From 37556eb3c5bc5d81aeb39b83234ce64bb64bd2fa Mon Sep 17 00:00:00 2001 From: ashu555 Date: Wed, 10 Apr 2019 15:41:01 +0530 Subject: [PATCH 01/16] Validation for Mobile Nos --- app/Http/Controllers/BaseHomeController.php | 2 +- app/Http/Controllers/Front/CartController.php | 1 - .../Controllers/License/LicenseController.php | 2 +- .../Order/ExtendedBaseInvoiceController.php | 7 +- .../Controllers/Order/InvoiceController.php | 7 +- .../Product/ExtendedBaseProductController.php | 4 +- .../Controllers/Product/ProductController.php | 2 +- .../User/AdminOrderInvoiceController.php | 4 +- app/Http/Requests/User/ClientRequest.php | 2 +- config/database.php | 2 +- ...017_06_10_062630_create_products_table.php | 4 +- .../2017_06_10_062630_create_users_table.php | 6 +- public/robots.txt | 4 +- .../front/auth/login-register.blade.php | 88 +++++++++++++++++-- .../default1/front/clients/profile.blade.php | 77 ++++++++++------ .../front/clients/show-order.blade.php | 2 +- .../default1/invoice/editInvoice.blade.php | 22 +++-- .../default1/invoice/generate.blade.php | 24 ++++- .../themes/default1/invoice/show.blade.php | 13 ++- .../default1/user/client/create.blade.php | 55 +++++++++--- .../default1/user/client/edit.blade.php | 69 ++++++++++----- storage/installed | 1 + 22 files changed, 291 insertions(+), 107 deletions(-) diff --git a/app/Http/Controllers/BaseHomeController.php b/app/Http/Controllers/BaseHomeController.php index 36268c2137..e0ff342f80 100644 --- a/app/Http/Controllers/BaseHomeController.php +++ b/app/Http/Controllers/BaseHomeController.php @@ -159,7 +159,7 @@ public function checkUpdatesExpiry(Request $request) $orderId = Order::where('number', 'LIKE', $order_number)->pluck('id')->first(); if ($orderId) { $expiryDate = Subscription::where('order_id', $orderId)->pluck('update_ends_at')->first(); - if (\Carbon\Carbon::now()->toDateTimeString() < $expiryDate->toDateTimeString()) { + if (\Carbon\Carbon::now()->toDateTimeString() < $expiryDate) { return ['status' => 'success', 'message' => 'allow-auto-update']; } } diff --git a/app/Http/Controllers/Front/CartController.php b/app/Http/Controllers/Front/CartController.php index e3721b4771..4abc663356 100755 --- a/app/Http/Controllers/Front/CartController.php +++ b/app/Http/Controllers/Front/CartController.php @@ -105,7 +105,6 @@ public function cart(Request $request) $items = $this->addProduct($id); \Cart::add($items); //Add Items To the Cart Collection } - return redirect('show/cart'); } catch (\Exception $ex) { app('log')->error($ex->getMessage()); diff --git a/app/Http/Controllers/License/LicenseController.php b/app/Http/Controllers/License/LicenseController.php index 067ad4feed..88a4b4cd94 100644 --- a/app/Http/Controllers/License/LicenseController.php +++ b/app/Http/Controllers/License/LicenseController.php @@ -143,7 +143,7 @@ public function createNewLicene($orderid, $product, $user_id, $orderNo = $order->number; $domain = $order->domain; $productId = $this->searchProductId($sku); - $addLicense = $this->postCurl($url, "api_key_secret=$api_key_secret&api_function=licenses_add&product_id=$productId&license_code=$serial_key&license_require_domain=1&license_status=1&license_order_number=$orderNo&license_domain=$domain&license_limit=2&license_expire_date=$licenseExpiry&license_updates_date=$updatesExpiry&license_support_date=$supportExpiry&license_disable_ip_verification=0"); + $addLicense = $this->postCurl($url, "api_key_secret=$api_key_secret&api_function=licenses_add&product_id=$productId&license_code=$serial_key&license_require_domain=1&license_status=1&license_order_number=$orderNo&license_domain=$domain&license_limit=6&license_expire_date=$licenseExpiry&license_updates_date=$updatesExpiry&license_support_date=$supportExpiry&license_disable_ip_verification=0"); } /* diff --git a/app/Http/Controllers/Order/ExtendedBaseInvoiceController.php b/app/Http/Controllers/Order/ExtendedBaseInvoiceController.php index 392fc07e70..0e286d9a35 100644 --- a/app/Http/Controllers/Order/ExtendedBaseInvoiceController.php +++ b/app/Http/Controllers/Order/ExtendedBaseInvoiceController.php @@ -68,17 +68,19 @@ public function edit($invoiceid, Request $request) { $totalSum = '0'; $invoice = Invoice::where('id', $invoiceid)->first(); + $date = date('m/d/Y', strtotime($invoice->date)); $payment = Payment::where('invoice_id', $invoiceid)->pluck('amount')->toArray(); if ($payment) { $totalSum = array_sum($payment); } - return view('themes.default1.invoice.editInvoice', compact('userid', 'invoiceid', 'invoice', 'totalSum')); + return view('themes.default1.invoice.editInvoice', compact('userid','date','invoiceid', 'invoice', 'totalSum')); } public function postEdit($invoiceid, Request $request) { $this->validate($request, [ + 'date' => 'required', 'total' => 'required', 'status'=> 'required', ]); @@ -87,7 +89,8 @@ public function postEdit($invoiceid, Request $request) $total = $request->input('total'); $status = $request->input('status'); $paid = $request->input('paid'); - $invoice = Invoice::where('id', $invoiceid)->update(['grand_total'=>$total, 'status'=>$status]); + $invoice = Invoice::where('id', $invoiceid)->update(['grand_total'=>$total, 'status'=>$status, + 'date'=>\Carbon\Carbon::parse($request->input('date'))]); $order = Order::where('invoice_id', $invoiceid)->update(['price_override'=>$total]); return redirect()->back()->with('success', \Lang::get('message.updated-successfully')); diff --git a/app/Http/Controllers/Order/InvoiceController.php b/app/Http/Controllers/Order/InvoiceController.php index f2f9db4614..ab516886ff 100755 --- a/app/Http/Controllers/Order/InvoiceController.php +++ b/app/Http/Controllers/Order/InvoiceController.php @@ -360,8 +360,9 @@ public function createInvoiceItems($invoiceid, $cart, $codevalue = '') public function invoiceGenerateByForm(Request $request, $user_id = '') { - $this->validate($request, [ - + $this->validate($request, [ + 'date' => 'required', + 'domain' => 'sometimes|nullable|regex:/^(?!:\/\/)(?=.{1,255}$)((.{1,63}\.){1,127}(?![0-9]*$)[a-z0-9-]+\.?)$/i', 'plan' => 'required_if:subscription,true', 'price' => 'required', ], [ @@ -392,7 +393,7 @@ public function invoiceGenerateByForm(Request $request, $user_id = '') $userCurrency = $controller->currency($user_id); $currency = $userCurrency['currency']; $number = rand(11111111, 99999999); - $date = \Carbon\Carbon::now(); + $date = \Carbon\Carbon::parse($request->input('date')); $product = Product::find($productid); $cost = $controller->cost($productid, $user_id, $plan); $grand_total = $this->getGrandTotal($code, $total, $cost, $productid, $currency); diff --git a/app/Http/Controllers/Product/ExtendedBaseProductController.php b/app/Http/Controllers/Product/ExtendedBaseProductController.php index bdb62b09c2..31dff8e0c5 100644 --- a/app/Http/Controllers/Product/ExtendedBaseProductController.php +++ b/app/Http/Controllers/Product/ExtendedBaseProductController.php @@ -118,10 +118,10 @@ public function getProductField(int $productid) $product = Product::find($productid); if ($product->require_domain == 1) { $field .= "
-
"; } diff --git a/app/Http/Controllers/Product/ProductController.php b/app/Http/Controllers/Product/ProductController.php index 60818a2f4f..7bbaabb4cf 100755 --- a/app/Http/Controllers/Product/ProductController.php +++ b/app/Http/Controllers/Product/ProductController.php @@ -316,7 +316,7 @@ public function store(Request $request) app('log')->error($e->getMessage()); Bugsnag::notifyException($e); - return redirect()->with('fails', $e->getMessage()); + return redirect()->back()->with('fails', $e->getMessage()); } } diff --git a/app/Http/Controllers/User/AdminOrderInvoiceController.php b/app/Http/Controllers/User/AdminOrderInvoiceController.php index 01f94f28d5..b92a2a9d6a 100644 --- a/app/Http/Controllers/User/AdminOrderInvoiceController.php +++ b/app/Http/Controllers/User/AdminOrderInvoiceController.php @@ -20,8 +20,8 @@ public function getClientInvoice($id) }) ->addColumn('date', function ($model) use ($client) { $date1 = new \DateTime($model->date); - // $tz = \Auth::user()->timezone()->first()->name; - // $date1->setTimezone(new \DateTimeZone($tz)); + $tz = \Auth::user()->timezone()->first()->name; + $date1->setTimezone(new \DateTimeZone($tz)); $date = $date1->format('M j, Y, g:i a '); return $date; diff --git a/app/Http/Requests/User/ClientRequest.php b/app/Http/Requests/User/ClientRequest.php index c24e6d6bf7..706cfede5f 100755 --- a/app/Http/Requests/User/ClientRequest.php +++ b/app/Http/Requests/User/ClientRequest.php @@ -31,7 +31,7 @@ public function rules() 'email' => 'required|email|unique:users', 'mobile' => 'required|numeric', 'bussiness' => 'required', - + 'timezone_id' => 'required', 'address' => 'required', 'zip' => 'required', 'user_name' => 'required|unique:users,user_name', diff --git a/config/database.php b/config/database.php index 586c76432d..13139f3b33 100644 --- a/config/database.php +++ b/config/database.php @@ -64,7 +64,7 @@ 'charset' => 'utf8', 'collation' => 'utf8_unicode_ci', 'prefix' => '', - 'strict' => false, + 'strict' => true, 'engine' => 'Innodb', ], diff --git a/database/migrations/2017_06_10_062630_create_products_table.php b/database/migrations/2017_06_10_062630_create_products_table.php index b2b6cfa395..7c60e2c2df 100644 --- a/database/migrations/2017_06_10_062630_create_products_table.php +++ b/database/migrations/2017_06_10_062630_create_products_table.php @@ -18,8 +18,8 @@ public function up() $table->string('description', 2000); $table->string('category', 225); $table->integer('parent'); - $table->integer('type')->unsigned()->index('products_type_foreign'); - $table->integer('group')->unsigned()->index('products_group_foreign'); + $table->integer('type')->nullable(); + $table->integer('group')->nullable(); $table->string('welcome_email'); $table->integer('require_domain'); $table->boolean('can_modify_agent')->nullable(); diff --git a/database/migrations/2017_06_10_062630_create_users_table.php b/database/migrations/2017_06_10_062630_create_users_table.php index e108beea7f..830ed800c8 100644 --- a/database/migrations/2017_06_10_062630_create_users_table.php +++ b/database/migrations/2017_06_10_062630_create_users_table.php @@ -29,11 +29,11 @@ public function up() $table->string('town'); $table->string('state')->nullable()->default('IN-KA'); $table->string('zip'); - $table->string('profile_pic'); + $table->string('profile_pic')->nullable(); $table->integer('active'); $table->string('role')->default('client'); $table->string('currency', 225)->default('INR'); - $table->decimal('debit', 10, 0); + $table->decimal('debit', 10, 0)->nullable(); $table->integer('timezone_id')->default(114); $table->string('remember_token', 100)->nullable(); $table->timestamps(); @@ -42,7 +42,7 @@ public function up() $table->integer('mobile_verified'); $table->string('position', 225)->nullable(); $table->string('skype', 225)->nullable(); - $table->integer('manager')->nullable(); + $table->string('manager')->nullable(); }); } diff --git a/public/robots.txt b/public/robots.txt index eb0536286f..ed5e54ea67 100644 --- a/public/robots.txt +++ b/public/robots.txt @@ -1,2 +1,2 @@ -User-agent: * -Disallow: +User-agent: AhrefsBot +Disallow: / \ No newline at end of file diff --git a/resources/views/themes/default1/front/auth/login-register.blade.php b/resources/views/themes/default1/front/auth/login-register.blade.php index 4fea035642..18b200e63b 100644 --- a/resources/views/themes/default1/front/auth/login-register.blade.php +++ b/resources/views/themes/default1/front/auth/login-register.blade.php @@ -311,6 +311,8 @@ {!! Form::hidden('mobile',null,['id'=>'mobile_code_hidden']) !!} {!! Form::hidden('mobile_code',null,['class'=>'form-control input-lg','disabled','id'=>'mobile_code']) !!} + +
@@ -504,7 +506,8 @@
- + +
@@ -592,7 +595,14 @@ @stop @section('script') + +