<table width="100%" class="table m-table nowrap table-header-fixed table-striped table-bordered table-hover table-header-fixed" id="project_stages_view_table">
  <thead>
    <tr class="">
      <th>Stage ID</th>
      <th>Stage No</th>
      <th>Stage Name</th>
      <th>Budget</th>
      <th>Start Date</th>
      <th>End Date</th>
      <th>Total Income</th>
      <th>Total Expense</th>
      <th>Active Status</th>
      <th>Actions</th>
      <th style="display: none;"></th>
      <th style="display: none;"></th>
    </tr>
  </thead>
  <tbody>
  </tbody>
</table>

<div class="modal fade" tabindex="-1" id="project_stages_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: #00c5dc;border-radius: 4px">
        <h5 class="modal-title" id="exampleModalLabel" style="color: #ffffff" >
          Add New Project Stage
        </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="project_stage" data-modal-id="project_stages_add_modal" id="form_project_stages_add" method="post" action="<?php echo base_url().'work/create_stage' ?>" enctype="multipart/form-data" class="m-form m-form--fit m-form--state m-form--label-align-right " >
        <div class="modal-body" id="">
          <div class="m-form__content">
            <div class="m-alert m-alert--icon alert alert-warning m--hide" role="alert" id="form_project_stages_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-8" >
              <div class="form-group m-form__group" >
                <label for="user_name">
                  Stage Name
                </label>
                <div class="m-input-icon m-input-icon--right">
                  <input required type="text" placeholder="Stage Name"  class="form-control m-input m-input--pill m-input--air"  aria-describedby="basic-addon1" name="stage_name">
                  <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-4" >
              <div class="form-group m-form__group" >
                <label for="user_name">
                  Stage No
                </label>
                <div class="m-input-icon m-input-icon--right">
                  <input required type="text" placeholder="Stage No"  class="form-control m-input m-input--pill m-input--air"  aria-describedby="basic-addon1" name="stage_no">
                  <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-4">
              <div class="form-group m-form__group">
                <label>
                  Start Date
                </label>
                <div class="m-input-icon m-input-icon--right">
                  <input data-date-format="dd-mm-yyyy" type="text" name="start_date" id="stage_start_date" class="form-control m-input m-input--pill m-input--air" placeholder="Planned Date of Start"  aria-describedby="basic-addon1">
                  <span class="m-input-icon__icon m-input-icon__icon--right"><span><i class="fa fa-calendar-alt"></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>
                  End Date
                </label>
                <div class="m-input-icon m-input-icon--right">
                  <input  data-date-format="dd-mm-yyyy" type="text" name="end_date" id="stage_end_date" class="form-control m-input m-input--pill m-input--air" placeholder="Planned Date of Completion"  aria-describedby="basic-addon1">
                  <span class="m-input-icon__icon m-input-icon__icon--right"><span><i class="fa fa-calendar-alt"></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>
                  Estimated Budget
                </label>
                <div class="m-input-icon m-input-icon--right">
                  <input type="text" name="budget" id="stage_budget_amount" class="form-control m-input m-input--pill m-input--air tax_fields" placeholder="Estimated Budget"  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">
                  Active Status
                </label>
                <div >
                  <span class="m-bootstrap-switch m-bootstrap-switch--pill m-bootstrap-switch--air">
                    <input name="active_status" data-switch="true" type="checkbox" data-on-color="success" data-off-color="danger" data-on-text="Active" data-off-text="InActive" >
                  </span>
                </div>
              </div>
            </div>
            <div class="col-lg-8" >
              <div class="form-group m-form__group" >
                <label for="user_name">
                  Description
                </label>
                <textarea type="text"  name="description" class="form-control m-input m-input--pill m-input--air "  aria-describedby="basic-addon1"></textarea>
                <span class="m-form__help"></span>
              </div>
            </div>
            <input type="hidden" name="work_id" value="<?php echo $work_data->work_id?>" />
          </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="project_stages_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 Project Stage
        </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="project_stage" data-modal-id="project_stages_edit_modal" id="form_project_stages_edit" method="post" action="<?php echo base_url().'work/update_stage' ?>" enctype="multipart/form-data" class="m-form m-form--fit m-form--state m-form--label-align-right " >
        <div class="modal-body" id="">
          <div class="m-form__content">
            <div class="m-alert m-alert--icon alert alert-warning m--hide" role="alert" id="form_project_stages_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>

          <input type="hidden" name="stage_id" id="stage_id_edit">

          <div class="row">
            <div class="col-lg-8" >
              <div class="form-group m-form__group" >
                <label for="user_name">
                  Stage Name
                </label>
                <div class="m-input-icon m-input-icon--right">
                  <input required type="text" placeholder="Stage Name"  class="form-control m-input m-input--pill m-input--air"  aria-describedby="basic-addon1" name="stage_name" id="stage_name_edit">
                  <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-4" >
              <div class="form-group m-form__group" >
                <label for="user_name">
                  Stage No
                </label>
                <div class="m-input-icon m-input-icon--right">
                  <input required type="text" placeholder="Stage No"  class="form-control m-input m-input--pill m-input--air"  aria-describedby="basic-addon1" name="stage_no" id="stage_no_edit">
                  <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-4">
              <div class="form-group m-form__group">
                <label>
                  Start Date
                </label>
                <div class="m-input-icon m-input-icon--right">
                  <input data-date-format="dd-mm-yyyy" type="text" name="start_date" id="stage_start_date_edit" class="form-control m-input m-input--pill m-input--air" placeholder="Planned Date of Start"  aria-describedby="basic-addon1">
                  <span class="m-input-icon__icon m-input-icon__icon--right"><span><i class="fa fa-calendar-alt"></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>
                  End Date
                </label>
                <div class="m-input-icon m-input-icon--right">
                  <input  data-date-format="dd-mm-yyyy" type="text" name="end_date" id="stage_end_date_edit" class="form-control m-input m-input--pill m-input--air" placeholder="Planned Date of Completion"  aria-describedby="basic-addon1">
                  <span class="m-input-icon__icon m-input-icon__icon--right"><span><i class="fa fa-calendar-alt"></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>
                  Estimated Budget
                </label>
                <div class="m-input-icon m-input-icon--right">
                  <input type="text" name="budget" id="stage_budget_amount_edit" class="form-control m-input m-input--pill m-input--air tax_fields" placeholder="Estimated Budget"  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">
                  Active Status
                </label>
                <div >
                  <span class="m-bootstrap-switch m-bootstrap-switch--pill m-bootstrap-switch--air">
                    <input name="active_status" id="active_status_edit" data-switch="true" type="checkbox" data-on-color="success" data-off-color="danger" data-on-text="Active" data-off-text="InActive">
                  </span>
                </div>
              </div>
            </div>
            <div class="col-lg-8" >
              <div class="form-group m-form__group" >
                <label for="user_name">
                  Description
                </label>
                <textarea type="text" id="stage_description_edit" name="description" class="form-control m-input m-input--pill m-input--air "  aria-describedby="basic-addon1"></textarea>
                <span class="m-form__help"></span>
              </div>
            </div>
            <input type="hidden" name="work_id" value="<?php echo $work_data->work_id?>" />
          </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="project_stages_delete_modal" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
  <div class="modal-dialog " role="document" >
    <form autocomplete="off" data-form-type="invoices"  data-modal-id="project_stages_delete_modal" id="form_project_stage_delete" method="post" action="<?php echo base_url().'invoices/delete'?>" 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 Stage ? This can not be undone ! </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" value name="stage_id" id="stage_id_delete">
        </div>
      </div>
    </form>
  </div>
</div>
