initial: bootstrap from BukidBountyApp base

This commit is contained in:
Jonathan Sykes
2026-06-06 18:43:00 +08:00
commit eb4a5731fb
5674 changed files with 160857 additions and 0 deletions

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,75 @@
<br><br>
<div id="viewContainer">
<center>Loading</center>
</div>
<script>
defaultBackOnclick = null;
Target_Uploaded_Files = [];
if(typeof LoadDataPageFunc==='undefined'){
LoadDataPageFunc = {};
}
LoadDataPageFunc.Settings = {};
LoadDataPageFunc.PageTitle = 'Photo';
LoadDataPageFunc.currentTargetPage = 'PhotoViewer';
LoadDataPageFunc.URLs = {};
LoadDataPageFunc.URLs.MainPhotoFileListHASH = currenttarget;
LoadDataPageFunc.URLs.TargetURL = currenttarget;
LoadDataPageFunc.ids = {};
LoadDataPageFunc.ids.ViewContainer = "viewContainer";
LoadDataPageFunc.RefetchDataAndReload = function (istrue = true) {
if (!istrue) { return false; }
Preloaders.ViewPropertyDetailsData(currenttarget, false,
function (response) {
ReloadPage();
}
);
};
LoadDataPageFunc.UpdateMainContainer=function(html){
$('#'+LoadDataPageFunc.ids.ViewContainer).html(html);
};
LoadDataPageFunc.Settings = {};
LoadDataPageFunc.Settings.RequestType = 'POST';
LoadDataPageFunc.Settings.fromVarCache = true;
LoadDataPageFunc.LoadMainDetails = {};
LoadDataPageFunc.LoadMainDetails.LoadNow = function () {
LoadAndCreateURLfromFileHash(currenttarget).then(bloburl => {
const imgelement = `<img src ="${bloburl}" style="">`;
LoadDataPageFunc.UpdateMainContainer(imgelement);
});
};
LoadDataPageFunc.main = function () {
LoadDataPageFunc.LoadMainDetails.LoadNow();
changeTopbarTitle(LoadDataPageFunc.PageTitle);
};
$(document).ready(function () {
LoadDataPageFunc.main();
});
</script>

View File

@@ -0,0 +1,257 @@
<div id='ListMainContainer'>
</div>
<script>
Target_Uploaded_Files = [];
defaultBackOnclick = null;
if (typeof LoadDataPageFunc === 'undefined') {
LoadDataPageFunc = {};
}
if (typeof LoadDataPageFunc.Settings === 'undefined') {
LoadDataPageFunc.Settings = {};
}
LoadDataPageFunc.Settings.PageName = 'Photos';
LoadDataPageFunc.currentTargetPage = 'ViewAllPhotos';
LoadDataPageFunc.URLs = {};
if (typeof currenttarget === 'string') {
currenttarget = tryparsingJSON(currenttarget);
}
if (typeof currenttarget === 'object') {
LoadDataPageFunc.Settings.Phototype = currenttarget['type'];
targethash = currenttarget['t'];
} else {
targethash = currenttarget;
}
if (typeof LoadDataPageFunc.Settings.Phototype === 'undefined') {
LoadDataPageFunc.Settings.Phototype = 'ProductMarket';
}
LoadDataPageFunc.URLs.QueryListData = '/Request/Photos/' + LoadDataPageFunc.Settings.Phototype;
LoadDataPageFunc.Settings.CurrentTargetRequired = true;
LoadDataPageFunc.Settings.DefaultDatatoSend = null;
LoadDataPageFunc.NewRow = function (url, hashkey) {
if (!hashkey || !url) { return false; }
return [url, '', 'PhotoViewer', hashkey];
};
LoadDataPageFunc.Settings = {};
LoadDataPageFunc.Settings.PageName = 'List';
LoadDataPageFunc.Settings.DefaultCardNoDetailsMessage = 'No Data';
LoadDataPageFunc.Settings.DefaultRequestType = 'POST';
LoadDataPageFunc.Settings.fromVarCache = true;
LoadDataPageFunc.Settings.SortArray = function (arr) {
return arr.sort((a, b) => new Date(b.created) - new Date(a.created));
};
LoadDataPageFunc.ids = {};
LoadDataPageFunc.ids.MainContainer = 'ListMainContainer';
LoadDataPageFunc.ids.ListContainer = 'ListContainer';
LoadDataPageFunc.ids.HashKeyContainer = 'ListRowCardHash';
LoadDataPageFunc.ids.MainCardBody = 'MAINCARDBODY_LIST';
$$$ = {};
$$$.UpdateMainContainer = function (html) {
$('#' + LoadDataPageFunc.ids.MainContainer).html(html);
};
LoadDataPageFunc.Settings = {};
LoadDataPageFunc.Settings.ViewDetailsOnclick = function (data) {
return `ButtonGo('ViewDetails', '${data}')`;
};
LoadDataPageFunc.CheckCachefromURLandChangeURLToBlob = function (photourl) {
if (!photourl) { return ''; }
photoblob = reqcacheload(photourl);
if (photoblob) {
photourl = URL.createObjectURL(photoblob);
}
return photourl;
}
LoadDataPageFunc.URLs.PreloadPhoto = function (hash) {
return '/RequestData/File/' + hash;
};
LoadDataPageFunc.populatelist = function () {
let urlArrays = []; let photoPromises = [];
let newhtmlrows = ''; let htmlarrayrows = [];
let PhotolistHashToHTML = function (PhotoHashArray) {
if (typeof PhotoHashArray === 'string') { PhotoHashArray = JSON.parse(PhotoHashArray); }
let count = PhotoHashArray.length;
for (let dd = 0; dd < count; dd++) {
photoPromises.push(
LoadAndCreateURLfromFileHash(PhotoHashArray[dd]).then(bloburl => {
urlArrays.push(bloburl);
})
);
}
Promise.all(photoPromises).then(() => {
for (let aa = 0; aa < count; aa++) {
if (!PhotoHashArray[aa] || !urlArrays[aa]) { continue; }
htmlarrayrows.push(LoadDataPageFunc.NewRow(urlArrays[aa], PhotoHashArray[aa]));
}
newhtmlrows = UIServices_FullDIV_GOTOPAGE_Array('', viewallhref = '', viewallonclick = '', viewalltext = '', htmlarrayrows);
$('#' + LoadDataPageFunc.ids.ListContainer).html(newhtmlrows);
const elementsWithIconBox = document.querySelectorAll('.icon-box');
elementsWithIconBox.forEach(element => {
element.classList.remove('icon-box');
});
}).catch(error => {
$('#' + LoadDataPageFunc.ids.ListContainer).html('Error Loading Photos');
});
};
if (LoadDataPageFunc.Details && LoadDataPageFunc.Details.photourl) {
let photoarray = LoadDataPageFunc.Details.photourl;
let PhotolistCount = photoarray.length;
if (!PhotolistCount) { return false; }
PhotolistHashToHTML(LoadDataPageFunc.Details.photourl);
return true;
}
let request = new RequestData(true);
request
.url(LoadDataPageFunc.URLs.QueryListData)
.type(LoadDataPageFunc.Settings.DefaultRequestType)
.data({ target: targethash })
.fromVarCache(true)
.success((response) => {
if (!response) {
$('#card-body-' + LoadDataPageFunc.ids.MainCardBody).html(LoadDataPageFunc.Settings.DefaultCardNoDetailsMessage);
return;
}
let List = response;
const count = List.length;
for (let i = 0; i < count; i++) {
// Push each promise into the array
photoPromises.push(
LoadAndCreateURLfromFileHash(List[i]).then(bloburl => {
urlArrays.push(bloburl);
})
);
}
Promise.all(photoPromises).then(() => {
for (let i = 0; i < count; i++) {
if (!List[i] || !urlArrays[i]) { continue; }
htmlarrayrows.push(LoadDataPageFunc.NewRow(urlArrays[i], List[i]));
}
newhtmlrows = UIServices_FullDIV_GOTOPAGE_Array('', viewallhref = '', viewallonclick = '', viewalltext = '', htmlarrayrows);
$('#' + LoadDataPageFunc.ids.ListContainer).html(newhtmlrows);
const elementsWithIconBox = document.querySelectorAll('.icon-box');
elementsWithIconBox.forEach(element => {
element.classList.remove('icon-box');
});
}).catch(error => {
$('#' + LoadDataPageFunc.ids.ListContainer).html('Error Loading Photos');
});
})
.error((err) => {
console.error(err);
})
.go();
};
LoadDataPageFunc.ListContainerMessage = function (message = 'No Photos') {
ListContainer = '<div id="' + LoadDataPageFunc.ids.ListContainer + '"><center>' + message + '</center></div>';
$$$.UpdateMainContainer(UICardSimple('', ListContainer, LoadDataPageFunc.ids.MainCardBody));
};
LoadDataPageFunc.main = function () {
if (LoadDataPageFunc.Settings.CurrentTargetRequired && (!targethash || targethash === '0')) {
$$$.UpdateMainContainer('<center>No Target<br><br>' + buttonprimary('Go Back', '', "Backkey()") +
'<br><br>' + buttonprimary('Home', '', "ButtonGo('Home', '')") + '</center>'); return false;
}
LoadDataPageFunc.ListContainerMessage('Loading Please Wait...');
return true;
};
$(document).ready(function () {
LoadDataPageFunc.main();
LoadDataPageFunc.populatelist();
changeTopbarTitle(LoadDataPageFunc.Settings.PageName);
});
</script>

View File

@@ -0,0 +1,330 @@
<style>
.ListRowCard {
margin-bottom: 20px;
}
</style>
<div id='ListMainContainer'>
</div>
<script>
defaultBackOnclick = null;
LoadDataPageFunc = {};
LoadDataPageFunc.URLs = {};
LoadDataPageFunc.URLs.QueryListData = '/ListStores/List/data';
LoadDataPageFunc.currentPage = 'ListStores';
LoadDataPageFunc.Settings = {};
ListBuilder.build({
targetDiv: "ListMainContainer",
title: "Stores",
dataUrl: "/ListStores/List/data",
pageName: 'ListStores',
defaultback: "Home",
search: true,
unabletoLoadFunc: () => ModalQuickDismiss('Error', 'Unable to Load Data!'),
// customCss:` .ListRowCard {
// margin-bottom: 20px;
// }`,
type: 'tiled',
height: '15vh',
renderCard: function (item, index, config) {
photoblob = reqcacheload(item.photourl);
const imageid ='StoreListPhoto-'+index;
ListBuilder.queueImageLoad(imageid, item.photourl);
const FinalBody = `
<div class="row" onclick=" gotoPage('ViewStoreMarket', '${item.hashkey}');" class="ListCardRow equal-height" style="">
<div class="col-2">
<img src="${item.photourl}" class="StoreListIMGIcon" id="${imageid}" style="max-width:20vw; height:10vh;">
</div>
<div class="col-10">
<div class="row">
<div class="col-12" style="font-width:1.5vh;">
<b>${item.name}</b>
</div>
<div class="col-12" style="font-size:1.0vh;">
${item.category}
</div>
<div class="col-12" style="font-size:0.7vh;">
${item.subcategory}
</div>
</div>
</div>
</div>
`;
const cardid = 'ListRowCard-' + index;
const cardfull = CreateCardSimple('',FinalBody,cardid,'margin:5px; height: 15vh;');
// const cardfull = createCard(item.name, cardid, '', cardbodyid = '', FinalBody, cardbodyclassadd = 'ListCardRow', '', 'ListRowCard');
return cardfull;
},
});
// LoadDataPageFunc.Settings.SortArray = function (arr) {
// return arr.sort((a, b) => new Date(b.created) - new Date(a.created));
// };
// LoadDataPageFunc.Settings.ViewDetailsOnclick = function (data) {
// gotoPage('ViewStoreMarket', `${data}`);
// };
// LoadDataPageFunc.Settings.PageName = 'Stores';
// LoadDataPageFunc.Settings.DefaultCardNoDetailsMessage = 'No Data';
// LoadDataPageFunc.Settings.DefaultRequestType = 'POST';
// LoadDataPageFunc.Settings.fromVarCache = true;
// LoadDataPageFunc.Settings.SortArray = function (arr) {
// return arr.sort((a, b) => new Date(b.created) - new Date(a.created));
// };
// LoadDataPageFunc.Settings.CurrentTargetRequired = false;
// LoadDataPageFunc.Settings.DefaultDatatoSend = null;
// LoadDataPageFunc.NewRow = function (objectdata, rownum) {
// let rowhtml = [];
// const hashkey = objectdata.hashkey;
// let photourl = objectdata.photourl;
// let name = objectdata.name;
// let category = objectdata.category || '';
// let subcategory = objectdata.subcategory || '';
// let FinalBody = '';
// /* html */
// FinalBody = `
// <div class="row" onclick="LoadDataPageFunc.Settings.ViewDetailsOnclick('${hashkey}');">
// <div class="col-2">
// <img src="${photourl}" class="StoreListIMGIcon" id="StoreListPhoto" style="width:0.5vw: height:0.5vh;display:none;">
// </div>
// <div class="col-10">
// <div class="row">
// <div class="col-12" style="font-width:1.5vh;">
// <b>${name}</b>
// </div>
// <div class="col-12" style="font-size:1.0vh;">
// ${category}
// </div>
// <div class="col-12" style="font-size:0.7vh;">
// ${subcategory}
// </div>
// </div>
// </div>
// </div>
// `;
// return createCard(objectdata.fullname, cardid = 'ListRowCard-' + rownum, '', cardbodyid = '', FinalBody, cardbodyclassadd = 'ListCardRow', '', 'ListRowCard');
// };
// LoadDataPageFunc.ids = {};
// LoadDataPageFunc.ids.MainContainer = 'ListMainContainer';
// LoadDataPageFunc.ids.SearchInput = 'List_Search';
// LoadDataPageFunc.ids.ListContainer = 'ListContainer';
// LoadDataPageFunc.ids.HashKeyContainer = 'ListRowCardHash';
// LoadDataPageFunc.ids.MainCardBody = 'MAINCARDBODY_LIST';
// $$$ = {};
// $$$.UpdateMainContainer = function (html) {
// $('#' + LoadDataPageFunc.ids.MainContainer).html(html);
// };
// LoadDataPageFunc.CheckCachefromURLandChangeURLToBlob = function (photourl) {
// if (!photourl) { return ''; }
// photoblob = reqcacheload(photourl);
// if (photoblob) {
// photourl = URL.createObjectURL(photoblob);
// }
// return photourl;
// }
// LoadDataPageFunc.ClearSearch = function () {
// $('#' + LoadDataPageFunc.ids.SearchInput).val('');
// $('#' + LoadDataPageFunc.ids.SearchInput).trigger('keyup');
// };
// LoadDataPageFunc.CardResultInterSectionPreloadDetails = function () {
// let hashkey = '';
// const observer = new IntersectionObserver((entries) => {
// entries.forEach(entry => {
// if (entry.isIntersecting) {
// const cardId = $(entry.target).attr('id');
// const variablePart = cardId.split('-')[1];
// const hashKeyDivId = LoadDataPageFunc.ids.HashKeyContainer + '-' + variablePart;
// hashkey = $('#' + hashKeyDivId).text();
// if (hashkey) {
// request.url('/ViewLead/Details/data').success((response) => {
// }).data({ target: hashkey }).fromVarCache(true).type('POST').go();
// }
// hashkey = '';
// }
// });
// }, { threshold: 0.1 });
// $('#' + LoadDataPageFunc.ids.ListContainer + ' .card').each(function () {
// observer.observe(this);
// });
// };
// LoadDataPageFunc.populatelist = function (response) {
// if (!response) {
// $('#card-body-' + LoadDataPageFunc.ids.MainCardBody).html(LoadDataPageFunc.Settings.DefaultCardNoDetailsMessage);
// return;
// }
// let List = response;
// let newhtmlrows = ''; let htmlarrayrows = [];
// const count = List.length;
// let hashkey;
// for (let i = 0; i < count; i++) {
// let hashkey = List[i]['hashkey'];
// htmlarrayrows.push(LoadDataPageFunc.NewRow(List[i], i) + '<br>');
// }
// newhtmlrows = htmlarrayrows.join('');
// updateHTMLifChanged(newhtmlrows, LoadDataPageFunc.ids.ListContainer);
// const imgclassname = 'StoreListIMGIcon';
// LoadPhotoIMGTargetClass(imgclassname, settodisplaylater = true);
// HideBrokenPhotowithClass(imgclassname);
// LoadDataPageFunc.CardResultInterSectionPreloadDetails();
// };
// LoadDataPageFunc.ListData = false;
// LoadDataPageFunc.reloadPopulatelist = function () {
// loadDataWithCache({
// url: LoadDataPageFunc.URLs.QueryListData,
// currentPage: LoadDataPageFunc.currentPage,
// executeFunction: LoadDataPageFunc.populatelist
// });
// };
// LoadDataPageFunc.SearchKeyUPListPage = function () {
// $('#' + LoadDataPageFunc.ids.SearchInput).on('keyup', function () {
// let searchTerm = $(this).val().toLowerCase();
// $('#' + LoadDataPageFunc.ids.ListContainer + ' .card').each(function () {
// let title = $(this).find('.card-title').text().toLowerCase();
// let cols = $(this).find('.col').text().toLowerCase();
// if (title.includes(searchTerm) || cols.includes(searchTerm)) {
// $(this).show();
// } else {
// $(this).hide();
// }
// });
// });
// };
// LoadDataPageFunc.main = function () {
// const searchcard = UIInputGroup('Search', 'text', LoadDataPageFunc.ids.SearchInput, '', classs = '', span = '', '/assets/clear.png');
// let LeadsListContainer = UICardSimple('', 'Loading Please Wait...', LoadDataPageFunc.ids.ListContainer);
// LeadsListContainer = '<div id="' + LoadDataPageFunc.ids.ListContainer + '"><center>Loading Please Wait...</center></div>';
// const FinalInnerHTML = searchcard + LeadsListContainer;
// const MainCard = UICardSimple('Stores', FinalInnerHTML, LoadDataPageFunc.ids.MainCardBody);
// $$$.UpdateMainContainer(MainCard);
// return true;
// };
// $(document).ready(function () {
// LoadDataPageFunc.main();
// @if($FragmentOnly)
// LoadDataPageFunc.reloadPopulatelist()
// @else
// LoadDataPageFunc.populatelist();
// @endif
// changeTopbarTitle(LoadDataPageFunc.Settings.PageName);
// LoadDataPageFunc.SearchKeyUPListPage();
// $('#imgspan' + LoadDataPageFunc.ids.SearchInput).attr('onclick', 'LoadDataPageFunc.ClearSearch();');
// // $('#ListLeads_Search-div-mb3').addClass('tf-statusbar');
// setDefaultbackGotoPageifNoHistory('Home', 0);
// });
</script>

View File

@@ -0,0 +1,48 @@
<div id='ListMainContainer'>
</div>
<script>
defaultBackOnclick = null;
currentData = null;
LoadDataPageFunc = {};
PhotoListPreloadQueue = [];
ListBuilder.build({
targetDiv: "ListMainContainer",
title: "Products",
dataUrl: "/Market/Products/List",
pageName: 'ListProductsMarket',
defaultback: "Home",
search: true,
width: '40vh',
height: '40vh',
unabletoLoadFunc:() => ModalQuickDismiss('Error', 'Unable to Load Data!'),
card: {
imageField: "photo",
nameField: "name",
priceField: "price",
unitField: "unit",
descriptionField: "description",
onClick: (data) => `ButtonGo('BuyViewProductMarket','${data.hashkey}')`,
fallbackImage: "/assets/noproductphoto.png",
}
});
</script>

View File

