<div class="content-wrapper">
<!-- Content Header (Page header) -->
<div class="content-header">
   <div class="container-fluid">
      <div class="row mb-2">
         <div class="col-sm-6">
            <h1 class="m-0 text-dark">All Pages</h1>
         </div>
         <!-- /.col -->
         <div class="col-sm-6">
            <ol class="breadcrumb float-sm-right">
               <li class="breadcrumb-item"><a href="<?php echo base_url() ?>admin/admin/dashboard">Dashboard</a></li>
               <li class="breadcrumb-item"><a href="#">Home Setting</a></li>
               <li class="breadcrumb-item active">All Pages</li>
            </ol>
         </div>
         <!-- /.col -->
      </div>
      <!-- /.row -->
   </div>
   <!-- /.container-fluid -->
</div>
<!-- /.content-header -->
<section class="content">
   <div class="container-fluid">
      <!-- Info boxes -->
     
      <div class="card card-default">
         <div class="card-header">
            <div class="card-tools">
                <a href="<?php echo base_url(); ?>/admin/main_page_setting/add_new_page" class="btn btn-success"><i class="fa fa-plus" aria-hidden="true"></i> Add Page</a>
            </div>
         </div>
         <!-- /.card-header -->
         <div class="card-body">
            <table id="example1" class="table table-bordered table-striped">
               <thead>
                  <tr>
                     <th>id</th>
                     <th>Image</th>
                     <th>Page Name</th>
    
                     <th>Status</th>
                     <th>Date</th>
                     <th></th>
                  </tr>
               </thead>
               <tbody>
                  <?php $i=1; foreach ($get_all_page as $key => $page):?>
                  <tr>
                     <td><?php echo $i ?></td>
                     <td><img src="<?php echo base_url() ?><?php echo $page->image ?>" width="70px;"></td>
                     <td><?php echo $page->name ?></td>
                  
                     <td><?php if($page->status == 1): ?>
                        <span class="badge badge-success">Active</span>
                       <?php else: ?>
                           <span class="badge badge-danger">Deactive</span>
                       <?php endif; ?>
                     </td>                     
                     <td><?php echo $page->date ?></td>
                     <td>
                        <button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown" aria-expanded="false">
                        Action
                        </button> 
                        <div class="dropdown-menu" style="">
                           <a class="dropdown-item" href="<?php echo base_url(); ?>/admin/main_page_setting/edit_page/<?php echo $page->id ?>"><i class="fa fa-edit option-icon"></i>&nbsp;Edit</a>
                           <?php if($page->slug != 'return-policy' && $page->slug != 'refund-policy' && $page->slug != 'terms-of-use' && $page->slug != 'privacy-policy' && $page->slug != 'seller-policy' && $page->slug != 'affiliate-policy'):?>
                           <div class="dropdown-divider"></div>

                           
                           <a class="dropdown-item" onclick="return confirm('Are you sure?')" href="<?php echo base_url() ?>/admin/main_page_setting/delete_page/<?php echo $page->id ?>"><i class="fa fa-trash" aria-hidden="true"></i>
                           &nbsp;Delete</a>
                        <?php endif;?>


                        </div>
                     </td>
                  </tr>
                  <?php $i++; ?>
                  <?php endforeach; ?>
               </tbody>
              
            </table>
         </div>
      </div>
      <!--/. container-fluid -->
