<div class="modal fade" tabindex="-1" id="damages_add_modal" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
  <div class="modal-dialog " role="document" style="max-width: 75%">
    <div class="modal-content">
      <div class="modal-header" style="background-color: #36a3f7;border-radius: 4px">
        <h5 class="modal-title" id="exampleModalLabel" style="color: #ffffff" >
          Add Stock Damage
        </h5>
        <button type="button" class="close" data-dismiss="modal" aria-label="Close">
          <span aria-hidden="true">
            &times;
          </span>
        </button>
      </div>
      <form data-form-type='damages' class="m-form m-form--fit m-form--state m-form--label-align-right "  data-modal-id="damages_add_modal" autocomplete="off" id="form_damages_add" method="post" action="<?php echo base_url().'production/create_damages'?>" 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_damages_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-6">
              <div class="form-group m-form__group row">
                <label class="col-form-label col-lg-4" for="user_name">
                  Location Name
                </label>
                <div class="col-lg-8">
                  <div class="m-select2 m-select2--air m-select2--pill">
                    <select required style="width: 100%" class="form-control m-select2 m-select2--solid m-input--solid m-input " id="damages_location_add" name="location" data-placeholder="Select location">
                      <option selected disabled>Select Location</option>
                      <?php
                      foreach($stock_locations as $row): ?>
                      <option value="<?php echo $row->location_id?>"><?php echo $row->location_name?></option>
                      <?php
                    endforeach;
                    ?>
                  </select>
                </div>
                <span class="m-form__help"></span>
                </div>

            </div>
          </div>
          <div class="col-lg-6">
            <div class="form-group m-form__group row">
              <label class="col-form-label col-lg-6" for="user_name">
                Damage Date
              </label>
              <div class="col-lg-6">
                <div class="input-group m-input-group--air m-input-group--pill date">
                  <input required data-date-format="dd-mm-yyyy" autocomplete="off" id="damage_date" name="date"  type="text" class="form-control  m-input " placeholder="Damage Date" >
                </div>
              </div>
            </div>
          </div>
          <input type="hidden" name="redirect_url" value="<?php echo base_url(uri_string())?>" >
          <input type="hidden" name="count" value="0" id="stock_transfer_count" >
        </div>
        <div class="row">
          <div class="col-lg-12" id="stock_view_div" style="display:none;margin-top: 20px;">
            <table width="100%" class="table m-table   table-header-fixed table-striped- table-bordered table-striped table-hover table-header-fixed" id="stock_list_table">
              <caption id="stock_list_table_caption" style="caption-side: top;text-align: center;font-weight: 700;"></caption>
              <thead>
                <tr class="">
                  <th rowspan="2">Sl No</th>
                  <th rowspan="2">Stock ID</th>
                  <th rowspan="2">Material ID</th>
                  <th rowspan="2">Unit ID</th>
                  <th rowspan="2">Location ID</th>
                  <th rowspan="2">Material Name</th>
                  <th rowspan="2">Unit</th>
                  <th rowspan="2">Unit Price</th>
                  <th rowspan="2">Supplier</th>
                  <th colspan="2">Currently Available Stock</th>
                  <th rowspan="2">Location</th>
                  <th rowspan="2">Location Type</th>
                  <th colspan="2" style="display: none">Total Purchased Stock</th>
                  <th colspan="2" style="display: none">Total Transferred In Stock</th>
                  <th colspan="2" style="display: none">Total Transferred Out Stock</th>
                  <th colspan="2" style="display: none">Total Consumed Stock</th>
                  <th rowspan="2">Supplier ID</th>
                  <th rowspan="2">Damage Qty</th>
                </tr>
                <tr>
                  <th><span class="hidden">Currently Available Stock</span> Qty</th>
                  <th>Amount</th>
                  <th><span class="hidden">Total Purchased Stock</span> Qty</th>
                  <th>Amount</th>
                  <th><span class="hidden">Total Transferred In Stock</span>Qty</th>
                  <th>Amount</th>
                  <th><span class="hidden">Total Transferred Out Stock</span>Qty</th>
                  <th>Amount</th>
                  <th><span class="hidden">Total Consumed Stock</span>Qty</th>
                  <th>Amount</th>
                </tr>
              </thead>
              <tbody>
              </tbody>
            </table>
          </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">
          Save & Submit
        </button>
      </div>
    </form>
  </div>
</div>
</div>
<div class="modal fade" tabindex="-1" id="damages_delete_modal" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
  <div class="modal-dialog " role="document" >
    <form autocomplete="off" id="form_damages_delete" data-modal-id="damages_delete_modal"  method="post" action="<?php echo base_url().'production/delete_damages'?>" 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="damage_ids" id="damages_delete_ids">
          <input type="hidden"  value="0" class="numeric_fields">
          <input type="hidden" name="redirect_url" value="<?php echo base_url(uri_string())?>" >
        </div>
      </div>
    </form>
  </div>
</div>