@@ -0,0 +1,192 @@
<style>
.ListRowCard {
margin-bottom: 5px;
}
</style>
<script>
defaultBackOnclick = null;
try {
currentData = @json($current_data);
} catch (error) {
currentData = null;
}
LoadDataPageFunc = {};
LoadDataPageFunc.PageTitle = 'Product Details';
LoadDataPageFunc.MainDetailsURL = '';
LoadDataPageFunc.Details = {};
LoadDataPageFunc.Settings = {};
LoadDataPageFunc.currentPage = 'BuyViewProductMarket';
LoadDataPageFunc.Disabled = false;
LoadDataPageFunc.OutofStock = function () {
$('#OutOfStockColumn').show();
$('#ControlsAddCartBuy').hide()
ModalQuickDismiss(false, 'Product Out of Stock');
LoadDataPageFunc.Disabled = true;
};
LoadDataPageFunc.Buy = function () {
if (LoadDataPageFunc.Disabled) { return false; }
gotoPage('ConfirmBUYProductMarket', cartobj, nohistory = 0, redundantpage = 0);
};
LoadDataPageFunc.AddToCart = function () {
if (LoadDataPageFunc.Disabled) { return false; }
if (!currenttarget) { return false; }
let reqq = new RequestData(false);
reqq.fromVarCache(false).data(null).url(`/cart/add/one/${currenttarget}`).type('GET')
.success((response) => {
if (response === true) {
ModalQuickDismiss('', 'Added to Cart!', 'ModalAddedtoCartSuccessfully');
$('#modal-header-ModalAddedtoCartSuccessfully').hide();
} else {
ModalQuickDismiss('', 'Unable to Add to Cart!', 'ModalUnableAddtoCart');
$('#modal-header-ModalUnableAddtoCart').hide();
}
Preloaders.CartContents();
}).go();
};
if (typeof Buttons == 'undefined') {
let Buttons;
}
Buttons = [
// { icon: '/assets/addtocart.png', label: 'Add To Cart', onclick: 'LoadDataPageFunc.AddToCart();return false;' },
// { icon: '/assets/buy.png', label: 'Buy', onclick: 'LoadDataPageFunc.Buy();return false;' },
{ icon: '/assets/briefcase.png', label: 'Manage', onclick: "gotoPage('ManageProductAdmin', currenttarget);return false;" },
];
initGlobal("acct_type", '');
acct_type = @json($currentUser['acct_type']);
defaultbackpage = {
page: 'ListProductsMarket',
data: 0,
};
if (typeof currenttarget.store_hash !== 'undefined' && currenttarget.store_hash) {
defaultbackpage = {
page: 'ViewStoreMarket',
data: currenttarget.store_hash,
};
}
LoadDataPageFunc.Main = function () {
// Preloaders.ViewProductinMarket(currenttarget, true, LoadDataPageFunc.UpdateDetailsUI);
ViewBuilder.build({
dataurl: '/View/Product/Details/data',
pageName: 'BuyViewProductMarket',
topbartitle: LoadDataPageFunc.PageTitle,
defaultback: defaultbackpage,
defaultErrorHTML: '<b><center>Unable to Load Product</center></b>',
unabletoLoadFunc: (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;` },
);
}
//TODO Add routes in viewmap and create the blades and controllers for these
if (acct_type === 'ult' || acct_type === 'superoperator') {
Buttons.push(
{ icon: '/assets/reports.png', label: 'Global Transactions', onclick: `gotoPage('ManageGlobalTransactions',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',
// currentdatavar: 'price',
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;
}
},
}
]
// title: ProductData.name,
// description: ProductData.description,
// price: ProductData.price,
// unit: ProductData.unitname,
},
{
type: 'buttons',
buttons: Buttons
},
{
type: 'card',
id: 'DescriptionCard',
hidden: false,
currentdatavar: 'description',
},
]
});
// LoadDataPageFunc.PopulateDetails();
};
LoadDataPageFunc.Main();
</script>

View File

@@ -0,0 +1,266 @@
@php
use App\Http\Controllers\Market\StoreController;
use App\Enums\UserTypes;
use App\Http\Controllers\FilesMainController;
if (!$FragmentOnly && $current_target) {
}
@endphp
<div id="MainView">
<div class="row">
<div class="col-md" style="overflow:hidden;">
<a href="javascript:void(0);" onclick="">
<div class="card ListRowCard" id="ListRowCard-0" style="">
<div id="cardheader-ListRowCard-0" class="card-header ui-sortable-handle"
style="cursor: move;display:none;">
<h3 class="card-title" style="" id="card-title-ListRowCard-0"></h3>
<div class="card-tools" id="card-tools-ListRowCard-0">
</div>
</div>
<div class="card-body ListCardRow" id="card-body-ListRowCard-0">
<div style="text-align:center;" id="PhotosCard">
<center>
<div id="PhotosPlaceholder"
style="width: 100%; max-width: 600px; height: 350px; display: flex; justify-content: center; align-items: center; background: #f0f0f0; color: #555; font-size: 18px;">
Loading photos...
</div>
</center>
</div>
<br>
<div class="row" style="">
<div class="col">
<h3 id="StoreNameMarketPlace"> </h3>
</div>
<div class="col" id="StoreLocationMarketPlace"> </div>
</div>
<ul class="mt-3 box-outstanding-service" id="ControlsAddCartBuy">
<li onclick="LoadDataPageFunc.ViewAllStoreDetails();return false;">
<div class="">
<img src="/assets/search.png" style="width: 30; height: 30;" class="icon-user">
</div>More Details
</li>
<li onclick="LoadDataPageFunc.Report();return false;">
<div class="">
<img src="/assets/reportaccount.png" style="width: 30; height: 30;"
class="icon-user">
</div>Report
</li>
@if($current_user->acct_type === UserTypes::ULTIMATE)
<li onclick="LoadDataPageFunc.Edit();return false;">
<div class="">
<img src="/assets/edit.png" style="width: 30; height: 30;" class="icon-user">
</div>Edit
</li>
@endif
</ul>
</div>
</div>
</div>
</a>
</div>
<div class="col-md" style="overflow:hidden;">
<a href="javascript:void(0);" onclick="">
<div class="card ListRowCard" id="ListRowCard-2" style="">
<div class="card-body ListCardRow" id="card-body-ListRowCard-2">
<div style="text-align:center;" id="StoreDescription">
</div>
<h5></h5>
</div>
</div>
</a>
</div>
<div class="col-md" style="overflow:hidden;" id="StoreProductsColumn">
</div>
<div class="col-md" style="overflow:hidden;display: none;" id="ReviewsCard">
<UI type="card" id="ReviewsCard" title="Reviews" tools="no">
</UI>
</div>
</div>
</div>
<script>
LoadDataPageFunc = {};
LoadDataPageFunc.PageTitle = 'Store Details';
LoadDataPageFunc.MainDetailsURL = '';
LoadDataPageFunc.Details = {};
LoadDataPageFunc.Settings = {};
LoadDataPageFunc.Disabled = false;
LoadDataPageFunc.Edit = function () {
gotoPage('EditStoreAdmin', currenttarget);
};
LoadDataPageFunc.ProductsListNewCard = function (object, rownum) {
if (!object || rownum === false || rownum === null || typeof rownum === undefined) {
return '';
}
let hash = object.hashkey || false;
let name = object.name || '';
let price = object.store_price || object.price || '';
let isStorePrice = typeof object.store_price === 'number';
let photo = object.photourl || '';
const unit = object.unitname || '';
if (!hash) { return ''; }
if (typeof photo === 'array' || typeof photo === 'object') {
photo = photo[0];
}
name = trimStringToMaxLength(name, 16, suffix = '');
// price = trimStringToMaxLength(price, 16, suffix = '');
const productColumnSize = '6';
const newcol = function (colinner, colsize = "12", style = '') {
return `<div class="col-${colsize}" style="${style} overflow:hidden; padding-bottom:10px; width: 40vh; height: 40vh; ">${colinner}</div>`;
}
if (isStorePrice) {
isStorePrice = 'Store Price';
} else {
isStorePrice = '';
}
const imgelement = `
<img id="marketplacelistproductphoto-1" src="${photo}" loading="lazy" class="StoreProductsIMGMarket"
style="width: 60%;height: 60%;object-fit: contain;">
`;
/* html */
let finalcontent = imgelement + `<br><div class="row" style=""><div class="col"><h4>${name}</h4></div></div>`;
finalcontent += `<div class="row" style=""><div class="col"><h6>${isStorePrice} P${price} / ${unit}</h6></div></div>`;
const maincolstyle = '';
let target_data = { target: hash, store_hash: currenttarget };
return newcol(`<center onclick='gotoPage("BuyViewProductMarket", ${JSON.stringify(target_data)})'>` + CreateCardSimple(false, finalcontent, 'StoreProductCard-' + rownum, 'width: 100%; height: 100%; object-fit: cover;') + '</center>', productColumnSize, maincolstyle);
}
LoadDataPageFunc.UpdateProductsListCard = function (productslist) {
const isempty = typeof productslist === 'array' || productslist.length === 0;
if (!productslist || isempty) {
$('#card-body-StoreProductsCard').html('<p style="text-align:center;">No Products</p>');
return false;
}
let cardarray = [];
cardarray.push('<div class="row" style="">');
iterateArray(productslist, (data, rownum) => {
cardarray.push(LoadDataPageFunc.ProductsListNewCard(data, rownum));
});
cardarray.push('</div>');
const finalhtml = cardarray.join('');
$('#card-body-StoreProductsCard').html(finalhtml);
LoadPhotoIMGTargetClass('StoreProductsIMGMarket', settodisplaylater = true);
return true;
};
LoadDataPageFunc.PopulateDetailsNow = function (name, description, address, category, subcategory, products) {
$('#StoreNameMarketPlace').html(name);
$('#StoreDescription').html(description);
$('#StoreLocationMarketPlace').html(address);
const StoreProductsColumn = UICardSimple('Products', text = '', id = 'StoreProductsCard');
$('#StoreProductsColumn').html(StoreProductsColumn);
LoadDataPageFunc.UpdateProductsListCard(products);
};
LoadDataPageFunc.ViewPhotosLink = function () {
const datasend = { t: currenttarget, type: LoadDataPageFunc.Settings.Phototype };
ButtonGo('ViewAllPhotos', datasend);
}
LoadDataPageFunc.Settings.Phototype = "StoreMarket";
LoadDataPageFunc.StoreLoadErrorModal = function () {
ModalQuickDismiss(false, 'Store Not Available!', 'UnavailableStoreModal');
}
LoadDataPageFunc.PopulateDetails = function () {
let description;
let photosarray;
let response;
if (!currenttarget) { console.log('currenttarget not found', currenttarget); LoadDataPageFunc.StoreLoadErrorModal(); }
const UpdateDetailsUI = function (response) {
if (!response) {
LoadDataPageFunc.StoreLoadErrorModal();
return false;
}
@if (isset($current_data) && $current_data)
response.photourl = @json($current_data?->photourl ?? []);
@foreach ($current_data?->photourl as $photohash)
@endforeach
@else
Preloaders.ImageList(currenttarget, LoadDataPageFunc.Settings.Phototype);
@endif
LoadPhotosCard('PhotosCard', "LoadDataPageFunc.ViewPhotosLink();", response.photourl);
LoadDataPageFunc.PopulateDetailsNow(response.name, response.description, response.address, response.category, response.subcategory, response.products);
};
@if ($FragmentOnly)
Preloaders.ViewStoreinMarket(currenttarget, true, UpdateDetailsUI);
@else
response = @json($current_data);
UpdateDetailsUI(response);
@endif
};
LoadDataPageFunc.Main = function () {
setDynamicCSS(` .ListRowCard {
margin-bottom: 5px;
}`);
changeTopbarTitle(LoadDataPageFunc.PageTitle);
LoadDataPageFunc.PopulateDetails();
};
LoadDataPageFunc.Main();
</script>

View File

@@ -0,0 +1,92 @@
<script>
defaultBackOnclick = null;
try {
currentData = @json($current_data);
} catch (error) {
currentData = null;
}
InitDataPageFuncOBJ();
LoadDataPageFunc = {};
LoadDataPageFunc.URLs = {};
LoadDataPageFunc.URLs.EditUrl = `{{ route('admin.products.edit', [], false) }}`;
LoadDataPageFunc.URLs.CategoryDatalist = `/Products/New/Category/Datalist`;
LoadDataPageFunc.URLs.SubCategoryDatalist = `/Products/New/SubCategory/Datalist`;
LoadDataPageFunc.URLs.PhotoUpload = `/File/Upload/Product`;
LoadDataPageFunc.PageTitle = 'Edit Product';
LoadDataPageFunc.pageName = 'EditProductAdmin';
LoadDataPageFunc.ids = {};
LoadDataPageFunc.ids.photodropzone = 'EditProductPhotos';
LoadDataPageFunc.formclass = 'EditProductMarket';
LoadDataPageFunc.UpdateSubCategoryDatalistasTyped = function () {
document.getElementById("EditProductCategory").addEventListener("keyup", function (event) {
const inputValue = event.target.value;
const categoryinputvalue = document.getElementById("EditProductCategory").value;
QueryandReplaceDatalist("EditProductSubCategoryDataList",
LoadDataPageFunc.URLs.SubCategoryDatalist,
'POST', { category: categoryinputvalue }, fromvarcache = true,
function (response) {
});
});
};
LoadDataPageFunc.PopulateCategoryDatalist = function () {
QueryandReplaceDatalist("EditProductCategoryDataList",
LoadDataPageFunc.URLs.CategoryDatalist,
'POST', { }, fromvarcache = true,
);
};
FormBuilder.build({
formClass: 'EditProductMarket',
pageName: LoadDataPageFunc.pageName,
submitUrl: '{{ route('admin.products.bystore.edit', [], false) }}',
currentDataUrl: '{{ route('admin.products.bystore.view.data', [], false) }}',
topbartitle: LoadDataPageFunc.PageTitle,
defaultback: {
page: 'ManageProductAdmin',
data: currenttarget,
},
onSuccess: (response) => {
ModalQuickDismiss('Success', 'Product Updated');
},
onError: (err) => {
ModalQuickDismiss('Error', 'Failed to update product.<br>' + err.message);
},
unabletoLoadFunc: function (err) {
ModalQuickDismiss('Error', 'Failed to update product.<br>' + err.message);
},
onFormGenerated: function () {
LoadDataPageFunc.UpdateSubCategoryDatalistasTyped();
LoadDataPageFunc.PopulateCategoryDatalist();
},
fields: [
{ type: 'textarea', id: 'EditProductDescription', label: 'Description', required: true, currentdatavar: 'description' },
{ type: 'text', id: 'EditProductCategory', label: 'Category', placeholder: 'Category', required: true, datalist: 'EditProductCategoryDataList', currentdatavar: 'category' },
{ type: 'text', id: 'EditProductSubCategory', label: 'Subcategory', placeholder: 'Subcategory', required: true, datalist: 'EditProductSubCategoryDataList', currentdatavar: 'subcategory' },
{ type: 'number', id: 'EditProductPrice', placeholder: '260', label: 'Price (PHP)', required: true, currentdatavar: 'price' },
{ type: 'text', id: 'EditProductUnitName', label: 'Unit', placeholder: 'ex 25kg', required: true, currentdatavar: 'unitname' },
// { type: 'number', id: 'EditProductAvailable',placeholder:'ex. 999', label: 'Available Stock', required: true, currentdatavar: 'available' },
{ type: 'text', id: 'EditProductBarcode', label: 'Barcode', placeholder: '12-digit number', maxlength: 12, pattern: '[0-9]*', currentdatavar: 'barcode' },
{ type: 'dropzone', id: LoadDataPageFunc.ids.photodropzone, label: 'Photo', uploadUrl: LoadDataPageFunc.URLs.PhotoUpload, currentdatavar: 'photourlDropzone' },
{ type: 'button', label: 'Submit', onClick: 'FormBuilder.submit()' },
]
});
</script>

View File

@@ -0,0 +1,69 @@
<script>
defaultBackOnclick = null;
try {
currentData = @json($current_data);
} catch (error) {
currentData = null;
}
InitDataPageFuncOBJ();
LoadDataPageFunc = {};
LoadDataPageFunc.URLs = {};
LoadDataPageFunc.URLs.EditUrl = `{{ route('admin.products.addtostore', [], false) }}`;
LoadDataPageFunc.URLs.CategoryDatalist = `/Products/New/Category/Datalist`;
LoadDataPageFunc.URLs.SubCategoryDatalist = `/Products/New/SubCategory/Datalist`;
LoadDataPageFunc.URLs.PhotoUpload = `/File/Upload/Product`;
LoadDataPageFunc.PageTitle = 'Add Product to Store';
LoadDataPageFunc.pageName = 'AddProducttoStoreAdmin';
LoadDataPageFunc.ids = {};
LoadDataPageFunc.ids.photodropzone = 'EditProductPhotos';
FormBuilder.build({
formClass: 'AddProducttoStoreAdmin',
pageName: LoadDataPageFunc.pageName,
submitUrl: LoadDataPageFunc.URLs.EditUrl,
currentDataUrl: '{{ route('admin.products.view.data.addstore', [], false) }}',
topbartitle: LoadDataPageFunc.PageTitle,
defaultback: {
page: 'ManageProductAdmin',
data: currenttarget,
},
onSuccess: (response) => {
ModalQuickDismissGoto('Success', 'Product Added to Store', ['ManageProductAdmin', 'Go Back',currenttarget]);
Preloaders.ViewStoreinMarket($('#TargetStore').val());
},
onError: (err) => {
ModalQuickDismiss('Error', 'Failed to Add Product to Store.<br>' + err.message);
},
unabletoLoadFunc: function (res) {
console.log(res);
ModalQuickDismiss('Error', 'Failed to Add Product to Store.<br>' + err.message);
},
onFormGenerated: function () {
// LoadDataPageFunc.UpdateSubCategoryDatalistasTyped();
// LoadDataPageFunc.PopulateCategoryDatalist();
},
fields: [
{ type: 'select', id: 'TargetStore', label: 'Store Name', currentdatavar: 'store_options', required: true, },
{ type: 'text', id: 'EditProductName', label: 'Name', placeholder: 'Product Name', required: true, currentdatavar: 'name', disabled: true },
// { type: 'textarea', id: 'EditProductDescription', label: 'Description', required: true, currentdatavar: 'description' },
// { type: 'text', id: 'EditProductCategory', label: 'Category', placeholder: 'Category', required: true, datalist: 'EditProductCategoryDataList', currentdatavar: 'category' },
// { type: 'text', id: 'EditProductSubCategory', label: 'Subcategory', placeholder: 'Subcategory', required: true, datalist: 'EditProductSubCategoryDataList', currentdatavar: 'subcategory' },
{ type: 'number', id: 'EditProductPrice', placeholder: '260', label: 'Price (PHP)', required: true, currentdatavar: 'price', disabled: true },
{ type: 'text', id: 'EditProductUnitName', label: 'Unit', placeholder: 'ex 25kg', required: true, currentdatavar: 'unitname', disabled: true },
// { type: 'number', id: 'EditProductAvailable',placeholder:'ex. 999', label: 'Available Stock', required: true, currentdatavar: 'available' },
{ type: 'text', id: 'EditProductBarcode', label: 'Barcode', placeholder: '12-digit number', maxlength: 12, pattern: '[0-9]*', currentdatavar: 'barcode', disabled: true },
{ type: 'dropzone', id: LoadDataPageFunc.ids.photodropzone, label: 'Photo', uploadUrl: LoadDataPageFunc.URLs.PhotoUpload, currentdatavar: 'photourlDropzone', disabled: true },
{ type: 'button', label: 'Submit', onClick: 'FormBuilder.submit()' },
]
});
</script>

View File

@@ -0,0 +1,113 @@
<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>

View File

