<!-- Modal -->
<div class="modal fade" id="editUserModal" tabindex="-1" aria-labelledby="exampleModalLabel">
  <div class="modal-dialog modal-lg">
    <div class="modal-content">
      <div class="modal-header">
        <h5 class="modal-title" id="exampleModalLabel">Edit User Form</h5>
        <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
      </div>
      <div class="modal-body">
          <div class="alert alert-success d-none" id="editSuccessArea">Success</div>
          <div class="alert alert-danger d-none" id="editErrorArea">Failed</div>
          <div class="alert alert-info d-none" id="editInfoArea"></div>
          <div class="container-fluid">
          <div class="row">   
          <div class="col-md-12">   
          <form class="row g-3" action="" method="POST" id="editUserForm">
            @csrf
            <input type="hidden" name="user_id" value="">
            <input type="hidden" name="district_id" value="{{ session('current_user.district_id') }}">
            <input type="hidden" name="region_id" value="{{ session('current_user.region_id') }}">
            <!-- <input type="hidden" name="user_type" value="district_user"> -->
            <div class="col-md-12">
                @if (session('current_user.user_type') == 'district_user')
                <div class="form-check">
                  <input class="form-check-input" type="radio" name="user_type" value="district_user" id="editUserTypeDistrict" >
                  <label class="form-check-label" for="editUserTypeDistrict">District User</label>
                </div>
                @elseif(session('current_user.user_type') == 'regional_user')
                <div class="form-check">
                  <input class="form-check-input" type="radio" name="user_type" value="district_user" id="editUserTypeDistrict" >
                  <label class="form-check-label" for="editUserTypeDistrict">District User</label>
                </div>
                <div class="form-check">
                  <input class="form-check-input" type="radio" name="user_type" value="regional_luspa" id="editUserTypeLuspaRegion">
                  <label class="form-check-label" for="editUserTypeLuspaRegion">Regional LUSPA</label>
                </div>
                @else
                <div class="form-check">
                  <input class="form-check-input" type="radio" name="user_type" value="district_user" id="editUserTypeDistrict" >
                  <label class="form-check-label" for="editUserTypeDistrict">District User</label>
                </div>
                <div class="form-check">
                  <input class="form-check-input" type="radio" name="user_type" value="regional_luspa" id="editUserTypeLuspaRegion">
                  <label class="form-check-label" for="editUserTypeLuspaRegion">Regional LUSPA</label>
                </div>
                <div class="form-check">
                  <input class="form-check-input" type="radio" name="user_type" value="national_luspa" id="editUserTypeLuspaNational">
                  <label class="form-check-label" for="editUserTypeLuspaNational">National LUSPA</label>
                </div>
                @endif
              </div>
            <div class="col-md-2">
              <label for="editTitle" class="form-label">Title</label>
              <select id="editTitle" name="title" class="form-select" required>
                <option selected disabled>Choose...</option>
                <option value="Mr">Mr</option>
                <option value="Mrs">Mrs</option>
                <option value="Dr">Dr</option>
                <option value="Proff">Proff</option>
              </select>
            </div>
            
            <div class="col-md-5">
              <label for="editFullName" class="form-label">Fullname *</label>
              <input type="text" name="full_name" value="" class="form-control" id="editFullName" required>
            </div>
            <div class="col-md-5">
              <label for="editEmail" class="form-label">Email *</label>
              <input type="email" name="email" value="" class="form-control" id="editEmail" required>
            </div>
            <div class="col-md-4">
              <label for="editUsername" class="form-label">Username</label>
              <input type="text" name="username" value="" class="form-control" id="editUsername" required>
            </div>
            <div class="col-md-4">
              <label for="editGender" class="form-label">Gender</label>
              <select id="editGender" name="gender" class="form-select" required>
                <option selected disabled>Choose...</option>
                <option value="female">Female</option>
                <option value="male">Male</option>
              </select>
            </div>
            <div class="col-md-4">
              <label for="editPhone" class="form-label">Phone *</label>
              <input type="text" name="phone" value="" class="form-control" id="editPhone" required>
            </div>
            <div class="col-md-4">
              <label for="editUaPostion" class="form-label">Position *</label>
              <select id="editUaPostion" name="ua_position" class="form-select" required>
                <option value="district-mis">District MIS</option>
                    <option value="district-ppd-head">PPD Head</option>
                    <option value="luspa-it-head">IT(LUSPA)</option>
                    <option value="district-ppd-staff">PPD Staff</option>
                    <option value="district-works-head">Works Department Head</option>
                    <option value="district-works-staff">Works Department Staff</option>
              </select>
            </div>
             @if (session('current_user.user_type') == 'district_user' )           
              <input type="hidden" name="district_id" value="{{ session('current_user.district_id') }}">
              @elseif(session('current_user.user_type') == 'regional_user')
              <div class="col-md-4">
                <label for="editRegionID" class="form-label">Region *</label>
                <select name="region_id" id="editRegionID" class="form-select">
                  <option selected disabled>Choose...</option>
                  <?php foreach ($regions_arr as $row): ?>
                    <option value="<?php echo $row['regionid']; ?>" ><?php echo $row['region_name']; ?></option>
                  <?php endforeach; ?>
                </select>
              </div>
              <div class="col-md-4">
                <label for="editDistrictID" class="form-label">District *</label>
                <select id="editDistrictID" name="district_id" class="form-select">
                  <option selected disabled>Choose...</option>
                </select>
              </div>
              @else
              <div class="col-md-4">
                <label for="editRegionID" class="form-label">Region *</label>
                <select name="region_id" id="editRegionID" class="form-select regionIDD">
                  <option selected disabled>Choose...</option>
                  <?php foreach ($regions_arr as $row): ?>
                    <option value="<?php echo $row['regionid']; ?>"><?php echo $row['region_name']; ?></option>
                  <?php endforeach; ?>
                </select>
              </div>
              <div class="col-md-4">
                <label for="editDistrictID" class="form-label">District *</label>
                <select id="editDistrictID" name="district_id" class="form-select districtIDD">
                  <option selected disabled>Choose...</option>
                </select>
              </div>
              @endif
              <div class="col-md-4">
                <label for="userStatus" class="form-label">User Status</label>
                <select id="userStatus" name="user_status" class="form-select"required style="width:100%">
                  <option value="active">Active</option>
                  <option value="inactive">Inactive</option>
                </select>
              </div>
              <!-- <div class="col-md-4">
                <label for="editAllowedApps" class="form-label">Allowed Apps *</label>
                <select id="editAllowedApps" name="allowed_apps[]" class="form-select" multiple required style="width:100%">
                  <option value="drawing-tools">Drawing Tools</option>
                  <option value="permit-tools">Permit Tools</option>
                  <option value="admin-gui">Admin GUI</option>
                </select>
              </div> -->
            
            @if(env('APP_ENV') == 'local')
            <div class="col-md-6">
              <label for="resetPassword" class="form-label">Reset Password</label>
              <input type="text" name="reset_password" value="" class="form-control" id="resetPassword">
            </div>
            @endif
            <div class="col-md-12">
              <div class="form-check">
                <input class="form-check-input" type="checkbox" name="expire_password" value="yes" id="expirePassword">
                <label class="form-check-label" for="expirePassword">Expire Password</label>
              </div>
            </div>
            <div class="col-md-12">
            <div class="d-grid gap-2">
              <button type="submit" class="btn btn-primary">Submit</button>
            </div>
          </div>
          </form>
          </div>
          
          </div>  
        </div>
      </div>

      <div class="modal-footer">  
        <!-- <button type="button" class="btn btn-danger" data-bs-dismiss="modal">Close</button>           -->

      </div>
    </div>
  </div>
</div>