WIP: Fix invoice_next_at date on service update for broadband - must do the others, and create a service validator

This commit is contained in:
Deon George 2022-09-07 15:15:02 +10:00
parent 3cae12b256
commit 5b4aa5c73e
2 changed files with 9 additions and 5 deletions

View File

@ -405,7 +405,7 @@ class ServiceController extends Controller
->withInput();
}
$o->type->forceFill(Arr::except($x,['start_at']));
$o->type->forceFill($validator->validated());
} elseif ($request->post($o->product->category)) {
$o->type->forceFill($request->post($o->product->category));
@ -413,6 +413,10 @@ class ServiceController extends Controller
$o->type->save();
// @todo create a validator for service
if ($request->post('invoice_next_at'))
$o->invoice_next_at = $request->invoice_next_at;
// Also update our service start_at date.
if ($request->post('start_at'))
$o->start_at = $request->start_at;

View File

@ -53,10 +53,10 @@
<div class="col-12 col-sm-9 col-md-6 col-xl-5">
@include('adminlte::widget.form_date',[
'label'=>'Billing Start Date',
'id'=>'start_at',
'old'=>'broadband.start_at',
'name'=>'broadband[start_at]',
'value'=>$o->start_at ? $o->start_at->format('Y-m-d') : ($o->connect_at ? $o->connect_at->format('Y-m-d') : ''),
'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') : ''),
])
</div>
</div>