From a9f81373fadf1b7825cc80a49226fa836d0ef5d4 Mon Sep 17 00:00:00 2001 From: Deon George Date: Fri, 9 Jul 2021 11:39:27 +1000 Subject: [PATCH] Fixes for ordering --- app/Http/Controllers/OrderController.php | 23 +- app/Traits/OrderServiceOptions.php | 2 +- .../theme/frontend/metronic/order.blade.php | 458 +++++++++--------- .../metronic/order_received.blade.php | 14 +- routes/web.php | 9 +- 5 files changed, 255 insertions(+), 251 deletions(-) diff --git a/app/Http/Controllers/OrderController.php b/app/Http/Controllers/OrderController.php index eb1503f..624a84f 100644 --- a/app/Http/Controllers/OrderController.php +++ b/app/Http/Controllers/OrderController.php @@ -40,9 +40,7 @@ class OrderController extends Controller public function submit(Request $request) { - Validator::make($request->all(),[ - 'product_id'=>'required|exists:ab_product,id', - ]) + Validator::make($request->all(),['product_id'=>'required|exists:ab_product,id']) // Reseller ->sometimes('account_id','required|email',function($input) use ($request) { return is_null($input->account_id) AND is_null($input->order_email_manual); @@ -63,15 +61,13 @@ class OrderController extends Controller // Check we have the custom attributes for the product $options = $po->orderValidation($request); - if ($request->input('order_email_manual')) - { + if ($request->input('order_email_manual')) { $uo = User::firstOrNew(['email'=>$request->input('order_email_manual')]); // If this is a new client - if (! $uo->exists) - { + if (! $uo->exists) { // @todo Make this automatic - $uo->site_id = config('SITE')->id; + $uo->site_id = config('SITE')->site_id; $uo->active = FALSE; $uo->firstname = ''; $uo->lastname = ''; @@ -83,12 +79,11 @@ class OrderController extends Controller } // If we have a new account. - if (is_null($request->input('account_id'))) - { + if (is_null($request->input('account_id'))) { $ao = new Account; //$ao->id = Account::NextId(); // @todo Make this automatic - $ao->site_id = config('SITE')->id; + $ao->site_id = config('SITE')->site_id; $ao->country_id = config('SITE')->country_id; // @todo This might be wrong $ao->language_id = config('SITE')->language_id; // @todo This might be wrong $ao->currency_id = config('SITE')->currency_id; // @todo This might be wrong @@ -102,15 +97,15 @@ class OrderController extends Controller $so = new Service; // @todo Make this automatic - $so->site_id = config('SITE')->id; + $so->site_id = config('SITE')->site_id; $so->product_id = $request->input('product_id'); $so->order_status = 'ORDER-SUBMIT'; $so->orderby_id = Auth::id(); $so->model = get_class($options); - if ($options->order_info) - { + if ($options->order_info) { $so->order_info = $options->order_info; + unset($options->order_info); } diff --git a/app/Traits/OrderServiceOptions.php b/app/Traits/OrderServiceOptions.php index e7b4148..24781b4 100644 --- a/app/Traits/OrderServiceOptions.php +++ b/app/Traits/OrderServiceOptions.php @@ -43,7 +43,7 @@ trait OrderServiceOptions $o->forceFill(array_undot($x)); // @todo Make this automatic - $o->site_id = config('SITE')->id; + $o->site_id = config('SITE')->site_id; return $o; } diff --git a/resources/views/theme/frontend/metronic/order.blade.php b/resources/views/theme/frontend/metronic/order.blade.php index 2229619..d9496c7 100644 --- a/resources/views/theme/frontend/metronic/order.blade.php +++ b/resources/views/theme/frontend/metronic/order.blade.php @@ -1,263 +1,267 @@ -@extends('layouts.app') +@extends('metronic::layouts.app') @section('htmlheader_title') - {{ trans('message.home') }} + Order Service @endsection @section('main-content') -
-

Order Service

+
+
+
+

Order Service

-
-
-
- -
+
+
+
+ +
-
-
-
-
-
- {{ csrf_field() }} +
+
+
+
+ + {{ csrf_field() }} -
- - @if (Auth::user() AND Auth::user()->isReseller()) -
-
-

- Account -

-
+
+ + @if (Auth::user() AND Auth::user()->isReseller()) +
+
+

+ Account +

+
-
-
-
+
+
+
-
- +
+ -
-
-
- - - {{ $errors->first('account_id') }} +
+
+
+ + + {{ $errors->first('account_id') }} +
+
+ +
+
+ + + {{ $errors->first('order_email_manual') }} +
+
+
-
+
+
+
+
+
+
+
+ + + @elseif (Auth::user()) +
+
+

+ Account +

+
+ +
+
+
+ +
+ + +
+
+
+ + + {{ $errors->first('account_id') }} +
+
+ +
+
+ + + {{ $errors->first('account_name') }} +
+
+
+
+
+ +
+
+
+
+
+
+
+ + + @else + @php + //dd($errors); + @endphp +
+
+

+ Account +

+
+ +
+
+
+
- - + + {{ $errors->first('order_email_manual') }}
-
-
-
-
-
-
-
-
-
- - - @elseif (Auth::user()) -
-
-

- Account -

-
- -
-
-
- -
- - -
-
-
- - - {{ $errors->first('account_id') }} -
-
- -
-
- - - {{ $errors->first('account_name') }} -
-
+
+
+
- -
-
-
-
-
-
+ @endif - - @else - @php - //dd($errors); - @endphp -
-
-

- Account -

-
+ +
+
+

Product

+
-
-
-
-
-
- - - {{ $errors->first('order_email_manual') }} +
+
+
+
+ {{ $errors->first('product_options') }} +
+ +
+ + + {{ $errors->first('product_id') }} +
+
+ @if (old('product_id')) + @include('widgets.product_description',['o'=>$po]) + @endif
-
-
-
-
+
+ @if (old('product_id')) + @include('widgets.product_order',['o'=>$po]) + @endif +
+ +
+
+
+
+ +
+ + +
+
+

Notes

+
+ +
+
+
+
+ + + {{ $errors->first('options.notes') }} +
+
+ +
+
+
+
+
+
+
- @endif - - -
-
-

Product

-
- -
-
-
-
- {{ $errors->first('product_options') }} -
- -
- - - {{ $errors->first('product_id') }} -
-
- @if (old('product_id')) - @include('widgets.product_description',['o'=>$po]) - @endif -
-
- -
- @if (old('product_id')) - @include('widgets.product_order',['o'=>$po]) - @endif -
- -
-
-
-
-
-
- -
- - -
-
-

Notes

-
- -
-
-
-
- - - {{ $errors->first('options.notes') }} -
-
- -
-
-
-
-
-
- -
+
- -
-
+
-
+
+
+
@@ -267,8 +271,8 @@ @endsection @section('page-scripts') - @js('/plugin/jqBootstrapValidation/jqBootstrapValidation.js','jq-validation','jquery') - + @js('plugin/jqBootstrapValidation/jqBootstrapValidation.js','jq-validation','jquery') + @js('//code.jquery.com/ui/1.12.1/jquery-ui.js','jquery-ui-js','jqery')