<form class="row g-3 auto-width" action="{{ route('additional-charge.update', $type->id)}}" method="post" enctype='multipart/form-data'>
    @csrf
    @method('patch')
    <div class="col-md-6">
        <label for="name" class="form-label">Name <span class="text-danger"><b>*</b></span></label>
        <input type="text" class="form-control" id="name" name="name" aria-describedby="inputGroupPrepend" required value="{{$type->name}}">
        <span class="text-danger error_name" style="display:none;">This field is required.</span>
    </div>
    <div class="col-md-6">
        <label for="form-label" >Voucher Type </label>
         <select class="form-control" id="voucher_type_code" name="voucher_type_code">
            <option value=" "> -Select- </option>
            @foreach($voucher as $list)
            <option value="{{ $list->code }}"{!! $type->voucher_type_code == $list->code ? 'selected' : '' !!}>{{$list->code}}</option>
            @endforeach
         </select>
    </div>
     <div class="col-md-6">
        <label class="form-label">Primary Unit </label>
        <select class="form-control" id="primary_unit_id" name="primary_unit_id">
            <option value=" "> -Select- </option>
            @foreach($primaryunitname as $list)
            <option value="{{ $list->id }}" {!! $type->primary_unit_id == $list->id ? 'selected' : '' !!}>{{$list->name}}</option>
            @endforeach
         </select>
    </div>
    <div class="col-md-6">
        <label for="default_rate" class="form-label">Default rate</label>
        <input type="text" class="form-control" id="default_rate" name="default_rate" aria-describedby="inputGroupPrepend" required value="{{$type->default_rate}}">
        <span class="text-danger error_name" style="display:none;">This field is required.</span>
    </div>
    <div class="col-md-6">
        <label class="form-label">Tax Slab Name</label>
        <select class="form-control" id="tax_slab_id" name="tax_slab_id">
            <option value=" "> -Select- </option>
            @foreach($taxname as $list)
            <option value="{{ $list->id}}" {!! $type->tax_slab_id == $list->id ? 'selected' : '' !!}>{{$list->name}}</option>
            @endforeach
         </select>
    </div> 
    <div class="col-md-6">
        <label for="priority" class="form-label">Priority</label>
        <input type="text" class="form-control" id="priority" name="priority" aria-describedby="inputGroupPrepend" required value="{{$type->priority}}">
        <span class="text-danger error_priority" style="display:none;">This field is required.</span>
    </div>
   
</form>
<script type="text/javascript">
      $("#priority").on('input', function() {
          const onlyNumbers = $(this).val().replace(/[^0-9]/g, '');
          $("#priority").val(onlyNumbers);
      });
</script> 