D7net
Home
Console
Upload
information
Create File
Create Folder
About
Tools
:
/
home
/
ksclnmuac
/
public_html
/
ci_panel
/
application
/
views
/
admin
/
Filename :
slider.php
back
Copy
<!DOCTYPE html> <html lang="en" class="light-style layout-menu-fixed" dir="ltr" data-theme="theme-default" data-assets-path="../assets/" data-template="vertical-menu-template-free"> <head> <?php $data = []; $data['title'] = "Slider"; $this->load->view('admin/components/header_link', $data); ?> </head> <body> <!-- Layout wrapper --> <div class="layout-wrapper layout-content-navbar "> <div class="layout-container"> <?php $this->load->view('admin/components/menu'); ?> <!-- Layout container --> <div class="layout-page"> <!-- Navbar --> <?php $this->load->view('admin/components/navbar'); ?> <!-- / Navbar --> <!-- Content wrapper --> <div class="content-wrapper"> <!-- Content --> <div class="container-xxl flex-grow-1 container-p-y"> <div class="row"> <div class="col-sm-12"> <?php if($this->session->flashdata('success') != ''){ ?> <div class="alert alert-success" role="alert"> <?php echo $this->session->flashdata('success'); ?> </div> <?php } ?> <?php if($this->session->flashdata('error') != ''){ ?> <div class="alert alert-danger" role="alert"> <?php echo $this->session->flashdata('error'); ?> </div> <?php } ?> </div> </div> <div class="row"> <div class="col-lg-12 mb-4 order-0"> <div class="card"> <div class="card-header d-flex justify-content-between align-items-center"> <h5 class="mb-0">Add Slider Image</h5> </div> <div class="card-body"> <form action="<?php echo base_url().'admin/slider/create'; ?>" method="post" enctype="multipart/form-data"> <div class="row"> <div class="col-md-6"> <div class="mb-3"> <label class="form-label" for="text1">Text 1</label> <input type="text" required value="<?php echo set_value('text1'); ?>" class="form-control <?php echo (!empty(form_error('text1')))? "is-invalid" : ""; ?>" id="text1" name="text1" placeholder="First Text" /> <?php echo (!empty(form_error('text1')))? form_error('text1') : ""; ?> </div> </div> <div class="col-md-6"> <div class="mb-3"> <label class="form-label" for="text2">Text 2</label> <input type="text" required value="<?php echo set_value('text2'); ?>" class="form-control <?php echo (!empty(form_error('text2')))? "is-invalid" : ""; ?>" id="text2" name="text2" placeholder="Second Text" /> <?php echo (!empty(form_error('text2')))? form_error('text2') : ""; ?> </div> </div> <div class="col-md-12"> <div class="mb-3"> <label class="form-label" for="image">Upload Image</label> <input type="file" required id="image" name="image" class="form-control"> </div> </div> </div> <button type="submit" class="btn btn-primary">Save Image</button> </form> </div> </div> </div> <div class="col-lg-12 mb-4 order-0"> <div class="card"> <div class="card-header d-flex justify-content-between align-items-center"> <h5 class="mb-0">View Slider Images</h5> </div> <div class="card-body"> <div class="table-responsive text-nowrap"> <table class="table datatable table-bordered"> <thead> <tr> <th>S. No.</th> <th>Image</th> <th>Text 1</th> <th>Text 2</th> <th>Date</th> <th>Actions</th> </tr> </thead> <tbody> <?php $i=1; if(!empty($slider)){ foreach($slider as $slide){ ?> <tr> <td><?php echo $i; ?></td> <td><img src="<?php echo base_url().'public/uploads/slider/'.$slide['pic']; ?>" style="width:300px; height:100px;" alt="slider image"></td> <td><?php echo $slide['text1']; ?></td> <td><?php echo $slide['text2']; ?></td> <td><?php echo date('d-M-Y', strtotime($slide['date'])); ?></td> <td> <div class="dropdown"> <button type="button" class="btn p-0 dropdown-toggle hide-arrow" data-bs-toggle="dropdown"><i class="bx bx-dots-vertical-rounded"></i></button> <div class="dropdown-menu"> <a class="dropdown-item" href="javascript:void(0);" onclick="showEdit(<?php echo $slide['slider_id'] ?>)"><i class="bx bx-edit-alt me-1"></i> Edit</a> <a class="dropdown-item" href="javascript:void(0);" onclick="deleteSlide(<?php echo $slide['slider_id'] ?>)"><i class="bx bx-trash me-1"></i> Delete</a> </div> </div> </td> </tr> <?php $i++; } } ?> </tbody> </table> </div> </div> </div> </div> </div> </div> <!-- / Content --> <!-- offcanvas start --> <div class="offcanvas offcanvas-end" tabindex="-1" id="editOffCanvas" aria-labelledby="offcanvasEndLabel"> <div class="offcanvas-header"> <h5 id="offcanvasEndLabel" class="offcanvas-title">Edit Slider</h5> <button type="button" class="btn-close text-reset" data-bs-dismiss="offcanvas" aria-label="Close"></button> </div> <div class="offcanvas-body"> <form action="<?php echo base_url().'admin/slider/edit'; ?>" method="post" enctype="multipart/form-data"> <div class="row"> <input type="hidden" id="eid" name="eid" value=""/> <div class="col-md-12"> <div class="mb-3"> <label class="form-label" for="etext1">Text 1</label> <input type="text" required value="<?php echo set_value('etext1'); ?>" class="form-control <?php echo (!empty(form_error('etext1')))? "is-invalid" : ""; ?>" id="etext1" name="etext1" placeholder="First Text" /> <?php echo (!empty(form_error('etext1')))? form_error('etext1') : ""; ?> </div> </div> <div class="col-md-12"> <div class="mb-3"> <label class="form-label" for="etext2">Text 2</label> <input type="text" required value="<?php echo set_value('etext2'); ?>" class="form-control <?php echo (!empty(form_error('etext2')))? "is-invalid" : ""; ?>" id="etext2" name="etext2" placeholder="Second Text" /> <?php echo (!empty(form_error('etext2')))? form_error('etext2') : ""; ?> </div> </div> <div class="col-md-12"> <div class="mb-3"> <label class="form-label" for="eimage">Upload Image</label> <input type="file" id="eimage" name="eimage" class="form-control"> </div> </div> </div> <button type="submit" class="btn btn-primary">Save Image</button> </form> </div> </div> <!-- offcanvas end --> <?php $this->load->view('admin/components/footer'); ?> <?php $this->load->view('admin/components/footer_link'); ?> <script> // Delete code function deleteSlide(id){ if(window.confirm("Are you sure, you want to delete this slider image?")){ window.location.href="<?php echo base_url().'admin/slider/delete/' ?>"+id } } // Edit code function showEdit(id){ $.ajax({ type:"POST", url:"<?php echo base_url().'admin/slider/getDataAjax/' ?>"+id, success:function(response){ let data = JSON.parse(response) $("#eid").val(data[0].slider_id); $("#etext1").val(data[0].text1); $("#etext2").val(data[0].text2); } }) const editOffCanvas = document.getElementById("editOffCanvas"); var bsOffcanvas = new bootstrap.Offcanvas(editOffCanvas) bsOffcanvas.show() } </script> </body> </html>