<div class="modal fade" tabindex="-1" id="customer_add_modal" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
  <div class="modal-dialog " role="document" style="max-width: 800px">
    <div class="modal-content">
      <div class="modal-header" style="background-color: #36a3f7;border-radius: 4px">
        <h5 class="modal-title" id="exampleModalLabel" style="color: #ffffff" >
          Create New Customer
        </h5>
        <button type="button" class="close" data-dismiss="modal" aria-label="Close">
          <span aria-hidden="true">
            &times;
          </span>
        </button>
      </div>
      <form autocomplete="off" data-form-type="customer" data-modal-id="customer_add_modal" id="form_customer_add" method="post" action="<?php echo base_url().'customers/create'?>" enctype="multipart/form-data" class="form m-form m-form--fit m-form--state m-form--label-align-right " >
        <div class="modal-body">
          <div class="m-form__content">
            <div class="m-alert m-alert--icon alert alert-warning m--hide" role="alert" id="form_customer_add_msg">
              <div class="m-alert__icon">
                <i class="la la-warning"></i>
              </div>
              <div class="m-alert__text">
                Oh snap! Change a few things up and try submitting again.
              </div>
              <div class="m-alert__close">
                <button type="button" class="close" data-close="alert" aria-label="Close"></button>
              </div>
            </div>
          </div>
          <div class="row">
            <?php if ($this->config->item('app_module_sales_invoice') == 1  && $this->config->item('Material_sale_price_category_enable') == 1){ ?>
            <div class="col-lg-8">
            <?php }else{ ?>
              <div class="col-lg-12">
            <?php } ?>
              <div class="form-group m-form__group" >
                <label for="user_name">
                  Name of Customer/Company
                </label>
                <div class="input-group m-input-group m-input-group--pill m-input-group--air">
                  <div class="input-group-prepend">
                    <span class="input-group-text" id="basic-addon1">
                      <i class="la la-user"></i>
                    </span>
                  </div>
                  <input required type="text" name="customer_name" id="customer_name" class="form-control m-input form_customer_add_fields" placeholder="Name of Customer/Company" aria-describedby="basic-addon1">
                </div>
                <span class="m-form__help"></span>
              </div>
            </div>
            <?php if ($this->config->item('app_module_sales_invoice') == 1 && $this->config->item('Material_sale_price_category_enable') == 1){ ?>
            <div class="col-lg-4">
              <div class="form-group m-form__group"  >
                <label for="user_name">
                  Sale Price Category
                </label>
                <div class="m-select2 m-select2--air m-select2--pill">
                  <select required id="sale_price_category_add"  name="sale_price_category"  style="width: 100%" class="form-control m-input"  aria-describedby="basic-addon1" >
                    <option selected disabled>Select Sale Price Category</option>
                    <option value="1"><?php echo $this->config->item('Material_sale_price1_name') ?></option>
                    <option value="2"><?php echo $this->config->item('Material_sale_price2_name') ?></option>
                    <option value="3"><?php echo $this->config->item('Material_sale_price3_name') ?></option>
                    <option value="4"><?php echo $this->config->item('Material_sale_price4_name') ?></option>
                    <option value="5"><?php echo $this->config->item('Material_sale_price5_name') ?></option>
                    <option value="6"><?php echo $this->config->item('Material_sale_price6_name') ?></option>
                  </select>
                </div>
                <span class="m-form__help"></span>
              </div>
            </div>
          <?php } ?>
          <div class="col-lg-12">
            <div class="form-group m-form__group" >
              <label for="user_name">
                Contact Person Name
              </label>
              <div class="input-group m-input-group m-input-group--pill m-input-group--air">
                <div class="input-group-prepend">
                  <span class="input-group-text" id="basic-addon1">
                    <i class="la la-edit"></i>
                  </span>
                </div>
                <input type="text" name="contact_person" id="contact_person" class="form-control m-input form_customer_add_fields" placeholder="Contact Person" aria-describedby="basic-addon1">
              </div>
              <span class="m-form__help"></span>
            </div>
          </div>
            <div class="col-lg-6">
              <div class="form-group m-form__group" >
                <label for="user_name">
                  Phone Number
                </label>
                <div class="input-group m-input-group m-input-group--pill m-input-group--air">
                  <div class="input-group-prepend">
                    <span class="input-group-text" id="basic-addon1">
                      <i class="la la-phone"></i>
                    </span>
                  </div>
                  <input  type="text" name="mobile_number" id="mobile_number" class="form-control m-input form_customer_add_fields" placeholder="Phone Number" aria-describedby="basic-addon1">
                </div>
                <span class="m-form__help"></span>
              </div>
            </div>
            <div class="col-lg-6">
              <div class="form-group m-form__group" >
                <label for="user_name">
                  E Mail
                </label>
                <div class="input-group m-input-group m-input-group--pill m-input-group--air">
                  <div class="input-group-prepend">
                    <span class="input-group-text" id="basic-addon1">
                      <i class="la la-envelope"></i>
                    </span>
                  </div>
                  <input type="text" name="email" id="email" class="form-control m-input form_customer_add_fields" placeholder="E Mail of Customer" aria-describedby="basic-addon1">
                </div>
                <span class="m-form__help"></span>
              </div>
            </div>
            <?php if ($this->config->item('app_module_sales_invoice') == 1){ ?>
            <div class="col-lg-6">
            <?php }else{ ?>
              <div class="col-lg-12">
            <?php } ?>
              <div class="form-group m-form__group">
                <label for="user_name">
                  Address
                </label>
                <textarea required placeholder="Address" rows="7" name="address" class="form-control form_customer_add_fields m-input  m-input--air m-input--pill" ></textarea>
                <span class="m-form__help"></span>
              </div>
            </div>
            <?php if ($this->config->item('app_module_sales_invoice') == 1){ ?>
            <div class="col-lg-6">
              <div class="form-group m-form__group">
                <label for="user_name">
                  <?php echo $this->config->item('Tax_tax_name') ?>/TRN No
                </label>
                <div class="m-input-icon m-input-icon--right">
                  <input type="text" class="form-control m-input m-input--pill m-input--air" aria-describedby="basic-addon1" name="taxno">
                  <span class="m-input-icon__icon m-input-icon__icon--right"><span><i class="la la-edit"></i></span></span>
                </div>
              </div>
              <div class="form-group m-form__group"  >
                <label for="user_name">
                  State Code
                </label>
                <div class="m-select2 m-select2--air m-select2--pill">
                  <select required id="state_id_add"  name="state_id"  style="width: 100%" class="form-control m-input"  aria-describedby="basic-addon1" >
                    <option selected disabled>Select State</option>
                    <option value="0">N/A</option>
                    <?php
                    foreach($tax_state_codes as $row):
                      ?>
                      <option value="<?php echo $row->state_id?>"><?php echo $row->state_name." - ".$row->state_code?></option>
                      <?php
                    endforeach;
                    ?>
                  </select>
                </div>
                <span class="m-form__help"></span>
              </div>
            </div>
          <?php } ?>
          </div>


        </div>
        <div class="modal-footer">
          <button type="button" class="btn btn-secondary " data-dismiss="modal">
            Close
          </button>
          <button type="submit" class="btn btn-primary form_submit_btn">
            Submit
          </button>
        </div>
      </form>
    </div>
  </div>
