partial update detail opnames page
This commit is contained in:
20
resources/js/warehouse_management/opnames/detail.js
Normal file
20
resources/js/warehouse_management/opnames/detail.js
Normal file
@@ -0,0 +1,20 @@
|
||||
$.ajaxSetup({
|
||||
headers: {
|
||||
"X-CSRF-TOKEN": $('meta[name="csrf-token"]').attr("content"),
|
||||
},
|
||||
});
|
||||
let tableContainer = $("#opname-detail-table");
|
||||
let url = tableContainer.data("url");
|
||||
let table = $("#opname-detail-table").DataTable({
|
||||
processing: true,
|
||||
serverSide: true,
|
||||
ajax: url,
|
||||
columns: [
|
||||
{ data: "opname_date", name: "opname_date" },
|
||||
{ data: "user_name", name: "user.name" },
|
||||
{ data: "product_name", name: "product.name" },
|
||||
{ data: "system_stock", name: "system_stock" },
|
||||
{ data: "physical_stock", name: "physical_stock" },
|
||||
{ data: "difference", name: "difference" },
|
||||
],
|
||||
});
|
||||
@@ -16,34 +16,3 @@ let table = $("#opnames-table").DataTable({
|
||||
{ data: "action", name: "action", orderable: false, searchable: false },
|
||||
],
|
||||
});
|
||||
$(document).on("click", ".btn-product-stock-dealers", function () {
|
||||
const productId = $(this).data("id");
|
||||
const productName = $(this).data("name");
|
||||
const ajaxUrl = $(this).data("url");
|
||||
|
||||
// Set product name in modal title
|
||||
$("#product-name-title").text(productName);
|
||||
|
||||
// Initialize or reload DataTable inside modal
|
||||
$("#dealer-stock-table").DataTable({
|
||||
destroy: true, // reinit if exists
|
||||
processing: true,
|
||||
serverSide: true,
|
||||
ajax: {
|
||||
url: ajaxUrl,
|
||||
data: {
|
||||
product_id: productId,
|
||||
},
|
||||
},
|
||||
columns: [
|
||||
{ data: "dealer_name", name: "dealer_name" },
|
||||
{ data: "system_stock", name: "system_stock" },
|
||||
{ data: "physical_stock", name: "physical_stock" },
|
||||
{ data: "difference", name: "difference" },
|
||||
{ data: "opname_date", name: "opname_date" },
|
||||
],
|
||||
});
|
||||
|
||||
// Show the modal
|
||||
$("#dealerStockModal").modal("show");
|
||||
});
|
||||
|
||||
@@ -14,7 +14,12 @@ let table = $("#products-table").DataTable({
|
||||
{ data: "name", name: "name" },
|
||||
{ data: "category_name", name: "category.name" },
|
||||
{ data: "unit", name: "unit" },
|
||||
{ data: "total_stock", name: "total_stock" },
|
||||
{
|
||||
data: "total_stock",
|
||||
name: "total_stock",
|
||||
orderable: false,
|
||||
searchable: false,
|
||||
},
|
||||
{ data: "action", name: "action", orderable: false, searchable: false },
|
||||
],
|
||||
});
|
||||
@@ -83,3 +88,37 @@ $(document).on("click", ".btn-toggle-active", function () {
|
||||
}
|
||||
});
|
||||
});
|
||||
$(document).on("click", ".btn-product-stock-dealers", function () {
|
||||
const productId = $(this).data("id");
|
||||
const productName = $(this).data("name");
|
||||
const ajaxUrl = $(this).data("url");
|
||||
|
||||
// Set product name in modal title
|
||||
$("#product-name-title").text(productName);
|
||||
|
||||
// Initialize or reload DataTable inside modal
|
||||
$("#dealer-stock-table").DataTable({
|
||||
destroy: true, // reinit if exists
|
||||
processing: true,
|
||||
serverSide: true,
|
||||
ajax: {
|
||||
url: ajaxUrl,
|
||||
data: {
|
||||
product_id: productId,
|
||||
},
|
||||
},
|
||||
columns: [
|
||||
{ data: "dealer_name", name: "dealer_name" },
|
||||
{ data: "system_stock", name: "system_stock" },
|
||||
{ data: "physical_stock", name: "physical_stock" },
|
||||
{ data: "difference", name: "difference" },
|
||||
{ data: "opname_date", name: "opname_date" },
|
||||
],
|
||||
initComplete: function () {
|
||||
$("#dealerStockModal").modal("show");
|
||||
},
|
||||
});
|
||||
});
|
||||
$(document).on("click", "#dealerStockModal .close", function () {
|
||||
$("#dealerStockModal").modal("hide");
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user