@@ -0,0 +1,138 @@
<style>
.ListRowCard {
margin-bottom: 5px;
}
</style>
<div id="MainView">
</div>
<script>
defaultBackOnclick = null;
try {
currentData = @json($current_data);
} catch (error) {
currentData = null;
}
LoadDataPageFunc = {};
LoadDataPageFunc.PageTitle = 'Manage Product';
LoadDataPageFunc.pageName = 'ManageProductAdmin';
LoadDataPageFunc.MainDetailsURL = '';
LoadDataPageFunc.Details = {};
LoadDataPageFunc.Settings = {};
LoadDataPageFunc.Disabled = false;
LoadDataPageFunc.RemoveProductfromCurrentStore = () => {
const urllink = `{{ route('store.product.remove') }}/`;
const datatosend = {
'store_hash': currenttarget['store_hash'],
'product_hash': currenttarget['target'],
};
SendPostDataURLData(urllink, datatosend, (response) => {
if (response.success) {
ModalQuickDismiss('Success', 'Product Removed from Store.');
Preloaders.ViewStoreinMarket(currenttarget['store_hash'], false, () => {
//TODO Fix error here
gotoPage('ViewStoreMarket', currenttarget['store_hash']);
});
}
});
};
LoadDataPageFunc.Settings.Phototype = "ProductMarket";
Buttons = [
{ icon: '/assets/products.png', label: 'View Product', onclick: "gotoPage('BuyViewProductMarket',currenttarget);return false;" },
{ icon: '/assets/edit.png', label: 'Edit Product', onclick: "gotoPage('EditProductAdmin',currenttarget);return false;" },
{ icon: '/assets/plus-cart.png', label: 'Add to Store', onclick: "gotoPage('AddProducttoStoreAdmin',currenttarget);return false;" },
{ icon: '/assets/minus-cart.png', label: 'Remove from Store', onclick: "gotoPage('RemoveProductfromStoreAdmin',currenttarget);return false;" },
];
LoadDataPageFunc.Main = function () {
ViewBuilder.build({
dataurl: '/View/Product/Details/data',
pageName: 'ManageProductAdmin',
topbartitle: 'Manage Product',
defaultback: {
page: 'BuyViewProductMarket',
data: currenttarget,
},
initialize: (response) => {
if (typeof response.is_from_store !== 'undefined' && response.is_from_store) {
Buttons.push(
{ icon: '/assets/edit.png', label: 'Edit Product By Store', onclick: "gotoPage('EditProductStoreData',currenttarget);return false;" },
// { icon: '/assets/plus-cart.png', label: 'Add to Store', onclick: "gotoPage('AddProducttoCurrentStore',currenttarget);return false;" }, d
{ icon: '/assets/minus-cart.png', label: 'Remove from Current Store', onclick: "LoadDataPageFunc.RemoveProductfromCurrentStore();return false;" },
);
}
},
sections: [
{
phototype: 'ProductMarket',
type: 'photos',
id: 'PhotosCard',
currentdatavar: 'photourl'
},
{
type: 'details',
data: [
{
h: 3,
bold: true,
type: 'text',
currentdatavar: 'name'
},
{
type: 'text',
// currentdatavar: 'price',
func: function () {
return 'P' + currentData.price + ' / ' + currentData.unitname;
},
}
]
// title: ProductData.name,
// description: ProductData.description,
// price: ProductData.price,
// unit: ProductData.unitname,
},
{
type: 'buttons',
buttons: Buttons
},
{
type: 'card',
id: 'DescriptionCard',
hidden: false,
currentdatavar: 'description',
},
]
});
};
LoadDataPageFunc.Main();
</script>

View File

@@ -0,0 +1,69 @@
<script>
defaultBackOnclick = null;
try {
currentData = @json($current_data);
} catch (error) {
currentData = null;
}
InitDataPageFuncOBJ();
LoadDataPageFunc = {};
LoadDataPageFunc.URLs = {};
LoadDataPageFunc.URLs.EditUrl = `{{ route('admin.products.removefromstore', [], false) }}`;
LoadDataPageFunc.URLs.CategoryDatalist = `/Products/New/Category/Datalist`;
LoadDataPageFunc.URLs.SubCategoryDatalist = `/Products/New/SubCategory/Datalist`;
LoadDataPageFunc.URLs.PhotoUpload = `/File/Upload/Product`;
LoadDataPageFunc.PageTitle = 'Remove Product from Store';
LoadDataPageFunc.pageName = 'RemoveProductfromStoreAdmin';
LoadDataPageFunc.ids = {};
LoadDataPageFunc.ids.photodropzone = 'EditProductPhotos';
FormBuilder.build({
formClass: 'RemoveProductfromStoreAdmin',
pageName: LoadDataPageFunc.pageName,
submitUrl: LoadDataPageFunc.URLs.EditUrl,
currentDataUrl: '{{ route('admin.products.view.data.addstore', [], false) }}',
topbartitle: LoadDataPageFunc.PageTitle,
defaultback: {
page: 'ManageProductAdmin',
data: currenttarget,
},
onSuccess: (response) => {
ModalQuickDismissGoto('Success', 'Product Removed from Store', ['ManageProductAdmin', 'Go Back', currenttarget]);
Preloaders.ViewStoreinMarket($('#TargetStore').val());
},
onError: (err) => {
ModalQuickDismiss('Error', 'Failed to Remove Product from Store.<br>' + err.message);
},
unabletoLoadFunc: function (res) {
console.log(res);
ModalQuickDismiss('Error', 'Failed to Remove Product from Store.<br>' + err.message);
},
onFormGenerated: function () {
// LoadDataPageFunc.UpdateSubCategoryDatalistasTyped();
// LoadDataPageFunc.PopulateCategoryDatalist();
},
fields: [
{ type: 'select', id: 'TargetStore', label: 'Store Name', currentdatavar: 'store_options', required: true, },
{ type: 'text', id: 'EditProductName', label: 'Name', placeholder: 'Product Name', required: true, currentdatavar: 'name', disabled: true },
// { type: 'textarea', id: 'EditProductDescription', label: 'Description', required: true, currentdatavar: 'description' },
// { type: 'text', id: 'EditProductCategory', label: 'Category', placeholder: 'Category', required: true, datalist: 'EditProductCategoryDataList', currentdatavar: 'category' },
// { type: 'text', id: 'EditProductSubCategory', label: 'Subcategory', placeholder: 'Subcategory', required: true, datalist: 'EditProductSubCategoryDataList', currentdatavar: 'subcategory' },
{ type: 'number', id: 'EditProductPrice', placeholder: '260', label: 'Price (PHP)', required: true, currentdatavar: 'price', disabled: true },
{ type: 'text', id: 'EditProductUnitName', label: 'Unit', placeholder: 'ex 25kg', required: true, currentdatavar: 'unitname', disabled: true },
// { type: 'number', id: 'EditProductAvailable',placeholder:'ex. 999', label: 'Available Stock', required: true, currentdatavar: 'available' },
{ type: 'text', id: 'EditProductBarcode', label: 'Barcode', placeholder: '12-digit number', maxlength: 12, pattern: '[0-9]*', currentdatavar: 'barcode', disabled: true },
{ type: 'dropzone', id: LoadDataPageFunc.ids.photodropzone, label: 'Photo', uploadUrl: LoadDataPageFunc.URLs.PhotoUpload, currentdatavar: 'photourlDropzone', disabled: true },
{ type: 'button', label: 'Submit', onClick: 'FormBuilder.submit()' },
]
});
</script>

View File

@@ -0,0 +1,151 @@
<div id="NewProductForm">
</div>
<script>
InitDataPageFuncOBJ();
LoadDataPageFunc = {};
LoadDataPageFunc.URLs = {};
LoadDataPageFunc.URLs.NewUrl = `{{ route('admin.products.new',[],false) }}`;
LoadDataPageFunc.URLs.CategoryDatalist = `/Products/New/Category/Datalist`;
LoadDataPageFunc.URLs.SubCategoryDatalist = `/Products/New/SubCategory/Datalist`;
LoadDataPageFunc.URLs.PhotoUpload = `/File/Upload/Product`;
LoadDataPageFunc.PageTitle = 'New Product';
LoadDataPageFunc.ids = {};
LoadDataPageFunc.ids.photodropzone = 'NewProductPhotos';
LoadDataPageFunc.formclass = 'NewProductMarket';
LoadDataPageFunc.UpdateSubCategoryDatalistasTyped = function () {
document.getElementById("NewProductCategory").addEventListener("change", function (event) {
const inputValue = event.target.value;
const categoryinputvalue = document.getElementById("NewProductCategory").value;
QueryandReplaceDatalist("NewProductSubCategoryDataList",
LoadDataPageFunc.URLs.SubCategoryDatalist,
'POST', { category: categoryinputvalue }, fromvarcache = true,
function (response) {
});
});
};
LoadDataPageFunc.LoadUI = function () {
let finalhtml = '';
const formclass = LoadDataPageFunc.formclass;
const textbox = function (placeholder, label, idsuffix, required = false, datalist = '') {
return UIInputGroup(placeholder, 'text', 'New' + idsuffix, label, formclass, spanclass = '', imginsteadofspan = '', required, textvalue = '', datalist, imgwidth = '', imgheight = '');
};
const name = textbox('Product Name', 'Name', 'ProductName', true);
const description = UIInputGroupTEXTAREA(label = 'Description', 'NewProductDescription', required = true, textareacontent = '', formclass);
const category = textbox('Product Category', 'Category', 'ProductCategory', true, 'NewProductCategoryDataList');
const categorydatalistData = @json((new App\Http\Controllers\Market\ProductController)->getCategories(false))
const categorydatalist = ArraytoDatalist("NewProductCategoryDataList", categorydatalistData, false) || '';
const subcategory = textbox('Product Subcategory', 'Subcategory', 'ProductSubCategory', true, 'NewProductSubCategoryDataList');
const subcategorydatalist = ArraytoDatalist("NewProductSubCategoryDataList", [], false) || '';
const photoscontainer = UIInputGroupFileUploadDropzone(LoadDataPageFunc.ids.photodropzone, label = 'Photo', LoadDataPageFunc.URLs.PhotoUpload);
const price = UIInputGroupNumber('Price in Philippine Pesos', 'NewProductPrice', 'Price', formclass, 1, max = '', spanclass = '', imginsteadofspan = '', required = true, val = 1, datalist = '', imgwidth = '', imgheight = '');
const unit = textbox('ex 25kg', 'Unit', 'ProductUnitName', true);
const available = UIInputGroupNumber('Available Stock', 'NewProductAvailable', 'No of Stock', formclass, 1, max = '', spanclass = '', imginsteadofspan = '', required = true, val = 1, datalist = '', imgwidth = '', imgheight = '');
let barcode = textbox('12 Digits Barcode Number', 'Barcode', 'ProductBarcode', false);
barcode = $('<div>' + barcode + '</div>');
barcodeinput = barcode.find('input');
barcodeinput.attr('maxlength', 12).attr('pattern', '[0-9]*').on('input', function () {
this.value = this.value.replace(/[^0-9]/g, '');
});
barcode = barcode.html();
const submitbutton = UIInputGroupButton('Submit', formclass, buttonid = '', onclick = 'LoadDataPageFunc.TryToSubmit();', buttonstyle = '');
finalhtml = name + description + category + categorydatalist + subcategory + subcategorydatalist + photoscontainer + price + unit + available + barcode + submitbutton;
finalhtml = CreateCardSimple(false, finalhtml);
document.getElementById('NewProductForm').innerHTML = finalhtml;
QueryandReplaceDatalist("NewProductCategoryDataList", LoadDataPageFunc.URLs.CategoryDatalist, 'POST', datatosend = null, fromvarcache = true);
QueryandReplaceDatalist("NewProductSubCategoryDataList", LoadDataPageFunc.URLs.SubCategoryDatalist, 'POST', datatosend = null, fromvarcache = true);
InitializeLoadDataPageFuncDropZonePhotoUpload(LoadDataPageFunc.URLs.PhotoUpload, LoadDataPageFunc.ids.photodropzone, ShowClearPhotoFUNC = '', clearphotosbuttonid = 'clearuploadbutton', acceptedfiles = '', maxsizeMB = 100);
LoadDataPageFunc.InitializePhotoDropZone();
LoadDataPageFunc.UpdateSubCategoryDatalistasTyped();
};
LoadDataPageFunc.TryToSubmit = function () {
const errorModal = function (errorstring = '') {
ModalQuickDismiss('Error', 'Unable Submit To New Product. <br>' + errorstring, modalid = '', modaltohide = '', functiontodo = '', conditiontrue = true, modalfooter = '');
};
const successModal = function () {
hideallmodals();
ModalQuickDismiss('Success', 'New Product Submitted');
};
const submitsuccess = function (response) {
getResponseHashkeyOrErrorMessage(response, function (hashkey) {
Preloaders.ViewProductinMarket(hashkey);
successModal();
gotoPage('BuyViewProductMarket', hashkey);
return true;
}, errorModal);
};
SendPostDataFormwithTARGETUPLOADEDFILES(LoadDataPageFunc.URLs.NewUrl, LoadDataPageFunc.formclass, submitsuccess);
};
LoadDataPageFunc.ValidateForm = function () {
let inputsArray = getInputElementsValuesObjectbyCSSClassname(LoadDataPageFunc.formclass);
if (isObjectEmpty(inputsArray)) { return false; }
const isAnyoftheRequiredEmpty = !inputsArray['NewProductName'] || !inputsArray['NewProductDescription'] || !inputsArray['NewProductCategory'] || !inputsArray['NewProductSubCategory'] ||
!inputsArray['NewProductPrice'] || !inputsArray['NewProductAvailable'] || !inputsArray['NewProductUnitName'] || Target_Uploaded_Files.length === 0;
const isBarcodeNumeric = inputsArray['NewProductBarcode'] && isNumeric(inputsArray['NewProductBarcode']);
if (isAnyoftheRequiredEmpty || isBarcodeNumeric === false) {
return false;
}
const IsBarcodeValid = IsStringBarcode12Digits(inputsArray['NewProductBarcode']);
return true;
};
LoadDataPageFunc.Main = function () {
// if (!currenttarget || currenttarget === '0') {
// const modalbody = 'Unable to Load Store Details.';
// const modalfooter = buttonGOTOPage('Home', 'Home', 0, '', 'hideallmodals();');;
// ModalQuickDismiss(false, modalbody, modalid = '', modaltohide = '', functiontodo = '', conditiontrue = true, modalfooter);
// Backkey();
// return false;
// }
LoadDataPageFunc.LoadUI();
changeTopbarTitle(LoadDataPageFunc.PageTitle);
};
LoadDataPageFunc.Main();
</script>

View File

@@ -0,0 +1,177 @@
<div id="NewStoreForm">
</div>
<script>
InitDataPageFuncOBJ();
LoadDataPageFunc = {};
LoadDataPageFunc.URLs = {};
LoadDataPageFunc.URLs.NewUrl = `/Store/New`;
LoadDataPageFunc.URLs.CategoryDatalist = `/Store/New/Category/Datalist`;
// LoadDataPageFunc.URLs.SubCategoryDatalist = `/Products/New/SubCategory/Datalist`;
LoadDataPageFunc.URLs.PhotoUpload = `/File/Upload/Store`;
LoadDataPageFunc.PageTitle = 'New Store';
LoadDataPageFunc.ids = {};
LoadDataPageFunc.ids.photodropzone = 'NewStorePhotos';
LoadDataPageFunc.formclass = 'NewStoreMarket';
// LoadDataPageFunc.UpdateSubCategoryDatalistasTyped = function () {
// document.getElementById("NewProductCategory").addEventListener("keyup", function (event) {
// const inputValue = event.target.value;
// const categoryinputvalue = document.getElementById("NewProductCategory").value;
// QueryandReplaceDatalist("NewProductSubCategoryDataList", LoadDataPageFunc.URLs.SubCategoryDatalist, 'POST', {category:categoryinputvalue}, fromvarcache = true);
// });
// };
LoadDataPageFunc.LoadUI = function () {
let finalhtml = '';
const formclass = LoadDataPageFunc.formclass;
const textbox = function (placeholder, label, id, required = false, datalist = '') {
return UIInputGroup(placeholder, 'text', id, label, formclass, spanclass = '', imginsteadofspan = '', required, textvalue = '', datalist, imgwidth = '', imgheight = '');
};
const name = textbox('Store Name', 'Name', 'name', true);
const description = UIInputGroupTEXTAREA(label = 'Description', 'description', required = true, textareacontent = '', formclass);
const category = textbox('Product Category', 'Category', 'category', true, 'NewStoreCategoryDataList');
const address = UIInputGroupTEXTAREA(label = 'Address', 'address', required = true, textareacontent = '', formclass);
const categorydatalist = ArraytoDatalist("NewStoreCategoryDataList", [], false) || '';
// const subcategory = textbox('Product Subcategory', 'Subcategory', 'ProductSubCategory', true, 'NewProductSubCategoryDataList');
// const subcategorydatalist = ArraytoDatalist("NewProductSubCategoryDataList", [], false) || '';
const photoscontainer = UIInputGroupFileUploadDropzone(LoadDataPageFunc.ids.photodropzone, label = 'Photo', LoadDataPageFunc.URLs.PhotoUpload);
// const price = UIInputGroupNumber('Price in Philippine Pesos', 'NewProductPrice', 'Price', formclass, 1, max = '', spanclass = '', imginsteadofspan = '', required = true, val = 1, datalist = '', imgwidth = '', imgheight = '');
// const unit = textbox('ex 25kg', 'Unit', 'ProductUnitName', true);
// const available = UIInputGroupNumber('Available Stock', 'NewProductAvailable', 'No of Stock', formclass, 1, max = '', spanclass = '', imginsteadofspan = '', required = true, val = 1, datalist = '', imgwidth = '', imgheight = '');
// let barcode = textbox('12 Digits Barcode Number', 'Barcode', 'ProductBarcode', false);
// barcode = $('<div>' + barcode + '</div>');
// barcodeinput = barcode.find('input');
// barcodeinput.attr('maxlength', 12).attr('pattern', '[0-9]*').on('input', function () {
// this.value = this.value.replace(/[^0-9]/g, '');
// });
// barcode = barcode.html();
const storeOwner = UIInputGroupSelect('owner', label = 'Store Owner', [['', 'Select User']], spanclass = '', imginsteadofspan = '', 0,'','',formclass);
//TODO Add Support for storeManager and Cashier multiple accounts support
const submitbutton = UIInputGroupButton('Submit', formclass, buttonid = '', onclick = 'LoadDataPageFunc.TryToSubmit();', buttonstyle = '');
// const selectFromUser = ` <div class="input-group mb-3" id="store_owner" style="">
// <select class="form-control" id="storeOwner">
// </select>
// </div>`;
finalhtml = name + description + category + categorydatalist + address + photoscontainer + storeOwner + submitbutton;
finalhtml = CreateCardSimple(false, finalhtml);
document.getElementById('NewStoreForm').innerHTML = finalhtml;
// QueryandReplaceDatalist("NewProductCategoryDataList", LoadDataPageFunc.URLs.CategoryDatalist, 'POST', datatosend = null, fromvarcache = true);
// QueryandReplaceDatalist("NewProductSubCategoryDataList", LoadDataPageFunc.URLs.SubCategoryDatalist, 'POST', datatosend = null, fromvarcache = true);
InitializeLoadDataPageFuncDropZonePhotoUpload(LoadDataPageFunc.URLs.PhotoUpload, LoadDataPageFunc.ids.photodropzone, ShowClearPhotoFUNC = '', clearphotosbuttonid = 'clearuploadbutton', acceptedfiles = '', maxsizeMB = 100);
LoadDataPageFunc.InitializePhotoDropZone();
// LoadDataPageFunc.UpdateSubCategoryDatalistasTyped();
QueryandReplaceDatalist("NewStoreCategoryDataList", LoadDataPageFunc.URLs.CategoryDatalist, 'POST', null, fromvarcache = true);
};
LoadDataPageFunc.RepopulateStoreOwnerList = function () {
function UpdateSelectParentList(response) {
const selectElement = $("#owner");
response.forEach(element => {
$("<option></option>")
.val(element.hashkey)
.text(`${element.name} (${element.mobile_number}) [${element.username}] ${element.fullname ?? ''}`)
.appendTo(selectElement);
});
}
AjaxDo('/admin/user/list/numbers/hash', {}, UpdateSelectParentList, null, reqtype = 'POST');
};
LoadDataPageFunc.TryToSubmit = function () {
const currentformdata = LoadDataPageFunc.ValidateForm();
if (!currentformdata) {
ModalQuickDismiss('Error', 'Name, Description, Category and Address are required fields.', modalid = '', modaltohide = '', functiontodo = '', conditiontrue = true, modalfooter = '');
return false;
}
const errorModal = function (errorstring = '') {
ModalQuickDismiss('Error', 'Unable Submit To New Store. <br>' + errorstring, modalid = '', modaltohide = '', functiontodo = '', conditiontrue = true, modalfooter = '');
};
const successModal = function () {
hideallmodals();
ModalQuickDismiss('Success', 'New Store Created');
};
const submitsuccess = function (response) {
responseOk = isResponseAHash(response);
if (!responseOk) {
errorModal(response);
return false;
}
if (responseOk) {
// Preloaders.ViewProductinMarket(response);
successModal();
gotoPage('ViewStoreMarket', response);
return true;
}
};
SendPostDataFormwithTARGETUPLOADEDFILES(LoadDataPageFunc.URLs.NewUrl, LoadDataPageFunc.formclass, submitsuccess);
};
LoadDataPageFunc.ValidateForm = function () {
return validateInputForm(['name', 'description', 'address', 'category']);
const isAnyoftheRequiredEmpty = !inputsArray['NewProductName'] || !inputsArray['NewProductDescription'] || !inputsArray['NewProductCategory'] || !inputsArray['NewProductSubCategory'] ||
!inputsArray['NewProductPrice'] || !inputsArray['NewProductAvailable'] || !inputsArray['NewProductUnitName'] || Target_Uploaded_Files.length === 0;
if (isAnyoftheRequiredEmpty || isBarcodeNumeric === false) {
return false;
}
const IsBarcodeValid = IsStringBarcode12Digits(inputsArray['NewProductBarcode']);
return true;
};
LoadDataPageFunc.Main = function () {
LoadDataPageFunc.LoadUI();
LoadDataPageFunc.RepopulateStoreOwnerList();
changeTopbarTitle(LoadDataPageFunc.PageTitle);
};
LoadDataPageFunc.Main();
</script>

