Skip to content

Commit

Permalink
filetr to search version
Browse files Browse the repository at this point in the history
  • Loading branch information
ashu555 committed Feb 1, 2020
1 parent fb7a452 commit 39f664f
Show file tree
Hide file tree
Showing 16 changed files with 154 additions and 51 deletions.
27 changes: 26 additions & 1 deletion app/Http/Controllers/Order/ExtendedOrderController.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@ public function advanceSearch(
$till = '',
$domain = '',
$paidUnpaid = '',
$allInstallation = ''
$allInstallation = '',
$version = ''
) {
try {
$join = Order::leftJoin('subscriptions', 'orders.id', '=', 'subscriptions.order_id');
Expand All @@ -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',
Expand All @@ -70,6 +72,29 @@ public function advanceSearch(
}
}


/**
* Searches for order for selected versions
*
* @author Ashutosh Pathak <[email protected]>
*
*
* @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
*
Expand Down
8 changes: 5 additions & 3 deletions app/Http/Controllers/Order/OrderController.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand All @@ -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 "<input type='checkbox' class='order_checkbox' value=".
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ public function getGrandTotal($code, $total, $cost, $productid, $currency)
public function getMessage($items, $user_id)
{
if ($items) {
$this->sendmailClientAgent($user_id, $items->invoice_id);
// $this->sendmailClientAgent($user_id, $items->invoice_id);
$result = ['success' => \Lang::get('message.invoice-generated-successfully')];
} else {
$result = ['fails' => \Lang::get('message.can-not-generate-invoice')];
Expand Down
3 changes: 2 additions & 1 deletion app/Http/Controllers/RazorpayController.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,13 +46,14 @@ public function payWithRazorpay()
public function payment($invoice, Request $request)
{
//Input items of form
$input = Input::all();
$input = $request->all();
$success = true;
$error = 'Payment Failed';
$rzp_key = ApiKey::where('id', 1)->value('rzp_key');
$rzp_secret = ApiKey::where('id', 1)->value('rzp_secret');

$api = new Api($rzp_key, $rzp_secret);
dd($api->payment->fetch($input['razorpay_payment_id']));
$payment = $api->payment->fetch($input['razorpay_payment_id']);
if (count($input) && !empty($input['razorpay_payment_id'])) { //Verify Razorpay Payment Id and Signature

Expand Down
4 changes: 2 additions & 2 deletions resources/views/themes/default1/invoice/generate.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -134,10 +134,10 @@
{!! Form::text('code',null,['class'=>'form-control']) !!}
</div>
<div class="col-md-6 form-group">
<!-- <div class="col-md-6 form-group">
{!! Form::label('send_mail',Lang::get('message.send-mail')) !!}
<p>{!! Form::checkbox('client',1) !!} To Client&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{!! Form::checkbox('agent',1) !!} To Agent</p>
</div>
</div> -->
Expand Down
11 changes: 9 additions & 2 deletions resources/views/themes/default1/order/index.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,13 @@
</select>

</div>

<div class="col-md-3 form-group">
<!-- first name -->
{!! Form::label('version','Version') !!}
{!! Form::text('version',null,['class' => 'form-control','placeholder'=>'v3.0.0', 'id'=>'ver']) !!}

</div>
</div>

<div class='row'>
Expand All @@ -142,7 +149,7 @@
$('.payment_date').val('');
$('.payment_till').val('');
$('#domain').val('');
$('#ver').val('');
});
});
Expand Down Expand Up @@ -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: ",
Expand Down
2 changes: 2 additions & 0 deletions storage/installed
Original file line number Diff line number Diff line change
Expand Up @@ -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
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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()]);
}

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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]);
}
Expand All @@ -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]);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand All @@ -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');
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -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());

}

}

/**
Expand All @@ -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);
Expand All @@ -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);
Expand Down Expand Up @@ -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 ;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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" .
Expand All @@ -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" .
Expand All @@ -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);
Expand Down
5 changes: 4 additions & 1 deletion vendor/rachidlaasri/laravel-installer/src/Routes/web.php
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
<?php

Route::group(['prefix' => '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'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
});
}
Expand Down
Loading

0 comments on commit 39f664f

Please sign in to comment.