<table width="100%" class="table m-table nowrap table-header-fixed table-striped table-bordered table-hover table-header-fixed" id="payments_schedule_view_table">
  <thead>
    <tr class="">
      <th>Sl No</th>
      <th>Type</th>
      <th>Work Name</th>
      <th>Client Name</th>
      <th>Stage No</th>
      <th>Stage Name</th>
      <th>Scheduled Date</th>
      <th>Scheduled Amount</th>
      <th>Remarks</th>
      <th>Created By</th>
      <th>Created Date</th>
      <th>Actions</th>
      <th>ID</th>
      <th>work ID</th>

    </tr>
  </thead>
  <tbody>
  </tbody>
</table>
<div class="modal fade" tabindex="-1" id="payment_schedule_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" >
          Schedule Payment From Client
        </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="client_payment" id="form_payment_schedule_add" data-modal-id="payment_schedule_add_modal" method="post" action="<?php echo base_url().'payment_schedule/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_client_payment_schedule_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" >
                <label for="user_name">
                  Work Name
                </label>
                <div class="m-select2 m-select2--air m-select2--pill">
                  <select required style="width: 100%" class="form-control m-select2 form_payment_schedule_add_select" id="payment_schedule_work_add"  name="reference_id" data-placeholder="Select Work">
                    <option selected disabled>Select Work</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-6">
              <div class="form-group m-form__group" >
                <label for="user_name">
                  Client Name
                </label>
                <div class="m-input-icon m-input-icon--right">
                  <input type="text" name="client_name" readonly class="form-control form_client_payment_add_fields m-input m-input--pill m-input--air" id="client_payment_client_name_add" aria-describedby="basic-addon1">
                  <span class="m-input-icon__icon m-input-icon__icon--right"><span><i class="la la-user"></i></span></span>
                </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">
                  Scheduled Amount
                </label>
                <div class="m-input-icon m-input-icon--right">
                  <input required type="text" name="scheduled_amount"  class="form-control form_client_payment_add_fields m-input m-input--pill m-input--air" placeholder="Scheduled 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-6">
              <div class="form-group m-form__group" >
                <label for="user_name">
                  Scheduled Date
                </label>
                <div class="m-input-icon m-input-icon--right">
                  <input  data-date-format="dd-mm-yyyy" id="payment_scheduled_date_add" required type="text" name="scheduled_date" class="form-control form_client_payment_add_fields m-input m-input--pill m-input--air" placeholder="Scheduled 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-6">
              <div class="form-group m-form__group" style="  !important">
                <label for="user_name">
                  Stage No
                </label>
                <div class="m-input-icon m-input-icon--right">
                  <input type="text" name="stage_no"  class="form-control form_client_payment_add_fields m-input m-input--pill m-input--air" placeholder="Stage No" 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-6">
              <div class="form-group m-form__group" style="  !important">
                <label for="user_name">
                  Stage Name
                </label>
                <div class="m-input-icon m-input-icon--right">
                  <input type="text" name="stage_name"  class="form-control form_client_payment_add_fields m-input m-input--pill m-input--air" placeholder="Stage Name" 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-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_client_payment_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="reference_type" value="work" id="reference_type_add_client_payment">
            <input type="hidden" name="type" value="client_payment" id="">

            <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="payment_schedule_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" >
          Schedule Payment From Client
        </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="client_payment" id="form_client_payment_schedule_edit" data-modal-id="payment_schedule_edit_modal" method="post" action="<?php echo base_url().'payment_schedule/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_client_payment_schedule_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" >
                <label for="user_name">
                  Work Name
                </label>
                <div class="m-select2 m-select2--air m-select2--pill">
                  <select required style="width: 100%" class="form-control m-select2 form_client_payment_schedule_edit_select" id="client_payment_work_edit"  name="reference_id" data-placeholder="Select Work">
                    <option selected disabled>Select Work</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-6">
              <div class="form-group m-form__group" >
                <label for="user_name">
                  Client Name
                </label>
                <div class="m-input-icon m-input-icon--right">
                  <input type="text" name="client_name" readonly class="form-control form_client_payment_add_fields m-input m-input--pill m-input--air" id="client_payment_client_name_edit" aria-describedby="basic-addon1">
                  <span class="m-input-icon__icon m-input-icon__icon--right"><span><i class="la la-user"></i></span></span>
                </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">
                  Scheduled Amount
                </label>
                <div class="m-input-icon m-input-icon--right">
                  <input required type="text" name="scheduled_amount"  class="form-control form_client_payment_add_fields m-input m-input--pill m-input--air" id="scheduled_amount" placeholder="Scheduled 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-6">
              <div class="form-group m-form__group" >
                <label for="user_name">
                  Scheduled Date
                </label>
                <div class="m-input-icon m-input-icon--right">
                  <input  data-date-format="dd-mm-yyyy" id="payment_scheduled_date_edit" required type="text" name="scheduled_date" class="form-control form_client_payment_add_fields m-input m-input--pill m-input--air" placeholder="Scheduled 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-6">
              <div class="form-group m-form__group" style="  !important">
                <label for="user_name">
                  Stage No
                </label>
                <div class="m-input-icon m-input-icon--right">
                  <input type="text" name="stage_no"  class="form-control form_client_payment_add_fields m-input m-input--pill m-input--air" id="stage_no" placeholder="Stage No" 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-6">
              <div class="form-group m-form__group" style="  !important">
                <label for="user_name">
                  Stage Name
                </label>
                <div class="m-input-icon m-input-icon--right">
                  <input type="text" name="stage_name"  class="form-control form_client_payment_add_fields m-input m-input--pill m-input--air" id="stage_name" placeholder="Stage Name" 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-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_client_payment_add_fields m-input m-input--pill m-input--air" id="remarks" 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="reference_type" value="work" id="reference_type_edit_client_payment">
            <input type="hidden" name="type" value="client_payment" id="type_edit">
            <input type="hidden" name="schedule_id_edit" value="" id="schedule_id_edit">


            <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="send_email_modal" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
  <div class="modal-dialog " role="document" >
    <form autocomplete="off" data-modal-id="resend_email_modal" method="post" action="<?php echo base_url().'client_payments/send_receipt'?>" class="form-horizontal">
      <div class="modal-content">
        <div class="alert alert-info" 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 Send Receipt To Below Email of Client. </p>
          <div class="row">
            <div class="col-lg-12">
              <div class="form-group m-form__group">
                <label for="user_name">
                  Client 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-user"></i>
                    </span>
                  </div>
                  <input disabled type="text"  id="client_name_send_receipt"  class="form-control m-input" aria-describedby="basic-addon1">
                </div>
              </div>
            </div>
          </div>
          <div class="row">
            <div class="col-lg-12">
              <div class="form-group m-form__group">
                <label for="user_name">
                  Email
                </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 required name="email" type="email"  id="email_send_receipt"  class="form-control m-input"  aria-describedby="basic-addon1">
                </div>
              </div>
            </div>
          </div>
          <br/>
          <input type="hidden" name="redirect_url" value="<?php echo base_url(uri_string())?>">
          <input type="hidden" name="client_id" id="client_id_send_receipt">
          <input type="hidden" name="transaction_id" id="transaction_id_send_receipt">
          <div class="modal-footer">
            <button type="button" class="btn btn-secondary" data-dismiss="modal">
              Close
            </button>
            <button class="btn btn-focus form_submit_btn" type="submit" name="submit">Confirm & Send</button>
          </div>
        </div>
      </div>
    </form>
  </div>
</div>