View File

@@ -0,0 +1,344 @@
<br><br>
<div class="card" id="secondary-card">
<div class="card-header ui-sortable-handle" style="cursor: move; display: none;">
<h3 class="card-title"></h3>
<div class="card-tools"></div>
</div>
<div class="card-body">
<div class="row card-body d-flex align-items-center w-100">
<div class="input-group mb-3">
<input type="number" id="usernumber" class="form-control createuserinputfield"
placeholder="Mobile Number" name="usernumber">
</div>
<div class="input-group mb-3" style="" id="user-create-nickname-input-group">
<input type="text" id="nickname" class="form-control createuserinputfield" placeholder="Nick Name"
name="nickname">
</div>
<div class="input-group mb-3" style="" id="user-create-name-input-group">
<input type="text" id="name" class="form-control createuserinputfield" placeholder="Name" name="name">
</div>
<div class="input-group mb-3" style="" id="user-create-username-input-group">
<input type="text" id="username" class="form-control createuserinputfield" placeholder="Username" name="username">
</div>
<div class="input-group mb-3" style="" id="user-create-fullname-input-group">
<input type="text" id="fullname" class="form-control createuserinputfield" placeholder="Fullname" name="fullname">
</div>
<div class="input-group mb-3" id="usertypecontrol" style="">
<select class="form-control" id="usertype">
</select>
</div>
<div class="input-group mb-3" id="userparentcontrol" style="">
<select class="form-control" id="userparent">
</select>
</div>
<div class="input-group mb-3">
<input type="password" class="form-control createuserinputfield" placeholder="Password"
id="userpassword" name="userpassword">
</div>
<div class="input-group mb-3">
<input type="password" class="form-control createuserinputfield" placeholder="ConfirmPassword"
id="userpasswordconfirm" name="userpasswordconfirm">
</div>
<div class="input-group mb-3">
<button class="form-control btn-primary" id="RegisterNowButton" onclick="RegisterConfirmationPrompt();"
style="display:none;">Register Now</button>
</div>
</div>
</div>
</div>
<script>
var usernumberallowed = false;
var usernicknameallowed = false;
var normalpasswordallowed = false;
var confirmpasswordallowed = false;
window.hasValidMobileNumberFormat = function hasValidFormat(usernumber) {
const pattern = /^09\d{9}$/;
return pattern.test(usernumber);
}
function VerifyInitialPassword() {
const userPassword = document.getElementById("userpassword").value;
if (userPassword.length < 6) {
changeSpantoInvalid('user-password');
normalpasswordallowed = false;
return false;
}
changeSpantoValid('user-password');
normalpasswordallowed = true;
return true;
}
function VerifyConfirmPassword() {
const userPassword = document.getElementById("userpassword").value;
const userPasswordConfirm = document.getElementById("userpasswordconfirm").value;
if (userPassword.length < 6 || userPasswordConfirm.length < 6) {
changeSpantoInvalid('user-password-confirm');
confirmpasswordallowed = false;
return false;
}
if (userPassword !== userPasswordConfirm) {
changeSpantoInvalid('user-password-confirm');
confirmpasswordallowed = false;
return false;
}
changeSpantoValid('user-password-confirm');
changeSpantoValid('user-password');
confirmpasswordallowed = true;
return true;
}
function changeSpantoInvalid(idtext) {
$("#" + idtext + "-span").attr("class", "fas fa-times-circle");
$("#" + idtext + "-input-group-text").attr("class", "input-group-text bg-danger");
}
function changeSpantoValid(idtext) {
$("#" + idtext + "-span").attr("class", "fas fa-check");
$("#" + idtext + "-input-group-text").attr("class", "input-group-text bg-primary");
}
function checkifUserExists() {
let usernumber = $('#usernumber').val();
if (!window.hasValidMobileNumberFormat(usernumber)) {
changeSpantoInvalid('mobile-number');
usernumberallowed = false;
return false;
}
function CheckUser(response) {
if (response.exists === true) {
changeSpantoInvalid('mobile-number');
usernumberallowed = false;
return false;
} else if (response.exists === false) {
changeSpantoValid('mobile-number');
usernumberallowed = true;
return true;
}
}
AjaxDo('/admin/user/number/exists', {
mobile_number: usernumber
}, CheckUser, null, reqtype = 'POST');
}
function checkifUsernameExists() {
let username = $('#username').val();
if (username === '') {
changeSpantoValid('username');
usernicknameallowed = true;
SRegistrationValidateALLinputs();
return;
}
function CheckUsername(response) {
if (response.exists === true) {
changeSpantoInvalid('nick-name');
usernicknameallowed = false;
SRegistrationValidateALLinputs();
return false;
} else if (response.exists === false) {
changeSpantoValid('nick-name');
usernicknameallowed = true;
SRegistrationValidateALLinputs();
return true;
}
}
AjaxDo('/admin/user/username/exists', {
username: username
}, CheckUsername, null, reqtype = 'POST');
}
function SRegistrationValidateALLinputs() {
if (usernumberallowed && normalpasswordallowed && confirmpasswordallowed && usernicknameallowed) {
$('#RegisterNowButton').show();
return true;
} else {
$('#RegisterNowButton').hide();
return false;
}
}
function RegisterConfirmationPrompt() {
let modalid = "CreateUserConfirmationDialog";
let modaltitle = 'Create New User?';
let modalbody = 'Are you sure you want to Create a New User?';
let modalfooter = `<button type="button" class="btn btn-warning" data-dismiss="modal">Cancel</button>
<button type="button" class="btn btn-danger" onclick="SregisterNow()" id="request-credit-now">Continue</button>`;
CreateAndShowModal(modalid, modaltitle, modalbody, modalfooter, modalfooterclose = false, topclosebutton = true, modalbodyclass = 'modal-body', modalheaderclass = 'modal-header');
}
function UserRegistrationSuccessModal(userhashkey) {
let modalid = "CreateUserSuccessModal";
let modaltitle = 'Success';
let modalbody = 'User Created Successfully';
let modalfooter = `<button type="button" class="btn btn-primary" onclick="$('#CreateUserSuccessModal').modal('hide');ButtonGo('user_list',0);" id="request-credit-now">Ok</button>`;
CreateAndShowModal(modalid, modaltitle, modalbody, modalfooter, modalfooterclose = false, topclosebutton = true, modalbodyclass = 'modal-body', modalheaderclass = 'modal-header');
}
function UserRegistrationFailedModal() {
let modalid = "CreateUserFailedModal";
let modaltitle = 'Failed';
let modalbody = 'Error Creating User. User was not created.';
let modalfooter = `<button type="button" class="btn btn-warning" data-dismiss="modal">Ok</button>`;
CreateAndShowModal(modalid, modaltitle, modalbody, modalfooter, modalfooterclose = false, topclosebutton = true, modalbodyclass = 'modal-body', modalheaderclass = 'modal-header');
}
function UserRegistrationFailedModalErrorMessage(Message) {
let modalid = "CreateUserFailedModalErrorMessage";
let modaltitle = 'Failed';
let modalbody = Message;
let modalfooter = `<button type="button" class="btn btn-warning" data-dismiss="modal">Ok</button>`;
CreateAndShowModal(modalid, modaltitle, modalbody, modalfooter, modalfooterclose = false, topclosebutton = true, modalbodyclass = 'modal-body', modalheaderclass = 'modal-header');
}
function RePopulateParentList() {
function UpdateSelectParentList(response) {
const selectElement = $("#userparent");
response.forEach(element => {
$("<option></option>")
.val(element.hashkey)
.text(`${element.name} (${element.mobile_number}) [${element.username}] ${element.fullname ?? ''}`)
.appendTo(selectElement);
});
}
AjaxDo('/admin/user/list/numbers/hash', {}, UpdateSelectParentList, null, reqtype = 'POST');
}
function RePopulateUserTypeCreateUser() {
function UpdateSelectUserTypeList(response) {
const selectElement = $("#usertype"); // Select the element using jQuery
selectElement.html('');
response.forEach(element => {
$("<option></option>")
.val(element[0])
.text(element[1])
.appendTo(selectElement); // Create and append option with values
});
}
AjaxDo('/admin/list/usertype/create', {}, UpdateSelectUserTypeList, null, reqtype = 'POST');
}
function SregisterNow() {
$('#CreateUserConfirmationDialog').modal('hide');
function RegisterNow(response) {
console.log(response);
if (typeof response.success !=='undefined' &&
response.success) {
UserRegistrationSuccessModal(response.hashkey);
} else if (response === false) {
UserRegistrationFailedModal();
}
}
AjaxDo('/admin/user/create', {
mobile_number: $("#usernumber").val(),
password: $("#userpassword").val(),
nickname: $("#nickname").val(),
type: $("#usertype").val(),
parent: $("#userparent").val(),
fullname: $("#fullname").val(),
name: $("#name").val(),
username: $("#username").val(),
}, RegisterNow, null, reqtype = 'POST');
}
$('#usernumber').keyup(function () {
checkifUserExists();
SRegistrationValidateALLinputs();
});
$('#username').keyup(function () {
checkifUsernameExists();
});
$('#userpassword').keyup(function () {
VerifyInitialPassword();
SRegistrationValidateALLinputs();
});
$('#userpasswordconfirm').keyup(function () {
VerifyConfirmPassword();
SRegistrationValidateALLinputs();
});
$('.createuserinputfield').keyup(function () {
SRegistrationValidateALLinputs();
});
RePopulateUserTypeCreateUser();
RePopulateParentList();
</script>

View File

@@ -0,0 +1,92 @@
<script>
defaultBackOnclick = null;
try {
currentData = @json($current_data);
} catch (error) {
currentData = null;
}
InitDataPageFuncOBJ();
LoadDataPageFunc = {};
LoadDataPageFunc.URLs = {};
LoadDataPageFunc.URLs.EditUrl = `{{ route('admin.products.edit', [], false) }}`;
LoadDataPageFunc.URLs.CategoryDatalist = `/Products/New/Category/Datalist`;
LoadDataPageFunc.URLs.SubCategoryDatalist = `/Products/New/SubCategory/Datalist`;
LoadDataPageFunc.URLs.PhotoUpload = `/File/Upload/Product`;
LoadDataPageFunc.PageTitle = 'Edit Product';
LoadDataPageFunc.pageName = 'EditProductAdmin';
LoadDataPageFunc.ids = {};
LoadDataPageFunc.ids.photodropzone = 'EditProductPhotos';
LoadDataPageFunc.formclass = 'EditProductMarket';
LoadDataPageFunc.UpdateSubCategoryDatalistasTyped = function () {
document.getElementById("EditProductCategory").addEventListener("keyup", function (event) {
console.log('hey'); // the even does not seem to fire
const inputValue = event.target.value;
const categoryinputvalue = document.getElementById("EditProductCategory").value;
QueryandReplaceDatalist("EditProductSubCategoryDataList",
LoadDataPageFunc.URLs.SubCategoryDatalist,
'POST', { category: categoryinputvalue }, fromvarcache = true,
function (response) {
});
});
};
LoadDataPageFunc.PopulateCategoryDatalist = function () {
QueryandReplaceDatalist("EditProductCategoryDataList",
LoadDataPageFunc.URLs.CategoryDatalist,
'POST', { }, fromvarcache = true,
);
};
FormBuilder.build({
formClass: 'EditProductMarket',
pageName: LoadDataPageFunc.pageName,
submitUrl: LoadDataPageFunc.URLs.EditUrl,
currentDataUrl: '{{ route('admin.products.view.data', [], false) }}',
topbartitle: LoadDataPageFunc.PageTitle,
defaultback: {
page: 'ManageProductAdmin',
data: currenttarget,
},
onSuccess: (response) => {
ModalQuickDismiss('Success', 'Product Updated');
},
onError: (err) => {
ModalQuickDismiss('Error', 'Failed to update product.<br>' + err.message);
},
unabletoLoadFunc: function (err) {
ModalQuickDismiss('Error', 'Failed to update product.<br>' + err.message);
},
onFormGenerated: function () {
LoadDataPageFunc.UpdateSubCategoryDatalistasTyped();
LoadDataPageFunc.PopulateCategoryDatalist();
},
fields: [
{ type: 'text', id: 'EditProductName', label: 'Name', placeholder: 'Product Name', required: true, currentdatavar: 'name' },
{ type: 'textarea', id: 'EditProductDescription', label: 'Description', required: true, currentdatavar: 'description' },
{ type: 'text', id: 'EditProductCategory', label: 'Category', placeholder: 'Category', required: true, datalist: 'EditProductCategoryDataList', currentdatavar: 'category' },
{ type: 'text', id: 'EditProductSubCategory', label: 'Subcategory', placeholder: 'Subcategory', required: true, datalist: 'EditProductSubCategoryDataList', currentdatavar: 'subcategory' },
{ type: 'number', id: 'EditProductPrice', placeholder: '260', label: 'Price (PHP)', required: true, currentdatavar: 'price' },
{ type: 'text', id: 'EditProductUnitName', label: 'Unit', placeholder: 'ex 25kg', required: true, currentdatavar: 'unitname' },
// { type: 'number', id: 'EditProductAvailable',placeholder:'ex. 999', label: 'Available Stock', required: true, currentdatavar: 'available' },
{ type: 'text', id: 'EditProductBarcode', label: 'Barcode', placeholder: '12-digit number', maxlength: 12, pattern: '[0-9]*', currentdatavar: 'barcode' },
{ type: 'dropzone', id: LoadDataPageFunc.ids.photodropzone, label: 'Photo', uploadUrl: LoadDataPageFunc.URLs.PhotoUpload, currentdatavar: 'photourlDropzone' },
{ type: 'button', label: 'Submit', onClick: 'FormBuilder.submit()' },
]
});
</script>

View File

@@ -0,0 +1,224 @@
<div id="EditStoreForm">
</div>
<script>storeUnavailabe = false;</script>
@php
use App\Http\Controllers\UserManagement\CreateUserControllerUltimate;
@endphp
<script>
InitDataPageFuncOBJ();
LoadDataPageFunc = {};
LoadDataPageFunc.URLs = {};
LoadDataPageFunc.URLs.EditUrl = `/Store/Edit`;
LoadDataPageFunc.URLs.CategoryDatalist = `/Store/New/Category/Datalist`;
// LoadDataPageFunc.URLs.SubCategoryDatalist = `/Products/New/SubCategory/Datalist`;
LoadDataPageFunc.URLs.PhotoUpload = `/File/Upload/Store`;
LoadDataPageFunc.PageTitle = 'Edit Store';
LoadDataPageFunc.ids = {};
LoadDataPageFunc.ids.photodropzone = 'NewStorePhotos';
LoadDataPageFunc.formclass = 'NewStoreMarket';
try {
StoreData = @json($current_data);
} catch (error) {
StoreData = {};
}
LoadDataPageFunc.LoadUI = function () {
let finalhtml = '';
const formclass = LoadDataPageFunc.formclass;
const textbox = function (placeholder, label, id, required = false, datalist = '', textvalue = '') {
return UIInputGroup(placeholder, 'text', id, label, formclass, spanclass = '', imginsteadofspan = '', required, textvalue, datalist, imgwidth = '', imgheight = '');
};
const name = textbox('Store Name', 'Name', 'name', true, '', StoreData.name);
const description = UIInputGroupTEXTAREA(label = 'Description', 'description', required = true, textareacontent = StoreData.description, formclass);
const category = textbox('Product Category', 'Category', 'category', true, 'NewStoreCategoryDataList', StoreData.category);
const address = UIInputGroupTEXTAREA(label = 'Address', 'address', required = true, textareacontent = StoreData.address, formclass);
const categorydatalist = ArraytoDatalist("NewStoreCategoryDataList", [], false) || '';
const photoscontainer = UIInputGroupFileUploadDropzone(LoadDataPageFunc.ids.photodropzone, label = 'Photo', LoadDataPageFunc.URLs.PhotoUpload);
//ADD Validator for Javascript Inputs to Prevent JS Code Injection on ALL
const storeOwner = UIInputGroupSelect('owner', label = 'Store Owner', [['', 'Select User']], spanclass = '', imginsteadofspan = '', '', '', '', formclass);
//TODO Add Support for storeManager and Cashier multiple accounts support
const submitbutton = UIInputGroupButton('Submit', formclass, buttonid = '', onclick = 'LoadDataPageFunc.TryToSubmit();', buttonstyle = '');
finalhtml = name + description + category + categorydatalist + address + photoscontainer + storeOwner + submitbutton;
finalhtml = CreateCardSimple(false, finalhtml);
document.getElementById('EditStoreForm').innerHTML = finalhtml;
// QueryandReplaceDatalist("NewProductCategoryDataList", LoadDataPageFunc.URLs.CategoryDatalist, 'POST', datatosend = null, fromvarcache = true);
// QueryandReplaceDatalist("NewProductSubCategoryDataList", LoadDataPageFunc.URLs.SubCategoryDatalist, 'POST', datatosend = null, fromvarcache = true);
InitializeLoadDataPageFuncDropZonePhotoUpload(LoadDataPageFunc.URLs.PhotoUpload, LoadDataPageFunc.ids.photodropzone, ShowClearPhotoFUNC = '', clearphotosbuttonid = 'clearuploadbutton', acceptedfiles = '', maxsizeMB = 100);
LoadDataPageFunc.InitializePhotoDropZone();
// LoadDataPageFunc.UpdateSubCategoryDatalistasTyped();
QueryandReplaceDatalist("NewStoreCategoryDataList", LoadDataPageFunc.URLs.CategoryDatalist, 'POST', null, fromvarcache = true);
currentDropzone[LoadDataPageFunc.ids.photodropzone].functions.ReplaceDropzoneFiles(StorePhotosDropzone);
};
LoadDataPageFunc.RepopulateStoreOwnerList = function () {
function UpdateSelectParentList(response) {
const selectElement = $("#owner");
response.forEach(element => {
$("<option></option>")
.val(element.hashkey)
.text(`${element.name} (${element.mobile_number}) [${element.username}] ${element.fullname ?? ''}`)
.appendTo(selectElement);
});
selectElement.val(StoreData.owner_hashkey || 0);
}
@if ($FragmentOnly)
AjaxDo('/admin/user/list/numbers/hash', {}, UpdateSelectParentList, null, reqtype = 'POST');
@else
let userdata = @json(CreateUserControllerUltimate::listAllUsersforParentSelectHTML(true));
UpdateSelectParentList(userdata);
@endif
};
LoadDataPageFunc.TryToSubmit = function () {
const currentformdata = LoadDataPageFunc.ValidateForm();
if (!currentformdata) {
ModalQuickDismiss('Error', 'Name, Description, Category and Address are required fields.', modalid = '', modaltohide = '', functiontodo = '', conditiontrue = true, modalfooter = '');
return false;
}
const errorModal = function (errorstring = '') {
ModalQuickDismiss('Error', 'Unable Update Store. <br>' + errorstring, modalid = '', modaltohide = '', functiontodo = '', conditiontrue = true, modalfooter = '');
};
const successModal = function () {
hideallmodals();
ModalQuickDismiss('Success', 'New Store Updated');
};
const submitsuccess = function (response) {
if (typeof response.success !== 'undefined' && response.success === true) {
Preloaders.ViewStoreinMarket(currenttarget, false, function (response) {
successModal();
gotoPage('ViewStoreMarket', currenttarget);
});
} else {
errorModal(response.message || 'An error occurred while updating the store.');
}
// responseOk = isResponseAHash(response);
// if (!responseOk) {
// errorModal(response);
// return false;
// }
// if (responseOk) {
// // Preloaders.ViewProductinMarket(response);
// successModal();
// gotoPage('ViewStoreMarket', response);
// return true;
// }
};
SendPostDataFormwithTARGETUPLOADEDFILES(LoadDataPageFunc.URLs.EditUrl, LoadDataPageFunc.formclass, submitsuccess);
};
LoadDataPageFunc.ValidateForm = function () {
return validateInputForm(['name', 'description', 'address', 'category']);
const isAnyoftheRequiredEmpty = !inputsArray['NewProductName'] || !inputsArray['NewProductDescription'] || !inputsArray['NewProductCategory'] || !inputsArray['NewProductSubCategory'] ||
!inputsArray['NewProductPrice'] || !inputsArray['NewProductAvailable'] || !inputsArray['NewProductUnitName'] || Target_Uploaded_Files.length === 0;
if (isAnyoftheRequiredEmpty || isBarcodeNumeric === false) {
return false;
}
const IsBarcodeValid = IsStringBarcode12Digits(inputsArray['NewProductBarcode']);
return true;
};
LoadDataPageFunc.AssignVariablesandLoadUI = function () {
try {
StorePhotosDropzone = StoreData.photourlDropzone;
} catch (error) {
StorePhotosDropzone = [];
}
try {
ParentList = StoreData.ParentList; // TODO ParentListisNotUsed
} catch (error) {
ParentList = false;
}
LoadDataPageFunc.LoadUI();
LoadDataPageFunc.RepopulateStoreOwnerList();
};
LoadDataPageFunc.FetchStoreData = function () {
if (typeof StoreData.name !== 'undefined') {
LoadDataPageFunc.AssignVariablesandLoadUI();
return;
}
let Req = new RequestData(false);
Req.url('/Edit/Store/Details/data').type('POST').fromVarCache(false).data({ target: currenttarget })
.success((response) => {
StoreData = response;
LoadDataPageFunc.AssignVariablesandLoadUI();
}).go();
};
LoadDataPageFunc.Main = function () {
LoadDataPageFunc.FetchStoreData();
changeTopbarTitle(LoadDataPageFunc.PageTitle);
};
LoadDataPageFunc.Main();
</script>

