<%- include('includes/header',  {username: admin[0].name,email: admin[0].email } ) %>

  <div class="body-wrapper">
    <div class="container-fluid">
      <div class="card bg-info-subtle shadow-none position-relative overflow-hidden mb-4">
        <div class="card-body px-4 py-3">
          <div class="row align-items-center">
            <div class="col-md-8 col-sm-7">
              <h4 class="fw-semibold mb-1">States</h4>

            </div>

            <div class="col-md-4 col-sm-5 text-md-end text-sm-start mt-3 mt-md-0">
              <button class="btn btn-primary px-4" id="addStateBtn">
                <i class="fa-solid fa-plus me-2"></i> Add State
              </button>
            </div>
          </div>

        </div>
      </div>
      <div class="datatables">


        <div class="card">
          <div class="card-body">
            <div class="table-responsive">
              <table id="zero_config" class="table table-striped table-bordered text-nowrap align-middle">
                <thead>
                  <tr>
                    <th>Country</th>
                    <th>State</th>
                    <th>Status</th>
                    <th class="action-col">Action</th>
                  </tr>
                </thead>
                <tbody>
                </tbody>
              </table>
            </div>
          </div>
        </div>

        <!-- state Modal -->
        <div class="modal fade" id="stateModal" tabindex="-1" aria-hidden="true">
          <div class="modal-dialog modal-md modal-dialog-centered">
            <div class="modal-content border-0 shadow-lg rounded-3">
              <div class="modal-header bg-light-subtle text-white">
                <h5 class="modal-title fw-semibold" id="stateModalLabel">Add State</h5>
                <button type="button" class="btn-close btn-close-dark" data-bs-dismiss="modal"></button>
              </div>
              <div class="modal-body p-4">
                <form id="stateForm">
                  <input type="hidden" id="stateId">
                  <div class="mb-3">
                    <label class="form-label fw-medium">Country <span class="text-danger">*</span></label>
                    <select class="form-select" id="countrySelect">
                      <option selected disabled>Loading...</option>
                    </select>
                  </div>
                  <div class="mb-3">
                    <label class="form-label fw-medium">State Name <span class="text-danger">*</span></label>
                    <input type="text" id="stateTitle" class="form-control" placeholder="Enter state name">
                  </div>
                  <div class="form-check form-switch d-flex align-items-center mt-3">
                    <input class="form-check-input" type="checkbox" id="stateStatus" checked>
                    <label class="form-check-label ms-2 fw-medium" for="stateStatus">Enable State</label>
                  </div>
                   <div class="modal-footer border-0 pt-0">
                <button type="button" class="btn btn-light" data-bs-dismiss="modal">Cancel</button>
                <button type="submit" class="btn btn-primary px-4" id="saveStateBtn">Save</button>
              </div>
                </form>
              </div>
             
            </div>
          </div>
        </div>


      </div>



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

  <%- include('includes/allscripts') %>
    <script src="/js/view/states.js"></script>