From 7e784c3e8125e79448b0ceb112e9ddd8b0884075 Mon Sep 17 00:00:00 2001 From: Deon George Date: Sat, 17 Aug 2024 13:17:07 +1000 Subject: [PATCH] Show cancel date on service information widget --- app/Http/Controllers/ServiceController.php | 1 + app/Models/Service.php | 5 +++++ composer.lock | 6 +++--- .../adminlte/service/widget/information.blade.php | 13 ++++++++++--- 4 files changed, 19 insertions(+), 6 deletions(-) diff --git a/app/Http/Controllers/ServiceController.php b/app/Http/Controllers/ServiceController.php index 134e5e7..2f4520b 100644 --- a/app/Http/Controllers/ServiceController.php +++ b/app/Http/Controllers/ServiceController.php @@ -38,6 +38,7 @@ class ServiceController extends Controller $o->order_info->put('cancel_cancel',Carbon::now()->format('Y-m-d H:i:s')); $o->order_status = 'ACTIVE'; + $o->stop_at = NULL; return $o->save(); } diff --git a/app/Models/Service.php b/app/Models/Service.php index 0cff768..5ece2a1 100644 --- a/app/Models/Service.php +++ b/app/Models/Service.php @@ -1077,6 +1077,11 @@ class Service extends Model implements IDs && (! in_array($this->order_status,array_merge(self::INACTIVE_STATUS,['INACTIVE']))); } + public function isPendingCancel(): bool + { + return in_array(strtolower($this->order_status),['cancel-request','cancel-pending']); + } + /** * Generate a collection of invoice_item objects that will be billed for the next invoice * diff --git a/composer.lock b/composer.lock index 97e86a0..62cbe7e 100644 --- a/composer.lock +++ b/composer.lock @@ -3059,11 +3059,11 @@ }, { "name": "leenooks/laravel", - "version": "11.1.12", + "version": "11.1.13", "source": { "type": "git", "url": "https://gitea.dege.au/laravel/leenooks.git", - "reference": "ba18a2a21c0bf98c3825d53f93ed620d6a3e4423" + "reference": "be6061fb6e91689714260dd0139839b9cfbffbc7" }, "type": "library", "extra": { @@ -3096,7 +3096,7 @@ "laravel", "leenooks" ], - "time": "2024-08-17T00:36:07+00:00" + "time": "2024-08-17T03:14:51+00:00" }, { "name": "leenooks/passkey", diff --git a/resources/views/theme/backend/adminlte/service/widget/information.blade.php b/resources/views/theme/backend/adminlte/service/widget/information.blade.php index d700556..1c5631d 100644 --- a/resources/views/theme/backend/adminlte/service/widget/information.blade.php +++ b/resources/views/theme/backend/adminlte/service/widget/information.blade.php @@ -22,6 +22,12 @@ Status + @if($o->isPendingCancel()) + + Cancel Date + {{ $o->stop_at->format('Y-m-d') }} + + @endif @if($o->order_status == 'ORDER-SENT') Order Reference @@ -59,18 +65,19 @@ @endif @endif - @if($o->status !== 'cancel-pending') + Next Invoice @if($o->suspend_billing)@endif{{ $o->invoice_next?->format('Y-m-d') }}@if($o->suspend_billing) SUSPENDED@endif - @if($o->invoice_next) + + @if($o->invoice_next) Next Estimated Invoice ${{ number_format($o->next_invoice_items()->sum('total'),2) }} * - @endif @endif + Payment Method @if($o->billing)Direct Debit @else Invoice @endif