<table width="100%" class="table m-table nowrap table-header-fixed table-striped table-bordered table-hover table-header-fixed" id="daily_note_view_table">
  <thead>
    <tr class="">
      <th>Sl No</th>
      <th>Note ID</th>
      <th style="display:none">Work ID</th>
      <th>User</th>
      <th>Work</th>
      <th>Note Title</th>
      <th>Note Date</th>
      <th>Description</th>
      <th>Image</th>
      <th>Location</th>
      <th>Created Date</th>
      <th>Status</th>
      <th>Action</th>
      <th>Read Status</th>
    </tr>
  </thead>
  <tbody>
  </tbody>
</table>

<div class="modal fade" tabindex="-1" id="daily_note_add_modal" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
  <div class="modal-dialog " role="document" >
    <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 Daily Note
        </h5>
        <button type="button" class="close" data-dismiss="modal" aria-label="Close">
          <span aria-hidden="true">
            &times;
          </span>
        </button>
      </div>
      <form autocomplete="off" data-modal-id="daily_note_add_modal" id="form_daily_note_add" method="post" action="<?php echo base_url().'daily_notes/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_daily_note_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>
          <?php if($page_name=='work_profile'){?>
            <input type="hidden" name="work_id" value="<?php echo $work_data->work_id?>" />
          <?php }else{ ?>
            <div class="row">
              <div class="col-lg-12">
                <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_daily_note_add_select" id="work_1"  name="work_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>
              <input type="hidden" name="redirect_url" value="<?php echo base_url(uri_string())?>" >
            </div>
          <?php } ?>
          <div class="row">
            <div class="col-lg-12">
              <div class="form-group m-form__group">
                <label for="user_name">
                  Title
                </label>
                <div class="input-group m-input-group--air date">
                  <div class="input-group-prepend">
                    <span class="input-group-text">
                      <i class="la la-tag"></i>
                    </span>
                  </div>
                  <input required type="text" name="title" class="form-control m-input form_daily_note_add_fields" placeholder="Title" >
                </div>
              </div>
              <span class="m-form__help"></span>
            </div>
          </div>
          <div class="row">
            <div class="col-lg-12">
              <div class="form-group m-form__group">
                <label for="user_name">
                  Description
                </label>
                <div class="input-group m-input-group m-input-group--pill m-input-group--air">
                  <textarea required name="description"   class="form-control m-input form_daily_note_add_fields"  aria-describedby="basic-addon1" rows="7"></textarea>
                </div>
                <span class="m-form__help"></span>
              </div>
            </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">
            Submit
          </button>
        </div>
      </form>
    </div>
  </div>
</div>
<div class="modal fade" tabindex="-1" id="daily_note_edit_modal" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
  <div class="modal-dialog " role="document" >
    <div class="modal-content" >
      <div class="modal-header" style="background-color: #36a3f7;border-radius: 4px">
        <h5 class="modal-title" id="exampleModalLabel" style="color: #ffffff" >
          Update Daily Note
        </h5>
        <button type="button" class="close" data-dismiss="modal" aria-label="Close">
          <span aria-hidden="true">
            &times;
          </span>
        </button>
      </div>
      <form autocomplete="off" data-modal-id="daily_note_edit_modal" id="form_daily_note_edit" method="post" action="<?php echo base_url().'daily_notes/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_daily_note_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>
          <?php if($page_name=='work_profile'){?>
            <input type="hidden" name="work_id" value="<?php echo $work_data->work_id?>" />
          <?php }else{ ?>
            <div class="row">
              <div class="col-lg-12">
                <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_daily_note_edit_select" id="work_update"  name="work_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>
              <input type="hidden" name="redirect_url" value="<?php echo base_url(uri_string())?>" >
            </div>
          <?php } ?>
          <div class="row">
            <div class="col-lg-12">
              <div class="form-group m-form__group">
                <label for="user_name">
                  Title
                </label>
                <div class="input-group m-input-group--air date">
                  <div class="input-group-prepend">
                    <span class="input-group-text">
                      <i class="la la-tag"></i>
                    </span>
                  </div>
                  <input required id="note_title_edit" type="text" name="title" class="form_daily_note_edit_fields form-control m-input " placeholder="Title" >
                </div>
              </div>
              <span class="m-form__help"></span>
            </div>
          </div>
          <div class="row">
            <div class="col-lg-12">
              <div class="form-group m-form__group">
                <label for="user_name">
                  Description
                </label>
                <div class="input-group m-input-group m-input-group--pill m-input-group--air">
                  <textarea required id="description_update" name="description"  class="form-control m-input form_daily_note_edit_fields"  aria-describedby="basic-addon1" rows="7"></textarea>
                </div>
                <span class="m-form__help"></span>
              </div>
              <input type="hidden" id="note_id" name="note_id">
            </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">
            Update
          </button>
        </div>
      </form>
    </div>
  </div>
