NonInventPurchasingSystem/CPRNIMS.WebApps/wwwroot/JsFunctions/PO/ComponentsV2.js
2026-01-20 07:44:30 +08:00

70 lines
2.0 KiB
JavaScript

function shippingInstructsComponent(id) {
$.ajax({
url: '/POMgmt/GetShippingInstructions',
type: 'GET',
data: { id: id },
success: function (response) {
$('#shippingInstructionsContainer').html(response); // Inject the component's HTML into the modal
},
error: function (xhr, status, error) {
console.error("Error loading component:", error);
}
});
}
function poTableComponent(id, loader) {
$.ajax({
url: '/POMgmt/GetPOTable',
type: 'GET',
data: { id: id },
success: function (response) {
$('#POTableContainer').html(response);
poInitializeDatatable(loader);
},
error: function (xhr, status, error) {
console.error("Error loading component:", error);
}
});
}
function customFormPOElemComponent(id) {
populateIncoterms();
populatePOElem(id);
$('#poTypeId').val(id);
$("#supplierName").on('keyup', function () {
populateSupplier();
});
if (!id) {
console.warn("No PO Type selected.");
return;
}
$.ajax({
url: '/POMgmt/GetCustomFormPOElem',
type: 'GET',
data: { id: id },
success: function (response) {
$('#CustomFormPOElemContainer').html(response);
$("#C-paymentTerms").on('keyup', function () {
populateTerms();
});
},
error: function (xhr, status, error) {
console.error("Error loading component:", error);
}
});
}
function poNoComponent(id) {
populatePONoElem(id);
$('#poTypeId').val(id);
}
function poReportComponent(id) {
return $.ajax({
url: '/POMgmt/GetPOReportTable',
type: 'GET',
data: { id: id },
success: function (response) {
$('#POTableContainer').html(response);
},
error: function (xhr, status, error) {
console.error("Error loading component:", error);
}
});
}