<?php defined('BASEPATH') OR exit('No direct script access allowed');
$pagehead   = "Class Settings Page"; ?>
<!doctype html>
<html lang="en">
<head>
   <?php $this->load->view('admin/includes/header-script')?>
   <title><?=TITLE?></title>
</head>
<body class="pushmenu-push pushmenu-push-toright">
  <?php $this->load->view('admin/includes/left-menu')?> 
  <?php $this->load->view('admin/includes/header')?>
  <section class="admin-content">
   <div class="container">
      <h2><?=$pagehead?></h2>
      <?php
      $success_msg= $this->session->flashdata('success_msg');
      $error_msg= $this->session->flashdata('error_msg');
      if($success_msg) { ?>
         <div class="alert alert-success">
            <?php echo $success_msg; ?>
            <a href="#" class="close" data-dismiss="alert" aria-label="close" >×</a>
         </div>
      <?php } if($error_msg){ ?>
         <div class="alert alert-danger">
            <?php echo $error_msg; ?>
            <a href="#" class="close" data-dismiss="alert" aria-label="close" >×</a>
         </div>
      <?php } ?>
      <div class="setting d-flex">
         <div class="col-md-12 col-lg-2 no-pad class-left">
            <ul class="class-nav d-flex">
               <li><a href="<?= base_url();?>admin/class-name">Class Names</a></li>
               <li class="active"><a href="<?= base_url();?>admin/class-locations">Locations</a></li>
               <li><a href="<?= base_url();?>admin/class-instructors">Instructors</a></li>
            </ul>
         </div>
         <div class="col-md-12 col-lg-10">
            <div class="class-content d-flex">
               <div class="col-md-12 class-name col-lg-6">
                  <?php echo form_open('admin/classsetting/manage_location'); ?>
                  <div class="d-flex">
                     <span>Class Locations</span>
                     <input type="text" name="locat_name" value="<?=isset($locat_name)? $locat_name : ''?>" class="form-control" required>
                  </div>
                  <div class="submit-class d-flex justify-content-end">
                   <?php if(isset($locat_id)) { ?> 
                     <input type="hidden" value="<?=isset($locat_id)? $locat_id : ''?>" name="locat_id">
                     <input type="submit" name="submit" value="Update" style="cursor: pointer;" class="submit">
                     <a href="<?= base_url();?>admin/class-locations"><input type="button" value="Cancel" style="cursor: pointer;" class="reset"></a>
                  <?php } else {?>
                     <input type="submit" name="submit" value="Add" style="cursor: pointer;" class="submit">
                     <input type="reset" value="Reset" style="cursor: pointer;" class="reset">
                  <?php } ?>
               </div>
               <?php echo form_close(); ?>
            </div>
            <div class="col-md-12 col-lg-6">
              <h2> Class Locations</h2>
              <table class="table">
               <thead>
                  <tr>
                     <th>Created </th>
                     <th>Class Locations</th>
                     <th>Edit</th>
                     <th>Delete</th>
                  </tr>
               </thead>
               <tbody>
                  <?php foreach($all_locations as $val) { ?>
                     <tr>
                        <td><?=date("d-m-Y",strtotime($val['locat_createddate']))?></td>
                        <td><?=$val['locat_name']?></td>
                        <td><a href="<?=base_url();?>admin/class-locations-edit/<?=$val['locat_id']?>" title="Edit"><img src="<?=base_url();?>assets/admin/img/edit.png" alt=""><a></td>
                           <td><a href="<?=base_url();?>admin/class-locations-delete/<?=$val['locat_id']?>" onclick="return confirm('Are you sure want to Delete?')" title="Delete"><img src="<?=base_url();?>assets/admin/img/delete.png" alt=""><a></td>
                           </tr>
                        <?php } ?>
                     </tbody>
                  </table>
               </div>
            </div>
         </div>
      </div>
   </div>
</section>
<!-- Optional JavaScript -->
<?php $this->load->view('admin/includes/footer-script')?> 
</body>
</html>