From 8402e4fcb6d66defbb6158ab4d80062461d016f0 Mon Sep 17 00:00:00 2001 From: Deon George Date: Thu, 24 Jan 2019 20:12:00 +1100 Subject: [PATCH] Added Service Reference for SUBMIT-SENT --- app/Http/Controllers/AdminHomeController.php | 4 ++ app/Models/Service.php | 15 ++++++- ..._01_24_175606_create_failed_jobs_table.php | 35 +++++++++++++++ .../backend/adminlte/a/service.blade.php | 12 ++++- .../a/widgets/service/order/sent.blade.php | 44 +++++++++++++++++++ .../backend/adminlte/u/service.blade.php | 36 +++++++++++++++ .../info.blade.php} | 0 .../u/widgets/service/order/sent.blade.php | 44 +++++++++++++++++++ 8 files changed, 186 insertions(+), 4 deletions(-) create mode 100644 database/migrations/2019_01_24_175606_create_failed_jobs_table.php create mode 100644 resources/theme/backend/adminlte/a/widgets/service/order/sent.blade.php create mode 100644 resources/theme/backend/adminlte/u/service.blade.php rename resources/theme/backend/adminlte/u/widgets/{service_info.blade.php => service/info.blade.php} (100%) create mode 100644 resources/theme/backend/adminlte/u/widgets/service/order/sent.blade.php diff --git a/app/Http/Controllers/AdminHomeController.php b/app/Http/Controllers/AdminHomeController.php index 92cda31..19b8818 100644 --- a/app/Http/Controllers/AdminHomeController.php +++ b/app/Http/Controllers/AdminHomeController.php @@ -49,6 +49,10 @@ class AdminHomeController extends Controller $o->nextStatus($action); break; + case 'update_reference': + $o->order_info = array_merge($o->order_info ? $o->order_info : [],['order_reference'=>$request->input('notes')]); + $o->save(); + // No action specified. default: return $this->service($o); diff --git a/app/Models/Service.php b/app/Models/Service.php index 7f5717a..30bccda 100644 --- a/app/Models/Service.php +++ b/app/Models/Service.php @@ -57,6 +57,7 @@ class Service extends Model private $valid_status = [ 'ORDER-SUBMIT' => ['approve'=>'ORDER-SENT','reject'=>'ORDER-REJECTED'], + 'ORDER-SENT' => ['update_reference'=>'ORDER-SENT'], ]; public function account() @@ -175,7 +176,12 @@ class Service extends Model $result = ''; foreach ($this->order_info as $k=>$v) + { + if (in_array($k,['order_reference'])) + continue; + $result .= sprintf('%s: %s
',ucfirst($k),$v); + } return $result; } @@ -198,7 +204,7 @@ class Service extends Model public function getServiceIdUrlAttribute() { - return sprintf('%s',$this->id,$this->service_id); + return sprintf('%s',$this->id,$this->service_id); } public function getServiceNumberAttribute() @@ -208,7 +214,12 @@ class Service extends Model public function getStatusAttribute() { - return $this->order_status ? $this->order_status : ( $this->active ? 'Active' : 'Inactive'); + if (! $this->order_status) + return $this->active ? 'Active' : 'Inactive'; + + return $this->order_status=='ORDER-SENT' + ? sprintf('%s: #%s',$this->order_status,array_get($this->order_info,'order_reference','Unknown')) + : $this->order_status; } public function setDateOrigAttribute($value) diff --git a/database/migrations/2019_01_24_175606_create_failed_jobs_table.php b/database/migrations/2019_01_24_175606_create_failed_jobs_table.php new file mode 100644 index 0000000..d432dff --- /dev/null +++ b/database/migrations/2019_01_24_175606_create_failed_jobs_table.php @@ -0,0 +1,35 @@ +bigIncrements('id'); + $table->text('connection'); + $table->text('queue'); + $table->longText('payload'); + $table->longText('exception'); + $table->timestamp('failed_at')->useCurrent(); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::dropIfExists('failed_jobs'); + } +} diff --git a/resources/theme/backend/adminlte/a/service.blade.php b/resources/theme/backend/adminlte/a/service.blade.php index ffa3eda..834b24b 100644 --- a/resources/theme/backend/adminlte/a/service.blade.php +++ b/resources/theme/backend/adminlte/a/service.blade.php @@ -22,13 +22,16 @@
-
@switch($o->order_status) @case('ORDER-SUBMIT') @include('a.widgets.service.order.submit') @break + @case('ORDER-SENT') + @include('a.widgets.service.order.sent') + @break + @default @include('u.widgets.service_info') @endswitch @@ -47,9 +50,14 @@ @break; + + @case('ORDER-SENT') + + @break; + @endswitch - + {{-- --}}
diff --git a/resources/theme/backend/adminlte/a/widgets/service/order/sent.blade.php b/resources/theme/backend/adminlte/a/widgets/service/order/sent.blade.php new file mode 100644 index 0000000..2c9aa72 --- /dev/null +++ b/resources/theme/backend/adminlte/a/widgets/service/order/sent.blade.php @@ -0,0 +1,44 @@ +
+
+

