<table width="100%" class="table m-table nowrap table-header-fixed table-striped table-bordered table-hover table-header-fixed" id="income_receipts_view_table">
  <thead>
    <tr class="">
      <th>Sl No</th>
      <th>ID</th>
      <th>Receipt ID</th>
      <th>Received Date</th>
      <th>Income Under</th>
      <th>Income Head</th>
      <th>Received Amount</th>
      <th>Credited To Acc</th>
      <th>Receipt No</th>
      <th>Remarks</th>
      <th>Received By</th>
      <th>Created Date</th>
      <th>Actions</th>
      <th>Credit Acc</th>
      <th>Income Under</th>
      <th>Approval Status</th>
    </tr>
  </thead>
  <tbody>
  </tbody>
</table>
<div class="modal fade" tabindex="-1" id="income_receipt_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" >
          New Income Receipt
        </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="income_receipt" id="form_income_receipt_add" data-modal-id="income_receipt_add_modal" method="post" action="<?php echo base_url().'accounts/create_transaction'?>" 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_income_receipt_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-12">
              <div class="form-group m-form__group" >
                <label for="user_name">
                  Income Head
                </label>
                <div class="m-input-icon m-input-icon--right">
                  <input placeholder="Income Head" required name="income_head" type="text" class="form-control m-input m-input--pill m-input--air form_income_receipt_add_fields"  aria-describedby="basic-addon1">
                  <span class="m-input-icon__icon m-input-icon__icon--right"><span><i class="la la-edit"></i></span></span>
                </div>
                <span class="m-form__help"></span>
              </div>
            </div>
            <div class="col-lg-8">
              <div class="form-group m-form__group" >
                <label for="user_name">
                  Income Under - Office/Project
                </label>
                <div class="m-select2 m-select2--air m-select2--pill">
                  <select required style="width: 100%" class="form-control m-select2 form_income_receipt_add_select" id="income_receipt_work_add" name="work"  >
                    <option selected disabled>Select Office/Project</option>
                    <option value="0">Office</option>
                    <?php
                    foreach($work_contracts as $row): ?>
                    <option data-work-status="<?php echo $row->work_status?>" value="<?php echo $row->work_id?>"><?php echo $row->work_name?></option>
                    <?php
                  endforeach;
                  ?>
                </select>
              </div>
              <span class="m-form__help"></span>
            </div>
          </div>
            <div class="col-lg-4">
              <div class="form-group m-form__group" style="  !important">
                <label for="user_name">
                  Receipt No
                </label>
                <div class="m-input-icon m-input-icon--right">
                  <input type="text" name="reference_no"  class="form-control form_income_receipt_add_fields m-input m-input--pill m-input--air" placeholder="Receipt No" aria-describedby="basic-addon1">
                  <span class="m-input-icon__icon m-input-icon__icon--right"><span><i class="la la-tag"></i></span></span>
                </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">
                  Received Amount
                </label>
                <div class="m-input-icon m-input-icon--right">
                  <input required type="text" name="received_amount"  class="form-control form_income_receipt_add_fields m-input m-input--pill m-input--air" placeholder="Received Amount" aria-describedby="basic-addon1">
                  <span class="m-input-icon__icon m-input-icon__icon--right"><span><?php echo $this->config->item('Currency_currency_format'); ?></span></span>
                </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">
                  Received Date
                </label>
                <div class="m-input-icon m-input-icon--right">
                  <input  data-date-format="dd-mm-yyyy" id="income_receipt_received_date_add" required type="text" name="received_date" class="form-control form_income_receipt_add_fields m-input m-input--pill m-input--air" placeholder="Received Date" >
                  <span class="m-input-icon__icon m-input-icon__icon--right"><span><i class="la la-calendar"></i></span></span>
                </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">
                  Received To Acc
                </label>
                <div class="m-select2 m-select2--air m-select2--pill">
                  <select required id="income_receipt_acc_add" name="credit_acc" style="width: 100%" class="form-control m-input"  aria-describedby="basic-addon1">
                    <?php
                    foreach($this->config->item('account_heads') as $row):
                      $selected="";
                      if($row->acc_head_id==1){
                        $selected="selected";
                      }
                      ?>
                      <option <?php echo $selected?> value="<?php echo $row->acc_head_id?>"><?php echo $row->acc_head_name?></option>
                      <?php
                    endforeach;
                    ?>
                  </select>
                </div>
                <span class="m-form__help"></span>
              </div>
            </div>
            <div class="col-lg-12">
              <div class="form-group m-form__group" style="  !important">
                <label for="user_name">
                  Remarks
                </label>
                <div class="m-input-icon m-input-icon--right">
                  <input type="text" name="tr_remarks"  class="form-control form_income_receipt_add_fields m-input m-input--pill m-input--air" placeholder="Remarks" aria-describedby="basic-addon1">
                  <span class="m-input-icon__icon m-input-icon__icon--right"><span><i class="la la-edit"></i></span></span>
                </div>
                <span class="m-form__help"></span>
              </div>
            </div>
            <input type="hidden" name="tr_type" value="income_receipt_transaction" id="tr_type_add_income_receipt">
            <input type="hidden" name="reference_id" id="reference_id_add_income_receipt" value="0">
            <input type="hidden" name="reference_type" value="income_receipt" id="reference_type_add_income_receipt">
            <input type="hidden" name="redirect_url" value="<?php echo base_url(uri_string())?>" >
          </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>
