<div class="content-wrapper">
  <div class="content">
    <div class="container-fluid">
      <div class="row">
        <div class="col">
          <div class="card card-primary card-outline">
            <div class="card-header">
              <h5 class="m-0"><?php echo $pageTitle; ?> <?php showCreateButton($this->uri->segment(1) . "/" . $this->uri->segment(2) . "/add","Create New ".$pageTitle); ?></h5>
            </div>
            <div class="card-body">
              <?php $TableData = $this->db->query("select * from tbl_workshifts where status=1")->result(); ?>
              <table class="table table-bordered table-striped dataTable">
                <thead>
                  <tr>
                    <th>workshift_id</th>
                    <th>workshift_name</th>
                    <th>workshift_alias</th>
                    <th>workshift_desc</th>
                    <th>created_by</th>
                    <th>created_on</th>
                    <th>remarks</th>
                    <th>status</th>
                    <th class="table-col col-2">Action</th>
                  </tr>
                </thead>
                <tbody>
                  <?php $a=0; foreach ($TableData as $TableRow) : $a++; ?>
                    <?php foreach ($TableRow as $cols) : $id = $cols;
                      break;
                    endforeach; ?><tr>
                      <td><?php echo $TableRow->workshift_id; ?></td>
                      <td><?php echo $TableRow->workshift_name; ?></td>
                      <td><?php echo $TableRow->workshift_alias; ?></td>
                      <td><?php echo $TableRow->workshift_desc; ?></td>
                      <td><?php echo $TableRow->created_by; ?></td>
                      <td><?php echo $TableRow->created_on; ?></td>
                      <td><?php echo $TableRow->remarks; ?></td>
                      <td><?php echo $TableRow->status; ?></td>
                      <td><?php showEditButton($this->uri->segment(1) . "/" . $this->uri->segment(2) . "/edit/$id"); ?>
                        <?php showDeleteButton($id); ?>
                      </td>
                    </tr>
                  <?php endforeach; ?>
                <tbody>
              </table>
              <script>
                function doDelete(id) {
                  if (confirm('Are you sure to delete?')) {
                    window.location = '<?php echo site_url($this->uri->segment(1) . "/" . $this->uri->segment(2) . "/delete/"); ?>' + id;
                  }
                }
              </script>
            </div>
          </div>
        </div>
      </div>
    </div>
  </div>
</div>