From 39f664f0dbe89b1a68292855a14a8c9711a91c71 Mon Sep 17 00:00:00 2001 From: ashu555 Date: Sat, 1 Feb 2020 12:52:04 +0530 Subject: [PATCH] filetr to search version --- .../Order/ExtendedOrderController.php | 27 ++++++- .../Controllers/Order/OrderController.php | 8 +- .../Order/TaxRatesAndCodeExpiryController.php | 2 +- app/Http/Controllers/RazorpayController.php | 3 +- .../default1/invoice/generate.blade.php | 4 +- .../themes/default1/order/index.blade.php | 11 ++- storage/installed | 2 + .../src/Config/installer.php | 2 +- .../src/Controllers/DatabaseController.php | 8 +- .../src/Controllers/EnvironmentController.php | 8 +- .../src/Controllers/FinalController.php | 18 +++-- .../src/Helpers/DatabaseManager.php | 24 ++++-- .../src/Helpers/EnvironmentManager.php | 8 +- .../laravel-installer/src/Routes/web.php | 5 +- ...001638_add_more_mail_columns_email_log.php | 1 + vendor/torann/currency/src/Currency.php | 74 +++++++++++++++---- 16 files changed, 154 insertions(+), 51 deletions(-) diff --git a/app/Http/Controllers/Order/ExtendedOrderController.php b/app/Http/Controllers/Order/ExtendedOrderController.php index 9ace84afc3..c8578f1ab1 100644 --- a/app/Http/Controllers/Order/ExtendedOrderController.php +++ b/app/Http/Controllers/Order/ExtendedOrderController.php @@ -39,7 +39,8 @@ public function advanceSearch( $till = '', $domain = '', $paidUnpaid = '', - $allInstallation = '' + $allInstallation = '', + $version = '' ) { try { $join = Order::leftJoin('subscriptions', 'orders.id', '=', 'subscriptions.order_id'); @@ -52,6 +53,7 @@ public function advanceSearch( $this->domain($domain, $join); $this->paidOrUnpaid($paidUnpaid,$join); $this->allInstallations($allInstallation,$join); + $this->getSelectedVersionOrders($version,$join); $join = $join->orderBy('created_at', 'desc') ->select( 'orders.id', @@ -70,6 +72,29 @@ public function advanceSearch( } } + + /** + * Searches for order for selected versions + * + * @author Ashutosh Pathak + * + * + * @param string $version + * @param App\Model\Order $join The order instance + * + * @return $join + */ + private function getSelectedVersionOrders($version,$join) + { + if($version) { + $currentVer = ($version[0] == 'v') ? $version : 'v'.$version; + $join = $join->whereHas('subscription', function($query) use($currentVer) { + $query->where('version', '=', $currentVer); + }); + } + return $join; + } + /** * Searches for Active/Inactive Installation * diff --git a/app/Http/Controllers/Order/OrderController.php b/app/Http/Controllers/Order/OrderController.php index 240e875722..113e9c2b6a 100755 --- a/app/Http/Controllers/Order/OrderController.php +++ b/app/Http/Controllers/Order/OrderController.php @@ -84,9 +84,10 @@ public function index(Request $request) $paidUnpaid = $request->input('p_un'); $paidUnpaid = $request->input('p_un'); $allInstallation = $request->input('act_ins'); + $version = $request->input('version'); return view('themes.default1.order.index', compact('products', 'order_no', 'product_id', - 'expiry', 'from', 'till', 'domain', 'expiryTill', 'paidUnpaid', 'allInstallation')); + 'expiry', 'from', 'till', 'domain', 'expiryTill', 'paidUnpaid', 'allInstallation','version')); } catch (\Exception $e) { Bugsnag::notifyExeption($e); @@ -105,9 +106,10 @@ public function getOrders(Request $request) $domain = $request->input('domain'); $paidUnpaid = $request->input('p_un'); $allInstallation = $request->input('act_ins'); - $query = $this->advanceSearch($order_no, $product_id, $expiry, $expiryTill, $from, $till, $domain, $paidUnpaid, $allInstallation); + $version = $request->input('version'); + $query = $this->advanceSearch($order_no, $product_id, $expiry, $expiryTill, $from, $till, $domain, $paidUnpaid, $allInstallation, $version); - return \DataTables::of($query->take(50)) + return \DataTables::of($query) ->setTotalRecords($query->count()) ->addColumn('checkbox', function ($model) { return " + diff --git a/resources/views/themes/default1/order/index.blade.php b/resources/views/themes/default1/order/index.blade.php index b420d7fc5c..44bf43fbad 100644 --- a/resources/views/themes/default1/order/index.blade.php +++ b/resources/views/themes/default1/order/index.blade.php @@ -116,6 +116,13 @@ + +
+ + {!! Form::label('version','Version') !!} + {!! Form::text('version',null,['class' => 'form-control','placeholder'=>'v3.0.0', 'id'=>'ver']) !!} + +
@@ -142,7 +149,7 @@ $('.payment_date').val(''); $('.payment_till').val(''); $('#domain').val(''); - + $('#ver').val(''); }); }); @@ -225,7 +232,7 @@ serverSide: true, stateSave: false, order: [[ 0, "desc" ]], - ajax: '{!! route('get-orders',"order_no=$order_no&product_id=$product_id&expiry=$expiry&expiryTill=$expiryTill&from=$from&till=$till&domain=$domain&p_un=$paidUnpaid&act_ins=$allInstallation" ) !!}', + ajax: '{!! route('get-orders',"order_no=$order_no&product_id=$product_id&expiry=$expiry&expiryTill=$expiryTill&from=$from&till=$till&domain=$domain&p_un=$paidUnpaid&act_ins=$allInstallation&version=$version" ) !!}', "oLanguage": { "sLengthMenu": "_MENU_ Records per page", "sSearch" : "Search: ", diff --git a/storage/installed b/storage/installed index 9ba8e01f09..d29f812ae5 100644 --- a/storage/installed +++ b/storage/installed @@ -16,3 +16,5 @@ Agora Invoicing Installer successfully UPDATED on 2019/04/16 12:42:54pm Agora Invoicing Installer successfully UPDATED on 2019/04/16 12:54:26pm Agora Invoicing Installer successfully UPDATED on 2019/04/16 01:40:00pm Agora Invoicing Installer successfully UPDATED on 2019/05/15 10:00:08am +Agora Invoicing Installer successfully UPDATED on 2020/01/31 08:44:08pm +Agora Invoicing Installer successfully UPDATED on 2020/01/31 08:50:43pm diff --git a/vendor/rachidlaasri/laravel-installer/src/Config/installer.php b/vendor/rachidlaasri/laravel-installer/src/Config/installer.php index a73e2bd7a9..8f70bfad87 100644 --- a/vendor/rachidlaasri/laravel-installer/src/Config/installer.php +++ b/vendor/rachidlaasri/laravel-installer/src/Config/installer.php @@ -76,7 +76,7 @@ 'database_port' => 'required|numeric', 'database_name' => 'required|string|max:50', 'database_username' => 'required|string|max:50', - 'database_password' => 'required|string|max:50', + // 'database_password' => 'required|string|max:50', 'broadcast_driver' => 'required|string|max:50', 'cache_driver' => 'required|string|max:50', 'session_driver' => 'required|string|max:50', diff --git a/vendor/rachidlaasri/laravel-installer/src/Controllers/DatabaseController.php b/vendor/rachidlaasri/laravel-installer/src/Controllers/DatabaseController.php index 04e81e2111..92c529c3df 100644 --- a/vendor/rachidlaasri/laravel-installer/src/Controllers/DatabaseController.php +++ b/vendor/rachidlaasri/laravel-installer/src/Controllers/DatabaseController.php @@ -27,9 +27,15 @@ public function __construct(DatabaseManager $databaseManager) */ public function database() { - $response = $this->databaseManager->migrateAndSeed(); + try { + $response = $this->databaseManager->migrateAndSeed(); return redirect()->route('LaravelInstaller::final') ->with(['message' => $response]); + } catch (\Exception $ex) { + return redirect()->route('LaravelInstaller::environmentWizard') + ->with(['fails' =>$ex->getMessage()]); + } + } } diff --git a/vendor/rachidlaasri/laravel-installer/src/Controllers/EnvironmentController.php b/vendor/rachidlaasri/laravel-installer/src/Controllers/EnvironmentController.php index 3d9665131c..83b5860222 100644 --- a/vendor/rachidlaasri/laravel-installer/src/Controllers/EnvironmentController.php +++ b/vendor/rachidlaasri/laravel-installer/src/Controllers/EnvironmentController.php @@ -6,7 +6,6 @@ use Illuminate\Http\Request; use Illuminate\Routing\Redirector; use RachidLaasri\LaravelInstaller\Helpers\EnvironmentManager; -use RachidLaasri\LaravelInstaller\Events\EnvironmentSaved; use Validator; use Illuminate\Validation\Rule; @@ -70,8 +69,6 @@ public function saveClassic(Request $input, Redirector $redirect) { $message = $this->EnvironmentManager->saveFileClassic($input); - event(new EnvironmentSaved($input)); - return $redirect->route('LaravelInstaller::environmentClassic') ->with(['message' => $message]); } @@ -94,13 +91,12 @@ public function saveWizard(Request $request, Redirector $redirect) if ($validator->fails()) { $errors = $validator->errors(); - return view('vendor.installer.environment-wizard', compact('errors', 'envConfig')); + return redirect()->back()->withInput()->withErrors($errors); + // return view('vendor.installer.environment-wizard', compact('errors')); } $results = $this->EnvironmentManager->saveFileWizard($request); - event(new EnvironmentSaved($request)); - return $redirect->route('LaravelInstaller::database') ->with(['results' => $results]); } diff --git a/vendor/rachidlaasri/laravel-installer/src/Controllers/FinalController.php b/vendor/rachidlaasri/laravel-installer/src/Controllers/FinalController.php index 46c45ff799..ef1f3008e9 100644 --- a/vendor/rachidlaasri/laravel-installer/src/Controllers/FinalController.php +++ b/vendor/rachidlaasri/laravel-installer/src/Controllers/FinalController.php @@ -6,7 +6,6 @@ use RachidLaasri\LaravelInstaller\Helpers\EnvironmentManager; use RachidLaasri\LaravelInstaller\Helpers\FinalInstallManager; use RachidLaasri\LaravelInstaller\Helpers\InstalledFileManager; -use RachidLaasri\LaravelInstaller\Events\LaravelInstallerFinished; class FinalController extends Controller { @@ -18,12 +17,17 @@ class FinalController extends Controller */ public function finish(InstalledFileManager $fileManager, FinalInstallManager $finalInstall, EnvironmentManager $environment) { - $finalMessages = $finalInstall->runFinal(); - $finalStatusMessage = $fileManager->update(); - $finalEnvFile = $environment->getEnvContent(); - - event(new LaravelInstallerFinished); + $env = base_path('.env'); + if (\File::exists($env)) { + file_put_contents($env,str_replace( - return view('vendor.installer.finished', compact('finalMessages', 'finalStatusMessage', 'finalEnvFile')); + "DB_INSTALL=0", "DB_INSTALL=1", file_get_contents($env) + )); + + $fileManager->update(); + + } + + return view('vendor.installer.finished'); } } diff --git a/vendor/rachidlaasri/laravel-installer/src/Helpers/DatabaseManager.php b/vendor/rachidlaasri/laravel-installer/src/Helpers/DatabaseManager.php index 899ad8aad2..c2da30f995 100644 --- a/vendor/rachidlaasri/laravel-installer/src/Helpers/DatabaseManager.php +++ b/vendor/rachidlaasri/laravel-installer/src/Helpers/DatabaseManager.php @@ -6,6 +6,7 @@ use Illuminate\Database\SQLiteConnection; use Illuminate\Support\Facades\Artisan; use Illuminate\Support\Facades\Config; +use Illuminate\Routing\Redirector; use Illuminate\Support\Facades\DB; use Symfony\Component\Console\Output\BufferedOutput; @@ -18,11 +19,17 @@ class DatabaseManager */ public function migrateAndSeed() { - $outputLog = new BufferedOutput; + try { + $outputLog = new BufferedOutput; - $this->sqlite($outputLog); + ($this->sqlite($outputLog)); return $this->migrate($outputLog); + } catch (\Exception $ex) { + throw new \Exception($ex->getMessage()); + + } + } /** @@ -37,7 +44,8 @@ private function migrate($outputLog) Artisan::call('migrate', ["--force"=> true], $outputLog); } catch(Exception $e){ - return $this->response($e->getMessage(), 'error', $outputLog); + throw new Exception('Cannot Establish Database Conection.Check Details'); + // return $this->response($e->getMessage()); } return $this->seed($outputLog); @@ -52,10 +60,10 @@ private function migrate($outputLog) private function seed($outputLog) { try{ - Artisan::call('db:seed', ['--force' => true], $outputLog); + Artisan::call('db:seed', [], $outputLog); } catch(Exception $e){ - return $this->response($e->getMessage(), 'error', $outputLog); + return $this->response($e->getMessage()); } return $this->response(trans('installer_messages.final.finished'), 'success', $outputLog); @@ -85,13 +93,15 @@ private function response($message, $status = 'danger', $outputLog) */ private function sqlite($outputLog) { - if(DB::connection() instanceof SQLiteConnection) { + if(DB::connection() instanceof SQLiteConnection) { $database = DB::connection()->getDatabaseName(); if(!file_exists($database)) { touch($database); DB::reconnect(Config::get('database.default')); } $outputLog->write('Using SqlLite database: ' . $database, 1); - } + } else { + return ; + } } } diff --git a/vendor/rachidlaasri/laravel-installer/src/Helpers/EnvironmentManager.php b/vendor/rachidlaasri/laravel-installer/src/Helpers/EnvironmentManager.php index dc933ff6b1..e2accfa48d 100644 --- a/vendor/rachidlaasri/laravel-installer/src/Helpers/EnvironmentManager.php +++ b/vendor/rachidlaasri/laravel-installer/src/Helpers/EnvironmentManager.php @@ -93,7 +93,7 @@ public function saveFileWizard(Request $request) $results = trans('installer_messages.environment.success'); $envFileData = - 'APP_NAME=\'' . $request->app_name . "'\n" . + 'APP_NAME=' . $request->app_name . "\n" . 'APP_ENV=' . $request->environment . "\n" . 'APP_KEY=' . 'base64:bODi8VtmENqnjklBmNJzQcTTSC8jNjBysfnjQN59btE=' . "\n" . 'APP_DEBUG=' . $request->app_debug . "\n" . @@ -104,7 +104,9 @@ public function saveFileWizard(Request $request) 'DB_PORT=' . $request->database_port . "\n" . 'DB_DATABASE=' . $request->database_name . "\n" . 'DB_USERNAME=' . $request->database_username . "\n" . + 'DB_PASSWORD=' . $request->database_password . "\n\n" . + 'DB_INSTALL=' ."0". "\n". 'BROADCAST_DRIVER=' . $request->broadcast_driver . "\n" . 'CACHE_DRIVER=' . $request->cache_driver . "\n" . 'SESSION_DRIVER=' . $request->session_driver . "\n" . @@ -120,7 +122,9 @@ public function saveFileWizard(Request $request) 'MAIL_ENCRYPTION=' . $request->mail_encryption . "\n\n" . 'PUSHER_APP_ID=' . $request->pusher_app_id . "\n" . 'PUSHER_APP_KEY=' . $request->pusher_app_key . "\n" . - 'PUSHER_APP_SECRET=' . $request->pusher_app_secret; + 'PUSHER_APP_SECRET=' . $request->pusher_app_secret. "\n" . + 'NOCAPTCHA_SECRET=' ."00". "\n". + 'NOCAPTCHA_SITEKEY=' ."00"; try { file_put_contents($this->envPath, $envFileData); diff --git a/vendor/rachidlaasri/laravel-installer/src/Routes/web.php b/vendor/rachidlaasri/laravel-installer/src/Routes/web.php index 3882a11614..d4b73133e3 100644 --- a/vendor/rachidlaasri/laravel-installer/src/Routes/web.php +++ b/vendor/rachidlaasri/laravel-installer/src/Routes/web.php @@ -1,11 +1,14 @@ 'install','as' => 'LaravelInstaller::','namespace' => 'RachidLaasri\LaravelInstaller\Controllers','middleware' => ['web', 'install']], function() { +Route::group(['prefix' => 'install','as' => 'LaravelInstaller::','namespace' => 'RachidLaasri\LaravelInstaller\Controllers'], function() { + + Route::get('/', [ 'as' => 'welcome', 'uses' => 'WelcomeController@welcome' ]); + Route::get('environment', [ 'as' => 'environment', 'uses' => 'EnvironmentController@environmentMenu' diff --git a/vendor/shvetsgroup/laravel-email-database-log/src/database/migrations/2017_11_10_001638_add_more_mail_columns_email_log.php b/vendor/shvetsgroup/laravel-email-database-log/src/database/migrations/2017_11_10_001638_add_more_mail_columns_email_log.php index 3c4916d719..55eb9d2af6 100644 --- a/vendor/shvetsgroup/laravel-email-database-log/src/database/migrations/2017_11_10_001638_add_more_mail_columns_email_log.php +++ b/vendor/shvetsgroup/laravel-email-database-log/src/database/migrations/2017_11_10_001638_add_more_mail_columns_email_log.php @@ -18,6 +18,7 @@ public function up() $table->string('cc')->after('to')->nullable(); $table->text('headers')->after('body')->nullable(); $table->text('attachments')->after('headers')->nullable(); + $table->text('status')->after('attachments')->nullable(); } }); } diff --git a/vendor/torann/currency/src/Currency.php b/vendor/torann/currency/src/Currency.php index db8a8e1c8c..227602e2fc 100644 --- a/vendor/torann/currency/src/Currency.php +++ b/vendor/torann/currency/src/Currency.php @@ -89,8 +89,7 @@ public function convert($amount, $from = null, $to = null, $format = true) // Convert amount if ($from === $to) { $value = $amount; - } - else { + } else { $value = ($amount * $to_rate) / $from_rate; } @@ -133,40 +132,84 @@ public function format($value, $code = null, $include_symbol = true) // Match decimal and thousand separators preg_match_all('/[\s\',.!]/', $format, $separators); - - if ($thousand = Arr::get($separators, '0.0', null)) { + + if ($thousand = array_get($separators, '0.0', null)) { if ($thousand == '!') { $thousand = ''; } } - - $decimal = Arr::get($separators, '0.1', null); - + + $decimal = array_get($separators, '0.1', null); // Match format for decimals count preg_match($valRegex, $format, $valFormat); - $valFormat = Arr::get($valFormat, 0, 0); - + $valFormat = array_get($valFormat, 0, 0); // Count decimals length $decimals = $decimal ? strlen(substr(strrchr($valFormat, $decimal), 1)) : 0; - + // Do we have a negative value? if ($negative = $value < 0 ? '-' : '') { $value = $value * -1; } - + + if ($code == 'INR') { + $value = $this->getIndianCurrencyFormat($value); + } else { + // $value = number_format($value, $decimals, $decimal, $thousand); + $value =number_format($value); + } // Format the value - $value = number_format($value, $decimals, $decimal, $thousand); + + + // dd($value); + // dd($value,$code); + // Apply the formatted measurement if ($include_symbol) { $value = preg_replace($valRegex, $value, $format); } - // Return value return $negative . $value; } + public function getIndianCurrencyFormat($number) + { + + $explrestunits = "" ; + $number = explode('.', $number); + $num = $number[0]; + if (strlen($num)>3) { + $lastthree = substr($num, strlen($num)-3, strlen($num)); + $restunits = substr($num, 0, strlen($num)-3); // extracts the last three digits + $restunits = (strlen($restunits)%2 == 1)?"0".$restunits:$restunits; // explodes the remaining digits in 2's formats, adds a zero in the beginning to maintain the 2's grouping. + $expunit = str_split($restunits, 2); + for ($i=0; $icurrencies_cache === null) { if (config('app.debug', false) === true) { $this->currencies_cache = $this->getDriver()->all(); - } - else { + } else { $this->currencies_cache = $this->cache->rememberForever('torann.currency', function () { return $this->getDriver()->all(); }); @@ -254,7 +296,7 @@ public function getCurrencies() */ public function getActiveCurrencies() { - return array_filter($this->getCurrencies(), function($currency) { + return array_filter($this->getCurrencies(), function ($currency) { return $currency['active'] == true; }); }