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

70 lines
2.0 KiB
PHP
Raw Normal View History

2022-08-07 02:17:20 +00:00
<!-- $o=User::class -->
<!-- Suppliers Configuration for this User -->
<div class="row">
<div class="col-6">
<div class="card">
<div class="card-body">
@include('adminlte::widget.success_button')
<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->id }}</td>
<td>{{ $so->pivot->created_at }} <a class="float-right" href="{{ url('a/user/supplier/delete',[$o->id,$so->id]) }}"><i class=" fa-fw fas fa-trash"></i></a></td>
</tr>
@endforeach
</tbody>
@if(($x=\App\Models\Supplier::active()->whereNotIn('id',$o->suppliers->pluck('id'))->orderBy('name')->get())->count())
<tfoot>
<tr>
<td colspan="3">
<form class="g-0 needs-validation" method="POST" action="{{ url('a/user/supplier/add',[$o->id]) }}" enctype="multipart/form-data" role="form">
@csrf
<div class="row">
<div class="col-6">
@include('adminlte::widget.form_select',[
'label'=>'Add Supplier',
'icon'=>'fas fa-handshake',
'id'=>'supplier_id',
'old'=>'supplier_id',
'options'=>$x->transform(function($item) { return ['id'=>$item->id,'value'=>$item->name]; }),
'value'=>'',
])
</div>
<div class="col-4">
@include('adminlte::widget.form_text',[
'label'=>'ID',
'icon'=>'fas fa-hashtag',
'id'=>'id',
'old'=>'id',
'name'=>'id',
'value'=>'',
])
</div>
<div class="col-2">
<div class="form-group">
<button type="submit" class="mt-4 float-right btn btn-sm btn-success">Add</button>
</div>
</div>
</div>
</form>
</td>
</tr>
</tfoot>
@endif
</table>
</div>
</div>
</div>
</div>