<div class="modal fade" tabindex="-1" id="sales_target_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 Sales target
        </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="sales_target" id="form_sales_targets_add" data-modal-id="sales_target_add_modal" method="post" action="<?php echo base_url() . 'sales_targets/create' ?>" enctype="multipart/form-data" class="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_sales_targets_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">

            <div class="col-lg-4">
              <div class="form-group m-form__group m-select2--pill">
                <label for="user_name">
                  Sales Staff
                </label>
                <div class="m-select2 m-select2--air m-select2--pill">
                  <select style="width: 100%" class="form-control m-select2 m-select2-general" required id="sales_staff" name="sales_staff" data-placeholder="Select Sales Staff">
                    <option disabled="" selected="">Select Sales Staff</option>
                    <?php
                    foreach ($sales_staffs as $key => $value) {
                      echo '<option value="' . $value->user_id . '">' . $value->user_alias . '</option>';
                    }
                    ?>
                  </select>
                </div>
                <span class="m-form__help"></span>
              </div>
            </div>

            <div class="col-lg-4">
              <div class="form-group m-form__group">
                <label for="user_name">
                  Month
                </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="fa fa-calendar-alt"></i>
                    </span>
                  </div>
                  <input readonly required placeholder="Month" type="text" name="month" id="month" class="form-control form_sales_targets_add_fields m-input" aria-describedby="basic-addon1">
                </div>
                <span class="m-form__help"></span>
              </div>
            </div>

            <!-- col-md-2 radio button sales_target_type product or service -->
            <div class="col-lg-4">
              <div class="form-group m-form__group">
                <label for="user_name">
                  Type
                </label>
                <div class="m-radio-inline">
                  <label class="m-radio m-radio--solid m-radio--state-brand">
                    <input type="radio" name="sales_target_type" value="product" checked>
                    Product
                    <span></span>
                  </label>
                  <label class="m-radio m-radio--solid m-radio--state-info">
                    <input type="radio" name="sales_target_type" value="service">
                    Service
                    <span></span>
                  </label>
                  <label class="m-radio m-radio--solid m-radio--state-focus">
                    <input type="radio" name="sales_target_type" value="Both">
                    Both
                    <span></span>
                  </label>
                </div>
                <span class="m-form__help"></span>
              </div>
            </div>

          </div>

          <div class="row">
            <div class="col-lg-12">
              <div class="table-responsive">
                <table id="sales_targets_add_table" style="width: 100%;" class="table table-bordered table-striped table-hover m-table m-table--head-bg-brand">
                  <thead class="thead-dark">
                    <tr>
                      <th width="75%">
                        Target Amount
                      </th>
                      <th width="20%">
                        Incentive %
                      </th>
                      <th width="5%">
                        &nbsp;
                      </th>
                    </tr>
                  </thead>
                  <tbody id="sales_targets_add_tbody">
                    <tr>
                      <td>
                        <div class="form-group m-form__group">
                          <input required type="text" name="items[target_amount][]" class="form-control m-input m-input--air m-input--pill" placeholder="Target Amount">
                          <span class="m-form__help"></span>
                        </div>
                      </td>
                      <td>
                        <div class="form-group m-form__group">
                          <input required type="text" name="items[incentive_percent][]" class="form-control m-input m-input--air m-input--pill" placeholder="Incentive %">
                          <span class="m-form__help"></span>
                        </div>
                      </td>
                      <td>
                        <a style="margin-left: 5px;margin-right: 5px" id="sales_targets_edit_remove_btn" class="btn btn-danger text-white  m-btn m-btn--icon  m-btn--icon-only  m-btn--pill m-btn--air">
                          <i class="la la-trash"></i>
                        </a>
                      </td>
                    </tr>
                  </tbody>
                  <tfoot>
                    <tr>
                      <td colspan="2">
                      </td>
                      <td>
                        <a style="margin-left: 5px;margin-right: 5px" id="sales_targets_add_add_row" class="btn btn-primary m-btn m-btn--icon  m-btn--icon-only  m-btn--pill m-btn--air text-white">
                          <i class="la la-plus"></i>
                        </a>
                      </td>

                    </tr>
                  </table>
                </div>
              </div>
            </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="sales_target_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 Sales target
          </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="sales_target" id="form_sales_targets_edit" data-modal-id="sales_target_edit_modal" method="post" action="<?php echo base_url() . 'sales_targets/update' ?>" enctype="multipart/form-data" class="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_sales_targets_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">

              <input type="hidden" name="sales_target_id" id="sales_target_id_edit">

              <div class="col-lg-4">
                <div class="form-group m-form__group m-select2--pill">
                  <label for="user_name">
                    Sales Staff
                  </label>
                  <div class="m-select2 m-select2--air m-select2--pill">
                    <select style="width: 100%" class="form-control m-select2 m-select2-general" required id="sales_staff_edit" name="sales_staff" data-placeholder="Select Sales Staff">
                      <option disabled="" selected="">Select Sales Staff</option>
                      <?php
                      foreach ($sales_staffs as $key => $value) {
                        echo '<option value="' . $value->user_id . '">' . $value->user_alias . '</option>';
                      }
                      ?>
                    </select>
                  </div>
                  <span class="m-form__help"></span>
                </div>
              </div>

              <div class="col-lg-4">
                <div class="form-group m-form__group">
                  <label for="user_name">
                    Month
                  </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="fa fa-calendar-alt"></i>
                      </span>
                    </div>
                    <input readonly required placeholder="Month" type="text" name="month" id="month_edit" class="form-control form_sales_targets_edit_fields m-input" aria-describedby="basic-addon1">
                  </div>
                  <span class="m-form__help"></span>
                </div>
              </div>

              <!-- col-md-2 radio button sales_target_type product or service -->
              <div class="col-lg-4">
                <div class="form-group m-form__group">
                  <label for="user_name">
                    Type
                  </label>
                  <div class="m-radio-inline">
                    <label class="m-radio m-radio--solid m-radio--state-brand">
                      <input type="radio" name="sales_target_type_edit" value="product" checked>
                      Product
                      <span></span>
                    </label>
                    <label class="m-radio m-radio--solid m-radio--state-info">
                      <input type="radio" name="sales_target_type_edit" value="service">
                      Service
                      <span></span>
                    </label>
                    <label class="m-radio m-radio--solid m-radio--state-focus">
                      <input type="radio" name="sales_target_type" value="Both">
                      Both
                      <span></span>
                    </label>
                  </div>
                  <span class="m-form__help"></span>
                </div>
              </div>

            </div>

            <div class="row">
              <div class="col-lg-12">
                <div class="table-responsive">
                  <table id="sales_targets_edit_table" style="width: 100%;" class="table table-bordered table-striped table-hover m-table m-table--head-bg-brand">
                    <thead class="thead-dark">
                      <tr>
                        <th width="75%">
                          Target Amount
                        </th>
                        <th width="20%">
                          Incentive %
                        </th>
                        <th width="5%">
                          &nbsp;
                        </th>
                      </tr>
                    </thead>
                    <input type="hidden" name="sales_target_delete_ids" id="sales_target_delete_ids">
                    <tbody id="sales_targets_edit_tbody">
                      <tr>
                        <td>
                          <div class="form-group m-form__group">
                            <input required type="text" name="items[target_amount][]" class="form-control m-input m-input--air m-input--pill" placeholder="Target Amount">
                            <span class="m-form__help"></span>
                          </div>
                        </td>
                        <td>
                          <div class="form-group m-form__group">
                            <input required type="text" name="items[incentive_percent][]" class="form-control m-input m-input--air m-input--pill" placeholder="Incentive %">
                            <span class="m-form__help"></span>
                          </div>
                        </td>
                        <td>
                          <a style="margin-left: 5px;margin-right: 5px" id="sales_targets_edit_remove_btn" class="btn btn-danger text-white  m-btn m-btn--icon  m-btn--icon-only  m-btn--pill m-btn--air">
                            <i class="la la-trash"></i>
                          </a>
                        </td>
                      </tr>
                    </tbody>
                    <tfoot>
                      <tr>
                        <td colspan="2">
                        </td>
                        <td>
                          <a style="margin-left: 5px;margin-right: 5px" id="sales_targets_edit_add_row" class="btn btn-primary m-btn m-btn--icon  m-btn--icon-only  m-btn--pill m-btn--air text-white">
                            <i class="la la-plus"></i>
                          </a>
                        </td>

                      </tr>
                    </table>
                  </div>
                </div>
              </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">
                Update
              </button>
            </div>
          </form>
        </div>
      </div>
    </div>


    <div class="modal fade" tabindex="-1" id="sales_target_delete_modal" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
      <div class="modal-dialog " role="document">
        <form autocomplete="off" method="post" data-modal-id="sales_target_delete_modal" id="form_sales_target_delete" action="<?php echo base_url() . 'sales_targets/delete_target' ?>" 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="redirect_url" value="<?php echo base_url(uri_string()) ?>">
              <input type="hidden" name="sales_target_id" id="sales_target_id_delete">
            </div>
          </div>
        </form>
      </div>
    </div>
