Add product selection to service update

This commit is contained in:
2025-05-16 21:42:29 +10:00
parent b33c052995
commit 622147d584
2 changed files with 21 additions and 0 deletions

View File

@@ -412,6 +412,7 @@ class ServiceController extends Controller
'suspend_billing' => 'nullable|in:on',
'recur_schedule' => ['required',Rule::in(collect(Invoice::billing_periods)->keys())],
'invoice_next_at' => 'nullable|date',
'product_id'=>'required|exists:products,id',
'price' => 'nullable|numeric|min:0', // Price we charge the client, if we dont charge supplied/price
'cost' => 'nullable|numeric|min:0', // Price we are charged by supplier, if we arent charged supplier/price
'supplierid' => 'nullable|string|min:1', // As used on invoices
@@ -460,6 +461,7 @@ class ServiceController extends Controller
$o->price = $validated->get('price');
$o->cost = $validated->get('cost');
$o->supplierid = $validated->get('supplierid');
$o->product_id = $validated->get('product_id');
// Also update our service start_at date.
// @todo We may want to make start_at/stop_at dynamic values calculated by the type records