osb/resources/views/theme/backend/adminlte/supplier/widget/costs.blade.php

19 lines
759 B
PHP
Raw Permalink Normal View History

2024-08-24 07:37:55 +00:00
<!-- $spo=Supplier::class -->
@use(App\Models\Cost)
<div class="row">
<div class="col-4">
2024-08-24 07:37:55 +00:00
<x-leenooks::form.select name="cost_id" icon="fa-list" label="Supplier Invoice" helper="Supplier invoice" addnew="Add New" :options="Cost::where('supplier_id',$spo->id)->orderBy('billed_at','DESC')->get()->map(fn($item,$key)=>['id'=>$item->id,'value'=>sprintf('%s: $%s',$item->billed_at->format('Y-m-d'),number_format($item->total,2))])"/>
</div>
</div>
@section('page-scripts')
<script type="text/javascript">
$(document).ready(function() {
$('#cost_id')
.on('change',function(item) {
2024-08-24 07:37:55 +00:00
window.location.href = '{{ url('a/supplier/cost') }}/'+(item.target.value !== 'new' ? item.target.value : 'new/'+{{ $spo->id }});
});
});
</script>
@append