feat: store_retail

feature/issue-1/view-store-detail
Frédérik Benoist 2023-11-26 23:17:56 +01:00
parent b5d7024ab5
commit 4e4a838045
4 changed files with 766 additions and 4090 deletions

View File

@ -237,7 +237,7 @@ Contact: frederik.benoist@inetum.com
<!--begin::Search--> <!--begin::Search-->
<div class="d-flex align-items-center position-relative my-1"> <div class="d-flex align-items-center position-relative my-1">
<i class="ki-outline ki-magnifier fs-3 position-absolute ms-5"></i> <i class="ki-outline ki-magnifier fs-3 position-absolute ms-5"></i>
<input type="text" data-kt-user-table-filter="search" class="form-control form-control-solid w-250px ps-13" placeholder="Rechercher Store" /> <input type="text" data-kt-user-table-filter="search" class="form-control form-control-solid w-250px ps-13" placeholder="Search store" />
</div> </div>
<!--end::Search--> <!--end::Search-->
</div> </div>

View File

@ -50,12 +50,15 @@ var KTUsersList = function () {
// Init datatable --- more info on datatables: https://datatables.net/manual/ // Init datatable --- more info on datatables: https://datatables.net/manual/
datatable = $(table).DataTable({ datatable = $(table).DataTable({
"info": false, info: false,
"bStateSave": true, // cookie bStateSave: false, // cookie
'order': [], order: [],
"pageLength": 10, pageLength: 10,
"lengthChange": false, lengthChange: true,
'columnDefs': [ processing: false,
paging: true,
autoWidth: false,
columnDefs: [
{ orderable: true, targets: 0 }, // Disable ordering on column 0 (checkbox) { orderable: true, targets: 0 }, // Disable ordering on column 0 (checkbox)
{ orderable: false, targets: 3 }, // Disable ordering on column 6 (actions) { orderable: false, targets: 3 }, // Disable ordering on column 6 (actions)
], ],
@ -71,17 +74,13 @@ var KTUsersList = function () {
{ data: 'ip', name: "ip" }, { data: 'ip', name: "ip" },
{ data: 'telephone', name: "telephone"} { data: 'telephone', name: "telephone"}
], ],
"ajax": { ajax: {
"url": "http://localhost:8080/hdpos/api/stores/getAll", // Remplacez cela par l'URL correcte de votre API "url": "http://localhost:8080/hdpos/api/stores/getAll",
"dataSrc": "" // Indique à DataTables de traiter le tableau directement "dataSrc": ""
}, },
}); error: function (jqXHR, textStatus, errorThrown) {
toastr.error(jqXHR.responseJSON.error, "Error");
// Re-init functions on every table re-draw -- more info: https://datatables.net/reference/event/draw }
datatable.on('draw', function () {
//initToggleToolbar();
handleDeleteRows();
//toggleToolbars();
}); });
} }

File diff suppressed because it is too large Load Diff

View File