New Order

+
+ + +
+
+ +
+ + + + + + + + @if($o->date_last_invoice) + + + + + + + + + + @endif + + + + + + +
Account{{ $o->account->company }}
Product{{ $o->product->name }}
Last Invoice{{ $o->date_last_invoice }}
Paid Until{{ 'TBA' }}
Next Invoice{{ $o->date_next_invoice }}
Order Details{!! $o->order_info_details !!}
Reference:
+
+ + {{-- + + --}} +
\ No newline at end of file diff --git a/resources/theme/backend/adminlte/u/service.blade.php b/resources/theme/backend/adminlte/u/service.blade.php new file mode 100644 index 0000000..1fbff21 --- /dev/null +++ b/resources/theme/backend/adminlte/u/service.blade.php @@ -0,0 +1,36 @@ +@extends('adminlte::layouts.app') + +@section('htmlheader_title') + Service #{{ $o->id }} +@endsection + +@section('contentheader_title') + Service # +@endsection +@section('contentheader_description') + {{ $o->service_id }} +@endsection + +@section('main-content') +
+
+
+

Service Information

+
+ +
+
+ @switch($o->order_status) + @case('ORDER-SUBMIT') + @case('ORDER-SENT') + @include('u.widgets.service.order.sent') + @break + + @default + @include('u.widgets.service.info') + @endswitch +
+
+
+
+@endsection \ No newline at end of file diff --git a/resources/theme/backend/adminlte/u/widgets/service_info.blade.php b/resources/theme/backend/adminlte/u/widgets/service/info.blade.php similarity index 100% rename from resources/theme/backend/adminlte/u/widgets/service_info.blade.php rename to resources/theme/backend/adminlte/u/widgets/service/info.blade.php diff --git a/resources/theme/backend/adminlte/u/widgets/service/order/sent.blade.php b/resources/theme/backend/adminlte/u/widgets/service/order/sent.blade.php new file mode 100644 index 0000000..47b3806 --- /dev/null +++ b/resources/theme/backend/adminlte/u/widgets/service/order/sent.blade.php @@ -0,0 +1,44 @@ +
+
+

New Order

+
+ + +
+
+ +
+ + + + + + + + @if($o->date_last_invoice) + + + + + + + + + + @endif + + + + + + +
Account{{ $o->account->company }}
Product{{ $o->product->name }}
Last Invoice{{ $o->date_last_invoice }}
Paid Until{{ 'TBA' }}
Next Invoice{{ $o->date_next_invoice }}
Order Details{!! $o->order_info_details !!}
Reference:{{ array_get($o->order_info,'order_reference','') }}
+
+ + {{-- + + --}} +
\ No newline at end of file