<div class="modal fade" tabindex="-1" id="income_receipt_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: #00c5dc;border-radius: 4px">
        <h5 class="modal-title" id="exampleModalLabel" style="color: #ffffff" >
          Edit Income Receipt
        </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="income_receipt" id="form_income_receipt_edit" data-modal-id="income_receipt_edit_modal" method="post" action="<?php echo base_url().'accounts/update_transaction'?>" 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_income_receipt_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">
            <div class="col-lg-12">
              <div class="form-group m-form__group" >
                <label for="user_name">
                  Income Head
                </label>
                <div class="m-input-icon m-input-icon--right">
                  <input placeholder="Income Head" id="income_receipt_head_edit" required name="income_head" type="text" class="form-control m-input m-input--pill m-input--air form_income_receipt_edit_fields"  aria-describedby="basic-addon1">
                  <span class="m-input-icon__icon m-input-icon__icon--right"><span><i class="la la-edit"></i></span></span>
                </div>
                <span class="m-form__help"></span>
              </div>
            </div>
            <div class="col-lg-8">
              <div class="form-group m-form__group" >
                <label for="user_name">
                  Income Under - Office/Project
                </label>
                <div class="m-select2 m-select2--air m-select2--pill">
                  <select required style="width: 100%" class="form-control m-select2 form_income_receipt_edit_select" id="income_receipt_work_edit" name="work"  >
                    <option selected disabled>Select Office/Project</option>
                    <option value="0">Office</option>
                    <?php
                    foreach($work_contracts as $row): ?>
                    <option data-work-status="<?php echo $row->work_status?>" value="<?php echo $row->work_id?>"><?php echo $row->work_name?></option>
                    <?php
                  endforeach;
                  ?>
                </select>
              </div>
              <span class="m-form__help"></span>
            </div>
          </div>
          <div class="col-lg-4">
            <div class="form-group m-form__group" style="  !important">
              <label for="user_name">
                Receipt No
              </label>
              <div class="m-input-icon m-input-icon--right">
                <input type="text" name="reference_no" id="income_receipt_receipt_no_edit"  class="form-control form_income_receipt_edit_fields m-input m-input--pill m-input--air" placeholder="Receipt No" aria-describedby="basic-addon1">
                <span class="m-input-icon__icon m-input-icon__icon--right"><span><i class="la la-tag"></i></span></span>
              </div>
              <span class="m-form__help"></span>
            </div>
          </div>
            <div class="col-lg-4">
              <div class="form-group m-form__group" >
                <label for="income_receipt_amount">
                  Received Amount
                </label>
                <div class="m-input-icon m-input-icon--right">
                  <input required type="text" name="received_amount" id="income_receipt_received_amount_edit"  class="form-control form_income_receipt_edit_fields m-input m-input--pill m-input--air" placeholder="Payment Amount" aria-describedby="basic-addon1">
                  <span class="m-input-icon__icon m-input-icon__icon--right"><span><?php echo $this->config->item('Currency_currency_format'); ?></span></span>
                </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">
                  Received Date
                </label>
                <div class="m-input-icon m-input-icon--right">
                  <input  data-date-format="dd-mm-yyyy" id="income_receipt_received_date_edit" required type="text" name="received_date" class="form-control form_income_receipt_edit_fields m-input m-input--pill m-input--air" placeholder="Received Date" >
                  <span class="m-input-icon__icon m-input-icon__icon--right"><span><i class="la la-calendar"></i></span></span>
                </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">
                  Received To Acc
                </label>
                <div class="m-select2 m-select2--air m-select2--pill">
                  <select required id="income_receipt_acc_edit" name="credit_acc" style="width: 100%" class="form-control m-input"  aria-describedby="basic-addon1">
                    <?php
                    foreach($this->config->item('account_heads') as $row):
                      $selected="";
                      if($row->acc_head_id==1){
                        $selected="selected";
                      }
                      ?>
                      <option <?php echo $selected?> value="<?php echo $row->acc_head_id?>"><?php echo $row->acc_head_name?></option>
                      <?php
                    endforeach;
                    ?>
                  </select>
                </div>
                <span class="m-form__help"></span>
              </div>
            </div>
            <div class="col-lg-12">
              <div class="form-group m-form__group" style=" !important">
                <label for="income_receipt_remarks">
                  Remarks
                </label>
                <div class="m-input-icon m-input-icon--right">
                  <input type="text" name="tr_remarks" id="income_receipt_remarks_edit"  class="form-control form_income_receipt_edit_fields m-input m-input--pill m-input--air" placeholder="Remarks" aria-describedby="basic-addon1">
                  <span class="m-input-icon__icon m-input-icon__icon--right"><span><i class="la la-edit"></i></span></span>
                </div>
                <span class="m-form__help"></span>
              </div>
            </div>


            <input type="hidden" name="transaction_id" id="income_receipt_tr_id_edit">
            <input type="hidden" name="tr_type" value="income_receipt_transaction" id="tr_type_edit_income_receipt">
            <input type="hidden" name="reference_id" id="reference_id_edit_income_receipt" value="0">
            <input type="hidden" name="reference_type" value="income_receipt" id="reference_type_edit_income_receipt">
            <input type="hidden" name="redirect_url" value="<?php echo base_url(uri_string())?>" >
          </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>
