From 3b40e92c4822ea208cea9aac3ab93033d4a1e233 Mon Sep 17 00:00:00 2001 From: Deon George Date: Fri, 16 Aug 2024 08:20:58 +1000 Subject: [PATCH] Improvements for service_change and service_cancel --- app/Http/Controllers/ServiceController.php | 7 +- app/Mail/CancelRequest.php | 10 +- app/Mail/ChangeRequest.php | 12 +- app/Models/Charge.php | 3 +- .../a/charge/service_change.blade.php | 33 ----- .../adminlte/service/cancel_request.blade.php | 73 +++------- .../adminlte/service/change_charge.blade.php | 29 ++++ .../adminlte/service/change_pending.blade.php | 133 +++++------------- .../adminlte/service/change_request.blade.php | 81 ++++------- .../service/widget/broadband/change.blade.php | 34 +---- .../service/widget/information.blade.php | 12 +- .../metronic/order/widget/info/base.blade.php | 86 +++++------ 12 files changed, 186 insertions(+), 327 deletions(-) delete mode 100644 resources/views/theme/backend/adminlte/a/charge/service_change.blade.php create mode 100644 resources/views/theme/backend/adminlte/service/change_charge.blade.php diff --git a/app/Http/Controllers/ServiceController.php b/app/Http/Controllers/ServiceController.php index 384e1d0..80c7691 100644 --- a/app/Http/Controllers/ServiceController.php +++ b/app/Http/Controllers/ServiceController.php @@ -330,9 +330,8 @@ class ServiceController extends Controller $start_at = Carbon::create(Arr::get($request->broadband,'start_at')); // Get the invoiced items covering the start_at date - foreach ($o->invoiced_items->filter(function($item) use ($start_at) { - return ($item->start_at < $start_at) && ($item->stop_at > $start_at) && ($item->item_type === 0); - }) as $iio) + foreach ($o->invoiced_items + ->filter(fn($item)=>($item->start_at < $start_at) && ($item->stop_at > $start_at) && ($item->item_type === 0)) as $iio) { // Reverse the original charge $co = new Charge; @@ -400,7 +399,7 @@ class ServiceController extends Controller */ public function service_change_charges_display(Request $request,Service $o) { - return view('theme.backend.adminlte.a.charge.service_change') + return view('theme.backend.adminlte.service.change_charge') ->with('charges',$this->service_change_charges($request,$o)); } diff --git a/app/Mail/CancelRequest.php b/app/Mail/CancelRequest.php index 125ff6d..46daea8 100644 --- a/app/Mail/CancelRequest.php +++ b/app/Mail/CancelRequest.php @@ -15,15 +15,15 @@ class CancelRequest extends Mailable use Queueable, SerializesModels; public Service $service; - public string $notes; + public ?string $notes; /** * Create a new message instance. * * @param Service $o - * @param string $notes + * @param string|NULL $notes */ - public function __construct(Service $o,string $notes='') + public function __construct(Service $o,string $notes=NULL) { $this->service = $o; $this->notes = $notes; @@ -40,7 +40,9 @@ class CancelRequest extends Mailable switch (get_class($this->service->type)) { case Service\Broadband::class: - $subject = sprintf('Cancel BROADBAND: %s',$this->service->type->service_address); + $subject = sprintf('Cancel BROADBAND: %s (%s)', + $this->service->type->service_number, + $this->service->type->service_address); break; case Service\Phone::class: diff --git a/app/Mail/ChangeRequest.php b/app/Mail/ChangeRequest.php index dca3113..44f5bd1 100644 --- a/app/Mail/ChangeRequest.php +++ b/app/Mail/ChangeRequest.php @@ -15,18 +15,18 @@ class ChangeRequest extends Mailable use Queueable, SerializesModels; public Service $service; - public string $notes; + public ?string $notes; /** * Create a new message instance. * * @param Service $o - * @param string $notes + * @param string|NULL $notes */ - public function __construct(Service $o,string $notes='') + public function __construct(Service $o,string $notes=NULL) { $this->service = $o; - $this->notes = $notes ?? ''; + $this->notes = $notes; } /** @@ -40,7 +40,9 @@ class ChangeRequest extends Mailable switch (get_class($this->service->type)) { case Service\Broadband::class: - $subject = sprintf('Change BROADBAND: %s',$this->service->type->service_address); + $subject = sprintf('Change BROADBAND: %s (%s)', + $this->service->type->service_number, + $this->service->type->service_address); break; case Service\Phone::class: diff --git a/app/Models/Charge.php b/app/Models/Charge.php index ca70721..2f48ac8 100644 --- a/app/Models/Charge.php +++ b/app/Models/Charge.php @@ -8,6 +8,7 @@ use Illuminate\Support\Facades\Log; use Leenooks\Traits\ScopeActive; use App\Casts\CollectionOrNull; +use App\Traits\SiteID; /** * CLEANUP NOTES: @@ -15,7 +16,7 @@ use App\Casts\CollectionOrNull; */ class Charge extends Model { - use ScopeActive; + use ScopeActive,SiteID; protected $casts = [ 'attributes' => CollectionOrNull::class, diff --git a/resources/views/theme/backend/adminlte/a/charge/service_change.blade.php b/resources/views/theme/backend/adminlte/a/charge/service_change.blade.php deleted file mode 100644 index 9dab783..0000000 --- a/resources/views/theme/backend/adminlte/a/charge/service_change.blade.php +++ /dev/null @@ -1,33 +0,0 @@ -
-
-
-
-