</div>
<div class="modal fade" tabindex="-1" id="daily_note_view_modal" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
  <div class="modal-dialog " role="document" >
    <div class="modal-content" >
      <div class="modal-header" style="background-color: #36a3f7;border-radius: 4px">
        <h5 class="modal-title" id="exampleModalLabel" style="color: #ffffff" >
          View Daily Note
        </h5>
        <button type="button" class="close" data-dismiss="modal" aria-label="Close">
          <span aria-hidden="true">
            &times;
          </span>
        </button>
      </div>
      <form autocomplete="off" id="update_daily_note_form" method="post" action="" 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>
          </div>

          <?php if($page_name!='work_profile'){?>
            <div class="row">
              <div class="col-lg-12">
                <div class="form-group m-form__group">
                  <label for="user_name">
                    Work Name
                  </label>
                  <div class="input-group m-input-group--air date">
                    <div class="input-group-prepend">
                      <span class="input-group-text">
                        <i class="la la-tag"></i>
                      </span>
                    </div>
                    <input  readonly id="note_work_view" type="text"  class="form-control m-input--solid m-input  m-input " placeholder="Title" >
                  </div>
                  <span class="m-form__help"></span>
                </div>
              </div>
              <input type="hidden" name="redirect_url" value="<?php echo base_url(uri_string())?>" >
            </div>
          <?php } ?>
          <div class="row">
            <div class="col-lg-12">
              <div class="form-group m-form__group">
                <label for="user_name">
                  Title
                </label>
                <div class="input-group m-input-group--air date">
                  <div class="input-group-prepend">
                    <span class="input-group-text">
                      <i class="la la-tag"></i>
                    </span>
                  </div>
                  <input  readonly id="note_title_view" type="text" name="report_date" class="form-control m-input--solid m-input  m-input " placeholder="Title" >
                </div>
              </div>
              <span class="m-form__help"></span>
            </div>
          </div>
          <div class="row">
            <div class="col-lg-12">
              <div class="form-group m-form__group">
                <label for="user_name">
                  Date
                </label>
                <div class="input-group m-input-group--air date">
                  <div class="input-group-prepend">
                    <span class="input-group-text">
                      <i class="la la-calendar"></i>
                    </span>
                  </div>
                  <input  readonly id="note_date_view" type="text"  class="form-control m-input--solid m-input  m-input " placeholder="Title" >
                </div>
              </div>
              <span class="m-form__help"></span>
            </div>
          </div>
          <div class="row">
            <div class="col-lg-12">
              <div class="form-group m-form__group">
                <label for="user_name">
                  Description
                </label>
                <div class="input-group m-input-group m-input-group--pill m-input-group--air">
                  <textarea id="note_description_view" readonly name="description"  class="form-control m-input--solid m-input  m-input"  aria-describedby="basic-addon1" rows="7"></textarea>
                </div>
                <span class="m-form__help"></span>
              </div>
              <input type="hidden" id="report_id" name="report_id">
            </div>
          </div>
        </div>
        <div class="modal-footer">
          <button type="button" class="btn btn-secondary" data-dismiss="modal">
            Close
          </button>
        </div>
      </form>
    </div>
  </div>
</div>
<div class="modal fade"  tabindex="-1" id="daily_note_delete_modal" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
  <div class="modal-dialog " role="document" >
    <form autocomplete="off" method="post" data-modal-id="daily_note_delete_modal" id="form_daily_note_delete" action="<?php echo base_url().'daily_notes/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 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="note_id" id="delete_note_id">
        </div>
      </div>
    </form>
  </div>
</div>
