initial: bootstrap from BukidBountyApp base
This commit is contained in:
@@ -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>
|
||||
@@ -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>
|
||||
@@ -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>
|
||||
@@ -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>
|
||||
Reference in New Issue
Block a user