<table width="100%" class="table m-table nowrap table-header-fixed table-striped table-bordered table-hover table-header-fixed" id="vehicle_documents_view_table">
  <thead>
    <tr class="">
      <th>Sl No</th>
      <th>Vehicle</th>
      <th>Document Type</th>
      <th>File</th>
      <th>Remarks</th>
      <th>Creation</th>
      <th>Actions</th>
      <th>Vehicle ID</th>
      <th>File Type</th>
      <th>File</th>
      <th>Doc ID</th>
    </tr>
  </thead>
  <tbody>
  </tbody>
</table>
<div class="modal fade" tabindex="-1" id="vehicle_document_add_modal" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
  <div class="modal-dialog " role="document" style="max-width: 800px">
    <div class="modal-content" style="width: 750px">
      <div class="modal-header" style="background-color: #36a3f7;border-radius: 4px">
        <h5 class="modal-title" id="exampleModalLabel" style="color: #ffffff" >
          Add Vehicle Documents/Photos
        </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="renewal" id="form_vehicle_document_add" data-modal-id="vehicle_document_add_modal" method="post" action="<?php echo base_url().'vehicles/create_document'?>" 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_vehicle_document_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-7">
              <div class="form-group m-form__group" >
                <label for="user_name">
                  Vehicle
                </label>
                <?php if($page_name=='vehicle_profile') { ?>
                  <div class="input-group m-input-group--air m-input-group--pill  date">
                    <input value="<?= $vehicle_data->vehicle_name." : ".$vehicle_data->vehicle_no ?>" type="text"  class="form-control  m-input form_vehicle_document_add_fields" readonly>
                  </div>
                  <input type="hidden" name="vehicle_id" value="<?= $vehicle_data->id?>" />
                <?php } ?>
                <span class="m-form__help"></span>
              </div>
            </div>
            <div class="col-lg-5">
              <div class="form-group m-form__group" >
                <label for="user_name">
                  Document Type
                </label>
                <div class="m-select2 m-select2--air m-select2--pill">
                  <select required style="width: 100%" class="form-control m-select2  form_vehicle_document_add_select" id="vehicle_doc_type_add" name="document_type" required >
                    <option selected disabled>Select Type</option>
                    <?php foreach ($vehicle_document_types as $key => $value) { ?>
                      <option value="<?php echo $value->type_name ?>"><?php echo $value->type_name ?></option>
                    <?php } ?>
                  </select>
                </div>
                <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">
                  <!-- Select the Document -->
                  Google Drive Link
                </label>
                <div class="m-input-icon m-input-icon--right ">
                  <!-- <div class="custom-file">
                  <input required type="file" class="custom-file-input m-input m-input--pill m-input--air" name="uploaded_file" id="customFile">
                  <label class="custom-file-label" for="customFile">Choose file</label>
                </div> -->
                <div class="m-input-icon m-input-icon--right">
                  <input required type="url" class="form-control m-input m-input--pill m-input--air"  aria-describedby="basic-addon1" name="file">
                  <span class="m-input-icon__icon m-input-icon__icon--right"><span><i class="fab fa-google-drive"></i></span></span>
                </div>
              </div>
              <span class="m-form__help"></span>
            </div>
          </div>
          <div class="col-lg-12" >
            <div class="form-group m-form__group" >
              <label for="user_name">
                Remarks
              </label>
              <div class="m-input-icon m-input-icon--right">
                <input type="text" name="remarks" class="form-control m-input m-input--pill m-input--air form_vehicle_document_add_fields" 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>
        </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="vehicle_document_edit_modal" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
  <div class="modal-dialog " role="document" style="max-width: 800px">
    <div class="modal-content" style="width: 750px">
      <div class="modal-header" style="background-color: #36a3f7;border-radius: 4px">
        <h5 class="modal-title" id="exampleModalLabel" style="color: #ffffff" >
          Edit Vehicle Document
        </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="renewal" id="form_vehicle_document_edit" data-modal-id="vehicle_document_edit_modal" method="post" action="<?php echo base_url().'vehicles/update_document'?>" 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_vehicle_document_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-7">
              <div class="form-group m-form__group" >
                <label for="user_name">
                  Vehicle
                </label>
                <?php if($page_name=='vehicle_profile') { ?>
                  <div class="input-group m-input-group--air m-input-group--pill  date">
                    <input value="<?= $vehicle_data->vehicle_name." : ".$vehicle_data->vehicle_no ?>" type="text"  class="form-control  m-input form_vehicle_document_edit_fields" readonly>
                  </div>
                  <input type="hidden" name="vehicle_id" value="<?= $vehicle_data->id?>" />
                <?php } ?>
                <span class="m-form__help"></span>
              </div>
            </div>
            <div class="col-lg-5">
              <div class="form-group m-form__group" >
                <label for="user_name">
                  Document Type
                </label>
                <div class="m-select2 m-select2--air m-select2--pill">
                  <select required style="width: 100%" class="form-control m-select2  form_vehicle_document_edit_select" id="vehicle_doc_type_edit" name="document_type" required >
                    <option selected disabled>Select Type</option>
                    <?php foreach ($vehicle_document_types as $key => $value) { ?>
                      <option value="<?php echo $value->type_name ?>"><?php echo $value->type_name ?></option>
                    <?php } ?>
                  </select>
                </div>
                <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">
                  <!-- Select the Document -->
                  Google Drive Link
                </label>
                <div class="m-input-icon m-input-icon--right ">
                  <!-- <div class="custom-file">
                  <input required type="file" class="custom-file-input m-input m-input--pill m-input--air" name="uploaded_file" id="customFile">
                  <label class="custom-file-label" for="customFile">Choose file</label>
                </div> -->
                <div class="m-input-icon m-input-icon--right">
                  <input required type="url" id="document_file_edit" class="form-control m-input form_vehicle_document_edit_fields m-input--pill m-input--air"  aria-describedby="basic-addon1" name="file">
                  <span class="m-input-icon__icon m-input-icon__icon--right"><span><i class="fab fa-google-drive"></i></span></span>
                </div>
              </div>
              <span class="m-form__help"></span>
            </div>
          </div>
          <div class="col-lg-12" >
            <div class="form-group m-form__group" >
              <label for="user_name">
                Remarks
              </label>
              <div class="m-input-icon m-input-icon--right">
                <input type="text" name="remarks" id="document_remarks_edit" class="form-control m-input m-input--pill m-input--air form_vehicle_document_edit_fields" 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="document_id" id="document_id_edit" />
        </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="vehicle_document_delete_modal" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
  <div class="modal-dialog " role="document" >
    <form id="form_vehicle_document_delete" data-modal-id="vehicle_document_delete_modal" autocomplete="off" method="post" action="<?php echo base_url().'vehicles/delete_document'?>" 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="document_id" id="document_id_delete" />
        </div>
      </div>
    </form>
  </div>
</div>