</section>
<!-- /.content -->
</div>
<!-- /.content-wrapper -->
<?php $i=1; foreach ($get_all_page as $key => $page):?>
<div class="modal fade" id="update-page<?php echo $page->id ?>">
   <div class="modal-dialog">
      <div class="modal-content bg-primary">
         <div class="modal-header">
            <h4 class="modal-title">Update Designation</h4>
            <button type="button" class="close" data-dismiss="modal" aria-label="Close">
            <span aria-hidden="true">&times;</span></button>
         </div>
         <?php echo form_open_multipart('admin/home_setting/update_page/'.$page->id); ?>
         <div class="modal-body">
            <div class="row">
               <div class="col-md-12">
                  <div class="form-group">
                     <label for="inputEmail" class="col-sm-12 col-form-label">Page Name <span class="required">*</span></label>
                     <div class="col-sm-12">
                        <input type="text" class="form-control"  name="name"  required="required" placeholder="Enter Page Name" value="<?php echo $page->name ?>">
                     </div>
                  </div>
               </div>
                
               
               <div class="col-md-12">
                  <div class="form-group">
                     <label for="inputEmail" class="col-sm-12 col-form-label"> Page Content</label>
                     <div class="col-sm-12">
                        <textarea class="text-editor" name="content" placeholder="Enter Shipping Details"><?php echo $page->content ?></textarea>
                     </div>
                  </div>
               </div>
               <div class="col-md-12">
                  <div class="form-group">
                     <label for="inputEmail" class="col-sm-12 col-form-label"> Page Meta Description</label>
                     <div class="col-sm-12">
                        <textarea class="form-control"  name="meta_descrition" placeholder="Enter Page Meta Description"><?php echo $page->meta_descrition ?></textarea>
                     </div>
                  </div>
               </div>
               <div class="col-md-12">
                  <div class="form-group">
                     <label for="inputEmail" class="col-sm-12 col-form-label"> Page Keywords</label>
                     <div class="col-sm-12">
                        <textarea class="form-control"  name="meta_keyword" placeholder="Enter Page Keywords"><?php echo $page->meta_keyword ?></textarea>
                     </div>
                  </div>
               </div>
               <div class="col-md-12">
                  <div class="form-group">
                     <label for="inputEmail" class="col-sm-12 col-form-label">Image (Image size 690 X 460 px)</label>
                     <div class="col-sm-12">
                        <input type="file" class="form-control"  name="image" placeholder="Enter Page Name">
                     </div>
                  </div>
               </div>
               <div class="col-md-12">
                  <div class="form-group">
                     <img src="<?php echo base_url() ?><?php echo $page->image; ?>" width="150px" style="border:1px solid black">
                   </div>
                </div>
                <div class="col-md-12">
                  <div class="form-group">
                     <label for="inputEmail" class="col-sm-12 col-form-label">Status</label>
                     <div class="col-sm-12">
                        <select  class="form-control"  name="status" placeholder="Enter Page Name">
                           <option <?php if($page->status == 1){echo 'selected';} ?> value="1">Active</option>
                           <option <?php if($page->status == 0){echo 'selected';} ?> value="0">Deactive</option>
                        </select>
                     </div>
                  </div>
               </div>
               <div class="col-md-12">
                  <div class="form-group">
                     <label for="inputEmail" class="col-sm-12 col-form-label">Showing Position</label>
                     <div class="col-sm-12">
                        <select  class="form-control"  name="important" placeholder="Enter Page Name" required="">
                           <option <?php if($page->important == 'Top'){echo 'selected';} ?> value="Top">Top</option>
                           <option <?php if($page->important == 'Userfull Link'){echo 'selected';} ?> value="Userfull Link">Userfull Link</option>
                           <option <?php if($page->important == 'Policies'){echo 'selected';} ?> value="Policies">Policies</option>
                           <option <?php if($page->important == 'Help'){echo 'selected';} ?> value="Help">Help</option>
                        </select>
                     </div>
                  </div>
               </div>
               <input type="hidden" class="form-control"  name="page_id"  value="<?php echo $page->id ?>">
            </div>
         </div>
         <div class="modal-footer justify-content-between">
            <button type="button" class="btn btn-outline-light" data-dismiss="modal">Close</button>
            <button type="submit" class="btn btn-outline-light">Save changes</button>
         </div>
         <?php echo form_close() ?>
      </div>
      <!-- /.modal-content -->
   </div>
   <!-- /.modal-dialog -->
</div>

<?php $i++; ?>
<?php endforeach; ?>

</div>
