<div class="modal fade" tabindex="-1" id="material_add_modal" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
  <div class="modal-dialog " role="document" style="max-width: 750px">
    <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 Material
        </h5>
        <button type="button" class="close" data-dismiss="modal" aria-label="Close">
          <span aria-hidden="true">
            &times;
          </span>
        </button>
      </div>
      <form autocomplete="off" id="form_material_add" data-form-type="material_create" data-modal-id="material_add_modal" method="post" action="<?php echo base_url().'material/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_material_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>
            <?php if ($this->config->item('app_module_production') == 1 ){?>
              <div class="row">
                <div class="col-lg-6">
                  <div class="form-group m-form__group">
                    <label>
                      Material Section
                    </label>
                    <div class="m-radio-inline" style="padding-top: 10px;">
                      <label class="m-radio m-radio--solid m-radio--state-danger">
                        <input required type="radio" class="form_fields_radio" checked name="material_section" value="product"> Product
                        <span></span>
                      </label>
                      <label class="m-radio m-radio--solid m-radio--state-warning">
                        <input type="radio" class="form_fields_radio" name="material_section"  value="material"> Raw Material
                        <span></span>
                      </label>
                    </div>
                    <span class="m-form__help"></span>
                  </div>
                </div>
              </div>
            <?php } ?>
            <?php if($this->config->item('app_module_vehicle_management')==1){ ?>
              <div class="row">
                <div class="col-lg-6">
                  <div class="form-group m-form__group">
                    <label>
                      Material Type
                    </label>
                    <div class="m-radio-inline" style="padding-top: 10px;">
                      <label class="m-radio m-radio--solid m-radio--state-danger">
                        <input required type="radio" class="form_fields_radio" checked name="material_type" value="construction"> Construction Material
                        <span></span>
                      </label>
                      <label class="m-radio m-radio--solid m-radio--state-warning">
                        <input type="radio" class="form_fields_radio" name="material_type"  value="vehicle"> Vehicle Spare
                        <span></span>
                      </label>
                    </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">
                      <?php echo $this->config->item('Tax_tax_name') ?> %
                    </label>
                    <div class="m-select2 m-select2--air m-select2--pill ">
                      <select id="material_tax_percent_add" name="tax_percent" style="width: 100%" class="form-control m-input form_material_add_select" aria-describedby="basic-addon1" data-placeholder="Select Tax %">
                        <?php
                        $tax_percent = $this->config->item('Tax_tax_percent');
                        foreach ($tax_percent as $row) :
                          $selected_tax = '';
                          if ($row->tax_percentage == 0) {
                            $selected_tax = 'selected';
                          }
                          ?>
                          <option <?php echo $selected_tax ?> data-tax-percent="<?php echo $row->tax_percentage ?>" value="<?php echo $row->tax_id ?>"><?php echo $row->tax_name ?></option>
                          <?php
                        endforeach;
                        ?>
                      </select>
                    </div>
                    <span class="m-form__help"></span>
                  </div>
                </div>
              </div>
            <?php } ?>
            <div class="row">
              <div class="col-lg-8">
                <div class="form-group m-form__group">
                  <label for="user_name">
                    Material Name
                  </label>
                  <div class="input-group m-input-group m-input-group--pill m-input-group--air">
                    <input required type="text" name="name"  class="form-control m-input form_material_add_fields" placeholder="Material Name" aria-describedby="basic-addon1">
                  </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">
                    Unit
                  </label>
                  <?php if($this->session->userdata('branch_id')==0){?>
                    <div class="input-group m-input-group m-input-group--pill">
                      <div class="input-group-prepend">
                        <a href="#unit_add_modal"   data-toggle="modal" data-target="#unit_add_modal" class="btn btn-focus">
                          <i class="fa fa-plus-circle"></i>
                        </a>
                      </div>
                      <select style="width: 70%"  class="form-control m-select2 m-select2-general form_material_add_select" required id="material_unit_add" name="unit">

                      </select>
                    </div>
                  <?php }else{ ?>
                    <div class="m-select2 m-select2--air m-select2--pill ">
                      <select id="material_unit_add" required name="unit" style="width: 100%" class="form-control m-input form_material_add_select" aria-describedby="basic-addon1" data-placeholder="Select Unit">
                      </select>
                    </div>
                  <?php } ?>
                  <span class="m-form__help"></span>
                </div>
              </div>
            </div>
            <div class="row">
              <div class="col-lg-12">
                <div class="form-group m-form__group">
                  <label for="user_name">
                    Make / Specification / Brand
                  </label>
                  <div class="input-group m-input-group m-input-group--pill m-input-group--air">
                    <input  type="text" name="specification"  class="form-control m-input form_material_add_fields" placeholder="Make / Specification / Brand" aria-describedby="basic-addon1">
                  </div>
                  <span class="m-form__help"></span>
                </div>
              </div>
            </div>
            <div class="row">
              <div class="col-lg-4">
                <div class="form-group m-form__group">
                  <label for="user_name">
                    Category
                  </label>
                  <div class="m-select2 m-select2--air m-select2--pill ">
                    <select id="material_category_add" name="category" style="width: 100%" class="form-control m-input form_material_add_select" aria-describedby="basic-addon1" data-placeholder="Select Category">
                    </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">
                    Unit Price (Purchase)
                  </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">
                        <?php echo $this->config->item('Currency_currency_format'); ?>
                      </span>
                    </div>
                    <input required type="text" name="price"  class="form-control m-input form_material_add_fields" placeholder="Material Unit Price" aria-describedby="basic-addon1">
                  </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">
                    Item Code
                  </label>
                  <input type="text" name="item_code"  class="form-control m-input  m-input--air m-input--pill form_material_add_fields" placeholder="Item Code" aria-describedby="basic-addon1">
                  <span class="m-form__help"></span>
                </div>
              </div>
            </div>
            <?php if ($this->config->item('app_module_sales_invoice') == 1 && $this->config->item('Material_sale_price_category_enable') == 1){ ?>
              <div class="row">
                <?php if($this->config->item('Material_sale_price1_name')!=''){ ?>
                  <div class="col-lg-4">
                    <div class="form-group m-form__group">
                      <label for="user_name" style="text-align: left;">
                        Sale Price  <br/>[<?php echo $this->config->item('Material_sale_price1_name') ?>]
                      </label>
                      <input type="text" name="sale_price1"   class="form-control m-input  m-input--air m-input--pill form_material_add_fields" placeholder="Sale Price [<?php echo $this->config->item('Material_sale_price1_name') ?>]" aria-describedby="basic-addon1">
                      <span class="m-form__help"></span>
                    </div>
                  </div>
                <?php } ?>
                <?php if($this->config->item('Material_sale_price2_name')!=''){ ?>
                  <div class="col-lg-4">
                    <div class="form-group m-form__group">
                      <label for="user_name" style="text-align: left;">
                        Sale Price  <br/>[<?php echo $this->config->item('Material_sale_price2_name') ?>]
                      </label>
                      <input type="text" name="sale_price2"   class="form-control m-input  m-input--air m-input--pill form_material_add_fields" placeholder="Sale Price [<?php echo $this->config->item('Material_sale_price2_name') ?>]" aria-describedby="basic-addon1">
                      <span class="m-form__help"></span>
                    </div>
                  </div>
                <?php } ?>
                <?php if($this->config->item('Material_sale_price3_name')!=''){ ?>
                  <div class="col-lg-4">
                    <div class="form-group m-form__group">
                      <label for="user_name" style="text-align: left;">
                        Sale Price  <br/>[<?php echo $this->config->item('Material_sale_price3_name') ?>]
                      </label>
                      <input type="text" name="sale_price3"   class="form-control m-input  m-input--air m-input--pill form_material_add_fields" placeholder="Sale Price [<?php echo $this->config->item('Material_sale_price3_name') ?>]" aria-describedby="basic-addon1">
                      <span class="m-form__help"></span>
                    </div>
                  </div>
                <?php } ?>
                <?php if($this->config->item('Material_sale_price4_name')!=''){ ?>
                  <div class="col-lg-4">
                    <div class="form-group m-form__group">
                      <label for="user_name" style="text-align: left;">
                        Sale Price  <br/>[<?php echo $this->config->item('Material_sale_price4_name') ?>]
                      </label>
                      <input type="text" name="sale_price4"   class="form-control m-input  m-input--air m-input--pill form_material_add_fields" placeholder="Sale Price [<?php echo $this->config->item('Material_sale_price4_name') ?>]" aria-describedby="basic-addon1">
                      <span class="m-form__help"></span>
                    </div>
                  </div>
                <?php } ?>
                <?php if($this->config->item('Material_sale_price5_name')!=''){ ?>
                  <div class="col-lg-4">
                    <div class="form-group m-form__group">
                      <label for="user_name" style="text-align: left;">
                        Sale Price  <br/>[<?php echo $this->config->item('Material_sale_price5_name') ?>]
                      </label>
                      <input type="text" name="sale_price5"   class="form-control m-input  m-input--air m-input--pill form_material_add_fields" placeholder="Sale Price [<?php echo $this->config->item('Material_sale_price5_name') ?>]" aria-describedby="basic-addon1">
                      <span class="m-form__help"></span>
                    </div>
                  </div>
                <?php } ?>
                <?php if($this->config->item('Material_sale_price6_name')!=''){ ?>
                  <div class="col-lg-4">
                    <div class="form-group m-form__group">
                      <label for="user_name" style="text-align: left;">
                        Sale Price  <br/>[<?php echo $this->config->item('Material_sale_price6_name') ?>]
                      </label>
                      <input type="text" name="sale_price6"   class="form-control m-input  m-input--air m-input--pill form_material_add_fields" placeholder="Sale Price [<?php echo $this->config->item('Material_sale_price6_name') ?>]" aria-describedby="basic-addon1">
                      <span class="m-form__help"></span>
                    </div>
                  </div>
                <?php } ?>
              </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 form_submit_btn btn-primary">
            Submit
          </button>
        </div>
      </form>
    </div>
  </div>
</div>
