<form class="row g-3 auto-width" action="{{ route('additional-charge.store')}}" method="post" enctype='multipart/form-data'>
    @csrf
    <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>
        <span class="text-danger error_name" style="display:none;">This field is required.</span>
    </div>
    <div class="col-md-6">
        <label for="voucher_type_code" class="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}}">{{$list->code}}</option>
            @endforeach
         </select>
    </div>
    <div class="col-md-6">
        <label for="accounting_group_id" class="form-label">Accounting group</label>
         <select class="form-control" id="accounting_group_id" name="accounting_group_id">
            <option value=" "> -Select- </option>
            @foreach($accounting_groups as $list)
            <option value="{{ $list->id }}">{{$list->name}}</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}}">{{$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>
    </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}}">{{$list->name}}</option>
            @endforeach
         </select>
    </div>  
 <div class="col-md-6" style="display:none;">
        <label for="priority" class="form-label">Priority</label>
        <input type="text" class="form-control" id="priority" name="priority" aria-describedby="inputGroupPrepend" required value="{!! $priority + 1 !!}">
        <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>