D7net
Home
Console
Upload
information
Create File
Create Folder
About
Tools
:
/
home
/
ksclnmuac
/
public_html
/
ci_panel
/
application
/
views
/
admin
/
Filename :
notification.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'] = "Notification"; $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"> <!-- message area start --> <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-success" role="alert"> <?php echo $this->session->flashdata('success'); ?> </div> <?php } ?> </div> </div> <!-- message area end --> <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 Notification</h5> </div> <div class="card-body"> <form action="<?php echo base_url().'admin/notification/create'; ?>" method="post" enctype="multipart/form-data"> <div class="row"> <div class="col-md-6"> <div class="mb-3"> <label class="form-label" for="title">Title <span class="text-danger">*</span></label> <input type="text" required name="title" class="form-control <?php echo (!empty(form_error('title')))?"is-invalid" : ""; ?>" value="<?php echo set_value('title') ?>" id="title" placeholder="Notification" /> <?php echo (!empty(form_error('title')))? form_error('title') : ""; ?> </div> </div> <div class="col-md-6"> <div class="mb-3"> <label class="form-label" for="file">Upload File</label> <input type="file" id="file" name="file" class="form-control <?php echo (!empty($errorFileUpload)) ?"is-invalid":""; ?>"> <?php echo (!empty($errorFileUpload))? $errorFileUpload : ""; ?> </div> </div> </div> <button type="submit" class="btn btn-primary">Save Notification</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 Notification</h5> </div> <div class="card-body"> <div class="table-responsive text-nowrap"> <table class="table table-bordered"> <thead> <tr> <th>S. No.</th> <th>Notification</th> <th>File</th> <th>Date</th> <th>Actions</th> </tr> </thead> <tbody> <?php $i=1; foreach($notification as $getNoti){ ?> <tr> <td><?php echo $i; ?></td> <td><i class="fab fa-angular fa-lg text-danger me-3"></i> <strong><?php echo $getNoti['notice'] ?></strong></td> <td> <?php $path = "./public/uploads/notice/".$getNoti['file_name']; if(!empty($getNoti['file_name']) and file_exists($path)){ ?> <span class="badge bg-label-primary me-1"><a href="<?php echo base_url()."public/uploads/notice/".$getNoti['file_name']; ?>" target="_blank">View File</a></span> <?php }else{ ?> <span class="badge bg-label-danger me-1">No File!</span> <?php } ?> </td> <td><?php echo date('d-M-Y', strtotime($getNoti['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 $getNoti['file_id'] ?>)"><i class="bx bx-edit-alt me-1"></i> Edit</a> <a class="dropdown-item" href="javascript:void(0);" onclick="deleteNoti(<?php echo $getNoti['file_id'] ?>)"><i class="bx bx-trash me-1"></i> Delete</a> </div> </div> </td> </tr> <?php $i++; } ?> </tbody> </table> </div> <div class="mt-2"> <?php echo $pagination_links; ?> </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 Notification</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/notification/edit'; ?>" method="post" enctype="multipart/form-data"> <div class="row"> <div class="col-md-12"> <input type="hidden" name="eid" id="eid" value=""> <div class="mb-3"> <label class="form-label" for="etitle">Title <span class="text-danger">*</span></label> <input type="text" name="etitle" required class="form-control <?php echo (!empty(form_error('title')))?"is-invalid" : ""; ?>" value="<?php echo set_value('title') ?>" id="etitle" placeholder="Notification" /> <?php echo (!empty(form_error('etitle')))? form_error('etitle') : ""; ?> </div> </div> <div class="col-md-12"> <div class="mb-3"> <label class="form-label" for="efile">Upload File</label> <input type="file" id="efile" name="efile" class="form-control <?php echo (!empty($errorFileUpload)) ?"is-invalid":""; ?>"> <?php echo (!empty($errorFileUpload))? $errorFileUpload : ""; ?> </div> </div> </div> <button type="submit" class="btn btn-primary">Save Notification</button> </form> </div> </div> <!-- offcanvas end --> <?php $this->load->view('admin/components/footer'); ?> <?php $this->load->view('admin/components/footer_link'); ?> <script> function deleteNoti(id){ // alert(id); if(window.confirm("Are you sure you want to delete this notification?")){ window.location.href="<?php echo base_url().'admin/notification/delete/' ?>"+id; } } function showEdit(id){ // console.log(id); $.ajax({ type:"POST", url:"<?php echo base_url().'admin/notification/getDataAjax/' ?>"+id, // data:{'id':id}, success:function(response){ // alert("hey, this alert is from ajax blok : "+ response) let data = JSON.parse(response) // console.log(data[0]); $("#eid").val(data[0].file_id); $("#etitle").val(data[0].notice); } }) const editOffCanvas = document.getElementById("editOffCanvas"); var bsOffcanvas = new bootstrap.Offcanvas(editOffCanvas) bsOffcanvas.show() } </script> </body> </html>