View File

@@ -0,0 +1,93 @@
@php
$photourl = $currentUser->photourl[0] ?? '/resource-photos/No_image_available.svg.png';
$name = $currentUser->name ?? $currentUser->nickname ?? $currentUser->fullname ?? $currentUser->username ?? '';
$fullname = $currentUser->fullname ?? $currentUser->name ?? '';
$mobile = $currentUser->mobile_number;
$landline = $currentUser?->landline ?? '';
$email = $currentUser->email;
$script_asset = App\Http\Controllers\PageMemoryController::readPublicAssetInMemory('account_settings.js');
if (!$script_asset) {
echo 'empty asset';
}
$account_settings_loaded_text = 'let account_settings_loaded = true;';
@endphp
<script>
{!! $account_settings_loaded_text !!}
</script>
<br><br><br>
<div class="mt-1">
<div class="tf-container">
<div class="box-user">
<div class="inner d-flex flex-column align-items-center justify-content-center">
<div class="box-avatar">
<img src="{{ $photourl }}" id="account_settings_profile_picture" alt="image">
<span class="icon-camera-to-take-photos"></span>
</div>
<div class="info">
<h2 class="fw_8 mt-3 text-center" id="account_settings_fullname_profile">
{{ $name }}
</h2>
<p id="">
<h6 id="account_settings_credit_card_profile_pic"></h6> <i class="icon-copy1"></i></p>
</div>
</div>
</div>
<ul class="mt-7">
<li class="list-user-info"><span class="icon-user"></span>
<h5 id="account_settings_fullname_main"> {{ $fullname }}</h5>
</li>
<li class="list-user-info"><span class="icon-credit-card2"></span>
<h4 id="account_settings_credit_card_main">{{ $mobile }}</h4>
</li>
<li class="list-user-info"><span class="icon-phone"></span>
<h4 id="account_settings_mobile_number">{{ $landline }}</h4>
</li>
<li class="list-user-info"><span class="icon-email"></span>
<h4 id="account_settings_email">{{ $email }}</h4>
</li>
</ul>
</div>
</div>
<div class="card-section" id="main-card-section">
</div>
<br><br>
<script>
if (typeof window.account_settings_loaded === 'undefined') {
let account_settings_loaded = false;
}
account_settings_loaded = {{ $account_settings_loaded ?? false ? 'true' : 'false' }};
{!! App\Http\Controllers\PageMemoryController::readAssetInMemory('account_settings.js') !!}
</script>
<script>
$(document).ready(function () {
if (typeof window.account_settings_loaded === 'undefined') {
window.account_settings_loaded = false;
}
if (!account_settings_loaded) {
account_details_load_data();
}
});
</script>

View File

@@ -0,0 +1,130 @@
<div class="card-body card-info" id="main-card-body" style="">
<div class="row">
<div class="col-md-18">
</div>
</div>
<br>
</div>
<div class="card" id="secondary-card">
<div class="card-header ui-sortable-handle" style="cursor: move;">
<div class="row">
<div class="col">
<h4 class="card-title">Transfer My Credit</h4>
</div>
<div class="col">
</div>
</div>
<div class="card-tools">
</div>
</div>
<div class="card-body " id="credit-amount-request-form">
<div class="row">
<div class="col-6">
<input class="form-control" type="number" id="transfer-credit-amount-field"
placeholder="Amount to Transfer">
</div>
<div class="col-6">
<button value="Transfer" id="Transfer-credit-initial-button" class=" form-control btn btn-primary"
onclick="CreateAndShowModalTransferMyCreditConfirmation()">Transfer Credit</button>
</div>
</div>
</div>
</div>
<script>
function CreateAndShowModalTransferMyCreditConfirmation() {
if (!$('#transfer-credit-amount-field').val()) { return false; }
const modalid = "modal-credit-transfer-confirmation";
const modaltitle = "Continue?";
const modalbody = `
<p>You are sending credit from your account to the target User?</p>
`;
const modalfooter = `<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
<button type="button" class="btn btn-primary" onclick="TransferMyCreditNow();" id="transfer-credit-now">Continue</button>`;
CreateAndShowModal(modalid, modaltitle, modalbody, modalfooter, modalfooterclose = false, topclosebutton = true, modalbodyclass = 'modal-body', modalheaderclass = 'modal-header');
}
function SuccessCreditTransferResponse() {
const modalid = "modal-credit-transfer-success";
const modaltitle = "Success";
const modalbody = `
<p>Transfer has been sucessful.</p>
`;
const modalfooter = `<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>`;
CreateAndShowModal(modalid, modaltitle, modalbody, modalfooter, modalfooterclose = false, topclosebutton = true, modalbodyclass = 'modal-body', modalheaderclass = 'modal-header');
$("#modal-credit-transfer-confirmation").modal('hide');
Backkey();
}
function ErrorCreditTransferResponse() {
const modalid = "modal-credit-transfer-failed";
const modaltitle = "Failed";
const modalbody = `
<p>Failed to transfer credit. Try Again Later.</p>
`;
const modalfooter = `<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>`;
CreateAndShowModal(modalid, modaltitle, modalbody, modalfooter, modalfooterclose = false, topclosebutton = true, modalbodyclass = 'modal-body ', modalheaderclass = 'modal-header bg-danger');
$("#modal-credit-transfer-confirmation").modal('hide');
}
function TransferMyCreditNow() {
function TransferCreditToUserNow(response) {
if (response === true) {
SuccessCreditTransferResponse();
}
else if (response === false) {
ErrorCreditTransferResponse();
}
}
AjaxDo('/user/sendmycredit', { amount: $("#transfer-credit-amount-field").val().trim(), target_user: currenttarget }, TransferCreditToUserNow, null, reqtype = 'POST');
}

View File

@@ -0,0 +1,101 @@
<br>
<h2 class="fw_6 text-center">BukidBounty Market</h2><br>
<div class="card-section" id="main-card-section">
</div>
<br>
<div class="bill-content">
<div class="tf-container" id="recents_home">
</div>
</div>
<script>
defaultBackOnclick=null;
statsarray = [["Pending", 0, "Orders", "left", "pending_orders_no"],
["Delivered", 0, "Today", "left", "actionable-leads-no"],
["Sold", 0, "Today", "right", "sold-today-no"],
["Balance", 0, "PHP", "right", "total_balance_php"]
//,["Sold", 0, "Total", "right", "sold-all-no"]
];
balancewrapper_item_array = [["New Transaction", "NewTransaction", "", "/assets/transaction.png", "", "", "", ""], ["Transaction Summary", "ListTransactions", "0", "/assets/ListLeads.png", "", "", "", ""]];
balancebox = UIcreateBalanceBoxfromArray(statsarray, balancewrapper_item_array);
servicesbuttonarray = [
// ['/assets/ListLeads.png', 'Leads', 'ListLeads', ''],
// ['/assets/user-list.png', 'Ultimate Shortcuts', 'ultimate_shortcuts']
['/assets/user-list.png', 'Users', 'user_list', ''],
['/assets/reports.png', 'Reports', 'ListReports'],
['/assets/shopping-cart.png', 'Market', 'ListProductsMarket'],
['/assets/shipments.png', 'Shipments', 'list_shipments'],
['/assets/delivery-bike.png', 'Riders', 'list_riders'],
['/assets/store.png', 'Stores', 'ListStores'],
];
servicesbox = UIServices_FullDIV_GOTOPAGE_Array('', '', '', '', servicesbuttonarray);
todocardtext = `
<img src="/assets/health_advisory.jpg" style="width:100%;border-radius:10px;box-shadow:0 0 5px rgba(0,0,0,0.1);margin-bottom:10px;">
Fix Stores Not showing in the list
<br>
Fix Photo Not Showin in Account Settings
<br>
Address Update In Account Settings
`;
todobox = CreateCardSimple('Announcement', todocardtext);
dualcolumn_button_array = [
// ['Leads', 'ListLeads', '', '/assets/ListLeads.png'],
['Create User', 'create_user', '', '/assets/user-list.png'],
['Accounting', 'ListReports', '', '/assets/reports.png'],
['Create Store', 'NewStoreAdmin', '', '/assets/store.png'],
['New Product', 'NewProductAdmin', '', '/assets/products.png'],
['List Products', 'ListProductsMarket', '', '/assets/products.png'],
];
dualcolumnhtml = UISideText_DualColumnButton_Array(dualcolumn_button_array);
recents_list_array = [['Loading', 'Please Wait...', '', 'xxxwait', 'unknown', '', '/assets/sync.png']];
arrowlist_button_array = '';
searchbox_html = UISearchBox_with_BUTTONS_FULL('Recent', recents_list_array, arrowlist_button_array, 'RecentsPage', '', 'View All', 'HomeRecentList', 'home_recent_search', 'Search');
$('#main-card-section').append(balancebox);
$('#main-body').append(servicesbox + dualcolumnhtml + '<br><br>' + todobox + searchbox_html);
function UIHome_Leads_Today_Change(num) {
if (num === false || num === undefined || num === null) {
return false;
}
$('#leads-today-no').html(num);
}
function loadrecents_home() {
}
function HomeULT_reinitilize_loaders() {
Preloaders.Account_Settings_Details();
Preloaders.ListAllMarketProductsData();
}
$().ready(function () {
changeTopbarTitle('Home');
loadrecents_home();
HomeULT_reinitilize_loaders();
CheckAndSetDarkMode();
});
</script>

View File

@@ -0,0 +1,35 @@
<br>
<h2 class="fw_6 text-center">BukidBounty Market</h2><br>
<h3 class="fw_6 text-center">Ultimate Functions</h3>
<div class="card-section" id="main-card-section">
</div>
<script>
servicesbuttonarray = [
// ['/assets/ListLeads.png', 'Leads', 'ListLeads', ''],
['/assets/user-list.png', 'Users', 'user_list', ''],
['/assets/reports.png', 'Reports', 'ListReports'],
['/assets/shopping-cart.png', 'Market', 'ListProductsMarket'],
['/assets/target.png', 'New Store', 'NewStore'],
['/assets/user-list.png', 'New User', 'create_user']
];
</script>

View File

@@ -0,0 +1,164 @@
@php
$children = App\Http\Controllers\Pages\UserListPageController::ListChildrenofCurrentUser();
$child_script = "child_users = $children;";
@endphp
<script>
if (typeof child_users === 'undefined') {
let child_users = false;
}
{!! $child_script !!}
</script>
<br><br><br><br>
<div class="card" id="secondary-card" style="display:none;">
<div class="card-header ui-sortable-handle" style="cursor: move;">
<h3 class="card-title">Users</h3>
<div class="card-tools"></div>
</div>
<div class="card-body">
<table id="User_list_table">
<thead>
<tr>
<th>Number /<br>Nickname</th>
<th>Total Balance</th>
<th>Type</th>
<th>
<center>Active</center>
</th>
</tr>
</thead>
<tbody id="user-list-table-body">
</tbody>
</table>
</div>
</div>
<br><br><br>
<script>
window.disableduser_checkbox ||= '<img class="icon-box" style="width:40px;height:40px" src="/assets/checkmark.png">';
window.enableduser_checkbox ||= '<img class="icon-box" style="width:40px;height:40px" src="/assets/uncheck.png">';
function GenerateUserRow(Number, Total_Balance, Type, Active, Hashkey) {
let activecheckbox = '';
if (Active === '1' || Active === 1) {
Active = true;
} else { Active = false; }
if (Active) {
activecheckbox = enableduser_checkbox;
} else {
activecheckbox = disableduser_checkbox;
}
const actionbutton = `<button class="btn btn-warning" onclick="gotoPage('UserModify','${Hashkey}')">View User</button>`;
let numandnick = Number;
numandnick = numandnick.replace('----', '<br>');
numandnick = numandnick.replace('----', '<br>');
numandnick = `<a href="#" onclick="gotoPage('UserModify','${Hashkey}');return false;">${numandnick}</a>`;
if (Type == 'user') { Type = 'Player'; }
if (Type == 'usher') { Type = 'Leader'; }
if (Type == 'coordinator') { Type = 'Team Leader'; }
return `<tr>
<td>${numandnick}</td>
<td>${Total_Balance}</td>
<td>${Type}</td>
<td>${activecheckbox}</td>
</tr>`;
}
async function GenerateUserRows(responsearray) {
// console.log(responsearray);
let newhtmltable = '';
for (let i = 0; i < responsearray.length; i++) {
newhtmltable += GenerateUserRow(
responsearray[i]['mobile_number'],
responsearray[i]['total_balance'],
responsearray[i]['acct_type'],
responsearray[i]['active'],
responsearray[i]['hashkey']
);
}
//$("#User_list_table").find("tbody").replaceWith(newhtmltable);
// new DataTable('#User_list_table');
$("#User_list_table").find("tbody").html(newhtmltable);
let userlist = $("#User_list_table").DataTable({
"destroy": true,
order: [[0, 'desc']],
pageLength: 5,
lengthMenu: [[5], [5]]
});
userlist.on('click', 'tbody tr', function () {
let data = userlist.row(this).data();
if (typeof data === 'undefined') { return false; }
let targettranshash = data[0];
// console.log(targettranshash);
$(targettranshash).find('a').trigger('click');
});
$('#secondary-card').fadeIn(200);
}
function GenerateUserTable() {
let REQQ = new RequestData(false);
REQQ.url('/admin/users/list').type('POST').success((response) => {
GenerateUserRows(response);
}).go();
// AjaxDo('?/admin/users/list', null, GenerateUserRows, null, reqtype = 'POST');
}
if (child_users) {
GenerateUserRows(child_users);
}
GenerateUserTable();
changeTopbarTitle('Users');
</script>

View File

