D7net
Home
Console
Upload
information
Create File
Create Folder
About
Tools
:
/
home
/
ksclnmuac
/
public_html
/
ci_panel
/
application
/
views
/
admin
/
Filename :
department.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'] = "Department"; $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 } ?> </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 Department</h5> </div> <div class="card-body"> <form method="post" action="<?php echo base_url().'admin/department/addDepartment'; ?>"> <div class="row"> <div class="col-md-12"> <div class="mb-3"> <label class="form-label" for="department">Department Name <span class="text-danger">*</span></label> <input type="text" required class="form-control <?php echo (!empty(form_error('department')))?"is-invalid":""; ?>" value="<?php echo set_value('department'); ?>" id="department" name="department" placeholder="Department Name" /> <?php echo (!empty(form_error('department')))?form_error('department'):""; ?> </div> </div> </div> <button type="submit" class="btn btn-primary">Save Department</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 Department</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>Department</th> <th>Data</th> <th>Actions</th> </tr> </thead> <tbody> <?php if(!empty($department)){ $i = 1; foreach($department as $dept){ ?> <tr> <td><?php echo $i; ?></td> <td><i class="fab fa-angular fa-lg text-danger me-3"></i> <strong><?php echo $dept['dept_name']; ?></strong></td> <td><?php echo date('d-M-Y', strtotime($dept['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 $dept['dept_id'] ?>)"><i class="bx bx-edit-alt me-1"></i> Edit</a> <a class="dropdown-item" href="javascript:void(0);" onclick="deleteDept(<?php echo $dept['dept_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 Department</h5> <button type="button" class="btn-close text-reset" data-bs-dismiss="offcanvas" aria-label="Close"></button> </div> <div class="offcanvas-body"> <form method="post" action="<?php echo base_url().'admin/department/edit'; ?>"> <input type="hidden" name="eid" id="eid" value=""> <div class="row"> <div class="col-md-12"> <div class="mb-3"> <label class="form-label" for="edepartment">Department Name <span class="text-danger">*</span></label> <input type="text" class="form-control <?php echo (!empty(form_error('department')))?"is-invalid":""; ?>" required value="<?php echo set_value('department'); ?>" id="edepartment" name="edepartment" placeholder="Department Name" /> <?php echo (!empty(form_error('edepartment')))?form_error('edepartment'):""; ?> </div> </div> </div> <button type="submit" class="btn btn-primary">Save Department</button> </form> </div> </div> <!-- offcanvas end --> <?php $this->load->view('admin/components/footer'); ?> <?php $this->load->view('admin/components/footer_link'); ?> <script> function deleteDept(id){ // console.log(id); if(window.confirm("Are you sure, you want to delete this department?")){ window.location.href="<?php echo base_url().'admin/department/delete/' ?>"+id } } function showEdit(id){ $.ajax({ type:"POST", url:"<?php echo base_url().'admin/department/getDataAjax/' ?>"+id, success:function(response){ let data = JSON.parse(response) $("#eid").val(data[0].dept_id); $("#edepartment").val(data[0].dept_name); } }) const editOffCanvas = document.getElementById("editOffCanvas"); var bsOffcanvas = new bootstrap.Offcanvas(editOffCanvas) bsOffcanvas.show() } </script> </body> </html>