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

@@ -1,5 +1,6 @@
<!-- $o=Service::class -->
@use(App\Models\Invoice)
@use(App\Models\Product)
<div class="row">
<div class="col-12">
@@ -43,6 +44,24 @@
</div>
</div>
<div class="row">
<div class="col-12">
<!-- PRODUCT -->
<x-leenooks::form.select name="product_id" icon="fa-list" label="Product" :helper="$o->product->category_name"
:value="$o->product_id"
:options="Product::get()
->filter(fn($item)=>($item->category === $o->product->category))
->sortBy('name')
->map(fn($item)=>[
'id'=>$item->id,
'value'=>sprintf('%s $%3.2f [%s/%3.2f]',
$item->name,
$o->account->taxed($item->base_charge)*Invoice::billing_change($item->billing_interval,Invoice::BILL_MONTHLY),
$item->supplied->name,
$o->account->taxed($item->base_cost)*Invoice::billing_change($item->billing_interval,Invoice::BILL_MONTHLY),
)])" :required="true"/>
</div>
</div>
<hr>
@includeIf('theme.backend.adminlte.service.widget.'.$o->product->category.'.update',['o'=>$o->type])