diff --git a/app/Http/Controllers/ServiceController.php b/app/Http/Controllers/ServiceController.php index 427cd8a..647a73e 100644 --- a/app/Http/Controllers/ServiceController.php +++ b/app/Http/Controllers/ServiceController.php @@ -421,6 +421,12 @@ class ServiceController extends Controller if ($request->post('recur_schedule')) $o->recur_schedule = $request->recur_schedule; + $o->suspend_billing = ($request->suspend_billing == 'on'); + $o->external_billing = ($request->external_billing == 'on'); + // @todo Cant have both price and price_override - show an exception. (price_override shows a discount, whereas price shows the price) + $o->price = $request->price ?: NULL; + $o->price_override = $request->price_override ?: NULL; + // Also update our service start_at date. // @todo We may want to make start_at/stop_at dynamic values calculated by the type records if ($request->post('start_at')) diff --git a/app/Models/Service.php b/app/Models/Service.php index e774248..8eb9f84 100644 --- a/app/Models/Service.php +++ b/app/Models/Service.php @@ -1190,7 +1190,7 @@ class Service extends Model implements IDs */ public function isBilled(): bool { - return ! ($this->external_billing || $this->suspend_billing || ($this->price == 0)); + return ! ($this->external_billing || $this->suspend_billing || ($this->price === 0)); } /** diff --git a/resources/views/theme/backend/adminlte/service/widget/broadband/update.blade.php b/resources/views/theme/backend/adminlte/service/widget/broadband/update.blade.php index 06868d4..f9c3940 100644 --- a/resources/views/theme/backend/adminlte/service/widget/broadband/update.blade.php +++ b/resources/views/theme/backend/adminlte/service/widget/broadband/update.blade.php @@ -54,6 +54,7 @@
@include('adminlte::widget.form_date',[ 'label'=>'Connect Date', + 'icon'=>'fas fa-calendar', 'id'=>'connect_at', 'old'=>'broadband.connect_at', 'name'=>'broadband[connect_at]', @@ -61,21 +62,10 @@ ])
-
- @include('adminlte::widget.form_date',[ - 'label'=>'Billing Start Date', - 'id'=>'invoice_next_at', - 'old'=>'invoice_next_at', - 'name'=>'invoice_next_at', - 'value'=>$o->service->invoice_next_at ? $o->service->invoice_next_at->format('Y-m-d') : ($o->connect_at ? $o->connect_at->format('Y-m-d') : ''), - ]) -
- - -
@include('adminlte::widget.form_date',[ 'label'=>'Contract End', + 'icon'=>'fas fa-calendar', 'id'=>'expire_at', 'old'=>'broadband.expire_at', 'name'=>'broadband[expire_at]', diff --git a/resources/views/theme/backend/adminlte/service/widget/domain/update.blade.php b/resources/views/theme/backend/adminlte/service/widget/domain/update.blade.php index b1cce4a..4c46f6c 100644 --- a/resources/views/theme/backend/adminlte/service/widget/domain/update.blade.php +++ b/resources/views/theme/backend/adminlte/service/widget/domain/update.blade.php @@ -33,6 +33,7 @@
@include('adminlte::widget.form_date',[ 'label'=>'Expiry', + 'icon'=>'fas fa-calendar', 'id'=>'expire_at', 'old'=>'domain.expire_at', 'name'=>'domain[expire_at]', @@ -102,34 +103,15 @@
@include('adminlte::widget.form_date',[ 'label'=>'Registered Date', - 'id'=>'connect_at', - 'old'=>'phone.connect_at', - 'name'=>'phone[connect_at]', - 'value'=>$o->connect_at ? $o->connect_at->format('Y-m-d') : '', - ]) -
- -
- @include('adminlte::widget.form_date',[ - 'label'=>'Billing Start Date', - 'id'=>'invoice_next_at', - 'old'=>'invoice_next_at', - 'name'=>'invoice_next_at', - 'value'=>$o->service->invoice_next_at ? $o->service->invoice_next_at->format('Y-m-d') : ($o->connect_at ? $o->connect_at->format('Y-m-d') : ''), - ]) -
- -
- @include('adminlte::widget.form_select',[ - 'label'=>'Renew Term', 'icon'=>'fas fa-calendar', - 'id'=>'recur_schedule', - 'old'=>'recur_schedule', - 'name'=>'recur_schedule', - 'options'=>collect(\App\Models\Invoice::billing_periods)->filter(function ($item) { return $item['interval'] >= 12; })->transform(function($item,$key) { return ['id'=>$key,'value'=>$item['name']]; }), - 'value'=>$o->service->recur_schedule ?? '', + 'id'=>'start_at', + 'old'=>'start_at', + 'name'=>'start_at', + 'value'=>$o->service->start_at ? $o->service->start_at->format('Y-m-d') : '', ])
+ +
@section('page-scripts') diff --git a/resources/views/theme/backend/adminlte/service/widget/phone/update.blade.php b/resources/views/theme/backend/adminlte/service/widget/phone/update.blade.php index be5479f..e2e4eb9 100644 --- a/resources/views/theme/backend/adminlte/service/widget/phone/update.blade.php +++ b/resources/views/theme/backend/adminlte/service/widget/phone/update.blade.php @@ -54,6 +54,7 @@
@include('adminlte::widget.form_date',[ 'label'=>'Connect Date', + 'icon'=>'fas fa-calendar', 'id'=>'connect_at', 'old'=>'phone.connect_at', 'name'=>'phone[connect_at]', @@ -61,21 +62,10 @@ ])
-
- @include('adminlte::widget.form_date',[ - 'label'=>'Billing Start Date', - 'id'=>'invoice_next_at', - 'old'=>'invoice_next_at', - 'name'=>'invoice_next_at', - 'value'=>$o->service->invoice_next_at ? $o->service->invoice_next_at->format('Y-m-d') : ($o->connect_at ? $o->connect_at->format('Y-m-d') : ''), - ]) -
-
- -
@include('adminlte::widget.form_date',[ 'label'=>'Contract End', + 'icon'=>'fas fa-calendar', 'id'=>'expire_at', 'old'=>'phone.expire_at', 'name'=>'phone[expire_at]', diff --git a/resources/views/theme/backend/adminlte/service/widget/update.blade.php b/resources/views/theme/backend/adminlte/service/widget/update.blade.php index fdf0693..9243704 100644 --- a/resources/views/theme/backend/adminlte/service/widget/update.blade.php +++ b/resources/views/theme/backend/adminlte/service/widget/update.blade.php @@ -7,6 +7,83 @@ @csrf +
+ +
+ @include('adminlte::widget.form_toggle',[ + 'label'=>'External Billing', + 'id'=>'external_billing', + 'old'=>'external_billing', + 'name'=>'external_billing', + 'value'=>$o->external_billing ?? '', + ]) + + + @include('adminlte::widget.form_toggle',[ + 'label'=>'Suspend Billing', + 'id'=>'suspend_billing', + 'old'=>'suspend_billing', + 'name'=>'suspend_billing', + 'value'=>$o->suspend_billing ?? '', + ]) +
+ +
+ +
+ @include('adminlte::widget.form_date',[ + 'label'=>'Billing Start Date', + 'icon'=>'fas fa-calendar', + 'id'=>'invoice_next_at', + 'old'=>'invoice_next_at', + 'name'=>'invoice_next_at', + 'value'=>$o->invoice_next_at ? $o->invoice_next_at->format('Y-m-d') : ($o->connect_at ? $o->connect_at->format('Y-m-d') : ''), + ]) +
+ + +
+ @include('adminlte::widget.form_text',[ + 'label'=>'Price', + 'icon'=>'fas fa-dollar-sign', + 'id'=>'price', + 'old'=>'price', + 'name'=>'price', + 'value'=>$o->price ?? '', + ]) +
+
+ +
+
+ +
+ @include('adminlte::widget.form_select',[ + 'label'=>'Renew Term', + 'icon'=>'fas fa-redo', + 'id'=>'recur_schedule', + 'old'=>'recur_schedule', + 'name'=>'recur_schedule', + 'options'=>collect(\App\Models\Invoice::billing_periods)->transform(function($item,$key) { return ['id'=>$key,'value'=>$item['name']]; }), + 'value'=>$o->recur_schedule ?? '', + ]) +
+ + +
+ @include('adminlte::widget.form_text',[ + 'label'=>'Override Price', + 'icon'=>'fas fa-dollar-sign', + 'id'=>'price_override', + 'old'=>'price_override', + 'name'=>'price_override', + 'value'=>$o->price_override ?? '', + ]) +
+
+ +
+ @includeIf('service.widget.'.$o->product->category.'.update',['o'=>$o->type])