From a92e94398c21854c1b9d3e8b8d6aea76e2b04bce Mon Sep 17 00:00:00 2001 From: Deon George Date: Sun, 9 Feb 2020 16:48:03 +1100 Subject: [PATCH] Putback user::site(), add heading for order emails --- .gitlab-ci.yml | 1 - app/Http/Controllers/OrderController.php | 4 ++- app/Mail/OrderRequest.php | 6 ++-- app/User.php | 10 +++++++ .../adminlte/r/invoice/widget/next.blade.php | 30 +++++++++++++++++++ .../views/email/admin/order/approve.blade.php | 2 +- 6 files changed, 48 insertions(+), 5 deletions(-) create mode 100644 resources/theme/backend/adminlte/r/invoice/widget/next.blade.php diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index afbcd3f..59e17a8 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -20,7 +20,6 @@ variables: cache: paths: - vendor/ - - node_modules/ # This is a basic example for a gem or script which doesn't use # services such as redis or postgres diff --git a/app/Http/Controllers/OrderController.php b/app/Http/Controllers/OrderController.php index 00fbc3c..9fef49a 100644 --- a/app/Http/Controllers/OrderController.php +++ b/app/Http/Controllers/OrderController.php @@ -117,7 +117,9 @@ class OrderController extends Controller $options->save(); } - Mail::to('help@graytech.net.au')->queue((new OrderRequest($so,$request->input('options.notes')))->onQueue('email')); //@todo Get email from DB. + Mail::to('help@graytech.net.au') + ->queue((new OrderRequest($so,$request->input('options.notes')))->onQueue('email')); //@todo Get email from DB. + return view('order_received',['o'=>$so]); } } \ No newline at end of file diff --git a/app/Mail/OrderRequest.php b/app/Mail/OrderRequest.php index 90f1466..13dcd54 100644 --- a/app/Mail/OrderRequest.php +++ b/app/Mail/OrderRequest.php @@ -37,10 +37,12 @@ class OrderRequest extends Mailable { switch (get_class($this->service->type)) { - case 'App\Models\Service\Adsl': $subject = sprintf('NBN: %s',$this->service->type->service_address); + case 'App\Models\Service\Adsl': + $subject = sprintf('NBN: %s',$this->service->type->service_address); break; - case 'App\Models\Service\Voip': $subject = sprintf('VOIP: %s',$this->service->type->service_number); + case 'App\Models\Service\Voip': + $subject = sprintf('VOIP: %s',$this->service->type->service_number); break; default: diff --git a/app/User.php b/app/User.php index 35a017f..afa9b3c 100644 --- a/app/User.php +++ b/app/User.php @@ -133,6 +133,16 @@ class User extends Authenticatable ->with(['account','product','invoices.items.tax','type']); } + /** + * The site this user is configured to access + * + * @return \Illuminate\Database\Eloquent\Relations\BelongsTo + */ + public function site() + { + return $this->belongsTo(Site::class); + } + /** * This users supplier/reseller * diff --git a/resources/theme/backend/adminlte/r/invoice/widget/next.blade.php b/resources/theme/backend/adminlte/r/invoice/widget/next.blade.php new file mode 100644 index 0000000..f1c0a8a --- /dev/null +++ b/resources/theme/backend/adminlte/r/invoice/widget/next.blade.php @@ -0,0 +1,30 @@ + + + @foreach (($x=$o->next_invoice_items($future))->groupBy('product_id') as $id => $oo) + + + + + + @foreach ($oo->groupBy('service_id') as $ooo) + + + + + + @foreach ($ooo as $io) + + + + + + + @endforeach + @endforeach + @endforeach + + + + + +
{{ $oo->first()->product->name }}${{ number_format($oo->sum('total'),2) }}
{{ $ooo->first()->service->sid }}{{ $ooo->first()->service->sname }}: {{ $ooo->first()->service->sdesc }}
  {{ $io->item_type_name }}${{ number_format($io->total,2) }}
TOTAL${{ number_format($x->sum('total'),2) }}
\ No newline at end of file diff --git a/resources/views/email/admin/order/approve.blade.php b/resources/views/email/admin/order/approve.blade.php index c8672af..430a806 100644 --- a/resources/views/email/admin/order/approve.blade.php +++ b/resources/views/email/admin/order/approve.blade.php @@ -1,4 +1,4 @@ -@component('mail::message',['site'=>$site]) +@component('mail::message',['site'=>$site,'heading'=>'Please Order the following...']) # Please order the following service. @component('mail::panel')