@@ -0,0 +1,848 @@
@php
if (!$FragmentOnly) {
$echo['SetLoadedFlagFalse'];
$checkboxActive = '<center><img class="icon-box" style="width:40px;height:40px" src="/assets/checkmark.png"></center>';
$checkboxInactive = '<center><img class="icon-box" style="width:40px;height:40px" src="/assets/uncheck.png"></center>';
$active_checkbox = '';
if (isset($current_target)) {
$User = $userModifyAdmin::getDetailsbyHashkey($current_target);
if (!$User) {
echo '<script>ModalQuickDismiss("Error", "User Not Found")</script>';
} else {
$user_phonenumber = $User['mobile_number'];
$user_nickname = $User['nickname'];
$user_fullname = $User['fullname'];
$active = $User['active'];
$created_time = $User['created'];
$acct_type = $User['acct_type']->value;
$total_balance = $User['total_balance'];
$parent = $User['parent'];
$additional_roles = $User['additional_roles'] ?? [];
$current_roles = $userModifyAdmin::ShowUserRoles($current_target);
$all_roles = $userModifyAdmin::ShowAllRoles();
$echo['SetLoadedFlagTrue'];
}
$children = $userModifyAdmin::getchildrenofTargetUser($current_target);
}
if ($active ?? false) {
$active_checkbox = $checkboxActive;
} else {
$active_checkbox = $checkboxActive;
}
}
@endphp
<div class="card" id="secondary-card">
<div class="card-header ui-sortable-handle" style="cursor: move;">
<h3 class="card-title" style="" id="User_phonenumber">{{ $user_phonenumber ?? '' }}</h3>
<div class="card-tools">
<h3 class="card-title" style="" id="User_nick">{{ $user_nickname ?? '' }}</h3>
</div>
</div>
<div class="card-body ">
<h3 style="text-align:center; padding-bottom:10px;" id="User_fullname">{{ $user_fullname ?? '' }}</h3>
<div class="card-section" id="main-card-section">
<div class="tf-container">
<div class="tf-balance-box" style="border: solid 3px #000d88;">
<div id="balance_wrapper">
<div class="balance">
<div class="row">
<div class="col br-right">
<div class="inner-left">
<p>Created</p>
<h3 id="creation_date">{{ $created_time ?? '' }}</h3>
</div>
</div>
<div class="col br-right">
<div class="inner-left">
<p>Active</p>
<h3 id="active_checkbox">
{!! $active_checkbox ?? '' !!}
</h3>
</div>
</div>
<div class="col br-right">
<div class="inner-right">
<p>Parent</p>
<h3 id="user_parent">{{ $parent ?? '' }}</h3>
</div>
</div>
<div class="col br-right">
<div class="inner-right">
<p>User Type</p>
<h3 id="user_type_column">
{{ $acct_type ?? '' }}
</h3>
</div>
</div>
<div class="col br-right">
<div class="inner-right">
<p>Balance</p>
<h3 id="user_balance">{{ $total_balance ?? '' }}</h3>
</div>
</div>
</div>
</div>
</div>
<div class="wallet-footer">
<ul class="d-flex justify-content-between align-items-center">
<li class="wallet-card-item">
<a class="fw_6 text-center" id="btn-popup-down" href="javascript:void(0);"
onclick="ButtonGo('NewLeads','');return false;">
<ul>
<li class="path1"></li>
<li class="path2"></li>
<li class="path3"></li>
<li class="path4"></li>
</ul>
<img src="/assets/NewLeads.png" style="width: 30; height: 30;" class="icon-user">
New Lead
</a>
</li>
<li class="wallet-card-item">
<a class="fw_6 text-center" id="btn-popup-down" href="javascript:void(0);"
onclick="ButtonGo('ListLeads','0');return false;">
<ul>
<li class="path1"></li>
<li class="path2"></li>
<li class="path3"></li>
<li class="path4"></li>
</ul>
<img src="/assets/ListLeads.png" style="width: 30; height: 30;" class="icon-user">
List Leads
</a>
</li>
</ul>
</div>
</div>
</div>
</div>
<br><br>
<div class="mt-5">
<div class="tf-container">
<div class="tf-title d-flex justify-content-between">
<h3 class="fw_6"></h3>
<a href="" onclick="" class="primary_color fw_6"></a>
</div>
<ul class="box-service mt-3" id="user_controls">
</ul>
</div>
</div>
</div>
</div>
<br><br>
<div class="card" id="third-card" style='display:none;'>
<div class="card-header ui-sortable-handle" style="cursor: move;">
<h3 class="card-title" style="">Members</h3>
<div class="card-tools">
</div>
</div>
<div class="card-body " id='user_details_children'>
<table id="User_details_children_table">
<thead>
<tr>
<th>Number /<br>Nickname</th>
<th>Total Balance</th>
<th>Type</th>
<th>
<center>Active</center>
</th>
<th>Parent</th>
</tr>
</thead>
<tbody>
</tbody>
</table>
</div>
</div>
<script>
LoadDataPageFunc = {};
LoadDataPageFunc.data = {};
LoadDataPageFunc.data.children = null;
LoadDataPageFunc.data.CurrentRoles = null;
LoadDataPageFunc.data.AllRoles = null;
@if (isset($current_roles) && $current_roles)
LoadDataPageFunc.data.CurrentRoles = {!! json_encode($current_roles) !!}
@endif
@if(isset($all_roles) && $all_roles)
LoadDataPageFunc.data.AllRoles = {!! json_encode($all_roles) !!}
@endif
@if(isset($children) && $children)
LoadDataPageFunc.data.children = {!! json_encode($children) !!}
@endif
LoadDataPageFunc.buttonLImaker = function (text, onclick, icon) {
return `<li><a href="javascript:void(0);" onclick="${onclick}"><div class="icon-box "><img src="/assets/${icon}"></div>${text}</a></li>`;
};
LoadDataPageFunc.ActiveCheckbox = '<center><img class="icon-box" style="width:40px;height:40px" src="/assets/checkmark.png"></center>';
LoadDataPageFunc.ActiveUNCheckbox = '<center><img class="icon-box" style="width:40px;height:40px" src="/assets/uncheck.png"></center>';
LoadDataPageFunc.UserControls = {};
LoadDataPageFunc.UserControls.Load = function () {
let controlsArr = []; let allcontrolsSTR = '';
let DisableButton = LoadDataPageFunc.buttonLImaker('Disable', 'LoadDataPageFunc.DisableUser();', 'disableuser.png');
DisableButton = $(DisableButton);
DisableButton.attr('id', 'AdminUserDisableButton');
DisableButton = DisableButton.prop('outerHTML');
controlsArr.push(DisableButton);
controlsArr.push(LoadDataPageFunc.buttonLImaker('Set Notes', 'LoadDataPageFunc.SetUserNotesModal();', 'notes.png'));
controlsArr.push(LoadDataPageFunc.buttonLImaker('Set Exec', 'LoadDataPageFunc.SetUserExecModal();', 'exec.png'));
// controlsArr.push(LoadDataPageFunc.buttonLImaker('Request Credit For User', 'LoadDataPageFunc.OpenRequestCredit();', 'request-credit.png'));
controlsArr.push(LoadDataPageFunc.buttonLImaker('Update Details', 'LoadDataPageFunc.UpdateUserDetailsDialog();', 'edituser.png'));
controlsArr.push(LoadDataPageFunc.buttonLImaker('Reset Password', 'LoadDataPageFunc.ResetUserPassword();', 'resetpassword.png'));
controlsArr.push(LoadDataPageFunc.buttonLImaker('Transfer My Credit', 'LoadDataPageFunc.TransferMyCredit();', 'transfercredit.png'));
controlsArr.push(LoadDataPageFunc.buttonLImaker('Logout', 'LoadDataPageFunc.OpenLogoutUser();', 'logout.png'));
controlsArr.push(LoadDataPageFunc.buttonLImaker('Roles', 'LoadDataPageFunc.Roles.ShowFetchedUserRoles();', 'briefcase.png'));
controlsArr.push(LoadDataPageFunc.buttonLImaker('Change Parent', 'LoadDataPageFunc.ChangeParentModal();', 'atlas/ecology/leaf-tag.svg'));
allcontrolsSTR = controlsArr.join('');
$('#user_controls').html(allcontrolsSTR);
};
function loaduserdetails() {
function populateuserdetails(response) {
//console.log(response);
if (response.created) {
response.created = formatDateTimetoReadable(response.created);
}
$('#User_phonenumber').html(response.mobile_number);
$('#User_nick').html(response.nickname);
$('#creation_date').html(response.created);
if (response.active === '1' || response.active === 1 || response.active === true) {
LoadDataPageFunc.ChangeToEnableUserButton();
}
else {
LoadDataPageFunc.ChangeToDisableUserButton();
}
$('#user_parent').html(response.parent);
$('#user_type_column').html(response.acct_type);
if (response.total_balance || response.total_balance === 0) {
$('#user_balance_column').show();
$('#user_balance').html(response.total_balance);
}
if (response.nickname) {
$('#user_type_column').show();
}
}
LoadDataPageFunc.UserControls.Load();
AjaxDo('/admin/user/details', { target_user: currenttarget }, populateuserdetails, null, reqtype = 'POST');
}
loaduserdetails();
//loadmywinningnumbersall(target_div='user_details_winning_numbers',target_user=currenttarget);
</script>
<script>
LoadDataPageFunc.Roles = {};
LoadDataPageFunc.Roles.ShowUserRoles = function () {
let finalhtml = '';
const formclass = 'UserRoles';
let roleshtml = '';
if (typeof LoadDataPageFunc.data.CurrentRoles === 'object') {
LoadDataPageFunc.data.CurrentRoles.forEach(role => {
roleshtml += UIInputGroupCheckBox('ROLE' + role.value, role.name, true, additional_input_class = 'RolesAllowed')
});
LoadDataPageFunc.data.AllRoles.forEach(role => {
const exists = LoadDataPageFunc.data.CurrentRoles.some(cr => cr.value === role.value);
if (!exists) {
roleshtml += UIInputGroupCheckBox(
'ROLE' + role.value,
role.name,
false,
additional_input_class = 'RolesAllowed'
);
}
});
}
// const submitbutton = UIInputGroupButton('Submit', formclass, buttonid = '', onclick = 'LoadDataPageFunc.UpdateUserRoles();', buttonstyle = '');
finalhtml = roleshtml;
finalhtml = CreateCardSimple(false, finalhtml);
let modalbody = finalhtml;
let modalfooter = UIInputGroupButton('Update', formclass, buttonid = '', onclick = 'LoadDataPageFunc.Roles.UpdateUserRoles();', buttonstyle = '');
CreateAndShowModal('ChangeUserRolesModal', 'User Roles', modalbody, modalfooter, modalfooterclose = true, topclosebutton = true, modalbodyclass = 'modal-body', modalheaderclass = 'modal-header');
};
LoadDataPageFunc.Roles.ShowFetchedUserRoles = function () {
if (LoadDataPageFunc.data.CurrentRoles && LoadDataPageFunc.data.AllRoles) {
LoadDataPageFunc.Roles.ShowUserRoles();
return;
}
LoadDataPageFunc.Roles.FetchRoles(function () {
LoadDataPageFunc.Roles.ShowUserRoles();
});
};
LoadDataPageFunc.Roles.FetchRoles = function (success = null, error = null) {
LoadDataPageFunc.Req.url(`/admin/user/roles/get`).type('POST').fromVarCache(false).data({ target_user: currenttarget })
.success((response) => {
LoadDataPageFunc.data.CurrentRoles = response;
LoadDataPageFunc.Req.url(`/admin/user/roles/all`).type('POST').fromVarCache(false).data({ target_user: currenttarget })
.success((response) => {
LoadDataPageFunc.data.AllRoles = response || [];
if (success && typeof success === 'function') {
success(response);
}
}).error((response) => {
if (error && typeof succerroress === 'function') {
error(response);
}
}).go();
}).error((response) => {
if (error && typeof succerroress === 'function') {
error(response);
}
}).go();
};
LoadDataPageFunc.Roles.GetSelectedRoles = function () {
const selectedRoles = [];
document.querySelectorAll('.RolesAllowed').forEach(checkbox => {
if (checkbox.checked) {
const label = document.querySelector(`label[for="${checkbox.id}"]`);
if (label) {
selectedRoles.push(label.textContent.trim());
}
}
});
return selectedRoles;
}
LoadDataPageFunc.Roles.UpdateUserRoles = function () {
LoadDataPageFunc.Req.url(`/admin/user/roles/change`).type('POST').fromVarCache(false).data({ target_user: currenttarget, roles: LoadDataPageFunc.Roles.GetSelectedRoles() })
.success((response) => {
LoadDataPageFunc.data.AllRoles = response || [];
LoadDataPageFunc.Roles.FetchRoles(function () {
ModalQuickDismiss('Success', 'Roles Updated');
});
}).error((response) => {
ModalQuickDismiss('Error', response);
}).go();
};
LoadDataPageFunc.Req = new RequestData(false);
LoadDataPageFunc.SetUserNotesModal = function () {
let modalbody = `<textarea id="SetUserNotesContentTextArea" class="form-control" rows="4" cols="50"></textarea>`;
let modalfooter = `<button class="btn btn-primary" onclick="LoadDataPageFunc.UpdateUserNotesTarget()">Update</button><button class="btn btn-danger" onclick="LoadDataPageFunc.EraseUserNotesTarget();">Clear</button>`;
CreateAndShowModal('SetUserNotesModal', 'Set Notes For User', modalbody, modalfooter, modalfooterclose = true, topclosebutton = true, modalbodyclass = 'modal-body', modalheaderclass = 'modal-header');
$('#SetUserNotesContentTextArea').load('/admin/user/note/content', { target_user: currenttarget });
};
LoadDataPageFunc.EraseUserNotesTarget = function () {
let Req = LoadDataPageFunc.Req;
function ShowConfirmationEraseUserNotesTarget(response) {
if (response) {
ModalQuickDismiss('Success', 'Note Deleted');
hidemodal('SetUserNotesModal');
} else {
ModalQuickDismiss('Failed', 'Unable to Delete Note.');
}
}
Req.url('/admin/user/note/delete').type('POST').fromVarCache(false).data({ target_user: currenttarget })
.success((response) => {
ShowConfirmationEraseUserNotesTarget(response);
}).go();
};
LoadDataPageFunc.UpdateUserNotesTarget = function () {
let Req = LoadDataPageFunc.Req;
let newnotevalue = $('#SetUserNotesContentTextArea').val();
if (!newnotevalue) { ModalQuickDismiss('Failed', 'No Content. Note was not updated.'); return false; }
function NoteUpdateConfirmationTarget(response) {
if (!response) {
ModalQuickDismiss('Failed', 'Unable to Update Notes'); return false;
} else {
ModalQuickDismiss('Updated', 'Notes Updated.');
hidemodal('SetUserNotesModal'); return true;
}
}
Req.url('/admin/user/note/update').type('POST').fromVarCache(false).data({ target_user: currenttarget, newnotecontent: newnotevalue })
.success((response) => {
NoteUpdateConfirmationTarget(response);
}).go();
console.log('df');
};
LoadDataPageFunc.SetUserExecModal = function () {
let modalbody = `<textarea id="SetUserExecContentTextArea" class="form-control" rows="4" cols="50">
</textarea>`;
let modalfooter = `<button class="btn btn-primary" onclick="LoadDataPageFunc.UpdateUserExecTarget()">Update</button><button class="btn btn-danger" onclick="LoadDataPageFunc.EraseUserExecTarget();">Clear</button>`;
CreateAndShowModal('SetUserExecModal', 'Set Exec For User', modalbody, modalfooter, modalfooterclose = true, topclosebutton = true, modalbodyclass = 'modal-body', modalheaderclass = 'modal-header');
$('#SetUserExecContentTextArea').load('/admin/user/exec/content', { target_user: currenttarget });
};
LoadDataPageFunc.EraseUserExecTarget = function () {
let Req = LoadDataPageFunc.Req;
function ShowConfirmationEraseUserExecTarget(response) {
if (response) {
ModalQuickDismiss('Success', 'Exec Deleted');
hidemodal('SetUserExecModal');
} else {
ModalQuickDismiss('Failed', 'Unable to Delete Exec.');
}
}
Req.url('/admin/user/exec/delete').type('POST').fromVarCache(false).data({ target_user: currenttarget })
.success((response) => {
ShowConfirmationEraseUserExecTarget(response);
}).go();
};
LoadDataPageFunc.UpdateUserExecTarget = function () {
let Req = LoadDataPageFunc.Req;
let newexecvalue = $('#SetUserExecContentTextArea').val();
if (!newexecvalue) { ModalQuickDismiss('Failed', 'No Content. Exec was not updated.'); return false; }
function ExecUpdateConfirmationTarget(response) {
if (!response) {
ModalQuickDismiss('Failed', 'Unable to Update Exec'); return false;
} else {
ModalQuickDismiss('Updated', 'Exec Updated.');
hidemodal('SetUserExecModal'); return true;
}
}
Req.url('/admin/user/exec/update').type('POST').fromVarCache(false).data({ target_user: currenttarget, newexeccontent: newexecvalue })
.success((response) => {
ExecUpdateConfirmationTarget(response);
}).go();
};
LoadDataPageFunc.DisableUserButtonHtml = function () {
let button = LoadDataPageFunc.buttonLImaker('Disable', 'LoadDataPageFunc.DisableUser();', 'disableuser.png');
button = $(button);
button = button.html();
return button;
};
LoadDataPageFunc.EnableUserButtonHtml = function () {
let button = LoadDataPageFunc.buttonLImaker('Enable', 'LoadDataPageFunc.EnableUser();', 'enable-user.png');
button = $(button);
button = button.html();
return button;
};
LoadDataPageFunc.ChangeToEnableUserButton = function () {
$('#active_checkbox').html(LoadDataPageFunc.ActiveCheckbox);
$('#AdminUserDisableButton').html(LoadDataPageFunc.DisableUserButtonHtml);
};
LoadDataPageFunc.ChangeToDisableUserButton = function () {
$('#active_checkbox').html(LoadDataPageFunc.ActiveUNCheckbox);
$('#AdminUserDisableButton').html(LoadDataPageFunc.EnableUserButtonHtml);
};
LoadDataPageFunc.ModalDisableSuccess = function () {
let modalid = "DisableUserSuccessModal";
let modaltitle = 'Sucess';
let modalbody = 'User is now Disabled';
let modalfooter = ``;
CreateAndShowModal(modalid, modaltitle, modalbody, modalfooter, modalfooterclose = true, topclosebutton = true, modalbodyclass = 'modal-body', modalheaderclass = 'modal-header');
};
LoadDataPageFunc.ModalDisableFailed = function (response) {
let modalid = "DisableUserFailedModal";
let modaltitle = 'Failed';
let modalbody = 'Unable to Disable User'.response;
let modalfooter = ``;
CreateAndShowModal(modalid, modaltitle, modalbody, modalfooter, modalfooterclose = true, topclosebutton = true, modalbodyclass = 'modal-body bg-warning', modalheaderclass = 'modal-header');
};
LoadDataPageFunc.ModalEnableSuccess = function () {
let modalid = "EnableUserSuccessModal";
let modaltitle = 'Sucess';
let modalbody = 'User is now Enabled';
let modalfooter = ``;
CreateAndShowModal(modalid, modaltitle, modalbody, modalfooter, modalfooterclose = true, topclosebutton = true, modalbodyclass = 'modal-body', modalheaderclass = 'modal-header');
};
LoadDataPageFunc.ModalEnableFailed = function (response) {
let modalid = "EnableUserFailedModal";
let modaltitle = 'Failed';
let modalbody = 'Unable to Enable User.<br>'.response;
let modalfooter = ``;
CreateAndShowModal(modalid, modaltitle, modalbody, modalfooter, modalfooterclose = true, topclosebutton = true, modalbodyclass = 'modal-body bg-warning', modalheaderclass = 'modal-header');
};
LoadDataPageFunc.EnableUserNow = function () {
let Reqq = new RequestData(false);
function TryToEnable(response) {
$("#EnableUserConfirmationDialog").modal('hide');
if (response === true) {
LoadDataPageFunc.ModalEnableSuccess();
LoadDataPageFunc.ChangeToEnableUserButton();
} else {
LoadDataPageFunc.ModalEnableFailed(response);
}
LoadDataPageFunc.CheckIfUserActive();
loaduserdetails();
};
Reqq.url('/admin/user/enable').type('POST').fromVarCache(false).data({ target_user: currenttarget })
.success((response) => {
TryToEnable(response);
}).go();
};
LoadDataPageFunc.ChangeParentModal = function () {
ModalQuickDismiss('Error','Function Not Implemented');
};
LoadDataPageFunc.DisableUserNow = function () {
let Reqq = new RequestData(false);
function TryToDisable(response) {
$("#DisableUserConfirmationDialog").modal('hide');
if (response === true) {
LoadDataPageFunc.ModalDisableSuccess();
LoadDataPageFunc.ChangeToDisableUserButton();
} else {
ModalDisableFailed(response);
}
LoadDataPageFunc.CheckIfUserActive();
loaduserdetails();
}
Reqq.url('/admin/user/disable').type('POST').fromVarCache(false).data({ target_user: currenttarget })
.success((response) => {
TryToDisable(response);
}).go();
}
LoadDataPageFunc.DisableUser = function () {
let modalid = "DisableUserConfirmationDialog";
let modaltitle = 'Disable User?';
let modalbody = 'Are you sure you want to disable user?<br> The user would not be able to access his/her account?';
let modalfooter = `<button type="button" class="btn btn-warning" data-dismiss="modal">Cancel</button>
<button type="button" class="btn btn-danger" onclick="LoadDataPageFunc.DisableUserNow()" id="request-credit-now">Continue</button>`;
CreateAndShowModal(modalid, modaltitle, modalbody, modalfooter, modalfooterclose = false, topclosebutton = true, modalbodyclass = 'modal-body', modalheaderclass = 'modal-header');
};
LoadDataPageFunc.EnableUser = function () {
let modalid = "EnableUserConfirmationDialog";
let modaltitle = 'Enable User?';
let modalbody = 'Are you sure you want to Enable user?<br> The user would have access his/her account?';
let modalfooter = `<button type="button" class="btn btn-warning" data-dismiss="modal">Cancel</button>
<button type="button" class="btn btn-danger" onclick="LoadDataPageFunc.EnableUserNow()" id="request-credit-now">Continue</button>`;
CreateAndShowModal(modalid, modaltitle, modalbody, modalfooter, modalfooterclose = false, topclosebutton = true, modalbodyclass = 'modal-body', modalheaderclass = 'modal-header');
};
LoadDataPageFunc.CheckIfUserActive = function () {
let Reqq = new RequestData(false);
function ChangeDisableButtonState(response) {
console.log(response);
if (response === true) {
LoadDataPageFunc.ChangeToDisableUserButton();
}
else if (response === false) {
LoadDataPageFunc.ChangeToEnableUserButton();
}
}
Reqq.url('/admin/user/isactive').type('POST').fromVarCache(false).data({ target_user: currenttarget })
.success((response) => {
ChangeDisableButtonState(response);
}).go();
};
LoadDataPageFunc.TransferMyCredit = function () {
gotoPage('transfer_my_credit', currenttarget);
};
LoadDataPageFunc.OpenUpdateUserDetailsButtonHtml = function () {
return HomeMenuButtons('assets/edituser.png', 'Update Details', '', '', '45%', '45%', '', buttononclick = 'LoadDataPageFunc.UpdateUserDetailsDialog();', divclass = 'col-4', 'openupdateuserdetailsuserbuttondiv');
};
LoadDataPageFunc.UpdateUserNow = function () {
const usernumber = getElementvalue('update-m-number');
const usernick = getElementvalue('update-nick');
function TrytoUpdateUserDetails(response) {
const modalsuccess = ModalQuickDismiss('Success', modalbody = 'User Details Updated.', modalid = 'UpdateUserDetailsSuccess', modaltohide = 'UpdateUserDetailsDialog', ReloadPage, response);
const modalfailed = ModalQuickDismiss('Failed', modalbody = 'Unable to Update User Details.<br><br>' + response, modalid = 'UpdateUserDetailsFailed', modaltohide = '', functiontodo = '', response !== true);
}
AjaxDo('/admin/user/details/update', { target_user: currenttarget, details: { mobile_number: usernumber, nickname: usernick } }, TrytoUpdateUserDetails, null, reqtype = 'POST');
};
LoadDataPageFunc.UpdateUserDetailsDialog = function () {
const usernumber = getElementhtml('User_phonenumber');
const usernick = getElementhtml('User_nick');
let modalbody = dualcolrow('Mobile Number', textformcontrol('update-m-number', '', '', placeholder = '09xxxxxxxxx', usernumber)) + '<br>' +
dualcolrow('Nickname', textformcontrol('update-nick', '', '', '', usernick));
let modalfooter = `<button type="button" class="btn btn-warning" data-dismiss="modal">Cancel</button>
<button type="button" class="btn btn-danger" onclick="LoadDataPageFunc.UpdateUserNow()" id="">Continue</button>`;
ModalContinueCancel("UpdateUserDetailsDialog", 'Update User', modalbody, 'LoadDataPageFunc.UpdateUserNow();');
// CreateAndShowModal(modalid, modaltitle, modalbody, modalfooter, modalfooterclose = false, topclosebutton = true, modalbodyclass = 'modal-body', modalheaderclass = 'modal-header');
};
LoadDataPageFunc.ResetUserPassword = function () {
let modalbody = dualcolrow('New Password', '<input type="password" class="form-control" id="reset-password-new">');
ModalContinueCancel('reset-user-password-dialog', 'Reset Password', modalbody, 'LoadDataPageFunc.ResetUserPasswordNow();', cancelbuttontext = 'Cancel', continuebuttontext = 'Reset', continuebuttoncss = 'btn btn-danger', cancelbuttoncss = 'btn btn-warning');
};
LoadDataPageFunc.OpenResetUserPasswordButtonHtml = function () { return HomeMenuButtons('assets/resetpassword.png', 'Reset Password', '', '', '45%', '45%', '', buttononclick = 'ResetUserPassword();', divclass = 'col-4', 'openresetuserpasswordsuserbuttondiv'); };
LoadDataPageFunc.ResetUserPasswordNow = function () {
if (!$('#reset-password-new').val() || $('#reset-password-new').val().trim().length < 6) {
ModalQuickDismiss('Incorrect Password Input', 'Password must be 6 characters or more.', modalid = 'modal-reset-user-password-success');
}
function ResetUserPasswordResult(response) {
if (response === true) {
ModalQuickDismiss('Password Changed', 'Password Reset Successful. Please inform user', modalid = 'modal-reset-user-password-success', modaltohide = 'reset-user-password-dialog', functiontodo = '', conditiontrue = true);
modalhide('reset-user-password-dialog');
} else {
ModalQuickDismiss('Failed', 'Password was not reset.<br><br>' + response, modalid = 'modal-reset-user-password-success', modaltohide = '', functiontodo = '', conditiontrue = true);
}
}
AjaxDo('/admin/user/password/reset', { target_user: currenttarget, user_new_password: $('#reset-password-new').val() }, ResetUserPasswordResult, null, reqtype = 'POST');
};
LoadDataPageFunc.ResetUserPassword = function () {
let modalbody = dualcolrow('New Password', '<input type="password" class="form-control" id="reset-password-new">');
ModalContinueCancel('reset-user-password-dialog', 'Reset Password', modalbody, 'LoadDataPageFunc.ResetUserPasswordNow();', cancelbuttontext = 'Cancel', continuebuttontext = 'Reset', continuebuttoncss = 'btn btn-danger', cancelbuttoncss = 'btn btn-warning');
};
LoadDataPageFunc.OpenLogoutButtonHtml = function () {
return HomeMenuButtons('assets/logout.png', 'Logout', '', '', '45%', '45%', '', buttononclick = 'OpenLogoutUser()', divclass = 'col-4', 'openlogoutuserbuttondiv', '', textclass = '');
};
LoadDataPageFunc.OpenLogoutUser = function () {
function OpenTryForceLogout(response) {
if (response) {
ModalQuickDismiss('Success', 'Session Ended.');
}
else {
ModalQuickDismiss('Failed', 'Unable to End User Session.');
}
}
let request = new RequestData(false);
request.url('/admin/logout/force/user').type('POST').fromVarCache(false).data({ target_user: currenttarget })
.success((response) => {
OpenTryForceLogout(response);
}).error((response) => {
ModalQuickDismiss('Failed', 'Unable to End User Session.');
}).go();
// AjaxDo('/admin/logout/force/user', { target_user: currenttarget }, OpenTryForceLogout, null, reqtype = 'POST');
};
LoadDataPageFunc.ChildTable = {};
LoadDataPageFunc.ChildTable.GenerateChildRow = function (Number, Total_Balance, Type, Active, parent, Hashkey) {
// console.log(Number,Total_Balance,Type,Active,Parent,Hashkey);
let activecheckbox = '';
if (Active === '1' || Active === 1 || Active === true) {
Active = LoadDataPageFunc.ActiveCheckbox;
} else { Active = LoadDataPageFunc.ActiveUNCheckbox; }
activecheckbox = Active;
let numandnick = Number;
numandnick = numandnick.replace(' ', '<br>');
numandnick = `<a href="#" onclick="gotoPage('UserModify','${Hashkey}',0,1);return false;">${numandnick}</a>`;
parent = parent.replace(/---/g, '<br>');
numandnick = numandnick.replace(/---/g, '<br>');
return `<tr>
<td>${numandnick}</td>
<td>${Total_Balance}</td>
<td>${Type}</td>
<td>${activecheckbox}</td>
<td>${parent}</td>
</tr>`;
}
LoadDataPageFunc.ChildTable.GenerateChildRows = async function (responsearray) {
//console.log(responsearray);
let newhtmltable = '';
for (let i = 0; i < responsearray.length; i++) {
newhtmltable += LoadDataPageFunc.ChildTable.GenerateChildRow(
responsearray[i]['mobile_number'],
responsearray[i]['total_balance'],
responsearray[i]['acct_type'],
responsearray[i]['active'],
responsearray[i]['parent'],
responsearray[i]['hashkey']
);
}
//$("#User_list_table").find("tbody").replaceWith(newhtmltable);
// new DataTable('#User_list_table');
$("#User_details_children_table").find("tbody").html(newhtmltable);
$('#third-card').fadeIn(200);
let userlist = $("#User_details_children_table").DataTable({
"destroy": true,
order: [[0, 'desc']],
pageLength: 5,
lengthMenu: [[5], [5]]
});
/*
userlist.on('click', 'tbody tr', function () {
let data = userlist.row(this).data();
let targettranshash = data[0];
console.log(targettranshash);
$(targettranshash).find('a').trigger('click');
});
*/
}
LoadDataPageFunc.ChildTable.GenerateChildUsersTable = function () {
if (!LoadDataPageFunc.data.children) {
AjaxDo('/user/details/children', { target_user: currenttarget }, LoadDataPageFunc.ChildTable.GenerateChildRows, null, reqtype = 'POST');
} else {
LoadDataPageFunc.ChildTable.GenerateChildRows(LoadDataPageFunc.data.children);
}
}
$(document).ready(function () {
if (!LoadDataPageFunc.data.CurrentRoles || !LoadDataPageFunc.data.AllRoles) { LoadDataPageFunc.Roles.FetchRoles(); }
LoadDataPageFunc.ChildTable.GenerateChildUsersTable();
});
</script>
<head>
<style>
</style>
</head>
<br><br><br>

