@extends('layouts.appuser')

@section('content')
<script> 

    function toEnglishNumber(strNum) {
   var ar = '٠١٢٣٤٥٦٧٨٩'.split('');
   var en = '0123456789'.split('');
   strNum = strNum.replace(/[٠١٢٣٤٥٦٧٨٩]/g, x => en[ar.indexOf(x)]);
   strNum = strNum.replace(/[^\d]/g, '');
   return strNum;
}

$(document).on('keyup', '.arabicNumbers', function(e) {
   var val = toEnglishNumber($(this).val())
   $(this).val(val)
});
</script>

<div class="container" dir="ltr">
    <h3 class="mb-4"> Register a New Administration  </h3>

     
                        @if (session()->has('success'))
                        <div class="alert alert-success">
                            <span class="text-green font-bold">{{ session('success') }}</span>
                        </div>
                       @endif
             
    <form action="{{ route('Administrations.store') }}" method="POST">
        @csrf

        <div class="mb-3">
            <label class="form-label"> Department Name  </label>
           <select name="sector_id" id="">
           <option value="0" selected>---Choose One----</option>
                @foreach ($sectors as $item)
                    <option value="{{ $item->id }}">{{ $item->sectorName }}</option>
                @endforeach
           </select>
        </div>

        <div class="mb-3">
            <label class="form-label">  Sub-Department  </label>
            <input type="text" name="Sub_manager_name" class="form-control">
        </div>
       
        <div class="mb-3">
            <label class="form-label"> Contact Person </label>
            <input type="text" name="contact_person" class="form-control">
        </div>

        <div class="mb-3">
            <label class="form-label"> E-mail </label>
            <input type="email" name="contact_email" class="form-control">
        </div>

        <div class="mb-3">
            <label class="form-label"> Telephone </label>
            <input type="text" name="contact_Tel" class="arabicNumbers form-control">
        </div>

        <button type="submit" class="btn btn-success">save</button>
    </form>
</div>
@endsection
