Files
BarangaySystem/legacy/pages-blade-views/views/fragments/user/shared/adminadvanced/ManageGlobalTransactions.blade.php
2026-06-06 18:43:00 +08:00

113 lines
3.5 KiB
PHP

<script>
//TODO NEXT Fix MnageglobalTransactions not displaying when using button links
// has something to do with add to pageload variable target is confusing and current target
tabledata = [
["Laptop", 1200, "Electronics"],
["Phone", 800, "Electronics"],
["Desk", 300, "Furniture"]
];
ViewBuilder.build({
dataurl: '/View/Product/Details/data',
pageName: 'GlobalTransactionsProduct',
topbartitle: LoadDataPageFunc.PageTitle,
defaultback: {
page: 'BuyViewProductAdmin',
data: currenttarget,
},
defaultErrorHTML: '<b><center>Unable to Load Product</center></b>',
unabletoLoadFunc: (response) => {
if (!response){
alert('no response');
}
const errorModalName = 'errorLoadingModal';
if (document.getElementById(errorModalName)) {
modaldestroy(errorModalName);
}
let responseMessage = response.message;
if (typeof responseMessage !== 'object') {
responseMessage = 'Unknown Error';
}
ModalQuickDismiss('Error!<br>', responseMessage, errorModalName);
},
initialize: (response) => {
if (typeof response.is_from_store !== 'undefined' && response.is_from_store) {
Buttons.push(
{ icon: '/assets/reports.png', label: 'Store Transactions', onclick: "gotoPage('ManageStoreTransactions',currenttarget);return false;" },
);
}
},
sections: [
{
phototype: 'ProductMarket',
type: 'photos',
id: 'PhotosCard',
currentdatavar: 'photourl'
},
{
type: 'details',
data: [
{
h: 3,
bold: true,
type: 'text',
currentdatavar: 'name'
},
{
type: 'text',
func: function () {
const declaredPrice = currentData.store_price || currentData.price;
if (typeof currentData.store_price !== 'undefined' && currentData.store_price) {
return 'Store Price P' + declaredPrice + ' / ' + currentData.unitname;
} else {
return 'P' + declaredPrice + ' / ' + currentData.unitname;
}
},
}
]
},
{
type: 'buttons',
buttons: [
{ icon: '/assets/briefcase.png', label: 'Manage', onclick: "gotoPage('ManageProductAdmin', currenttarget);return false;" },
],
},
{
type: 'card',
id: 'TransactionCard',
hidden: false,
currentdatavar: 'transactions',
func: function () {
// const declaredPrice = currentData.store_price || currentData.price;
const html = createSearchableTable({
data: tabledata,
placeTable: false,
initializeTable: false
});
console.log(html); // no output
return html;
},
},
]
});
</script>