Update supplier details to use form helpers, and added in api settings
This commit is contained in:
@@ -26,29 +26,17 @@
|
||||
@csrf
|
||||
|
||||
<div class="row">
|
||||
<div class="col-4">
|
||||
<div class="form-group has-validation">
|
||||
<label for="name">Supplier Name</label>
|
||||
<select class="form-control form-control-border" id="name" name="supplier_id">
|
||||
<option value=""></option>
|
||||
<option value="">Add New</option>
|
||||
@foreach(\App\Models\Supplier::orderBy('active','DESC')->orderBy('name')->get()->groupBy('active') as $o)
|
||||
<optgroup label="{{ $o->first()->active ? 'Active' : 'Not Active' }}">
|
||||
@foreach($o as $oo)
|
||||
<option value="{{ $oo->id }}">{{ $oo->name }}</option>
|
||||
@endforeach
|
||||
</optgroup>
|
||||
@endforeach
|
||||
</select>
|
||||
<span class="invalid-feedback" role="alert">
|
||||
@error('name')
|
||||
{{ $message }}
|
||||
@else
|
||||
Supplier Name is required.
|
||||
@enderror
|
||||
</span>
|
||||
<span class="input-helper">Suppliers Name</span>
|
||||
</div>
|
||||
<div class="col-12 col-sm-9 col-md-6 col-xl-5">
|
||||
@include('adminlte::widget.form_select',[
|
||||
'label'=>'Supplier',
|
||||
'icon'=>'fas fa-handshake',
|
||||
'id'=>'supplier_id',
|
||||
'old'=>'supplier_id',
|
||||
'name'=>'supplier_id',
|
||||
'groupby'=>'active',
|
||||
'options'=>\App\Models\Supplier::orderBy('active','DESC')->orderBy('name')->get()->transform(function($item) { return ['id'=>$item->id,'value'=>$item->name,'active'=>$item->active]; }),
|
||||
'value'=>'',
|
||||
])
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
@@ -64,10 +52,10 @@
|
||||
|
||||
<script type="text/javascript">
|
||||
$(document).ready(function() {
|
||||
$('#name').select2()
|
||||
$('#supplier_id')
|
||||
.on('change',function(item) {
|
||||
window.location.href = '{{ url('a/supplier/details') }}'+(item.target.value ? '/'+item.target.value : '');
|
||||
});
|
||||
});
|
||||
</script>
|
||||
@endsection
|
||||
@append
|
Reference in New Issue
Block a user