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

59 lines
1.7 KiB
PHP
Raw Normal View History

<!-- $o=Account::class -->
@use(App\Models\Supplier)
<!-- Suppliers Configuration for this User -->
<div class="row">
<div class="col-6">
<div class="card">
<div class="card-body">
<x-leenooks::button.success class="float-right"/>
<table class="table">
<thead>
<tr>
<th>Supplier</th>
<th>ID</th>
<th>Added</th>
</tr>
</thead>
<tbody>
@foreach ($o->suppliers as $so)
<tr>
<td>{{ $so->name }}</td>
<td>{{ $so->pivot->supplier_ref }}</td>
<td>{{ $so->pivot->created_at }} <a class="float-right" href="{{ url('a/account/supplier/delete',[$o->id,$so->id]) }}"><i class="fas fa-fw fa-trash"></i></a></td>
</tr>
@endforeach
</tbody>
@if(($x=Supplier::active()->whereNotIn('id',$o->suppliers->pluck('id'))->orderBy('name')->get())->count())
<tfoot>
<tr>
<td colspan="3">
<form method="POST" action="{{ url('a/account/supplier/add',[$o->id]) }}">
@csrf
<div class="row">
<div class="col-6">
<x-leenooks::form.select id="supplier_id" name="supplier_id" icon="fa-handshake" label="Add Supplier" :options="$x->map(function($item) { $item->value = $item->name; return $item; })->toArray()"/>
</div>
<div class="col-4">
<x-leenooks::form.text id="supplier_ref" name="supplier_ref" icon="fa-hashtag" label="ID"/>
</div>
<div class="col-2">
<x-leenooks::button.submit class="float-right">Save</x-leenooks::button.submit>
</div>
</div>
</form>
</td>
</tr>
</tfoot>
@endif
</table>
</div>
</div>
</div>
</div>