Pending Transactions

-
- -
- - - - - - - - - - - - @foreach ($charges as $co) - - - - - - - @endforeach - -
Service ChargeQuantityRateAmount
{{ $co->type_name }}{{ number_format($co->quantity,2) }}${{ number_format($co->amount,2) }}${{ number_format($co->amount*$co->quantity,2) }}
-
-
-
-
\ No newline at end of file diff --git a/resources/views/theme/backend/adminlte/service/cancel_request.blade.php b/resources/views/theme/backend/adminlte/service/cancel_request.blade.php index 423ed31..9237d82 100644 --- a/resources/views/theme/backend/adminlte/service/cancel_request.blade.php +++ b/resources/views/theme/backend/adminlte/service/cancel_request.blade.php @@ -16,72 +16,35 @@ @section('main-content')
-
- @include('adminlte::widget.status') -
-
+
+
+ @csrf -
-
-
-
-
Cancelling Service
-
- - - {{ csrf_field() }} +
+
+
Cancelling Service
+
-
- -
-
-
- -
- -
+
+
+
- {{-- - @includeIf('theme.backend.adminlte.service.widget.'.$o->product->category.'.order',['o'=>$o->type]) - --}} - -
- -
- +
+
+
- - -
+
+
-@endsection - -@section('page-scripts') - @themejs('//cdn.jsdelivr.net/momentjs/latest/moment.min.js','moment-js') - @themejs('//cdn.jsdelivr.net/npm/daterangepicker/daterangepicker.min.js','daterange-js') - @themecss('//cdn.jsdelivr.net/npm/daterangepicker/daterangepicker.css','daterange-css') - - -@append \ No newline at end of file +@endsection \ No newline at end of file diff --git a/resources/views/theme/backend/adminlte/service/change_charge.blade.php b/resources/views/theme/backend/adminlte/service/change_charge.blade.php new file mode 100644 index 0000000..e69b68a --- /dev/null +++ b/resources/views/theme/backend/adminlte/service/change_charge.blade.php @@ -0,0 +1,29 @@ +
+
+

Pending Transactions

+
+ +
+ + + + + + + + + + + + @foreach ($charges as $co) + + + + + + + @endforeach + +
Service ChargeQuantityRateAmount
{{ $co->type_name }}{{ number_format($co->quantity,2) }}${{ number_format($co->amount,2) }}${{ number_format($co->amount*$co->quantity,2) }}
+
+
\ No newline at end of file diff --git a/resources/views/theme/backend/adminlte/service/change_pending.blade.php b/resources/views/theme/backend/adminlte/service/change_pending.blade.php index 98c0a2e..9a5d647 100644 --- a/resources/views/theme/backend/adminlte/service/change_pending.blade.php +++ b/resources/views/theme/backend/adminlte/service/change_pending.blade.php @@ -1,3 +1,5 @@ +@use(App\Models\Product) + @extends('adminlte::layouts.app') @section('htmlheader_title') @@ -8,20 +10,20 @@ @endsection @section('contentheader_title') - Change Service #{{ $o->id }} - WARNING - this is only for Broadband for now + Change Service #{{ $o->id }} - WARNING - this is only for Broadband for now @endsection @section('contentheader_description') {{ $o->sid }} @endsection - + @section('main-content')
-
-
- {{ csrf_field() }} + + @csrf +

Service Information

@@ -30,114 +32,42 @@
-
- - -
-
- -
- -
-
+
-
- -
-
- -
- - - @error('broadband.product_id') - {{ $message }} - @else - Type is required. - @enderror - -
- Product - {{ $o->product->category_name }}. -
+
-
- -
-
- -
- - - @error('broadband.start_at') - {{ $message }} - @else - Type is required. - @enderror - -
-
+
-
- -
-
- -
- - - @error('broadband.change_fee') - {{ $message }} - @enderror - -
-
+
-
- -
-
- -
- - - @error('broadband.price') - {{ $message }} - @enderror - -
-
+
- Cancel - @can('wholesaler') - - @endcan + + Save
@@ -146,25 +76,34 @@
+
-
-
-

Plan Information

-
+
+
+
+
+

Plan Information

+
-
- @include('theme.backend.adminlte.service.widget.internal',['o'=>$o,'p'=>$np]) +
+ @include('theme.backend.adminlte.service.widget.internal',['o'=>$o,'p'=>$np]) +
+
+
+
+ +
+
+
-
@endsection -@section('page-scripts') - @css(select2) - @js(select2,autofocus) +@pa(select2,autofocus) +@section('page-scripts') -@append \ No newline at end of file +@endsection \ No newline at end of file diff --git a/resources/views/theme/backend/adminlte/service/widget/broadband/change.blade.php b/resources/views/theme/backend/adminlte/service/widget/broadband/change.blade.php index 345dad1..27f854f 100644 --- a/resources/views/theme/backend/adminlte/service/widget/broadband/change.blade.php +++ b/resources/views/theme/backend/adminlte/service/widget/broadband/change.blade.php @@ -1,31 +1,11 @@ -
- -
-
- -
-
+@use(App\Models\Product) +@use(App\Models\Product\Broadband) -
- NOTE: A plan setup fee is normally not applicable to Broadband changes, but a plan change fee normally is. -
-
+ + +NOTE: A plan setup fee is normally not applicable to Broadband changes, but a plan change fee normally is. @section('page-scripts')