initial: bootstrap from BukidBountyApp base
This commit is contained in:
267
legacy/pages-html/slvl/all/LeadsByProperty
Normal file
267
legacy/pages-html/slvl/all/LeadsByProperty
Normal file
@@ -0,0 +1,267 @@
|
||||
<div id='ListMainContainer'>
|
||||
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<script>
|
||||
|
||||
|
||||
|
||||
|
||||
LoadDataPageFunc = {};
|
||||
|
||||
|
||||
LoadDataPageFunc.InitializeDynamicVariables = function () {
|
||||
|
||||
LoadDataPageFunc.Settings.PageName = 'Property Leads';
|
||||
|
||||
|
||||
LoadDataPageFunc.URLs.QueryListData = '/ListLeads/ByProperty/List/data';
|
||||
|
||||
LoadDataPageFunc.Settings.CurrentTargetRequired = true;
|
||||
LoadDataPageFunc.Settings.DefaultDatatoSend = { target: currenttarget };
|
||||
|
||||
LoadDataPageFunc.Settings.ViewDetailsOnclick = function (data) {
|
||||
return `ButtonGo('ViewLeadDetails', '${data}')`;
|
||||
};
|
||||
|
||||
|
||||
|
||||
LoadDataPageFunc.NewRow = function (objectdata, rownum) {
|
||||
|
||||
let rowhtml = [];
|
||||
let Status = InttoStrDetailsFuncs.Status(objectdata.Status);
|
||||
const modified = objectdata.modified;
|
||||
const created = formatDateTimetoReadable(objectdata.created);
|
||||
const TargetViewingDate = formatDateTimetoReadable(objectdata.TargetViewingDate);
|
||||
const hashkey = objectdata.hashkey;
|
||||
const Referrer = objectdata.referral;
|
||||
const Mobile = objectdata.mobile;
|
||||
const Landline = objectdata.landline;
|
||||
const Email = objectdata.email;
|
||||
|
||||
let PushRowifnotFalse = function (variablevalue, label) {
|
||||
if (variablevalue !== false) {
|
||||
rowhtml.push(dualcolrow(label, variablevalue, rowclass = ''));
|
||||
}
|
||||
};
|
||||
|
||||
PushRowifnotFalse(modified, 'Last Activity');
|
||||
PushRowifnotFalse(created, 'Created');
|
||||
PushRowifnotFalse(Status, 'Status');
|
||||
PushRowifnotFalse(TargetViewingDate, 'Target Viewing Date');
|
||||
PushRowifnotFalse(Referrer, 'Referrer');
|
||||
PushRowifnotFalse(Mobile, 'Mobile');
|
||||
PushRowifnotFalse(Landline, 'Landline');
|
||||
PushRowifnotFalse(Email, 'Email');
|
||||
|
||||
|
||||
|
||||
|
||||
rowhtml.push('<div id="' + LoadDataPageFunc.ids.HashKeyContainer + '-' + rownum + '" style="display:none;">' + hashkey + '</div>');
|
||||
rowhtml.push(row(col('<br>' + buttonprimary('View', '', LoadDataPageFunc.Settings.ViewDetailsOnclick(hashkey), '-12', 'ListCardGoRow-' + rownum))));
|
||||
let FinalBody = rowhtml.join('');
|
||||
|
||||
return createCard(objectdata.fullname, cardid = 'ListRowCard-' + rownum, created, cardbodyid = '', FinalBody, cardbodyclassadd = 'ListCardRow');
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
LoadDataPageFunc.Settings.SortArray = function (arr) {
|
||||
return arr.sort((a, b) => new Date(b.created) - new Date(a.created));
|
||||
};
|
||||
|
||||
|
||||
};
|
||||
|
||||
LoadDataPageFunc.Settings = {};
|
||||
|
||||
LoadDataPageFunc.Settings.DefaultCardNoDetailsMessage = 'No Leads';
|
||||
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.SearchInput = 'List_Search';
|
||||
LoadDataPageFunc.ids.ListContainer = 'ListContainer';
|
||||
LoadDataPageFunc.ids.HashKeyContainer = 'ListRowCardHash';
|
||||
LoadDataPageFunc.ids.MainCardBody = 'MAINCARDBODY_LIST';
|
||||
|
||||
LoadDataPageFunc.URLs = {};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
$$$ = {};
|
||||
$$$.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.NewRow = function (DetailsObject, rownum) {
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
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(LoadDataPageFunc.Settings.DefaultDatatoSend)
|
||||
.fromVarCache(LoadDataPageFunc.Settings.fromVarCache)
|
||||
.success((response) => {
|
||||
|
||||
if (!response) {
|
||||
$('#card-body-MAINCARDBODY_LIST').html('<center>No Leads Yet</center>');
|
||||
return null;
|
||||
}
|
||||
|
||||
let List = response.List;
|
||||
//LeadsList.reverse();
|
||||
|
||||
|
||||
List = LoadDataPageFunc.Settings.SortArray(List);
|
||||
|
||||
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);
|
||||
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 () {
|
||||
|
||||
if (LoadDataPageFunc.Settings.CurrentTargetRequired && (!currenttarget || currenttarget === '0')) {
|
||||
$$$.UpdateMainContainer('<center>No Target<br><br>' + buttonprimary('View All Leads', '', "ButtonGo('ListLeads', '')") +
|
||||
'<br><br>' + buttonprimary('Home', '', "ButtonGo('Home', '')") + '</center>'); return false;
|
||||
}
|
||||
|
||||
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('Leads', FinalInnerHTML, LoadDataPageFunc.ids.MainCardBody);
|
||||
$$$.UpdateMainContainer(MainCard);
|
||||
return true;
|
||||
|
||||
};
|
||||
|
||||
$(document).ready(function () {
|
||||
|
||||
LoadDataPageFunc.InitializeDynamicVariables();
|
||||
changeTopbarTitle(LoadDataPageFunc.Settings.PageName);
|
||||
if (!LoadDataPageFunc.main()) { return false; }
|
||||
|
||||
LoadDataPageFunc.populatelist();
|
||||
|
||||
LoadDataPageFunc.SearchKeyUPListPage();
|
||||
|
||||
|
||||
$('#imgspan' + LoadDataPageFunc.ids.SearchInput).attr('onclick', 'LoadDataPageFunc.ClearSearch();');
|
||||
|
||||
|
||||
|
||||
// $('#ListLeads_Search-div-mb3').addClass('tf-statusbar');
|
||||
|
||||
});
|
||||
</script>
|
||||
152
legacy/pages-html/slvl/all/ListLeads
Normal file
152
legacy/pages-html/slvl/all/ListLeads
Normal file
@@ -0,0 +1,152 @@
|
||||
<div id='ListLeadsMainContainer'>
|
||||
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<script>
|
||||
|
||||
|
||||
LoadDataPageFunc = {};
|
||||
LoadDataPageFunc.newleadrow = function (hashkey, LeadName, DateCreated, DateModified, Referrer, TargetViewingDate, Status, Mobile, Landline, Email, TargetProperty,rownum) {
|
||||
let leadrowhtml=[];
|
||||
Status = InttoStrDetailsFuncs.Status(Status);
|
||||
|
||||
|
||||
leadrowhtml.push(dualcolrow('Last Activity', formatDateTimetoReadable(DateModified), rowclass = ''));
|
||||
leadrowhtml.push(dualcolrow('Status', Status, rowclass = ''));
|
||||
leadrowhtml.push(dualcolrow('Referrer', Referrer, rowclass = ''));
|
||||
leadrowhtml.push(dualcolrow('Target Property', TargetProperty, rowclass = ''));
|
||||
leadrowhtml.push(dualcolrow('Target Viewing Date', formatDateTimetoReadable(TargetViewingDate), rowclass = ''));
|
||||
leadrowhtml.push(dualcolrow('Mobile', Mobile, rowclass = ''));
|
||||
leadrowhtml.push(dualcolrow('Landline', Landline || '', rowclass = ''));
|
||||
leadrowhtml.push(dualcolrow('Email', Email, rowclass = ''));
|
||||
leadrowhtml.push('<div id="LeadsListRowCardHash-'+rownum+'" style="display:none;">'+hashkey+'</div>');
|
||||
leadrowhtml.push(row(col('<br>'+buttonprimary('View Details', '', `ButtonGo('ViewLeadDetails', '${hashkey}')`, '-12','ListLeadGoRow-'+rownum))));
|
||||
let FinalBody = leadrowhtml.join('');
|
||||
|
||||
return createCard(LeadName, cardid = 'LeadRowCard-'+rownum, formatDateTimetoReadable(DateCreated), cardbodyid = '', FinalBody, cardbodyclassadd = 'ListLeadRow');
|
||||
};
|
||||
|
||||
|
||||
|
||||
LoadDataPageFunc.main = function () {
|
||||
const searchcard = UIInputGroup('Search', 'text', 'ListLeads_Search','',classs='',span='','/assets/clear.png');
|
||||
let LeadsListContainer = UICardSimple('', 'Loading Please Wait...', 'LeadsListContainer');
|
||||
LeadsListContainer = '<div id="LeadsListContainer"><center>Loading Please Wait...</center></div>';
|
||||
const FinalInnerHTML = searchcard + LeadsListContainer;
|
||||
const MainCard = UICardSimple('Leads', FinalInnerHTML,'MAINCARDBODY_LEADSLIST');
|
||||
$('#ListLeadsMainContainer').html(MainCard);
|
||||
|
||||
};
|
||||
|
||||
LoadDataPageFunc.ClearSearch=function(){
|
||||
$('#ListLeads_Search').val('');
|
||||
$('#ListLeads_Search').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 = 'LeadsListRowCardHash-' + 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 });
|
||||
|
||||
|
||||
$('#LeadsListContainer .card').each(function() {
|
||||
observer.observe(this);
|
||||
});
|
||||
};
|
||||
|
||||
LoadDataPageFunc.populateleadlist = function () {
|
||||
let request = new RequestData(true);
|
||||
request
|
||||
.url('/ListLeads/List/data')
|
||||
.type('POST')
|
||||
.data(null)
|
||||
.fromVarCache(true)
|
||||
.success((response) => {
|
||||
if ($('#card-body-MAINCARDBODY_LEADSLIST').length ===0){return false;}
|
||||
if(!response){
|
||||
$('#card-body-MAINCARDBODY_LEADSLIST').html('No Leads');
|
||||
return;
|
||||
}
|
||||
|
||||
const LeadsList = response.List;
|
||||
//LeadsList.reverse();
|
||||
LeadsList.sort((a, b) => new Date(b.created) - new Date(a.created));
|
||||
let newhtmlrows = '';let htmlarrayrows=[];
|
||||
const count = LeadsList.length;
|
||||
let hashkey;
|
||||
|
||||
|
||||
for (let i = 0; i < count; i++) {
|
||||
let hashkey =LeadsList[i]['hashkey'];
|
||||
htmlarrayrows.push(LoadDataPageFunc.newleadrow(hashkey,LeadsList[i]['fullname'],LeadsList[i]['created'],
|
||||
LeadsList[i]['modified'],LeadsList[i]['referral'],LeadsList[i]['target_viewing_date'],LeadsList[i]['status'],
|
||||
LeadsList[i]['mobile'],LeadsList[i]['landline'],LeadsList[i]['email'],LeadsList[i]['property_name'],i));
|
||||
}
|
||||
|
||||
newhtmlrows = htmlarrayrows.join('');
|
||||
$('#LeadsListContainer').html(newhtmlrows);
|
||||
LoadDataPageFunc.CardResultInterSectionPreloadDetails();
|
||||
})
|
||||
.error((err) => {
|
||||
console.error(err);
|
||||
})
|
||||
.go();
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
function SearchKeyUPListLeadsPage(){
|
||||
$('#ListLeads_Search').on('keyup', function() {
|
||||
|
||||
let searchTerm = $(this).val().toLowerCase();
|
||||
|
||||
$('#LeadsListContainer .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();
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
$(document).ready(function () {
|
||||
LoadDataPageFunc.main();
|
||||
LoadDataPageFunc.populateleadlist();
|
||||
changeTopbarTitle('Leads');
|
||||
SearchKeyUPListLeadsPage();
|
||||
|
||||
|
||||
$('#imgspanListLeads_Search').attr('onclick', 'LoadDataPageFunc.ClearSearch();');
|
||||
|
||||
|
||||
|
||||
// $('#ListLeads_Search-div-mb3').addClass('tf-statusbar');
|
||||
|
||||
});
|
||||
</script>
|
||||
267
legacy/pages-html/slvl/all/ListProperties
Normal file
267
legacy/pages-html/slvl/all/ListProperties
Normal file
@@ -0,0 +1,267 @@
|
||||
<style>
|
||||
.ListPropertyRowCard {
|
||||
margin-bottom: 20px; /* Adjust this value to increase or decrease space between cards */
|
||||
}
|
||||
</style>
|
||||
<div id='ListPropertiesMainContainer'>
|
||||
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<br><br><br>
|
||||
<script>
|
||||
|
||||
|
||||
LoadDataPageFunc = {};
|
||||
LoadDataPageFunc.newpropertyrow = function (objrow, rownum) {
|
||||
let rows = [];
|
||||
let rowcoldetail = '';
|
||||
let firstimagesrc = '/assets/no-image.png';
|
||||
const imgwidth = '200px'; const imgheight = "200px";
|
||||
const hash = objrow.hashkey || false;
|
||||
if (!objrow || !hash) { rowcoldetail = 'No Data'; return createCard('Unknown', cardid = 'PropertyRowCard-' + rownum, '', cardbodyid = '', rowcoldetail, cardbodyclassadd = 'ListPropertyRow',true,'ListPropertyRowCard'); }
|
||||
|
||||
let created = objrow.created || false;
|
||||
let modified = objrow.modified || false;
|
||||
let name = objrow.name || false;
|
||||
let description = objrow.description || false;
|
||||
let status = objrow.status || false;
|
||||
let remarks = objrow.remarks || false;
|
||||
let referralid = objrow.referralid || false;
|
||||
let createdby = objrow.createdby || false;
|
||||
let category = objrow.category || '';
|
||||
let subcategory = objrow.subcategory || '';
|
||||
let photourl = objrow.photourl || false;
|
||||
let sqm = objrow.sqm || false;
|
||||
let bedrooms = objrow.bedrooms || false;
|
||||
let rooms = objrow.rooms || false;
|
||||
let toilet = objrow.toilet || false;
|
||||
|
||||
let kitchen = objrow.kitchen || false;
|
||||
let floors = objrow.floors || false;
|
||||
let price = objrow.price || false;
|
||||
let specs = objrow.specs || false;
|
||||
let location = objrow.location || false
|
||||
|
||||
status = InttoStrDetailsFuncs.PropertyStatus(status);
|
||||
modified = formatDateTimetoReadable(modified);
|
||||
created = formatDateTimetoReadable(created);
|
||||
|
||||
let photobinarystring = '';
|
||||
let base64string = '';
|
||||
let blob;
|
||||
|
||||
try { photourl = JSON.parse(photourl); } catch (e) { photourl = photourl; }
|
||||
|
||||
if (photourl) { if (Array.isArray(photourl)) { photourl = photourl[0]; } else { } }
|
||||
let photohash =photourl;
|
||||
|
||||
if (photourl) { photourl = '/RequestData/File/' + photourl; }
|
||||
|
||||
|
||||
/*
|
||||
photobinarystring = reqcacheload(photourl);
|
||||
if (photobinarystring) {
|
||||
blob = binaryStringToBlob(photobinarystring);
|
||||
console.log('blob ',blob);
|
||||
if (blob){
|
||||
photourl = CreateObjectURLfrombinaryStringforIMGUse(photobinarystring);
|
||||
console.log(photourl);
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
let photoelementID='PropertyRowCard-Image-'+ rownum;
|
||||
photoblob = reqcacheload(photourl);
|
||||
if (photoblob) {
|
||||
photourl = URL.createObjectURL(photoblob);
|
||||
}else{
|
||||
LoadAndCreateURLfromFileHash(photohash).then(bloburl => {
|
||||
$('#'+photoelementID).attr('src', bloburl);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
rows.push(`<div class="col-12"><center><a href="javascript:void(0);return;" onclick="ButtonGo('${'ViewPropertyDetails'}', '${hash}')"><img id="${photoelementID}" src="` + photourl + '" style="width:' + imgwidth + '; height:' + imgheight + ';"></a></center>');
|
||||
rows.push('<br>');
|
||||
rows.push('<div class="col">');
|
||||
|
||||
|
||||
|
||||
if (modified !== false) {
|
||||
rows.push(dualcolrow('Last Activity', modified, rowclass = ''));
|
||||
}
|
||||
|
||||
if (status !== false) {
|
||||
rows.push(dualcolrow('Status', status, rowclass = ''));
|
||||
}
|
||||
|
||||
if (location !== false) {
|
||||
rows.push(dualcolrow('Location', location, rowclass = ''));
|
||||
}
|
||||
|
||||
if (createdby !== false) {
|
||||
rows.push(dualcolrow('Filled By', createdby, rowclass = ''));
|
||||
}
|
||||
|
||||
if (subcategory !== false) {
|
||||
rows.push(dualcolrow(category, subcategory, rowclass = ''));
|
||||
}
|
||||
|
||||
if (sqm !== false) {
|
||||
rows.push(dualcolrow('Size', sqm + ' sqm', rowclass = ''));
|
||||
}
|
||||
|
||||
if (bedrooms !== false) {
|
||||
rows.push(dualcolrow('Bedrooms', bedrooms, rowclass = ''));
|
||||
}
|
||||
|
||||
if (rooms !== false) {
|
||||
rows.push(dualcolrow('Rooms', rooms, rowclass = ''));
|
||||
}
|
||||
|
||||
if (toilet !== false) {
|
||||
rows.push(dualcolrow('Toilet', toilet, rowclass = ''));
|
||||
}
|
||||
|
||||
if (kitchen !== false) {
|
||||
rows.push(dualcolrow('Kitchen', kitchen));
|
||||
}
|
||||
if (floors !== false) {
|
||||
rows.push(dualcolrow('Floors', floors));
|
||||
}
|
||||
if (price !== false) {
|
||||
rows.push(dualcolrow('Price', price));
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
rows.push('<div id="PropertyListRowCardHash-' + rownum + '" style="display:none;">' + hash + '</div>');
|
||||
|
||||
|
||||
if (description !== false) {
|
||||
rows.push('<br><div class="row">' + col('<center>Description</center>', '-12'));
|
||||
rows.push(col('<textarea>' + description + '</textarea>', '-12') + '</div>');
|
||||
}
|
||||
|
||||
rows.push('</div></div>');
|
||||
|
||||
rows.push(row(col('<br>' + buttonprimary('View Details', '', `ButtonGo('ViewPropertyDetails', '${hash}')`, '-12', 'ListPropertyGoRow-' + rownum))));
|
||||
let FinalBody = rows.join('');
|
||||
|
||||
return createCard(name, cardid = 'PropertyRowCard-' + rownum, created, cardbodyid = '', FinalBody, cardbodyclassadd = 'ListPropertyRow','',false,'ListPropertyRowCard');
|
||||
};
|
||||
|
||||
|
||||
|
||||
LoadDataPageFunc.main = function () {
|
||||
const searchcard = UIInputGroup('Search', 'text', 'ListProperty_Search', '', classs = '', span = '', '/assets/clear.png');
|
||||
// let PropertyListContainer = UICardSimple('', 'Loading Please Wait...', 'PropertyListContainer');
|
||||
let PropertyListContainer = '<div id="PropertyListContainer"><center>Loading Please Wait...</center></div>';
|
||||
const FinalInnerHTML = searchcard + PropertyListContainer;
|
||||
const MainCard = UICardSimple('Properties', FinalInnerHTML, 'MAINCARDBODY_PROPERTYLIST');
|
||||
$('#ListPropertiesMainContainer').html(MainCard);
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
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 = 'PropertyListRowCardHash-' + variablePart;
|
||||
hashkey = $('#' + hashKeyDivId).text();
|
||||
if (hashkey) {
|
||||
request.url('/ViewProperty/Details/data').success((response) => {
|
||||
}).data({ target: hashkey }).fromVarCache(true).type('POST').go();
|
||||
}
|
||||
hashkey = '';
|
||||
}
|
||||
});
|
||||
}, { threshold: 0.1 });
|
||||
|
||||
|
||||
$('#PropertyListContainer .card').each(function () {
|
||||
observer.observe(this);
|
||||
});
|
||||
};
|
||||
|
||||
LoadDataPageFunc.populatepropertylist = function () {
|
||||
let request = new RequestData(true);
|
||||
request
|
||||
.url('/ListProperty/List/data')
|
||||
.type('POST')
|
||||
.data(null)
|
||||
.fromVarCache(true)
|
||||
.success((response) => {
|
||||
if ($('#card-body-MAINCARDBODY_PROPERTYLIST').length === 0) { return false; }
|
||||
if (!response) {
|
||||
$('#card-body-MAINCARDBODY_PROPERTYLIST').html('No Properties');
|
||||
return;
|
||||
}
|
||||
|
||||
const PropertyList = response.List;
|
||||
//PropertyList.reverse();
|
||||
PropertyList.sort((a, b) => new Date(b.created) - new Date(a.created));
|
||||
let newhtmlrows = ''; let arrayrows = [];
|
||||
const count = PropertyList.length;
|
||||
|
||||
|
||||
for (let i = 0; i < count; i++) {
|
||||
arrayrows.push(LoadDataPageFunc.newpropertyrow(PropertyList[i], i));
|
||||
}
|
||||
|
||||
newhtmlrows = arrayrows.join('');
|
||||
$('#PropertyListContainer').html(newhtmlrows);
|
||||
LoadDataPageFunc.CardResultInterSectionPreloadDetails();
|
||||
})
|
||||
.error((err) => {
|
||||
console.error(err);
|
||||
})
|
||||
.go();
|
||||
|
||||
};
|
||||
|
||||
function SearchKeyUPListPropertyPage() {
|
||||
$('#ListProperty_Search').on('keyup', function () {
|
||||
|
||||
let searchTerm = $(this).val().toLowerCase();
|
||||
|
||||
$('#PropertyListContainer .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.ClearSearch = function () {
|
||||
$('#ListProperty_Search').val('');
|
||||
$('#ListProperty_Search').trigger('keyup');
|
||||
};
|
||||
|
||||
$(document).ready(function () {
|
||||
LoadDataPageFunc.main();
|
||||
LoadDataPageFunc.populatepropertylist();
|
||||
changeTopbarTitle('Properties');
|
||||
SearchKeyUPListPropertyPage();
|
||||
$('#imgspanListProperty_Search').attr('onclick', 'LoadDataPageFunc.ClearSearch();');
|
||||
|
||||
});
|
||||
</script>
|
||||
237
legacy/pages-html/slvl/all/ListReferralCodeURLs
Normal file
237
legacy/pages-html/slvl/all/ListReferralCodeURLs
Normal file
@@ -0,0 +1,237 @@
|
||||
<div id='ListMainContainer'>
|
||||
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<script>
|
||||
|
||||
|
||||
|
||||
|
||||
LoadDataPageFunc = {};
|
||||
|
||||
|
||||
LoadDataPageFunc.InitializeDynamicVariables = function () {
|
||||
LoadDataPageFunc.URLs.QueryListData = '/ReferralCode/List/data';
|
||||
|
||||
LoadDataPageFunc.Settings.ViewDetailsOnclick = function (data) {
|
||||
return `Copy', '${data}')`;
|
||||
};
|
||||
|
||||
LoadDataPageFunc.Settings.CurrentTargetRequired = false;
|
||||
|
||||
LoadDataPageFunc.Settings.DefaultDatatoSend = null;
|
||||
|
||||
LoadDataPageFunc.NewRow = function (objectdata, rownum) {
|
||||
|
||||
let rowhtml = [];
|
||||
const created = formatDateTimetoReadable(dateobjectdata.created) || '';
|
||||
const modified = formatDateTimetoReadable(dateobjectdata.modified) || '';
|
||||
const views = objectdata.referral_hits;
|
||||
const leads_submitted = objectdata.referral_submit;
|
||||
const referralCode = objectdata.referral_code;
|
||||
const fullurl = window.location.origin+'/r/'+referralCode;
|
||||
|
||||
rowhtml.push(dualcolrow('Status', Status, rowclass = ''));
|
||||
rowhtml.push(dualcolrow('Target Viewing Date', TargetViewingDate, rowclass = ''));
|
||||
|
||||
|
||||
rowhtml.push('<div id="' + LoadDataPageFunc.ids.HashKeyContainer + '-' + rownum + '" style="display:none;">' + hashkey + '</div>');
|
||||
rowhtml.push(row(col('<br>' + buttonprimary('View', '', LoadDataPageFunc.Settings.ViewDetailsOnclick(hashkey), '-12', 'ListCardGoRow-' + rownum))));
|
||||
let FinalBody = rowhtml.join('');
|
||||
|
||||
return createCard(objectdata.fullname, cardid = 'ListRowCard-' + rownum, created, cardbodyid = '', FinalBody, cardbodyclassadd = 'ListCardRow');
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
LoadDataPageFunc.Settings.SortArray = function (arr) {
|
||||
return arr.sort((a, b) => new Date(b.created) - new Date(a.created));
|
||||
};
|
||||
};
|
||||
|
||||
LoadDataPageFunc.Settings = {};
|
||||
LoadDataPageFunc.Settings.PageName = 'My Referral URLs';
|
||||
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.SearchInput = 'List_Search';
|
||||
LoadDataPageFunc.ids.ListContainer = 'ListContainer';
|
||||
LoadDataPageFunc.ids.HashKeyContainer = 'ListRowCardHash';
|
||||
LoadDataPageFunc.ids.MainCardBody = 'MAINCARDBODY_LIST';
|
||||
|
||||
LoadDataPageFunc.URLs = {};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
$$$ = {};
|
||||
$$$.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);
|
||||
}
|
||||
// LoadAndCreateURLfromFileHash(FileListHash,fromvarcache=true);
|
||||
return photourl;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
LoadDataPageFunc.NewRow = function (DetailsObject, rownum) {
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
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.List;
|
||||
//LeadsList.reverse();
|
||||
|
||||
|
||||
List = LoadDataPageFunc.Settings.SortArray(List);
|
||||
|
||||
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));
|
||||
}
|
||||
|
||||
newhtmlrows = htmlarrayrows.join('');
|
||||
|
||||
$('#' + LoadDataPageFunc.ids.ListContainer).html(newhtmlrows);
|
||||
// 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 () {
|
||||
if (LoadDataPageFunc.Settings.CurrentTargetRequired && (!currenttarget || currenttarget === '0')) {
|
||||
$$$.UpdateMainContainer('<center>No Target<br><br>' + buttonprimary('View All Leads', '', "ButtonGo('ListLeads', '')") +
|
||||
'<br><br>' + buttonprimary('Home', '', "ButtonGo('Home', '')") + '</center>'); return false;
|
||||
}
|
||||
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('Leads', FinalInnerHTML, LoadDataPageFunc.ids.MainCardBody);
|
||||
$$$.UpdateMainContainer(MainCard);
|
||||
return true;
|
||||
|
||||
};
|
||||
|
||||
$(document).ready(function () {
|
||||
LoadDataPageFunc.InitializeDynamicVariables();
|
||||
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>
|
||||
75
legacy/pages-html/slvl/all/NewLeads
Normal file
75
legacy/pages-html/slvl/all/NewLeads
Normal file
@@ -0,0 +1,75 @@
|
||||
<div id='NewLeadsFormContainer'>
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<br><br><br>
|
||||
|
||||
<script>
|
||||
|
||||
|
||||
$('#usernumber').keyup(function () {
|
||||
checkifUserExists();
|
||||
SRegistrationValidateALLinputs();
|
||||
});
|
||||
|
||||
|
||||
function NewLeadsvalidateForm() {
|
||||
let fullname = $('#NewLeadsFullname').val();
|
||||
let mobile = $('#NewLeadsmobile').val();
|
||||
let landline = $('#NewLeadslandline').val();
|
||||
let email = $('#NewLeadsemail').val();
|
||||
let preferreddate = $('#NewLeadspreferreddate').val();
|
||||
let preferredsite = $('#NewLeadsPreferredSite').val();
|
||||
if (!fullname || !mobile || !email) { return false; }
|
||||
if (!hasValidMobileFormat(mobile)) { return false; }
|
||||
if (!isValidEmail(email)) { return false; }
|
||||
return { fullname: fullname, mobile: mobile, landline: landline, email: email, preferred_date: preferreddate, preferred_site: preferredsite };
|
||||
}
|
||||
|
||||
function TrytoSubmitNewLead() {
|
||||
let ValidateData = NewLeadsvalidateForm();
|
||||
if (!ValidateData) {
|
||||
ModalQuickDismiss('Invalid/Incomplete', 'The following are required<br><br>Fullname<br>11 Digits Mobile Number<br>Correct Email<br><br>Please Input the following properly if not done so. Thank you.');
|
||||
return false;
|
||||
}
|
||||
|
||||
console.log(ValidateData);
|
||||
request.type('POST').data(ValidateData).url('/NewLeads/Form/submit').fromVarCache(false).success((response) => {
|
||||
console.log(response);
|
||||
if (response['success'] === true) {
|
||||
ModalQuickDismiss('Success', 'New Lead Created', 'NewLeadsModalSuccess', modaltohide = '', function () {
|
||||
ButtonGo('ViewLeadDetails', response['data']);
|
||||
|
||||
});
|
||||
}
|
||||
else if (response['success'] === true) {
|
||||
ModalQuickDismiss('Error', 'Unable to Submit. Try Again Later', 'NewPropertysModalError');
|
||||
}
|
||||
|
||||
}).error((errorstring) => {
|
||||
ModalQuickDismiss('Error', 'An Error Occured<br>' + errorstring + '<br><br>Please Try Again Later');
|
||||
}).go()
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
if (typeof request === 'undefined') {
|
||||
var request = new RequestData(false);
|
||||
var requestWHash = new RequestData(true);
|
||||
}
|
||||
|
||||
$(document).ready(function () {
|
||||
requestWHash.type('POST').url('/NewLeads/Form/PreferredSitesOption').fromVarCache(true).success((response) => {
|
||||
UIReplaceCurrentOptionsSelect('NewLeadsPreferredSite', response);
|
||||
}).go();
|
||||
});
|
||||
|
||||
|
||||
|
||||
ReusableUIElements.NewLeadsGenerateUI();
|
||||
changeTopbarTitle('New Lead');
|
||||
</script>
|
||||
166
legacy/pages-html/slvl/all/NewProperty
Normal file
166
legacy/pages-html/slvl/all/NewProperty
Normal file
@@ -0,0 +1,166 @@
|
||||
<div id='NewPropertyFormContainer'>
|
||||
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
<br><br><br>
|
||||
|
||||
<script>
|
||||
|
||||
LoadDataPageFunc.PageTitle = 'New Property';
|
||||
InitDataPageFuncOBJ();
|
||||
Target_Uploaded_Files = [];
|
||||
LoadDataPageFunc = {};
|
||||
LoadDataPageFunc.NewProperty = {};
|
||||
LoadDataPageFunc.ids = {};
|
||||
var currentDropzone;
|
||||
var ongoingUploads = 0;
|
||||
var yesnomodalDecision = null;
|
||||
|
||||
LoadDataPageFunc.NewPropertyValidate = function () {
|
||||
let name = $('#NewPropertyPropertyName').val();
|
||||
let description = $('#NewPropertyPropertyDescription').val();
|
||||
let status = $('#NewPropertyStatus').val() || 0;
|
||||
let remarks = $('#NewPropertyRemarks').val();
|
||||
let location = $('#NewPropertyLocation').val();
|
||||
let category = $('#NewPropertyCategory').val();
|
||||
let subcategory = $('#NewPropertySubCategory').val();
|
||||
let sqm = $('#NewPropertysqm').val();
|
||||
let bedrooms = $('#NewPropertyBedrooms').val();
|
||||
let rooms = $('#NewPropertyRooms').val();
|
||||
let toilet = $('#NewPropertyToilet').val();
|
||||
let kitchen = $('#NewPropertyKitchen').val();
|
||||
let floors = $('#NewPropertyFloors').val();
|
||||
let price = $('#NewPropertyPrice').val();
|
||||
|
||||
if (!name || !description || !location || !sqm || !Target_Uploaded_Files.length) { return false; }
|
||||
return { name: name, description: description, status: status, remarks: remarks, location: location, category: category, subcategory: subcategory, sqm: sqm, bedrooms: bedrooms, rooms: rooms, toilet: toilet, kitchen: kitchen, floors: floors, photourl: JSON.stringify(Target_Uploaded_Files),price:price };
|
||||
};
|
||||
|
||||
LoadDataPageFunc.UpdateModalDecision=function(type){
|
||||
$(document).ready(function () {
|
||||
yesnomodalDecision = type;
|
||||
modalhide("ModalYesNoWaitForFinishedUpload");
|
||||
$("#ModalYesNoWaitForFinishedUpload").remove();
|
||||
});
|
||||
};
|
||||
|
||||
LoadDataPageFunc.TrytoSubmitNewProperty = function () {
|
||||
let ValidateData = LoadDataPageFunc.NewPropertyValidate();
|
||||
if (!ValidateData) {
|
||||
$('#IncompleteInputModal').remove();
|
||||
ModalQuickDismiss('Invalid/Incomplete', 'The following are required<br><br>Property Name<br>Description<br>Location<br>Size in SQM<br>At Least One Photo<br><br>Please Input the following properly if not done so. Thank you.','IncompleteInputModal');
|
||||
return false;
|
||||
}
|
||||
|
||||
if (ongoingUploads) {
|
||||
yesnomodalDecision = null;
|
||||
$('#ModalYesNoWaitForFinishedUpload').remove();
|
||||
ModalYesNo('Photo Upload in Progress!', 'Some Files are not finished uploading.', 'LoadDataPageFunc.UpdateModalDecision(1);', 'Continue', 'LoadDataPageFunc.UpdateModalDecision(-1);', 'Wait', modalid = 'ModalYesNoWaitForFinishedUpload', modaltohide = '', functiontodo = '', conditiontrue = true);
|
||||
if (yesnomodalDecision === -1 || yesnomodalDecision === null) {
|
||||
hidemodal(modalid);
|
||||
$('#'+modalid).remove();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
request.type('POST').data(ValidateData).url('/NewProperty/Form/submit').fromVarCache(false).success((response) => {
|
||||
|
||||
if (response['success'] === true) {
|
||||
ModalQuickDismiss('Success', 'New Property Created', 'NewPropertysModalSuccess', modaltohide = '', function () {
|
||||
ButtonGo('ViewPropertyDetails', response['data']);
|
||||
});
|
||||
} else if (response['success'] === true) {
|
||||
ModalQuickDismiss('Error', 'Unable to Submit. <br><br>' + response['error'], 'NewPropertysModalError');
|
||||
}
|
||||
}).error((errorstring) => {
|
||||
ModalQuickDismiss('Error', 'An Error Occured<br>' + errorstring + '<br><br>Please Try Again Later');
|
||||
}).go()
|
||||
};
|
||||
|
||||
|
||||
LoadDataPageFunc.ReplaceSelectOptionsfromServer = function (url, id, fromVarCache = true, type = 'POST') {
|
||||
if (!url || !id) { return false; }
|
||||
requestWHash.type(type).url(url).fromVarCache(fromVarCache).success((response) => {
|
||||
UIReplaceCurrentOptionsSelect(id, response);
|
||||
}).go();
|
||||
};
|
||||
|
||||
|
||||
|
||||
if (typeof request === 'undefined') {
|
||||
var request = new RequestData(false);
|
||||
var requestWHash = new RequestData(true);
|
||||
}
|
||||
|
||||
LoadDataPageFunc.ids.ClearPhotosButton = 'newpropertydropzoneclearbutton';
|
||||
|
||||
LoadDataPageFunc.ShowPhotoClearButton = function () {
|
||||
$('#' + LoadDataPageFunc.ids.ClearPhotosButton).show();
|
||||
};
|
||||
|
||||
LoadDataPageFunc.HidePhotoClearButton = function () {
|
||||
$('#' + LoadDataPageFunc.ids.ClearPhotosButton).hide();
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
LoadDataPageFunc.NewProperty.InitializePhotoDropZone = function () {
|
||||
Target_Uploaded_Files = [];
|
||||
currentDropzone = DropZoneFunc.InitializeDropZone('/File/Upload/Property', (response) => {
|
||||
if (response.length === 72) {
|
||||
Target_Uploaded_Files.push(response);
|
||||
LoadDataPageFunc.ShowPhotoClearButton();
|
||||
} else {
|
||||
currentDropzone.removeFile(currentDropzone.files[currentDropzone.files.length - 2]);
|
||||
}
|
||||
}, dropzoneid = 'newpropertydropzonephoto', DropZoneFunc.AcceptedFilesString.images, 'file', maxfilesize = 100);
|
||||
};
|
||||
|
||||
LoadDataPageFunc.ClearPhotos = function () {
|
||||
DropZoneFunc.ClearDropzoneUpload();
|
||||
LoadDataPageFunc.HidePhotoClearButton();
|
||||
};
|
||||
|
||||
LoadDataPageFunc.FormLoad = function () {
|
||||
ReusableUIElements.NewPropertyGenerateUI();
|
||||
};
|
||||
|
||||
LoadDataPageFunc.Initialization = function () {
|
||||
LoadDataPageFunc.FormLoad();
|
||||
changeTopbarTitle(LoadDataPageFunc.PageTitle);
|
||||
};
|
||||
|
||||
|
||||
$(document).ready(function () {
|
||||
|
||||
|
||||
LoadDataPageFunc.Initialization();
|
||||
$('#' + LoadDataPageFunc.ids.ClearPhotosButton).hide();
|
||||
|
||||
$('#' + LoadDataPageFunc.ids.ClearPhotosButton).off('click').on('click', function () {
|
||||
LoadDataPageFunc.ClearPhotos();
|
||||
});
|
||||
|
||||
|
||||
|
||||
Preloaders.Datalist.NewPropertyCategory(function () { ReqCachetoDatalist('/Datalist/NewPropertyCategory', 'NewPropertyCategoryDataList', replace = true); });
|
||||
Preloaders.Datalist.NewPropertySubCategory(function () { ReqCachetoDatalist('/Datalist/NewPropertySubCategory', 'NewPropertySubCategoryDataList', replace = true); });
|
||||
|
||||
|
||||
LoadDataPageFunc.NewProperty.InitializePhotoDropZone();
|
||||
DropZoneFunc.ClearDropzoneUpload();
|
||||
|
||||
ReqCachetoDatalist('/Datalist/NewPropertySubCategory', 'NewPropertySubCategory', replace = true);
|
||||
ReqCachetoDatalist('/Datalist/NewPropertyLocation', 'NewPropertyLocationDataList', replace = true);
|
||||
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
</script>
|
||||
74
legacy/pages-html/slvl/all/PhotoViewer
Normal file
74
legacy/pages-html/slvl/all/PhotoViewer
Normal file
@@ -0,0 +1,74 @@
|
||||
<br><br>
|
||||
<div id="viewContainer">
|
||||
<center>Loading</center>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<script>
|
||||
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>
|
||||
176
legacy/pages-html/slvl/all/Products/BuyViewProductMarket
Normal file
176
legacy/pages-html/slvl/all/Products/BuyViewProductMarket
Normal file
@@ -0,0 +1,176 @@
|
||||
<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">
|
||||
<img src="/assets/micons//image-alt.svg" style="max-width: 100%;
|
||||
max-height: 100%; width: auto; height: 100%;">
|
||||
</div>
|
||||
<br>
|
||||
<div class="row" style="">
|
||||
<div class="col">
|
||||
<h3 id="ProductNameMarketPlace"></h3>
|
||||
</div>
|
||||
<div class="col" id="ProductUnitMarketPlace"></div>
|
||||
</div>
|
||||
|
||||
<ul class="mt-3 box-outstanding-service" id="ControlsAddCartBuy">
|
||||
<li onclick="LoadDataPageFunc.AddToCart();return false;">
|
||||
<div class="">
|
||||
<img src="/assets/addtocart.png" style="width: 30; height: 30;" class="icon-user">
|
||||
</div>Add To Cart
|
||||
</li>
|
||||
<li onclick="LoadDataPageFunc.Buy();return false;">
|
||||
<div class="">
|
||||
<img src="/assets/buy.png" style="width: 30; height: 30;" class="icon-user">
|
||||
</div>Buy
|
||||
</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="ProductDescription">
|
||||
|
||||
</div>
|
||||
|
||||
<h5></h5>
|
||||
</div>
|
||||
</div>
|
||||
</a>
|
||||
</div>
|
||||
<div class="col-md" style="overflow:hidden;display: none;" id="OutOfStockColumn">
|
||||
<div class="card ListRowCard" id="ListRowCard-3" style="">
|
||||
<div class="card-body ListCardRow" id="card-body-ListRowCard-3">
|
||||
<div style="text-align:center;" id="OutOfStockMessage">
|
||||
Out of Stock!
|
||||
<button class="btn" onclick="ButtonGo('ListProductsMarket','');">Go to Market</button>
|
||||
</div>
|
||||
|
||||
<h5></h5>
|
||||
</div>
|
||||
</div>
|
||||
</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 = 'Product Details';
|
||||
LoadDataPageFunc.MainDetailsURL = '';
|
||||
LoadDataPageFunc.Details = {};
|
||||
LoadDataPageFunc.Settings = {};
|
||||
|
||||
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();
|
||||
};
|
||||
LoadDataPageFunc.PopulateDetailsNow = function (name, description, price, unit, available) {
|
||||
|
||||
$('#ProductNameMarketPlace').html(name);
|
||||
$('#ProductDescription').html(description);
|
||||
$('#ProductUnitMarketPlace').html('P' + price + ' / ' + unit);
|
||||
|
||||
if (!available) { LoadDataPageFunc.OutofStock(); }
|
||||
};
|
||||
|
||||
|
||||
|
||||
LoadDataPageFunc.Settings.Phototype = "ProductMarket";
|
||||
|
||||
LoadDataPageFunc.PopulateDetails = function () {
|
||||
let description;
|
||||
let photosarray;
|
||||
|
||||
const UpdateDetailsUI = function (response) {
|
||||
|
||||
|
||||
const ErrorModal = function () {
|
||||
ModalQuickDismiss(false, 'Product Not Available!', 'UnavailableProductModal');
|
||||
};
|
||||
|
||||
if (!response) {
|
||||
ErrorModal();
|
||||
return false;
|
||||
}
|
||||
|
||||
let ProductData = response.data || false;
|
||||
if (!ProductData) { ErrorModal(); return false; }
|
||||
|
||||
LoadDataPageFunc.Details.photourl = ProductData.photourl;
|
||||
LoadPhotosCard('PhotosCard', onclick = `ButtonGo('ViewAllPhotos','${currenttarget}');`, ProductData.photourl);
|
||||
|
||||
LoadDataPageFunc.PopulateDetailsNow(ProductData.name, ProductData.description, ProductData.price, ProductData.unitname, ProductData.available);
|
||||
|
||||
};
|
||||
|
||||
Preloaders.ViewProductinMarket(currenttarget, true, UpdateDetailsUI);
|
||||
|
||||
|
||||
};
|
||||
|
||||
LoadDataPageFunc.Main = function () {
|
||||
changeTopbarTitle(LoadDataPageFunc.PageTitle);
|
||||
LoadDataPageFunc.PopulateDetails();
|
||||
};
|
||||
|
||||
|
||||
|
||||
LoadDataPageFunc.Main();
|
||||
</script>
|
||||
164
legacy/pages-html/slvl/all/Products/CartProductMarket
Normal file
164
legacy/pages-html/slvl/all/Products/CartProductMarket
Normal file
@@ -0,0 +1,164 @@
|
||||
<style>
|
||||
.ListRowCard {
|
||||
margin-bottom: 5px;
|
||||
}
|
||||
</style>
|
||||
<div id="MainView" style="padding-top: 5px;">
|
||||
|
||||
<div class="row" id="CartListRow" style="margin-top: 5px; margin-bottom: 5px;">
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<script>
|
||||
LoadDataPageFunc = {};
|
||||
LoadDataPageFunc.PageTitle = 'Cart';
|
||||
LoadDataPageFunc.MainDetailsURL = '';
|
||||
LoadDataPageFunc.Details = {};
|
||||
LoadDataPageFunc.CartCurrentlyLoading = 0;
|
||||
|
||||
LoadDataPageFunc.SetQuantityUI = function (newquantity, rownum) {
|
||||
if (typeof rownum !== 'number') { return false; }
|
||||
if (typeof newquantity !== 'number') { return false; }
|
||||
let controlid = "ProductCartMarket-" + rownum;
|
||||
$('#' + controlid).html(newquantity);
|
||||
const newvalue = $('#' + controlid).html();
|
||||
if (newquantity !== newvalue) { return false; }
|
||||
return true;
|
||||
};
|
||||
|
||||
|
||||
LoadDataPageFunc.FindRowNumByHash = function (hashkey) {
|
||||
let element = $('[data-hash="' + hashkey + '"]');
|
||||
if (element.length === 0) { return false; }
|
||||
let nrownum = element.data('rownum');
|
||||
return nrownum
|
||||
};
|
||||
|
||||
|
||||
LoadDataPageFunc.SetQuantitybyHash = function (newquantity, hashkey) {
|
||||
|
||||
if (!hashkey || typeof hashkey !== 'string') { return false; }
|
||||
let rownum = '';
|
||||
rownum = LoadDataPageFunc.FindRowNumByHash(hashkey);
|
||||
|
||||
if (rownum === false) { return false; }
|
||||
const changequantity = LoadDataPageFunc.SetQuantityUI(newquantity, rownum);
|
||||
if (!changequantity) { return false; }
|
||||
return true;
|
||||
};
|
||||
|
||||
LoadDataPageFunc.UpdateProductQuantityCart = function (response, producthash) {
|
||||
LoadDataPageFunc.CartCurrentlyLoading--;
|
||||
LoadDataPageFunc.PopulateDetails(false);
|
||||
/* if (response === false) { return false; }
|
||||
if (typeof response !== 'number') {
|
||||
return false;
|
||||
};
|
||||
return LoadDataPageFunc.SetQuantitybyHash(response, producthash); */
|
||||
|
||||
};
|
||||
|
||||
|
||||
LoadDataPageFunc.RequestData = new RequestData(false);
|
||||
|
||||
LoadDataPageFunc.RemoveFromCartOneProduct = function (producthash) {
|
||||
if (LoadDataPageFunc.CartCurrentlyLoading) { return false; }
|
||||
if (!producthash) { return false; }
|
||||
LoadDataPageFunc.CartCurrentlyLoading++;
|
||||
LoadDataPageFunc.RequestData
|
||||
.url('/cart/remove/one/' + producthash)
|
||||
.type('GET')
|
||||
.fromVarCache(false)
|
||||
.success((response) => {
|
||||
const res = LoadDataPageFunc.UpdateProductQuantityCart(response, producthash);
|
||||
})
|
||||
.go();
|
||||
}
|
||||
|
||||
|
||||
|
||||
LoadDataPageFunc.CheckOutAllCart = function () {
|
||||
const cartobj = objectToUrlSafeBase64(LoadDataPageFunc.Details);
|
||||
gotoPage('ConfirmBUYProductMarket', cartobj, nohistory = 0, redundantpage = 0);
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
LoadDataPageFunc.AddToCartOneProduct = function (producthash) {
|
||||
if (LoadDataPageFunc.CartCurrentlyLoading > 0) { return false; }
|
||||
if (!producthash) { return false; }
|
||||
LoadDataPageFunc.CartCurrentlyLoading++;
|
||||
LoadDataPageFunc.RequestData
|
||||
.url('/cart/add/one/' + producthash)
|
||||
.type('GET')
|
||||
.fromVarCache(false)
|
||||
.success((response) => {
|
||||
const res = LoadDataPageFunc.UpdateProductQuantityCart(response, producthash);
|
||||
})
|
||||
.go();
|
||||
|
||||
};
|
||||
|
||||
|
||||
LoadDataPageFunc.CartProductRow = MarketUI.CartProductRow;
|
||||
|
||||
LoadDataPageFunc.UpdateCartFull = function (response) {
|
||||
LoadDataPageFunc.Details = response;
|
||||
if (Array.isArray(response) && response.length === 0) {
|
||||
let cardCARTempty = CreateCardSimple(false, '<div style="text-align:center;">No Items On Cart! Start Shopping<br>' + buttonGOTOPage('Go to Market', 'ListProductsMarket') + '</div>');
|
||||
$('#CartListRow').html(cardCARTempty);
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
|
||||
let htmllist = []; let finalhtml = '';
|
||||
let rownum = 0;
|
||||
|
||||
if (!response) { return false; }
|
||||
|
||||
LoopArrayorObject(response, (item) => {
|
||||
htmllist.push(LoadDataPageFunc.CartProductRow(item, rownum));
|
||||
rownum++;
|
||||
});
|
||||
finalhtml = htmllist.join('');
|
||||
finalhtml +=`<br><br>`+buttonprimary('Checkout All','','LoadDataPageFunc.CheckOutAllCart()');
|
||||
$('#CartListRow').html(finalhtml);
|
||||
|
||||
LoopArrayorObject(response, (item) => {
|
||||
LoadAndCreateURLfromFileHash(item.photourl).then(bloburl => {
|
||||
$('#ProductCartMarketPlacePhoto--' + rownum).attr('src', bloburl);
|
||||
});
|
||||
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
LoadDataPageFunc.PopulateDetails = function (fromVarCacheN = true) {
|
||||
|
||||
Preloaders.CartContents(fromVarCacheN, (response) => { LoadDataPageFunc.UpdateCartFull(response); });
|
||||
/* let reqq = new RequestData(true);
|
||||
reqq.fromVarCache(fromVarCacheN).data().url('/User/My/Details/Cart/data').type('POST')
|
||||
.success((response) => {
|
||||
LoadDataPageFunc.UpdateCartFull(response);
|
||||
}).go(); */
|
||||
|
||||
};
|
||||
|
||||
LoadDataPageFunc.Main = function () {
|
||||
changeTopbarTitle(LoadDataPageFunc.PageTitle);
|
||||
LoadDataPageFunc.PopulateDetails();
|
||||
};
|
||||
|
||||
|
||||
|
||||
LoadDataPageFunc.Main();
|
||||
</script>
|
||||
450
legacy/pages-html/slvl/all/Products/ConfirmBUYProductMarket
Normal file
450
legacy/pages-html/slvl/all/Products/ConfirmBUYProductMarket
Normal file
@@ -0,0 +1,450 @@
|
||||
<style>
|
||||
.ListRowCard {
|
||||
margin-bottom: 5px;
|
||||
}
|
||||
|
||||
.pdbottom {
|
||||
overflow: hidden;
|
||||
padding-bottom: 5px;
|
||||
text-align: center;
|
||||
}
|
||||
</style>
|
||||
<div id="MainView">
|
||||
|
||||
<div class="row" id="MainRowContainer">
|
||||
<center>
|
||||
<h3>Loading...</h3>
|
||||
</center>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<script>
|
||||
LoadDataPageFunc = {};
|
||||
LoadDataPageFunc.PageTitle = 'Product Details';
|
||||
LoadDataPageFunc.MainDetailsURL = '';
|
||||
LoadDataPageFunc.Details = {};
|
||||
LoadDataPageFunc.Settings = {};
|
||||
LoadDataPageFunc.Settings.ProductNotAvailableModalDismissed = false;
|
||||
|
||||
LoadDataPageFunc.NewMainColumn = function (id, Cardtitle, CardContent, CardID) {
|
||||
return `<div class="col-md-12 pdbottom" style="" id="${id}Container">
|
||||
${CreateCardSimple(Cardtitle, CardContent, CardID,)}
|
||||
</div>`;
|
||||
};
|
||||
|
||||
LoadDataPageFunc.PopulateDetailsNow = function (obj) {
|
||||
|
||||
const details = obj.details || '';
|
||||
const total = details.total || 'Unknown';
|
||||
const containerID = 'CardCartContainer';
|
||||
let cardhtmlArr = [];
|
||||
|
||||
iterateArray(obj.cart, (item, key) => {
|
||||
cardhtmlArr.push(LoadDataPageFunc.CartProductRow(item, key, false) + '<br><br>');
|
||||
});
|
||||
|
||||
const cardhtml = cardhtmlArr.join('');
|
||||
const CardCartColumn = LoadDataPageFunc.NewMainColumn('CardCartContainer', 'Items', cardhtml, 'CardCart')
|
||||
|
||||
const TotalPricehtml = `
|
||||
<h1>Total Price: <h1>
|
||||
<h1 id="TotalPrice" style="text-align: center;color: red;">${formatCurrency(total)}</h1>`;
|
||||
const TotalPriceColumn = LoadDataPageFunc.NewMainColumn('TotalPriceCardContainer', false, TotalPricehtml, 'TotalPriceCard');
|
||||
|
||||
const AddressHtml = `
|
||||
|
||||
`;
|
||||
const AddressColumn = LoadDataPageFunc.NewMainColumn('AddressContainer', "Address", AddressHtml, 'AddressCard');
|
||||
|
||||
|
||||
const PurchaseHtml = buttonprimary(imgiconuserdefault("/assets/plus-cart.png") + 'Proceed Purchase', '', 'LoadDataPageFunc.ConfirmPurchase();');
|
||||
const ConfirmPurchaseColumn = LoadDataPageFunc.NewMainColumn('PurchaseContainer', false, PurchaseHtml, 'PurchaseCard');
|
||||
const finalhtml = CardCartColumn + TotalPriceColumn + AddressColumn + ConfirmPurchaseColumn;
|
||||
$('#MainRowContainer').html(finalhtml);
|
||||
|
||||
};
|
||||
|
||||
LoadDataPageFunc.Settings.Phototype = "ProductMarket";
|
||||
|
||||
LoadDataPageFunc.CartProductRow = MarketUI.CartProductRow;
|
||||
|
||||
LoadDataPageFunc.BuySuccess = function () {
|
||||
ModalQuickDismiss(false, 'Successfully Bought Product!', 'ModalConfirmBuySuccess');
|
||||
gotoPage('PendingBuysProductMarket');
|
||||
return;
|
||||
};
|
||||
|
||||
LoadDataPageFunc.BuyFailed = function (response) {
|
||||
ModalQuickDismiss(false, 'Unable to Complete Purchase!<br>' + response, 'ModalConfirmBuyFailed');
|
||||
return;
|
||||
};
|
||||
|
||||
LoadDataPageFunc.ConfirmPurchase = function () {
|
||||
if (!LoadDataPageFunc.CurrentSelectedAddress) {
|
||||
ModalQuickDismiss(false, 'Please select an address to proceed with purchase.', 'ModalConfirmBuy');
|
||||
return false;
|
||||
}
|
||||
let reqqpurchase = new RequestData(false);
|
||||
reqqpurchase.fromVarCache(false).data({ targetproduct: currenttarget }).url('/Buy/Complete/Purchase')
|
||||
.success((response) => {
|
||||
|
||||
if (response !== true) { LoadDataPageFunc.BuyFailed(response); return false; }
|
||||
else { LoadDataPageFunc.BuySuccess(); return true; }
|
||||
|
||||
}).go();
|
||||
};
|
||||
|
||||
LoadDataPageFunc.BuyDetails = {};
|
||||
LoadDataPageFunc.AddressDetails = false;
|
||||
LoadDataPageFunc.CurrentSelectedAddress = false;
|
||||
|
||||
LoadDataPageFunc.NewAddressValidate = function () {
|
||||
const name = $('#NewAddressName').val();
|
||||
const address = $('#NewAddress').val();
|
||||
const contactname = $('#NewContactName').val();
|
||||
const contactnumber = $('#NewContactNumber').val();
|
||||
const defaultaddress = $('#NewDefaultAddress').is(':checked');
|
||||
|
||||
if (!name || !address || !contactname || !contactnumber) {
|
||||
return false;
|
||||
}
|
||||
return { 'name': name, 'address': address, 'contactname': contactname, 'contactnumber': contactnumber, 'default': defaultaddress };
|
||||
}
|
||||
|
||||
LoadDataPageFunc.SubmitNewAddress = function () {
|
||||
const addressformdata = LoadDataPageFunc.NewAddressValidate();
|
||||
if (!addressformdata) {
|
||||
ModalQuickDismiss(false, 'Please fill in all fields!');
|
||||
return false;
|
||||
}
|
||||
|
||||
let submitReq = new RequestData(false);
|
||||
submitReq.fromVarCache(false).type('POST').url('/User/My/Add/Address').data(addressformdata).success(
|
||||
(response) => {
|
||||
|
||||
if (!response) {
|
||||
ModalQuickDismiss(false, 'Unable to add address!<br>', 'ModalAddAddressSubmitFailed');
|
||||
return false;
|
||||
}
|
||||
|
||||
modaldestroy();
|
||||
hideallmodals();
|
||||
|
||||
LoadDataPageFunc.fetchAddresses((response) => {
|
||||
//modalhide('NewAddressModal');
|
||||
|
||||
if (addressformdata.default) {
|
||||
LoadDataPageFunc.CurrentSelectedAddress = LoadDataPageFunc.FindDefaultAddressBasedonAddressDetails();
|
||||
LoadDataPageFunc.UpdateAddressCard(response);
|
||||
}
|
||||
|
||||
LoadDataPageFunc.ShowAddressesModal();
|
||||
|
||||
});
|
||||
}
|
||||
).go();
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
LoadDataPageFunc.NewAddressModal = function () {
|
||||
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('Address Name', 'Address Name', 'AddressName', true);
|
||||
const address = textbox('Address', 'Address', 'Address', true);
|
||||
const contactname = textbox('Recipient Name for the Address', 'Recipient Name', 'ContactName', true);
|
||||
const contactnumber = textbox('Recipient Number for the Address', 'Recipient Number', 'ContactNumber', true);
|
||||
const checkbox = `<input class="btn btn-primary" type="checkbox" id="NewDefaultAddress">Set As Default?`;
|
||||
|
||||
const finalform = name + address + contactname + contactnumber + checkbox;
|
||||
const footerbuttons = buttonprimary('Submit Address', '', 'LoadDataPageFunc.SubmitNewAddress();');
|
||||
CreateAndShowModal('NewAddressModal', 'New Address', finalform, footerbuttons, false);
|
||||
};
|
||||
|
||||
LoadDataPageFunc.SelectCurrentAddress = function () {
|
||||
const selectedaddress = LoadDataPageFunc.GetSelectAddressUIFields();
|
||||
LoadDataPageFunc.CurrentSelectedAddress= selectedaddress;
|
||||
|
||||
LoadDataPageFunc.UpdateAddressCard([LoadDataPageFunc.CurrentSelectedAddress]);
|
||||
hideallmodals();
|
||||
modaldestroy();
|
||||
//capture select control value and index and all textbox inside
|
||||
//show confirm Address selection modal
|
||||
//update LoadDataPageFunc.CurrentSelectedAddress
|
||||
//Update Address Card
|
||||
//close ShowAddressesModal and other Modals
|
||||
|
||||
|
||||
};
|
||||
|
||||
LoadDataPageFunc.SelectedKey = false;
|
||||
|
||||
LoadDataPageFunc.SetAsDefault = function () {
|
||||
const defaultkey = $('#InputSelectedAddress').val();
|
||||
let addressui = LoadDataPageFunc.GetSelectAddressUIFields();
|
||||
const datatosend = {
|
||||
'name': addressui[1], 'address': addressui[0],
|
||||
'contactname': addressui[2],
|
||||
'contactnumber': addressui[3],
|
||||
'key': defaultkey
|
||||
};
|
||||
let setasDefaultFetch = new RequestData(false);
|
||||
setasDefaultFetch.url('/User/My/SetasDefault/Address/').type('POST').data(datatosend).fromVarCache(false)
|
||||
.success((response) => {
|
||||
if (!response) {
|
||||
ModalQuickDismiss(false, 'Error Try Again Later');
|
||||
return false;
|
||||
}
|
||||
ModalQuickDismiss(false, 'Success');
|
||||
|
||||
LoadDataPageFunc.fetchAddresses((response) => {
|
||||
LoadDataPageFunc.AddressDetails = response;
|
||||
LoadDataPageFunc.CurrentSelectedAddress = LoadDataPageFunc.FindDefaultAddressBasedonAddressDetails();
|
||||
hideallmodals();
|
||||
modaldestroy();
|
||||
LoadDataPageFunc.ShowAddressesModal();
|
||||
|
||||
});
|
||||
|
||||
|
||||
}).go();
|
||||
};
|
||||
|
||||
|
||||
LoadDataPageFunc.ShowAddressesModal = function () {
|
||||
|
||||
const title = 'Select Address';
|
||||
let modalbody = '<div style="text-align:center;">No Address</div>';
|
||||
const selectbutton = buttonprimary('Select Address', '', 'LoadDataPageFunc.SelectCurrentAddress();');
|
||||
const Newbutton = buttonwarning('New Address', '', 'LoadDataPageFunc.NewAddressModal();');
|
||||
const setasdefaultbutton = buttonprimary('Set As Default', '', 'LoadDataPageFunc.SetAsDefault();');
|
||||
let footerbuttons = '';
|
||||
let selectarray = [];
|
||||
let selectedkey = -1;
|
||||
const CurrentSelectedAddress = LoadDataPageFunc.CurrentSelectedAddressOBJ();
|
||||
const selectedname = CurrentSelectedAddress['name'];
|
||||
const selectedaddress = CurrentSelectedAddress['address'];
|
||||
const selectedcontactname = CurrentSelectedAddress['contactname'];
|
||||
const selectedcontactnumber = CurrentSelectedAddress['contactnumber'];
|
||||
|
||||
let UIAddressField = {};
|
||||
UIAddressField.name = '';
|
||||
UIAddressField.address = '';
|
||||
UIAddressField.contactname = '';
|
||||
UIAddressField.contactnumber = '';
|
||||
|
||||
if (!LoadDataPageFunc.AddressDetails) {
|
||||
footerbuttons = Newbutton;
|
||||
} else {
|
||||
footerbuttons = selectbutton + setasdefaultbutton + Newbutton;
|
||||
}
|
||||
|
||||
if (LoadDataPageFunc.AddressDetails) {
|
||||
selectarray = [];
|
||||
selectedkey = -1;
|
||||
|
||||
iterateArray(LoadDataPageFunc.AddressDetails, (item, key) => {
|
||||
const name = item[1];
|
||||
const address = item[0];
|
||||
const contactname = item[2];
|
||||
const contactnumber = item[3];
|
||||
|
||||
|
||||
if (name === selectedname && address === selectedaddress && contactname === selectedcontactname && contactnumber === selectedcontactnumber) {
|
||||
selectedkey = key;
|
||||
} else {
|
||||
|
||||
}
|
||||
selectarray.push([key, name]);
|
||||
});
|
||||
if (selectedkey > -1) {
|
||||
LoadDataPageFunc.SelectedKey = selectedkey;
|
||||
} else {
|
||||
LoadDataPageFunc.SelectedKey = false;
|
||||
}
|
||||
|
||||
const InputSelectHTML = UIInputGroupSelect('InputSelectedAddress', '', selectarray, '', '', selectedkey);
|
||||
// UIArraytoOptionforSelect(selectarray,selectedkey);
|
||||
|
||||
//iterateArray() and
|
||||
// if LoadDataPageFunc.CurrentSelectedAddress is present then find it in the obj and select it if not then show all addresses and default to obj.default
|
||||
//Load SEleect Control
|
||||
|
||||
modalbody = InputSelectHTML + `
|
||||
<h4 id="InputSelectContent-Name">${selectedname}</h4>
|
||||
<h4 id="InputSelectContent-Address">${selectedaddress}</h4>
|
||||
<h4 id="InputSelectContent-ContactName">${selectedcontactname}</h4>
|
||||
<h4 id="InputSelectContent-ContactAddress">${selectedcontactnumber}</h4>
|
||||
`;
|
||||
|
||||
footerbuttons = selectbutton + setasdefaultbutton + Newbutton;;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
const finalmodal = CreateAndShowModal('ShowAddressesModal', 'Select Address', modalbody, footerbuttons, false);
|
||||
|
||||
if (!LoadDataPageFunc.SelectedKey) {
|
||||
$('#InputSelectedAddress').val('');
|
||||
}
|
||||
|
||||
const inputSelectedAddress = document.getElementById('InputSelectedAddress');
|
||||
inputSelectedAddress.addEventListener('change', function (event) {
|
||||
const value = event.target.value;
|
||||
LoadDataPageFunc.UpdateSelectAddressUIFields();
|
||||
|
||||
});
|
||||
|
||||
};
|
||||
|
||||
LoadDataPageFunc.GetSelectAddressUIFields = function () {
|
||||
return [
|
||||
$('#InputSelectContent-Address').html(),
|
||||
$('#InputSelectContent-Name').html(),
|
||||
$('#InputSelectContent-ContactName').html(),
|
||||
$('#InputSelectContent-ContactAddress').html()];
|
||||
}
|
||||
LoadDataPageFunc.UpdateSelectAddressUIFields = function () {
|
||||
const currentselected = $('#InputSelectedAddress').val();
|
||||
|
||||
if (currentselected === false || currentselected === null) { return false; }
|
||||
|
||||
const SelectedData = LoadDataPageFunc.AddressDetails[currentselected];
|
||||
|
||||
const selectedname = SelectedData[1];
|
||||
const selectedaddress = SelectedData[0];
|
||||
const selectedcontactname = SelectedData[2];
|
||||
const selectedcontactnumber = SelectedData[3];
|
||||
|
||||
$('#InputSelectContent-Name').html(selectedname);
|
||||
$('#InputSelectContent-Address').html(selectedaddress);
|
||||
$('#InputSelectContent-ContactName').html(selectedcontactname);
|
||||
$('#InputSelectContent-ContactAddress').html(selectedcontactnumber);
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
LoadDataPageFunc.FindDefaultAddressBasedonAddressDetails = function () {
|
||||
let foundIndex = -1;
|
||||
let arrayofArrays = LoadDataPageFunc.AddressDetails;
|
||||
arrayofArrays.forEach((innerArray, index) => {
|
||||
if (innerArray.length >= 4) {
|
||||
if (typeof innerArray[4] !== 'undefined') {
|
||||
const fourthElement = innerArray[4];
|
||||
if (fourthElement === true) {
|
||||
foundIndex = index;
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
if (foundIndex > -1) { return arrayofArrays[foundIndex]; } else { return false; }
|
||||
};
|
||||
|
||||
LoadDataPageFunc.CurrentSelectedAddressOBJ = function () {
|
||||
if (Array.isArray(LoadDataPageFunc.CurrentSelectedAddress)) {
|
||||
|
||||
const name = LoadDataPageFunc.CurrentSelectedAddress[1];
|
||||
const address = LoadDataPageFunc.CurrentSelectedAddress[0];
|
||||
const contactname = LoadDataPageFunc.CurrentSelectedAddress[2];
|
||||
const contactnumber = LoadDataPageFunc.CurrentSelectedAddress[3];
|
||||
const defaultaddress = LoadDataPageFunc.CurrentSelectedAddress[4];
|
||||
return { 'name': name, 'address': address, 'contactname': contactname, "contactnumber": contactnumber };
|
||||
} else { return false; }
|
||||
};
|
||||
|
||||
LoadDataPageFunc.UpdateAddressCard = function (objAdd) {
|
||||
|
||||
const btn = button('Select Address', '', 'LoadDataPageFunc.ShowAddressesModal();', '', 'btn');
|
||||
|
||||
if (!LoadDataPageFunc.CurrentSelectedAddress) {
|
||||
LoadDataPageFunc.CurrentSelectedAddress = LoadDataPageFunc.FindDefaultAddressBasedonAddressDetails();
|
||||
}
|
||||
|
||||
if (!objAdd || !LoadDataPageFunc.CurrentSelectedAddressOBJ()) {
|
||||
$('#card-body-AddressCard').html(btn);
|
||||
return false;
|
||||
}
|
||||
|
||||
const AddressData = LoadDataPageFunc.CurrentSelectedAddressOBJ();
|
||||
|
||||
const SelectaddressHTML = `<h6>${AddressData.name}</h6>
|
||||
<h6>${AddressData.address}</h6>
|
||||
<h6>${AddressData.contactname}</h6>
|
||||
<h6>${AddressData.contactnumber}</h6>`;
|
||||
$('#card-body-AddressCard').html(SelectaddressHTML + btn);
|
||||
|
||||
//FInd Default Address based on LoadDataPageFunc.CurrentSelectedAddress if false find in obj
|
||||
|
||||
};
|
||||
|
||||
LoadDataPageFunc.fetchAddresses = function (sucessfunc = false) {
|
||||
let fetchAddressesNow = new RequestData(false);
|
||||
|
||||
fetchAddressesNow.fromVarCache(false).data(null).url('/User/My/Get/Addresses/data').type('POST')
|
||||
.success((response) => {
|
||||
|
||||
LoadDataPageFunc.AddressDetails = response;
|
||||
if (typeof sucessfunc === 'function') {
|
||||
sucessfunc(response);
|
||||
}
|
||||
|
||||
}).go();
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
LoadDataPageFunc.PopulateDetails = function () {
|
||||
|
||||
let description;
|
||||
let photosarray;
|
||||
|
||||
let reqqW = new RequestData(false);
|
||||
|
||||
|
||||
|
||||
reqqW.fromVarCache(false).data({ cart: currenttarget }).url(`/User/My/Cart/Compute/data/`).type('POST')
|
||||
.success((response) => {
|
||||
LoadDataPageFunc.BuyDetails = response;
|
||||
LoadDataPageFunc.PopulateDetailsNow(response);
|
||||
}).go();
|
||||
|
||||
LoadDataPageFunc.fetchAddresses((response) => { LoadDataPageFunc.UpdateAddressCard(response); });
|
||||
|
||||
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
LoadDataPageFunc.ProductNotAvailable = function () {
|
||||
const modalfooter = `
|
||||
<button class="btn" onclick="Backkey();">Back</button>
|
||||
<button class="btn" onclick="ButtonGo('ListProductsMarket')">All Products</button>
|
||||
`;
|
||||
CreateAndShowModal('modal-buyconfirm-productunavailable', false, 'Product Not Available', modalfooter, false);
|
||||
$('#modal-buyconfirm-productunavailable').on('hidden.bs.modal', function () {
|
||||
LoadDataPageFunc.Settings.ProductNotAvailableModalDismissed = true;
|
||||
ButtonGo('ListProductsMarket');
|
||||
});
|
||||
};
|
||||
|
||||
LoadDataPageFunc.Main = function () {
|
||||
// if (!currenttarget || currenttarget==='0'){ LoadDataPageFunc.ProductNotAvailable();return false;}
|
||||
changeTopbarTitle(LoadDataPageFunc.PageTitle);
|
||||
LoadDataPageFunc.PopulateDetails();
|
||||
};
|
||||
|
||||
|
||||
|
||||
LoadDataPageFunc.Main();
|
||||
</script>
|
||||
325
legacy/pages-html/slvl/all/Products/ListProductsMarket
Normal file
325
legacy/pages-html/slvl/all/Products/ListProductsMarket
Normal file
@@ -0,0 +1,325 @@
|
||||
<style>
|
||||
.ListRowCard {
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
</style>
|
||||
|
||||
<div id='ListMainContainer'>
|
||||
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<script>
|
||||
|
||||
|
||||
|
||||
|
||||
LoadDataPageFunc = {};
|
||||
|
||||
LoadDataPageFunc.NewRow = function (objectdata, rownum) {
|
||||
|
||||
let name = objectdata.name;
|
||||
let unit = objectdata.unit || '';
|
||||
let price = objectdata.price;
|
||||
let description = objectdata.description || '';
|
||||
let imgurl = objectdata.photo
|
||||
let imgwidthheight = 150;
|
||||
let hashkey = objectdata.hashkey;
|
||||
let ahreflink = "ButtonGo('BuyViewProductMarket','" + hashkey + "');";
|
||||
const maxDescriptionChars=80;
|
||||
|
||||
|
||||
//imgurl = LoadDataPageFunc.GetPhotoURL(imgurl, rownum);
|
||||
|
||||
const columnsize = '6';
|
||||
let brdescbefore = '';
|
||||
if (description) {
|
||||
brdescbefore = '<br><br>';
|
||||
}
|
||||
|
||||
if (description.length > maxDescriptionChars) {
|
||||
description = description.substring(0, maxDescriptionChars) + '...';
|
||||
}
|
||||
|
||||
|
||||
imagehtml = `<img id="marketplacelistproductphoto-${rownum}" src="/RequestData/File/${imgurl}" loading="lazy" class="" style="width: 60%;height: 60%;object-fit: contain;">`;
|
||||
|
||||
const style = "width: 100%; height: 100%; object-fit: cover;";
|
||||
|
||||
|
||||
return `<div class="col-${columnsize}" style="overflow:hidden; padding-bottom:10px;">
|
||||
<a href="javascript:void(0);" onclick="${ahreflink}">
|
||||
<div class="card ListRowCard" id="ListRowCard-${rownum}" style="${style}">
|
||||
<div id="cardheader-ListRowCard-${rownum}" class="card-header ui-sortable-handle" style="cursor: move;display:none;">
|
||||
<h3 class="card-title" style="" id="card-title-ListRowCard-${rownum}"></h3>
|
||||
<div class="card-tools" id="card-tools-ListRowCard-${rownum}">
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-body ListCardRow" id="card-body-ListRowCard-${rownum}">
|
||||
<div style="text-align:center;">
|
||||
${imagehtml}
|
||||
</div>
|
||||
<br>
|
||||
<div class="row" style=""><div class="col"><h3>${name}</h3></div><div class="col">P${price} / ${unit}</div></div>
|
||||
${brdescbefore}
|
||||
<h5>${description}</h5>
|
||||
<br>
|
||||
</div>
|
||||
</div>
|
||||
</a>
|
||||
</div>`;
|
||||
|
||||
};
|
||||
|
||||
LoadDataPageFunc.InitializeDynamicVariables = function () {
|
||||
LoadDataPageFunc.URLs.QueryListData = '/Market/Products/List';
|
||||
|
||||
LoadDataPageFunc.Settings.ViewDetailsOnclick = function (data) {
|
||||
return `ButtonGo('ViewLeadDetails', '${data}')`;
|
||||
};
|
||||
|
||||
LoadDataPageFunc.Settings.CurrentTargetRequired = false;
|
||||
|
||||
LoadDataPageFunc.Settings.DefaultDatatoSend = null;
|
||||
|
||||
LoadDataPageFunc.GetPhotoURL = function (imgurl, rownum) {
|
||||
if (!imgurl || !(typeof imgurl === 'string' && imgurl.length < 72)) { return '/assets/noproductphoto.png'; }
|
||||
|
||||
imghash= imgurl.slice(-72);
|
||||
|
||||
// photoblob = fileBlobURLList[imgurl] || false;
|
||||
|
||||
photoblob = Preloaders.getfileBlobURL(imghash);
|
||||
|
||||
if (photoblob){
|
||||
$('#marketplacelistproductphoto-' + rownum).attr('src', bloburl);
|
||||
}else{$('#marketplacelistproductphoto-' + rownum).attr('src', imgurl);}
|
||||
|
||||
/* imgurl = '/RequestData/File/' + imgurl;
|
||||
LoadAndCreateURLfromFileHash(imgurl).then(bloburl => {
|
||||
if (!bloburl) {
|
||||
bloburl = '/assets/noproductphoto.png';
|
||||
imgurl = '/assets/noproductphoto.png';
|
||||
}
|
||||
$('#marketplacelistproductphoto-' + rownum).attr('src', bloburl);
|
||||
|
||||
}).catch((err) => {
|
||||
imgurl = '/assets/noproductphoto.png';
|
||||
}); */
|
||||
|
||||
return imgurl;
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
LoadDataPageFunc.Settings.SortArray = function (arr) {
|
||||
return arr.sort((a, b) => new Date(b.created) - new Date(a.created));
|
||||
};
|
||||
};
|
||||
|
||||
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.SearchInput = 'List_Search';
|
||||
LoadDataPageFunc.ids.ListContainer = 'ListRowCard';
|
||||
LoadDataPageFunc.ids.HashKeyContainer = 'ListRowCardHash';
|
||||
LoadDataPageFunc.ids.MainCardBody = 'MAINCARDBODY_LIST';
|
||||
|
||||
LoadDataPageFunc.URLs = {};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
$$$ = {};
|
||||
$$$.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.ClearSearch = function () {
|
||||
$('#' + LoadDataPageFunc.ids.SearchInput).val('');
|
||||
$('#' + LoadDataPageFunc.ids.SearchInput).trigger('keyup');
|
||||
};
|
||||
|
||||
LoadDataPageFunc.GenerateListfromResponse = function (response) {
|
||||
|
||||
let newhtmlrows = ''; let htmlarrayrows = [];
|
||||
const count = response.length;
|
||||
let hashkey;
|
||||
let colsize = '6';
|
||||
htmlarrayrows.push('<div class="row">');
|
||||
for (let i = 0; i < count; i++) {
|
||||
htmlarrayrows.push(LoadDataPageFunc.NewRow(response[i], i));
|
||||
}
|
||||
htmlarrayrows.push('</div>');
|
||||
newhtmlrows = htmlarrayrows.join('');
|
||||
|
||||
return newhtmlrows;
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
LoadDataPageFunc.MemoizeGenerateListResponse = memoize(LoadDataPageFunc.GenerateListfromResponse);
|
||||
|
||||
|
||||
|
||||
|
||||
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(true)
|
||||
.success((response) => {
|
||||
|
||||
|
||||
if (!response) {
|
||||
$('#card-body-' + LoadDataPageFunc.ids.MainCardBody).html(LoadDataPageFunc.Settings.DefaultCardNoDetailsMessage);
|
||||
return;
|
||||
}
|
||||
|
||||
let List = response;
|
||||
|
||||
//let newhtmlrows =LoadDataPageFunc.MemoizeGenerateListResponse(List);
|
||||
newhtmlrows = LoadDataPageFunc.GenerateListfromResponse(List);
|
||||
|
||||
$('#' + LoadDataPageFunc.ids.ListContainer).html(newhtmlrows);
|
||||
|
||||
iterateArray(List,(item,key)=>{
|
||||
LoadDataPageFunc.GetPhotoURL(item['photourl'],key);
|
||||
});
|
||||
LoadDataPageFunc.CardResultInterSectionPreloadDetails();
|
||||
|
||||
//Disabled IMG URL caching from varcache and BLob due to massive slowdown
|
||||
//now Relying on service worker
|
||||
//interceptImageSrcandChangetoBlob(fromvarcache = true, replacewithnologo = true);
|
||||
|
||||
})
|
||||
.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();
|
||||
let h4 = $(this).find('h4').text().toLowerCase();
|
||||
let h3 = $(this).find('h3').text().toLowerCase();
|
||||
let h2 = $(this).find('h2').text().toLowerCase();
|
||||
let h1 = $(this).find('h1').text().toLowerCase();
|
||||
let h5 = $(this).find('h5').text().toLowerCase();
|
||||
let h6 = $(this).find('h6').text().toLowerCase();
|
||||
|
||||
if (title.includes(searchTerm) || cols.includes(searchTerm) ||
|
||||
h1.includes(searchTerm) || h2.includes(searchTerm) || h3.includes(searchTerm)
|
||||
|| h4.includes(searchTerm) || h5.includes(searchTerm) || h6.includes(searchTerm)) {
|
||||
$(this).show();
|
||||
} else {
|
||||
$(this).hide();
|
||||
}
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
LoadDataPageFunc.main = function () {
|
||||
if (LoadDataPageFunc.Settings.CurrentTargetRequired && (!currenttarget || currenttarget === '0')) {
|
||||
$$$.UpdateMainContainer('<center>No Target<br><br>' + buttonprimary('View All Leads', '', "ButtonGo('ListLeads', '')") +
|
||||
'<br><br>' + buttonprimary('Home', '', "ButtonGo('Home', '')") + '</center>'); return false;
|
||||
}
|
||||
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('', FinalInnerHTML, LoadDataPageFunc.ids.MainCardBody);
|
||||
|
||||
$$$.UpdateMainContainer(MainCard);
|
||||
return true;
|
||||
|
||||
};
|
||||
|
||||
LoadDataPageFunc.LoadNow = function () {
|
||||
LoadDataPageFunc.InitializeDynamicVariables();
|
||||
LoadDataPageFunc.main();
|
||||
LoadDataPageFunc.populatelist();
|
||||
changeTopbarTitle(LoadDataPageFunc.Settings.PageName);
|
||||
LoadDataPageFunc.SearchKeyUPListPage();
|
||||
changeTopbarTitle('Products');
|
||||
$('#imgspan' + LoadDataPageFunc.ids.SearchInput).attr('onclick', 'LoadDataPageFunc.ClearSearch();');
|
||||
};
|
||||
|
||||
LoadDataPageFunc.LoadNow();
|
||||
|
||||
|
||||
|
||||
</script>
|
||||
325
legacy/pages-html/slvl/all/Products/ListWholesaleProductMarket
Normal file
325
legacy/pages-html/slvl/all/Products/ListWholesaleProductMarket
Normal file
@@ -0,0 +1,325 @@
|
||||
<style>
|
||||
.ListRowCard {
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
</style>
|
||||
|
||||
<div id='ListMainContainer'>
|
||||
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<script>
|
||||
|
||||
|
||||
|
||||
|
||||
LoadDataPageFunc = {};
|
||||
|
||||
LoadDataPageFunc.NewRow = function (objectdata, rownum) {
|
||||
|
||||
let name = objectdata.name;
|
||||
let unit = objectdata.unit || '';
|
||||
let price = objectdata.price;
|
||||
let description = objectdata.description || '';
|
||||
let imgurl = objectdata.photo
|
||||
let imgwidthheight = 150;
|
||||
let hashkey = objectdata.hashkey;
|
||||
let ahreflink = "ButtonGo('BuyViewProductMarket','" + hashkey + "');";
|
||||
const maxDescriptionChars=80;
|
||||
|
||||
|
||||
//imgurl = LoadDataPageFunc.GetPhotoURL(imgurl, rownum);
|
||||
|
||||
const columnsize = '6';
|
||||
let brdescbefore = '';
|
||||
if (description) {
|
||||
brdescbefore = '<br><br>';
|
||||
}
|
||||
|
||||
if (description.length > maxDescriptionChars) {
|
||||
description = description.substring(0, maxDescriptionChars) + '...';
|
||||
}
|
||||
|
||||
|
||||
imagehtml = `<img id="marketplacelistproductphoto-${rownum}" src="/RequestData/File/${imgurl}" loading="lazy" class="" style="width: 60%;height: 60%;object-fit: contain;">`;
|
||||
|
||||
const style = "width: 100%; height: 100%; object-fit: cover;";
|
||||
|
||||
|
||||
return `<div class="col-${columnsize}" style="overflow:hidden; padding-bottom:10px;">
|
||||
<a href="javascript:void(0);" onclick="${ahreflink}">
|
||||
<div class="card ListRowCard" id="ListRowCard-${rownum}" style="${style}">
|
||||
<div id="cardheader-ListRowCard-${rownum}" class="card-header ui-sortable-handle" style="cursor: move;display:none;">
|
||||
<h3 class="card-title" style="" id="card-title-ListRowCard-${rownum}"></h3>
|
||||
<div class="card-tools" id="card-tools-ListRowCard-${rownum}">
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-body ListCardRow" id="card-body-ListRowCard-${rownum}">
|
||||
<div style="text-align:center;">
|
||||
${imagehtml}
|
||||
</div>
|
||||
<br>
|
||||
<div class="row" style=""><div class="col"><h3>${name}</h3></div><div class="col">P${price} / ${unit}</div></div>
|
||||
${brdescbefore}
|
||||
<h5>${description}</h5>
|
||||
<br>
|
||||
</div>
|
||||
</div>
|
||||
</a>
|
||||
</div>`;
|
||||
|
||||
};
|
||||
|
||||
LoadDataPageFunc.InitializeDynamicVariables = function () {
|
||||
LoadDataPageFunc.URLs.QueryListData = '/Market/Products/Wholesale/List';
|
||||
|
||||
LoadDataPageFunc.Settings.ViewDetailsOnclick = function (data) {
|
||||
return `ButtonGo('ViewLeadDetails', '${data}')`;
|
||||
};
|
||||
|
||||
LoadDataPageFunc.Settings.CurrentTargetRequired = false;
|
||||
|
||||
LoadDataPageFunc.Settings.DefaultDatatoSend = null;
|
||||
|
||||
LoadDataPageFunc.GetPhotoURL = function (imgurl, rownum) {
|
||||
if (!imgurl || !(typeof imgurl === 'string' && imgurl.length < 72)) { return '/assets/noproductphoto.png'; }
|
||||
|
||||
imghash= imgurl.slice(-72);
|
||||
|
||||
// photoblob = fileBlobURLList[imgurl] || false;
|
||||
|
||||
photoblob = Preloaders.getfileBlobURL(imghash);
|
||||
|
||||
if (photoblob){
|
||||
$('#marketplacelistproductphoto-' + rownum).attr('src', bloburl);
|
||||
}else{$('#marketplacelistproductphoto-' + rownum).attr('src', imgurl);}
|
||||
|
||||
/* imgurl = '/RequestData/File/' + imgurl;
|
||||
LoadAndCreateURLfromFileHash(imgurl).then(bloburl => {
|
||||
if (!bloburl) {
|
||||
bloburl = '/assets/noproductphoto.png';
|
||||
imgurl = '/assets/noproductphoto.png';
|
||||
}
|
||||
$('#marketplacelistproductphoto-' + rownum).attr('src', bloburl);
|
||||
|
||||
}).catch((err) => {
|
||||
imgurl = '/assets/noproductphoto.png';
|
||||
}); */
|
||||
|
||||
return imgurl;
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
LoadDataPageFunc.Settings.SortArray = function (arr) {
|
||||
return arr.sort((a, b) => new Date(b.created) - new Date(a.created));
|
||||
};
|
||||
};
|
||||
|
||||
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.SearchInput = 'List_Search';
|
||||
LoadDataPageFunc.ids.ListContainer = 'ListRowCard';
|
||||
LoadDataPageFunc.ids.HashKeyContainer = 'ListRowCardHash';
|
||||
LoadDataPageFunc.ids.MainCardBody = 'MAINCARDBODY_LIST';
|
||||
|
||||
LoadDataPageFunc.URLs = {};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
$$$ = {};
|
||||
$$$.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.ClearSearch = function () {
|
||||
$('#' + LoadDataPageFunc.ids.SearchInput).val('');
|
||||
$('#' + LoadDataPageFunc.ids.SearchInput).trigger('keyup');
|
||||
};
|
||||
|
||||
LoadDataPageFunc.GenerateListfromResponse = function (response) {
|
||||
|
||||
let newhtmlrows = ''; let htmlarrayrows = [];
|
||||
const count = response.length;
|
||||
let hashkey;
|
||||
let colsize = '6';
|
||||
htmlarrayrows.push('<div class="row">');
|
||||
for (let i = 0; i < count; i++) {
|
||||
htmlarrayrows.push(LoadDataPageFunc.NewRow(response[i], i));
|
||||
}
|
||||
htmlarrayrows.push('</div>');
|
||||
newhtmlrows = htmlarrayrows.join('');
|
||||
|
||||
return newhtmlrows;
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
LoadDataPageFunc.MemoizeGenerateListResponse = memoize(LoadDataPageFunc.GenerateListfromResponse);
|
||||
|
||||
|
||||
|
||||
|
||||
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(true)
|
||||
.success((response) => {
|
||||
|
||||
|
||||
if (!response) {
|
||||
$('#card-body-' + LoadDataPageFunc.ids.MainCardBody).html(LoadDataPageFunc.Settings.DefaultCardNoDetailsMessage);
|
||||
return;
|
||||
}
|
||||
|
||||
let List = response;
|
||||
|
||||
//let newhtmlrows =LoadDataPageFunc.MemoizeGenerateListResponse(List);
|
||||
newhtmlrows = LoadDataPageFunc.GenerateListfromResponse(List);
|
||||
|
||||
$('#' + LoadDataPageFunc.ids.ListContainer).html(newhtmlrows);
|
||||
|
||||
iterateArray(List,(item,key)=>{
|
||||
LoadDataPageFunc.GetPhotoURL(item['photourl'],key);
|
||||
});
|
||||
LoadDataPageFunc.CardResultInterSectionPreloadDetails();
|
||||
|
||||
//Disabled IMG URL caching from varcache and BLob due to massive slowdown
|
||||
//now Relying on service worker
|
||||
//interceptImageSrcandChangetoBlob(fromvarcache = true, replacewithnologo = true);
|
||||
|
||||
})
|
||||
.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();
|
||||
let h4 = $(this).find('h4').text().toLowerCase();
|
||||
let h3 = $(this).find('h3').text().toLowerCase();
|
||||
let h2 = $(this).find('h2').text().toLowerCase();
|
||||
let h1 = $(this).find('h1').text().toLowerCase();
|
||||
let h5 = $(this).find('h5').text().toLowerCase();
|
||||
let h6 = $(this).find('h6').text().toLowerCase();
|
||||
|
||||
if (title.includes(searchTerm) || cols.includes(searchTerm) ||
|
||||
h1.includes(searchTerm) || h2.includes(searchTerm) || h3.includes(searchTerm)
|
||||
|| h4.includes(searchTerm) || h5.includes(searchTerm) || h6.includes(searchTerm)) {
|
||||
$(this).show();
|
||||
} else {
|
||||
$(this).hide();
|
||||
}
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
LoadDataPageFunc.main = function () {
|
||||
if (LoadDataPageFunc.Settings.CurrentTargetRequired && (!currenttarget || currenttarget === '0')) {
|
||||
$$$.UpdateMainContainer('<center>No Target<br><br>' + buttonprimary('View All Leads', '', "ButtonGo('ListLeads', '')") +
|
||||
'<br><br>' + buttonprimary('Home', '', "ButtonGo('Home', '')") + '</center>'); return false;
|
||||
}
|
||||
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('', FinalInnerHTML, LoadDataPageFunc.ids.MainCardBody);
|
||||
|
||||
$$$.UpdateMainContainer(MainCard);
|
||||
return true;
|
||||
|
||||
};
|
||||
|
||||
LoadDataPageFunc.LoadNow = function () {
|
||||
LoadDataPageFunc.InitializeDynamicVariables();
|
||||
LoadDataPageFunc.main();
|
||||
LoadDataPageFunc.populatelist();
|
||||
changeTopbarTitle(LoadDataPageFunc.Settings.PageName);
|
||||
LoadDataPageFunc.SearchKeyUPListPage();
|
||||
changeTopbarTitle('Products');
|
||||
$('#imgspan' + LoadDataPageFunc.ids.SearchInput).attr('onclick', 'LoadDataPageFunc.ClearSearch();');
|
||||
};
|
||||
|
||||
LoadDataPageFunc.LoadNow();
|
||||
|
||||
|
||||
|
||||
</script>
|
||||
144
legacy/pages-html/slvl/all/Products/NewProduct
Normal file
144
legacy/pages-html/slvl/all/Products/NewProduct
Normal file
@@ -0,0 +1,144 @@
|
||||
<div id="NewProductForm">
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
<script>
|
||||
|
||||
InitDataPageFuncOBJ();
|
||||
LoadDataPageFunc = {};
|
||||
LoadDataPageFunc.URLs = {};
|
||||
LoadDataPageFunc.URLs.NewUrl = `/Products/New/${currenttarget}`;
|
||||
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("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, 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 categorydatalist = ArraytoDatalist("NewProductCategoryDataList", [], 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) {
|
||||
|
||||
if (!response) {
|
||||
errorModal();
|
||||
return false;
|
||||
}
|
||||
if (response) {
|
||||
Preloaders.ViewProductinMarket(response);
|
||||
successModal();
|
||||
gotoPage('BuyViewProductMarket', response);
|
||||
return true;
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
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>
|
||||
186
legacy/pages-html/slvl/all/Products/PendingBuysProductMarket
Normal file
186
legacy/pages-html/slvl/all/Products/PendingBuysProductMarket
Normal file
@@ -0,0 +1,186 @@
|
||||
<style>
|
||||
.ListRowCard {
|
||||
margin-bottom: 5px;
|
||||
}
|
||||
</style>
|
||||
<div id="MainView" style="padding-top: 5px;">
|
||||
<div class="row" id="CartListRow" style="margin-top: 5px; margin-bottom: 5px;">
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<script>
|
||||
LoadDataPageFunc = {};
|
||||
LoadDataPageFunc.PageTitle = 'Pending Delivery';
|
||||
LoadDataPageFunc.MainDetailsURL = '';
|
||||
LoadDataPageFunc.Details = {};
|
||||
|
||||
LoadDataPageFunc.SetQuantityUI = function (newquantity, rownum) {
|
||||
if (typeof rownum !== 'number') { return false; }
|
||||
if (typeof newquantity !== 'number') { return false; }
|
||||
let controlid = "ProductCartMarket-" + rownum;
|
||||
$('#' + controlid).html(newquantity);
|
||||
const newvalue = $('#' + controlid).html();
|
||||
if (newquantity !== newvalue) { return false; }
|
||||
return true;
|
||||
};
|
||||
|
||||
|
||||
LoadDataPageFunc.FindRowNumByHash = function (hashkey) {
|
||||
let element = $('[data-hash="' + hashkey + '"]');
|
||||
if (element.length === 0) { return false; }
|
||||
let nrownum = element.data('rownum');
|
||||
return nrownum
|
||||
};
|
||||
|
||||
|
||||
LoadDataPageFunc.SetQuantitybyHash = function (newquantity, hashkey) {
|
||||
|
||||
if ( !hashkey || typeof hashkey !== 'string') { return false; }
|
||||
let rownum = '';
|
||||
rownum =LoadDataPageFunc.FindRowNumByHash(hashkey);
|
||||
|
||||
if (rownum===false) { return false; }
|
||||
const changequantity = LoadDataPageFunc.SetQuantityUI(newquantity, rownum);
|
||||
if (!changequantity) { return false; }
|
||||
return true;
|
||||
};
|
||||
|
||||
LoadDataPageFunc.UpdateProductQuantityCart=function(response,producthash){
|
||||
|
||||
if (response === false) { return false; }
|
||||
if (typeof response !== 'number') {
|
||||
return false;
|
||||
};
|
||||
return LoadDataPageFunc.SetQuantitybyHash(response, producthash);
|
||||
|
||||
};
|
||||
|
||||
|
||||
LoadDataPageFunc.RequestData = new RequestData(false);
|
||||
|
||||
LoadDataPageFunc.PendingDeliveryRow = function (rowdata, rownum) {
|
||||
const hashkey = rowdata.hashkey || false;
|
||||
if (!hashkey){return '';}
|
||||
let productviewonclick = "ButtonGo('TransactionDetailsProductMarket','" + hashkey + "');";
|
||||
const photourlsArray = rowdata.photourl;
|
||||
let photourl = ''
|
||||
if (photourlsArray && typeof photourlsArray === "array") {
|
||||
photourl = photourlsArray[0];
|
||||
} else {
|
||||
photourl = photourlsArray;
|
||||
}
|
||||
const name = rowdata.name;
|
||||
const price = rowdata.transactionprice |'';
|
||||
const unit = rowdata.unit;
|
||||
const items=rowdata.noofitems;
|
||||
const transactiondate= formatDateTimetoReadable(rowdata.date) || '';
|
||||
const priceperunit = 'P' + price + ' / ' + unit;
|
||||
photourl = '/RequestData/File/' + photourl;
|
||||
const transactioncode =rowdata.transactioncode ||'';
|
||||
|
||||
|
||||
return `<div class="col-md card ListRowCard" style="overflow:hidden;" data-hash="${hashkey}" data-rownum="${rownum}">
|
||||
|
||||
<div class="row">
|
||||
<div class="col" id ="product-image-marketplace-pendingbuys-${rownum}" style=" padding-top: 10px; padding-bottom: 10px;">
|
||||
<a href="javascript:void(0);" onclick="${productviewonclick}">
|
||||
<img id="ProductPendingBuysMarketPlacePhoto-${rownum}" src="${photourl}" style="width: 200px;height: 200px;">
|
||||
</a>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="col" id=${'product-controls-pendingbuys-marketplace-container-' + rownum}>
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
|
||||
</div>
|
||||
<div class="col-12" style=" padding-top: 10px;text-align:center;">
|
||||
<h6 style="font-weight:200;">${transactioncode}<br>${transactiondate}</h6>
|
||||
<h3>${name}<br>...</h3>
|
||||
<h6>${'Total items '+items}</h6>
|
||||
</div>
|
||||
|
||||
<div class="col-12 " style="text-align: center;">
|
||||
<br><br>
|
||||
<h1 id="PendingBuysMarket-${rownum}">Total Price: P${price}</h1>
|
||||
</div>
|
||||
<div class="col-12">
|
||||
<br><br>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>`;
|
||||
};
|
||||
|
||||
|
||||
LoadDataPageFunc.PopulateDetails = function () {
|
||||
|
||||
let reqq = new RequestData(true);
|
||||
reqq.fromVarCache(true).data().url('/marketplace/pending/delivery').type('POST')
|
||||
.success((response) => {
|
||||
let htmllist = []; let finalhtml = '';
|
||||
|
||||
response =[];
|
||||
response[0]={
|
||||
hashkey:'afrvfdv',
|
||||
date:'2024-04-29 21:26:09',
|
||||
photourl:'d5650f203fcd447bc7c409f9f0d06a67315041dcd3fd599f63b80d8fe5cc95734b644c2d',
|
||||
transactionprice: 200,
|
||||
transactioncode:'BM-06A67315041DCD3FD-2024',
|
||||
name: 'Sinandomeng',
|
||||
noofitems: 3,
|
||||
trackingnumber:'PXA38U67',
|
||||
};
|
||||
response[1]={
|
||||
hashkey:'ddddd',
|
||||
date:'2024-04-29 21:26:09',
|
||||
photourl:'d5650f203fcd447bc7c409f9f0d06a67315041dcd3fd599f63b80d8fe5cc95734b644c2d',
|
||||
transactionprice: 200,
|
||||
transactioncode:'BM-06A67315041DCD3FD-2024',
|
||||
name: 'cocopandan',
|
||||
noofitems: 3,
|
||||
trackingnumber:'PXA38U67',
|
||||
} ;
|
||||
|
||||
if (!response) { return false; }
|
||||
|
||||
LoopArrayorObject(response, (item,rownum) => {
|
||||
htmllist.push(LoadDataPageFunc.PendingDeliveryRow(item, rownum));
|
||||
});
|
||||
|
||||
finalhtml = htmllist.join('');
|
||||
$('#CartListRow').html(finalhtml);
|
||||
|
||||
LoopArrayorObject(response, (item,rownum) => {
|
||||
LoadAndCreateURLfromFileHash(item.photourl).then(bloburl => {
|
||||
const imgid = 'ProductPendingBuysMarketPlacePhoto-' + rownum;
|
||||
$('#ProductPendingBuysMarketPlacePhoto-' + rownum).attr('src', bloburl);
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
|
||||
}).go();
|
||||
|
||||
};
|
||||
|
||||
LoadDataPageFunc.Main = function () {
|
||||
changeTopbarTitle(LoadDataPageFunc.PageTitle);
|
||||
LoadDataPageFunc.PopulateDetails();
|
||||
};
|
||||
|
||||
|
||||
|
||||
LoadDataPageFunc.Main();
|
||||
</script>
|
||||
660
legacy/pages-html/slvl/all/ReferProperty
Normal file
660
legacy/pages-html/slvl/all/ReferProperty
Normal file
@@ -0,0 +1,660 @@
|
||||
<br><br>
|
||||
<div id="viewContainer">
|
||||
</div>
|
||||
|
||||
|
||||
<script>$(".bottom-navigation-bar").remove(); $(".header").remove();</script>
|
||||
<script>
|
||||
|
||||
|
||||
$$ = {};
|
||||
$$.UI = {};
|
||||
$$.UI.Table = {};
|
||||
$$.UI.Table.CreateTable = function (id, theadinnerhtml, bodyinnerhtml) { return CreateTable(id, theadinnerhtml, bodyinnerhtml); };
|
||||
$$.UI.Table.GenerateTheadFromArraySimple = function (array) { return GenerateTheadFromArraySimple(array); };
|
||||
$$.UI.Table.GenerateTableRowFromArraySimple = function (array) { return GenerateTableRowFromArraySimple(array); };
|
||||
$$.UI.ResetBrowserAndCache = function () { return ResetBrowserAndCache(); };
|
||||
$$.UI.formatCurrency = function (number, withdecimal = true) { return formatCurrency(number, withdecimal); };
|
||||
$$.UI.getDateInGMT8 = function () { return getDateInGMT8(); };
|
||||
$$.UI.RunFunctiononMutation = function (targetidToMonitor, callbackfunction) { return RunFunctiononMutation(targetidToMonitor, callbackfunction); };
|
||||
$$.UI.Element = {};
|
||||
$$.UI.Element.appendtobody = function (string) { return appendtobody(string); };
|
||||
$$.UI.Element.Exists = function (ElementIDtext) { ElementExists(ElementIDtext); };
|
||||
$$.UI.Element.RemovebyID = function (idstring) { return removeelementbyID(idstring); };
|
||||
$$.UI.Element.DeleteById = function (id) { return DeleteElementById(id); }
|
||||
$$.UI.Element.getHTML = function (idetext) { return getElementhtml(idtext); };
|
||||
$$.UI.Element.setHTML = function (idetext, html) { return setElementhtml(idtext, html); };
|
||||
$$.UI.Element.getValue = function (idetext) { return getElementvalue(idtext); };
|
||||
$$.UI.Element.setValue = function (idetext,) { return setElementvalue(idtext, value); };
|
||||
$$.UI.Validate = {};
|
||||
$$.UI.Validate.isValidEmail = function (email) { return isValidEmail(email); };
|
||||
$$.UI.Validate.hasValidMobileFormat = function (usernumber) { return hasValidMobileFormat(usernumber); };
|
||||
$$.UI.Modal = {};
|
||||
$$.UI.Modal.Create = function (modalid, modaltitle, modalbody, modalfooter, modalfooterclose = true, topclosebutton = true, modalbodyclass = 'modal-body', modalheaderclass = 'modal-header') { return createmodal(modalid, modaltitle, modalbody, modalfooter, modalfooterclose, topclosebutton, modalbodyclass, modalheaderclass); };
|
||||
$$.UI.Modal.Show = function (idtxt) { return modalshow(idtxt); };
|
||||
$$.UI.Modal.Hide = function (idtxt) { return modalhide(); };
|
||||
$$.UI.Modal.CreateAndShow = function (modalid, modaltitle, modalbody, modalfooter = '', modalfooterclose = true, topclosebutton = true, modalbodyclass = 'modal-body', modalheaderclass = 'modal-header') { return CreateAndShowModal(modalid, modaltitle, modalbody, modalfooter, modalfooterclose, topclosebutton, modalbodyclass, modalheaderclass); };
|
||||
$$.UI.Modal.ModalQuickDismiss = function (modaltitle, modalbody, modalid = '', modaltohide = '', functiontodo = '', conditiontrue = true) { return ModalQuickDismiss(modaltitle, modalbody, modalid, modaltohide, functiontodo, conditiontrue) };
|
||||
$$.UI.Modal.ModalContinueCancel = function (modalid, modaltitle, modalbody, continuebuttononclick, cancelbuttontext = 'Cancel', continuebuttontext = 'Continue', continuebuttoncss = 'btn btn-danger', cancelbuttoncss = 'btn btn-warning') { return ModalContinueCancel(modalid, modaltitle, modalbody, continuebuttononclick, cancelbuttontext, continuebuttontext, continuebuttoncss, cancelbuttoncss); };
|
||||
$$.UI.Modal.hide = function (modalid) { return hidemodal(modalid); };
|
||||
$$.UI.Modal.show = function (modalid) { return showmodal(modalid); };
|
||||
$$.UI.col = function (content = '', additionalclass = '') { return col(content, additionalclass); };
|
||||
$$.UI.row = function (content = '', additionalclass = '', hidden = false, style = '') { return row(content, additionalclass, hidden, style); };
|
||||
$$.UI.dualcolrow = function (colcontent1, colcontent2, rowclass = '', hidden = false, style = '') { return dualcolrow(colcontent1, colcontent2, rowclass, hidden, style); };
|
||||
$$.UI.Button = {};
|
||||
$$.UI.Button.Default = function (content, value = '', onclick = '', idtext = '', setclass = '', addtionaldata = '') { return button(content, value, onclick, idtext, setclass, addtionaldata); };
|
||||
$$.UI.Button.Warning = function (content, value = '', onclick = '', block = '', idtext = '', addclass = '', addtionaldata = '') { return buttonwarning(content, value, onclick, block, idtext, addclass, addtionaldata); };
|
||||
$$.UI.Button.Danger = function (content, value = '', onclick = '', block = '', idtext = '', addclass = '', addtionaldata = '') { return buttondanger(content, value, onclick, block, idtext, addclass, addtionaldata); };
|
||||
$$.UI.Button.Primary = function (content, value = '', onclick = '', block = '', idtext = '', addclass = '', addtionaldata = '') { return buttonprimary(content, value, onclick, block, idtext, addclass, addtionaldata); };
|
||||
$$.UI.Button.HomeMenuButtons = function (buttonicon, buttonText, buttonGo, buttonVariabletoPass = '', iconwidth = '', iconheight = '', buttonstyle = '', buttononclick = '', divclass = '', divid = '', buttonid = '', textclass = '') { return HomeMenuButtons(buttonicon, buttonText, buttonGo, buttonVariabletoPass, iconwidth, iconheight, buttonstyle, buttononclick, divclass, divid, buttonid, textclass); };
|
||||
$$.UI.Input = {};
|
||||
$$.UI.Input.textInput = function (idtext = '', setclass = '', required = '', placeholder = '', value = '') { return textinput(idtext, setclass, required, placeholder, value); };
|
||||
$$.UI.Input.textFormControl = function (idtext = '', addclass = '', required = '', placeholder = '', value = '') { return textformcontrol(idtext, addclass, required, placeholder, value); };
|
||||
$$.UI.Card = {};
|
||||
$$.UI.Card.Create = function (cardtitle = '', cardid = '', cardtools = '', cardbodyid = '', cardbodytext = '', cardbodyclassadd = '', maincardstyle = '', titlecardhide = false) { return createCard(cardtitle, cardid, cardtools, cardbodyid, cardbodytext, cardbodyclassadd, maincardstyle, titlecardhide); };
|
||||
$$.UI.Card.Simple = function (title = '', text = '', id = '') { return CreateCardSimple(title, text, id); };
|
||||
$$.UIalt = {};
|
||||
$$.UIalt.hrefonclickButtonGO = function (pagename, pagedatastring = '') { return hrefonclickButtonGO(pagename, pagedatastring); };
|
||||
$$.UIalt.generateHTMLfromarray = function (prepend, append, array, func) { return generateHTMLfromarray(prepend, append, array, func); };
|
||||
$$.UIalt.imgiconuserdefault = function (imgsrc, imgwidth = '', imgheight = '', id = '') { return imgiconuserdefault(imgsrc, imgwidth, imgheight, id); };
|
||||
$$.UIalt.UICardStats = {};
|
||||
$$.UIalt.UICardStats.UICardStatsDetails = function (Title = '', number = 0, Unit = '', leftORright = 'left', numberid = '') { return UICardStatsDetails(Title, number, Unit, leftORright, numberid); };
|
||||
$$.UIalt.UICardStats.UIStatsDetailsArray = function (statsarray) { return UIStatsDetailsArray(statsarray); };
|
||||
$$.UIalt.BalanceCard = {};
|
||||
$$.UIalt.BalanceCard.UIBalance_WrapperfromArray = function (statsarray) { return UIBalance_WrapperfromArray(statsarray); };
|
||||
$$.UIalt.BalanceCard.UIBalance_Wrapper_WalletFooter_Item = function (maintitle = '', onclickstring = '', imgsrc = '', href = '', subtitleline1 = '', subtitleline2 = '', subtitleline3 = '', subtitleline4 = '', imgwidth = '', imgheight = '') { return UIBalance_Wrapper_WalletFooter_Item(maintitle, onclickstring, imgsrc, href, subtitleline1, subtitleline2, subtitleline3, subtitleline4, imgwidth, imgheight); };
|
||||
$$.UIalt.BalanceCard.UIBalance_Wrapper_WalletFooter_Item_ButtonGO = function (maintitle, pagename, pagestring = '', iconclass = '', subtitleline1 = '', subtitleline2 = '', subtitleline3 = '', subtitleline4 = '') { return UIBalance_Wrapper_WalletFooter_Item_ButtonGO(maintitle, pagename, pagestring, iconclass, subtitleline1, subtitleline2, subtitleline3, subtitleline4); };
|
||||
$$.UIalt.BalanceCard.UIBalance_Wrapper_WalletFooter_ARRAY = function (balancewrapper_item_array) { return UIBalance_Wrapper_WalletFooter_ARRAY(balancewrapper_item_array); };
|
||||
$$.UIalt.BalanceCard.UIcreateBalanceBoxfromArray = function (statsarray, balancewrapper_item_array, style = 'border: solid 3px #000d88;') { return UIcreateBalanceBoxfromArray(statsarray, balancewrapper_item_array, style); };
|
||||
$$.UIalt.Services = {};
|
||||
$$.UIalt.Services.Button = function (imgiconsrc, title = '', onclick = '', href = '', bgcolor8 = false) { return UIServices_Button(imgiconsrc, title, onclick, href, bgcolor8); };
|
||||
$$.UIalt.Services.Button_GOTOPAGE = function (imgiconsrc, title, pagename, pagedatastring = '') { return UIServices_Button_GOTOPAGE(imgiconsrc, title, pagename, pagedatastring); };
|
||||
$$.UIalt.Services.FullDIV_GOTOPAGE_Array = function (title, viewallhref = '', viewallonclick = '', viewalltext = '', services_button_array) { return UIServices_FullDIV_GOTOPAGE_Array(title, viewallhref, viewallonclick, viewalltext, services_button_array); };
|
||||
$$.UIalt.Services.FullDIV_ONCLICK_Array = function (title, viewallhref = '', viewallonclick = '', viewalltext = '', services_button_array) { return UIServices_FullDIV_ONCLICK_Array(title, viewallhref, viewallonclick, viewalltext, services_button_array); };
|
||||
$$.UIalt.Sidetext = {};
|
||||
$$.UIalt.Sidetext.UISideText_DualColumnButton = function (text, pagename, pagedatastring = '', imgsrc = '', imgwidth = '', imgheight = '') { return UISideText_DualColumnButton(text, pagename, pagedatastring, imgsrc, imgwidth, imgheight); };
|
||||
$$.UIalt.Sidetext.UISideText_DualColumnButton_Array = function (sidetext_button_dualcolumn_array) { return UISideText_DualColumnButton_Array(sidetext_button_dualcolumn_array); };
|
||||
$$.UIalt.UICardSimple = function (title, text = '', id = '') { return UICardSimple(title, text, id); };
|
||||
$$.UIalt.RecentSearchBar = {};
|
||||
$$.UIalt.RecentSearchBar.SearchBar = function (searchplaceholdertext, classtosearch, id, imgsrclefticon = '', imgsrcrighticon = '', imgwidth = '', imgheight = '') { return UIRecentSearchBar(searchplaceholdertext, classtosearch, id, imgsrclefticon, imgsrcrighticon, imgwidth, imgheight); };
|
||||
$$.UIalt.RecentSearchBar.Searchable_Button_GO = function (title, subtitle, rightsidetext, classforsearch, pagename, pagedatastring = '', imgsrc, imgwidth = '', imgheight = '') { return UIRecentSearchable_Button_GO(title, subtitle, rightsidetext, classforsearch, pagename, pagedatastring, imgsrc, imgwidth, imgheight); };
|
||||
$$.UIalt.RecentSearchBar.Searchable_Button_GO_ARRAY = function (title, recentssearchablebuttonarray, viewallpagetarget, viewallpagedata = '', viewalltext = '') { return UIRecentSearchable_Button_GO_ARRAY(title, recentssearchablebuttonarray, viewallpagetarget, viewallpagedata, viewalltext); };
|
||||
$$.UIalt.UIListArrowButton_GO = function (title, subtitle, pagename, pagedatastring = '', imgsrc, imgwidth = '', imgheight = '') { return UIListArrowButton_GO(title, subtitle, pagename, pagedatastring, imgsrc, imgwidth, imgheight); };
|
||||
$$.UIalt.RecentSearchBar.SearchBox_with_BUTTONS_FULL = function (title, recentssearchablebuttonarray, UIListArrowButtonGOARRAY = '', viewallpagetarget, viewallpagedata = '', viewalltext = '', classtosearch = '', searchid = '', searchplaceholdertext = '', searchlefticon = '', searchrighticon = '', imgwidth = '', imgheight = '') { return UISearchBox_with_BUTTONS_FULL(title, recentssearchablebuttonarray, UIListArrowButtonGOARRAY, viewallpagetarget, viewallpagedata, viewalltext, classtosearch, searchid, searchplaceholdertext, searchlefticon, searchrighticon, imgwidth, imgheight); };
|
||||
$$.UIalt.Input = {};
|
||||
$$.UIalt.Input.InputGroupCore = function (innerhtml = '', label = '', inputgroupid = '') { return UIinputgroupcore(innerhtml, label, inputgroupid); };
|
||||
$$.UIalt.Input.InputGroup = function (placeholder, type, id, label = '', classinput = '', spanclass = '', imginsteadofspan = '', required = false, textvalue = '') { return UIInputGroup(placeholder, type, id, label, classinput, spanclass, imginsteadofspan, required, textvalue); };
|
||||
$$.UIalt.Input.InputGroupSelect = function (id = '', label = '', optionsarray = '', spanclass = '', imginsteadofspan = '', selectedvalue = '') { return UIInputGroupSelect(id, label, optionsarray, spanclass, imginsteadofspan, selectedvalue); };
|
||||
$$.UIalt.Input.InputGroupDatePicker = function () { return UIInputGroupDatePicker(); };
|
||||
$$.UIalt.Input.ArraytoOptionforSelect = function (array, selectedvalue = '') { return UIArraytoOptionforSelect(array, selectedvalue); };
|
||||
$$.UIalt.Input.ReplaceCurrentOptionsSelect = function (selectid, optionsarray, selectedvalue = '') { return UIReplaceCurrentOptionsSelect(selectid, optionsarray, selectedvalue); };
|
||||
$$.UIalt.Input.InputGroupButton = function (buttontext, buttonclass = '', buttonid = '', onclick = '', buttonstyle = '') { return UIInputGroupButton(buttontext, buttonclass, buttonid, onclick, buttonstyle); };
|
||||
$$.UIalt.UISetDarkMode = function () { return UISetDarkMode(); };
|
||||
$$.UIalt.UIUpdateBodyHTML = function (html = '') { return UIUpdateBodyHTML(html); };
|
||||
$$.UIalt.changeTopbarTitle = function (title) { return changeTopbarTitle(title); };
|
||||
$$.StatusIntToString = function (Status) { return InttoStrDetailsFuncs.Status(Status); };
|
||||
$$.StatusPropertiesIntToString = function (Status) { return InttoStrDetailsFuncs.PropertyStatus(Status); };
|
||||
</script>
|
||||
<script>
|
||||
Target_Uploaded_Files = [];
|
||||
LoadDataPageFunc = {};
|
||||
LoadDataPageFunc.Settings = {};
|
||||
LoadDataPageFunc.PageTitle = 'Property Details';
|
||||
LoadDataPageFunc.currentTargetPage = 'ReferProperty';
|
||||
|
||||
LoadDataPageFunc.URLs = {};
|
||||
LoadDataPageFunc.URLs.MainData = '/View/Property/Details';
|
||||
LoadDataPageFunc.URLs.AddLog = '/View/Property/Details/Logs/Add';
|
||||
LoadDataPageFunc.URLs.SubmitEdit = '/View/Property/Details/Edit/Submit';
|
||||
LoadDataPageFunc.URLs.ChangeStatus = '/View/Property/Details/ChangeStatus'
|
||||
|
||||
LoadDataPageFunc.ids = {};
|
||||
LoadDataPageFunc.ids.ViewPropertyContainer = "viewContainer";
|
||||
LoadDataPageFunc.ids.ViewDetailsLogsContainer = 'ViewDetailsLogsContainer';
|
||||
LoadDataPageFunc.ids.ViewPropertyCard = 'ViewPropertyCard';
|
||||
LoadDataPageFunc.ids.ViewPropertyDetailsCardBody = 'ViewPropertyDetailsCardBody';
|
||||
LoadDataPageFunc.ids.PreviousLogsPage = 'prevBtnLogsPropertyDetailsPage';
|
||||
LoadDataPageFunc.ids.NextLogsPage = 'nextBtnLogsPropertyDetailsPage';
|
||||
LoadDataPageFunc.ids.ChangeStatus_Select = 'ViewPropertyDetails_ChangeStatus_Select';
|
||||
|
||||
LoadDataPageFunc.onclicks = {};
|
||||
LoadDataPageFunc.onclicks.SubmitReferral = 'LoadDataPageFunc.EditDetails.NewReferralModal();';
|
||||
|
||||
|
||||
LoadDataPageFunc.Logs = {};
|
||||
LoadDataPageFunc.Logs.Pagination = {};
|
||||
|
||||
|
||||
LoadDataPageFunc.Logs.Pagination.cardsPerPage = 5;
|
||||
LoadDataPageFunc.Logs.Pagination.currentPage = 1;
|
||||
|
||||
LoadDataPageFunc.Logs.LogRowCard = function (Date = '', content = '') {
|
||||
content = replaceLineBreaks(content);
|
||||
return (UICardSimple('', formatDateTimetoReadable(Date) + '<br><br><h4>' + content + '</h4>'));
|
||||
};
|
||||
|
||||
LoadDataPageFunc.Logs.Pagination.PageArray = function () {
|
||||
return divideArrayIntoSets(LoadDataPageFunc.Logs.LogsCardRowHTMLArray, LoadDataPageFunc.Logs.Pagination.cardsPerPage);
|
||||
};
|
||||
|
||||
LoadDataPageFunc.Logs.Pagination.Firstpage = 1;
|
||||
LoadDataPageFunc.Logs.Pagination.Lastpage = function () {
|
||||
return LoadDataPageFunc.Logs.Pagination.PageArray().length;
|
||||
};
|
||||
|
||||
LoadDataPageFunc.Logs.LogsCardRowHTMLArray = [];
|
||||
|
||||
|
||||
LoadDataPageFunc.Logs.Pagination.FirstPageFound = function () {
|
||||
$('#' + LoadDataPageFunc.ids.NextLogsPage).prop('disabled', false);
|
||||
$('#' + LoadDataPageFunc.ids.PreviousLogsPage).prop('disabled', true);
|
||||
};
|
||||
LoadDataPageFunc.Logs.Pagination.LastPageFound = function () {
|
||||
$('#' + LoadDataPageFunc.ids.NextLogsPage).prop('disabled', true);
|
||||
$('#' + LoadDataPageFunc.ids.PreviousLogsPage).prop('disabled', false);
|
||||
};
|
||||
|
||||
LoadDataPageFunc.Logs.Pagination.MiddlePageFound = function () {
|
||||
$('#' + LoadDataPageFunc.ids.NextLogsPage).prop('disabled', false);
|
||||
$('#' + LoadDataPageFunc.ids.PreviousLogsPage).prop('disabled', false);
|
||||
};
|
||||
|
||||
LoadDataPageFunc.Logs.Pagination.OnlyOnePageFound = function () {
|
||||
$('#' + LoadDataPageFunc.ids.NextLogsPage).prop('disabled', true);
|
||||
$('#' + LoadDataPageFunc.ids.PreviousLogsPage).prop('disabled', true);
|
||||
};
|
||||
|
||||
LoadDataPageFunc.Logs.LogRowHtmlPage = function (page = 1) {
|
||||
if (page) { LoadDataPageFunc.Logs.Pagination.currentPage = page; }
|
||||
|
||||
let arrayset = LoadDataPageFunc.Logs.Pagination.PageArray();
|
||||
let newpageindex = LoadDataPageFunc.Logs.Pagination.currentPage - 1;
|
||||
|
||||
|
||||
if (!isIndexAccessibleArray(arrayset, newpageindex)) {
|
||||
return false;
|
||||
}
|
||||
LoadDataPageFunc.Logs.Pagination.DetectAndTogglePageButton(page);
|
||||
|
||||
let targetarr = arrayset[newpageindex];
|
||||
const htmlstr = targetarr.join('<br>');
|
||||
|
||||
$('#' + LoadDataPageFunc.ids.ViewDetailsLogsContainer).html(htmlstr);
|
||||
};
|
||||
|
||||
LoadDataPageFunc.Logs.Pagination.DetectAndTogglePageButton = function (newpage) {
|
||||
if (newpage <= LoadDataPageFunc.Logs.Pagination.Firstpage) { LoadDataPageFunc.Logs.Pagination.FirstPageFound(); }
|
||||
else if (newpage >= LoadDataPageFunc.Logs.Pagination.LastPageFound()) {
|
||||
LoadDataPageFunc.Logs.Pagination.FirstPageFound();
|
||||
} else if (LoadDataPageFunc.Logs.Pagination.Lastpage() == 1) {
|
||||
LoadDataPageFunc.Logs.Pagination.OnlyOnePageFound();
|
||||
} else if (newpage > LoadDataPageFunc.Logs.Pagination.Firstpage && newpage < LoadDataPageFunc.Logs.Pagination.Lastpage()) {
|
||||
LoadDataPageFunc.Logs.Pagination.MiddlePageFound();
|
||||
}
|
||||
|
||||
if (LoadDataPageFunc.Logs.Pagination.Lastpage() === 1) {
|
||||
LoadDataPageFunc.Logs.Pagination.OnlyOnePageFound();
|
||||
}
|
||||
};
|
||||
|
||||
LoadDataPageFunc.Logs.changePage = function (forwardORBackward) {
|
||||
if (!forwardORBackward) { return false; }
|
||||
|
||||
let newpage = LoadDataPageFunc.Logs.Pagination.currentPage;
|
||||
if (forwardORBackward === -1) { newpage = newpage - 1; }
|
||||
else if (forwardORBackward === 1) { newpage = newpage + 1; }
|
||||
if (newpage < LoadDataPageFunc.Logs.Pagination.Firstpage || newpage > LoadDataPageFunc.Logs.Pagination.Lastpage()) {
|
||||
newpage = LoadDataPageFunc.Logs.Pagination.currentPage;
|
||||
return false;
|
||||
}
|
||||
|
||||
LoadDataPageFunc.Logs.Pagination.DetectAndTogglePageButton(newpage);
|
||||
LoadDataPageFunc.Logs.Pagination.currentPage = newpage;
|
||||
|
||||
// Load the new page
|
||||
LoadDataPageFunc.Logs.LogRowHtmlPage(newpage);
|
||||
};
|
||||
|
||||
|
||||
LoadDataPageFunc.Logs.LogFullCard = function (obj) {
|
||||
if (!obj.logs) { return ''; }
|
||||
LoadDataPageFunc.LogsCardRowHTMLArray = [];
|
||||
let newlogfullarr = [];
|
||||
if (obj.logs && Array.isArray(obj.logs)) {
|
||||
newlogfullarr.push('<br><br><div id="' + LoadDataPageFunc.ids.ViewDetailsLogsContainer + '">');
|
||||
let logrow = '';
|
||||
|
||||
const reversedLogs = [...obj.logs].reverse();
|
||||
|
||||
for (let log of reversedLogs) {
|
||||
logrow = LoadDataPageFunc.Logs.LogRowCard(log[0], log[1]);
|
||||
LoadDataPageFunc.Logs.LogsCardRowHTMLArray.push(logrow);
|
||||
// newlogfullarr.push(logrow);
|
||||
}
|
||||
}
|
||||
newlogfullarr.push('</div>');
|
||||
|
||||
return newlogfullarr.join('');
|
||||
|
||||
};
|
||||
|
||||
LoadDataPageFunc.RefetchDataAndReload = function (istrue = true) {
|
||||
if (!istrue) { return false; }
|
||||
Preloaders.ViewPropertyDetailsData(currenttarget, false,
|
||||
function (response) {
|
||||
ReloadPage();
|
||||
}
|
||||
);
|
||||
};
|
||||
|
||||
LoadDataPageFunc.DetailsCardControls = function () {
|
||||
let 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>`;
|
||||
};
|
||||
let htmlarr = [`<div class="mt-5"><div class="tf-container">`];
|
||||
htmlarr.push('<ul class="box-service mt-3">');
|
||||
htmlarr.push(buttonLImaker('Interested', LoadDataPageFunc.onclicks.SubmitReferral, 'edit.png'));
|
||||
htmlarr.push(buttonLImaker('View More Properties', `window.location.href=window.location.origin+'/r/${LoadDataPageFunc.ReferralCode}'`, 'ListLeads.png'));
|
||||
htmlarr.push('</ul</div></div>');
|
||||
return htmlarr.join('');
|
||||
};
|
||||
|
||||
LoadDataPageFunc.getReferralCode = function () {
|
||||
const urlObj = window.location.pathname;
|
||||
const segments = urlObj.split('/');
|
||||
const drIndex = segments.indexOf('dr');
|
||||
if (drIndex !== -1 && drIndex + 1 < segments.length) {
|
||||
return segments[drIndex + 1];
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
LoadDataPageFunc.Details = {};
|
||||
LoadDataPageFunc.Details.Status = '';
|
||||
LoadDataPageFunc.ids.PhotosShowCard = 'PhotosCard';
|
||||
|
||||
LoadDataPageFunc.PropertyDetailsCard = function (obj) {
|
||||
if (!obj) { return false; }
|
||||
|
||||
let rowcoldetail = [];
|
||||
const imgwidth = '200px'; const imgheight = "200px";
|
||||
if (!obj) { rowcoldetail = 'No Data'; return createCard('Unknown', cardid = 'PropertyRowCard-' + rownum, '', cardbodyid = '', rowcoldetail, cardbodyclassadd = 'ListPropertyRow'); }
|
||||
|
||||
let created = obj.created || false;
|
||||
let modified = obj.modified || false;
|
||||
let name = obj.name || false;
|
||||
let description = obj.description || false;
|
||||
let status = obj.status || false;
|
||||
let remarks = obj.remarks || false;
|
||||
let referralid = obj.referralid || false;
|
||||
let createdby = obj.createdby || false;
|
||||
let category = obj.category || '';
|
||||
let subcategory = obj.subcategory || '';
|
||||
let photourl = obj.photourl || false;
|
||||
let sqm = obj.sqm || false;
|
||||
let bedrooms = obj.bedrooms || false;
|
||||
let rooms = obj.rooms || false;
|
||||
let toilet = obj.toilet || false;
|
||||
let kitchen = obj.kitchen || false;
|
||||
let floors = obj.floors || false;
|
||||
let price = obj.price || false;
|
||||
let specs = obj.specs || false;
|
||||
let location = obj.location || false
|
||||
|
||||
status = InttoStrDetailsFuncs.PropertyStatus(status);
|
||||
modified = formatDateTimetoReadable(modified);
|
||||
created = formatDateTimetoReadable(created);
|
||||
|
||||
try { photourl = JSON.parse(photourl); } catch (e) { photourl = photourl; }
|
||||
|
||||
//LoadDataPageFunc.Details.Status = Status;
|
||||
|
||||
const AddDualColifValue = function (varstr, label) {
|
||||
if (varstr !== false && varstr !== null) {
|
||||
rowcoldetail.push(dualcolrow(label, varstr));
|
||||
}
|
||||
};
|
||||
|
||||
rowcoldetail.push(createCard('', LoadDataPageFunc.ids.PhotosShowCard, '', LoadDataPageFunc.ids.ViewPropertyDetailsCardBody, '', '', '', true));
|
||||
rowcoldetail.push('<br><br>');
|
||||
AddDualColifValue(subcategory, category);
|
||||
AddDualColifValue(location, 'Location');
|
||||
AddDualColifValue(sqm, 'Size');
|
||||
AddDualColifValue(bedrooms, 'Bedrooms');
|
||||
AddDualColifValue(rooms, 'Rooms');
|
||||
AddDualColifValue(toilet, 'Toilet');
|
||||
AddDualColifValue(kitchen, 'Kitchen');
|
||||
AddDualColifValue(floors, 'Floors');
|
||||
AddDualColifValue(price, 'Price');
|
||||
rowcoldetail.push('<br><br>');
|
||||
|
||||
rowcoldetail.push(LoadDataPageFunc.DetailsCardControls());
|
||||
//rowcoldetail.push(LoadDataPageFunc.Logs.LogFullCard(obj));
|
||||
|
||||
const finalRowColDetail = rowcoldetail.join('');
|
||||
|
||||
let ViewPropertyCardDetails = createCard(name, LoadDataPageFunc.ids.ViewPropertyCard, created, LoadDataPageFunc.ids.ViewPropertyDetailsCardBody, cardbody = finalRowColDetail);
|
||||
return ViewPropertyCardDetails;
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
LoadDataPageFunc.LoadPhotosCard = async function () {
|
||||
let photosdiv = $('#' + LoadDataPageFunc.ids.PhotosShowCard);
|
||||
if (photosdiv.length === 0) { return false; }
|
||||
if (!LoadDataPageFunc.Details.photourl) { photosdiv.html('No Photos.<br>'); return false; }
|
||||
let photolist = JSON.parse(LoadDataPageFunc.Details.photourl);
|
||||
if (!photolist || photolist.length === 0) { photosdiv.html('No Photos.<br>'); return false; }
|
||||
let htmlbody = $(`<div class="splide" role="group" aria-label="photosSplide">
|
||||
<div class="splide__track">
|
||||
<ul class="splide__list">
|
||||
</ul> </div></div>`);
|
||||
const NewSplideLIImage = function (imgsrc) {
|
||||
return `<li class="splide__slide" onclick="ButtonGo('ViewAllPhotos','${currenttarget}');"><img src="${imgsrc}" style="max-width: 300px;
|
||||
max-height: 300px;
|
||||
width: auto;
|
||||
height: auto;"></li>`;
|
||||
};
|
||||
let splidebody = htmlbody.find('ul');
|
||||
LoadDataPageFunc.PhotoBlobs = [];
|
||||
photolist.forEach(function (photo) {
|
||||
LoadAndCreateURLfromFileHash(photo).then(bloburl => {
|
||||
splidebody.append(NewSplideLIImage(bloburl));
|
||||
LoadDataPageFunc.PhotoBlobs.push(bloburl);
|
||||
});
|
||||
});
|
||||
|
||||
photosdiv.html(htmlbody);
|
||||
|
||||
new Splide('.splide').mount();
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
LoadDataPageFunc.vars = {};
|
||||
LoadDataPageFunc.vars.idprefix = 'ReferProperty';
|
||||
LoadDataPageFunc.ids.SubmitReferral = LoadDataPageFunc.vars.idprefix + '_ReferProperty';
|
||||
LoadDataPageFunc.EditDetails = {};
|
||||
|
||||
LoadDataPageFunc.ids.EditDetailsMidfix = '-EditDetails';
|
||||
LoadDataPageFunc.ids.EditDetails_name = LoadDataPageFunc.vars.idprefix + LoadDataPageFunc.ids.EditDetailsMidfix + 'PropertyName';
|
||||
LoadDataPageFunc.ids.EditDetails_Description = LoadDataPageFunc.vars.idprefix + LoadDataPageFunc.ids.EditDetailsMidfix + 'PropertyDescription';
|
||||
LoadDataPageFunc.ids.EditDetails_Remarks = LoadDataPageFunc.vars.idprefix + LoadDataPageFunc.ids.EditDetailsMidfix + 'Remarks';
|
||||
LoadDataPageFunc.ids.EditDetails_Location = LoadDataPageFunc.vars.idprefix + LoadDataPageFunc.ids.EditDetailsMidfix + 'Location';
|
||||
LoadDataPageFunc.ids.EditDetails_Category = LoadDataPageFunc.vars.idprefix + LoadDataPageFunc.ids.EditDetailsMidfix + 'Category';
|
||||
LoadDataPageFunc.ids.EditDetails_SubCategory = LoadDataPageFunc.vars.idprefix + LoadDataPageFunc.ids.EditDetailsMidfix + 'SubCategory';
|
||||
LoadDataPageFunc.ids.EditDetails_sqm = LoadDataPageFunc.vars.idprefix + LoadDataPageFunc.ids.EditDetailsMidfix + 'sqm';
|
||||
LoadDataPageFunc.ids.EditDetails_Bedrooms = LoadDataPageFunc.vars.idprefix + LoadDataPageFunc.ids.EditDetailsMidfix + 'Bedrooms';
|
||||
LoadDataPageFunc.ids.EditDetails_Rooms = LoadDataPageFunc.vars.idprefix + LoadDataPageFunc.ids.EditDetailsMidfix + 'Rooms';
|
||||
LoadDataPageFunc.ids.EditDetails_Toilet = LoadDataPageFunc.vars.idprefix + LoadDataPageFunc.ids.EditDetailsMidfix + 'Toilet';
|
||||
LoadDataPageFunc.ids.EditDetails_Kitchen = LoadDataPageFunc.vars.idprefix + LoadDataPageFunc.ids.EditDetailsMidfix + 'Kitchen';
|
||||
LoadDataPageFunc.ids.EditDetails_Floors = LoadDataPageFunc.vars.idprefix + LoadDataPageFunc.ids.EditDetailsMidfix + 'Floors';
|
||||
LoadDataPageFunc.ids.EditDetails_Price = LoadDataPageFunc.vars.idprefix + LoadDataPageFunc.ids.EditDetailsMidfix + 'Price';
|
||||
|
||||
LoadDataPageFunc.ids.EditDetailsUploadPhotoDropzone = 'newpropertydropzonephoto';
|
||||
LoadDataPageFunc.ids.EditDetailsReplacePhotosButton = 'EditDetailsreplacePhotos';
|
||||
|
||||
LoadDataPageFunc.EditDetails.InitializePhotoDropZone = function () {
|
||||
Target_Uploaded_Files = [];
|
||||
myDropzone = null;
|
||||
currentDropzone = DropZoneFunc.InitializeDropZone('/File/Upload/Property', (response) => {
|
||||
if (response.length === 72) {
|
||||
Target_Uploaded_Files.push(response);
|
||||
LoadDataPageFunc.ShowPhotoClearButton();
|
||||
} else {
|
||||
currentDropzone.removeFile(currentDropzone.files[currentDropzone.files.length - 2]);
|
||||
}
|
||||
}, LoadDataPageFunc.ids.EditDetailsUploadPhotoDropzone, DropZoneFunc.AcceptedFilesString.images, 'file', maxfilesize = 100);
|
||||
};
|
||||
|
||||
|
||||
LoadDataPageFunc.ids.ClearPhotosButton = 'newpropertydropzoneclearbutton';
|
||||
|
||||
LoadDataPageFunc.ShowPhotoClearButton = function () {
|
||||
$('#' + LoadDataPageFunc.ids.ClearPhotosButton).show();
|
||||
};
|
||||
LoadDataPageFunc.ClearPhotos = function () {
|
||||
DropZoneFunc.ClearDropzoneUpload();
|
||||
LoadDataPageFunc.HidePhotoClearButton();
|
||||
};
|
||||
|
||||
LoadDataPageFunc.HidePhotoClearButton = function () {
|
||||
$('#' + LoadDataPageFunc.ids.ClearPhotosButton).hide();
|
||||
};
|
||||
|
||||
LoadDataPageFunc.NewLeadsvalidateForm=function () {
|
||||
let fullname = $('#ReferProperty-SendDetailsFullname').val();
|
||||
let mobile = $('#ReferProperty-SendDetailsmobile').val();
|
||||
let landline = $('#ReferProperty-SendDetailslandline').val();
|
||||
let email = $('#ReferProperty-SendDetailsemail').val();
|
||||
let preferreddate = $('#ReferProperty-SendDetailspreferreddate').val();
|
||||
let preferredsite = $('#ReferProperty-SendDetailsPreferredSite').val();
|
||||
let ReferralCode = LoadDataPageFunc.ReferralCode;
|
||||
if (!fullname || !mobile || !email) { return false; }
|
||||
if (!hasValidMobileFormat(mobile)) { return false; }
|
||||
if (!isValidEmail(email)) { return false; }
|
||||
|
||||
return { referralcode:ReferralCode, fullname: fullname, mobile: mobile, landline: landline, email: email, preferred_date: preferreddate, preferred_site: preferredsite };
|
||||
}
|
||||
|
||||
LoadDataPageFunc.SubmitNewLead=function(){
|
||||
const ValidateData=LoadDataPageFunc.NewLeadsvalidateForm();
|
||||
if (!ValidateData) {
|
||||
ModalQuickDismiss('Invalid/Incomplete', 'The following are required<br><br>Fullname<br>11 Digits Mobile Number<br>Correct Email<br><br>Please Input the following properly if not done so. Thank you.');
|
||||
return false;
|
||||
}
|
||||
|
||||
request.type('POST').data(ValidateData).url('/refer/submit').fromVarCache(false).success((response) => {
|
||||
|
||||
if (response === true) {
|
||||
ModalQuickDismiss('Success', 'You will be contacted Shortly. Thank you.', 'NewLeadsModalSuccess', modaltohide = '', function () {
|
||||
hidemodal('ReferProperty_ReferProperty');
|
||||
ReloadPage();
|
||||
});
|
||||
|
||||
}
|
||||
else if (response === false) {
|
||||
ModalQuickDismiss('Error', 'Unable to Submit. Try Again Later', 'NewPropertysModalError');
|
||||
}
|
||||
|
||||
}).error((errorstring) => {
|
||||
ModalQuickDismiss('Error', 'An Error Occured<br>' + errorstring + '<br><br>Please Try Again Later');
|
||||
}).go()
|
||||
|
||||
};
|
||||
|
||||
LoadDataPageFunc.EditDetails.NewReferralModal = function () {
|
||||
Target_Uploaded_Files = [];
|
||||
$('#' + LoadDataPageFunc.ids.SubmitReferral).remove();
|
||||
|
||||
const SubmitOnclick = '';
|
||||
const targetdiv = 'modal-body-' + LoadDataPageFunc.ids.SubmitReferral;
|
||||
let FormHTML = ReusableUIElements.NewLeadsGenerateUI(targetdiv, idprefix = LoadDataPageFunc.vars.idprefix + '-SendDetails', replace = false,
|
||||
'','','','','',LoadDataPageFunc.Details.hashkey,'LoadDataPageFunc.SubmitNewLead();',true);
|
||||
const footer = buttonprimary('Submit', '', onclick = 'LoadDataPageFunc.SubmitNewLead();');
|
||||
const modalhtml = $$.UI.Modal.Create(LoadDataPageFunc.ids.SubmitReferral, 'Contact Details', FormHTML, footer);
|
||||
$$.UI.Element.appendtobody(modalhtml);
|
||||
const replacePhotosButton = buttonprimary('Replace Photos', value = '', onclick = 'LoadDataPageFunc.EditDetails.ShowPhotoUploadButton();', block = '', LoadDataPageFunc.ids.EditDetailsReplacePhotosButton);
|
||||
$('#ViewProperty-EditDetailsNewPropertyPhotosInputGroup').append(replacePhotosButton);
|
||||
$('#' + LoadDataPageFunc.ids.EditDetailsUploadPhotoDropzone).hide();
|
||||
$('#ViewProperty-EditDetailsStatus-select-div-mb3').remove();
|
||||
$('label[for="ViewProperty-EditDetailsStatus-select-div-mb3"]').remove();
|
||||
|
||||
|
||||
Preloaders.Datalist.NewPropertyCategory(function () { ReqCachetoDatalist('/Datalist/NewPropertyCategory', 'ViewProperty-EditDetailsSubCategory', replace = true); });
|
||||
Preloaders.Datalist.NewPropertySubCategory(function () { ReqCachetoDatalist('/Datalist/NewPropertySubCategory', 'ViewProperty-EditDetailsSubCategory', replace = true); });
|
||||
$('#ReferProperty-SendDetailssubmit_Lead_button').hide();
|
||||
|
||||
showmodal(LoadDataPageFunc.ids.SubmitReferral);
|
||||
|
||||
requestWHash.type('POST').url('/NewLeads/Form/PreferredSitesOption').fromVarCache(true).success((response) => {
|
||||
UIReplaceCurrentOptionsSelect('ReferProperty-SendDetailsPreferredSite', response);
|
||||
$('#ReferProperty-SendDetailsPreferredSite').val(LoadDataPageFunc.Details.hashkey);
|
||||
$('#ReferProperty-SendDetailsPreferredSite').prop('disabled',true);
|
||||
}).go();
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
LoadDataPageFunc.EditDetails.GetChanges = function () {
|
||||
let objectdata = {};
|
||||
objectdata.target = currenttarget;
|
||||
const new_name = $('#' + LoadDataPageFunc.ids.EditDetails_name).val();
|
||||
const new_description = $('#' + LoadDataPageFunc.ids.EditDetails_Description).val();
|
||||
const new_remarks = $('#' + LoadDataPageFunc.ids.EditDetails_Remarks).val();
|
||||
const new_location = $('#' + LoadDataPageFunc.ids.EditDetails_Location).val();
|
||||
const new_category = $('#' + LoadDataPageFunc.ids.EditDetails_Category).val();
|
||||
const new_subcategory = $('#' + LoadDataPageFunc.ids.EditDetails_SubCategory).val();
|
||||
let new_sqm = Number($('#' + LoadDataPageFunc.ids.EditDetails_sqm).val());
|
||||
let new_bedroom = Number($('#' + LoadDataPageFunc.ids.EditDetails_Bedrooms).val());
|
||||
let new_rooms = Number($('#' + LoadDataPageFunc.ids.EditDetails_Rooms).val());
|
||||
let new_toilet = Number($('#' + LoadDataPageFunc.ids.EditDetails_Toilet).val());
|
||||
let new_kitchen = Number($('#' + LoadDataPageFunc.ids.EditDetails_Kitchen).val());
|
||||
let new_floors = Number($('#' + LoadDataPageFunc.ids.EditDetails_Floors).val());
|
||||
let new_price = Number($('#' + LoadDataPageFunc.ids.EditDetails_Price).val());
|
||||
|
||||
let changes = 0;
|
||||
|
||||
if (LoadDataPageFunc.Details.name !== new_name) { objectdata.name = new_name; changes++; }
|
||||
if (LoadDataPageFunc.Details.description !== new_description) { objectdata.description = new_description; changes++; }
|
||||
if (LoadDataPageFunc.Details.remarks !== new_remarks) { objectdata.remarks = new_remarks; changes++; }
|
||||
if (LoadDataPageFunc.Details.location !== new_location) { objectdata.location = new_location; changes++; }
|
||||
if (LoadDataPageFunc.Details.category !== new_category) { objectdata.category = new_category; changes++; }
|
||||
if (LoadDataPageFunc.Details.subcategory !== new_subcategory) { objectdata.subcategory = new_subcategory; changes++; }
|
||||
if (LoadDataPageFunc.Details.sqm !== new_sqm) { objectdata.sqm = new_sqm; changes++; }
|
||||
if (LoadDataPageFunc.Details.bedrooms !== new_bedroom) { objectdata.bedrooms = new_bedroom; changes++; }
|
||||
if (LoadDataPageFunc.Details.rooms !== new_rooms) { objectdata.rooms = new_rooms; changes++; }
|
||||
if (LoadDataPageFunc.Details.toilet !== new_toilet) { objectdata.toilet = new_toilet; changes++; }
|
||||
if (LoadDataPageFunc.Details.kitchen !== new_kitchen) { objectdata.kitchen = new_kitchen; changes++; }
|
||||
if (LoadDataPageFunc.Details.floors !== new_floors) { objectdata.floors = new_floors; changes++; }
|
||||
if (LoadDataPageFunc.Details.price !== new_price) { objectdata.price = new_price; changes++; }
|
||||
if (Target_Uploaded_Files.length > 0) { objectdata.photourl = JSON.stringify(Target_Uploaded_Files); changes++; }
|
||||
if (!changes) { return null; }
|
||||
if (!new_name || !new_description || !new_location || !new_sqm) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return objectdata;
|
||||
};
|
||||
|
||||
|
||||
LoadDataPageFunc.EditDetails.Submit = function () {
|
||||
|
||||
let ChangesObject = LoadDataPageFunc.EditDetails.GetChanges();
|
||||
if (ChangesObject === null) { $$.UI.Modal.ModalQuickDismiss('No Changes', 'No Changes to Update!'); return false; }
|
||||
if (ChangesObject === false) { $$.UI.Modal.ModalQuickDismiss('', 'Incomplete Details!<br>The following are required!<br><br>Property Name<br>Description<br>Location<br>Size in sqm'); return false; }
|
||||
if (Target_Uploaded_Files.length == 0) { $$.UI.Modal.ModalQuickDismiss('', 'No New Photos Uploaded!<br>Previous Photos Would be used!',); }
|
||||
let SendUpdatedDetails = new RequestData(false);
|
||||
request
|
||||
.url(LoadDataPageFunc.URLs.SubmitEdit)
|
||||
.type(LoadDataPageFunc.Settings.RequestType)
|
||||
.fromVarCache(false)
|
||||
.data(ChangesObject)
|
||||
.success((response) => {
|
||||
if (!response) { return false; }
|
||||
const error = response.error || false;
|
||||
if (response !== true) {
|
||||
if (error) { $$.UI.Modal.ModalQuickDismiss('Error', error); }
|
||||
return false;
|
||||
} else if (response === true) {
|
||||
LoadDataPageFunc.RefetchDataAndReload(true);
|
||||
ReloadPage();
|
||||
hidemodal(LoadDataPageFunc.ids.SubmitReferral);
|
||||
$$.UI.Modal.ModalQuickDismiss('Success', 'Details Updated');
|
||||
}
|
||||
})
|
||||
.error((err) => {
|
||||
ModalQuickDismiss('Error', 'Unable to Load<br>' + err);
|
||||
})
|
||||
.go();
|
||||
|
||||
};
|
||||
|
||||
|
||||
LoadDataPageFunc.Settings = {};
|
||||
|
||||
|
||||
LoadDataPageFunc.Settings.RequestType = 'POST';
|
||||
LoadDataPageFunc.Settings.fromVarCache = true;
|
||||
LoadDataPageFunc.DefaultDatatoSend = function () {
|
||||
return { target: currenttarget };
|
||||
};
|
||||
LoadDataPageFunc.LoadMainDetails = {};
|
||||
LoadDataPageFunc.LoadMainDetails.OnSuccess = function (response) {
|
||||
if (!response) { ModalQuickDismiss('Error', 'No Data Loaded<br>'); return ''; }
|
||||
LoadDataPageFunc.PropertyCurrentDetails = response.Details;
|
||||
|
||||
LoadDataPageFunc.Details = response.Details;
|
||||
$('#' + LoadDataPageFunc.ids.ViewPropertyContainer).html(LoadDataPageFunc.PropertyDetailsCard(response.Details));
|
||||
LoadDataPageFunc.Logs.LogRowHtmlPage();
|
||||
LoadDataPageFunc.LoadPhotosCard();
|
||||
};
|
||||
|
||||
LoadDataPageFunc.LoadMainDetails.OnError = function (err) { ModalQuickDismiss('Error', 'Unable to Load<br>' + err); };
|
||||
|
||||
|
||||
|
||||
LoadDataPageFunc.LoadMainDetails.LoadNow = function () {
|
||||
|
||||
let request = new RequestData(false);
|
||||
request
|
||||
.url(LoadDataPageFunc.URLs.MainData)
|
||||
.type(LoadDataPageFunc.Settings.RequestType)
|
||||
.fromVarCache(LoadDataPageFunc.Settings.fromVarCache)
|
||||
.data(LoadDataPageFunc.DefaultDatatoSend())
|
||||
.success((response) => {
|
||||
|
||||
if (typeof LoadDataPageFunc === 'undefined' || LoadDataPageFunc.currentTargetPage === 'undefined') {
|
||||
return false;
|
||||
}
|
||||
//console.log(response);
|
||||
if (currentPage !== LoadDataPageFunc.currentTargetPage) { return false; }
|
||||
|
||||
LoadDataPageFunc.LoadMainDetails.OnSuccess(response);
|
||||
})
|
||||
.error((err) => {
|
||||
ModalQuickDismiss('Error', 'Unable to Load<br>' + err);
|
||||
})
|
||||
.go();
|
||||
};
|
||||
|
||||
|
||||
LoadDataPageFunc.main = function () {
|
||||
LoadDataPageFunc.LoadMainDetails.LoadNow();
|
||||
|
||||
changeTopbarTitle(LoadDataPageFunc.PageTitle);
|
||||
|
||||
|
||||
};
|
||||
LoadDataPageFunc.ReferralCode = '';
|
||||
if (typeof ReferralCode !== 'undefined') {
|
||||
LoadDataPageFunc.ReferralCode = ReferralCode;
|
||||
history.replaceState({}, "ReferProperty", "/p/ReferProperty/s/" + currenttarget + "/dr/" + ReferralCode);
|
||||
}
|
||||
if (typeof ReferralCode === 'undefined'){
|
||||
ReferralCode = LoadDataPageFunc.getReferralCode();
|
||||
LoadDataPageFunc.ReferralCode = ReferralCode;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
$(document).ready(function () {
|
||||
LoadDataPageFunc.main();
|
||||
|
||||
|
||||
});
|
||||
|
||||
|
||||
|
||||
</script>
|
||||
242
legacy/pages-html/slvl/all/Referral
Normal file
242
legacy/pages-html/slvl/all/Referral
Normal file
@@ -0,0 +1,242 @@
|
||||
<div id='ListPropertiesMainContainer'>
|
||||
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<br><br><br>
|
||||
<script>
|
||||
|
||||
|
||||
LoadDataPageFunc = {};
|
||||
LoadDataPageFunc.newpropertyrow = function (objrow, rownum) {
|
||||
let rows = [];
|
||||
let rowcoldetail = '';
|
||||
let firstimagesrc = '/assets/no-image.png';
|
||||
const imgwidth = '200px'; const imgheight = "200px";
|
||||
const hash = objrow.hashkey || false;
|
||||
if (!objrow || !hash) { rowcoldetail = 'No Data'; return createCard('Unknown', cardid = 'PropertyRowCard-' + rownum, '', cardbodyid = '', rowcoldetail, cardbodyclassadd = 'ListPropertyRow'); }
|
||||
|
||||
let name = objrow.name || false;
|
||||
let description = objrow.description || false;
|
||||
let remarks = objrow.remarks || false;
|
||||
|
||||
let createdby = objrow.createdby || false;
|
||||
let category = objrow.category || '';
|
||||
let subcategory = objrow.subcategory || '';
|
||||
let photourl = objrow.photourl || false;
|
||||
let sqm = objrow.sqm || false;
|
||||
let bedrooms = objrow.bedrooms || false;
|
||||
let rooms = objrow.rooms || false;
|
||||
let toilet = objrow.toilet || false;
|
||||
|
||||
let kitchen = objrow.kitchen || false;
|
||||
let floors = objrow.floors || false;
|
||||
let price = objrow.price || false;
|
||||
let specs = objrow.specs || false;
|
||||
let location = objrow.location || false
|
||||
|
||||
|
||||
let photobinarystring = '';
|
||||
let base64string = '';
|
||||
let blob;
|
||||
|
||||
try { photourl = JSON.parse(photourl); } catch (e) { photourl = photourl; }
|
||||
|
||||
if (photourl) { if (Array.isArray(photourl)) { photourl = photourl[0]; } else { } }
|
||||
|
||||
|
||||
if (photourl) { photourl = '/RequestData/File/' + photourl; }
|
||||
|
||||
|
||||
/*
|
||||
photobinarystring = reqcacheload(photourl);
|
||||
if (photobinarystring) {
|
||||
blob = binaryStringToBlob(photobinarystring);
|
||||
console.log('blob ',blob);
|
||||
if (blob){
|
||||
photourl = CreateObjectURLfrombinaryStringforIMGUse(photobinarystring);
|
||||
console.log(photourl);
|
||||
}
|
||||
}
|
||||
*/
|
||||
photoblob = reqcacheload(photourl);
|
||||
if (photoblob) {
|
||||
photourl = URL.createObjectURL(photoblob);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
rows.push(`<div class="col-12"><center><a href="javascript:void(0);return;" onclick="ButtonGo('${'ReferProperty'}', '${hash}')"><img src="` + photourl + '" style="width:' + imgwidth + '; height:' + imgheight + ';"></a></center>');
|
||||
rows.push('<br>');
|
||||
rows.push('<div class="col">');
|
||||
|
||||
|
||||
if (location !== false) {
|
||||
rows.push(dualcolrow('Location', location, rowclass = ''));
|
||||
}
|
||||
|
||||
if (subcategory !== false) {
|
||||
rows.push(dualcolrow(category, subcategory, rowclass = ''));
|
||||
}
|
||||
|
||||
if (sqm !== false) {
|
||||
rows.push(dualcolrow('Size', sqm + ' sqm', rowclass = ''));
|
||||
}
|
||||
|
||||
if (bedrooms !== false) {
|
||||
rows.push(dualcolrow('Bedrooms', bedrooms, rowclass = ''));
|
||||
}
|
||||
|
||||
if (rooms !== false) {
|
||||
rows.push(dualcolrow('Rooms', rooms, rowclass = ''));
|
||||
}
|
||||
|
||||
if (toilet !== false) {
|
||||
rows.push(dualcolrow('Toilet', toilet, rowclass = ''));
|
||||
}
|
||||
|
||||
if (kitchen !== false) {
|
||||
rows.push(dualcolrow('Kitchen', kitchen));
|
||||
}
|
||||
if (floors !== false) {
|
||||
rows.push(dualcolrow('Floors', floors));
|
||||
}
|
||||
if (price !== false) {
|
||||
rows.push(dualcolrow('Price', price));
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
rows.push('<div id="PropertyListRowCardHash-' + rownum + '" style="display:none;">' + hash + '</div>');
|
||||
|
||||
|
||||
if (description !== false) {
|
||||
rows.push('<br><div class="row">' + col('<center>Description</center>', '-12'));
|
||||
rows.push(col('<textarea>' + description + '</textarea>', '-12') + '</div>');
|
||||
}
|
||||
|
||||
rows.push('</div></div>');
|
||||
|
||||
rows.push(row(col('<br>' + buttonprimary('View Details', '', `ButtonGo('ReferProperty', '${hash}')`, '-12', 'ListPropertyGoRow-' + rownum))));
|
||||
let FinalBody = rows.join('');
|
||||
|
||||
return createCard(name, cardid = 'PropertyRowCard-' + rownum, '', cardbodyid = '', FinalBody, cardbodyclassadd = 'ListPropertyRow');
|
||||
};
|
||||
|
||||
|
||||
|
||||
LoadDataPageFunc.main = function () {
|
||||
const searchcard = UIInputGroup('Search', 'text', 'ListProperty_Search', '', classs = '', span = '', '/assets/clear.png');
|
||||
// let PropertyListContainer = UICardSimple('', 'Loading Please Wait...', 'PropertyListContainer');
|
||||
let PropertyListContainer = '<div id="PropertyListContainer"><center>Loading Please Wait...</center></div>';
|
||||
const FinalInnerHTML = searchcard + PropertyListContainer;
|
||||
const MainCard = UICardSimple('Properties', FinalInnerHTML, 'MAINCARDBODY_PROPERTYLIST');
|
||||
$('#ListPropertiesMainContainer').html(MainCard);
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
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 = 'PropertyListRowCardHash-' + variablePart;
|
||||
hashkey = $('#' + hashKeyDivId).text();
|
||||
if (hashkey) {
|
||||
request.url('/ViewProperty/Details/data').success((response) => {
|
||||
}).data({ target: hashkey }).fromVarCache(true).type('POST').go();
|
||||
}
|
||||
hashkey = '';
|
||||
}
|
||||
});
|
||||
}, { threshold: 0.1 });
|
||||
|
||||
|
||||
$('#PropertyListContainer .card').each(function () {
|
||||
observer.observe(this);
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
LoadDataPageFunc.populatepropertylist = function () {
|
||||
let request = new RequestData(true);
|
||||
request
|
||||
.url('/ListProperty/List/Referral/data')
|
||||
.type('POST')
|
||||
.data(null)
|
||||
.fromVarCache(true)
|
||||
.success((response) => {
|
||||
if ($('#card-body-MAINCARDBODY_PROPERTYLIST').length === 0) { return false; }
|
||||
if (!response) {
|
||||
$('#card-body-MAINCARDBODY_PROPERTYLIST').html('No Properties');
|
||||
return;
|
||||
}
|
||||
|
||||
let PropertyList = response.List;
|
||||
//PropertyList.reverse();
|
||||
if(typeof PropertyList==='object'){
|
||||
PropertyList = Object.values(PropertyList);
|
||||
}
|
||||
PropertyList.sort((a, b) => new Date(b.created) - new Date(a.created));
|
||||
let newhtmlrows = ''; let arrayrows = [];
|
||||
const count = PropertyList.length;
|
||||
|
||||
|
||||
for (let i = 0; i < count; i++) {
|
||||
arrayrows.push(LoadDataPageFunc.newpropertyrow(PropertyList[i], i) + '<br>');
|
||||
}
|
||||
|
||||
newhtmlrows = arrayrows.join('');
|
||||
$('#PropertyListContainer').html(newhtmlrows);
|
||||
LoadDataPageFunc.CardResultInterSectionPreloadDetails();
|
||||
})
|
||||
.error((err) => {
|
||||
console.error(err);
|
||||
})
|
||||
.go();
|
||||
|
||||
};
|
||||
|
||||
function SearchKeyUPListPropertyPage() {
|
||||
$('#ListProperty_Search').on('keyup', function () {
|
||||
|
||||
let searchTerm = $(this).val().toLowerCase();
|
||||
|
||||
$('#PropertyListContainer .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.ClearSearch = function () {
|
||||
$('#ListProperty_Search').val('');
|
||||
$('#ListProperty_Search').trigger('keyup');
|
||||
};
|
||||
|
||||
$(document).ready(function () {
|
||||
LoadDataPageFunc.main();
|
||||
LoadDataPageFunc.populatepropertylist();
|
||||
changeTopbarTitle('Properties');
|
||||
SearchKeyUPListPropertyPage();
|
||||
$('#imgspanListProperty_Search').attr('onclick', 'LoadDataPageFunc.ClearSearch();');
|
||||
|
||||
});
|
||||
</script>
|
||||
259
legacy/pages-html/slvl/all/Store/ListStoresProductMarket
Normal file
259
legacy/pages-html/slvl/all/Store/ListStoresProductMarket
Normal 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>
|
||||
145
legacy/pages-html/slvl/all/Store/New
Normal file
145
legacy/pages-html/slvl/all/Store/New
Normal 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();
|
||||
0
legacy/pages-html/slvl/all/Store/StoreDetailsMarket
Normal file
0
legacy/pages-html/slvl/all/Store/StoreDetailsMarket
Normal file
0
legacy/pages-html/slvl/all/Store/View
Normal file
0
legacy/pages-html/slvl/all/Store/View
Normal file
209
legacy/pages-html/slvl/all/Store/ViewStoreMarket
Normal file
209
legacy/pages-html/slvl/all/Store/ViewStoreMarket
Normal 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>
|
||||
349
legacy/pages-html/slvl/all/TransactionDetailsProductMarket
Normal file
349
legacy/pages-html/slvl/all/TransactionDetailsProductMarket
Normal file
@@ -0,0 +1,349 @@
|
||||
<style>
|
||||
.ListRowCard {
|
||||
margin-bottom: 5px;
|
||||
}
|
||||
</style>
|
||||
<div id="MainView">
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md" style="overflow:hidden;">
|
||||
|
||||
<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 class="row" style="">
|
||||
<div class="col" id="TransactionCode">
|
||||
</div>
|
||||
<div class="col" id="TransactionDate"></div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-md" style="overflow:hidden;" id="ColumnItemList">
|
||||
|
||||
<div class="card ListRowCard" id="ListRowCard-0" style="">
|
||||
<div id="cardheader-ListRowCard-0" class="card-header ui-sortable-handle"
|
||||
style="cursor: move;">
|
||||
Items
|
||||
<div class="card-tools" id="card-tools-ListRowCard-0">
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-body ListCardRow" id="card-body-ListRowCard-0">
|
||||
|
||||
<div class="row" style="" id="ItemsList">
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="col-md" style="overflow:hidden;">
|
||||
<a href="javascript:void(0);" onclick="">
|
||||
<div class="card ListRowCard" id="ListRowCard-1" style="">
|
||||
|
||||
<div class="card-body ListCardRow" id="card-body-ListRowCard-2">
|
||||
<div class="col-12" style="text-align: center;">
|
||||
Status: <h3 id="TStatus"></h3>
|
||||
</div>
|
||||
<h5></h5>
|
||||
</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="">
|
||||
<div class="row" style="">
|
||||
<div class="col">
|
||||
Total Items<h4 id="TotalItems"></h4>
|
||||
</div>
|
||||
<div class="col">
|
||||
Total Price: <h4 id="TotalPrice"></h4>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<h5></h5>
|
||||
</div>
|
||||
</div>
|
||||
</a>
|
||||
</div>
|
||||
<div class="col-md" style="overflow:hidden;" id="ColumnConfirmDeliveryButton">
|
||||
<a href="javascript:void(0);" onclick="">
|
||||
<div class="card ListRowCard" id="ListRowCard-3" style="">
|
||||
|
||||
<div class="card-body ListCardRow" id="card-body-ListRowCard-2">
|
||||
<button class="btn" onclick="LoadDataPageFunc.ShowConfirmDelivery();">
|
||||
<img src="/assets/checkmark.png" style="width: 30; height: 30;" class="icon-user">
|
||||
Set As Delivered
|
||||
</button>
|
||||
|
||||
<h5></h5>
|
||||
</div>
|
||||
</div>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<script>
|
||||
LoadDataPageFunc = {};
|
||||
LoadDataPageFunc.PageTitle = 'Purchase Details';
|
||||
LoadDataPageFunc.MainDetailsURL = '';
|
||||
LoadDataPageFunc.Details = {};
|
||||
LoadDataPageFunc.Settings = {};
|
||||
LoadDataPageFunc.Settings.ProductNotAvailableModalDismissed = false;
|
||||
|
||||
LoadDataPageFunc.SendPostData = function (url, func, VarCache = false, fromhashcache = false) {
|
||||
let reqq = new RequestData()
|
||||
reqq.fromVarCache(false).data({ target: currenttarget }).url(url).type('POST')
|
||||
.success((response) => {
|
||||
if (func) {
|
||||
return func(response);
|
||||
}
|
||||
}).go();
|
||||
}
|
||||
|
||||
LoadDataPageFunc.ProductRow = function (rowdata, rownum) {
|
||||
const hashkey = rowdata.hashkey;
|
||||
let productviewonclick = "ButtonGo('BuyViewProductMarket','" + hashkey + "');";
|
||||
const photourlsArray = rowdata.photourl;
|
||||
let photourl = ''
|
||||
if (photourlsArray && typeof photourlsArray === "array") {
|
||||
photourl = photourlsArray[0];
|
||||
} else {
|
||||
photourl = photourlsArray;
|
||||
}
|
||||
const name = rowdata.name;
|
||||
const quantity = rowdata.quantity;
|
||||
const price =rowdata.price;
|
||||
const totalprice = rowdata.totalprice;
|
||||
const unit = rowdata.unit;
|
||||
const priceperunit = 'P' + price + ' / ' + unit;
|
||||
photourl = '/RequestData/File/' + photourl;
|
||||
|
||||
return `<div class="col-md card ListRowCard" style="overflow:hidden;" data-hash="${hashkey}" data-rownum="${rownum}">
|
||||
|
||||
<div class="row">
|
||||
<div class="col" id ="product-image-marketplace-cart-${rownum}" style=" padding-top: 10px; padding-bottom: 10px;">
|
||||
<a href="javascript:void(0);" onclick="${productviewonclick}">
|
||||
<img id="ProductCartMarketPlacePhoto-${rownum}" src="${photourl}" style="width: 200px;height: 200px;">
|
||||
</a>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="col" id=${'product-controls-cart-marketplace-container-' + rownum}>
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
|
||||
</div>
|
||||
<div class="col-12" style=" padding-top: 10px;text-align:center;">
|
||||
<h3>${name}</h3>
|
||||
<h6>${priceperunit}</h6>
|
||||
</div>
|
||||
|
||||
<div class="col-12 " style="text-align: center;">
|
||||
<br> Quantity<h3 id="ProductTransactionBuyDetailsMarket-Item-Quantity-${rownum}">${quantity}</h3>
|
||||
</div>
|
||||
|
||||
<div class="col-12">
|
||||
<br>
|
||||
</div>
|
||||
<div class="col-12" style="text-align: center;" id="totalitemprice-${rownum}">
|
||||
<br> Price<h3 id="ProductTransactionBuyDetailsMarket-Item-Price-${rownum}">${totalprice}</h3>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>`;
|
||||
};
|
||||
|
||||
LoadDataPageFunc.ConfirmDelivery = function () {
|
||||
let responsefunc = function (response) {
|
||||
|
||||
if (response!==true){
|
||||
ModalQuickDismiss(false,'Unable to Confirm Delivery<br>'+response); return false;}
|
||||
else{
|
||||
hidemodal('TransactionConfirmDeliveryModal');
|
||||
ModalQuickDismiss(false,'Delivery Confirmed');
|
||||
ReloadPage();
|
||||
return true;}
|
||||
|
||||
};
|
||||
LoadDataPageFunc.SendPostData('/Transactions/Buy/Market/Confirm/Delivery', responsefunc);
|
||||
|
||||
};
|
||||
|
||||
LoadDataPageFunc.ShowConfirmDelivery = function () {
|
||||
const modalbody = `Are you sure you wish to Confirm Delivery?<br>
|
||||
Please Check Items First!`;
|
||||
const modalfooter = `<button class="btn" onclick="LoadDataPageFunc.ConfirmDelivery();"><img src="/assets/checkmark.png" style="width: 30; height: 30;" class="icon-user">Confirm</button>`;
|
||||
|
||||
CreateAndShowModal('TransactionConfirmDeliveryModal', false, modalbody, modalfooter);
|
||||
};
|
||||
|
||||
|
||||
LoadDataPageFunc.PopulateDetailsNow = function (data) {
|
||||
|
||||
const tcode = data.transactioncode;
|
||||
const tdate = formatDateTimetoReadable(data.transactiondate) || '';
|
||||
const tprice = data.totalprice;
|
||||
const tItems = data.totalitems;
|
||||
const status = data.status;
|
||||
|
||||
$('#TransactionCode').html(tcode);
|
||||
$('#TransactionDate').html(tdate);
|
||||
$('#TotalItems').html(tItems);
|
||||
$('#TotalPrice').html('P' + tprice);
|
||||
$('#TStatus').html(status);
|
||||
|
||||
if (strtolower(status)==='delivered'){$('#ColumnConfirmDeliveryButton').hide();}
|
||||
|
||||
|
||||
};
|
||||
|
||||
LoadDataPageFunc.Settings.Phototype = "ProductMarket";
|
||||
|
||||
|
||||
|
||||
LoadDataPageFunc.BuySuccess = function () {
|
||||
ModalQuickDismiss(false, 'Successfully Bought Product!', 'ModalConfirmBuySuccess');
|
||||
gotoPage('PendingBuysProductMarket');
|
||||
return;
|
||||
};
|
||||
|
||||
|
||||
LoadDataPageFunc.PopulateDetails = function () {
|
||||
let description;
|
||||
let photosarray;
|
||||
|
||||
|
||||
let responsefunc = function (response) {
|
||||
response = {};
|
||||
|
||||
response.data = {
|
||||
transactioncode: 'sgfesbgb',
|
||||
transactiondate: '2024-12-12 19:19:00',
|
||||
totalprice: '9030',
|
||||
totalitems: 5,
|
||||
status: 'paid',
|
||||
items: [
|
||||
{
|
||||
hashkey:'asdfasfvv443',
|
||||
name: 'Sinandomeng',
|
||||
unit: '25kg',
|
||||
quantity: 5,
|
||||
price: 1430,
|
||||
totalprice: 5 * 1430,
|
||||
photourl: 'd5650f203fcd447bc7c409f9f0d06a67315041dcd3fd599f63b80d8fe5cc95734b644c2d'
|
||||
},
|
||||
{
|
||||
hashkey:'asdfasfvv443',
|
||||
name: 'Coco Pandan',
|
||||
unit: '25kg',
|
||||
quantity: 7,
|
||||
price: 1235,
|
||||
totalprice: 7 * 1235,
|
||||
photourl: '09db0d2947463d87aee76aec90dc18d439bc6fe9c8d454b6c3de35d7006bc526cbfbafcf'
|
||||
},
|
||||
{
|
||||
hashkey:'asdfasfvv443',
|
||||
name: 'Buko Pandan',
|
||||
unit: '50kg',
|
||||
quantity: 18,
|
||||
price: 2000,
|
||||
totalprice: 18 * 2000,
|
||||
photourl: '0fdd3d467dfc392f4a8a34e37e81ca15bf613ab6304f6b4c3af6519ae6a323d5cac63666'
|
||||
}
|
||||
|
||||
]
|
||||
};
|
||||
|
||||
|
||||
|
||||
if (!response) {
|
||||
LoadDataPageFunc.TransactionDetailsNotAvailable();
|
||||
return false;
|
||||
}
|
||||
|
||||
let ProductData = response.data;
|
||||
let ItemsArr = ProductData.items;
|
||||
let htmlrows=[];
|
||||
|
||||
for (let i = 0; i < ItemsArr.length; i++) {
|
||||
htmlrows.push(LoadDataPageFunc.ProductRow(ItemsArr[i],i));
|
||||
}
|
||||
|
||||
const htmlprods=htmlrows.join('');
|
||||
|
||||
document.getElementById('ItemsList').innerHTML = htmlprods;
|
||||
|
||||
LoopArrayorObject(ItemsArr,(item,rowno)=>{
|
||||
LoadPhototoIMG('ProductCartMarketPlacePhoto-'+rowno,item.photourl, onclick = `ButtonGo('BuyViewProductMarket','${item.hashkey}');`);
|
||||
});
|
||||
|
||||
LoadDataPageFunc.PopulateDetailsNow(response.data);
|
||||
|
||||
|
||||
|
||||
};
|
||||
|
||||
LoadDataPageFunc.SendPostData(`/View/Product/Details`, responsefunc, true, true);
|
||||
|
||||
|
||||
|
||||
|
||||
};
|
||||
|
||||
LoadDataPageFunc.TransactionDetailsNotAvailable = function () {
|
||||
const modalfooter = `
|
||||
<button class="btn" onclick="Backkey();">Back</button>
|
||||
<button class="btn" onclick="ButtonGo('PendingBuysProductMarket')">All Pending Delivery</button>
|
||||
`;
|
||||
CreateAndShowModal('modal-buyconfirm-productunavailable', false, 'Product Not Available', modalfooter, false);
|
||||
$('#modal-buyconfirm-productunavailable').on('hidden.bs.modal', function () {
|
||||
LoadDataPageFunc.Settings.ProductNotAvailableModalDismissed = true;
|
||||
ButtonGo('ListProductsMarket');
|
||||
});
|
||||
};
|
||||
|
||||
LoadDataPageFunc.Main = function () {
|
||||
// if (!currenttarget || currenttarget==='0'){ LoadDataPageFunc.ProductNotAvailable();return false;}
|
||||
changeTopbarTitle(LoadDataPageFunc.PageTitle);
|
||||
LoadDataPageFunc.PopulateDetails();
|
||||
};
|
||||
|
||||
|
||||
|
||||
LoadDataPageFunc.Main();
|
||||
</script>
|
||||
257
legacy/pages-html/slvl/all/ViewAllPhotos
Normal file
257
legacy/pages-html/slvl/all/ViewAllPhotos
Normal file
@@ -0,0 +1,257 @@
|
||||
<div id='ListMainContainer'>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<script>
|
||||
Target_Uploaded_Files = [];
|
||||
|
||||
|
||||
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>
|
||||
599
legacy/pages-html/slvl/all/ViewLeadDetails
Normal file
599
legacy/pages-html/slvl/all/ViewLeadDetails
Normal file
@@ -0,0 +1,599 @@
|
||||
<div id="viewleadContainer">
|
||||
</div>
|
||||
|
||||
<div class="pagination">
|
||||
<button id="prevBtnLogsLeadDetailsPage" class="btn btn-primary"
|
||||
onclick="LoadDataPageFunc.Logs.changePage(-1)">Next</button>
|
||||
<span id="pageInfo"></span>
|
||||
<button id="nextBtnLogsLeadDetailsPage" class="btn btn-primary"
|
||||
onclick="LoadDataPageFunc.Logs.changePage(1)">Previous</button>
|
||||
</div>
|
||||
<script> $$ = {};
|
||||
$$.UI = {};
|
||||
$$.UI.Table = {};
|
||||
$$.UI.Table.CreateTable = function (id, theadinnerhtml, bodyinnerhtml) { return CreateTable(id, theadinnerhtml, bodyinnerhtml); };
|
||||
$$.UI.Table.GenerateTheadFromArraySimple = function (array) { return GenerateTheadFromArraySimple(array); };
|
||||
$$.UI.Table.GenerateTableRowFromArraySimple = function (array) { return GenerateTableRowFromArraySimple(array); };
|
||||
$$.UI.ResetBrowserAndCache = function () { return ResetBrowserAndCache(); };
|
||||
$$.UI.formatCurrency = function (number, withdecimal = true) { return formatCurrency(number, withdecimal); };
|
||||
$$.UI.getDateInGMT8 = function () { return getDateInGMT8(); };
|
||||
$$.UI.RunFunctiononMutation = function (targetidToMonitor, callbackfunction) { return RunFunctiononMutation(targetidToMonitor, callbackfunction); };
|
||||
$$.UI.Element = {};
|
||||
$$.UI.Element.appendtobody = function (string) { return appendtobody(string); };
|
||||
$$.UI.Element.Exists = function (ElementIDtext) { ElementExists(ElementIDtext); };
|
||||
$$.UI.Element.RemovebyID = function (idstring) { return removeelementbyID(idstring); };
|
||||
$$.UI.Element.DeleteById = function (id) { return DeleteElementById(id); }
|
||||
$$.UI.Element.getHTML = function (idetext) { return getElementhtml(idtext); };
|
||||
$$.UI.Element.setHTML = function (idetext, html) { return setElementhtml(idtext, html); };
|
||||
$$.UI.Element.getValue = function (idetext) { return getElementvalue(idtext); };
|
||||
$$.UI.Element.setValue = function (idetext,) { return setElementvalue(idtext, value); };
|
||||
$$.UI.Validate = {};
|
||||
$$.UI.Validate.isValidEmail = function (email) { return isValidEmail(email); };
|
||||
$$.UI.Validate.hasValidMobileFormat = function (usernumber) { return hasValidMobileFormat(usernumber); };
|
||||
$$.UI.Modal = {};
|
||||
$$.UI.Modal.Create = function (modalid, modaltitle, modalbody, modalfooter, modalfooterclose = true, topclosebutton = true, modalbodyclass = 'modal-body', modalheaderclass = 'modal-header') { return createmodal(modalid, modaltitle, modalbody, modalfooter, modalfooterclose, topclosebutton, modalbodyclass, modalheaderclass); };
|
||||
$$.UI.Modal.Show = function (idtxt) { return modalshow(idtxt); };
|
||||
$$.UI.Modal.Hide = function (idtxt) { return modalhide(); };
|
||||
$$.UI.Modal.CreateAndShow = function (modalid, modaltitle, modalbody, modalfooter = '', modalfooterclose = true, topclosebutton = true, modalbodyclass = 'modal-body', modalheaderclass = 'modal-header') { return CreateAndShowModal(modalid, modaltitle, modalbody, modalfooter, modalfooterclose, topclosebutton, modalbodyclass, modalheaderclass); };
|
||||
$$.UI.Modal.ModalQuickDismiss = function (modaltitle, modalbody, modalid = '', modaltohide = '', functiontodo = '', conditiontrue = true) { return ModalQuickDismiss(modaltitle, modalbody, modalid, modaltohide, functiontodo, conditiontrue) };
|
||||
$$.UI.Modal.ModalContinueCancel = function (modalid, modaltitle, modalbody, continuebuttononclick, cancelbuttontext = 'Cancel', continuebuttontext = 'Continue', continuebuttoncss = 'btn btn-danger', cancelbuttoncss = 'btn btn-warning') { return ModalContinueCancel(modalid, modaltitle, modalbody, continuebuttononclick, cancelbuttontext, continuebuttontext, continuebuttoncss, cancelbuttoncss); };
|
||||
$$.UI.Modal.hide = function (modalid) { return hidemodal(modalid); };
|
||||
$$.UI.Modal.show = function (modalid) { return showmodal(modalid); };
|
||||
$$.UI.col = function (content = '', additionalclass = '') { return col(content, additionalclass); };
|
||||
$$.UI.row = function (content = '', additionalclass = '', hidden = false, style = '') { return row(content, additionalclass, hidden, style); };
|
||||
$$.UI.dualcolrow = function (colcontent1, colcontent2, rowclass = '', hidden = false, style = '') { return dualcolrow(colcontent1, colcontent2, rowclass, hidden, style); };
|
||||
$$.UI.Button = {};
|
||||
$$.UI.Button.Default = function (content, value = '', onclick = '', idtext = '', setclass = '', addtionaldata = '') { return button(content, value, onclick, idtext, setclass, addtionaldata); };
|
||||
$$.UI.Button.Warning = function (content, value = '', onclick = '', block = '', idtext = '', addclass = '', addtionaldata = '') { return buttonwarning(content, value, onclick, block, idtext, addclass, addtionaldata); };
|
||||
$$.UI.Button.Danger = function (content, value = '', onclick = '', block = '', idtext = '', addclass = '', addtionaldata = '') { return buttondanger(content, value, onclick, block, idtext, addclass, addtionaldata); };
|
||||
$$.UI.Button.Primary = function (content, value = '', onclick = '', block = '', idtext = '', addclass = '', addtionaldata = '') { return buttonprimary(content, value, onclick, block, idtext, addclass, addtionaldata); };
|
||||
$$.UI.Button.HomeMenuButtons = function (buttonicon, buttonText, buttonGo, buttonVariabletoPass = '', iconwidth = '', iconheight = '', buttonstyle = '', buttononclick = '', divclass = '', divid = '', buttonid = '', textclass = '') { return HomeMenuButtons(buttonicon, buttonText, buttonGo, buttonVariabletoPass, iconwidth, iconheight, buttonstyle, buttononclick, divclass, divid, buttonid, textclass); };
|
||||
$$.UI.Input = {};
|
||||
$$.UI.Input.textInput = function (idtext = '', setclass = '', required = '', placeholder = '', value = '') { return textinput(idtext, setclass, required, placeholder, value); };
|
||||
$$.UI.Input.textFormControl = function (idtext = '', addclass = '', required = '', placeholder = '', value = '') { return textformcontrol(idtext, addclass, required, placeholder, value); };
|
||||
$$.UI.Card = {};
|
||||
$$.UI.Card.Create = function (cardtitle = '', cardid = '', cardtools = '', cardbodyid = '', cardbodytext = '', cardbodyclassadd = '', maincardstyle = '', titlecardhide = false) { return createCard(cardtitle, cardid, cardtools, cardbodyid, cardbodytext, cardbodyclassadd, maincardstyle, titlecardhide); };
|
||||
$$.UI.Card.Simple = function (title = '', text = '', id = '') { return CreateCardSimple(title, text, id); };
|
||||
$$.UIalt = {};
|
||||
$$.UIalt.hrefonclickButtonGO = function (pagename, pagedatastring = '') { return hrefonclickButtonGO(pagename, pagedatastring); };
|
||||
$$.UIalt.generateHTMLfromarray = function (prepend, append, array, func) { return generateHTMLfromarray(prepend, append, array, func); };
|
||||
$$.UIalt.imgiconuserdefault = function (imgsrc, imgwidth = '', imgheight = '', id = '') { return imgiconuserdefault(imgsrc, imgwidth, imgheight, id); };
|
||||
$$.UIalt.UICardStats = {};
|
||||
$$.UIalt.UICardStats.UICardStatsDetails = function (Title = '', number = 0, Unit = '', leftORright = 'left', numberid = '') { return UICardStatsDetails(Title, number, Unit, leftORright, numberid); };
|
||||
$$.UIalt.UICardStats.UIStatsDetailsArray = function (statsarray) { return UIStatsDetailsArray(statsarray); };
|
||||
$$.UIalt.BalanceCard = {};
|
||||
$$.UIalt.BalanceCard.UIBalance_WrapperfromArray = function (statsarray) { return UIBalance_WrapperfromArray(statsarray); };
|
||||
$$.UIalt.BalanceCard.UIBalance_Wrapper_WalletFooter_Item = function (maintitle = '', onclickstring = '', imgsrc = '', href = '', subtitleline1 = '', subtitleline2 = '', subtitleline3 = '', subtitleline4 = '', imgwidth = '', imgheight = '') { return UIBalance_Wrapper_WalletFooter_Item(maintitle, onclickstring, imgsrc, href, subtitleline1, subtitleline2, subtitleline3, subtitleline4, imgwidth, imgheight); };
|
||||
$$.UIalt.BalanceCard.UIBalance_Wrapper_WalletFooter_Item_ButtonGO = function (maintitle, pagename, pagestring = '', iconclass = '', subtitleline1 = '', subtitleline2 = '', subtitleline3 = '', subtitleline4 = '') { return UIBalance_Wrapper_WalletFooter_Item_ButtonGO(maintitle, pagename, pagestring, iconclass, subtitleline1, subtitleline2, subtitleline3, subtitleline4); };
|
||||
$$.UIalt.BalanceCard.UIBalance_Wrapper_WalletFooter_ARRAY = function (balancewrapper_item_array) { return UIBalance_Wrapper_WalletFooter_ARRAY(balancewrapper_item_array); };
|
||||
$$.UIalt.BalanceCard.UIcreateBalanceBoxfromArray = function (statsarray, balancewrapper_item_array, style = 'border: solid 3px #000d88;') { return UIcreateBalanceBoxfromArray(statsarray, balancewrapper_item_array, style); };
|
||||
$$.UIalt.Services = {};
|
||||
$$.UIalt.Services.Button = function (imgiconsrc, title = '', onclick = '', href = '', bgcolor8 = false) { return UIServices_Button(imgiconsrc, title, onclick, href, bgcolor8); };
|
||||
$$.UIalt.Services.Button_GOTOPAGE = function (imgiconsrc, title, pagename, pagedatastring = '') { return UIServices_Button_GOTOPAGE(imgiconsrc, title, pagename, pagedatastring); };
|
||||
$$.UIalt.Services.FullDIV_GOTOPAGE_Array = function (title, viewallhref = '', viewallonclick = '', viewalltext = '', services_button_array) { return UIServices_FullDIV_GOTOPAGE_Array(title, viewallhref, viewallonclick, viewalltext, services_button_array); };
|
||||
$$.UIalt.Services.FullDIV_ONCLICK_Array = function (title, viewallhref = '', viewallonclick = '', viewalltext = '', services_button_array) { return UIServices_FullDIV_ONCLICK_Array(title, viewallhref, viewallonclick, viewalltext, services_button_array); };
|
||||
$$.UIalt.Sidetext = {};
|
||||
$$.UIalt.Sidetext.UISideText_DualColumnButton = function (text, pagename, pagedatastring = '', imgsrc = '', imgwidth = '', imgheight = '') { return UISideText_DualColumnButton(text, pagename, pagedatastring, imgsrc, imgwidth, imgheight); };
|
||||
$$.UIalt.Sidetext.UISideText_DualColumnButton_Array = function (sidetext_button_dualcolumn_array) { return UISideText_DualColumnButton_Array(sidetext_button_dualcolumn_array); };
|
||||
$$.UIalt.UICardSimple = function (title, text = '', id = '') { return UICardSimple(title, text, id); };
|
||||
$$.UIalt.RecentSearchBar = {};
|
||||
$$.UIalt.RecentSearchBar.SearchBar = function (searchplaceholdertext, classtosearch, id, imgsrclefticon = '', imgsrcrighticon = '', imgwidth = '', imgheight = '') { return UIRecentSearchBar(searchplaceholdertext, classtosearch, id, imgsrclefticon, imgsrcrighticon, imgwidth, imgheight); };
|
||||
$$.UIalt.RecentSearchBar.Searchable_Button_GO = function (title, subtitle, rightsidetext, classforsearch, pagename, pagedatastring = '', imgsrc, imgwidth = '', imgheight = '') { return UIRecentSearchable_Button_GO(title, subtitle, rightsidetext, classforsearch, pagename, pagedatastring, imgsrc, imgwidth, imgheight); };
|
||||
$$.UIalt.RecentSearchBar.Searchable_Button_GO_ARRAY = function (title, recentssearchablebuttonarray, viewallpagetarget, viewallpagedata = '', viewalltext = '') { return UIRecentSearchable_Button_GO_ARRAY(title, recentssearchablebuttonarray, viewallpagetarget, viewallpagedata, viewalltext); };
|
||||
$$.UIalt.UIListArrowButton_GO = function (title, subtitle, pagename, pagedatastring = '', imgsrc, imgwidth = '', imgheight = '') { return UIListArrowButton_GO(title, subtitle, pagename, pagedatastring, imgsrc, imgwidth, imgheight); };
|
||||
$$.UIalt.RecentSearchBar.SearchBox_with_BUTTONS_FULL = function (title, recentssearchablebuttonarray, UIListArrowButtonGOARRAY = '', viewallpagetarget, viewallpagedata = '', viewalltext = '', classtosearch = '', searchid = '', searchplaceholdertext = '', searchlefticon = '', searchrighticon = '', imgwidth = '', imgheight = '') { return UISearchBox_with_BUTTONS_FULL(title, recentssearchablebuttonarray, UIListArrowButtonGOARRAY, viewallpagetarget, viewallpagedata, viewalltext, classtosearch, searchid, searchplaceholdertext, searchlefticon, searchrighticon, imgwidth, imgheight); };
|
||||
$$.UIalt.Input = {};
|
||||
$$.UIalt.Input.InputGroupCore = function (innerhtml = '', label = '', inputgroupid = '') { return UIinputgroupcore(innerhtml, label, inputgroupid); };
|
||||
$$.UIalt.Input.InputGroup = function (placeholder, type, id, label = '', classinput = '', spanclass = '', imginsteadofspan = '', required = false, textvalue = '') { return UIInputGroup(placeholder, type, id, label, classinput, spanclass, imginsteadofspan, required, textvalue); };
|
||||
$$.UIalt.Input.InputGroupSelect = function (id = '', label = '', optionsarray = '', spanclass = '', imginsteadofspan = '', selectedvalue = '') { return UIInputGroupSelect(id, label, optionsarray, spanclass, imginsteadofspan, selectedvalue); };
|
||||
$$.UIalt.Input.InputGroupDatePicker = function () { return UIInputGroupDatePicker(); };
|
||||
$$.UIalt.Input.ArraytoOptionforSelect = function (array, selectedvalue = '') { return UIArraytoOptionforSelect(array, selectedvalue); };
|
||||
$$.UIalt.Input.ReplaceCurrentOptionsSelect = function (selectid, optionsarray, selectedvalue = '') { return UIReplaceCurrentOptionsSelect(selectid, optionsarray, selectedvalue); };
|
||||
$$.UIalt.Input.InputGroupButton = function (buttontext, buttonclass = '', buttonid = '', onclick = '', buttonstyle = '') { return UIInputGroupButton(buttontext, buttonclass, buttonid, onclick, buttonstyle); };
|
||||
$$.UIalt.UISetDarkMode = function () { return UISetDarkMode(); };
|
||||
$$.UIalt.UIUpdateBodyHTML = function (html = '') { return UIUpdateBodyHTML(html); };
|
||||
$$.UIalt.changeTopbarTitle = function (title) { return changeTopbarTitle(title); };
|
||||
$$.StatusIntToString = function (Status) { return InttoStrDetailsFuncs.Status(Status); };
|
||||
</script>
|
||||
<script>
|
||||
LoadDataPageFunc = {};
|
||||
LoadDataPageFunc.PageTitle = 'Lead Details';
|
||||
|
||||
LoadDataPageFunc.ids = {};
|
||||
LoadDataPageFunc.ids.ViewLeadContainer = "viewleadContainer";
|
||||
LoadDataPageFunc.ids.ViewDetailsLogsContainer = 'ViewDetailsLogsContainer';
|
||||
LoadDataPageFunc.ids.ViewLeadCard = 'ViewLeadCard';
|
||||
LoadDataPageFunc.ids.ViewLeadDetailsCardBody = 'ViewLeadDetailsCardBody';
|
||||
LoadDataPageFunc.ids.PreviousLogsPage = 'prevBtnLogsLeadDetailsPage';
|
||||
LoadDataPageFunc.ids.NextLogsPage = 'nextBtnLogsLeadDetailsPage';
|
||||
LoadDataPageFunc.ids.ChangeStatus_Select = 'ViewLeadDetails_ChangeStatus_Select';
|
||||
|
||||
LoadDataPageFunc.onclicks = {};
|
||||
LoadDataPageFunc.onclicks.EditDetailsModalOnclick = 'LoadDataPageFunc.EditDetails.EditDetailsModal();';
|
||||
|
||||
|
||||
LoadDataPageFunc.Logs = {};
|
||||
LoadDataPageFunc.Logs.Pagination = {};
|
||||
|
||||
|
||||
LoadDataPageFunc.Logs.Pagination.cardsPerPage = 5;
|
||||
LoadDataPageFunc.Logs.Pagination.currentPage = 1;
|
||||
|
||||
LoadDataPageFunc.Logs.LogRowCard = function (Date = '', content = '') {
|
||||
content = replaceLineBreaks(content);
|
||||
return (UICardSimple('', formatDateTimetoReadable(Date) + '<br><br><h4>' + content + '</h4>'));
|
||||
};
|
||||
|
||||
LoadDataPageFunc.Logs.Pagination.PageArray = function () {
|
||||
return divideArrayIntoSets(LoadDataPageFunc.Logs.LogsCardRowHTMLArray, LoadDataPageFunc.Logs.Pagination.cardsPerPage);
|
||||
};
|
||||
|
||||
LoadDataPageFunc.Logs.Pagination.Firstpage = 1;
|
||||
LoadDataPageFunc.Logs.Pagination.Lastpage = function () {
|
||||
return LoadDataPageFunc.Logs.Pagination.PageArray().length;
|
||||
};
|
||||
|
||||
LoadDataPageFunc.Logs.LogsCardRowHTMLArray = [];
|
||||
|
||||
|
||||
LoadDataPageFunc.Logs.Pagination.FirstPageFound = function () {
|
||||
$('#' + LoadDataPageFunc.ids.NextLogsPage).prop('disabled', false);
|
||||
$('#' + LoadDataPageFunc.ids.PreviousLogsPage).prop('disabled', true);
|
||||
};
|
||||
LoadDataPageFunc.Logs.Pagination.LastPageFound = function () {
|
||||
$('#' + LoadDataPageFunc.ids.NextLogsPage).prop('disabled', true);
|
||||
$('#' + LoadDataPageFunc.ids.PreviousLogsPage).prop('disabled', false);
|
||||
};
|
||||
|
||||
LoadDataPageFunc.Logs.Pagination.MiddlePageFound = function () {
|
||||
$('#' + LoadDataPageFunc.ids.NextLogsPage).prop('disabled', false);
|
||||
$('#' + LoadDataPageFunc.ids.PreviousLogsPage).prop('disabled', false);
|
||||
};
|
||||
|
||||
LoadDataPageFunc.Logs.Pagination.OnlyOnePageFound = function () {
|
||||
$('#' + LoadDataPageFunc.ids.NextLogsPage).prop('disabled', true);
|
||||
$('#' + LoadDataPageFunc.ids.PreviousLogsPage).prop('disabled', true);
|
||||
};
|
||||
|
||||
LoadDataPageFunc.Logs.LogRowHtmlPage = function (page = 1) {
|
||||
if (page) { LoadDataPageFunc.Logs.Pagination.currentPage = page; }
|
||||
|
||||
let arrayset = LoadDataPageFunc.Logs.Pagination.PageArray();
|
||||
let newpageindex = LoadDataPageFunc.Logs.Pagination.currentPage - 1;
|
||||
|
||||
|
||||
if (!isIndexAccessibleArray(arrayset, newpageindex)) {
|
||||
return false;
|
||||
}
|
||||
LoadDataPageFunc.Logs.Pagination.DetectAndTogglePageButton(page);
|
||||
|
||||
let targetarr = arrayset[newpageindex];
|
||||
const htmlstr = targetarr.join('<br>');
|
||||
|
||||
$('#' + LoadDataPageFunc.ids.ViewDetailsLogsContainer).html(htmlstr);
|
||||
};
|
||||
|
||||
LoadDataPageFunc.Logs.Pagination.DetectAndTogglePageButton = function (newpage) {
|
||||
if (newpage <= LoadDataPageFunc.Logs.Pagination.Firstpage) { LoadDataPageFunc.Logs.Pagination.FirstPageFound(); }
|
||||
else if (newpage >= LoadDataPageFunc.Logs.Pagination.LastPageFound()) {
|
||||
LoadDataPageFunc.Logs.Pagination.FirstPageFound();
|
||||
} else if (LoadDataPageFunc.Logs.Pagination.Lastpage() == 1) {
|
||||
LoadDataPageFunc.Logs.Pagination.OnlyOnePageFound();
|
||||
} else if (newpage > LoadDataPageFunc.Logs.Pagination.Firstpage && newpage < LoadDataPageFunc.Logs.Pagination.Lastpage()) {
|
||||
LoadDataPageFunc.Logs.Pagination.MiddlePageFound();
|
||||
}
|
||||
|
||||
if (LoadDataPageFunc.Logs.Pagination.Lastpage() === 1) {
|
||||
LoadDataPageFunc.Logs.Pagination.OnlyOnePageFound();
|
||||
}
|
||||
};
|
||||
|
||||
LoadDataPageFunc.Logs.changePage = function (forwardORBackward) {
|
||||
if (!forwardORBackward) { return false; }
|
||||
|
||||
let newpage = LoadDataPageFunc.Logs.Pagination.currentPage;
|
||||
if (forwardORBackward === -1) { newpage = newpage - 1; }
|
||||
else if (forwardORBackward === 1) { newpage = newpage + 1; }
|
||||
if (newpage < LoadDataPageFunc.Logs.Pagination.Firstpage || newpage > LoadDataPageFunc.Logs.Pagination.Lastpage()) {
|
||||
newpage = LoadDataPageFunc.Logs.Pagination.currentPage;
|
||||
return false;
|
||||
}
|
||||
|
||||
LoadDataPageFunc.Logs.Pagination.DetectAndTogglePageButton(newpage);
|
||||
LoadDataPageFunc.Logs.Pagination.currentPage = newpage;
|
||||
|
||||
// Load the new page
|
||||
LoadDataPageFunc.Logs.LogRowHtmlPage(newpage);
|
||||
};
|
||||
|
||||
|
||||
LoadDataPageFunc.Logs.LogFullCard = function (obj) {
|
||||
if (!obj.logs) { return ''; }
|
||||
LoadDataPageFunc.LogsCardRowHTMLArray = [];
|
||||
let newlogfullarr = [];
|
||||
if (obj.logs && Array.isArray(obj.logs)) {
|
||||
newlogfullarr.push('<br><br><div id="' + LoadDataPageFunc.ids.ViewDetailsLogsContainer + '">');
|
||||
let logrow = '';
|
||||
|
||||
const reversedLogs = [...obj.logs].reverse();
|
||||
|
||||
for (let log of reversedLogs) {
|
||||
logrow = LoadDataPageFunc.Logs.LogRowCard(log[0], log[1]);
|
||||
LoadDataPageFunc.Logs.LogsCardRowHTMLArray.push(logrow);
|
||||
// newlogfullarr.push(logrow);
|
||||
}
|
||||
}
|
||||
newlogfullarr.push('</div>');
|
||||
|
||||
return newlogfullarr.join('');
|
||||
|
||||
};
|
||||
|
||||
LoadDataPageFunc.RefetchDataAndReload = function (istrue = true) {
|
||||
if (!istrue) { return false; }
|
||||
Preloaders.ViewLeadDetailsData(currenttarget, false,
|
||||
function () {
|
||||
ReloadPage();
|
||||
}
|
||||
);
|
||||
};
|
||||
|
||||
LoadDataPageFunc.LeadDetailsCardControls = function () {
|
||||
let 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>`;
|
||||
};
|
||||
let htmlarr = [`<div class="mt-5"><div class="tf-container">`];
|
||||
htmlarr.push('<ul class="box-service mt-3">');
|
||||
htmlarr.push(buttonLImaker('Change Status', 'LoadDataPageFunc.ChangeStatus.NewStatusModal();', 'changestatus.png'));
|
||||
htmlarr.push(buttonLImaker('Add Logs', 'LoadDataPageFunc.Logs.AddLogsModal();', 'logs.png'));
|
||||
htmlarr.push(buttonLImaker('Edit Details', LoadDataPageFunc.onclicks.EditDetailsModalOnclick, 'edit.png'));
|
||||
htmlarr.push(buttonLImaker('View Property Details', `ButtonGo('ViewPropertyDetails','${LoadDataPageFunc.Details.target_property}')`, 'house.png'));
|
||||
htmlarr.push(buttonLImaker('Declare As Sold', `LoadDataPageFunc.SetAsSold.ModalConfirm()`, 'sold.png'));
|
||||
htmlarr.push('</ul</div></div>');
|
||||
return htmlarr.join('');
|
||||
};
|
||||
|
||||
LoadDataPageFunc.Logs.SubmitNewLog = function () {
|
||||
let ShowEmptyTextModal = function () { ModalQuickDismiss('No Input', 'Please input text as log.') };
|
||||
let ShowUnabletoAddLog = function () { ModalQuickDismiss('Error', 'Unable to Add Log.') };
|
||||
let ShowSuccess = function () { ModalQuickDismiss('Success', 'New Log Added.') };
|
||||
let ShowError = function (errorstring) { ModalQuickDismiss('Error', 'Error Occured. <br><br>' + errorstring) };
|
||||
let newlogtext = $('#newlogtextarea').val();
|
||||
if (!newlogtext) {
|
||||
ShowEmptyTextModal();
|
||||
return false;
|
||||
}
|
||||
request
|
||||
.url('/ViewLeadPage/controls/logs/add')
|
||||
.type('POST')
|
||||
.fromVarCache(false)
|
||||
.data({ target: currenttarget, newlog: newlogtext })
|
||||
.success((response) => {
|
||||
if (response === true) {
|
||||
LoadDataPageFunc.RefetchDataAndReload(istrue = true);
|
||||
ShowSuccess();
|
||||
|
||||
|
||||
modalhide('ViewDetailsNewLogModal');
|
||||
|
||||
return true;
|
||||
} else {
|
||||
ShowUnabletoAddLog();
|
||||
return false;
|
||||
}
|
||||
})
|
||||
.error((err) => {
|
||||
ShowError(err);
|
||||
return false;
|
||||
})
|
||||
.caching(false)
|
||||
.go();
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
LoadDataPageFunc.Logs.AddLogsModal = function () {
|
||||
let modalbody = `<label for="newlogtextarea">Log:</label>
|
||||
<textarea id="newlogtextarea" rows="10" cols="50" placeholder="Enter the log here..."></textarea>`;
|
||||
CreateAndShowModal('ViewDetailsNewLogModal', 'New Log', modalbody, buttonprimary('Add New Log', value = '', onclick = 'LoadDataPageFunc.Logs.SubmitNewLog();', block = '', idtext = 'ViewLeadDetailsAddLogButton'));
|
||||
};
|
||||
|
||||
LoadDataPageFunc.Details = {};
|
||||
LoadDataPageFunc.Details.Status = '';
|
||||
|
||||
LoadDataPageFunc.LeadDetailsCard = function (obj) {
|
||||
if (!obj) { return false; }
|
||||
|
||||
let rowcoldetail = [];
|
||||
|
||||
const LeadName = obj.fullname || false;
|
||||
const DateCreated = formatDateTimetoReadable(obj.created) || false;
|
||||
const DateModified = formatDateTimetoReadable(obj.modified) || false;
|
||||
let Status = obj.status;
|
||||
const Referrer = obj.referral || false;
|
||||
const TargetProperty = obj.property_name || false;
|
||||
const TargetViewingDate = formatDateTimetoReadable(obj.target_viewing_date) || false;
|
||||
const Mobile = obj.mobile || false;
|
||||
const Landline = obj.landline || false;
|
||||
const Email = obj.email || false;
|
||||
|
||||
LoadDataPageFunc.Details.Status = Status;
|
||||
|
||||
|
||||
Status = InttoStrDetailsFuncs.Status(Status);
|
||||
|
||||
const AddDualColifValue = function (varstr, label) {
|
||||
if (varstr !== false && varstr !== null) {
|
||||
rowcoldetail.push(dualcolrow(label, varstr));
|
||||
}
|
||||
};
|
||||
|
||||
AddDualColifValue(DateModified, 'Last Activity');
|
||||
AddDualColifValue(Status, 'Status');
|
||||
AddDualColifValue(Referrer, 'Referrer');
|
||||
AddDualColifValue(`<a href="javascript:void(0);" onclick="ButtonGo('ViewPropertyDetails','${obj.target_property}')">` + TargetProperty + '</a>', 'Target Property');
|
||||
AddDualColifValue(TargetViewingDate, 'Target Viewing Date');
|
||||
AddDualColifValue(Mobile, 'Mobile');
|
||||
AddDualColifValue(Landline, 'Landline');
|
||||
AddDualColifValue(Email, 'Email');
|
||||
rowcoldetail.push('<br><br>');
|
||||
|
||||
rowcoldetail.push(LoadDataPageFunc.LeadDetailsCardControls());
|
||||
rowcoldetail.push(LoadDataPageFunc.Logs.LogFullCard(obj));
|
||||
|
||||
const finalRowColDetail = rowcoldetail.join('');
|
||||
|
||||
let ViewLeadCardDetails = createCard(LeadName, LoadDataPageFunc.ids.ViewLeadCard, DateCreated, LoadDataPageFunc.ids.ViewLeadDetailsCardBody, cardbody = finalRowColDetail);
|
||||
return ViewLeadCardDetails;
|
||||
};
|
||||
|
||||
|
||||
|
||||
LoadDataPageFunc.ChangeStatus = {};
|
||||
LoadDataPageFunc.ids.ChangeStatusModal = 'ViewDetails_ChangeStatusModal';
|
||||
|
||||
|
||||
LoadDataPageFunc.ChangeStatus.NewStatusModal = function () {
|
||||
const StatusSelect = $$.UIalt.Input.InputGroupSelect(LoadDataPageFunc.ids.ChangeStatus_Select, '', [
|
||||
[-2, $$.StatusIntToString(-2)],
|
||||
[-1, $$.StatusIntToString(-1)],
|
||||
[0, $$.StatusIntToString(0)],
|
||||
[1, $$.StatusIntToString(1)],
|
||||
[2, $$.StatusIntToString(2)],
|
||||
[3, $$.StatusIntToString(3)],
|
||||
[4, $$.StatusIntToString(4)],
|
||||
[5, $$.StatusIntToString(5)]], '', '', LoadDataPageFunc.Details.Status);
|
||||
|
||||
|
||||
const htmltext = 'Update the Status of the Lead';
|
||||
let modalbody = StatusSelect + htmltext;
|
||||
CreateAndShowModal(LoadDataPageFunc.ids.ChangeStatusModal, 'Update Status', modalbody, buttonprimary('Update', value = '', onclick = 'LoadDataPageFunc.ChangeStatus.Submit();', block = '', idtext = ''));
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
LoadDataPageFunc.ChangeStatus.Submit = function () {
|
||||
const sel = $('#' + LoadDataPageFunc.ids.ChangeStatus_Select).val();
|
||||
const selectedstatus = (sel !== null) ? sel : null;
|
||||
|
||||
if (selectedstatus === null) { $$.UI.Modal.ModalQuickDismiss('', 'Select a Status'); return false; }
|
||||
if (selectedstatus == LoadDataPageFunc.Details.Status) { $$.UI.Modal.ModalQuickDismiss('', 'Nothing to Change!'); return false; }
|
||||
|
||||
|
||||
let request = new RequestData(false);
|
||||
request
|
||||
.url('/ViewLead/Details/ChangeStatus')
|
||||
.type('POST')
|
||||
.fromVarCache(false)
|
||||
.data({ target: currenttarget, newstatus: selectedstatus })
|
||||
.success((response) => {
|
||||
// console.log(response);
|
||||
if (response === true) {
|
||||
LoadDataPageFunc.RefetchDataAndReload(true);
|
||||
$$.UI.Modal.ModalQuickDismiss('', 'Success!');
|
||||
hidemodal(LoadDataPageFunc.ids.ChangeStatusModal);
|
||||
return true;
|
||||
}
|
||||
|
||||
})
|
||||
.error((err) => {
|
||||
ModalQuickDismiss('Error', 'Unable To Change Status<br><br>' + err);
|
||||
})
|
||||
.go();
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
LoadDataPageFunc.ids.EditDetailsModal = 'ViewLeads_EditDetailsModal';
|
||||
LoadDataPageFunc.EditDetails = {};
|
||||
LoadDataPageFunc.ids.EditDetails_Fullname = 'ViewLeads-EditDetailsFullname';
|
||||
LoadDataPageFunc.ids.EditDetails_Mobile = 'ViewLeads-EditDetailsmobile';
|
||||
LoadDataPageFunc.ids.EditDetails_Landline = 'ViewLeads-EditDetailslandline';
|
||||
LoadDataPageFunc.ids.EditDetails_Email = 'ViewLeads-EditDetailsemail';
|
||||
LoadDataPageFunc.ids.EditDetails_ViewingDate = 'ViewLeads-EditDetailspreferreddate';
|
||||
LoadDataPageFunc.ids.EditDetails_Property = 'ViewLeads-EditDetailsPreferredSite';
|
||||
|
||||
LoadDataPageFunc.EditDetails.EditDetailsModal = function () {
|
||||
|
||||
$('#' + LoadDataPageFunc.ids.EditDetailsModal).remove();
|
||||
|
||||
Preloaders.PreferredSitesOption(fromVarCache = false, successfunc = false);
|
||||
const SubmitOnclick = '';
|
||||
const targetdiv = 'modal-body-' + LoadDataPageFunc.ids.EditDetailsModal;
|
||||
let FormHTML = ReusableUIElements.NewLeadsGenerateUI(targetdiv, idprefix = 'ViewLeads-EditDetails', replace = false, LoadDataPageFunc.Details.fullname, LoadDataPageFunc.Details.mobile, LoadDataPageFunc.Details.landline, LoadDataPageFunc.Details.email, LoadDataPageFunc.Details.target_viewing_date, LoadDataPageFunc.Details.target_property, false, true);
|
||||
const footer = buttonprimary('Update', '', onclick = 'LoadDataPageFunc.EditDetails.Submit();');
|
||||
const modalhtml = $$.UI.Modal.Create(LoadDataPageFunc.ids.EditDetailsModal, 'Update Details', FormHTML, footer);
|
||||
|
||||
$$.UI.Element.appendtobody(modalhtml);
|
||||
|
||||
Preloaders.PreferredSitesOption(fromVarCache = true, function (response) {
|
||||
UIReplaceCurrentOptionsSelect(idprefix + 'PreferredSite', response);
|
||||
$(idprefix + 'PreferredSite').val(LoadDataPageFunc.Details.target_property);
|
||||
$$.UI.Modal.Show(LoadDataPageFunc.ids.EditDetailsModal);
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
|
||||
LoadDataPageFunc.EditDetails.GetChanges = function () {
|
||||
let objectdata = {};
|
||||
objectdata.target = currenttarget;
|
||||
const new_fullname = $('#' + LoadDataPageFunc.ids.EditDetails_Fullname).val();
|
||||
const new_mobile = $('#' + LoadDataPageFunc.ids.EditDetails_Mobile).val();
|
||||
const new_landline = $('#' + LoadDataPageFunc.ids.EditDetails_Landline).val();
|
||||
const new_email = $('#' + LoadDataPageFunc.ids.EditDetails_Email).val();
|
||||
const new_viewingdate = $('#' + LoadDataPageFunc.ids.EditDetails_ViewingDate).val();
|
||||
const new_property = $('#' + LoadDataPageFunc.ids.EditDetails_Property).val();
|
||||
let changes = 0;
|
||||
|
||||
if (LoadDataPageFunc.Details.fullname !== new_fullname) { objectdata.fullname = new_fullname; changes++; }
|
||||
if (LoadDataPageFunc.Details.mobile !== new_mobile) { objectdata.mobile = new_mobile; changes++; }
|
||||
if (LoadDataPageFunc.Details.landline !== new_landline) { objectdata.landline = new_landline; changes++; }
|
||||
if (LoadDataPageFunc.Details.email !== new_email) { objectdata.email = new_email; changes++; }
|
||||
if (LoadDataPageFunc.Details.target_viewing_date !== new_viewingdate) { objectdata.target_viewing_date = new_viewingdate; changes++; }
|
||||
if (LoadDataPageFunc.Details.target_property !== new_property) { objectdata.target_property = new_property; changes++; }
|
||||
if (!changes) { return false; }
|
||||
|
||||
return objectdata;
|
||||
};
|
||||
|
||||
|
||||
LoadDataPageFunc.EditDetails.Submit = function () {
|
||||
|
||||
let ChangesObject = LoadDataPageFunc.EditDetails.GetChanges();
|
||||
if (!ChangesObject) { $$.UI.Modal.ModalQuickDismiss('No Changes', 'No Changes to Update!'); return false; }
|
||||
if (ChangesObject.fullname === '' || ChangesObject.fullname === false || ChangesObject.mobile === '' || ChangesObject.mobile === false || ChangesObject.email === false || ChangesObject.email === '') { $$.UI.Modal.ModalQuickDismiss('Incomplete Details', 'The Following Details are REQUIRED!<br><br>Fullname<br>Mobile<br>Email'); return false; }
|
||||
|
||||
if (ChangesObject.mobile && !hasValidMobileFormat(ChangesObject.mobile)) { toastr.error('Incorrect Mobile Format. Must Be 11 Digits!'); }
|
||||
if (ChangesObject.email && !isValidEmail(ChangesObject.email)) { toastr.error('Incorrect Email Format'); }
|
||||
|
||||
|
||||
let SendUpdatedDetails = new RequestData(false);
|
||||
request
|
||||
.url('/ViewLead/Details/Edit/Submit')
|
||||
.type('POST')
|
||||
.fromVarCache(false)
|
||||
.data(ChangesObject)
|
||||
.success((response) => {
|
||||
if (!response) { return false; }
|
||||
const error = response.error || false;
|
||||
if (response !== true) {
|
||||
if (error) { $$.UI.Modal.ModalQuickDismiss('Error', error); }
|
||||
return false;
|
||||
} else if (response === true) {
|
||||
LoadDataPageFunc.RefetchDataAndReload();
|
||||
hidemodal(LoadDataPageFunc.ids.EditDetailsModal);
|
||||
$$.UI.Modal.ModalQuickDismiss('Success', 'Details Updated');
|
||||
}
|
||||
})
|
||||
.error((err) => {
|
||||
ModalQuickDismiss('Error', 'Unable to Load<br>' + errordesc);
|
||||
})
|
||||
.go();
|
||||
|
||||
|
||||
};
|
||||
|
||||
LoadDataPageFunc.SetAsSold = {};
|
||||
LoadDataPageFunc.ids.FinalRemarks = 'FinalRemarksAsSold';
|
||||
LoadDataPageFunc.ids.SetAsSoldModal = 'SetAsSoldModal';
|
||||
|
||||
LoadDataPageFunc.SetAsSold.ModalConfirm = function () {
|
||||
if (LoadDataPageFunc.Details.status===5){ModalQuickDismiss('', 'Already Sold!'); return;}
|
||||
let modalbody = 'Remarks<br><br><textarea id="'+LoadDataPageFunc.ids.FinalRemarks+'"></textarea>';
|
||||
CreateAndShowModal(LoadDataPageFunc.ids.SetAsSoldModal, 'Set as Sold', modalbody, buttonprimary('Sold', value = '', onclick = ' LoadDataPageFunc.SetAsSold.Submit();', block = '', idtext = ''));
|
||||
};
|
||||
|
||||
LoadDataPageFunc.SetAsSold.Submit = function () {
|
||||
|
||||
const FinalRemarks = $('#' + LoadDataPageFunc.ids.FinalRemarks).val();
|
||||
|
||||
|
||||
const SetAsSoldDetails = {
|
||||
'Final_Remarks': FinalRemarks,
|
||||
target: currenttarget
|
||||
};
|
||||
|
||||
let SendData = new RequestData(false);
|
||||
|
||||
SendData
|
||||
.url('/ViewLead/Details/Edit/SetAsSold')
|
||||
.type('POST')
|
||||
.fromVarCache(false)
|
||||
.data(SetAsSoldDetails)
|
||||
.success((response) => {
|
||||
const error = response.error || false;
|
||||
if (response !== true) {
|
||||
if (error) { $$.UI.Modal.ModalQuickDismiss('Error', error); }
|
||||
return false;
|
||||
} else if (response === true) {
|
||||
LoadDataPageFunc.RefetchDataAndReload();
|
||||
hidemodal(LoadDataPageFunc.ids.SetAsSoldModal);
|
||||
$$.UI.Modal.ModalQuickDismiss('Success', 'Leads Set as Complete and Sold');
|
||||
}
|
||||
})
|
||||
.error((err) => {
|
||||
ModalQuickDismiss('Error', 'Unable to Load<br>' + errordesc);
|
||||
})
|
||||
.go();
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
LoadDataPageFunc.main = function () {
|
||||
let request = new RequestData(true);
|
||||
request
|
||||
.url('/ViewLead/Details/data')
|
||||
.type('POST')
|
||||
.fromVarCache(true)
|
||||
.data({ target: currenttarget })
|
||||
.success((response) => {
|
||||
|
||||
if (response.success ===false){
|
||||
ModalQuickDismiss('Error', 'Unable to Load<br>' + response.message);
|
||||
return false;
|
||||
}
|
||||
|
||||
LoadDataPageFunc.ViewLeadCurrentDetails = response.Details;
|
||||
LoadDataPageFunc.Details = response.Details;
|
||||
if (currentPage !== 'ViewLeadDetails') { return false; }
|
||||
$('#' + LoadDataPageFunc.ids.ViewLeadContainer).html(LoadDataPageFunc.LeadDetailsCard(response.Details));
|
||||
LoadDataPageFunc.Logs.LogRowHtmlPage();
|
||||
})
|
||||
.error((err) => {
|
||||
ModalQuickDismiss('Error', 'Unable to Load<br>' + errordesc);
|
||||
})
|
||||
.go();
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// let mainhtmlviewlead = ViewLeadCardDetails;
|
||||
// $('#viewleadContainer').html(mainhtmlviewlead);
|
||||
|
||||
|
||||
|
||||
|
||||
changeTopbarTitle(LoadDataPageFunc.PageTitle);
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
$(document).ready(function () {
|
||||
LoadDataPageFunc.main();
|
||||
|
||||
});
|
||||
|
||||
|
||||
|
||||
</script>
|
||||
799
legacy/pages-html/slvl/all/ViewPropertyDetails
Normal file
799
legacy/pages-html/slvl/all/ViewPropertyDetails
Normal file
@@ -0,0 +1,799 @@
|
||||
<br><br>
|
||||
<div id="viewContainer">
|
||||
</div>
|
||||
|
||||
<div class="pagination">
|
||||
<button id="prevBtnLogsPropertyDetailsPage" class="btn btn-primary"
|
||||
onclick="LoadDataPageFunc.Logs.changePage(-1)">Next</button>
|
||||
<span id="pageInfo"></span>
|
||||
<button id="nextBtnLogsPropertyDetailsPage" class="btn btn-primary"
|
||||
onclick="LoadDataPageFunc.Logs.changePage(1)">Previous</button>
|
||||
</div>
|
||||
<script> $$ = {};
|
||||
$$.UI = {};
|
||||
$$.UI.Table = {};
|
||||
$$.UI.Table.CreateTable = function (id, theadinnerhtml, bodyinnerhtml) { return CreateTable(id, theadinnerhtml, bodyinnerhtml); };
|
||||
$$.UI.Table.GenerateTheadFromArraySimple = function (array) { return GenerateTheadFromArraySimple(array); };
|
||||
$$.UI.Table.GenerateTableRowFromArraySimple = function (array) { return GenerateTableRowFromArraySimple(array); };
|
||||
$$.UI.ResetBrowserAndCache = function () { return ResetBrowserAndCache(); };
|
||||
$$.UI.formatCurrency = function (number, withdecimal = true) { return formatCurrency(number, withdecimal); };
|
||||
$$.UI.getDateInGMT8 = function () { return getDateInGMT8(); };
|
||||
$$.UI.RunFunctiononMutation = function (targetidToMonitor, callbackfunction) { return RunFunctiononMutation(targetidToMonitor, callbackfunction); };
|
||||
$$.UI.Element = {};
|
||||
$$.UI.Element.appendtobody = function (string) { return appendtobody(string); };
|
||||
$$.UI.Element.Exists = function (ElementIDtext) { ElementExists(ElementIDtext); };
|
||||
$$.UI.Element.RemovebyID = function (idstring) { return removeelementbyID(idstring); };
|
||||
$$.UI.Element.DeleteById = function (id) { return DeleteElementById(id); }
|
||||
$$.UI.Element.getHTML = function (idetext) { return getElementhtml(idtext); };
|
||||
$$.UI.Element.setHTML = function (idetext, html) { return setElementhtml(idtext, html); };
|
||||
$$.UI.Element.getValue = function (idetext) { return getElementvalue(idtext); };
|
||||
$$.UI.Element.setValue = function (idetext,) { return setElementvalue(idtext, value); };
|
||||
$$.UI.Validate = {};
|
||||
$$.UI.Validate.isValidEmail = function (email) { return isValidEmail(email); };
|
||||
$$.UI.Validate.hasValidMobileFormat = function (usernumber) { return hasValidMobileFormat(usernumber); };
|
||||
$$.UI.Modal = {};
|
||||
$$.UI.Modal.Create = function (modalid, modaltitle, modalbody, modalfooter, modalfooterclose = true, topclosebutton = true, modalbodyclass = 'modal-body', modalheaderclass = 'modal-header') { return createmodal(modalid, modaltitle, modalbody, modalfooter, modalfooterclose, topclosebutton, modalbodyclass, modalheaderclass); };
|
||||
$$.UI.Modal.Show = function (idtxt) { return modalshow(idtxt); };
|
||||
$$.UI.Modal.Hide = function (idtxt) { return modalhide(); };
|
||||
$$.UI.Modal.CreateAndShow = function (modalid, modaltitle, modalbody, modalfooter = '', modalfooterclose = true, topclosebutton = true, modalbodyclass = 'modal-body', modalheaderclass = 'modal-header') { return CreateAndShowModal(modalid, modaltitle, modalbody, modalfooter, modalfooterclose, topclosebutton, modalbodyclass, modalheaderclass); };
|
||||
$$.UI.Modal.ModalQuickDismiss = function (modaltitle, modalbody, modalid = '', modaltohide = '', functiontodo = '', conditiontrue = true) { return ModalQuickDismiss(modaltitle, modalbody, modalid, modaltohide, functiontodo, conditiontrue) };
|
||||
$$.UI.Modal.ModalContinueCancel = function (modalid, modaltitle, modalbody, continuebuttononclick, cancelbuttontext = 'Cancel', continuebuttontext = 'Continue', continuebuttoncss = 'btn btn-danger', cancelbuttoncss = 'btn btn-warning') { return ModalContinueCancel(modalid, modaltitle, modalbody, continuebuttononclick, cancelbuttontext, continuebuttontext, continuebuttoncss, cancelbuttoncss); };
|
||||
$$.UI.Modal.hide = function (modalid) { return hidemodal(modalid); };
|
||||
$$.UI.Modal.show = function (modalid) { return showmodal(modalid); };
|
||||
$$.UI.col = function (content = '', additionalclass = '') { return col(content, additionalclass); };
|
||||
$$.UI.row = function (content = '', additionalclass = '', hidden = false, style = '') { return row(content, additionalclass, hidden, style); };
|
||||
$$.UI.dualcolrow = function (colcontent1, colcontent2, rowclass = '', hidden = false, style = '') { return dualcolrow(colcontent1, colcontent2, rowclass, hidden, style); };
|
||||
$$.UI.Button = {};
|
||||
$$.UI.Button.Default = function (content, value = '', onclick = '', idtext = '', setclass = '', addtionaldata = '') { return button(content, value, onclick, idtext, setclass, addtionaldata); };
|
||||
$$.UI.Button.Warning = function (content, value = '', onclick = '', block = '', idtext = '', addclass = '', addtionaldata = '') { return buttonwarning(content, value, onclick, block, idtext, addclass, addtionaldata); };
|
||||
$$.UI.Button.Danger = function (content, value = '', onclick = '', block = '', idtext = '', addclass = '', addtionaldata = '') { return buttondanger(content, value, onclick, block, idtext, addclass, addtionaldata); };
|
||||
$$.UI.Button.Primary = function (content, value = '', onclick = '', block = '', idtext = '', addclass = '', addtionaldata = '') { return buttonprimary(content, value, onclick, block, idtext, addclass, addtionaldata); };
|
||||
$$.UI.Button.HomeMenuButtons = function (buttonicon, buttonText, buttonGo, buttonVariabletoPass = '', iconwidth = '', iconheight = '', buttonstyle = '', buttononclick = '', divclass = '', divid = '', buttonid = '', textclass = '') { return HomeMenuButtons(buttonicon, buttonText, buttonGo, buttonVariabletoPass, iconwidth, iconheight, buttonstyle, buttononclick, divclass, divid, buttonid, textclass); };
|
||||
$$.UI.Input = {};
|
||||
$$.UI.Input.textInput = function (idtext = '', setclass = '', required = '', placeholder = '', value = '') { return textinput(idtext, setclass, required, placeholder, value); };
|
||||
$$.UI.Input.textFormControl = function (idtext = '', addclass = '', required = '', placeholder = '', value = '') { return textformcontrol(idtext, addclass, required, placeholder, value); };
|
||||
$$.UI.Card = {};
|
||||
$$.UI.Card.Create = function (cardtitle = '', cardid = '', cardtools = '', cardbodyid = '', cardbodytext = '', cardbodyclassadd = '', maincardstyle = '', titlecardhide = false) { return createCard(cardtitle, cardid, cardtools, cardbodyid, cardbodytext, cardbodyclassadd, maincardstyle, titlecardhide); };
|
||||
$$.UI.Card.Simple = function (title = '', text = '', id = '') { return CreateCardSimple(title, text, id); };
|
||||
$$.UIalt = {};
|
||||
$$.UIalt.hrefonclickButtonGO = function (pagename, pagedatastring = '') { return hrefonclickButtonGO(pagename, pagedatastring); };
|
||||
$$.UIalt.generateHTMLfromarray = function (prepend, append, array, func) { return generateHTMLfromarray(prepend, append, array, func); };
|
||||
$$.UIalt.imgiconuserdefault = function (imgsrc, imgwidth = '', imgheight = '', id = '') { return imgiconuserdefault(imgsrc, imgwidth, imgheight, id); };
|
||||
$$.UIalt.UICardStats = {};
|
||||
$$.UIalt.UICardStats.UICardStatsDetails = function (Title = '', number = 0, Unit = '', leftORright = 'left', numberid = '') { return UICardStatsDetails(Title, number, Unit, leftORright, numberid); };
|
||||
$$.UIalt.UICardStats.UIStatsDetailsArray = function (statsarray) { return UIStatsDetailsArray(statsarray); };
|
||||
$$.UIalt.BalanceCard = {};
|
||||
$$.UIalt.BalanceCard.UIBalance_WrapperfromArray = function (statsarray) { return UIBalance_WrapperfromArray(statsarray); };
|
||||
$$.UIalt.BalanceCard.UIBalance_Wrapper_WalletFooter_Item = function (maintitle = '', onclickstring = '', imgsrc = '', href = '', subtitleline1 = '', subtitleline2 = '', subtitleline3 = '', subtitleline4 = '', imgwidth = '', imgheight = '') { return UIBalance_Wrapper_WalletFooter_Item(maintitle, onclickstring, imgsrc, href, subtitleline1, subtitleline2, subtitleline3, subtitleline4, imgwidth, imgheight); };
|
||||
$$.UIalt.BalanceCard.UIBalance_Wrapper_WalletFooter_Item_ButtonGO = function (maintitle, pagename, pagestring = '', iconclass = '', subtitleline1 = '', subtitleline2 = '', subtitleline3 = '', subtitleline4 = '') { return UIBalance_Wrapper_WalletFooter_Item_ButtonGO(maintitle, pagename, pagestring, iconclass, subtitleline1, subtitleline2, subtitleline3, subtitleline4); };
|
||||
$$.UIalt.BalanceCard.UIBalance_Wrapper_WalletFooter_ARRAY = function (balancewrapper_item_array) { return UIBalance_Wrapper_WalletFooter_ARRAY(balancewrapper_item_array); };
|
||||
$$.UIalt.BalanceCard.UIcreateBalanceBoxfromArray = function (statsarray, balancewrapper_item_array, style = 'border: solid 3px #000d88;') { return UIcreateBalanceBoxfromArray(statsarray, balancewrapper_item_array, style); };
|
||||
$$.UIalt.Services = {};
|
||||
$$.UIalt.Services.Button = function (imgiconsrc, title = '', onclick = '', href = '', bgcolor8 = false) { return UIServices_Button(imgiconsrc, title, onclick, href, bgcolor8); };
|
||||
$$.UIalt.Services.Button_GOTOPAGE = function (imgiconsrc, title, pagename, pagedatastring = '') { return UIServices_Button_GOTOPAGE(imgiconsrc, title, pagename, pagedatastring); };
|
||||
$$.UIalt.Services.FullDIV_GOTOPAGE_Array = function (title, viewallhref = '', viewallonclick = '', viewalltext = '', services_button_array) { return UIServices_FullDIV_GOTOPAGE_Array(title, viewallhref, viewallonclick, viewalltext, services_button_array); };
|
||||
$$.UIalt.Services.FullDIV_ONCLICK_Array = function (title, viewallhref = '', viewallonclick = '', viewalltext = '', services_button_array) { return UIServices_FullDIV_ONCLICK_Array(title, viewallhref, viewallonclick, viewalltext, services_button_array); };
|
||||
$$.UIalt.Sidetext = {};
|
||||
$$.UIalt.Sidetext.UISideText_DualColumnButton = function (text, pagename, pagedatastring = '', imgsrc = '', imgwidth = '', imgheight = '') { return UISideText_DualColumnButton(text, pagename, pagedatastring, imgsrc, imgwidth, imgheight); };
|
||||
$$.UIalt.Sidetext.UISideText_DualColumnButton_Array = function (sidetext_button_dualcolumn_array) { return UISideText_DualColumnButton_Array(sidetext_button_dualcolumn_array); };
|
||||
$$.UIalt.UICardSimple = function (title, text = '', id = '') { return UICardSimple(title, text, id); };
|
||||
$$.UIalt.RecentSearchBar = {};
|
||||
$$.UIalt.RecentSearchBar.SearchBar = function (searchplaceholdertext, classtosearch, id, imgsrclefticon = '', imgsrcrighticon = '', imgwidth = '', imgheight = '') { return UIRecentSearchBar(searchplaceholdertext, classtosearch, id, imgsrclefticon, imgsrcrighticon, imgwidth, imgheight); };
|
||||
$$.UIalt.RecentSearchBar.Searchable_Button_GO = function (title, subtitle, rightsidetext, classforsearch, pagename, pagedatastring = '', imgsrc, imgwidth = '', imgheight = '') { return UIRecentSearchable_Button_GO(title, subtitle, rightsidetext, classforsearch, pagename, pagedatastring, imgsrc, imgwidth, imgheight); };
|
||||
$$.UIalt.RecentSearchBar.Searchable_Button_GO_ARRAY = function (title, recentssearchablebuttonarray, viewallpagetarget, viewallpagedata = '', viewalltext = '') { return UIRecentSearchable_Button_GO_ARRAY(title, recentssearchablebuttonarray, viewallpagetarget, viewallpagedata, viewalltext); };
|
||||
$$.UIalt.UIListArrowButton_GO = function (title, subtitle, pagename, pagedatastring = '', imgsrc, imgwidth = '', imgheight = '') { return UIListArrowButton_GO(title, subtitle, pagename, pagedatastring, imgsrc, imgwidth, imgheight); };
|
||||
$$.UIalt.RecentSearchBar.SearchBox_with_BUTTONS_FULL = function (title, recentssearchablebuttonarray, UIListArrowButtonGOARRAY = '', viewallpagetarget, viewallpagedata = '', viewalltext = '', classtosearch = '', searchid = '', searchplaceholdertext = '', searchlefticon = '', searchrighticon = '', imgwidth = '', imgheight = '') { return UISearchBox_with_BUTTONS_FULL(title, recentssearchablebuttonarray, UIListArrowButtonGOARRAY, viewallpagetarget, viewallpagedata, viewalltext, classtosearch, searchid, searchplaceholdertext, searchlefticon, searchrighticon, imgwidth, imgheight); };
|
||||
$$.UIalt.Input = {};
|
||||
$$.UIalt.Input.InputGroupCore = function (innerhtml = '', label = '', inputgroupid = '') { return UIinputgroupcore(innerhtml, label, inputgroupid); };
|
||||
$$.UIalt.Input.InputGroup = function (placeholder, type, id, label = '', classinput = '', spanclass = '', imginsteadofspan = '', required = false, textvalue = '') { return UIInputGroup(placeholder, type, id, label, classinput, spanclass, imginsteadofspan, required, textvalue); };
|
||||
$$.UIalt.Input.InputGroupSelect = function (id = '', label = '', optionsarray = '', spanclass = '', imginsteadofspan = '', selectedvalue = '') { return UIInputGroupSelect(id, label, optionsarray, spanclass, imginsteadofspan, selectedvalue); };
|
||||
$$.UIalt.Input.InputGroupDatePicker = function () { return UIInputGroupDatePicker(); };
|
||||
$$.UIalt.Input.ArraytoOptionforSelect = function (array, selectedvalue = '') { return UIArraytoOptionforSelect(array, selectedvalue); };
|
||||
$$.UIalt.Input.ReplaceCurrentOptionsSelect = function (selectid, optionsarray, selectedvalue = '') { return UIReplaceCurrentOptionsSelect(selectid, optionsarray, selectedvalue); };
|
||||
$$.UIalt.Input.InputGroupButton = function (buttontext, buttonclass = '', buttonid = '', onclick = '', buttonstyle = '') { return UIInputGroupButton(buttontext, buttonclass, buttonid, onclick, buttonstyle); };
|
||||
$$.UIalt.UISetDarkMode = function () { return UISetDarkMode(); };
|
||||
$$.UIalt.UIUpdateBodyHTML = function (html = '') { return UIUpdateBodyHTML(html); };
|
||||
$$.UIalt.changeTopbarTitle = function (title) { return changeTopbarTitle(title); };
|
||||
$$.StatusIntToString = function (Status) { return InttoStrDetailsFuncs.Status(Status); };
|
||||
$$.StatusPropertiesIntToString = function (Status) { return InttoStrDetailsFuncs.PropertyStatus(Status); };
|
||||
</script>
|
||||
<script>
|
||||
Target_Uploaded_Files = [];
|
||||
LoadDataPageFunc = {};
|
||||
LoadDataPageFunc.Settings = {};
|
||||
LoadDataPageFunc.PageTitle = 'Property Details';
|
||||
LoadDataPageFunc.currentTargetPage = 'ViewPropertyDetails';
|
||||
|
||||
LoadDataPageFunc.URLs = {};
|
||||
LoadDataPageFunc.URLs.MainData = '/View/Property/Details';
|
||||
LoadDataPageFunc.URLs.AddLog = '/View/Property/Details/Logs/Add';
|
||||
LoadDataPageFunc.URLs.SubmitEdit = '/View/Property/Details/Edit/Submit';
|
||||
LoadDataPageFunc.URLs.ChangeStatus = '/View/Property/Details/ChangeStatus'
|
||||
|
||||
LoadDataPageFunc.ids = {};
|
||||
LoadDataPageFunc.ids.ViewPropertyContainer = "viewContainer";
|
||||
LoadDataPageFunc.ids.ViewDetailsLogsContainer = 'ViewDetailsLogsContainer';
|
||||
LoadDataPageFunc.ids.ViewPropertyCard = 'ViewPropertyCard';
|
||||
LoadDataPageFunc.ids.ViewPropertyDetailsCardBody = 'ViewPropertyDetailsCardBody';
|
||||
LoadDataPageFunc.ids.PreviousLogsPage = 'prevBtnLogsPropertyDetailsPage';
|
||||
LoadDataPageFunc.ids.NextLogsPage = 'nextBtnLogsPropertyDetailsPage';
|
||||
LoadDataPageFunc.ids.ChangeStatus_Select = 'ViewPropertyDetails_ChangeStatus_Select';
|
||||
|
||||
LoadDataPageFunc.onclicks = {};
|
||||
LoadDataPageFunc.onclicks.EditDetailsModalOnclick = 'LoadDataPageFunc.EditDetails.EditDetailsModal();';
|
||||
|
||||
|
||||
LoadDataPageFunc.Logs = {};
|
||||
LoadDataPageFunc.Logs.Pagination = {};
|
||||
|
||||
|
||||
LoadDataPageFunc.Logs.Pagination.cardsPerPage = 5;
|
||||
LoadDataPageFunc.Logs.Pagination.currentPage = 1;
|
||||
|
||||
LoadDataPageFunc.Logs.LogRowCard = function (Date = '', content = '') {
|
||||
content = replaceLineBreaks(content);
|
||||
return (UICardSimple('', formatDateTimetoReadable(Date) + '<br><br><h4>' + content + '</h4>'));
|
||||
};
|
||||
|
||||
LoadDataPageFunc.Logs.Pagination.PageArray = function () {
|
||||
return divideArrayIntoSets(LoadDataPageFunc.Logs.LogsCardRowHTMLArray, LoadDataPageFunc.Logs.Pagination.cardsPerPage);
|
||||
};
|
||||
|
||||
LoadDataPageFunc.Logs.Pagination.Firstpage = 1;
|
||||
LoadDataPageFunc.Logs.Pagination.Lastpage = function () {
|
||||
return LoadDataPageFunc.Logs.Pagination.PageArray().length;
|
||||
};
|
||||
|
||||
LoadDataPageFunc.Logs.LogsCardRowHTMLArray = [];
|
||||
|
||||
|
||||
LoadDataPageFunc.Logs.Pagination.FirstPageFound = function () {
|
||||
$('#' + LoadDataPageFunc.ids.NextLogsPage).prop('disabled', false);
|
||||
$('#' + LoadDataPageFunc.ids.PreviousLogsPage).prop('disabled', true);
|
||||
};
|
||||
LoadDataPageFunc.Logs.Pagination.LastPageFound = function () {
|
||||
$('#' + LoadDataPageFunc.ids.NextLogsPage).prop('disabled', true);
|
||||
$('#' + LoadDataPageFunc.ids.PreviousLogsPage).prop('disabled', false);
|
||||
};
|
||||
|
||||
LoadDataPageFunc.Logs.Pagination.MiddlePageFound = function () {
|
||||
$('#' + LoadDataPageFunc.ids.NextLogsPage).prop('disabled', false);
|
||||
$('#' + LoadDataPageFunc.ids.PreviousLogsPage).prop('disabled', false);
|
||||
};
|
||||
|
||||
LoadDataPageFunc.Logs.Pagination.OnlyOnePageFound = function () {
|
||||
$('#' + LoadDataPageFunc.ids.NextLogsPage).prop('disabled', true);
|
||||
$('#' + LoadDataPageFunc.ids.PreviousLogsPage).prop('disabled', true);
|
||||
};
|
||||
|
||||
LoadDataPageFunc.Logs.LogRowHtmlPage = function (page = 1) {
|
||||
if (page) { LoadDataPageFunc.Logs.Pagination.currentPage = page; }
|
||||
|
||||
let arrayset = LoadDataPageFunc.Logs.Pagination.PageArray();
|
||||
let newpageindex = LoadDataPageFunc.Logs.Pagination.currentPage - 1;
|
||||
|
||||
|
||||
if (!isIndexAccessibleArray(arrayset, newpageindex)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
LoadDataPageFunc.Logs.Pagination.DetectAndTogglePageButton(page);
|
||||
|
||||
let targetarr = arrayset[newpageindex];
|
||||
const htmlstr = targetarr.join('<br>');
|
||||
|
||||
$('#' + LoadDataPageFunc.ids.ViewDetailsLogsContainer).html(htmlstr);
|
||||
};
|
||||
|
||||
LoadDataPageFunc.Logs.Pagination.DetectAndTogglePageButton = function (newpage) {
|
||||
if (newpage <= LoadDataPageFunc.Logs.Pagination.Firstpage) { LoadDataPageFunc.Logs.Pagination.FirstPageFound(); }
|
||||
else if (newpage >= LoadDataPageFunc.Logs.Pagination.LastPageFound()) {
|
||||
LoadDataPageFunc.Logs.Pagination.FirstPageFound();
|
||||
} else if (LoadDataPageFunc.Logs.Pagination.Lastpage() == 1) {
|
||||
LoadDataPageFunc.Logs.Pagination.OnlyOnePageFound();
|
||||
} else if (newpage > LoadDataPageFunc.Logs.Pagination.Firstpage && newpage < LoadDataPageFunc.Logs.Pagination.Lastpage()) {
|
||||
LoadDataPageFunc.Logs.Pagination.MiddlePageFound();
|
||||
}
|
||||
|
||||
if (LoadDataPageFunc.Logs.Pagination.Lastpage() === 1) {
|
||||
LoadDataPageFunc.Logs.Pagination.OnlyOnePageFound();
|
||||
}
|
||||
};
|
||||
|
||||
LoadDataPageFunc.Logs.changePage = function (forwardORBackward) {
|
||||
if (!forwardORBackward) { return false; }
|
||||
|
||||
let newpage = LoadDataPageFunc.Logs.Pagination.currentPage;
|
||||
if (forwardORBackward === -1) { newpage = newpage - 1; }
|
||||
else if (forwardORBackward === 1) { newpage = newpage + 1; }
|
||||
if (newpage < LoadDataPageFunc.Logs.Pagination.Firstpage || newpage > LoadDataPageFunc.Logs.Pagination.Lastpage()) {
|
||||
newpage = LoadDataPageFunc.Logs.Pagination.currentPage;
|
||||
return false;
|
||||
}
|
||||
|
||||
LoadDataPageFunc.Logs.Pagination.DetectAndTogglePageButton(newpage);
|
||||
LoadDataPageFunc.Logs.Pagination.currentPage = newpage;
|
||||
|
||||
// Load the new page
|
||||
LoadDataPageFunc.Logs.LogRowHtmlPage(newpage);
|
||||
};
|
||||
|
||||
|
||||
LoadDataPageFunc.Logs.LogFullCard = function (obj) {
|
||||
if (!obj.logs) { return ''; }
|
||||
LoadDataPageFunc.LogsCardRowHTMLArray = [];
|
||||
let newlogfullarr = [];
|
||||
if (typeof obj.logs === 'string') {
|
||||
obj.logs = JSON.parse(obj.logs);
|
||||
}
|
||||
if (obj.logs && Array.isArray(obj.logs)) {
|
||||
newlogfullarr.push('<br><br><div id="' + LoadDataPageFunc.ids.ViewDetailsLogsContainer + '">');
|
||||
let logrow = '';
|
||||
|
||||
const reversedLogs = [...obj.logs].reverse();
|
||||
|
||||
for (let log of reversedLogs) {
|
||||
logrow = LoadDataPageFunc.Logs.LogRowCard(log[0], log[1]);
|
||||
LoadDataPageFunc.Logs.LogsCardRowHTMLArray.push(logrow);
|
||||
// newlogfullarr.push(logrow);
|
||||
}
|
||||
}
|
||||
newlogfullarr.push('</div>');
|
||||
|
||||
return newlogfullarr.join('');
|
||||
|
||||
};
|
||||
|
||||
LoadDataPageFunc.RefetchDataAndReload = function (istrue = true) {
|
||||
if (!istrue) { return false; }
|
||||
Preloaders.ViewPropertyDetailsData(currenttarget, false,
|
||||
function (response) {
|
||||
ReloadPage();
|
||||
}
|
||||
);
|
||||
};
|
||||
|
||||
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.buttonContainer = function (BUTTONSstr) {
|
||||
return `<div class="mt-5"><div class="tf-container">` + '<ul class="box-service mt-3">' + BUTTONSstr + '</ul</div></div>';
|
||||
};
|
||||
|
||||
|
||||
LoadDataPageFunc.DetailsCardControls = function () {
|
||||
let buttonLImaker = LoadDataPageFunc.buttonLImaker;
|
||||
let htmlarr = [`<div class="mt-5"><div class="tf-container">`];
|
||||
htmlarr.push('<ul class="box-service mt-3">');
|
||||
htmlarr.push(buttonLImaker('Change Status', 'LoadDataPageFunc.ChangeStatus.NewStatusModal();', 'changestatus.png'));
|
||||
htmlarr.push(buttonLImaker('Add Logs', 'LoadDataPageFunc.Logs.AddLogsModal();', 'logs.png'));
|
||||
htmlarr.push(buttonLImaker('Edit Details', LoadDataPageFunc.onclicks.EditDetailsModalOnclick, 'edit.png'));
|
||||
htmlarr.push(buttonLImaker('Leads', "ButtonGo('LeadsByProperty','" + currenttarget + "');", 'ListLeads.png'));
|
||||
htmlarr.push(buttonLImaker('Referral URL', 'LoadDataPageFunc.MyReferralURL.ReferralURLModal();', 'betshistory.png'));
|
||||
htmlarr.push('</ul</div></div>');
|
||||
return htmlarr.join('');
|
||||
};
|
||||
|
||||
LoadDataPageFunc.Logs.SubmitNewLog = function () {
|
||||
let ShowEmptyTextModal = function () { ModalQuickDismiss('No Input', 'Please input text as log.') };
|
||||
let ShowUnabletoAddLog = function () { ModalQuickDismiss('Error', 'Unable to Add Log.') };
|
||||
let ShowSuccess = function () { ModalQuickDismiss('Success', 'New Log Added.') };
|
||||
let ShowError = function (errorstring) { ModalQuickDismiss('Error', 'Error Occured. <br><br>' + errorstring) };
|
||||
let newlogtext = $('#newlogtextarea').val();
|
||||
if (!newlogtext) {
|
||||
ShowEmptyTextModal();
|
||||
return false;
|
||||
}
|
||||
request
|
||||
.url(LoadDataPageFunc.URLs.AddLog)
|
||||
.type(LoadDataPageFunc.Settings.RequestType)
|
||||
.fromVarCache(false)
|
||||
.data({ target: currenttarget, newlog: newlogtext })
|
||||
.success((response) => {
|
||||
console.log(response);
|
||||
if (response === true) {
|
||||
|
||||
LoadDataPageFunc.RefetchDataAndReload(true);
|
||||
ShowSuccess();
|
||||
modalhide('ViewDetailsNewLogModal');
|
||||
|
||||
return true;
|
||||
} else {
|
||||
ShowUnabletoAddLog();
|
||||
return false;
|
||||
}
|
||||
})
|
||||
.error((err) => {
|
||||
ShowError(err);
|
||||
return false;
|
||||
})
|
||||
.caching(false)
|
||||
.go();
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
LoadDataPageFunc.Logs.AddLogsModal = function () {
|
||||
let modalbody = `<label for="newlogtextarea">Log:</label>
|
||||
<textarea id="newlogtextarea" rows="10" cols="50" placeholder="Enter the log here..."></textarea>`;
|
||||
CreateAndShowModal('ViewDetailsNewLogModal', 'New Log', modalbody, buttonprimary('Add New Log', value = '', onclick = 'LoadDataPageFunc.Logs.SubmitNewLog();', block = '', idtext = 'ViewPropertyDetailsAddLogButton'));
|
||||
};
|
||||
|
||||
LoadDataPageFunc.Details = {};
|
||||
LoadDataPageFunc.Details.Status = '';
|
||||
LoadDataPageFunc.ids.PhotosShowCard = 'PhotosCard';
|
||||
|
||||
LoadDataPageFunc.PropertyDetailsCard = function (obj) {
|
||||
if (!obj) { return false; }
|
||||
|
||||
let rowcoldetail = [];
|
||||
const imgwidth = '200px'; const imgheight = "200px";
|
||||
if (!obj) { rowcoldetail = 'No Data'; return createCard('Unknown', cardid = 'PropertyRowCard-' + rownum, '', cardbodyid = '', rowcoldetail, cardbodyclassadd = 'ListPropertyRow'); }
|
||||
|
||||
let created = obj.created || false;
|
||||
let modified = obj.modified || false;
|
||||
let name = obj.name || false;
|
||||
let description = obj.description || false;
|
||||
let status = obj.status || false;
|
||||
let remarks = obj.remarks || false;
|
||||
let referralid = obj.referralid || false;
|
||||
let createdby = obj.createdby || false;
|
||||
let category = obj.category || '';
|
||||
let subcategory = obj.subcategory || '';
|
||||
let photourl = obj.photourl || false;
|
||||
let sqm = obj.sqm || false;
|
||||
let bedrooms = obj.bedrooms || false;
|
||||
let rooms = obj.rooms || false;
|
||||
let toilet = obj.toilet || false;
|
||||
let kitchen = obj.kitchen || false;
|
||||
let floors = obj.floors || false;
|
||||
let price = obj.price || false;
|
||||
let specs = obj.specs || false;
|
||||
let location = obj.location || false
|
||||
|
||||
status = InttoStrDetailsFuncs.PropertyStatus(status);
|
||||
modified = formatDateTimetoReadable(modified);
|
||||
created = formatDateTimetoReadable(created);
|
||||
|
||||
try { photourl = JSON.parse(photourl); } catch (e) { photourl = photourl; }
|
||||
|
||||
//LoadDataPageFunc.Details.Status = Status;
|
||||
|
||||
const AddDualColifValue = function (varstr, label) {
|
||||
if (varstr !== false && varstr !== null) {
|
||||
rowcoldetail.push(dualcolrow(label, varstr));
|
||||
}
|
||||
};
|
||||
|
||||
rowcoldetail.push(createCard('', LoadDataPageFunc.ids.PhotosShowCard, '', LoadDataPageFunc.ids.ViewPropertyDetailsCardBody, '', '', '', true));
|
||||
rowcoldetail.push('<br><br>');
|
||||
AddDualColifValue(modified, 'Last Activity');
|
||||
AddDualColifValue(subcategory, category);
|
||||
AddDualColifValue(status, 'Status');
|
||||
AddDualColifValue(createdby, 'Filled By');
|
||||
AddDualColifValue(location, 'Location');
|
||||
AddDualColifValue(sqm, 'Size');
|
||||
AddDualColifValue(bedrooms, 'Bedrooms');
|
||||
AddDualColifValue(rooms, 'Rooms');
|
||||
AddDualColifValue(toilet, 'Toilet');
|
||||
AddDualColifValue(kitchen, 'Kitchen');
|
||||
AddDualColifValue(floors, 'Floors');
|
||||
AddDualColifValue(price, 'Price');
|
||||
rowcoldetail.push('<br><br>');
|
||||
|
||||
rowcoldetail.push(LoadDataPageFunc.DetailsCardControls());
|
||||
let LogsCard = LoadDataPageFunc.Logs.LogFullCard(obj);
|
||||
|
||||
rowcoldetail.push(LogsCard);
|
||||
|
||||
const finalRowColDetail = rowcoldetail.join('');
|
||||
|
||||
let ViewPropertyCardDetails = createCard(name, LoadDataPageFunc.ids.ViewPropertyCard, created, LoadDataPageFunc.ids.ViewPropertyDetailsCardBody, cardbody = finalRowColDetail);
|
||||
return ViewPropertyCardDetails;
|
||||
};
|
||||
|
||||
|
||||
LoadDataPageFunc.LoadPhotosCard = async function () {
|
||||
let photosdiv = $('#' + LoadDataPageFunc.ids.PhotosShowCard);
|
||||
if (photosdiv.length === 0) { return false; }
|
||||
if (!LoadDataPageFunc.Details.photourl) { photosdiv.html('No Photos.<br>'); return false; }
|
||||
let photolist = JSON.parse(LoadDataPageFunc.Details.photourl);
|
||||
if (!photolist || photolist.length === 0) { photosdiv.html('No Photos.<br>'); return false; }
|
||||
let htmlbody = $(`<div class="splide" role="group" aria-label="photosSplide">
|
||||
<div class="splide__track">
|
||||
<ul class="splide__list">
|
||||
</ul> </div></div>`);
|
||||
const NewSplideLIImage = function (imgsrc) {
|
||||
return `<li class="splide__slide" onclick="ButtonGo('ViewAllPhotos','${currenttarget}');"><img src="${imgsrc}" style="max-width: 300px;
|
||||
max-height: 300px;
|
||||
width: auto;
|
||||
height: auto;"></li>`;
|
||||
};
|
||||
let splidebody = htmlbody.find('ul');
|
||||
LoadDataPageFunc.PhotoBlobs = [];
|
||||
photolist.forEach(function (photo) {
|
||||
LoadAndCreateURLfromFileHash(photo).then(bloburl => {
|
||||
splidebody.append(NewSplideLIImage(bloburl));
|
||||
LoadDataPageFunc.PhotoBlobs.push(bloburl);
|
||||
});
|
||||
});
|
||||
|
||||
photosdiv.html(htmlbody);
|
||||
|
||||
new Splide('.splide').mount();
|
||||
};
|
||||
|
||||
|
||||
|
||||
LoadDataPageFunc.ChangeStatus = {};
|
||||
LoadDataPageFunc.ids.ChangeStatusModal = 'ViewDetails_ChangeStatusModal';
|
||||
|
||||
|
||||
LoadDataPageFunc.ChangeStatus.NewStatusModal = function () {
|
||||
const StatusSelect = $$.UIalt.Input.InputGroupSelect(LoadDataPageFunc.ids.ChangeStatus_Select, '', [
|
||||
[-2, $$.StatusPropertiesIntToString(-2)],
|
||||
[-1, $$.StatusPropertiesIntToString(-1)],
|
||||
[0, $$.StatusPropertiesIntToString(0)],
|
||||
[1, $$.StatusPropertiesIntToString(1)],
|
||||
[2, $$.StatusPropertiesIntToString(2)],
|
||||
[3, $$.StatusPropertiesIntToString(3)]], '', '', LoadDataPageFunc.Details.status);
|
||||
|
||||
|
||||
const htmltext = 'Update the Status of the Property';
|
||||
let modalbody = StatusSelect + htmltext;
|
||||
CreateAndShowModal(LoadDataPageFunc.ids.ChangeStatusModal, 'Update Status', modalbody, buttonprimary('Update', value = '', onclick = 'LoadDataPageFunc.ChangeStatus.Submit();', block = '', idtext = ''));
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
LoadDataPageFunc.ChangeStatus.Submit = function () {
|
||||
const sel = $('#' + LoadDataPageFunc.ids.ChangeStatus_Select).val();
|
||||
const selectedstatus = (sel !== null) ? sel : null;
|
||||
|
||||
if (selectedstatus === null) { $$.UI.Modal.ModalQuickDismiss('', 'Select a Status'); return false; }
|
||||
if (selectedstatus == LoadDataPageFunc.Details.Status) { $$.UI.Modal.ModalQuickDismiss('', 'Nothing to Change!'); return false; }
|
||||
|
||||
|
||||
let request = new RequestData(false);
|
||||
request
|
||||
.url(LoadDataPageFunc.URLs.ChangeStatus)
|
||||
.type(LoadDataPageFunc.Settings.RequestType)
|
||||
.fromVarCache(false)
|
||||
.data({ target: currenttarget, newstatus: selectedstatus })
|
||||
.success((response) => {
|
||||
|
||||
if (response === true) {
|
||||
LoadDataPageFunc.RefetchDataAndReload(true);
|
||||
$$.UI.Modal.ModalQuickDismiss('', 'Success!');
|
||||
hidemodal(LoadDataPageFunc.ids.ChangeStatusModal);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
})
|
||||
.error((err) => {
|
||||
ModalQuickDismiss('Error', 'Unable To Change Status<br><br>' + err);
|
||||
})
|
||||
.go();
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
LoadDataPageFunc.vars = {};
|
||||
LoadDataPageFunc.vars.idprefix = 'ViewProperty';
|
||||
LoadDataPageFunc.ids.EditDetailsModal = LoadDataPageFunc.vars.idprefix + '_EditDetailsModal';
|
||||
LoadDataPageFunc.EditDetails = {};
|
||||
|
||||
LoadDataPageFunc.ids.EditDetailsMidfix = '-EditDetails';
|
||||
LoadDataPageFunc.ids.EditDetails_name = LoadDataPageFunc.vars.idprefix + LoadDataPageFunc.ids.EditDetailsMidfix + 'PropertyName';
|
||||
LoadDataPageFunc.ids.EditDetails_Description = LoadDataPageFunc.vars.idprefix + LoadDataPageFunc.ids.EditDetailsMidfix + 'PropertyDescription';
|
||||
LoadDataPageFunc.ids.EditDetails_Remarks = LoadDataPageFunc.vars.idprefix + LoadDataPageFunc.ids.EditDetailsMidfix + 'Remarks';
|
||||
LoadDataPageFunc.ids.EditDetails_Location = LoadDataPageFunc.vars.idprefix + LoadDataPageFunc.ids.EditDetailsMidfix + 'Location';
|
||||
LoadDataPageFunc.ids.EditDetails_Category = LoadDataPageFunc.vars.idprefix + LoadDataPageFunc.ids.EditDetailsMidfix + 'Category';
|
||||
LoadDataPageFunc.ids.EditDetails_SubCategory = LoadDataPageFunc.vars.idprefix + LoadDataPageFunc.ids.EditDetailsMidfix + 'SubCategory';
|
||||
LoadDataPageFunc.ids.EditDetails_sqm = LoadDataPageFunc.vars.idprefix + LoadDataPageFunc.ids.EditDetailsMidfix + 'sqm';
|
||||
LoadDataPageFunc.ids.EditDetails_Bedrooms = LoadDataPageFunc.vars.idprefix + LoadDataPageFunc.ids.EditDetailsMidfix + 'Bedrooms';
|
||||
LoadDataPageFunc.ids.EditDetails_Rooms = LoadDataPageFunc.vars.idprefix + LoadDataPageFunc.ids.EditDetailsMidfix + 'Rooms';
|
||||
LoadDataPageFunc.ids.EditDetails_Toilet = LoadDataPageFunc.vars.idprefix + LoadDataPageFunc.ids.EditDetailsMidfix + 'Toilet';
|
||||
LoadDataPageFunc.ids.EditDetails_Kitchen = LoadDataPageFunc.vars.idprefix + LoadDataPageFunc.ids.EditDetailsMidfix + 'Kitchen';
|
||||
LoadDataPageFunc.ids.EditDetails_Floors = LoadDataPageFunc.vars.idprefix + LoadDataPageFunc.ids.EditDetailsMidfix + 'Floors';
|
||||
LoadDataPageFunc.ids.EditDetails_Price = LoadDataPageFunc.vars.idprefix + LoadDataPageFunc.ids.EditDetailsMidfix + 'Price';
|
||||
|
||||
LoadDataPageFunc.ids.EditDetailsUploadPhotoDropzone = 'newpropertydropzonephoto';
|
||||
LoadDataPageFunc.ids.EditDetailsReplacePhotosButton = 'EditDetailsreplacePhotos';
|
||||
|
||||
LoadDataPageFunc.EditDetails.InitializePhotoDropZone = function () {
|
||||
Target_Uploaded_Files = [];
|
||||
myDropzone = null;
|
||||
currentDropzone = DropZoneFunc.InitializeDropZone('/File/Upload/Property', (response) => {
|
||||
if (response.length === 72) {
|
||||
Target_Uploaded_Files.push(response);
|
||||
LoadDataPageFunc.ShowPhotoClearButton();
|
||||
} else {
|
||||
currentDropzone.removeFile(currentDropzone.files[currentDropzone.files.length - 2]);
|
||||
}
|
||||
}, LoadDataPageFunc.ids.EditDetailsUploadPhotoDropzone, DropZoneFunc.AcceptedFilesString.images, 'file', maxfilesize = 100);
|
||||
};
|
||||
|
||||
|
||||
LoadDataPageFunc.ids.ClearPhotosButton = 'newpropertydropzoneclearbutton';
|
||||
|
||||
LoadDataPageFunc.ShowPhotoClearButton = function () {
|
||||
$('#' + LoadDataPageFunc.ids.ClearPhotosButton).show();
|
||||
};
|
||||
LoadDataPageFunc.ClearPhotos = function () {
|
||||
DropZoneFunc.ClearDropzoneUpload();
|
||||
LoadDataPageFunc.HidePhotoClearButton();
|
||||
};
|
||||
|
||||
LoadDataPageFunc.HidePhotoClearButton = function () {
|
||||
$('#' + LoadDataPageFunc.ids.ClearPhotosButton).hide();
|
||||
};
|
||||
|
||||
LoadDataPageFunc.EditDetails.EditDetailsModal = function () {
|
||||
Target_Uploaded_Files = [];
|
||||
$('#' + LoadDataPageFunc.ids.EditDetailsModal).remove();
|
||||
|
||||
const SubmitOnclick = '';
|
||||
const targetdiv = 'modal-body-' + LoadDataPageFunc.ids.EditDetailsModal;
|
||||
let FormHTML = ReusableUIElements.NewPropertyGenerateUI(targetdiv, idprefix = LoadDataPageFunc.vars.idprefix + '-EditDetails', replace = false,
|
||||
LoadDataPageFunc.Details.name, LoadDataPageFunc.Details.description,
|
||||
LoadDataPageFunc.Details.status, LoadDataPageFunc.Details.remarks,
|
||||
LoadDataPageFunc.Details.location, LoadDataPageFunc.Details.category, LoadDataPageFunc.Details.subcategory, LoadDataPageFunc.Details.sqm,
|
||||
LoadDataPageFunc.Details.bedrooms, LoadDataPageFunc.Details.rooms, LoadDataPageFunc.Details.toilet,
|
||||
LoadDataPageFunc.Details.kitchen, LoadDataPageFunc.Details.floors,
|
||||
false, true, LoadDataPageFunc.Details.price);
|
||||
const footer = buttonprimary('Update', '', onclick = 'LoadDataPageFunc.EditDetails.Submit();');
|
||||
const modalhtml = $$.UI.Modal.Create(LoadDataPageFunc.ids.EditDetailsModal, 'Update Details', FormHTML, footer);
|
||||
$$.UI.Element.appendtobody(modalhtml);
|
||||
const replacePhotosButton = buttonprimary('Replace Photos', value = '', onclick = 'LoadDataPageFunc.EditDetails.ShowPhotoUploadButton();', block = '', LoadDataPageFunc.ids.EditDetailsReplacePhotosButton);
|
||||
$('#ViewProperty-EditDetailsNewPropertyPhotosInputGroup').append(replacePhotosButton);
|
||||
$('#' + LoadDataPageFunc.ids.EditDetailsUploadPhotoDropzone).hide();
|
||||
$('#ViewProperty-EditDetailsStatus-select-div-mb3').remove();
|
||||
$('label[for="ViewProperty-EditDetailsStatus-select-div-mb3"]').remove();
|
||||
|
||||
|
||||
Preloaders.Datalist.NewPropertyCategory(function () { ReqCachetoDatalist('/Datalist/NewPropertyCategory', 'ViewProperty-EditDetailsSubCategory', replace = true); });
|
||||
Preloaders.Datalist.NewPropertySubCategory(function () { ReqCachetoDatalist('/Datalist/NewPropertySubCategory', 'ViewProperty-EditDetailsSubCategory', replace = true); });
|
||||
|
||||
|
||||
$('#' + LoadDataPageFunc.ids.ClearPhotosButton).hide();
|
||||
|
||||
$('#newpropertydropzoneclearbutton').click(function () {
|
||||
LoadDataPageFunc.ClearPhotos();
|
||||
});
|
||||
|
||||
LoadDataPageFunc.EditDetails.ShowPhotoUploadButton = function () {
|
||||
$('#' + LoadDataPageFunc.ids.EditDetailsUploadPhotoDropzone).show();
|
||||
$('#' + LoadDataPageFunc.ids.EditDetailsReplacePhotosButton).hide();
|
||||
};
|
||||
|
||||
LoadDataPageFunc.EditDetails.InitializePhotoDropZone();
|
||||
|
||||
showmodal(LoadDataPageFunc.ids.EditDetailsModal);
|
||||
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
LoadDataPageFunc.EditDetails.GetChanges = function () {
|
||||
let objectdata = {};
|
||||
objectdata.target = currenttarget;
|
||||
const new_name = $('#' + LoadDataPageFunc.ids.EditDetails_name).val();
|
||||
const new_description = $('#' + LoadDataPageFunc.ids.EditDetails_Description).val();
|
||||
const new_remarks = $('#' + LoadDataPageFunc.ids.EditDetails_Remarks).val();
|
||||
const new_location = $('#' + LoadDataPageFunc.ids.EditDetails_Location).val();
|
||||
const new_category = $('#' + LoadDataPageFunc.ids.EditDetails_Category).val();
|
||||
const new_subcategory = $('#' + LoadDataPageFunc.ids.EditDetails_SubCategory).val();
|
||||
let new_sqm = Number($('#' + LoadDataPageFunc.ids.EditDetails_sqm).val());
|
||||
let new_bedroom = Number($('#' + LoadDataPageFunc.ids.EditDetails_Bedrooms).val());
|
||||
let new_rooms = Number($('#' + LoadDataPageFunc.ids.EditDetails_Rooms).val());
|
||||
let new_toilet = Number($('#' + LoadDataPageFunc.ids.EditDetails_Toilet).val());
|
||||
let new_kitchen = Number($('#' + LoadDataPageFunc.ids.EditDetails_Kitchen).val());
|
||||
let new_floors = Number($('#' + LoadDataPageFunc.ids.EditDetails_Floors).val());
|
||||
let new_price = Number($('#' + LoadDataPageFunc.ids.EditDetails_Price).val());
|
||||
|
||||
let changes = 0;
|
||||
|
||||
if (LoadDataPageFunc.Details.name !== new_name) { objectdata.name = new_name; changes++; }
|
||||
if (LoadDataPageFunc.Details.description !== new_description) { objectdata.description = new_description; changes++; }
|
||||
if (LoadDataPageFunc.Details.remarks !== new_remarks) { objectdata.remarks = new_remarks; changes++; }
|
||||
if (LoadDataPageFunc.Details.location !== new_location) { objectdata.location = new_location; changes++; }
|
||||
if (LoadDataPageFunc.Details.category !== new_category) { objectdata.category = new_category; changes++; }
|
||||
if (LoadDataPageFunc.Details.subcategory !== new_subcategory) { objectdata.subcategory = new_subcategory; changes++; }
|
||||
if (LoadDataPageFunc.Details.sqm !== new_sqm) { objectdata.sqm = new_sqm; changes++; }
|
||||
if (LoadDataPageFunc.Details.bedrooms !== new_bedroom) { objectdata.bedrooms = new_bedroom; changes++; }
|
||||
if (LoadDataPageFunc.Details.rooms !== new_rooms) { objectdata.rooms = new_rooms; changes++; }
|
||||
if (LoadDataPageFunc.Details.toilet !== new_toilet) { objectdata.toilet = new_toilet; changes++; }
|
||||
if (LoadDataPageFunc.Details.kitchen !== new_kitchen) { objectdata.kitchen = new_kitchen; changes++; }
|
||||
if (LoadDataPageFunc.Details.floors !== new_floors) { objectdata.floors = new_floors; changes++; }
|
||||
if (LoadDataPageFunc.Details.price !== new_price) { objectdata.price = new_price; changes++; }
|
||||
if (Target_Uploaded_Files.length > 0) { objectdata.photourl = JSON.stringify(Target_Uploaded_Files); changes++; }
|
||||
if (!changes) { return null; }
|
||||
if (!new_name || !new_description || !new_location || !new_sqm) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return objectdata;
|
||||
};
|
||||
|
||||
|
||||
LoadDataPageFunc.EditDetails.Submit = function () {
|
||||
|
||||
let ChangesObject = LoadDataPageFunc.EditDetails.GetChanges();
|
||||
if (ChangesObject === null) { $$.UI.Modal.ModalQuickDismiss('No Changes', 'No Changes to Update!'); return false; }
|
||||
if (ChangesObject === false) { $$.UI.Modal.ModalQuickDismiss('', 'Incomplete Details!<br>The following are required!<br><br>Property Name<br>Description<br>Location<br>Size in sqm'); return false; }
|
||||
if (Target_Uploaded_Files.length == 0) { $$.UI.Modal.ModalQuickDismiss('', 'No New Photos Uploaded!<br>Previous Photos Would be used!',); }
|
||||
let SendUpdatedDetails = new RequestData(false);
|
||||
request
|
||||
.url(LoadDataPageFunc.URLs.SubmitEdit)
|
||||
.type(LoadDataPageFunc.Settings.RequestType)
|
||||
.fromVarCache(false)
|
||||
.data(ChangesObject)
|
||||
.success((response) => {
|
||||
if (!response) { return false; }
|
||||
const error = response.error || false;
|
||||
if (response !== true) {
|
||||
if (error) { $$.UI.Modal.ModalQuickDismiss('Error', error); }
|
||||
return false;
|
||||
} else if (response === true) {
|
||||
LoadDataPageFunc.RefetchDataAndReload(true);
|
||||
ReloadPage();
|
||||
hidemodal(LoadDataPageFunc.ids.EditDetailsModal);
|
||||
$$.UI.Modal.ModalQuickDismiss('Success', 'Details Updated');
|
||||
}
|
||||
})
|
||||
.error((err) => {
|
||||
ModalQuickDismiss('Error', 'Unable to Load<br>' + err);
|
||||
})
|
||||
.go();
|
||||
|
||||
};
|
||||
|
||||
LoadDataPageFunc.MyReferralURL = {};
|
||||
LoadDataPageFunc.MyReferralURL.ToURL = function (ReferralCode) {
|
||||
let PropertyHash = LoadDataPageFunc.Details.hashkey;
|
||||
if (!ReferralCode || !PropertyHash) { return false; }
|
||||
return window.location.origin + '/p/ReferProperty/s/' + PropertyHash + '/dr/' + ReferralCode;
|
||||
};
|
||||
LoadDataPageFunc.MyReferralURL.ReferralURLModal = function () {
|
||||
|
||||
let RefferralREQ = new RequestData(false);
|
||||
let modalbody = '';
|
||||
let FinalURL = '';
|
||||
RefferralREQ.url('/ReferralCode/List/data').type('POST')
|
||||
.fromVarCache(false)
|
||||
.success(function (response) {
|
||||
|
||||
let newURLRow = function (ReferralCode) {
|
||||
const MainURL = LoadDataPageFunc.MyReferralURL.ToURL(ReferralCode)
|
||||
const textarea = '<textarea>' + MainURL + '</textarea>';
|
||||
const CopybuttonOnclick = 'navigator.clipboard.writeText(`' + MainURL + '`);this.textContent=`Copied!`;';
|
||||
|
||||
const SharebuttonOnclick = `if (navigator.share) {
|
||||
navigator.share({
|
||||
title: '${LoadDataPageFunc.Details.name} Property',
|
||||
text: 'Interested In this Property ${LoadDataPageFunc.Details.name}',
|
||||
url: '${MainURL}'
|
||||
});}`;
|
||||
|
||||
|
||||
return `<div class="tf-container"><ul class="box-service mt-3">
|
||||
<li>${textarea}</li>
|
||||
${LoadDataPageFunc.buttonLImaker('Copy',CopybuttonOnclick,'edit.png')}
|
||||
${LoadDataPageFunc.buttonLImaker('Share',SharebuttonOnclick,'share.png')}
|
||||
</ul>
|
||||
</div><br><br>`;
|
||||
}
|
||||
|
||||
/*
|
||||
for (let index = 0; index < response.length; index++) {
|
||||
const element = response[index];
|
||||
const referralCode = element['referral_code'];
|
||||
modalbody += newURLRow(referralCode);
|
||||
}
|
||||
*/
|
||||
|
||||
iterateArray(response, (element) => {
|
||||
modalbody += newURLRow(element['referral_code']);
|
||||
});
|
||||
|
||||
|
||||
if (!response) { modalbody = '<center>NO URL</center> '; }
|
||||
modalbody += '<br>' + LoadDataPageFunc.buttonContainer(LoadDataPageFunc.buttonLImaker('Generate URL', 'LoadDataPageFunc.MyReferralURL.Generate();', 'sync.png'));
|
||||
$$.UI.Modal.ModalQuickDismiss('My Property Referral URL', modalbody, 'PropertyReferralCodes');
|
||||
}).go();
|
||||
|
||||
};
|
||||
|
||||
LoadDataPageFunc.MyReferralURL.Generate = function () {
|
||||
|
||||
let ONsuccess = function () {
|
||||
hidemodal('PropertyReferralCodes');
|
||||
|
||||
LoadDataPageFunc.MyReferralURL.ReferralURLModal();
|
||||
};
|
||||
|
||||
|
||||
let REQQ = new RequestData(false);
|
||||
REQQ.url('/ReferralCode/Request/New').type('POST').fromVarCache(false).
|
||||
success((response) => {
|
||||
if (response) {
|
||||
ONsuccess();
|
||||
return true;
|
||||
} else {
|
||||
$$.UI.Modal.ModalQuickDismiss('', 'Error! Try Again Later');
|
||||
}
|
||||
}).go();
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
LoadDataPageFunc.Settings = {};
|
||||
|
||||
|
||||
LoadDataPageFunc.Settings.RequestType = 'POST';
|
||||
LoadDataPageFunc.Settings.fromVarCache = true;
|
||||
LoadDataPageFunc.DefaultDatatoSend = function () {
|
||||
return { target: currenttarget };
|
||||
};
|
||||
LoadDataPageFunc.LoadMainDetails = {};
|
||||
LoadDataPageFunc.LoadMainDetails.OnSuccess = function (response) {
|
||||
if (!response) { ModalQuickDismiss('Error', 'No Data Loaded<br>'); return ''; }
|
||||
LoadDataPageFunc.PropertyCurrentDetails = response.Details;
|
||||
LoadDataPageFunc.Details = response.Details;
|
||||
$('#' + LoadDataPageFunc.ids.ViewPropertyContainer).html(LoadDataPageFunc.PropertyDetailsCard(response.Details));
|
||||
LoadDataPageFunc.Logs.LogRowHtmlPage();
|
||||
LoadDataPageFunc.LoadPhotosCard();
|
||||
};
|
||||
|
||||
LoadDataPageFunc.LoadMainDetails.OnError = function (err) { ModalQuickDismiss('Error', 'Unable to Load<br>' + err); };
|
||||
|
||||
|
||||
|
||||
LoadDataPageFunc.LoadMainDetails.LoadNow = function () {
|
||||
|
||||
let request = new RequestData(false);
|
||||
request
|
||||
.url(LoadDataPageFunc.URLs.MainData)
|
||||
.type(LoadDataPageFunc.Settings.RequestType)
|
||||
.fromVarCache(LoadDataPageFunc.Settings.fromVarCache)
|
||||
.data(LoadDataPageFunc.DefaultDatatoSend())
|
||||
.success((response) => {
|
||||
if (typeof LoadDataPageFunc === 'undefined' || LoadDataPageFunc.currentTargetPage === 'undefined') {
|
||||
return false;
|
||||
}
|
||||
if (currentPage !== LoadDataPageFunc.currentTargetPage) { return false; }
|
||||
LoadDataPageFunc.LoadMainDetails.OnSuccess(response);
|
||||
})
|
||||
.error((err) => {
|
||||
ModalQuickDismiss('Error', 'Unable to Load<br>' + err);
|
||||
})
|
||||
.go();
|
||||
};
|
||||
|
||||
|
||||
|
||||
LoadDataPageFunc.main = function () {
|
||||
LoadDataPageFunc.LoadMainDetails.LoadNow();
|
||||
|
||||
changeTopbarTitle(LoadDataPageFunc.PageTitle);
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
$(document).ready(function () {
|
||||
LoadDataPageFunc.main();
|
||||
|
||||
});
|
||||
|
||||
|
||||
|
||||
</script>
|
||||
308
legacy/pages-html/slvl/all/account_settings
Normal file
308
legacy/pages-html/slvl/all/account_settings
Normal file
@@ -0,0 +1,308 @@
|
||||
<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="/assets/sync.png" 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">
|
||||
|
||||
</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"></h5>
|
||||
</li>
|
||||
<li class="list-user-info"><span class="icon-credit-card2"></span>
|
||||
<h4 id="account_settings_credit_card_main"></h4>
|
||||
</li>
|
||||
<li class="list-user-info"><span class="icon-phone"></span>
|
||||
<h4 id="account_settings_mobile_number"></h4>
|
||||
</li>
|
||||
<li class="list-user-info"><span class="icon-email"></span>
|
||||
<h4 id="account_settings_email"></h4>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div class="card-section" id="main-card-section">
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<br><br>
|
||||
|
||||
|
||||
<script>
|
||||
|
||||
function ChangePasswordInitialModal() {
|
||||
|
||||
|
||||
const modalid = "modal-change-password-initial-page";
|
||||
const modaltitle = "Change Password";
|
||||
const modalbody = `
|
||||
|
||||
|
||||
<div class="input-group mb-3">
|
||||
<input type="password" class="form-control" placeholder="Current Password" id="olduserpassword"
|
||||
name="olduserpassword">
|
||||
<div class="input-group-append">
|
||||
<div class="input-group-text" id="user-password-input-group-text">
|
||||
<span class="fas fa-lock" id="user-password-span"></span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="input-group mb-3">
|
||||
<input type="password" class="form-control" placeholder="New Password" id="newuserpassword"
|
||||
name="newuserpassword">
|
||||
<div class="input-group-append">
|
||||
<div class="input-group-text" id="newuser-password-input-group-text">
|
||||
<span class="fas fa-lock" id="newuser-password-span"></span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="input-group mb-3">
|
||||
<input type="password" class="form-control" placeholder="Confirm Password" id="newuserpasswordconfirm"
|
||||
name="newuserpasswordconfirm">
|
||||
<div class="input-group-append">
|
||||
<div class="input-group-text" id="newuser-password-confirm-input-group-text">
|
||||
<span class="fas fa-lock" id="newuser-password-confirm-span"></span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
`;
|
||||
const modalfooter = `<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
|
||||
<button type="button" class="btn btn-danger" onclick="ChangePasswordConfirmAccountSettings();" id="change-password-now-confirm-button">Change Password</button>`;
|
||||
|
||||
|
||||
CreateAndShowModal(modalid, modaltitle, modalbody, modalfooter, modalfooterclose = false, topclosebutton = true, modalbodyclass = 'modal-body', modalheaderclass = 'modal-header');
|
||||
|
||||
|
||||
$('#newuserpassword').keyup(function () {
|
||||
VerifyInitialPassword();
|
||||
VerifyAllPasswordInput();
|
||||
});
|
||||
$('#newuserpasswordconfirm').keyup(function () {
|
||||
VerifyConfirmPassword();
|
||||
VerifyAllPasswordInput();
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
function ChangePasswordAccountSettingsSuccess() {
|
||||
const modalid = "modal-change-password-success";
|
||||
const modaltitle = "Success";
|
||||
const modalbody = `<p>Password has been changed successfully</p>`;
|
||||
const modalfooter = `<button type="button" class="btn btn-primary" onclick="window.location.href = '/logout'; $('.modal').hide(); window.location.href = '';" id="change-password-success-button">OK</button>`;
|
||||
|
||||
|
||||
CreateAndShowModal(modalid, modaltitle, modalbody, modalfooter, modalfooterclose = false, topclosebutton = true, modalbodyclass = 'modal-body', modalheaderclass = 'modal-header');
|
||||
|
||||
|
||||
}
|
||||
|
||||
function ChangePasswordAccountSettingsError(response) {
|
||||
const modalid = "modal-change-password-failed";
|
||||
const modaltitle = "Failed";
|
||||
const modalbody = `<p>Unable to change password. Please try again later.</p><p>${response}</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-change-password-final-confirmation-page').modal('hide');
|
||||
}
|
||||
|
||||
|
||||
function ChangePasswordNowAccountSettings() {
|
||||
|
||||
function ChangePasswordNow(response) {
|
||||
if (response === true) {
|
||||
$('.modal').hide();
|
||||
ChangePasswordAccountSettingsSuccess();
|
||||
} else {
|
||||
ChangePasswordAccountSettingsError(response);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
AjaxDo('/user/changemypassword', { current_password: $("#olduserpassword").val(), new_password: $("#newuserpassword").val(), new_confirm_password: $("#newuserpasswordconfirm").val() }, ChangePasswordNow, null, reqtype = 'POST');
|
||||
|
||||
}
|
||||
|
||||
function ChangePasswordAccountSettingsFinalConfirmModal() {
|
||||
const modalid = "modal-change-password-final-confirmation-page";
|
||||
const modaltitle = "Continue?";
|
||||
const modalbody = `<p>Confirm Password Change?</p>`;
|
||||
const modalfooter = `<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
|
||||
<button type="button" class="btn btn-primary" onclick="ChangePasswordNowAccountSettings();" id="change-password-now-confirm-button">Change Password</button>`;
|
||||
|
||||
|
||||
CreateAndShowModal(modalid, modaltitle, modalbody, modalfooter, modalfooterclose = false, topclosebutton = true, modalbodyclass = 'modal-body', modalheaderclass = 'modal-header');
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
function ChangePasswordConfirmAccountSettings() {
|
||||
if (!VerifyAllPasswordInput()) { return false; }
|
||||
ChangePasswordAccountSettingsFinalConfirmModal();
|
||||
}
|
||||
|
||||
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 ChangeConfirmPasswordButtontoPrimary() {
|
||||
$('#change-password-now-confirm-button').attr('class', 'btn btn-primary');
|
||||
}
|
||||
function ChangeConfirmPasswordButtontoDanger() {
|
||||
$('#change-password-now-confirm-button').attr('class', 'btn btn-danger');
|
||||
}
|
||||
|
||||
function VerifyInitialPassword() {
|
||||
const userPassword = document.getElementById("newuserpassword").value;
|
||||
if (userPassword.length < 6) {
|
||||
changeSpantoInvalid('newuser-password');
|
||||
normalpasswordallowed = false;
|
||||
return false;
|
||||
}
|
||||
changeSpantoValid('newuser-password');
|
||||
normalpasswordallowed = true;
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
function VerifyConfirmPassword() {
|
||||
const userPassword = document.getElementById("newuserpassword").value;
|
||||
const userPasswordConfirm = document.getElementById("newuserpasswordconfirm").value;
|
||||
|
||||
if (userPassword.length < 6 || userPasswordConfirm.length < 6) {
|
||||
changeSpantoInvalid('newuser-password-confirm');
|
||||
confirmpasswordallowed = false;
|
||||
return false;
|
||||
}
|
||||
if (userPassword !== userPasswordConfirm) {
|
||||
changeSpantoInvalid('newuser-password-confirm');
|
||||
confirmpasswordallowed = false;
|
||||
return false;
|
||||
}
|
||||
changeSpantoValid('newuser-password-confirm'); changeSpantoValid('newuser-password');
|
||||
confirmpasswordallowed = true; return true;
|
||||
}
|
||||
|
||||
function VerifyAllPasswordInput() {
|
||||
const OlduserPassword = document.getElementById("olduserpassword").value;
|
||||
|
||||
|
||||
if (VerifyInitialPassword() && VerifyConfirmPassword() && OlduserPassword.length > 5) {
|
||||
ChangeConfirmPasswordButtontoPrimary();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
servicesbuttonarray = [['/assets/resetpassword.png', 'Reset Password', 'ChangePasswordInitialModal();', 'javascript:void(0);'],
|
||||
['/assets/betshistory.png', 'Reset Browser and Cache', 'clearCacheAndReload()', 'javascript:void(0);'],
|
||||
['/assets/notes.png', 'Show Notes', 'ShowNotes(true);', 'javascript:void(0);'],
|
||||
['/assets/logout.png', 'Logout', 'clearCacheAndLogout();clearCacheAndLogout();', 'javascript:void(0);']
|
||||
];
|
||||
|
||||
|
||||
|
||||
servicesbox = UIServices_FullDIV_ONCLICK_Array('', '', '', '', servicesbuttonarray);
|
||||
|
||||
|
||||
$('#main-card-section').html(servicesbox);
|
||||
|
||||
changeTopbarTitle('Account Settings');
|
||||
|
||||
|
||||
function account_details_load_data() {
|
||||
|
||||
const url ='/account_settings/details';
|
||||
const updateaccountdetailshtml = function(name,fullname,mobile,photourl,landline,email){
|
||||
$('#account_settings_profile_picture').attr('src',photourl);
|
||||
$('#account_settings_fullname_profile').html(name);
|
||||
$('#account_settings_fullname_main').html(fullname);
|
||||
$('#account_settings_credit_card_main').html(mobile);
|
||||
$('#account_settings_mobile_number').html(landline);
|
||||
$('#account_settings_email').html(email);
|
||||
}
|
||||
const photourl_account_settings_find_one = function(response){
|
||||
let photourl = response.photourl;
|
||||
if (photourl === undefined || photourl === null || photourl === '') {
|
||||
} else if (Array.isArray(photourl)) {
|
||||
photourl = photourl[0];
|
||||
} else if (!Array.isArray(photourl)) {
|
||||
|
||||
}
|
||||
|
||||
if (photourl === undefined || photourl === null || photourl === '') {
|
||||
photourl = response.photourl2;
|
||||
}
|
||||
if (Array.isArray(photourl)) {
|
||||
photourl = photourl[0];
|
||||
}
|
||||
return photourl;
|
||||
}
|
||||
|
||||
let request = new RequestData(true);
|
||||
const cachedata = reqcacheload(url,datavalue='',object=null);
|
||||
if(cachedata){
|
||||
let photourlcachedata = updateaccountdetailshtml(cachedata);
|
||||
updateaccountdetailshtml(cachedata.name,cachedata.fullname,cachedata.mobile,photourlcachedata,cachedata.landline,cachedata.email);
|
||||
}
|
||||
|
||||
request
|
||||
.url(url)
|
||||
.type('GET')
|
||||
.data(null)
|
||||
.success((response) => {
|
||||
|
||||
|
||||
const photourl = photourl_account_settings_find_one (response);
|
||||
updateaccountdetailshtml(response.name,response.fullname,response.mobile,photourl,response.landline,response.email);
|
||||
|
||||
|
||||
|
||||
})
|
||||
.error((err) => {
|
||||
console.error(err);
|
||||
})
|
||||
.go();
|
||||
}
|
||||
|
||||
|
||||
$(document).ready(function () {
|
||||
account_details_load_data();
|
||||
});
|
||||
|
||||
|
||||
</script>
|
||||
95
legacy/pages-html/slvl/all/all_available_reports
Normal file
95
legacy/pages-html/slvl/all/all_available_reports
Normal file
@@ -0,0 +1,95 @@
|
||||
<br><br><br><br>
|
||||
|
||||
<div class="card" id="primary-card">
|
||||
<div class="card-header ui-sortable-handle" style="cursor: move">
|
||||
<h1 class="card-title" style="font-size: 2.5rem;">Reports</h1>
|
||||
<div class="card-tools">
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<table id="reports_list_table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>
|
||||
Report
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<style>
|
||||
/* Style each row as a button */
|
||||
.dataTable tbody tr {
|
||||
padding: .5rem 1rem;
|
||||
font-size: 1.25rem;
|
||||
line-height: 1.5;
|
||||
border-radius: .3rem;
|
||||
}
|
||||
|
||||
|
||||
</style>
|
||||
|
||||
|
||||
<script>
|
||||
|
||||
|
||||
|
||||
function GenerateReportsListRow(Name) {
|
||||
var parts = Name.split('-');
|
||||
|
||||
// Assign the parts to variables
|
||||
var text = parts[0];
|
||||
var value = parts[1];
|
||||
|
||||
return `<tr> <td><center><button class="btn-block btn-lg" onclick="ButtonGo('${value}',0);">${text}</button></center></td> </tr>`; }
|
||||
|
||||
async function GenerateReportsListRows(responsearray) {
|
||||
let newhtmltable = [];
|
||||
|
||||
for (let i = 0; i < responsearray.length; i++) { newhtmltable.push(GenerateReportsListRow(responsearray[i])); }
|
||||
|
||||
|
||||
$("#reports_list_table").find("tbody").html(newhtmltable.join(''));
|
||||
|
||||
let reportslist = $("#reports_list_table").DataTable({
|
||||
"destroy": true,
|
||||
order: [[0, 'desc']],
|
||||
pageLength: 5,
|
||||
lengthMenu: [[5], [5]]
|
||||
});
|
||||
|
||||
|
||||
/*
|
||||
reportslist.on('click', 'tbody tr', function () {
|
||||
return;
|
||||
let data = reportslist.row(this).data();
|
||||
let targettranshash = data[0];
|
||||
console.log(targettranshash);
|
||||
$(targettranshash).find('a').trigger('click');
|
||||
|
||||
|
||||
});
|
||||
|
||||
*/
|
||||
|
||||
|
||||
$('#primary-card').fadeIn(200);
|
||||
|
||||
}
|
||||
|
||||
|
||||
function GenerateReportsListTable() {
|
||||
AjaxDo('?MyReports/List', null, GenerateReportsListRows, null, reqtype = 'POST');
|
||||
}
|
||||
|
||||
|
||||
GenerateReportsListTable();
|
||||
|
||||
|
||||
|
||||
</script>
|
||||
437
legacy/pages-html/slvl/all/bet-qr
Normal file
437
legacy/pages-html/slvl/all/bet-qr
Normal file
@@ -0,0 +1,437 @@
|
||||
|
||||
<br><br>
|
||||
|
||||
|
||||
<div class="card noprint" id="secondary-card">
|
||||
<div class="card-header ui-sortable-handle" style="cursor: move;display: none;">
|
||||
<h3 class="card-title" style=""></h3>
|
||||
<div class="card-tools">
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-body ">
|
||||
|
||||
<div class="row card-body">
|
||||
<div class="col-12"></div><br><br>
|
||||
<div class="col-12 mx-auto d-block text-center justify-content-center noprint" id="qrcode"></div>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="card noprint" id="secondary-card-betting">
|
||||
<div class="card-header ui-sortable-handle" style="cursor: move;display: none;">
|
||||
<h3 class="card-title" style=""></h3>
|
||||
<div class="card-tools">
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<div class="row card-body noprint">
|
||||
<div class="col mx-auto noprint" style="display:none;" id="">
|
||||
<button class="btn btn-primary btn-block" onclick="DownloadQRCodeNow()">SAVE</button>
|
||||
|
||||
</div>
|
||||
<div class="col mx-auto noprint" id="">
|
||||
<button class="btn btn-warning btn-block" onclick="printbtqr()">PRINT</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row card-body" style="display:none;">
|
||||
<div class="col mx-auto" id="">
|
||||
Date:
|
||||
</div>
|
||||
<div class="col mx-auto" id="">
|
||||
<select id="sched" class="form-control"></select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<center>
|
||||
<div id="qrcodeprinting" class="mainprint hideonbrowser"></div>
|
||||
</center>
|
||||
|
||||
|
||||
|
||||
<script>
|
||||
|
||||
function printbtqr(){
|
||||
window.print();
|
||||
|
||||
//printJS({ printable: "mainqrimg", type: "html",});
|
||||
|
||||
}
|
||||
|
||||
function OLDsavebtqr(){
|
||||
let b64 = $('.mainbtqr').attr('src');
|
||||
let base64Data = b64.split(',')[1];
|
||||
let decodedData = atob(base64Data);
|
||||
|
||||
let uint8Array = new Uint8Array(decodedData.length);
|
||||
for (let i = 0; i < decodedData.length; i++) {
|
||||
uint8Array[i] = decodedData.charCodeAt(i);
|
||||
}
|
||||
|
||||
const blob = new Blob([uint8Array], { type: "image/png" });
|
||||
const url = URL.createObjectURL(blob);
|
||||
|
||||
const link = document.createElement("a");
|
||||
link.href = url;
|
||||
link.download = "NewQ.png";
|
||||
link.click();
|
||||
|
||||
URL.revokeObjectURL(url);
|
||||
|
||||
}
|
||||
|
||||
function OLD2savebtqr() {
|
||||
let b64 = $('.mainbtqr').attr('src');
|
||||
let base64Data = b64.split(',')[1];
|
||||
let decodedData = atob(base64Data);
|
||||
|
||||
let uint8Array = new Uint8Array(decodedData.length);
|
||||
for (let i = 0; i < decodedData.length; i++) {
|
||||
uint8Array[i] = decodedData.charCodeAt(i);
|
||||
}
|
||||
|
||||
const blob = new Blob([uint8Array], { type: "image/png" });
|
||||
|
||||
// Check if the browser is Internet Explorer (MS Edge)
|
||||
if (navigator.msSaveOrOpenBlob) {
|
||||
navigator.msSaveOrOpenBlob(blob, 'NewQ.png');
|
||||
} else {
|
||||
const url = URL.createObjectURL(blob);
|
||||
|
||||
const link = document.createElement("a");
|
||||
link.href = url;
|
||||
link.download = "NewQ.png";
|
||||
|
||||
document.body.appendChild(link);
|
||||
link.click();
|
||||
document.body.removeChild(link);
|
||||
|
||||
URL.revokeObjectURL(url);
|
||||
}
|
||||
}
|
||||
|
||||
function savebtqr() {
|
||||
let b64 = $('.mainbtqr').attr('src');
|
||||
let base64Data = b64.split(',')[1];
|
||||
let decodedData = atob(base64Data);
|
||||
|
||||
let uint8Array = new
|
||||
|
||||
Uint8Array(decodedData.length);
|
||||
for (let i = 0; i < decodedData.length; i++) {
|
||||
uint8Array[i] = decodedData.charCodeAt(i);
|
||||
}
|
||||
|
||||
const blob = new Blob([uint8Array], { type: "image/png" });
|
||||
|
||||
// Cross-browser download approach:
|
||||
try {
|
||||
// Attempt saving via browser's native download manager:
|
||||
const url = URL.createObjectURL(blob);
|
||||
const link = document.createElement("a");
|
||||
link.href = url;
|
||||
link.download = "NewQRCode.png";
|
||||
document.body.appendChild(link);
|
||||
link.click();
|
||||
document.body.removeChild(link);
|
||||
URL.revokeObjectURL(url);
|
||||
} catch (error) {
|
||||
// Fallback for mobile browsers with limitations:
|
||||
const reader = new FileReader();
|
||||
reader.onload = (event) => {
|
||||
const base64Url = event.target.result;
|
||||
const img = document.createElement("img");
|
||||
img.src = base64Url;
|
||||
// Use a mobile-friendly method to display or share the image
|
||||
// (e.g., open a new window/tab, trigger native share functionality)
|
||||
};
|
||||
reader.readAsDataURL(blob);
|
||||
}
|
||||
}
|
||||
|
||||
function oldsaveQrCode() {
|
||||
// Get the base64 data
|
||||
let b64 = document.getElementById('mainqrimg').src;
|
||||
let base64Data = b64.split(',')[1];
|
||||
|
||||
// Create a Blob from base64 data
|
||||
const blob = new Blob([base64Data], { type: "image/png" });
|
||||
|
||||
// Create a link element
|
||||
const link = document.createElement("a");
|
||||
link.href = URL.createObjectURL(blob);
|
||||
link.download = "QrCode.png";
|
||||
|
||||
// Append the link to the body
|
||||
document.body.appendChild(link);
|
||||
|
||||
// Trigger a click on the link
|
||||
link.click();
|
||||
|
||||
// Remove the link from the body
|
||||
document.body.removeChild(link);
|
||||
|
||||
// Revoke the object URL
|
||||
URL.revokeObjectURL(link.href);
|
||||
}
|
||||
|
||||
|
||||
function saveQrCode2() {
|
||||
// Get the base64 data
|
||||
let b64 = document.getElementById('mainqrimg').src;
|
||||
|
||||
// Create a canvas element
|
||||
const canvas = document.createElement("canvas");
|
||||
const context = canvas.getContext("2d");
|
||||
|
||||
// Create an image element
|
||||
const image = new Image();
|
||||
image.onload = function () {
|
||||
// Set canvas dimensions based on image dimensions
|
||||
canvas.width = image.width;
|
||||
canvas.height = image.height;
|
||||
|
||||
// Draw the image onto the canvas
|
||||
context.drawImage(image, 0, 0);
|
||||
|
||||
// Convert canvas content to a data URL
|
||||
const dataUrl = canvas.toDataURL("image/png");
|
||||
|
||||
// Create a Blob from the data URL
|
||||
const blob = dataURLToBlob(dataUrl);
|
||||
|
||||
// Create a link element
|
||||
const link = document.createElement("a");
|
||||
link.href = URL.createObjectURL(blob);
|
||||
link.download = "QrCode.png";
|
||||
|
||||
// Append the link to the body
|
||||
document.body.appendChild(link);
|
||||
|
||||
// Trigger a click on the link
|
||||
link.click();
|
||||
|
||||
// Remove the link from the body
|
||||
document.body.removeChild(link);
|
||||
|
||||
// Revoke the object URL
|
||||
URL.revokeObjectURL(link.href);
|
||||
};
|
||||
|
||||
// Set the image source
|
||||
image.src = b64;
|
||||
}
|
||||
|
||||
|
||||
function oldsaveQrCode() {
|
||||
// Get the base64 data
|
||||
let b64 = document.getElementById('mainqrimg').src;
|
||||
let base64Data = b64.split(',')[1];
|
||||
|
||||
// Create a Blob from base64 data
|
||||
const blob = new Blob([base64Data], { type: "image/png" });
|
||||
|
||||
// Create a link element
|
||||
const link = document.createElement("a");
|
||||
link.href = URL.createObjectURL(blob);
|
||||
link.download = "QrCode.png";
|
||||
|
||||
// Append the link to the body
|
||||
document.body.appendChild(link);
|
||||
|
||||
// Trigger a click on the link
|
||||
link.click();
|
||||
|
||||
// Remove the link from the body
|
||||
document.body.removeChild(link);
|
||||
|
||||
// Revoke the object URL
|
||||
URL.revokeObjectURL(link.href);
|
||||
}
|
||||
|
||||
function saveQrCode3() {
|
||||
// Get the base64 data
|
||||
let b64 = document.getElementById('mainqrimg').src;
|
||||
const base64Content = b64.split(',')[1];
|
||||
const binaryContent = atob(base64Content);
|
||||
|
||||
const uint8Array = new Uint8Array(binaryContent.length);
|
||||
for (let i = 0; i < binaryContent.length; i++) {
|
||||
uint8Array[i] = binaryContent.charCodeAt(i);
|
||||
}
|
||||
|
||||
// Create a Blob
|
||||
const blob = new Blob([uint8Array], { type: 'image/png' });
|
||||
|
||||
// Create a download link
|
||||
const link = document.createElement('a');
|
||||
link.href = URL.createObjectURL(blob);
|
||||
link.download = 'QrCode.png';
|
||||
|
||||
// Append the link to the body
|
||||
document.body.appendChild(link);
|
||||
|
||||
// Trigger a click on the link
|
||||
link.click();
|
||||
|
||||
// Remove the link from the body
|
||||
document.body.removeChild(link);
|
||||
|
||||
// Revoke the object URL
|
||||
URL.revokeObjectURL(link.href);
|
||||
}
|
||||
|
||||
|
||||
function saveQrCode() {
|
||||
// Get the base64 data
|
||||
let b64 = document.getElementById('mainqrimg').src;
|
||||
let base64Data = b64.split(',')[1];
|
||||
|
||||
// Convert base64 to a Blob
|
||||
const byteCharacters = atob(base64Data);
|
||||
const byteNumbers = new Array(byteCharacters.length);
|
||||
for (let i = 0; i < byteCharacters.length; i++) {
|
||||
byteNumbers[i] = byteCharacters.charCodeAt(i);
|
||||
}
|
||||
const byteArray = new Uint8Array(byteNumbers);
|
||||
const blob = new Blob([byteArray], { type: 'image/png' });
|
||||
|
||||
// Use FileSaver.js to trigger the download
|
||||
saveAs(blob, 'QrCode.png');
|
||||
}
|
||||
|
||||
// Function to convert data URL to Blob
|
||||
function dataURLToBlob(dataUrl) {
|
||||
const parts = dataUrl.split(';base64,');
|
||||
const contentType = parts[0].split(':')[1];
|
||||
const raw = window.atob(parts[1]);
|
||||
const rawLength = raw.length;
|
||||
const uint8Array = new Uint8Array(new ArrayBuffer(rawLength));
|
||||
|
||||
for (let i = 0; i < rawLength; ++i) {
|
||||
uint8Array[i] = raw.charCodeAt(i);
|
||||
}
|
||||
|
||||
return new Blob([uint8Array], { type: contentType });
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
new QRCode(document.getElementById("qrcode"), "TAYTRSRC="+currenttarget,);
|
||||
|
||||
|
||||
new QRCode("qrcodeprinting", {
|
||||
text: "TAYTRSRC="+currenttarget,
|
||||
width: 1000,
|
||||
height: 1000,
|
||||
colorDark : "#000000",
|
||||
colorLight : "#ffffff",
|
||||
correctLevel : QRCode.CorrectLevel.H
|
||||
});
|
||||
|
||||
// new QRCode(document.getElementById("qrcode"), "TAYTRSRC="+currenttarget);
|
||||
$("#qrcode").find("img").addClass("img-fluid mx-auto d-block noprint");
|
||||
|
||||
$("#qrcode").find("img").addClass("mainbtqr");
|
||||
// $("#qrcode").find("img").prepend('<br>');
|
||||
//$("#qrcode").find('canvas').attr('width')=screen.width-40+'px';
|
||||
//$("#qrcode").find("img").attr("id", "mainqrimg");
|
||||
|
||||
$("#mainqrimg").attr("width", screen.width-40+'px');
|
||||
$("#qrcodeprinting").find("img").addClass("mainprint");
|
||||
$("#qrcodeprinting").find("img").attr("id", "mainqrimg");
|
||||
// $("#qrcodeprinting").find("img").hide();
|
||||
|
||||
|
||||
console.log("QR Download Button:", $("#qrdownloadbutton").length);
|
||||
console.log("Main QR Image:", $("#mainqrimg").attr("src"));
|
||||
$("#qrdownloadbutton").attr("href", $("#mainqrimg").attr("src"));
|
||||
|
||||
|
||||
$("#mainqrimg").on("load", function() {
|
||||
|
||||
//$("#qrdownloadbutton").attr("href", $("#mainqrimg").attr("src"));
|
||||
|
||||
});
|
||||
|
||||
|
||||
|
||||
$("#qrdownloadbutton").on("click", function() {
|
||||
downloadQRCode();
|
||||
});
|
||||
|
||||
function downloadQRCode() {
|
||||
const base64Data = $("#mainqrimg").attr("src").split(",")[1];
|
||||
const decodedData = atob(base64Data);
|
||||
const uint8Array = new Uint8Array(decodedData.length);
|
||||
|
||||
for (let i = 0; i < decodedData.length; i++) {
|
||||
uint8Array[i] = decodedData.charCodeAt(i);
|
||||
}
|
||||
|
||||
const blob = new Blob([uint8Array], { type: "image/png" });
|
||||
const url = URL.createObjectURL(blob);
|
||||
|
||||
const link = document.createElement("a");
|
||||
link.href = url;
|
||||
link.download = "NewQr.png";
|
||||
link.click();
|
||||
|
||||
URL.revokeObjectURL(url);
|
||||
}
|
||||
|
||||
|
||||
$(document).ready(function() {
|
||||
|
||||
|
||||
|
||||
$('#qrcode').find('canvas').attr('id', 'qrcode-canvas');
|
||||
$('#qrcode').find('img').attr('id', 'qrcode-image');
|
||||
|
||||
});
|
||||
|
||||
function DownloadQRCodeNow(){
|
||||
let img = document.getElementById('qrcode-image');
|
||||
let canvas = document.getElementById('qrcode-canvas');
|
||||
canvas.width = img.clientWidth;
|
||||
canvas.height = img.clientHeight;
|
||||
|
||||
let context = canvas.getContext('2d');
|
||||
|
||||
context.drawImage(img,0,0)
|
||||
|
||||
canvas.toBlob(function(blob){
|
||||
let link = document.createElement('a');
|
||||
link.download = 'qrcode.png';
|
||||
link.href = URL.createObjectURL(blob);
|
||||
link.click();
|
||||
|
||||
URL.revokeObjectURL(link.href);
|
||||
|
||||
},'image/png');
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</script>
|
||||
|
||||
<style>
|
||||
|
||||
.hideonbrowser {
|
||||
display: none;
|
||||
}
|
||||
|
||||
</style>
|
||||
131
legacy/pages-html/slvl/all/bets_history
Normal file
131
legacy/pages-html/slvl/all/bets_history
Normal file
@@ -0,0 +1,131 @@
|
||||
|
||||
|
||||
<br><br><br><br>
|
||||
<table class="" id="bets_history_table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Date</th>
|
||||
<th>
|
||||
<center>Type</center>
|
||||
</th>
|
||||
<th>Draw</th>
|
||||
<th>Numbers</th>
|
||||
<th>Amount</th>
|
||||
<th></th>
|
||||
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
<br><br><br>
|
||||
|
||||
<script>
|
||||
|
||||
document.body.style.zoom = 1;
|
||||
|
||||
|
||||
function GenerateBTRow(Date, Type, DrawTime, Num,Amount, Hashkey, Stat) {
|
||||
|
||||
//const actionbutton =`<button class="btn btn-warning" onclick="gotoPage('bet_qr','${Hashkey}')">View<br>QR</button>`;
|
||||
const actionbutton = `<img src="assets/qrcode.svg" onclick="gotoPage('bet_qr','${Hashkey}')">`;
|
||||
return `<tr>
|
||||
<td style="">${Date}</td>
|
||||
<td style=""><center>${Type}</center></td>
|
||||
<td style="">${DrawTime}</td>
|
||||
<td style="padding-right: 0;">${Num}</td>
|
||||
<td style="padding-right: 0;">${Amount}</td>
|
||||
<td style=""><center>${actionbutton}</center></td>` +
|
||||
//`<td style="padding: 0px;">${Stat}</td>`+
|
||||
`</tr>`;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
async function GenerateBTRows(responsearray) {
|
||||
|
||||
let newhtmltable = '';
|
||||
|
||||
for (let i = 0; i < responsearray.length; i++) {
|
||||
const currentgametype = responsearray[i]['bet_type'];
|
||||
let currentgametypename = '';
|
||||
|
||||
if (Object.keys(bet_types).length === 0) {
|
||||
await queryBetTypes();
|
||||
|
||||
}
|
||||
|
||||
|
||||
currentgametypename = bet_types[currentgametype];
|
||||
if (currentgametypename === undefined){continue;}
|
||||
currentgametypename = currentgametypename.replace(' ', "<br>");
|
||||
currentgametypename = currentgametypename.replace(' ', "<br>");
|
||||
let cr_bet_date = responsearray[i]['bet_date'];
|
||||
let cr_bet_schedule = responsearray[i]['bet_schedule'];
|
||||
let current_bet_number = responsearray[i]['bet_number'];
|
||||
let current_bet_amount = responsearray[i]['amount'];
|
||||
if (current_bet_number.endsWith("-")) { current_bet_number = current_bet_number.slice(0, -1); }
|
||||
|
||||
|
||||
|
||||
cr_bet_date = cr_bet_date.replace(' ', "<br>");
|
||||
cr_bet_schedule = cr_bet_schedule.replace(' ', "<br>");
|
||||
|
||||
|
||||
|
||||
newhtmltable += GenerateBTRow(
|
||||
cr_bet_date,
|
||||
currentgametypename,
|
||||
cr_bet_schedule,
|
||||
current_bet_number,
|
||||
current_bet_amount,
|
||||
responsearray[i]['transactionID'],
|
||||
''
|
||||
);
|
||||
}
|
||||
|
||||
$("#bets_history_table").find("tbody").html(newhtmltable);
|
||||
let bethistorytable = $("#bets_history_table").DataTable({
|
||||
order: [[0, 'desc']],
|
||||
pageLength: 5,
|
||||
lengthMenu: [[5], [5]]
|
||||
});
|
||||
$("#bets_history_table_length").hide();
|
||||
// new DataTable('#bets_history_table');
|
||||
|
||||
bethistorytable.on('click', 'tbody tr', function () {
|
||||
let data = bethistorytable.row(this).data();
|
||||
let targettranshash = data[5];
|
||||
$(targettranshash).find('img').trigger('click');
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
function loaddashboardcard(response){
|
||||
total_balance = response.total_balance;
|
||||
$( "#total-balance" ).html(response.total_balance);
|
||||
// $( "#pending-credit" ).html(data.total_credit);
|
||||
$( "#phone-number" ).html(response.number);
|
||||
}
|
||||
|
||||
|
||||
function loaduserdatadashboard(){AjaxDo('?userdatadashboard',null,loaddashboardcard, null,reqtype='GET');}
|
||||
|
||||
function GenerateBTTable() {
|
||||
// if (!currenttarget){return false;}
|
||||
const dataRight = { user: currenttarget };
|
||||
AjaxDo('?user/bet/history', dataRight, GenerateBTRows, null, reqtype = 'POST');
|
||||
}
|
||||
|
||||
|
||||
GenerateBTTable();
|
||||
|
||||
$(window).on('load', function () {
|
||||
//$('body').css('transform', 'scale(0.8)');
|
||||
});
|
||||
//$('html, body').css('overflow', 'hidden');
|
||||
|
||||
</script>
|
||||
96
legacy/pages-html/slvl/all/lotterysched
Normal file
96
legacy/pages-html/slvl/all/lotterysched
Normal file
@@ -0,0 +1,96 @@
|
||||
<div class="card-body card-info" id="main-card-body" style="">
|
||||
<div class="row">
|
||||
<div class="col-md-18">
|
||||
Welcome User
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<br>
|
||||
<div class="row card-info">
|
||||
<div class="col-md-18 card bg-gray text-xl border-rounded" style="width:100%;height:20%;">
|
||||
Schedule are as Follows:
|
||||
<br><br>
|
||||
<b>3D</b> Everyday at 2PM, 5PM and 9PM
|
||||
<br><br>
|
||||
<b>4D</b> Every Monday, Wednesday, Friday at 9PM
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</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">Betting Instructions</h4>
|
||||
</div>
|
||||
<div class="col">
|
||||
<h4 class="card-title" id=""></h4>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="card-tools">
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-body " id="credit-amount-request-form" style="">
|
||||
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
You can place your bet 30 mins before the draw.
|
||||
</div>
|
||||
<br> <br>
|
||||
<div class="col-12">
|
||||
For example, you wanted to bet Today 2PM, bets before 1:30PM are allowed.
|
||||
</div>
|
||||
<br> <br>
|
||||
<div class="col-12">
|
||||
You can place your bet 3 days in advance.
|
||||
</div>
|
||||
<br> <br>
|
||||
<div class="col-12">
|
||||
Keep the QR for scanning by the coordinator for claiming prizes.
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<script>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
$(document).ready(function() {
|
||||
var currenttarget=0;
|
||||
|
||||
// CheckPendingRequestForUI();
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
</script>
|
||||
|
||||
|
||||
141
legacy/pages-html/slvl/all/template
Normal file
141
legacy/pages-html/slvl/all/template
Normal file
@@ -0,0 +1,141 @@
|
||||
<br><br>
|
||||
<div id="PageContainer">
|
||||
</div>
|
||||
|
||||
<script src="/lib/referrenceslib.js"></script>
|
||||
<script> $$ = {};
|
||||
$$ = {};
|
||||
$$.UI = {};
|
||||
$$.UI.Table = {};
|
||||
$$.UI.Table.CreateTable = function (id, theadinnerhtml, bodyinnerhtml) { return CreateTable(id, theadinnerhtml, bodyinnerhtml); };
|
||||
$$.UI.Table.GenerateTheadFromArraySimple = function (array) { return GenerateTheadFromArraySimple(array); };
|
||||
$$.UI.Table.GenerateTableRowFromArraySimple = function (array) { return GenerateTableRowFromArraySimple(array); };
|
||||
$$.UI.ResetBrowserAndCache = function () { return ResetBrowserAndCache(); };
|
||||
$$.UI.formatCurrency = function (number, withdecimal = true) { return formatCurrency(number, withdecimal); };
|
||||
$$.UI.getDateInGMT8 = function () { return getDateInGMT8(); };
|
||||
$$.UI.RunFunctiononMutation = function (targetidToMonitor, callbackfunction) { return RunFunctiononMutation(targetidToMonitor, callbackfunction); };
|
||||
$$.UI.Element = {};
|
||||
$$.UI.Element.appendtobody = function (string) { return appendtobody(string); };
|
||||
$$.UI.Element.Exists = function (ElementIDtext) { ElementExists(ElementIDtext); };
|
||||
$$.UI.Element.RemovebyID = function (idstring) { return removeelementbyID(idstring); };
|
||||
$$.UI.Element.DeleteById = function (id) { return DeleteElementById(id); }
|
||||
$$.UI.Element.getHTML = function (idetext) { return getElementhtml(idtext); };
|
||||
$$.UI.Element.setHTML = function (idetext, html) { return setElementhtml(idtext, html); };
|
||||
$$.UI.Element.getValue = function (idetext) { return getElementvalue(idtext); };
|
||||
$$.UI.Element.setValue = function (idetext,) { return setElementvalue(idtext, value); };
|
||||
$$.UI.Validate = {};
|
||||
$$.UI.Validate.isValidEmail = function (email) { return isValidEmail(email); };
|
||||
$$.UI.Validate.hasValidMobileFormat = function (usernumber) { return hasValidMobileFormat(usernumber); };
|
||||
$$.UI.Modal = {};
|
||||
$$.UI.Modal.Create = function (modalid, modaltitle, modalbody, modalfooter, modalfooterclose = true, topclosebutton = true, modalbodyclass = 'modal-body', modalheaderclass = 'modal-header') { return createmodal(modalid, modaltitle, modalbody, modalfooter, modalfooterclose, topclosebutton, modalbodyclass, modalheaderclass); };
|
||||
$$.UI.Modal.Show = function (idtxt) { return modalshow(idtxt); };
|
||||
$$.UI.Modal.Hide = function (idtxt) { return modalhide(); };
|
||||
$$.UI.Modal.CreateAndShow = function (modalid, modaltitle, modalbody, modalfooter = '', modalfooterclose = true, topclosebutton = true, modalbodyclass = 'modal-body', modalheaderclass = 'modal-header') { return CreateAndShowModal(modalid, modaltitle, modalbody, modalfooter, modalfooterclose, topclosebutton, modalbodyclass, modalheaderclass); };
|
||||
$$.UI.Modal.ModalQuickDismiss = function (modaltitle, modalbody, modalid = '', modaltohide = '', functiontodo = '', conditiontrue = true) { return ModalQuickDismiss(modaltitle, modalbody, modalid, modaltohide, functiontodo, conditiontrue) };
|
||||
$$.UI.Modal.ModalContinueCancel = function (modalid, modaltitle, modalbody, continuebuttononclick, cancelbuttontext = 'Cancel', continuebuttontext = 'Continue', continuebuttoncss = 'btn btn-danger', cancelbuttoncss = 'btn btn-warning') { return ModalContinueCancel(modalid, modaltitle, modalbody, continuebuttononclick, cancelbuttontext, continuebuttontext, continuebuttoncss, cancelbuttoncss); };
|
||||
$$.UI.Modal.hide = function (modalid) { return hidemodal(modalid); };
|
||||
$$.UI.Modal.show = function (modalid) { return showmodal(modalid); };
|
||||
$$.UI.col = function (content = '', additionalclass = '') { return col(content, additionalclass); };
|
||||
$$.UI.row = function (content = '', additionalclass = '', hidden = false, style = '') { return row(content, additionalclass, hidden, style); };
|
||||
$$.UI.dualcolrow = function (colcontent1, colcontent2, rowclass = '', hidden = false, style = '') { return dualcolrow(colcontent1, colcontent2, rowclass, hidden, style); };
|
||||
$$.UI.Button = {};
|
||||
$$.UI.Button.Default = function (content, value = '', onclick = '', idtext = '', setclass = '', addtionaldata = '') { return button(content, value, onclick, idtext, setclass, addtionaldata); };
|
||||
$$.UI.Button.Warning = function (content, value = '', onclick = '', block = '', idtext = '', addclass = '', addtionaldata = '') { return buttonwarning(content, value, onclick, block, idtext, addclass, addtionaldata); };
|
||||
$$.UI.Button.Danger = function (content, value = '', onclick = '', block = '', idtext = '', addclass = '', addtionaldata = '') { return buttondanger(content, value, onclick, block, idtext, addclass, addtionaldata); };
|
||||
$$.UI.Button.Primary = function (content, value = '', onclick = '', block = '', idtext = '', addclass = '', addtionaldata = '') { return buttonprimary(content, value, onclick, block, idtext, addclass, addtionaldata); };
|
||||
$$.UI.Button.HomeMenuButtons = function (buttonicon, buttonText, buttonGo, buttonVariabletoPass = '', iconwidth = '', iconheight = '', buttonstyle = '', buttononclick = '', divclass = '', divid = '', buttonid = '', textclass = '') { return HomeMenuButtons(buttonicon, buttonText, buttonGo, buttonVariabletoPass, iconwidth, iconheight, buttonstyle, buttononclick, divclass, divid, buttonid, textclass); };
|
||||
$$.UI.Input = {};
|
||||
$$.UI.Input.textInput = function (idtext = '', setclass = '', required = '', placeholder = '', value = '') { return textinput(idtext, setclass, required, placeholder, value); };
|
||||
$$.UI.Input.textFormControl = function (idtext = '', addclass = '', required = '', placeholder = '', value = '') { return textformcontrol(idtext, addclass, required, placeholder, value); };
|
||||
$$.UI.Card = {};
|
||||
$$.UI.Card.Create = function (cardtitle = '', cardid = '', cardtools = '', cardbodyid = '', cardbodytext = '', cardbodyclassadd = '', maincardstyle = '', titlecardhide = false) { return createCard(cardtitle, cardid, cardtools, cardbodyid, cardbodytext, cardbodyclassadd, maincardstyle, titlecardhide); };
|
||||
$$.UI.Card.Simple = function (title = '', text = '', id = '') { return CreateCardSimple(title, text, id); };
|
||||
$$.UIalt = {};
|
||||
$$.UIalt.hrefonclickButtonGO = function (pagename, pagedatastring = '') { return hrefonclickButtonGO(pagename, pagedatastring); };
|
||||
$$.UIalt.generateHTMLfromarray = function (prepend, append, array, func) { return generateHTMLfromarray(prepend, append, array, func); };
|
||||
$$.UIalt.imgiconuserdefault = function (imgsrc, imgwidth = '', imgheight = '', id = '') { return imgiconuserdefault(imgsrc, imgwidth, imgheight, id); };
|
||||
$$.UIalt.UICardStats = {};
|
||||
$$.UIalt.UICardStats.UICardStatsDetails = function (Title = '', number = 0, Unit = '', leftORright = 'left', numberid = '') { return UICardStatsDetails(Title, number, Unit, leftORright, numberid); };
|
||||
$$.UIalt.UICardStats.UIStatsDetailsArray = function (statsarray) { return UIStatsDetailsArray(statsarray); };
|
||||
$$.UIalt.BalanceCard = {};
|
||||
$$.UIalt.BalanceCard.UIBalance_WrapperfromArray = function (statsarray) { return UIBalance_WrapperfromArray(statsarray); };
|
||||
$$.UIalt.BalanceCard.UIBalance_Wrapper_WalletFooter_Item = function (maintitle = '', onclickstring = '', imgsrc = '', href = '', subtitleline1 = '', subtitleline2 = '', subtitleline3 = '', subtitleline4 = '', imgwidth = '', imgheight = '') { return UIBalance_Wrapper_WalletFooter_Item(maintitle, onclickstring, imgsrc, href, subtitleline1, subtitleline2, subtitleline3, subtitleline4, imgwidth, imgheight); };
|
||||
$$.UIalt.BalanceCard.UIBalance_Wrapper_WalletFooter_Item_ButtonGO = function (maintitle, pagename, pagestring = '', iconclass = '', subtitleline1 = '', subtitleline2 = '', subtitleline3 = '', subtitleline4 = '') { return UIBalance_Wrapper_WalletFooter_Item_ButtonGO(maintitle, pagename, pagestring, iconclass, subtitleline1, subtitleline2, subtitleline3, subtitleline4); };
|
||||
$$.UIalt.BalanceCard.UIBalance_Wrapper_WalletFooter_ARRAY = function (balancewrapper_item_array) { return UIBalance_Wrapper_WalletFooter_ARRAY(balancewrapper_item_array); };
|
||||
$$.UIalt.BalanceCard.UIcreateBalanceBoxfromArray = function (statsarray, balancewrapper_item_array, style = 'border: solid 3px #000d88;') { return UIcreateBalanceBoxfromArray(statsarray, balancewrapper_item_array, style); };
|
||||
$$.UIalt.Services = {};
|
||||
$$.UIalt.Services.Button = function (imgiconsrc, title = '', onclick = '', href = '', bgcolor8 = false) { return UIServices_Button(imgiconsrc, title, onclick, href, bgcolor8); };
|
||||
$$.UIalt.Services.Button_GOTOPAGE = function (imgiconsrc, title, pagename, pagedatastring = '') { return UIServices_Button_GOTOPAGE(imgiconsrc, title, pagename, pagedatastring); };
|
||||
$$.UIalt.Services.FullDIV_GOTOPAGE_Array = function (title, viewallhref = '', viewallonclick = '', viewalltext = '', services_button_array) { return UIServices_FullDIV_GOTOPAGE_Array(title, viewallhref, viewallonclick, viewalltext, services_button_array); };
|
||||
$$.UIalt.Services.FullDIV_ONCLICK_Array = function (title, viewallhref = '', viewallonclick = '', viewalltext = '', services_button_array) { return UIServices_FullDIV_ONCLICK_Array(title, viewallhref, viewallonclick, viewalltext, services_button_array); };
|
||||
$$.UIalt.Sidetext = {};
|
||||
$$.UIalt.Sidetext.UISideText_DualColumnButton = function (text, pagename, pagedatastring = '', imgsrc = '', imgwidth = '', imgheight = '') { return UISideText_DualColumnButton(text, pagename, pagedatastring, imgsrc, imgwidth, imgheight); };
|
||||
$$.UIalt.Sidetext.UISideText_DualColumnButton_Array = function (sidetext_button_dualcolumn_array) { return UISideText_DualColumnButton_Array(sidetext_button_dualcolumn_array); };
|
||||
$$.UIalt.UICardSimple = function (title, text = '', id = '') { return UICardSimple(title, text, id); };
|
||||
$$.UIalt.RecentSearchBar = {};
|
||||
$$.UIalt.RecentSearchBar.SearchBar = function (searchplaceholdertext, classtosearch, id, imgsrclefticon = '', imgsrcrighticon = '', imgwidth = '', imgheight = '') { return UIRecentSearchBar(searchplaceholdertext, classtosearch, id, imgsrclefticon, imgsrcrighticon, imgwidth, imgheight); };
|
||||
$$.UIalt.RecentSearchBar.Searchable_Button_GO = function (title, subtitle, rightsidetext, classforsearch, pagename, pagedatastring = '', imgsrc, imgwidth = '', imgheight = '') { return UIRecentSearchable_Button_GO(title, subtitle, rightsidetext, classforsearch, pagename, pagedatastring, imgsrc, imgwidth, imgheight); };
|
||||
$$.UIalt.RecentSearchBar.Searchable_Button_GO_ARRAY = function (title, recentssearchablebuttonarray, viewallpagetarget, viewallpagedata = '', viewalltext = '') { return UIRecentSearchable_Button_GO_ARRAY(title, recentssearchablebuttonarray, viewallpagetarget, viewallpagedata, viewalltext); };
|
||||
$$.UIalt.UIListArrowButton_GO = function (title, subtitle, pagename, pagedatastring = '', imgsrc, imgwidth = '', imgheight = '') { return UIListArrowButton_GO(title, subtitle, pagename, pagedatastring, imgsrc, imgwidth, imgheight); };
|
||||
$$.UIalt.RecentSearchBar.SearchBox_with_BUTTONS_FULL = function (title, recentssearchablebuttonarray, UIListArrowButtonGOARRAY = '', viewallpagetarget, viewallpagedata = '', viewalltext = '', classtosearch = '', searchid = '', searchplaceholdertext = '', searchlefticon = '', searchrighticon = '', imgwidth = '', imgheight = '') { return UISearchBox_with_BUTTONS_FULL(title, recentssearchablebuttonarray, UIListArrowButtonGOARRAY, viewallpagetarget, viewallpagedata, viewalltext, classtosearch, searchid, searchplaceholdertext, searchlefticon, searchrighticon, imgwidth, imgheight); };
|
||||
$$.UIalt.Input = {};
|
||||
$$.UIalt.Input.InputGroupCore = function (innerhtml = '', label = '', inputgroupid = '') { return UIinputgroupcore(innerhtml, label, inputgroupid); };
|
||||
$$.UIalt.Input.InputGroup = function (placeholder, type, id, label = '', classinput = '', spanclass = '', imginsteadofspan = '', required = false, textvalue = '') { return UIInputGroup(placeholder, type, id, label, classinput, spanclass, imginsteadofspan, required, textvalue); };
|
||||
$$.UIalt.Input.InputGroupSelect = function (id = '', label = '', optionsarray = '', spanclass = '', imginsteadofspan = '',selectedvalue='') { return UIInputGroupSelect(id, label, optionsarray, spanclass, imginsteadofspan,selectedvalue); };
|
||||
$$.UIalt.Input.InputGroupDatePicker = function () { return UIInputGroupDatePicker(); };
|
||||
$$.UIalt.Input.ArraytoOptionforSelect = function (array,selectedvalue='') { return UIArraytoOptionforSelect(array,selectedvalue); };
|
||||
$$.UIalt.Input.ReplaceCurrentOptionsSelect = function (selectid, optionsarray,selectedvalue='') { return UIReplaceCurrentOptionsSelect(selectid, optionsarray,selectedvalue); };
|
||||
$$.UIalt.Input.InputGroupButton = function (buttontext, buttonclass = '', buttonid = '', onclick = '', buttonstyle = '') { return UIInputGroupButton(buttontext, buttonclass, buttonid, onclick, buttonstyle); };
|
||||
$$.UIalt.UISetDarkMode = function () { return UISetDarkMode(); };
|
||||
$$.UIalt.UIUpdateBodyHTML = function (html = '') { return UIUpdateBodyHTML(html); };
|
||||
$$.UIalt.changeTopbarTitle = function (title) { return changeTopbarTitle(title); };
|
||||
$$.StatusIntToString =function(Status){return InttoStrDetailsFuncs.Status(Status);};
|
||||
</script>
|
||||
<script>
|
||||
|
||||
|
||||
LoadDataPageFunc = {};
|
||||
LoadDataPageFunc.PageTitle = 'New Page';
|
||||
|
||||
LoadDataPageFunc.ids = {};
|
||||
LoadDataPageFunc.ids.PageContainer = 'PageContainer';
|
||||
|
||||
|
||||
|
||||
|
||||
LoadDataPageFunc.Initialize = function () {
|
||||
let request = new RequestData(true);
|
||||
request
|
||||
.url('/ViewLead/Details/data')
|
||||
.type('POST')
|
||||
.fromVarCache(true)
|
||||
.data({ target: currenttarget })
|
||||
.success((response) => {
|
||||
// console.log(response);
|
||||
LoadDataPageFunc.ViewLeadCurrentDetails = response.Details;
|
||||
$('#' + LoadDataPageFunc.ids.ViewLeadContainer).html(LoadDataPageFunc.LeadDetailsCard(response.Details));
|
||||
LoadDataPageFunc.Logs.LogRowHtmlPage();
|
||||
})
|
||||
.error((err) => {
|
||||
ModalQuickDismiss('Error', 'Unable to Load<br>' + errordesc);
|
||||
})
|
||||
.go();
|
||||
};
|
||||
|
||||
LoadDataPageFunc.main = function () {
|
||||
|
||||
changeTopbarTitle(LoadDataPageFunc.PageTitle);
|
||||
LoadDataPageFunc.Initialize();
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
$(document).ready(function () {
|
||||
LoadDataPageFunc.main();
|
||||
|
||||
});
|
||||
|
||||
|
||||
</script>
|
||||
251
legacy/pages-html/slvl/all/templates/List
Normal file
251
legacy/pages-html/slvl/all/templates/List
Normal file
@@ -0,0 +1,251 @@
|
||||
<style>
|
||||
.ListRowCard {
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
</style>
|
||||
|
||||
<div id='ListMainContainer'>
|
||||
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<script>
|
||||
|
||||
|
||||
|
||||
|
||||
LoadDataPageFunc = {};
|
||||
|
||||
|
||||
LoadDataPageFunc.InitializeDynamicVariables = function () {
|
||||
LoadDataPageFunc.URLs.QueryListData = '/ListLeads/List/data';
|
||||
|
||||
LoadDataPageFunc.Settings.ViewDetailsOnclick = function (data) {
|
||||
return `ButtonGo('ViewLeadDetails', '${data}')`;
|
||||
};
|
||||
|
||||
LoadDataPageFunc.Settings.CurrentTargetRequired = false;
|
||||
|
||||
LoadDataPageFunc.Settings.DefaultDatatoSend = null;
|
||||
|
||||
LoadDataPageFunc.NewRow = function (objectdata, rownum) {
|
||||
|
||||
let rowhtml = [];
|
||||
Status = InttoStrDetailsFuncs.Status(objectdata.Status);
|
||||
const modified = objectdata.modified;
|
||||
const created = formatDateTimetoReadable(objectdata.created);
|
||||
const TargetViewingDate = formatDateTimetoReadable(objectdata.TargetViewingDate);
|
||||
const hashkey = objectdata.hashkey;
|
||||
let photourl = objectdata.photourl;
|
||||
if (photourl) {
|
||||
rows.push('<div class="row">');
|
||||
rows.push('<div class="col"><center><img src="' + photourl + '" style="width:' + imgwidth + '; height:' + imgheight + ';"></center></div>');
|
||||
rows.push('<div class="col">');
|
||||
}
|
||||
|
||||
if (modified !== false) {
|
||||
rowhtml.push(dualcolrow('Last Activity', modified, rowclass = ''));
|
||||
}
|
||||
rowhtml.push(dualcolrow('Status', Status, rowclass = ''));
|
||||
if (TargetViewingDate !== false) {
|
||||
rowhtml.push(dualcolrow('Target Viewing Date', TargetViewingDate, rowclass = ''));
|
||||
}
|
||||
|
||||
rowhtml.push('<div id="' + LoadDataPageFunc.ids.HashKeyContainer + '-' + rownum + '" style="display:none;">' + hashkey + '</div>');
|
||||
rowhtml.push(row(col('<br>' + buttonprimary('View', '', LoadDataPageFunc.Settings.ViewDetailsOnclick(hashkey), '-12', 'ListCardGoRow-' + rownum))));
|
||||
let FinalBody = rowhtml.join('');
|
||||
|
||||
return createCard(objectdata.fullname, cardid = 'ListRowCard-' + rownum, created, cardbodyid = '', FinalBody, cardbodyclassadd = 'ListCardRow','','ListRowCard');
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
LoadDataPageFunc.Settings.SortArray = function (arr) {
|
||||
return arr.sort((a, b) => new Date(b.created) - new Date(a.created));
|
||||
};
|
||||
};
|
||||
|
||||
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.SearchInput = 'List_Search';
|
||||
LoadDataPageFunc.ids.ListContainer = 'ListContainer';
|
||||
LoadDataPageFunc.ids.HashKeyContainer = 'ListRowCardHash';
|
||||
LoadDataPageFunc.ids.MainCardBody = 'MAINCARDBODY_LIST';
|
||||
|
||||
LoadDataPageFunc.URLs = {};
|
||||
LoadDataPageFunc.URLs.QueryListData = '/ListLeads/List/data';
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
$$$ = {};
|
||||
$$$.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.NewRow = function (DetailsObject, rownum) {
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
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.List;
|
||||
//LeadsList.reverse();
|
||||
|
||||
|
||||
List = LoadDataPageFunc.Settings.SortArray(List);
|
||||
|
||||
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);
|
||||
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 () {
|
||||
if (LoadDataPageFunc.Settings.CurrentTargetRequired && (!currenttarget || currenttarget === '0')) {
|
||||
$$$.UpdateMainContainer('<center>No Target<br><br>' + buttonprimary('View All Leads', '', "ButtonGo('ListLeads', '')") +
|
||||
'<br><br>' + buttonprimary('Home', '', "ButtonGo('Home', '')") + '</center>'); return false;
|
||||
}
|
||||
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('Leads', FinalInnerHTML, LoadDataPageFunc.ids.MainCardBody);
|
||||
$$$.UpdateMainContainer(MainCard);
|
||||
return true;
|
||||
|
||||
};
|
||||
|
||||
$(document).ready(function () {
|
||||
LoadDataPageFunc.InitializeDynamicVariables();
|
||||
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>
|
||||
0
legacy/pages-html/slvl/all/templates/New
Normal file
0
legacy/pages-html/slvl/all/templates/New
Normal file
0
legacy/pages-html/slvl/all/templates/View
Normal file
0
legacy/pages-html/slvl/all/templates/View
Normal file
19
legacy/pages-html/slvl/all/tsconfig.json
Normal file
19
legacy/pages-html/slvl/all/tsconfig.json
Normal file
@@ -0,0 +1,19 @@
|
||||
{
|
||||
|
||||
"compilerOptions": {
|
||||
|
||||
"target":"ES6",
|
||||
"module":"ES6",
|
||||
"allowJs": true,
|
||||
"checkJs":false,
|
||||
"baseUrl": ".",
|
||||
"paths": {
|
||||
"*":["*"]
|
||||
}
|
||||
},
|
||||
|
||||
"include": ["lib.js","synclib.js","UIAlt.js",
|
||||
"libEXT/*.js"]
|
||||
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user