<!DOCTYPE html>
<html lang="en">
  
<head>
  <title><%= lang_data.Customers %></title>
    <%- include('./partials/meta'); -%>
  </head>
  <body>
    <%- include('./partials/header_sidebar'); -%> 

        <div class="page-body">
          <div class="container-fluid">
            <div class="page-title">
              <div class="row">
                <div class="col-sm-6">
                  <h3><%= lang_data.Edit_Customers %></h3>
                </div>
                <div class="col-sm-6">
                  <ol class="breadcrumb">
                    <li class="breadcrumb-item"><a href="/index"><i data-feather="home"></i></a></li>
                    <li class="breadcrumb-item"><a href="/users/customers"><%= lang_data.Customers %></a></li>
                    <li class="breadcrumb-item"><a href="/users/edit_customers"><%= lang_data.Edit_Customers %></a></li>
                  </ol>
                </div>
              </div>
            </div>
          </div>
          <!-- Container-fluid starts-->
          <div class="container-fluid">
            <div class="row">
             
              <!-- Scroll - vertical dynamic Starts-->
              <div class="col-sm-12">
                <div class="card">
                    <div class="card-body">
                      <form action="/users/edit_customers/<%= edit_customers_data[0].id %>" method="post">
                        <div class="row g-3">
                            <div class="col-6">
                                <label class="form-label"><%= lang_data.First_Name %></label>
                                <input class="form-control" type="text" name="first_name" value="<%= edit_customers_data[0].first_name %>" placeholder="Enter First Name" required>
                            </div>

                            <div class="col-6">
                                <label class="form-label"><%= lang_data.Last_Name %></label>
                                <input class="form-control" type="text" name="last_name" value="<%= edit_customers_data[0].last_name %>" placeholder="Enter Last Name" required>
                            </div>

                            <div class="col-6">
                                <label class="form-label"><%= lang_data.EMail %></label>
                                <input class="form-control" type="email" name="email" value="<%= edit_customers_data[0].email %>" placeholder="Enter E-Mail" required>
                            </div>

                            <div class="col-6">
                                <label class="col-form-label pt-0"><%= lang_data.Phone_No %></label>
                                <div class="row g-2">
                                  <div class="col-md-2 col-sm-4">
                                    <select class="js-example-basic-single" name="country_code" required>
                                      <option value selected disabled><%= lang_data.Country %></option>
                                      <% CountryCode.forEach((data, x) => { %>
                                        <option value="<%= data %>" <%= edit_customers_data[0].country_code == data ? "selected" : "" %>> <%= nameCode[x] %> <%= data %> </option>
                                      <% }) %>
                                    </select>
                                  </div>
                                  <div class="col-md-10 col-sm-8">
                                    <input class="form-control" type="text" name="mobile" placeholder="Phone Number" value="<%= edit_customers_data[0].mobile %>" required>
                                  </div>
                                </div>
                            </div>

                            <hr>

                            <div class="d-flex justify-content-between align-items-center">
                              <h5><%= lang_data.Directions %></h5>
                              <button class="btn btn-pill btn-primary btn-air-primary" id="btn_address" type="button"><%= lang_data.Add_Another_Address %></button>
                            </div>

                            <div id="add_address">
                              <% cuuntry.forEach((data, i) => { %>

                                <div class="row g-3 client_add">
  
                                    <h5><%= lang_data.Address %></h5>
  
                                    <div class="col-4">
                                        <div class="col-form-label"><%= lang_data.Country %></div>
                                        <select class="js-example-basic-single customers_country" name="country" id=" " required>
                                            <option value selected disabled>Search Country</option>
                                            <% countries_data.forEach((x) => { %>
                                              <option value="<%= x.id %>" <%= data == x.id ? "selected" : "" %>><%= x.countries_name %></option>
                                            <% }) %>
                                        </select>
                                    </div>
  
                                    <div class="col-4">
                                        <div class="col-form-label"><%= lang_data.State %></div>
                                        <select class="js-example-basic-single customers_state" name="state" id="" required>
                                            <option value selected disabled>Search State</option>
                                            <% state_data.forEach((y) => { %>
                                              <% if (y.countries_id == data) { %>

                                                <option value="<%= y.id %>" <%= state[i] == y.id ? "selected" : "" %>><%= y.state_name %></option>
                                              <% } %>
                                            <% }) %>
                                            <!-- ajax -->
                                        </select>
                                    </div>
  
                                    <div class="col-4">
                                        <div class="col-form-label"><%= lang_data.City %></div>
                                        <select class="js-example-basic-single customers_city" name="city" id="" required>
                                            <option value selected disabled>Search City</option>
                                            <% city_data.forEach((z) => { %>
                                              <% if (z.state_id == state[i]) { %>
                                              <option value="<%= z.id %>" <%= city[i] == z.id ? "selected" : "" %>><%= z.city_name %></option>
                                              <% } %>
                                            <% }) %>
                                            <!-- ajax -->
                                        </select>
                                    </div>
  
                                    <div class="col-4">
                                        <label class="form-label"><%= lang_data.Zip_Code %></label>
                                        <input class="form-control" type="number" name="zipcode" value="<%= zipcode[i] %>" placeholder="Enter Zip Code" required>
                                    </div>
  
                                    <div class="col-4">
                                        <label class="form-label"><%= lang_data.Address %></label>
                                        <input class="form-control" type="text" name="address" value="<%= address[i] %>" placeholder="Enter Address" required>
                                    </div>
  
                                    <hr class="my-4">
                                </div>
                              <% }) %>
                            </div>

                            <hr>

                            <div class="row mb-5">
                                <label class="col-md-2 col-sm-3 col-form-label pb-0 pt-2"><%= lang_data.Customer_Status %></label>
                                <div class="col-sm-9 col-xl-8">
                                  <div class="mb-0 mt-2">
                                    <div class="form-check form-check-inline radio radio-success">
                                      <input class="form-check-input" id="inline-form-1" type="radio" name="customer_active" value="1" <%= edit_customers_data[0].customer_active == "1" ? "checked" : "" %>>
                                      <label class="form-check-label" for="inline-form-1"><%= lang_data.Active %></label>
                                    </div>
                                    <div class="form-check form-check-inline radio radio-danger">
                                      <input class="form-check-input" id="inline-form-2" type="radio" name="customer_active" value="0" <%= edit_customers_data[0].customer_active == "0" ? "checked" : "" %>>
                                      <label class="form-check-label" for="inline-form-2"><%= lang_data.Inactive %></label>
                                    </div>
                                  </div>
                                </div>
                            </div>

                            <button class="btn btn-pill btn-primary btn-air-primary" type="submit"><%= lang_data.Update_Profile %></button>

                        </div>
                      </form>
                    </div>
                </div>
              </div>
              <!-- Scroll - vertical dynamic Ends-->
            </div>
          </div>
          <!-- Container-fluid Ends-->
        </div>
        
        <%- include('./partials/footer'); -%>
        
    <%- include('./partials/script'); -%>

  </body>

</html>