<div class="content-wrapper">
   <div class="container-full">
      <!-- Content Header (Page header) -->	  
      <div class="content-header">
         <div class="d-flex align-items-center">
            <div class="me-auto">
               <h4 class="page-title">Genral Management</h4>
               <div class="d-inline-block align-items-center">
                  <nav>
                     <ol class="breadcrumb">
                        <li class="breadcrumb-item"><a href="#"><i class="fa fa-home"></i></a></li>
                        <li class="breadcrumb-item active" aria-current="page">Home</li>
                     </ol>
                  </nav>
               </div>
            </div>
         </div>
      </div>
      <!-- Main content -->
      <section class="content">
         <div class="row">
            <div class="col-xl-5 col-lg-5 col-md-12 col-sm-12 col-12">
               <div class="box">
                  <!-- /.box-header -->
                  <?php if(empty($bannerE->banner_id)){ ?>
                  <div class="box-header with-border">
                     <h4 class="box-title">Add Banner</h4>
                  </div>
                  <form class="form" id="banneradd" enctype="multipart/form-data">
                     <div class="box-body">
                        <div class="row">
                           <div class="col-md-12">
                              <div class="form-group">
                                 <label class="form-label">Title<span class="reqired-star">*</span></label>
                                 <input type="text" class="form-control" name="banner_title" required>
                              </div>
                           </div>
                           <div class="col-md-12">
                              <div class="form-group">
                                 <label class="form-label">Sub Title<span class="reqired-star">*</span></label>
                                 <input type="text" class="form-control" name="banner_subtitle" required>
                              </div>
                           </div>
                           <div class="col-md-12">
                              <div class="form-group">
                                 <label class="form-label">Description<span class="reqired-star">*</span></label>
                                 <textarea class="form-control" placeholder="Description ..." rows="2"  name="banner_description" ></textarea>
                              </div>
                           </div>
                           <div class="col-md-12">
                              <div class="form-group">
                                 <label class="form-label">Image<span class="reqired-star">*</span></label>
                                 <input type="file" id="file" name="banner_image" required>
                              </div>
                           </div>
                        </div>
                     </div>
                     <!-- /.box-body -->
                     <div class="box-footer">
                        <button type="submit" class="btn btn-primary">Save</button>
                     </div>
                  </form>
                  <?php }else{ ?>
                  <div class="box-header with-border">
                     <h4 class="box-title">Update Banner</h4>
                  </div>
                  <form class="form" id="bannerupdate" enctype="multipart/form-data">
                     <div class="box-body">
                        <div class="row">
                           <div class="col-md-12">
                              <div class="form-group">
                                 <label class="form-label">Title</label>
                                 <input type="hidden" class="form-control" name="banner_id" value="<?= $bannerE->banner_id; ?>" required>
                                 <input type="text" class="form-control" name="banner_title" value="<?= $bannerE->banner_title; ?>"  required>
                              </div>
                           </div>
                            <div class="col-md-12">
                              <div class="form-group">
                                 <label class="form-label">Sub Title<span class="reqired-star">*</span></label>
                                 <input type="text" class="form-control" name="banner_subtitle" value="<?= $bannerE->banner_subtitle; ?>">
                              </div>
                           </div>
                           <div class="col-md-12">
                              <div class="form-group">
                                 <label class="form-label">Description<span class="reqired-star">*</span></label>
                                 <textarea class="form-control" placeholder="Description ..." rows="2"  name="banner_description" ><?= $bannerE->banner_description; ?></textarea>
                                 
                              </div>
                           </div>
                           <div class="col-md-12">
                              <div class="form-group">
                                 <label class="form-label">Image</label>
                                 <input type="file" id="file" name="banner_image">
                                 <img class="rounded-circle" width="60" height="60" src="<?= base_url(); ?>uploads/banner/<?= $bannerE->banner_image; ?>">
                              </div>
                           </div>
                        <div class="col-md-12">
                           <div class="form-group">
                              <label class="form-label">Status</label>
                              <select class="form-select" name="banner_status">
                                 <option value="1" <?php if($bannerE->banner_status == 1 ){ echo "selected";}else{} ?>>Active</option>
                                 <option value="0" <?php if($bannerE->banner_status == 0 ){ echo "selected";}else{} ?>>Inactive</option>
                              </select>
                           </div>
                        </div>
                     </div>
                     </div>
                     <!-- /.box-body -->
                     <div class="box-footer">
                        <button type="submit" class="btn btn-primary">Update</button>
                     </div>
                  </form>
                  <?php } ?>  
               </div>
               <!-- /.box -->			
            </div>
            <div class="col-xl-7 col-lg-7 col-md-12 col-sm-12 col-12">
               <div class="box">
                  <div class="table-box-header box-header with-border">
                     <h4 class="box-title">Banner List</h4>
                     <div class="table-right-btns">
                        
                     </div>
                  </div>
                  <!-- /.box-header -->
                  <div class="box-body">
                     <div class="table-responsive">
                        <table id="example1" class="table text-fade table-bordered">
                           <thead>
                              <tr class="text-dark">
                                 <th>ID</th>
                                 <th>Image</th>
                                 <th>Title</th>
                                 <th>Sub Title</th>
                                 <th>Status</th>
                                 <th>Action</th>
                              </tr>
                           </thead>
                           <tbody>
                              <?php $i=1; foreach($banners as $banner){ ?>
                              <tr class="text-dark">
                                 <td><?= $i;?></td>
                                 <td><img class="rounded-circle" width="50" height="50" src="<?= base_url(); ?>uploads/banner/<?= $banner->banner_image; ?>" title="<?= $banner->banner_title; ?>" alt="<?= $banner->banner_title; ?>"></td>
                                 <td><?= $banner->banner_title; ?></td>
                                    <td><?= $banner->banner_subtitle; ?></td>
                                 <td> <?php if($banner->banner_status ==1  ){  ?>
                                    <span class="badge badge-success-light">Active</span>
                                    <?php }else{ ?>
                                    <span class="badge badge-danger-light">Inactive</span>
                                    <?php } ?>
                                 </td>
                                 <td class="table-action min-w-100 action-tbns">
                                    <a href="<?= base_url(); ?>admin/banner-edit?bid=<?= $banner->banner_id; ?>" class="edit"  title="Edit"><i class="align-middle" data-feather="edit-2"></i></a>
                                    <a href="<?= base_url();?>admin/banner-delete?bid=<?= $banner->banner_id; ?>" class="text-fade trash"><i class="align-middle" data-feather="trash" title="Detail"></i></a>
                                 </td>
                              </tr>
                              <?php $i++; } ?>
                           </tbody>
                        </table>
                     </div>
                  </div>
                  <!-- /.box-body -->
               </div>
               <!-- /.box -->
            </div>
         </div>
      </section>
      <!-- /.content -->
   </div>
</div>