</div>

<div class="modal fade" tabindex="-1" id="customer_edit_modal" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
  <div class="modal-dialog " role="document" style="max-width: 800px">
    <div class="modal-content">
      <div class="modal-header" style="background-color: #36a3f7;border-radius: 4px">
        <h5 class="modal-title" id="exampleModalLabel" style="color: #ffffff" >
          Update Customer
        </h5>
        <button type="button" class="close" data-dismiss="modal" aria-label="Close">
          <span aria-hidden="true">
            &times;
          </span>
        </button>
      </div>
      <form autocomplete="off" data-modal-id="customer_edit_modal" id="form_customer_edit" method="post" action="<?php echo base_url().'customers/update'?>" enctype="multipart/form-data" class="form m-form m-form--fit m-form--state m-form--label-align-right " >
        <div class="modal-body">
          <div class="m-form__content">
            <div class="m-alert m-alert--icon alert alert-warning m--hide" role="alert" id="form_customer_edit_msg">
              <div class="m-alert__icon">
                <i class="la la-warning"></i>
              </div>
              <div class="m-alert__text">
                Oh snap! Change a few things up and try submitting again.
              </div>
              <div class="m-alert__close">
                <button type="button" class="close" data-close="alert" aria-label="Close"></button>
              </div>
            </div>
          </div>
          <div class="row">
            <?php if ($this->config->item('app_module_sales_invoice') == 1  && $this->config->item('Material_sale_price_category_enable') == 1){ ?>
            <div class="col-lg-8">
            <?php }else{ ?>
              <div class="col-lg-12">
            <?php } ?>
              <div class="form-group m-form__group" >
                <label for="user_name">
                  Name of Customer/Company
                </label>
                <div class="input-group m-input-group m-input-group--pill m-input-group--air">
                  <div class="input-group-prepend">
                    <span class="input-group-text" id="basic-addon1">
                      <i class="la la-user"></i>
                    </span>
                  </div>
                  <input required type="text" name="customer_name" id="customer_name_edit" class="form-control m-input form_customer_edit_fields" placeholder="Name of Customer/Company" aria-describedby="basic-addon1">
                </div>
                <span class="m-form__help"></span>
              </div>
            </div>
            <?php if ($this->config->item('app_module_sales_invoice') == 1  && $this->config->item('Material_sale_price_category_enable') == 1){ ?>
            <div class="col-lg-4">
              <div class="form-group m-form__group"  >
                <label for="user_name">
                  Sale Price Category
                </label>
                <div class="m-select2 m-select2--air m-select2--pill">
                  <select required id="sale_price_category_edit"  name="sale_price_category"  style="width: 100%" class="form-control m-input"  aria-describedby="basic-addon1" >
                    <option selected disabled>Select Sale Price Category</option>
                    <option value="1"><?php echo $this->config->item('Material_sale_price1_name') ?></option>
                    <option value="2"><?php echo $this->config->item('Material_sale_price2_name') ?></option>
                    <option value="3"><?php echo $this->config->item('Material_sale_price3_name') ?></option>
                    <option value="4"><?php echo $this->config->item('Material_sale_price4_name') ?></option>
                    <option value="5"><?php echo $this->config->item('Material_sale_price5_name') ?></option>
                    <option value="6"><?php echo $this->config->item('Material_sale_price6_name') ?></option>
                  </select>
                </div>
                <span class="m-form__help"></span>
              </div>
            </div>
          <?php } ?>
          <div class="col-lg-12">
            <div class="form-group m-form__group" >
              <label for="user_name">
                Contact Person
              </label>
              <div class="input-group m-input-group m-input-group--pill m-input-group--air">
                <div class="input-group-prepend">
                  <span class="input-group-text" id="basic-addon1">
                    <i class="la la-edit"></i>
                  </span>
                </div>
                <input type="text" name="contact_person" id="contact_person_edit" class="form-control m-input form_customer_edit_fields" placeholder="Contact Person" aria-describedby="basic-addon1">
              </div>
              <span class="m-form__help"></span>
            </div>
          </div>
            <div class="col-lg-6">
              <div class="form-group m-form__group" >
                <label for="user_name">
                  Phone Number
                </label>
                <div class="input-group m-input-group m-input-group--pill m-input-group--air">
                  <div class="input-group-prepend">
                    <span class="input-group-text" id="basic-addon1">
                      <i class="la la-phone"></i>
                    </span>
                  </div>
                  <input  type="text" name="mobile_number" id="mobile_number_edit" class="form-control m-input form_customer_edit_fields" placeholder="Phone Number" aria-describedby="basic-addon1">
                </div>
                <span class="m-form__help"></span>
              </div>
            </div>
            <div class="col-lg-6">
              <div class="form-group m-form__group" >
                <label for="user_name">
                  E Mail
                </label>
                <div class="input-group m-input-group m-input-group--pill m-input-group--air">
                  <div class="input-group-prepend">
                    <span class="input-group-text" id="basic-addon1">
                      <i class="la la-envelope"></i>
                    </span>
                  </div>
                  <input type="text" name="email" id="email_edit" class="form-control m-input form_customer_edit_fields" placeholder="E Mail of Customer" aria-describedby="basic-addon1">
                </div>
                <span class="m-form__help"></span>
              </div>
            </div>

            <?php if ($this->config->item('app_module_sales_invoice') == 1){ ?>
            <div class="col-lg-6">
            <?php }else{ ?>
              <div class="col-lg-12">
            <?php } ?>
              <div class="form-group m-form__group">
                <label for="user_name">
                  Address
                </label>
                <textarea required placeholder="Address" rows="7" name="address" id="address_edit" class="form-control form_customer_edit_fields m-input  m-input--air m-input--pill" ></textarea>
                <span class="m-form__help"></span>
              </div>
            </div>
            <?php if ($this->config->item('app_module_sales_invoice') == 1){ ?>
            <div class="col-lg-6">
              <div class="form-group m-form__group">
                <label for="user_name">
                  <?php echo $this->config->item('Tax_tax_name') ?>/TRN No
                </label>
                <div class="m-input-icon m-input-icon--right">
                  <input type="text" class="form-control m-input m-input--pill m-input--air" id="taxno_edit" aria-describedby="basic-addon1" name="taxno">
                  <span class="m-input-icon__icon m-input-icon__icon--right"><span><i class="la la-edit"></i></span></span>
                </div>
              </div>
              <div class="form-group m-form__group"  >
                <label for="user_name">
                  State Code
                </label>
                <div class="m-select2 m-select2--air m-select2--pill">
                  <select required id="state_id_edit"  name="state_id"  style="width: 100%" class="form-control m-input"  aria-describedby="basic-addon1" >
                    <option selected disabled>Select State</option>
                    <option value="0">N/A</option>
                    <?php
                    foreach($tax_state_codes as $row):
                      ?>
                      <option value="<?php echo $row->state_id?>"><?php echo $row->state_name." - ".$row->state_code?></option>
                      <?php
                    endforeach;
                    ?>
                  </select>
                </div>
                <span class="m-form__help"></span>
              </div>
            </div>
          <?php } ?>
          </div>
          <input type="hidden" name="customer_id" id="customer_id_edit">
        </div>
        <div class="modal-footer">
          <button type="button" class="btn btn-secondary " data-dismiss="modal">
            Close
          </button>
          <button type="submit" class="btn btn-primary form_submit_btn">
            Submit
          </button>
        </div>
      </form>
    </div>
  </div>
</div>


<div class="modal fade" tabindex="-1" id="customer_delete_modal" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
  <div class="modal-dialog " role="document" >
    <form autocomplete="off" data-modal-id="customer_delete_modal" method="post" action="<?php echo base_url().'customers/delete'?>" class="form-horizontal">
      <div class="modal-content">
        <div class="alert alert-danger" role="alert" style="margin-bottom: 0px">
          <button type="button" class="close" data-dismiss="modal"></button>
          <br/>
          <h4 class="alert-heading">Warning! Please Confirm Your Action</h4>
          <br/>
          <p> Are You Sure to Delete this Data ?. All the Associated Data will Lost. </p>
          <p>
            <button class="btn btn-danger form_submit_btn" type="submit" name="submit">Confirm & Delete</button>
            <button type="button" class="btn btn-primary modal-dismiss" data-dismiss="modal">Cancel</button>
          </p>
          <input type="hidden" name="customer_id" id="customer_delete_id">
        </div>
      </div>
    </form>
  </div>
</div>