View File

@@ -0,0 +1,423 @@
<html lang="en">
<script>
var InitializationFinished = false;
var PerformanceLog = {};
PerformanceLog.Start = performance.now();
PerformanceLog.Logs = [['Start'], PerformanceLog.Start];
PerformanceLog.Log = function (message) {
PerformanceLog.Logs.push([message, performance.now()]);
};
PerformanceLog.DisplayLogs = function () {
const arr = PerformanceLog.Logs;
for (let i = 0; i < arr.length; i++) {
console.log(arr[i][0], arr[i][1]);
}
};
</script>
<head>
@vite('resources/js/app.js')
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<!-- Mobile Specific Metas -->
<meta name="viewport"
content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1, viewport-fit=cover">
<title>Bukid Bounty Market</title>
@vite('resources/js/app.js')
<!-- Favicon and Touch Icons -->
<link rel="shortcut icon" href="/images/logo.png">
<link rel="apple-touch-icon-precomposed" href="/images/logo.png">
<!-- <link rel="stylesheet" href="/dist/alt-theme/fonts.css">
<link rel="stylesheet" href="/dist/alt-theme/icons-alipay.css"> -->
<link rel="stylesheet" href="/dist/alt-theme/bootstrap.css">
<!-- <link rel="stylesheet" type="text/css" href="/dist/alt-theme/styles.css"> -->
<link rel="stylesheet" media="print" onload="this.media='all'" href="/dist/css/select2.min.css">
<link rel="stylesheet"
href="/plugins/googlefonts/fonts.googleapis.com_css_familySourceSansPro300400400i700&displayfallback.css">
<link rel="stylesheet" href="/plugins/fontawesome-free/css/all.min.css">
<link rel="stylesheet" href="/dist/css/adminlte.min.css">
<link rel="stylesheet" media="print" onload="this.media='all'" href="/dist/css/dropzone.min.css">
<link rel="stylesheet" media="print" onload="this.media='all'" href="/dist/css/jquery.dataTables.min.css">
<link rel="stylesheet" type="text/css" href="/dist/alt-theme/styles.css">
<link rel="stylesheet" href="/dist/alt-theme/icons-alipay.css">
<link rel="stylesheet" href="/dist/alt-theme/fonts.css">
<link rel="stylesheet" media="print" onload="this.media='all'" href="/dist/css/splide.min.css">
<link rel="manifest" href="/manifest.json" data-pwa-version="set_in_manifest_and_pwa_js">
<link rel="apple-touch-icon" sizes="192x192" href="app/icons/icon-192x192.png">
<script src="/plugins/jquery/jquery.min.js"></script>
<script src="/plugins/bootstrap/js/bootstrap.bundle.min.js"></script>
<link rel="stylesheet" href="/dist/css/toastr.min.css" type="text/css">
<script src="/dist/js/toastr.min.js"></script>
<script src="/dist/js/adminlte.min.js"></script>
<!-- <script src="/dist/js/bower.json"></script> -->
<script defer src="/dist/js/qrcode.min.js"></script>
<script src="/synclib.js"></script>
<script src="/lib.js"></script>
<script src="/EXT/libEXT/marketlib.js"></script>
<script defer src="/dist/js/print.min.js"></script>
<script defer src="/dist/js/FileSaver.min.js"></script>
<script defer src="/dist/js/select2.min.js"></script>
<script src="/dist/js/splide.min.js"></script>
<script src="/dist/js/dropzone.min.js"></script>
<script defer src="/dist/js/jquery.dataTables.min.js"></script>
<script defer src="/dist/js/moment.min.js"></script>
<style>
.card .dark-mode {
background-color: rgb(36, 39, 44) !important;
color: #e0e0e0;
}
.modal-content .dark-mode {
background-color: rgb(36, 39, 44) !important;
color: #e0e0e0;
}
input .dark-mode {
background-color: rgb(36, 39, 44) !important;
color: #e0e0e022 !important;
}
textarea .dark-mode {
background-color: rgb(36, 39, 44) !important;
color: #e0e0e022 !important;
}
select .dark-mode {
background-color: rgb(36, 39, 44) !important;
color: #e0e0e022 !important;
}
form .dark-mode {
background-color: rgb(36, 39, 44) !important;
color: #e0e0e022 !important;
}
.tf-container .dark-mode {
background-color: #121212;
color: #e0e0e0;
/* Light gray text color */
}
body {
background-color: #ffffff;
/* Light background */
color: #000000;
/* Dark text color */
transition: background-color 0.3s, color 0.3s;
/* Smooth transition */
}
body.dark-mode {
background-color: #121212;
color: #e0e0e0;
/* Light gray text color */
}
.tf-balance-box {
background-color: #ffffff;
/* Light background */
color: #000000;
/* Dark text color */
}
.dark-mode .tf-balance-box {
background-color: inherit;
background-color: #24272c;
color: #e0e0e0;
/* Light gray text color */
}
.dark-mode .tf-statusbar {
background-color: inherit;
background-color: #24272c;
color: #e0e0e0;
/* Light gray text color */
}
.dark-mode .tf-navigation-bar {
background-color: inherit;
background-color: #24272c;
color: #e0e0e0;
/* Light gray text color */
}
.dark-mode .bottom-navigation-bar {
background-color: inherit;
background-color: #24272c;
color: #e0e0e0;
/* Light gray text color */
}
.dark-mode {
background-color: inherit;
background-color: #24272c;
color: #e0e0e0;
/* Light gray text color */
}
.dark-mode a {
color: #e0e0e0;
}
body.dark-mode h4 {
color: #ffffff;
/* White color for h3 in dark mode */
}
body.dark-mode h3 {
color: #ffffff;
/* White color for h3 in dark mode */
}
body.dark-mode h2 {
color: #ffffffc4;
/* White color for h3 in dark mode */
}
.pagination {
margin: 20px 0;
}
.pagination button {
margin: 0 5px;
padding: 5px 10px;
}
</style>
<link rel="apple-touch-icon" sizes="180x180" href="/assets/icons/ios/180.png">
<link rel="apple-touch-icon" sizes="167x167" href="/assets/icons/ios/167.png">
<link rel="apple-touch-icon" sizes="152x152" href="/assets/icons/ios/152.png">
<link rel="apple-touch-icon" sizes="120x120" href="/assets/icons/ios/120.png">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent">
<meta name="apple-mobile-web-app-title" content="Bukid Bounty Marketplace">
</head>
<style id="dynamic-css">
</style>
<body id="body-global">
<div class="header is-fixed" id="maintopbarheader">
<div class="tf-container">
<div class="tf-statusbar d-flex justify-content-center align-items-center">
<a href="javascript:void(0);" onclick="" class="back-btn" id="backbutton-top"> <i class="icon-left"></i> </a>
<h3 id="topbar-title" onclick="ReloadPage();"></h3>
<a href="javascript:void(0);" onclick="ButtonGo('account_settings');" id="btn-popup-up" class="action-right"><i
class="icon icon-filter"></i> </a>
</div>
</div>
</div>
<div id="app-wrap">
<div class="bill-content">
<br>
<div class="tf-container" id="main-body" style="padding-top: 10px;padding-bottom: 10px;">
@inertia
</div>
{{--
<script>
$('#SplashLogo').fadeIn(1000);
</script> --}}
</div>
</div>
<div class="bottom-navigation-bar">
<div class="tf-container">
<ul class="tf-navigation-bar">
<li><a class="fw_4 d-flex justify-content-center align-items-center flex-column" href=""
onclick="ButtonGo('Home',0);return false;"><i class="icon-home"></i> Home</a> </li>
<li>
<a href="" onclick="ButtonGo('CartProductMarket',0);return false;"
class="fw_4 d-flex justify-content-center align-items-center flex-column">
<img style="width: 30px;height: 30px;" src="/assets/addtocart.png" class="icon-home">
Cart
</a>
</li>
<li style="display:none;"><a class="fw_4 d-flex justify-content-center align-items-center flex-column"
href="40_qr-code.html"><i class="icon-scan-qr-code"></i> </a> </li>
<li><a href="" onclick="ButtonGo('ListProperties',0);return false;"
class="fw_4 d-flex justify-content-center align-items-center flex-column">
<img style="width: 30px;height: 30px;" src="/assets/house.png" class="icon-home">Properties</a> </li>
</ul>
<!-- <span class="line"></span> -->
</div>
</div>
<script>
if (navigator.userAgent.match('iPhone') || navigator.userAgent.match('iphone')) {
if (window.innerHeight < window.innerWidth) {
} else {
let headertopbar = document.getElementById('maintopbarheader');
if (headertopbar) {
headertopbar.style.paddingTop = "30px";
} else {
}
}
}
</script>
<script>
navigator.serviceWorker.register('/service-worker.js');
PerformanceLog.Log('Finished Loading HTML Part of StarterHMTL');
</script>
<script type="text/javascript" src="/UIALT.js"></script>
<script>
PerformanceLog.Log('Finished Loading UI ALT JS');
</script>
<script type="text/javascript" src="/dist/alt-theme/main.js"></script>
<script>
PerformanceLog.Log('Finished Loading ALT theme Main js');
</script>
<script type="text/javascript" src="/starter.js"></script>
<script type="text/javascript" src="/pageBuilder.js"></script>
<script type="text/javascript" src="/EXT/starterEXT/market.js"></script>
<script>
PerformanceLog.Log('Finished Loading Starter JS');
</script>
<style>
table {
table-layout: fixed;
width: 100%;
}
</style>
<script>
function SetNotif(title, body = '', icon = '', tag = '') {
Notification.requestPermission(function (result) { if (result === 'granted') { navigator.serviceWorker.ready.then(function (registration) { registration.showNotification(title, { body: body, icon: icon, tag: tag }); }); } });
}
function EraseAllNotif() {
Notification.requestPermission(function (result) {
if (result === 'granted') {
navigator.serviceWorker.ready.then(function (registration) {
registration.getNotifications().then(function (notifications) {
notifications.forEach(function (notification) {
notification.close();
});
});
});
}
});
}
function EraseNotifwithTag(tag) {
Notification.requestPermission(function (result) {
if (result === 'granted') {
// Replace 'specific-tag' with the tag you want to target
const specificTag = tag;
// Check if service workers are available
if ('serviceWorker' in navigator) {
navigator.serviceWorker.ready.then(function (registration) {
registration.getNotifications().then(function (notifications) {
notifications.forEach(function (notification) {
if (notification.tag === specificTag) {
notification.close();
}
});
});
});
}
}
});
}
function deepEqual(a, b) {
if (a === b) return true;
if (a == null || b == null) return false;
if (Array.isArray(a) && Array.isArray(b)) {
if (a.length !== b.length) return false;
for (let i = 0; i < a.length; i++) {
if (!deepEqual(a[i], b[i])) return false;
}
return true;
}
if (typeof a === 'object' && typeof b === 'object') {
let keysA = Object.keys(a);
let keysB = Object.keys(b);
if (keysA.length !== keysB.length) return false;
for (let key of keysA) {
if (!keysB.includes(key) || !deepEqual(a[key], b[key])) return false;
}
return true;
}
return a === b;
}
// EraseNotifwithTag('New_Winners');
//SetNotif(number_of_winners + ' Winners Today', tableHtml, 'https://mm.t677u.com/assets/drawlottery.png', 'New_Winners');
PerformanceLog.Log('Finished Everything');
// PerformanceLog.DisplayLogs();
</script>
</body>
</html>

View File

