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>
|
||||
Reference in New Issue
Block a user