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

View File

@@ -0,0 +1,259 @@
<style>
.ListRowCard {
margin-bottom: 20px;
}
</style>
<div id='ListMainContainer'>
</div>
<script>
LoadDataPageFunc = {};
LoadDataPageFunc.URLs = {};
LoadDataPageFunc.URLs.QueryListData = '/ListStores/List/data';
LoadDataPageFunc.Settings = {};
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 () {
let request = new RequestData(true);
request
.url(LoadDataPageFunc.URLs.QueryListData)
.type(LoadDataPageFunc.Settings.DefaultRequestType)
.data(null)
.fromVarCache(LoadDataPageFunc.Settings.fromVarCache)
.success((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('');
$('#' + LoadDataPageFunc.ids.ListContainer).html(newhtmlrows);
const imgclassname = 'StoreListIMGIcon';
LoadPhotoIMGTargetClass(imgclassname, settodisplaylater = true);
HideBrokenPhotowithClass(imgclassname);
LoadDataPageFunc.CardResultInterSectionPreloadDetails();
})
.error((err) => {
console.error(err);
})
.go();
};
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();
LoadDataPageFunc.populatelist();
changeTopbarTitle(LoadDataPageFunc.Settings.PageName);
LoadDataPageFunc.SearchKeyUPListPage();
$('#imgspan' + LoadDataPageFunc.ids.SearchInput).attr('onclick', 'LoadDataPageFunc.ClearSearch();');
// $('#ListLeads_Search-div-mb3').addClass('tf-statusbar');
});
</script>

View File

@@ -0,0 +1,145 @@
<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 submitbutton = UIInputGroupButton('Submit', formclass, buttonid = '', onclick = 'LoadDataPageFunc.TryToSubmit();', buttonstyle = '');
finalhtml = name + description + category + categorydatalist+ address + photoscontainer + 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.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();
changeTopbarTitle(LoadDataPageFunc.PageTitle);
};
LoadDataPageFunc.Main();

View File

View File

@@ -0,0 +1,209 @@
<style>
.ListRowCard {
margin-bottom: 5px;
}
</style>
<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">
</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>
</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">
content
</UI>
</div>
</div>
</div>
<script>
LoadDataPageFunc = {};
LoadDataPageFunc.PageTitle = 'Store Details';
LoadDataPageFunc.MainDetailsURL = '';
LoadDataPageFunc.Details = {};
LoadDataPageFunc.Settings = {};
LoadDataPageFunc.Disabled = false;
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.price || '';
let photo = object.photourl || '';
const unit = object.unitname || '';
if(!hash){return '';}
if (typeof photo ==='array'){
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}">${colinner}</div>`;
}
/* html */
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>P${price} / ${unit}</h6></div></div>`;
const maincolstyle='';
return newcol(`<center onclick="gotoPage('BuyViewProductMarket','${hash}')">`+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;
if (!currenttarget){LoadDataPageFunc.StoreLoadErrorModal();}
const UpdateDetailsUI = function (response) {
if (!response) {
LoadDataPageFunc.StoreLoadErrorModal();
return false;
}
Preloaders.ImageList(currenttarget,LoadDataPageFunc.Settings.Phototype);
LoadPhotosCard('PhotosCard', "LoadDataPageFunc.ViewPhotosLink();", response.photourl);
LoadDataPageFunc.PopulateDetailsNow(response.name, response.description, response.address, response.category, response.subcategory, response.products);
};
Preloaders.ViewStoreinMarket(currenttarget, true, UpdateDetailsUI);
};
LoadDataPageFunc.Main = function () {
changeTopbarTitle(LoadDataPageFunc.PageTitle);
LoadDataPageFunc.PopulateDetails();
};
LoadDataPageFunc.Main();
</script>