@ -5,29 +5,71 @@ var KTStoreView = function () {
// Shared variables // Shared variables
var storeId var storeId
var ipAddress var ipAddress
var inputIpAddress = document.getElementById("hb_storeIpAddress");
var butIpAddress = document.getElementById("but_storeIpAddress"); //
// dt Item
var datatableItem; var datatableItem;
var tableItem = document.getElementById('kt_table_item'); var tableItem = document.getElementById('kt_dt_item');
var datatableItemOption var statusItem = document.getElementById('kt_dt_item_status');
var tableItemOptions = document.getElementById('kt_table_item_options'); // dt Item option
var datatableItemPrices; var datatableItemOptions
var tableItemPrices = document.getElementById('kt_table_item_prices'); var tableItemOptions = document.getElementById('kt_dt_item_options');
var statusItemOptions = document.getElementById('kt_dt_item_options_status');
// dt Item price
var datatableItemPrice;
var tableItemPrice = document.getElementById('kt_dt_item_price');
var statusItemPrice = document.getElementById('kt_dt_item_price_status');
// dt Item stock
var datatableItemStock; var datatableItemStock;
var tableItemStock = document.getElementById('kt_table_item_stock'); var tableItemStock = document.getElementById('kt_dt_item_stock');
var statusItemStock = document.getElementById('kt_dt_item_stock_status');
// dt Store version
var datatableStoreVersion;
var tableStoreVersion = document.getElementById('kt_dt_store_version');
var statusStoreVersion = document.getElementById('kt_dt_store_version_status');
// dt Store sequence
var datatableStoreSequence;
var tableStoreSequence = document.getElementById('kt_dt_store_sequence');
var statusStoreSequence = document.getElementById('kt_dt_store_sequence_status');
// dt Store signature
var datatableStoreSignature;
var tableStoreSignature = document.getElementById('kt_dt_store_signature');
var statusStoreSignature = document.getElementById('kt_dt_store_signature_status');
// Init store view page // Init store view page
var initStoreView = () => { var initStoreView = () => {
var tabs = Array.prototype.slice.call(document.querySelectorAll('a[data-bs-toggle="tab"]'));
tabs.map(function(tab){
tab.addEventListener('click', function(e){
var target = this.getAttribute("href"); // activated tab
if (target == '#kt_store_item') {
// null
} else if (target == '#kt_store_general') {
loadStoreVersion();
} else if (target == '#kt_store_admin') {
loadStoreSequence();
loadStoreSignature();
}
});
});
// call StoreDetails API // call StoreDetails API
fetch('http://localhost:8080/hdpos/api/stores/getStoreDetails?dbHost='+ipAddress+'&storeId='+storeId) fetch('http://localhost:8080/hdpos/api/stores/getStoreDetails?dbHost='+ipAddress+'&storeId='+storeId)
.then(response => response.json()) .then(response => response.json())
.then(data => { .then(data => {
debugger;
document.getElementById('hb_storePhoto').style.backgroundImage = "url('" + data.store.photoLink + "')";
document.getElementById("hb_storeTitle").innerText = data.store.id_structure + " - " + data.store.nom; document.getElementById("hb_storeTitle").innerText = data.store.id_structure + " - " + data.store.nom;
document.getElementById("hb_storeIpAddress").innerText = ipAddress; document.getElementById("hb_storeIpAddress").value = ipAddress;
document.getElementById("hb_storePhoneNumber").innerText = data.store.telephone; document.getElementById("hb_storePhoneNumber").innerText = data.store.telephone;
document.getElementById("hb_storeEnseigne").innerText = data.store.enseigne;
// Display backOffice transaction informations // Display backOffice transaction informations
var statusTransaction = document.getElementById("hb_backOfficeTransactionOk"); var statusTransaction = document.getElementById("hb_backOfficeTransactionOk");
debugger;
if (data.transaction.backOfficeTransactionOk==true) { if (data.transaction.backOfficeTransactionOk==true) {
statusTransaction.classList.add("bg-success"); statusTransaction.classList.add("bg-success");
document.getElementById("hb_backOfficeBusinessDate").classList.add("text-gray-800"); document.getElementById("hb_backOfficeBusinessDate").classList.add("text-gray-800");
@ -58,6 +100,425 @@ var KTStoreView = function () {
}); });
} }
const loadItem = (itemId) => {
if (!$.fn.dataTable.isDataTable('#kt_dt_item') ) {
statusItem.innerHTML = 'Loading...';
// call StoreDetails API
datatableItem = $(tableItem).DataTable({
info: false,
bStateSave: false, // cookie
order: [],
pageLength: 10,
lengthChange: true,
processing: true,
paging: false,
autoWidth: false,
fixedColumns: {
left: 1
},
ajax: {
"url": "http://localhost:8080/hdpos/api/items/" + itemId,
"dataSrc": "",
"data": {
"dbHost": ipAddress
},
"error": function (jqXHR, textStatus, errorThrown) {
dtUpdateStatus(statusItem, "Ajax Error", jqXHR.responseJSON.error, true)
}
},
columns: [
{ data: 'itemId', name: "ITEM_ID" },
{ data: 'itemLevelCode', name: "LEVEL" },
{ data: 'parentItemId', name: "PARENT" },
{ data: 'itemTypeCode', name: "TYPE" },
{ data: 'createDate', name: "DATE CREATE" },
{ data: 'createUserId', name: "USER CREATE"},
{ data: 'updateDate', name: "DATE UPDATE" },
{ data: 'updateUserId', name: "USER UPDATE"},
] ,
initComplete: function () {
dtUpdateStatus(statusItem, "Last refresh", "", false)
}
});
} else {
statusItem.innerHTML = 'Loading...';
datatableItem.ajax.url("http://localhost:8080/hdpos/api/items/" + itemId);
datatableItem.ajax.reload(function() {
dtUpdateStatus(statusItem, "Last refresh", "", false)
}, true);
}
}
const loadItemOptions = (itemId) => {
if (!$.fn.dataTable.isDataTable('#kt_dt_item_options') ) {
statusItemOptions.innerHTML = 'Loading...';
// call StoreDetails API
datatableItemOptions = $(tableItemOptions).DataTable({
info: false,
bStateSave: false, // cookie
order: [],
pageLength: 10,
lengthChange: true,
processing: true,
paging: true,
autoWidth: false,
fixedColumns: {
left: 1
},
ajax: {
"url": "http://localhost:8080/hdpos/api/items/" + itemId + "/options",
"dataSrc": "",
"data": {
"dbHost": ipAddress
},
"error": function (jqXHR, textStatus, errorThrown) {
dtUpdateStatus(statusItemOptions, "Ajax Error", jqXHR.responseJSON.error, true)
}
},
columns: [
{ data: 'itemId', name: "ITEM_ID" },
{ data: null,
render: function(data, type, full, meta) {
return full.levelCode + ':' + full.levelValue;
}
},
{ data: 'itemAvailabilityCode', name: "VENDABLE" },
{ data: 'taxGroupId', name: "Tkt_dt_item_priceAXE" },
{ data: 'vendor', name: "VENDOR" },
{ data: 'seasonCode', name: "SEASON" },
{ data: 'createDate', name: "DATE CREATE" },
{ data: 'createUserId', name: "USER CREATE"},
{ data: 'updateDate', name: "DATE UPDATE" },
{ data: 'updateUserId', name: "USER UPDATE"},
] ,
initComplete: function () {
dtUpdateStatus(statusItemOptions, "Last refresh", "", false)
}
});
} else {
statusItemOptions.innerHTML = 'Loading...';
datatableItemOptions.ajax.url("http://localhost:8080/hdpos/api/items/" + itemId + "/options");
datatableItemOptions.ajax.reload(function() {
dtUpdateStatus(statusItemOptions, "Last refresh", "", false)
}, true);
}
}
const loadItemPrice = (itemId) => {
if (!$.fn.dataTable.isDataTable('#kt_dt_item_price') ) {
statusItemPrice.innerHTML = 'Loading...';
// call StoreDetails API
datatableItemPrice = $(tableItemPrice).DataTable({
info: false,
bStateSave: false, // cookie
order: [],
pageLength: 10,
lengthChange: true,
processing: true,
paging: true,
autoWidth: false,
fixedColumns: {
left: 1
},
ajax: {
"url": "http://localhost:8080/hdpos/api/items/" + itemId + "/price",
"dataSrc": "",
"data": {
"dbHost": ipAddress
},
"error": function (jqXHR, textStatus, errorThrown) {
dtUpdateStatus(statusItemPrice, "Ajax Error", jqXHR.responseJSON.error, true)
}
},
columns: [
{ data: 'itemId', name: "ITEM_ID" },
{ data: null,
render: function(data, type, full, meta) {
return full.levelCode + ':' + full.levelValue;
}
},
{ data: 'itmPricePropertyCode', name: "TYPE" },
{ data: 'effectiveDate', name: "EFFECTIVE DATE" },
{ data: 'expirationDate', name: "EXPIRATION DATE" },
{ data: 'price', name: "PRICE" },
{ data: 'externalId', name: "EXTERNAL_ID" },
{ data: 'createDate', name: "DATE CREATE" },
{ data: 'createUserId', name: "USER CREATE"},
{ data: 'updateDate', name: "DATE UPDATE" },
{ data: 'updateUserId', name: "USER UPDATE"},
],
initComplete: function () {
dtUpdateStatus(statusItemPrice, "Last refresh", "", false)
}
});
} else {
statusItemPrice.innerHTML = 'Loading...';
datatableItemPrice.ajax.url("http://localhost:8080/hdpos/api/items/" + itemId + "/price");
datatableItemPrice.ajax.reload(function() {
dtUpdateStatus(statusItemPrice, "Last refresh", "", false)
}, true);
}
}
const loadItemStock = (itemId) => {
if (!$.fn.dataTable.isDataTable('#kt_dt_item_stock') ) {
statusItemStock.innerHTML = 'Loading...';
// call StoreDetails API
datatableItemStock = $(tableItemStock).DataTable({
info: false,
bStateSave: false, // cookie
order: [],
pageLength: 10,
lengthChange: true,
processing: true,
paging: true,
autoWidth: false,
fixedColumns: {
left: 1
},
ajax: {
"url": "http://localhost:8080/hdpos/api/items/" + itemId + "/stock",
"dataSrc": "",
"data": {
"dbHost": ipAddress
},
"error": function (jqXHR, textStatus, errorThrown) {
dtUpdateStatus(statusItemStock, "Ajax Error", jqXHR.responseJSON.error, true)
}
},
columns: [
{ data: 'itemId', name: "ITEM_ID" },
{ data: 'invLocationId', name: "LOCATION" },
{ data: 'bucketId', name: "BUCKET" },
{ data: 'unitCount', name: "STOCK" },
{ data: 'inventoryValue', name: "INV VALUE" },
{ data: 'createDate', name: "DATE CREATE" },
{ data: 'createUserId', name: "USER CREATE"},
{ data: 'updateDate', name: "DATE UPDATE" },
{ data: 'updateUserId', name: "USER UPDATE"},
],
initComplete: function () {
dtUpdateStatus(statusItemStock, "Last refresh", "", false)
}
});
} else {
statusItemStock.innerHTML = 'Loading...';
datatableItemStock.ajax.url("http://localhost:8080/hdpos/api/items/" + itemId + "/stock");
datatableItemStock.ajax.reload(function() {
dtUpdateStatus(statusItemStock, "Last refresh", "", false)
}, true);
}
}
const loadStoreVersion = () => {
if (!$.fn.dataTable.isDataTable('#kt_dt_store_version') ) {
statusStoreVersion.innerHTML = 'Loading...';
// call StoreDetails API
datatableStoreVersion = $(tableStoreVersion).DataTable({
info: false,
bStateSave: false, // cookie
order: [],
pageLength: 10,
lengthChange: true,
processing: true,
paging: false,
autoWidth: false,
ajax: {
"url": "http://localhost:8080/hdpos/api/stores/version",
"dataSrc": "",
"data": {
"dbHost": ipAddress
},
"error": function (jqXHR, textStatus, errorThrown) {
dtUpdateStatus(statusStoreVersion, "Ajax Error", jqXHR.responseJSON.error, true)
}
},
columns: [
{ data: 'seq', name: "SEQ" },
{ data: 'baseSchemaDate', name: "BASE_SCHEMA_DATE" },
{ data: 'baseSchemaVersion', name: "BASE_SCHEMA_VERSION" },
{ data: 'customerSchemaDate', name: "CUSTOMER_SCHEMA_DATE" },
{ data: 'customerSchemaVersion', name: "CUSTOMER_SCHEMA_VERSION" },
{ data: 'customer', name: "CUSTOMER" },
{ data: 'createDate', name: "DATE CREATE" },
{ data: 'createUserId', name: "USER CREATE"},
{ data: 'updateDate', name: "DATE UPDATE" },
{ data: 'updateUserId', name: "USER UPDATE"},
] ,
initComplete: function () {
dtUpdateStatus(statusStoreVersion, "Last refresh", "", false)
}
});
}
}
const loadStoreSequence = () => {
if (!$.fn.dataTable.isDataTable('#kt_dt_store_sequence') ) {
statusStoreSequence.innerHTML = 'Loading...';
// call StoreDetails API
datatableStoreSequence = $(tableStoreSequence).DataTable({
info: true,
bStateSave: false, // cookie
order: [],
pageLength: 10,
lengthChange: true,
processing: true,
paging: true,
autoWidth: false,
ajax: {
"url": "http://localhost:8080/hdpos/api/stores/sequence",
"dataSrc": "",
"data": {
"dbHost": ipAddress
},
"error": function (jqXHR, textStatus, errorThrown) {
dtUpdateStatus(statusStoreSequence, "Ajax Error", jqXHR.responseJSON.error, true)
}
},
columns: [
{ data: 'wkstnId', name: "WSID" },
{ data: 'sequenceId', name: "NAME" },
{ data: 'sequenceMode', name: "MODE" },
{ data: 'sequenceNbr', name: "VALUE" },
{ data: 'createDate', name: "DATE CREATE" },
{ data: 'createUserId', name: "USER CREATE"},
{ data: 'updateDate', name: "DATE UPDATE" },
{ data: 'updateUserId', name: "USER UPDATE"},
],
initComplete: function () {
this.api()
.columns()
.every(function () {
let column = this;
let title = column.footer().textContent;
// Create input element
let input = document.createElement('input');
input.placeholder = title;
// Get the width of the header cell and apply it to the input element
let headerWidth = column.header().offsetWidth;
input.style.width = headerWidth + 'px';
column.footer().replaceChildren(input);
// Event listener for user input
input.addEventListener('keyup', () => {
if (column.search() !== this.value) {
column.search(input.value).draw();
}
});
});
dtUpdateStatus(statusStoreSequence, "Last refresh", "", false)
}
});
document.getElementById("kt_dt_store_sequence_reload").addEventListener('click', function() {
statusStoreSequence.innerHTML = 'Loading...';
datatableStoreSequence.ajax.reload(function() {
dtUpdateStatus(statusStoreSequence, "Last refresh", "", false)
}, true);
});
}
}
const loadStoreSignature = () => {
if (!$.fn.dataTable.isDataTable('#kt_dt_store_signature') ) {
statusStoreSignature.innerHTML = 'Loading...';
// call StoreDetails API
datatableStoreSignature = $(tableStoreSignature).DataTable({
info: true,
bStateSave: false, // cookie
order: [],
pageLength: 10,
lengthChange: true,
processing: true,
paging: true,
autoWidth: false,
fixedColumns: {
left: 2
},
ajax: {
"url": "http://localhost:8080/hdpos/api/stores/signature",
"dataSrc": "",
"data": {
"dbHost": ipAddress
},
"error": function (jqXHR, textStatus, errorThrown) {
dtUpdateStatus(statusStoreSignature, "Ajax Error", jqXHR.responseJSON.error, true)
}
},
columns: [
{ data: 'wkstnId', name: "WSID" },
{ data: 'signatureId', name: "SIGNATURE_ID" },
{ data: 'signatureMode', name: "MODE" },
{ data: 'signatureString', name: "SIGNATURE_STRING" },
{ data: 'signatureSource', name: "SIGNATURE_SOURCE" },
{ data: 'createDate', name: "DATE CREATE" },
{ data: 'createUserId', name: "USER CREATE"},
{ data: 'updateDate', name: "DATE UPDATE" },
{ data: 'updateUserId', name: "USER UPDATE"},
],
initComplete: function () {
this.api()
.columns()
.every(function () {
let column = this;
let title = column.footer().textContent;
// Create input element
let input = document.createElement('input');
input.placeholder = title;
// Get the width of the header cell and apply it to the input element
let headerWidth = column.header().offsetWidth;
input.style.width = headerWidth + 'px';
column.footer().replaceChildren(input);
// Event listener for user input
input.addEventListener('keyup', () => {
if (column.search() !== this.value) {
column.search(input.value).draw();
}
});
});
dtUpdateStatus(statusStoreSignature, "Last refresh", "", false)
}
});
}
}
const handleIpChange = () => {
// Add an event listener for value change
butIpAddress.addEventListener('click', function() {
// Create a URL object with the current URL
var url = new URL(window.location.href);
// Get URL search parameters
var params = url.searchParams;
// Modify IP address
params.set('ip', inputIpAddress.value);
// Update URL with new search parameters
url.search = params.toString();
// Change the current URL and reload the page
window.location.href = url.toString();
});
}
// Submit form handler // Submit form handler
const handleItemSubmit = () => { const handleItemSubmit = () => {
// Define variables // Define variables
@ -76,6 +537,10 @@ var KTStoreView = function () {
validators: { validators: {
notEmpty: { notEmpty: {
message: 'Item ID is required' message: 'Item ID is required'
},
stringLength: {
min: 7,
message: 'Item ID must be 7 characters or more'
} }
} }
} }
@ -99,166 +564,32 @@ var KTStoreView = function () {
if (validator) { if (validator) {
validator.validate().then(function (status) { validator.validate().then(function (status) {
if (status == 'Valid') { if (status == 'Valid') {
submitButton.setAttribute('data-kt-indicator', 'on');
// Disable submit button while loading
submitButton.disabled = true;
var itemId = document.querySelector('input[name="itemId"]').value; var itemId = document.querySelector('input[name="itemId"]').value;
// call StoreDetails API loadItem(itemId);
fetch('http://localhost:8080/hdpos/api/items/getItemDetails?dbHost='+ipAddress+'&itemId='+itemId) loadItemOptions(itemId);
.then(response => response.json()) loadItemPrice(itemId);
.then(data => { loadItemStock(itemId);
if ( $.fn.dataTable.isDataTable('#kt_table_item') ) {
$('#kt_table_item').DataTable().destroy();
}
datatableItem = $(tableItem).DataTable({
"info": true,
"bStateSave": true, // cookie
'order': [],
"pageLength": 10,
"lengthChange": false,
columns: [
{ data: 'itemId', name: "ITEM_ID" },
{ data: 'itemLevelCode', name: "LEVEL" },
{ data: 'parentItemId', name: "PARENT" },
{ data: 'itemTypeCode', name: "TYPE" },
{ data: null, // Using null to create a custom column
render: function(data, type, full, meta) {
return full.createDate + '<br>' + full.createUserId;
}
},
{ data: null, // Using null to create a custom column
render: function(data, type, full, meta) {
return full.updateDate + '<br>' + full.updateUserId;
}
}
],
"data": data.items
});
if ( $.fn.dataTable.isDataTable('#kt_table_item_options') ) {
$('#kt_table_item_options').DataTable().destroy();
}
datatableItemOption = $(tableItemOptions).DataTable({
"info": true,
"bStateSave": true, // cookie
'order': [],
"pageLength": 10,
"lengthChange": false,
columns: [
{ data: 'itemId', name: "ITEM_ID" },
{ data: null,
render: function(data, type, full, meta) {
return full.levelCode + ':' + full.levelValue;
}
},
{ data: 'itemAvailabilityCode', name: "VENDABLE" },
{ data: 'taxGroupId', name: "TAXE" },
{ data: 'vendor', name: "VENDOR" },
{ data: 'seasonCode', name: "SEASON" },
{ data: null, // Using null to create a custom column
render: function(data, type, full, meta) {
return full.createDate + '<br>' + full.createUserId;
}
},
{ data: null, // Using null to create a custom column
render: function(data, type, full, meta) {
return full.updateDate + '<br>' + full.updateUserId;
}
}
],
"data": data.itemOptions
});
if ( $.fn.dataTable.isDataTable('#kt_table_item_prices') ) {
$('#kt_table_item_prices').DataTable().destroy();
}
datatableItemPrices = $(tableItemPrices).DataTable({
"info": true,
"bStateSave": true, // cookie
'order': [],
"pageLength": 10,
"lengthChange": false,
columns: [
{ data: 'itemId', name: "ITEM_ID" },
{ data: null,
render: function(data, type, full, meta) {
return full.levelCode + ':' + full.levelValue;
}
},
{ data: 'itmPricePropertyCode', name: "TYPE" },
{ data: null, // Using null to create a custom column
render: function(data, type, full, meta) {
return full.effectiveDate + '<br>' + full.expirationDate;
}
},
{ data: 'price', name: "PRICE" },
{ data: 'externalId', name: "EXTERNAL_ID" },
{ data: null, // Using null to create a custom column
render: function(data, type, full, meta) {
return full.createDate + '<br>' + full.createUserId;
}
},
{ data: null, // Using null to create a custom column
render: function(data, type, full, meta) {
return full.updateDate + '<br>' + full.updateUserId;
}
}
],
"data": data.itemPrices
});
if ( $.fn.dataTable.isDataTable('#kt_table_item_stock') ) {
$('#kt_table_item_stock').DataTable().destroy();
}
datatableItemStock = $(tableItemStock).DataTable({
"info": true,
"bStateSave": true, // cookie
'order': [],
"pageLength": 10,
"lengthChange": false,
columns: [
{ data: 'itemId', name: "ITEM_ID" },
{ data: 'invLocationId', name: "LOCATION" },
{ data: 'bucketId', name: "BUCKET" },
{ data: 'itemId', name: "ITEM_ID" },
{ data: 'unitCount', name: "STOCK" },
{ data: null, // Using null to create a custom column
render: function(data, type, full, meta) {
return full.createDate + '<br>' + full.createUserId;
}
},
{ data: null, // Using null to create a custom column
render: function(data, type, full, meta) {
return full.updateDate + '<br>' + full.updateUserId;
}
}
],
"data": data.itemStock
});
// Enable submit button after loading
submitButton.removeAttribute('data-kt-indicator');
submitButton.disabled = false;
})
.catch(error => {
console.error('Error retrieving item details:', error);
// Enable submit button after loading
submitButton.removeAttribute('data-kt-indicator');
submitButton.disabled = false;
});
} }
}); });
} }
}) })
} }
function dtUpdateStatus(statusElement, statusMessage, toastMessage, isError) {
const currentDate = new Date();
const formattedDate = `${currentDate.getDate()}/${currentDate.getMonth() + 1}/${currentDate.getFullYear()} @ ${currentDate.getHours().toString().padStart(2, '0')}:${currentDate.getMinutes().toString().padStart(2, '0')}:${currentDate.getSeconds().toString().padStart(2, '0')}`;
// Check if the message is an error or information
if (isError) {
toastr.error(toastMessage, "Error");
} else {
toastr.info("Refreshed data", "Info");
}
statusElement.innerHTML = `${statusMessage}: ${formattedDate}`;
}
return { return {
// Public functions // Public functions
init: function () { init: function () {
@ -266,8 +597,27 @@ var KTStoreView = function () {
storeId = KTUtil.getURLParam("storeId"); storeId = KTUtil.getURLParam("storeId");
ipAddress = KTUtil.getURLParam("ip"); ipAddress = KTUtil.getURLParam("ip");
toastr.options = {
"closeButton": false,
"debug": false,
"newestOnTop": false,
"progressBar": false,
"positionClass": "toastr-top-right",
"preventDuplicates": true,
"onclick": null,
"showDuration": "300",
"hideDuration": "1000",
"timeOut": "5000",
"extendedTimeOut": "1000",
"showEasing": "swing",
"hideEasing": "linear",
"showMethod": "fadeIn",
"hideMethod": "fadeOut"
};
// Handle forms // Handle forms
initStoreView(); initStoreView();
handleIpChange();
handleItemSubmit(); handleItemSubmit();
} }
}; };