@@ -0,0 +1,428 @@
<html lang="en">
<script>
var InitializationFinished = false;
var PerformanceLog = {};
PerformanceLog.Start = performance.now();
PerformanceLog.Logs = [['Start'], PerformanceLog.Start];
PerformanceLog.Log = function (message) {
PerformanceLog.Logs.push([message, performance.now()]);
};
PerformanceLog.DisplayLogs = function () {
const arr = PerformanceLog.Logs;
for (let i = 0; i < arr.length; i++) {
console.log(arr[i][0], arr[i][1]);
}
};
</script>
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<!-- Mobile Specific Metas -->
<meta name="viewport"
content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1, viewport-fit=cover">
<title>Bukid Bounty Market</title>
<!-- Favicon and Touch Icons -->
<link rel="shortcut icon" href="/images/logo.png">
<link rel="apple-touch-icon-precomposed" href="/images/logo.png">
<!-- <link rel="stylesheet" href="/dist/alt-theme/fonts.css">
<link rel="stylesheet" href="/dist/alt-theme/icons-alipay.css"> -->
<link rel="stylesheet" href="/dist/alt-theme/bootstrap.css">
<!-- <link rel="stylesheet" type="text/css" href="/dist/alt-theme/styles.css"> -->
<link rel="stylesheet" media="print" onload="this.media='all'" href="/dist/css/select2.min.css">
<link rel="stylesheet"
href="/plugins/googlefonts/fonts.googleapis.com_css_familySourceSansPro300400400i700&displayfallback.css">
<link rel="stylesheet" href="/plugins/fontawesome-free/css/all.min.css">
<link rel="stylesheet" href="/dist/css/adminlte.min.css">
<link rel="stylesheet" media="print" onload="this.media='all'" href="/dist/css/dropzone.min.css">
<link rel="stylesheet" media="print" onload="this.media='all'" href="/dist/css/jquery.dataTables.min.css">
<link rel="stylesheet" type="text/css" href="/dist/alt-theme/styles.css">
<link rel="stylesheet" href="/dist/alt-theme/icons-alipay.css">
<link rel="stylesheet" href="/dist/alt-theme/fonts.css">
<link rel="stylesheet" media="print" onload="this.media='all'" href="/dist/css/splide.min.css">
<link rel="manifest" href="/manifest.json" data-pwa-version="set_in_manifest_and_pwa_js">
<link rel="apple-touch-icon" sizes="192x192" href="app/icons/icon-192x192.png">
<script src="/plugins/jquery/jquery.min.js"></script>
<script src="/plugins/bootstrap/js/bootstrap.bundle.min.js"></script>
<link rel="stylesheet" href="/dist/css/toastr.min.css" type="text/css">
<script src="/dist/js/toastr.min.js"></script>
<script src="/dist/js/adminlte.min.js"></script>
<!-- <script src="/dist/js/bower.json"></script> -->
<script defer src="/dist/js/qrcode.min.js"></script>
<script src="/synclib.js"></script>
<script src="/lib.js"></script>
<script src="/EXT/libEXT/marketlib.js"></script>
<script defer src="/dist/js/print.min.js"></script>
<script defer src="/dist/js/FileSaver.min.js"></script>
<script defer src="/dist/js/select2.min.js"></script>
<script src="/dist/js/splide.min.js"></script>
<script src="/dist/js/dropzone.min.js"></script>
<script defer src="/dist/js/jquery.dataTables.min.js"></script>
<script defer src="/dist/js/moment.min.js"></script>
<style>
.card .dark-mode {
background-color: rgb(36, 39, 44) !important;
color: #e0e0e0;
}
.modal-content .dark-mode {
background-color: rgb(36, 39, 44) !important;
color: #e0e0e0;
}
input .dark-mode {
background-color: rgb(36, 39, 44) !important;
color: #e0e0e022 !important;
}
textarea .dark-mode {
background-color: rgb(36, 39, 44) !important;
color: #e0e0e022 !important;
}
select .dark-mode {
background-color: rgb(36, 39, 44) !important;
color: #e0e0e022 !important;
}
form .dark-mode {
background-color: rgb(36, 39, 44) !important;
color: #e0e0e022 !important;
}
.tf-container .dark-mode {
background-color: #121212;
color: #e0e0e0;
/* Light gray text color */
}
body {
background-color: #ffffff;
/* Light background */
color: #000000;
/* Dark text color */
transition: background-color 0.3s, color 0.3s;
/* Smooth transition */
}
body.dark-mode {
background-color: #121212;
color: #e0e0e0;
/* Light gray text color */
}
.tf-balance-box {
background-color: #ffffff;
/* Light background */
color: #000000;
/* Dark text color */
}
.dark-mode .tf-balance-box {
background-color: inherit;
background-color: #24272c;
color: #e0e0e0;
/* Light gray text color */
}
.dark-mode .tf-statusbar {
background-color: inherit;
background-color: #24272c;
color: #e0e0e0;
/* Light gray text color */
}
.dark-mode .tf-navigation-bar {
background-color: inherit;
background-color: #24272c;
color: #e0e0e0;
/* Light gray text color */
}
.dark-mode .bottom-navigation-bar {
background-color: inherit;
background-color: #24272c;
color: #e0e0e0;
/* Light gray text color */
}
.dark-mode {
background-color: inherit;
background-color: #24272c;
color: #e0e0e0;
/* Light gray text color */
}
.dark-mode a {
color: #e0e0e0;
}
body.dark-mode h4 {
color: #ffffff;
/* White color for h3 in dark mode */
}
body.dark-mode h3 {
color: #ffffff;
/* White color for h3 in dark mode */
}
body.dark-mode h2 {
color: #ffffffc4;
/* White color for h3 in dark mode */
}
.pagination {
margin: 20px 0;
}
.pagination button {
margin: 0 5px;
padding: 5px 10px;
}
</style>
<link rel="apple-touch-icon" sizes="180x180" href="/assets/icons/ios/180.png">
<link rel="apple-touch-icon" sizes="167x167" href="/assets/icons/ios/167.png">
<link rel="apple-touch-icon" sizes="152x152" href="/assets/icons/ios/152.png">
<link rel="apple-touch-icon" sizes="120x120" href="/assets/icons/ios/120.png">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent">
<meta name="apple-mobile-web-app-title" content="Bukid Bounty Marketplace">
</head>
<body id="body-global">
<div class="header is-fixed" id="maintopbarheader">
<div class="tf-container">
<div class="tf-statusbar d-flex justify-content-center align-items-center">
<a href="javascript:void(0);" onclick="" class="back-btn" id="backbutton-top"> <i class="icon-left"></i> </a>
<h3 id="topbar-title" onclick="ReloadPage();">@yield('title_bar')</h3>
<a href="javascript:void(0);" onclick="ButtonGo('account_settings');" id="btn-popup-up" class="action-right"><i
class="icon icon-filter"></i> </a>
</div>
</div>
</div>
<div id="app-wrap">
<div class="bill-content">
<br>
<div class="tf-container" id="main-body" style="padding-top: 10px;padding-bottom: 10px;">
@hasSection('body')
@yield('body')
@elseif(!empty($body))
{!! $body !!}
@else
@include('layouts.partials.default.splash')
@endif
</div>
<script>
$('#SplashLogo').fadeIn(1000);
</script>
</div>
</div>
<div class="bottom-navigation-bar">
<div class="tf-container">
<ul class="tf-navigation-bar" id="main-nav-bar">
{{-- @yield('nav_bar_content',view('layouts.navi-content')->render()) --}}
@hasSection('nav_bar_content')
@yield('nav_bar_content')
@elseif(!empty($nav_bar_content))
{!! $nav_bar_content !!}
@else
@include('layouts.partials.default.navigationbar')
@endif
</ul>
<!-- <span class="line"></span> -->
</div>
</div>
<script>
const navbar = document.getElementById('main-nav-bar');
if (navbar && navbar.innerHTML === '') {
$('#main-nav-bar').load('/Components/NavBar/Main');
}
if (navigator.userAgent.match('iPhone') || navigator.userAgent.match('iphone')) {
if (window.innerHeight < window.innerWidth) {
} else {
let headertopbar = document.getElementById('maintopbarheader');
if (headertopbar) {
headertopbar.style.paddingTop = "30px";
} else {
}
}
}
</script>
<script>
const isthisLocalhost = ['localhost', '127.0.0.1', '::1'].includes(location.hostname);
if (!window.isSecureContext && !isthisLocalhost) {
console.info('Skipping service worker registration: insecure context', location.href);
return;
} else {
navigator.serviceWorker.register('/service-worker.js');
}
PerformanceLog.Log('Finished Loading HTML Part of StarterHMTL');
</script>
<script type="text/javascript" src="/UIALT.js"></script>
<script>
PerformanceLog.Log('Finished Loading UI ALT JS');
</script>
<script type="text/javascript" src="/dist/alt-theme/main.js"></script>
<script>
PerformanceLog.Log('Finished Loading ALT theme Main js');
</script>
<script type="text/javascript" src="/starter.js"></script>
<script type="text/javascript" src="/EXT/starterEXT/market.js"></script>
<script>
PerformanceLog.Log('Finished Loading Starter JS');
</script>
<style>
table {
table-layout: fixed;
width: 100%;
}
</style>
<script>
function SetNotif(title, body = '', icon = '', tag = '') {
Notification.requestPermission(function (result) { if (result === 'granted') { navigator.serviceWorker.ready.then(function (registration) { registration.showNotification(title, { body: body, icon: icon, tag: tag }); }); } });
}
function EraseAllNotif() {
Notification.requestPermission(function (result) {
if (result === 'granted') {
navigator.serviceWorker.ready.then(function (registration) {
registration.getNotifications().then(function (notifications) {
notifications.forEach(function (notification) {
notification.close();
});
});
});
}
});
}
function EraseNotifwithTag(tag) {
Notification.requestPermission(function (result) {
if (result === 'granted') {
// Replace 'specific-tag' with the tag you want to target
const specificTag = tag;
// Check if service workers are available
if ('serviceWorker' in navigator) {
navigator.serviceWorker.ready.then(function (registration) {
registration.getNotifications().then(function (notifications) {
notifications.forEach(function (notification) {
if (notification.tag === specificTag) {
notification.close();
}
});
});
});
}
}
});
}
function deepEqual(a, b) {
if (a === b) return true;
if (a == null || b == null) return false;
if (Array.isArray(a) && Array.isArray(b)) {
if (a.length !== b.length) return false;
for (let i = 0; i < a.length; i++) {
if (!deepEqual(a[i], b[i])) return false;
}
return true;
}
if (typeof a === 'object' && typeof b === 'object') {
let keysA = Object.keys(a);
let keysB = Object.keys(b);
if (keysA.length !== keysB.length) return false;
for (let key of keysA) {
if (!keysB.includes(key) || !deepEqual(a[key], b[key])) return false;
}
return true;
}
return a === b;
}
@hasSection('final_scripts')
@yield('final_scripts')
@elseif(!empty($final_scripts))
{!! $final_scripts !!}
@endif
// EraseNotifwithTag('New_Transaction');
//SetNotif(number_of_transactions + ' Orders Today', tableHtml, 'https://mq.hesed.sbs/assets/checkicon.png', 'New_Transaction');
PerformanceLog.Log('Finished Everything');
// PerformanceLog.DisplayLogs();
</script>
</body>
</html>

View File

@@ -0,0 +1,13 @@
<li><a class="fw_4 d-flex justify-content-center align-items-center flex-column" href=""
onclick="ButtonGo('Home',0);return false;"><i class="icon-home"></i> Home</a> </li>
<li>
<a href="" onclick="ButtonGo('CartProductMarket',0);return false;"
class="fw_4 d-flex justify-content-center align-items-center flex-column">
<img style="width: 30px;height: 30px;" src="/assets/addtocart.png" class="icon-home">
Cart
</a> </li>
<li style="display:none;"><a class="fw_4 d-flex justify-content-center align-items-center flex-column"
href="40_qr-code.html"><i class="icon-scan-qr-code"></i> </a> </li>
<li><a href="" onclick="ButtonGo('ListProperties',0);return false;"
class="fw_4 d-flex justify-content-center align-items-center flex-column">
<img style="width: 30px;height: 30px;" src="/assets/house.png" class="icon-home">Properties</a> </li>

View File

@@ -0,0 +1,10 @@
<br><br>
<center id="SplashLogo" style="display:none;">
<br>
<br><br>
<img src="/assets/mainlogo.png" style="width: 300;height: 300px;" class="text-center align-items-center">
</center>

View File

@@ -0,0 +1,520 @@
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="robots" content="noindex, nofollow">
<title></title>
<link rel="preload" href="/dist/css/bootstrap.min.css" as="style">
<link rel="preload" href="/dist/css/adminlte.min.css" as="style">
<link rel="preload" href="/dist/css/jquery.dataTables.min.css" as="style">
<link rel="preload" href="/dist/css/print.min.css" as="style">
<link rel="preload" href="/dist/css/select2.min.css" as="style">
<link rel="preload" href="/dist/css/toastr.min.css" as="style">
<link rel="preload" href="/dist/alt-theme/styles.css" as="style">
<link rel="preload" href="/assets/user-list.png" as="image">
<link rel="preload" href="/assets/NewLeads.png" as="image">
<link rel="preload" href="/assets/ListLeads.png" as="image">
<link rel="preload" href="https://fonts.gstatic.com/s/plusjakartasans/v7/LDIoaomQNQcsA88c7O9yZ4KMCoOg4Ko20yw.woff2"
as="font">
<link rel="preload" href="/dist/alt-theme/icons-alipay.css" as="style">
<link rel="preload" href="/dist/alt-theme/fonts.css" as="style">
<link rel="stylesheet"
href="/plugins/googlefonts/fonts.googleapis.com_css_familySourceSansPro300400400i700&amp;displayfallback.css">
<link rel="stylesheet" href="/plugins/fontawesome-free/css/all.min.css">
<link rel="preload" href="/plugins/jquery/jquery.min.js" as="script">
<style>
/* Basic reset and body styling */
body,
html {
margin: 0;
padding: 0;
font-family: Arial, sans-serif;
background-color: #f4f4f4;
height: 100%;
width: 100%;
}
/* Centering the container */
.login-container {
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
padding: 20px;
box-sizing: border-box;
}
.login-card-body {
max-width: 400px;
width: 100%;
padding: 20px;
border-radius: 10px;
background-color: #ffffff;
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
box-sizing: border-box;
}
.login-box-msg {
font-size: 1.5rem;
margin-bottom: 20px;
text-align: center;
color: #333;
}
.form-group {
margin-bottom: 15px;
}
.form-control {
width: 100%;
padding: 12px;
border: 1px solid #ced4da;
border-radius: 5px;
font-size: 1rem;
box-sizing: border-box;
}
.input-group {
display: flex;
flex-direction: column;
}
.custom-control {
display: flex;
align-items: center;
margin-bottom: 10px;
}
.custom-control-input {
position: relative;
width: 1.5rem;
height: 1.5rem;
margin-right: 10px;
cursor: pointer;
appearance: none;
border: 1px solid #ced4da;
border-radius: 0.25rem;
background: #ffffff;
transition: background-color 0.3s, border-color 0.3s;
}
.custom-control-input:checked {
background-color: #007bff;
border-color: #007bff;
}
.custom-control-input:checked::before {
content: '';
display: block;
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
width: 0.75rem;
height: 0.75rem;
background: #ffffff;
border-radius: 0.25rem;
}
.custom-control-label {
margin: 0;
font-size: 0.875rem;
color: #333;
}
.btn-primary {
display: block;
width: 100%;
padding: 12px;
border: none;
border-radius: 5px;
background-color: #007bff;
color: #ffffff;
font-size: 1rem;
cursor: pointer;
transition: background-color 0.3s;
}
.btn-primary:hover {
background-color: #0056b3;
}
/* Responsive Design */
@media (max-width: 480px) {
.login-card-body {
padding: 15px;
}
.form-control {
font-size: 0.875rem;
padding: 10px;
}
.btn-primary {
font-size: 0.875rem;
padding: 10px;
}
.login-box-msg {
font-size: 1.25rem;
}
}
body,
html {
margin: 0;
padding: 0;
font-family: Arial, sans-serif;
background-color: #f4f4f4;
height: 100%;
width: 100%;
display: flex;
justify-content: center;
align-items: center;
}
/* Centering the card */
.login-container {
max-width: 400px;
width: 100%;
padding: 20px;
border-radius: 10px;
background-color: #ffffff;
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
box-sizing: border-box;
margin: 0;
/* Ensure visibility */
position: relative;
}
.login-box-msg {
font-size: 1.5rem;
margin-bottom: 20px;
text-align: center;
color: #333;
}
.form-group {
margin-bottom: 15px;
}
.form-control {
width: 100%;
padding: 12px;
border: 1px solid #ced4da;
border-radius: 5px;
font-size: 1rem;
box-sizing: border-box;
}
.custom-control {
display: flex;
align-items: center;
margin-bottom: 10px;
}
.custom-control-input {
position: relative;
width: 1.5rem;
height: 1.5rem;
margin-right: 10px;
cursor: pointer;
appearance: none;
border: 1px solid #ced4da;
border-radius: 0.25rem;
background: #ffffff;
transition: background-color 0.3s, border-color 0.3s;
}
.custom-control-input:checked {
background-color: #007bff;
border-color: #007bff;
}
.custom-control-input:checked::before {
content: '';
display: block;
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
width: 0.75rem;
height: 0.75rem;
background: #ffffff;
border-radius: 0.25rem;
}
.custom-control-label {
margin: 0;
font-size: 0.875rem;
color: #333;
}
.btn-primary {
display: block;
width: 100%;
padding: 12px;
border: none;
border-radius: 5px;
background-color: #007bff;
color: #ffffff;
font-size: 1rem;
cursor: pointer;
transition: background-color 0.3s;
}
.btn-primary:hover {
background-color: #0056b3;
}
/* Responsive Design */
@media (max-width: 480px) {
.login-container {
padding: 15px;
}
.form-control {
font-size: 0.875rem;
padding: 10px;
}
.btn-primary {
font-size: 0.875rem;
padding: 10px;
}
.login-box-msg {
font-size: 1.25rem;
}
}
</style>
<link rel="stylesheet" href="/dist/css/toastr.min.css">
</head>
<body class="login-page">
<div class="card">
<div class="card-body login-card-body">
<p class="login-box-msg">
<div class="login-box">
<div class="login-logo">
<center><b>Bukid Bounty</b>Marketplace</center>
</div>
</p>
<form action="?loginnow" method="post">
<div class="input-group mb-3">
<input type="number" id="usernumber" class="form-control" placeholder="Mobile Number"
name="usernumber">
<div class="input-group-append">
<div class="input-group-text">
</div>
</div>
</div>
<br>
<div class="input-group mb-3">
<input type="password" class="form-control" placeholder="Password" id="userpassword"
name="userpassword">
<div class="input-group-append">
<div class="input-group-text">
</div>
</div>
</div>
<br>
<br>
{{-- <div class="input-group mb-3">
<div class="custom-control custom-checkbox">
<input type="checkbox" class="custom-control-input" id="keep-alive">
<label class="custom-control-label" for="keep-alive">Keep Me Signed-In</label>
</div>
</div> --}}
<button type="button" class="btn btn-primary btn-block" id="loginbutton">Sign In</button>
</form>
</div>
</div>
</div>
<div class="modal fade" id="modal-incorrect-password" style="display: none;" aria-modal="true" role="dialog">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title">Unable to Login</h4>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
</div>
<div class="modal-body">
<p>Incorrect Username or Password</p>
</div>
<div class="modal-footer justify-content-between">
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
</div>
</div>
</div>
</div>
<script src="/plugins/jquery/jquery.min.js"></script>
<script src="/dist/js/toastr.min.js"></script>
<script>
$("#loginbutton").click(function () {
let usernumber = $("#usernumber").val();
let userpassword = $("#userpassword").val();
// let keepalive = $('#keep-alive').is(':checked');
$.ajax({
url: "/post/loginnow",
type: "POST",
data: {
mobile_number: usernumber,
password: userpassword,
// keepalive: keepalive
},
xhrFields: {
withCredentials: true
},
success: function (response) {
// console.log(response);
if (response.success === false) {
toastr.error(response.message || 'Incorrect Username or Password');
$("#usernumber").val("");
$("#userpassword").val("");
} else {
window.location.href='/';
}
},
error: function (jqXHR, textStatus, errorThrown) {
// console.error(jqXHR);
// console.error(textStatus);
// console.error(errorThrown);
toastr.error(jqXHR.responseJSON?.message || 'An unknown error occurred.');
}
});
});
$(document).on('keypress', function (event) {
let keycode = (event.keyCode ? event.keyCode : event.which);
if (keycode == '13') {
$("#loginbutton").click();
}
});
function getCookie(name) {
const value = `; ${document.cookie}`;
const parts = value.split(`; ${name}=`);
if (parts.length === 2) return parts.pop().split(';').shift();
return null;
}
function getCurrentSession() {
return getCookie('SESSID');
}
function trysessioncookie() {
let currentsession = getCurrentSession();
if (!currentsession) { return false; }
}
/*
if ('serviceWorker' in navigator) {
window.addEventListener('load', () => {
navigator.serviceWorker.register('service-worker.js')
.then(registration => {
console.log('Service Worker registered:', registration);
if (navigator.serviceWorker.controller) {
// console.log('Service Worker is controlling the page');
navigator.serviceWorker.controller.postMessage({
type: 'INIT'
});
} else {
console.log('Service Worker is not controlling the page');
}
navigator.serviceWorker.addEventListener('message', event => {
// console.log('Message received from Service Worker:', event.data);
// alert(event);
});
})
.catch(error => {
// console.error('Service Worker registration failed:', error);
});
});
}
*/
if ('serviceWorker' in navigator) {
console.log('Trying to Unregister Service Worker');
navigator.serviceWorker.getRegistrations().then(function (registrations) {
for (let registration of registrations) {
console.log('registrations detected');
registration.unregister().then(function (boolean) {
if (boolean) {
console.log('Service worker unregistered:', registration);
} else {
console.log('Service worker could not be unregistered:', registration);
}
});
}
}).catch(function (error) {
console.error('Error while unregistering service workers:', error);
});
}
</script>
</body>
</html>

View File

@@ -0,0 +1,25 @@
@extends('layouts.main')
@section ('title_bar')
@yield('title');
@endsection
@section('body')
@yield('body')
@endsection
@section('nav_bar_content')
<li><a class="fw_4 d-flex justify-content-center align-items-center flex-column" href=""
onclick="ButtonGo('Home',0);return false;"><i class="icon-home"></i> Home</a> </li>
<li>
<a href="" onclick="ButtonGo('CartProductMarket',0);return false;"
class="fw_4 d-flex justify-content-center align-items-center flex-column">
<img style="width: 30px;height: 30px;" src="/assets/addtocart.png" class="icon-home">
Cart
</a> </li>
<li style="display:none;"><a class="fw_4 d-flex justify-content-center align-items-center flex-column"
href="40_qr-code.html"><i class="icon-scan-qr-code"></i> </a> </li>
<li><a href="" onclick="ButtonGo('ListProperties',0);return false;"
class="fw_4 d-flex justify-content-center align-items-center flex-column">
<img style="width: 30px;height: 30px;" src="/assets/house.png" class="icon-home">Properties</a> </li>
@endsection

View File

@@ -0,0 +1,78 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Hypervel</title>
<style>
html,
body {
background-color: #fff;
color: #636b6f;
font-family: 'Nunito', sans-serif;
font-weight: 200;
height: 100vh;
margin: 0;
}
.full-height {
height: 100vh;
}
.flex-center {
align-items: center;
display: flex;
justify-content: center;
}
.position-ref {
position: relative;
}
.top-right {
position: absolute;
right: 10px;
top: 18px;
}
.content {
text-align: center;
}
.title {
font-size: 84px;
}
.links>a {
color: #636b6f;
padding: 0 25px;
font-size: 13px;
font-weight: 600;
letter-spacing: .1rem;
text-decoration: none;
text-transform: uppercase;
}
.m-b-md {
margin-bottom: 30px;
}
</style>
</head>
<body>
<div class="flex-center position-ref full-height">
<div class="content">
<div class="title m-b-md">
Hypervel
</div>
<div class="links">
<a href="https://hypervel.org" target="_blank">Hypervel</a>
<a href="https://github.com/hypervel/hypervel" target="_blank">GitHub</a>
</div>
</div>
</div>
</body>
</html>