initial: bootstrap from BukidBountyApp base

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

View File

@@ -0,0 +1,3 @@
# Deny access to this directory and its contents
Order Allow,Deny
Deny from all

View File

@@ -0,0 +1,319 @@
<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="${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'; }
photoblob = fileBlobURLList[imgurl] || false;
if (photoblob) {
return photoblob;
}
if (imgurl.match(/blob/)) {
return 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);
LoadDataPageFunc.CardResultInterSectionPreloadDetails();
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>

View File

View File

@@ -0,0 +1,279 @@
<html>
<head>
<title>
Amaia Villas
</title>
<link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.3/css/all.min.css" rel="stylesheet"/>
<link href="https://fonts.googleapis.com/css2?family=Roboto:wght@400;700&amp;display=swap" rel="stylesheet"/>
<style>
body {
font-family: 'Roboto', sans-serif;
margin: 0;
padding: 0;
box-sizing: border-box;
}
.header {
position: relative;
background: url('https://placehold.co/1920x1080') no-repeat center center/cover;
height: 100vh;
color: white;
}
.header .overlay {
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
background: rgba(0, 0, 0, 0.5);
}
.header .content {
position: relative;
z-index: 2;
padding: 20px;
}
.header .logo {
display: flex;
align-items: center;
padding: 20px;
}
.header .logo img {
height: 50px;
margin-right: 10px;
}
.header .nav {
display: flex;
justify-content: flex-end;
padding: 20px;
}
.header .nav a {
color: white;
margin-left: 20px;
text-decoration: none;
font-weight: bold;
}
.header .main-content {
display: flex;
justify-content: space-between;
align-items: center;
padding: 20px;
}
.header .main-content .info {
max-width: 50%;
}
.header .main-content .info h1 {
font-size: 48px;
margin: 0;
}
.header .main-content .info p {
font-size: 18px;
margin: 10px 0;
}
.header .main-content .info .price {
font-size: 24px;
font-weight: bold;
margin: 10px 0;
}
.header .main-content .info .btn {
background: #FFC107;
color: black;
padding: 10px 20px;
text-decoration: none;
font-weight: bold;
border-radius: 5px;
}
.header .main-content .form {
background: white;
padding: 20px;
border-radius: 5px;
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
}
.header .main-content .form input,
.header .main-content .form textarea,
.header .main-content .form select {
width: 100%;
padding: 10px;
margin: 10px 0;
border: 1px solid #ccc;
border-radius: 5px;
}
.header .main-content .form .btn {
background: #FFC107;
color: black;
padding: 10px 20px;
text-decoration: none;
font-weight: bold;
border-radius: 5px;
display: block;
text-align: center;
}
.gallery {
display: flex;
justify-content: center;
padding: 20px;
background: white;
}
.gallery img {
width: 150px;
height: 100px;
margin: 0 10px;
border-radius: 5px;
}
.property-details {
text-align: center;
padding: 20px;
background: #f8f8f8;
}
.property-details h2 {
font-size: 24px;
margin: 0;
}
.property-details .details {
display: flex;
justify-content: center;
padding: 20px;
}
.property-details .details .detail {
margin: 0 20px;
text-align: center;
}
.property-details .details .detail i {
font-size: 24px;
margin-bottom: 10px;
}
.property-details .details .detail p {
margin: 5px 0;
}
</style>
</head>
<body>
<div class="header">
<img class="overlay" scr="https://storage.googleapis.com/a1aa/image/lDf07rzUSwzXTaDmVv44QqId7CxPQGvecp6B3wHgilTsxokTA.jpg"/>
<div class="content">
<div class="logo">
<img height="50" id="websitelogo" src="https://storage.googleapis.com/a1aa/image/lDf07rzUSwzXTaDmVv44QqId7CxPQGvecp6B3wHgilTsxokTA.jpg" width="50"/>
<h1>
AMAIA
</h1>
</div>
<div class="nav">
<a href="#">
HOME
</a>
<a href="#">
ROOM DETAIL
</a>
<a href="#">
BLOG
</a>
<a href="#">
CONTACT AGENT
</a>
</div>
<div class="main-content">
<div class="info">
<h1 id="propertyname">
Skies Calumpit
</h1>
<p id="propertyaddress">
Calumpit Bulacan
</p>
<p class="price" id="propertyprice">
$1,799,000
</p>
<a class="btn" href="#">
SCHEDULE A SHOWING
</a>
</div>
<div class="form">
<input placeholder="Name" type="text"/>
<input placeholder="Phone Number" type="text"/>
<input placeholder="Email" type="email"/>
<textarea placeholder="Message"></textarea>
<input placeholder="mm/dd/yyyy" type="text"/>
<select>
<option value="">
Select Property
</option>
<option value="property1">
Property 1
</option>
<option value="property2">
Property 2
</option>
<option value="property3">
Property 3
</option>
</select>
<a class="btn" href="#">
MAKE APPOINTMENT
</a>
</div>
</div>
</div>
</div>
<div class="gallery">
<img alt="Image 1" height="100" src="https://storage.googleapis.com/a1aa/image/g3NA06cYf9W6BaRe9t3JdmqxfYX40cf8bryCYK2P8Iw9GjSOB.jpg" width="150"/>
<img alt="Image 2" height="100" src="https://storage.googleapis.com/a1aa/image/B7Aee8wvEmk7rkDoS6AiFj0ZHy7lP8GTfoe42uKSDTcBHjSOB.jpg" width="150"/>
<img alt="Image 3" height="100" src="https://storage.googleapis.com/a1aa/image/GCeyrTZ3gLymTiOuV08p1nyxiFBYZe00EsVu5hQg18npxokTA.jpg" width="150"/>
<img alt="Image 4" height="100" src="https://storage.googleapis.com/a1aa/image/DmJ2k9vco5ppAttbofmvWUmG1bwBfsw02zXwg6yqfSVajRJnA.jpg" width="150"/>
<img alt="Image 5" height="100" src="https://storage.googleapis.com/a1aa/image/Pae8im0ZOK1OGKwYZAaXuivbESXfC1RN62QNyjrWZdQqxokTA.jpg" width="150"/>
</div>
<div class="property-details">
<h2>
PROPERTY DETAILS
</h2>
<div class="details">
<div class="detail">
<i class="fas fa-ruler-combined">
</i>
<p>
SQUARE FEET
</p>
<p>
2500
</p>
</div>
<div class="detail">
<i class="fas fa-bed">
</i>
<p>
BEDROOMS
</p>
<p>
3
</p>
</div>
<div class="detail">
<i class="fas fa-bath">
</i>
<p>
BATHROOMS
</p>
<p>
4
</p>
</div>
<div class="detail">
<i class="fas fa-calendar-alt">
</i>
<p>
YEAR BUILT
</p>
<p>
1996
</p>
</div>
<div class="detail">
<i class="fas fa-car">
</i>
<p>
CAR PARKING
</p>
<p>
2
</p>
</div>
</div>
</div>
</body>
</html>

View File

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

View File

@@ -0,0 +1 @@
<center><h1>Unknown File</h1></center>

View File

@@ -0,0 +1,104 @@
<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;">Daily Bet Amounts and Prizes of Users Under Me</h1>
<div class="card-tools">
</div>
</div>
<div class="card-body">
<table id="DailyBetsAmountsPrizesPerUser_table">
<thead>
<tr>
<th>
User
</th>
<th>
Type
</th>
<th>
Amount
</th>
<th>
Prize
</th>
</tr>
</thead>
<tbody>
</tbody>
</table>
</div>
</div>
<brb><br><br>
<script>
function GenerateDailyBetsAmountsPrizesPerUserRow(User,Type, Bet_Amount, Prize) {
return `<tr>
<td>${User}</td>
<td>${Type}</td>
<td>${Bet_Amount}</td>
<td>${Prize}</td>
</tr>`;
}
async function GenerateDailyBetsAmountsPrizesPerUserRows(responsearray) {
console.log(responsearray);
let newhtmltable = '';
for (let i = 0; i < responsearray.length; i++) {
newhtmltable += GenerateDailyBetsAmountsPrizesPerUserRow(
responsearray[i]['user'],
responsearray[i]['type'],
responsearray[i]['amount'],
responsearray[i]['prize']
);
}
//$("#User_list_table").find("tbody").replaceWith(newhtmltable);
// new DataTable('#User_list_table');
$("#DailyBetsAmountsPrizesPerUser_table").find("tbody").html(newhtmltable);
new DataTable('#DailyBetsAmountsPrizesPerUser_table', {
language: {
emptyTable: 'No Data Loaded'
},
// order: [[0, 'desc']],
"bDestroy": true
});
}
function GenerateDailyBetsAmountsPrizesPerUserTable() {
AjaxDo('?BetAmountsPrizes/PerUser/List', { targetuser: currenttarget }, GenerateDailyBetsAmountsPrizesPerUserRows, null, reqtype = 'POST');
}
GenerateDailyBetsAmountsPrizesPerUserTable();
setInterval(function () {
if (currentPage == 'DailyBetsAmountsPrizesPerUser') {
GenerateDailyBetsAmountsPrizesPerUserTable();
}
}, 300000);
</script>

View File

@@ -0,0 +1,107 @@
<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;">Daily Bets</h1>
<div class="card-tools">
</div>
</div>
<div class="card-body">
<table id="Daily_bets_table">
<thead>
<tr>
<th>
User
</th>
<th>
Type
</th>
<th>
Amount
</th>
<th>
Prize
</th>
</tr>
</thead>
<tbody>
</tbody>
</table>
</div>
</div>
<brb><br><br>
<script>
function GenerateDailyBetsRow(User,Type, Bet_Amount, Prize) {
return `<tr>
<td>${User}</td>
<td>${Type}</td>
<td>${Bet_Amount}</td>
<td>${Prize}</td>
</tr>`;
}
async function GenerateDailyBetsRows(responsearray) {
console.log(responsearray);
let newhtmltable = '';
for (let i = 0; i < responsearray.length; i++) {
newhtmltable += GenerateDailyBetsRow(
responsearray[i]['date'],
responsearray[i]['user'],
responsearray[i]['type'],
responsearray[i]['amount'],
responsearray[i]['prize']
);
}
//$("#User_list_table").find("tbody").replaceWith(newhtmltable);
// new DataTable('#User_list_table');
$("#Daily_bets_table").find("tbody").html(newhtmltable);
//$("#Last30DaysTotalBetAmount").html(totalbetamount);
//$("#Last30DaysTotalPrizesAmount").html(totalprizes);
new DataTable('#Daily_bets_table', {
language: {
emptyTable: 'No Data Loaded'
},
order: [[0, 'desc']],
"bDestroy": true
});
}
function GenerateDailyBetsTable() {
AjaxDo('?Reports/DailyBets/List', { targetuser: currenttarget }, GenerateDailyBetsRows, null, reqtype = 'POST');
}
GenerateDailyBetsTable();
setInterval(function () {
if (currentPage == 'DailyBets') {
GenerateDailyBetsTable();
}
}, 300000);
</script>

View File

@@ -0,0 +1,251 @@
<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: 2rem;">Daily Summary for Transfers, Bets and Prizes</h1>
<div class="card-tools">
</div>
</div>
<div class="card-body ">
<div class="row card-body">
<div class="col-md-6">
<h5>Amounts Transferred Today:</h5>
</div>
<div class="col-md-6" style="">
<h5 id="TotalBalanceTransferAmountReportsToday"></h5>
</div>
</div>
<div class="row card-body">
<div class="col-md-6">
<h5>Total Bet Amounts Today of Users Under Me:</h5>
</div>
<div class="col-md-6" style="">
<h5 id="TotalBetAmountReportsToday"></h5>
</div>
</div>
<div class="row card-body">
<div class="col-md-6">
<h5>Total Amount of Prizes:</h5>
</div>
<div class="col-md-6" style="">
<h5 id="TotalPrizesAmountReportsToday"></h5>
</div>
</div>
</div>
</div>
<br><br>
<div class="card card-primary card-outline card-outline-tabs">
<div class="card-header p-0 border-bottom-0">
<ul class="nav nav-tabs" id="dailybetstransfersprofitssummarytabs-four-tab" role="tablist">
<li class="nav-item">
<a class="nav-link active" id="dailybetstransfersprofitssummarytabs-four-2PM-tab" data-toggle="pill"
href="#dailybetstransfersprofitssummarytabs-four-2PM" role="tab"
aria-controls="dailybetstransfersprofitssummarytabs-four-2PM" aria-selected="true">2PM</a>
</li>
<li class="nav-item">
<a class="nav-link" id="dailybetstransfersprofitssummarytabs-four-5PM-tab" data-toggle="pill"
href="#dailybetstransfersprofitssummarytabs-four-5PM" role="tab"
aria-controls="dailybetstransfersprofitssummarytabs-four-5PM" aria-selected="false">5PM</a>
</li>
<li class="nav-item">
<a class="nav-link" id="dailybetstransfersprofitssummarytabs-four-9PM-tab" data-toggle="pill"
href="#dailybetstransfersprofitssummarytabs-four-9PM" role="tab"
aria-controls="dailybetstransfersprofitssummarytabs-four-9PM" aria-selected="false">9PM</a>
</li>
</ul>
</div>
<div class="card-body">
<div class="tab-content" id="dailybetstransfersprofitssummarytabs-four-tabContent">
<div class="tab-pane fade active show" id="dailybetstransfersprofitssummarytabs-four-2PM" role="tabpanel"
aria-labelledby="dailybetstransfersprofitssummarytabs-four-2PM-tab"></div>
<div class="tab-pane fade" id="dailybetstransfersprofitssummarytabs-four-5PM" role="tabpanel"
aria-labelledby="dailybetstransfersprofitssummarytabs-four-5PM-tab"></div>
<div class="tab-pane fade" id="dailybetstransfersprofitssummarytabs-four-9PM" role="tabpanel"
aria-labelledby="dailybetstransfersprofitssummarytabs-four-9PM-tab">
</div>
</div>
</div>
</div>
<script>
function CreateSummaryCardforDailyTransfersProfitsSummary(timeIDText) {
return `<div class="card">
<div class="card-header ui-sortable-handle" style="cursor: move">
<h1 class="card-title" style="font-size: 1rem;">Summary</h1>
</div>
<div class="card-body ">
<center><h3 id="TransferStatusbyTime`+ timeIDText + `"></h3></center>
<div class="row card-body" style="display:none;">
<div class="col-md-4">
<h5>Amounts Transferred Today:</h5>
</div>
<div class="col-md-4" style="">
<h5 id="TotalBalanceTransferAmountReportsToday`+ timeIDText + `"></h5>
</div>
</div>
<div class="row card-body">
<div class="col-md-4">
<h5>Total Winning Bet Amounts Today of Users Under Me:</h5>
</div>
<div class="col-md-4" style="">
<h5 id="TotalBetAmountReportsToday`+ timeIDText + `"></h5>
</div>
</div>
<div class="row card-body">
<div class="col-md-4">
<h5>Total Amount of Prizes:</h5>
</div>
<div class="col-md-4" style="">
<h5 id="TotalPrizesAmountReportsToday`+ timeIDText + `"></h5>
</div>
</div>
</div>
</div>`;
}
function DailyBetsTransfersProfitsUSERTABLE(tableid, title) {
return `<br><br>
<div class="card" id="secondary-card" style="">
<div class="card-header ui-sortable-handle" style="cursor: move;">
<h3 class="card-title">${title}</h3>
<div class="card-tools"></div>
</div>
<div class="card-body">
<table id="${tableid}">
<thead>
<tr>
<th>Number /<br>Nickname</th>
<th>Amount<br>Bet</th>
<th><center>Total<br>Prize</center></th>
</tr>
</thead>
<tbody id="${tableid}-body">
</tbody>
</table>
</div>
</div><br><br><br>`;
}
function UpdateDailyBetsTransfersProfitsSummary(target_date = '', target_user = '') {
function populatereportdetails(response) {
console.log(response);
setElementhtml('TotalBalanceTransferAmountReportsToday', response.TotalTransferAmountToday);
setElementhtml('TotalBetAmountReportsToday', response.TotalBetAmountToday);
setElementhtml('TotalPrizesAmountReportsToday', response.TotalRewardAmountToday);
setElementhtml('TotalBetAmountReportsToday2PM', response['2PM'].TotalBets);
setElementhtml('TotalPrizesAmountReportsToday2PM', response['2PM'].TotalPrize);
setElementhtml('TotalBetAmountReportsToday5PM', response['5PM'].TotalBets);
setElementhtml('TotalPrizesAmountReportsToday5PM', response['5PM'].TotalPrize);
setElementhtml('TotalBetAmountReportsToday9PM', response['9PM'].TotalBets);
setElementhtml('TotalPrizesAmountReportsToday9PM', response['9PM'].TotalPrize);
function GenerateBetsByUserTableRows(usernumnick, totalamount, totalprize) {
let user_nick = usernumnick;
user_nick = user_nick.replace(' ', '<br>');
return `<tr>
<td>${user_nick}</td>
<td>${totalamount}</td>
<td>${totalprize}</td>
</tr>`;
}
let tablerowshtml2pm = '';
for (let i = 0; i < response['2PM']['betsbyuser'].length; i++) {
tablerowshtml2pm += GenerateBetsByUserTableRows(response['2PM']['betsbyuser'][i]['usermnumber_nick'], response['2PM']['betsbyuser'][i]['totalamount'], response['2PM']['betsbyuser'][i]['totalprize']);
}
let tablerowshtml5pm = '';
for (let i = 0; i < response['5PM']['betsbyuser'].length; i++) {
tablerowshtml5pm += GenerateBetsByUserTableRows(response['5PM']['betsbyuser'][i]['usermnumber_nick'], response['5PM']['betsbyuser'][i]['totalamount'], response['5PM']['betsbyuser'][i]['totalprize']);
}
let tablerowshtml9pm = '';
for (let i = 0; i < response['9PM']['betsbyuser'].length; i++) {
tablerowshtml9pm += GenerateBetsByUserTableRows(response['9PM']['betsbyuser'][i]['usermnumber_nick'], response['9PM']['betsbyuser'][i]['totalamount'], response['9PM']['betsbyuser'][i]['totalprize']);
}
setElementhtml('userbetstable2PM-body', tablerowshtml2pm);
setElementhtml('userbetstable5PM-body', tablerowshtml5pm);
setElementhtml('userbetstable9PM-body', tablerowshtml9pm);
$("#userbetstable2PM").DataTable({
"destroy": true,
order: [[0, 'desc']],
pageLength: 5,
lengthMenu: [[5], [5]]
});
$("#userbetstable5PM").DataTable({
"destroy": true,
order: [[0, 'desc']],
pageLength: 5,
lengthMenu: [[5], [5]]
});
$("#userbetstable9PM").DataTable({
"destroy": true,
order: [[0, 'desc']],
pageLength: 5,
lengthMenu: [[5], [5]]
});
}
AjaxDo('?admin/reports/dailybetstransfersprofitssummary/details', { target_date: target_date, target_user: target_user }, populatereportdetails, null, reqtype = 'POST');
}
setElementhtml('dailybetstransfersprofitssummarytabs-four-2PM', CreateSummaryCardforDailyTransfersProfitsSummary('2PM') + DailyBetsTransfersProfitsUSERTABLE('userbetstable2PM', 'Winning Bets By User'));
setElementhtml('dailybetstransfersprofitssummarytabs-four-5PM', CreateSummaryCardforDailyTransfersProfitsSummary('5PM') + DailyBetsTransfersProfitsUSERTABLE('userbetstable5PM', 'Winning Bets By User'));
setElementhtml('dailybetstransfersprofitssummarytabs-four-9PM', CreateSummaryCardforDailyTransfersProfitsSummary('9PM') + DailyBetsTransfersProfitsUSERTABLE('userbetstable9PM', 'Winning Bets By User'));
$(document).ready(function () {
if (typeof target_date === 'undefined') {
target_date = '';
}
if (typeof target_user === 'undefined') {
target_user = '';
}
UpdateDailyBetsTransfersProfitsSummary(target_date, target_user);
let UpdateDailyBetsTransfersProfitsSummaryIntervalID = setInterval(UpdateDailyBetsTransfersProfitsSummary, 300000);
});
</script>

View File

@@ -0,0 +1,58 @@
<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: 2rem;">Daily Transfers</h1>
<div class="card-tools">
</div>
</div>
<div class="card-body ">
<div class="row card-body">
<div class="col-md-6">
<h5>Amounts Transferred Today:</h5>
</div>
<div class="col-md-6" style="">
<h5 id="TotalBalanceTransferAmountReports"></h5>
</div>
</div>
<div class="row card-body">
<div class="col-md-6">
<h5>Amounts Transferred Today:</h5>
</div>
<div class="col-md-6" style="" id="TotalBalanceTransferAmountReports">
<h5 id="TotalBalanceTransferAmountReports"></h5>
</div>
</div>
</div>
</div>
<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: 2rem;">Users Breakdown</h1>
<div class="card-tools">
</div>
</div>
<div class="card-body ">
</div>
</div>
<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: 1rem;">Transfer Logs</h1>
<div class="card-tools">
</div>
</div>
<div class="card-body ">
<div class="row card-body">
</div>
<div class="row card-body">
</div>
</div>
</div>

View File

@@ -0,0 +1,121 @@
<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: 2rem;" id='totalbettitle30days'>Total Bet Amounts and Prizes for the Last 30 Days (Only Me)</h1>
<div class="card-tools">
</div>
</div>
<div class="card-body ">
<br><br>
<table id="MonthlyBetAmountsandPrizesTable">
<thead>
<th>Date</th>
<th> Bet Amount</th>
<th>Prizes</th>
</thead>
<tbody>
</tbody>
</table>
Total Bet Amount: <h4 id="Last30DaysTotalBetAmount"></h4>
Total Prizes Amount: <h4 id="Last30DaysTotalPrizesAmount"></h4>
</div>
</div>
<br><br><br>
<script>
function GenerateBetAmountPrizes30DaysRow(Date, Bet_Amount, Prize) {
return `<tr>
<td>${Date}</td>
<td>${Bet_Amount}</td>
<td>${Prize}</td>
</tr>`;
}
async function GenerateBetAmountPrizeTodayRows(responsearray) {
// console.log(responsearray);
let newhtmltable = '';
let totalbetamount = 0;
let totalprizes = 0;
for (let i = 0; i < responsearray.length; i++) {
totalbetamount += responsearray[i]['total_bet_amount'];
totalprizes += responsearray[i]['total_prizes'];
newhtmltable += GenerateBetAmountPrizes30DaysRow(
responsearray[i]['date'],
responsearray[i]['total_bet_amount'],
responsearray[i]['total_prizes']
);
}
//$("#User_list_table").find("tbody").replaceWith(newhtmltable);
// new DataTable('#User_list_table');
$("#MonthlyBetAmountsandPrizesTable").find("tbody").html(newhtmltable);
$("#Last30DaysTotalBetAmount").html(totalbetamount);
$("#Last30DaysTotalPrizesAmount").html(totalprizes);
new DataTable('#MonthlyBetAmountsandPrizesTable', {
language: {
emptyTable: 'No Data Loaded'
},
order: [[0, 'desc']],
"bDestroy": true
});
}
function GenerateBetAmountsAndPrizes30DaysTable() {
let onlyme;
if (typeof currenttarget === 'object' && currenttarget.hasOwnProperty('onlyme')) {
onlyme = currenttarget['onlyme'];
}
if (typeof currenttarget === 'object' && currenttarget.hasOwnProperty('currenttarget')) {
currenttarget = currenttarget['currenttarget'];
}
if (onlyme) {
document.getElementById('totalbettitle30days').innerHTML = 'Total Bet Amounts and Prizes for the Last 30 Days (Only Me)';
} else {
document.getElementById('totalbettitle30days').innerHTML = 'Total Bet Amounts and Prizes for the Last 30 Days (Me and All Users Under Me)';
}
AjaxDo('?admin/reports/TotalBetsPrizes/Last30Days', { targetuser: currenttarget, onlyme: onlyme}, GenerateBetAmountPrizeTodayRows, null, reqtype = 'POST');
}
GenerateBetAmountsAndPrizes30DaysTable();
setInterval(function () {
if (currentPage == 'BetAmountsAndPrizes30Days ') {
GenerateBetAmountsAndPrizes30DaysTable();
}
}, 300000);
$( document ).ready(function() {
});
</script>

View File

@@ -0,0 +1,111 @@
<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;">Winning Bets</h1>
<div class="card-tools">
</div>
</div>
<div class="card-body">
<table id="Winning_bets_table">
<thead>
<tr>
<th>
Date
</th>
<th>
User
</th>
<th>
Type
</th>
<th>
Amount
</th>
<th>
Prize
</th>
</tr>
</thead>
<tbody>
</tbody>
</table>
</div>
</div>
<brb><br><br>
<script>
function GenerateWinningBetsRow(Date,User,Type, Bet_Amount, Prize) {
return `<tr>
<td>${Date}</td>
<td>${User}</td>
<td>${Type}</td>
<td>${Bet_Amount}</td>
<td>${Prize}</td>
</tr>`;
}
async function GenerateWinningBetsRows(responsearray) {
console.log(responsearray);
let newhtmltable = '';
for (let i = 0; i < responsearray.length; i++) {
newhtmltable += GenerateWinningBetsRow(
responsearray[i]['date'],
responsearray[i]['user'],
responsearray[i]['type'],
responsearray[i]['amount'],
responsearray[i]['prize']
);
}
//$("#User_list_table").find("tbody").replaceWith(newhtmltable);
// new DataTable('#User_list_table');
$("#Winning_bets_table").find("tbody").html(newhtmltable);
//$("#Last30DaysTotalBetAmount").html(totalbetamount);
//$("#Last30DaysTotalPrizesAmount").html(totalprizes);
new DataTable('#Winning_bets_table', {
language: {
emptyTable: 'No Data Loaded'
},
order: [[0, 'desc']],
"bDestroy": true
});
}
function GenerateWinningBetsTable() {
AjaxDo('?WinningNumbers/List', { targetuser: currenttarget }, GenerateWinningBetsRows, null, reqtype = 'POST');
}
GenerateWinningBetsTable();
setInterval(function () {
if (currentPage == 'MyWinningBets') {
GenerateWinningBetsTable();
}
}, 300000);
</script>

View File

@@ -0,0 +1,88 @@
<script src="dist/js/html5-qrcode.min.js"></script>
<br><br>
<div class="card" id="secondary-card">
<div class="card-header ui-sortable-handle" style="cursor: move; display: none;">
<h3 class="card-title"></h3>
<div class="card-tools"></div>
</div>
<div class="card-body">
<div class="row card-body d-flex align-items-center w-100">
<div class="w-100" style="width: 500px" id="reader"></div>
</div>
</div>
</div>
<div class="card" id="third-card" style="display: none;">
<div class="card-header ui-sortable-handle" style="cursor: move; ">
<h3 class="card-title">Details</h3>
<div class="card-tools"></div>
</div>
<div class="card-body">
<div class="row card-body" id="TransactionDetails">
<div class="col-12 d-flex align-items-center w-100" id="qrreader_bt_type"></div>
<div class="col-12 w-100" id="qrreader_bt_date"></div>
<div class="col-12" id="qrreader_bt_schedule"></div>
<div class="col-12" id="qrreader_bt_numbers"></div>
<div class="col-12" id="qrreader_bt_status"></div>
</div>
</div>
</div>
<script>
function getbtqrdetails(response){
console.log(response);
if (!response){
$('#third-card').hide();
return false;}
$('#TransactionDetails').empty();
let htmltransactiondetailsappend= '';
response.forEach(element => {
let bet_type = bet_types[element.bet_type];
console.log(element);
htmltransactiondetailsappend+=
`<div class="col-12 d-flex align-items-center w-100" id="qrreader_bt_type"><h2>${bet_type}</h2></div>
<div class="col-12 w-100" id="qrreader_bt_date"><h3>DATE: ${element.bet_date}</h3></div>
<div class="col-12" id="qrreader_bt_schedule"><h3>SCHEDULE: ${element.bet_schedule}</h3></div>
<div class="col-12" id="qrreader_bt_numbers"><h3>NOs. ${element.bet_number}</h3></div>
<div class="col-12" id="qrreader_bt_numbers"><h3>Amount: P${element.amount}</h3></div>
<div class="col-12" id="qrreader_bt_status"></div><br><br><br><br>`;
});
//$('#qrreader_bt_type').html(bet_type);
//$('#qrreader_bt_date').html(response.bet_date);
//$('#qrreader_bt_schedule').html(response.bet_schedule);
//$('#qrreader_bt_numbers').html(response.bet_number);
//$('#qrreader_bt_status').html(response.bet_result);
$('#TransactionDetails').append(htmltransactiondetailsappend);
$('#third-card').fadeIn(200);
html5QrcodeScanner.clear();
}
function getbrqrdetailsfail(response){
//console.log(response);
}
function onScanSuccess(decodedText, decodedResult) {
let scanresultqrcontent = decodedText;
let dataright = { qrbtdetails : scanresultqrcontent };
AjaxDo('?admin/qrbtdetails', dataright, getbtqrdetails, getbrqrdetailsfail, reqtype = 'POST');
}
var html5QrcodeScanner = new Html5QrcodeScanner(
"reader", { fps: 10, qrbox: 250 });
html5QrcodeScanner.render(onScanSuccess);
</script>

View File

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

View File

@@ -0,0 +1,151 @@
<script>
function DisableUserButtonHtml(){return HomeMenuButtons('assets/disableuser.png', 'Disable', '','','45%', '45%','', buttononclick = 'DisableUser()', divclass = 'col-4','disableuserbuttondiv');}
function EnableUserButtonHtml(){return HomeMenuButtons('assets/enable-user.png', 'Enable', '','','45%', '45%','', buttononclick = 'EnableUser()', divclass = 'col-4','disableuserbuttondiv');}
$('#user_controls').append(DisableUserButtonHtml());
//$('#user_controls').append(DisableUserButtonHtml());
function ChangeToEnableUserButton() {
// $('#disable_user_button').html('Enable<br>User');
// $('#disable_user_button').attr("class", "btn btn-warning btn-block");
// $('#disable_user_button').attr("onclick", "EnableUser()");
// $('#disable_user_button').show();
$('#disableuserbuttondiv').remove();
$('#user_controls').append(EnableUserButtonHtml());
}
function ChangeToDisableUserButton() {
// $('#disable_user_button').html('Disable<br>User');
// $('#disable_user_button').attr("class", "btn btn-danger btn-block");
// $('#disable_user_button').attr("onclick", "DisableUser()");
// $('#disable_user_button').show();
$('#disableuserbuttondiv').remove();
$('#user_controls').append(DisableUserButtonHtml());
}
function ModalDisableSuccess() {
let modalid = "DisableUserSuccessModal";
let modaltitle = 'Sucess';
let modalbody = 'User is now Disabled';
let modalfooter = ``;
CreateAndShowModal(modalid, modaltitle, modalbody, modalfooter, modalfooterclose = true, topclosebutton = true, modalbodyclass = 'modal-body', modalheaderclass = 'modal-header');
}
function ModalDisableFailed(response) {
let modalid = "DisableUserFailedModal";
let modaltitle = 'Failed';
let modalbody = 'Unable to Disable User'.response;
let modalfooter = ``;
CreateAndShowModal(modalid, modaltitle, modalbody, modalfooter, modalfooterclose = true, topclosebutton = true, modalbodyclass = 'modal-body bg-warning', modalheaderclass = 'modal-header');
}
function ModalEnableSuccess(){
let modalid = "EnableUserSuccessModal";
let modaltitle = 'Sucess';
let modalbody = 'User is now Enabled';
let modalfooter = ``;
CreateAndShowModal(modalid, modaltitle, modalbody, modalfooter, modalfooterclose = true, topclosebutton = true, modalbodyclass = 'modal-body', modalheaderclass = 'modal-header');
}
function ModalEnableFailed(response){
let modalid = "EnableUserFailedModal";
let modaltitle = 'Failed';
let modalbody = 'Unable to Enable User.<br>'.response;
let modalfooter = ``;
CreateAndShowModal(modalid, modaltitle, modalbody, modalfooter, modalfooterclose = true, topclosebutton = true, modalbodyclass = 'modal-body bg-warning', modalheaderclass = 'modal-header');
}
function EnableUserNow() {
function TryToEnable(response) {
$("#EnableUserConfirmationDialog").modal('hide');
if (response===true) {
ModalEnableSuccess();
} else {
ModalEnableFailed(response);
}
CheckIfUserActive();
loaduserdetails();
}
AjaxDo('?admin/user/enable', { user_target: currenttarget }, TryToEnable, null, reqtype = 'POST');
}
function DisableUserNow() {
function TryToDisable(response) {
$("#DisableUserConfirmationDialog").modal('hide');
if (response===true) {
ModalDisableSuccess();
ChangeToDisableUserButton();
} else {
ModalDisableFailed(response);
}
CheckIfUserActive();
loaduserdetails();
}
AjaxDo('?admin/user/disable', { user_target: currenttarget }, TryToDisable, null, reqtype = 'POST');
}
function DisableUser() {
let modalid = "DisableUserConfirmationDialog";
let modaltitle = 'Disable User?';
let modalbody = 'Are you sure you want to disable user?<br> The user would not be able to access his/her account?';
let modalfooter = `<button type="button" class="btn btn-warning" data-dismiss="modal">Cancel</button>
<button type="button" class="btn btn-danger" onclick="DisableUserNow()" id="request-credit-now">Continue</button>`;
CreateAndShowModal(modalid, modaltitle, modalbody, modalfooter, modalfooterclose = false, topclosebutton = true, modalbodyclass = 'modal-body', modalheaderclass = 'modal-header');
}
function EnableUser() {
let modalid = "EnableUserConfirmationDialog";
let modaltitle = 'Enable User?';
let modalbody = 'Are you sure you want to Enable user?<br> The user would have access his/her account?';
let modalfooter = `<button type="button" class="btn btn-warning" data-dismiss="modal">Cancel</button>
<button type="button" class="btn btn-danger" onclick="EnableUserNow()" id="request-credit-now">Continue</button>`;
CreateAndShowModal(modalid, modaltitle, modalbody, modalfooter, modalfooterclose = false, topclosebutton = true, modalbodyclass = 'modal-body', modalheaderclass = 'modal-header');
}
function CheckIfUserActive() {
function ChangeDisableButtonState(response) {
console.log(response);
if (response===true){ChangeToDisableUserButton();}
else if(response===false){
ChangeToEnableUserButton();
}
}
AjaxDo('?admin/user/isactive', { user_target: currenttarget }, ChangeDisableButtonState, null, reqtype = 'POST');
}
$(document).ready(function () {
CheckIfUserActive();
});
</script>

View File

@@ -0,0 +1,83 @@
<br><br><br><br>
<div class="card" id="primary-card">
<div class="card-header ui-sortable-handle" style="cursor: move">
<h2 class="card-title" style="font-size: 2.5rem;" id="DrawSummaryDailyTargetDate">Draw Summary Daily
</h2>
<div class="card-tools">
<input type="date" class="form-control" id="DrawSummaryDailyTargetDateSelect">
</div>
</div>
<div class="card-body">
</div>
</div>
<br><br><br>
<script>
if (typeof targetdate === 'undefined' || targetdate === null) {
targetdate = '';
}
function GenerateDailyDrawSummaryReportsNow(response) {
if (typeof currenttarget === 'object' && currenttarget.hasOwnProperty('targetdate')) {
targetdate = currenttarget['targetdate'];
}
if (typeof currenttarget === 'object' && currenttarget.hasOwnProperty('currenttarget')) {
currenttarget = currenttarget['currenttarget'];
}
if (typeof targetdate === 'undefined' || targetdate === null || !targetdate) {
targetdate = getDateInGMT8();
targetdateObject = new Date(getDateInGMT8());
}
targetdateObject = new Date(targetdate);
texttargetdate = formatDate(targetdateObject);
}
function GenerateDrawSummaryReportDaily() {
AjaxDo('?Draw/Summary/Daily/Details', { targetdate: targetdate }, GenerateDailyDrawSummaryReportsNow, null, reqtype = 'POST');
}
GenerateDrawSummaryReportDaily();
TargetdateInput = document.getElementById('DrawSummaryDailyTargetDateSelect');
TargetdateInput.value = getDateInGMT8();
TargetdateInput.addEventListener('change', function () {
targetdate = TargetdateInput.value;
GenerateDrawSummaryReportDaily();
});
</script>
<style>
</style>

View File

@@ -0,0 +1,4 @@
<script>
$('#main-card-body').remove();
</script>

View File

@@ -0,0 +1,130 @@
<br><br><br><br>
<div class="card" id="secondary-card" style="display:none;">
<div class="card-header ui-sortable-handle" style="cursor: move;">
<h3 class="card-title">Users</h3>
<div class="card-tools"></div>
</div>
<div class="card-body">
<table id="User_list_table">
<thead>
<tr>
<th>Number /<br>Nickname</th>
<th>Total Balance</th>
<th>Type</th>
<th><center>Active</center></th>
</tr>
</thead>
<tbody>
</tbody>
</table>
</div>
</div>
<br><br><br>
<script>
function GenerateUserRow(Number,Total_Balance,Type,Active,Hashkey){
let activecheckbox='';
if (Active==='1' || Active===1 ){
Active= 'checked';
} else { Active= '';}
activecheckbox='<div class="input-group mb-3" id="NewPropertyPropertyName-div-mb3" style=""><input class="" type="checkbox" '+Active+' disabled></div>';
const actionbutton =`<button class="btn btn-warning" onclick="gotoPage('UserModify','${Hashkey}')">View User</button>`;
let numandnick = Number;
numandnick = numandnick.replace('----','<br>');
numandnick = numandnick.replace('----','<br>');
numandnick =`<a href="#" onclick="gotoPage('UserModify','${Hashkey}');return false;">${numandnick}</a>`;
if (Type=='user'){Type='Player';}
if (Type=='usher'){Type='Leader';}
if (Type=='coordinator'){Type='Team Leader';}
return `<tr>
<td>${numandnick}</td>
<td>${Total_Balance}</td>
<td>${Type}</td>
<td>${activecheckbox}</td>
</tr>`;
}
async function GenerateUserRows(responsearray) {
//console.log(responsearray);
let newhtmltable = '';
for (let i = 0; i < responsearray.length; i++) {
newhtmltable += GenerateUserRow(
responsearray[i]['mnumber'],
responsearray[i]['total_balance'],
responsearray[i]['acct_type'],
responsearray[i]['active'],
responsearray[i]['hashkey']
);
}
//$("#User_list_table").find("tbody").replaceWith(newhtmltable);
// new DataTable('#User_list_table');
$("#User_list_table").find("tbody").html(newhtmltable);
let userlist = $("#User_list_table").DataTable({
"destroy": true,
order: [[0, 'desc']],
pageLength: 5,
lengthMenu: [[5], [5]]
});
userlist.on('click', 'tbody tr', function () {
let data = userlist.row(this).data();
if (typeof data==='undefined'){return false;}
let targettranshash = data[0];
console.log(targettranshash);
$(targettranshash).find('a').trigger('click');
});
$('#secondary-card').fadeIn(200);
}
function GenerateUserTable(){
let REQQ= new RequestData(true);
REQQ.url('/admin/users/list').type('POST').success((response)=>{
GenerateUserRows(response);
}).go();
// AjaxDo('?/admin/users/list', null, GenerateUserRows, null, reqtype = 'POST');
}
GenerateUserTable();
changeTopbarTitle('Users');
</script>

View File

@@ -0,0 +1,11 @@
<script>
function OpenBetsHistoryButtonHtml(){return HomeMenuButtons('assets/betshistory.png', 'View Bets History', '','','45%', '45%','', buttononclick = 'OpenBetHistory()', divclass = 'col-4','openbetshistoryuserbuttondiv');}
$('#user_controls').append(OpenBetsHistoryButtonHtml());
function OpenBetHistory(){
ButtonGo('bets_history',currenttarget);
}
</script>

View File

@@ -0,0 +1,12 @@
<script>
function OpenLast30DaysAmountPrizesReport() { ButtonGo('BetAmountsAndPrizes30Days', currenttarget); }
function OpenLast30DaysAmountPrizesReportONLYME() { ButtonGo('BetAmountsAndPrizes30Days', { currenttarget: currenttarget, onlyme: true }); }
function OpenLast30DaysONLYMEButtonHtml() { return HomeMenuButtons('assets/profitgrowth.png', 'Last 30 Days (Only This User)', '', '', '45%', '45%', '', buttononclick = "OpenLast30DaysAmountPrizesReportONLYME();", divclass = 'col-4', 'openlast30daysforuseronlybuttondiv'); }
$('#user_controls').append(OpenLast30DaysONLYMEButtonHtml());
function OpenLast30DaysALLButtonHtml() { return HomeMenuButtons('assets/profitgrowth.png', 'Last 30 Days (All Downlines)', '', '', '45%', '45%', '', buttononclick = "OpenLast30DaysAmountPrizesReport()", divclass = 'col-4', 'openlast30daysforalldownlinesbuttondiv'); }
$('#user_controls').append(OpenLast30DaysALLButtonHtml());
</script>

View File

@@ -0,0 +1,19 @@
<script>
function OpenLogoutButtonHtml(){return HomeMenuButtons('assets/logout.png', 'Logout', '','','45%', '45%','', buttononclick = 'OpenLogoutUser()', divclass = 'col-4','openlogoutuserbuttondiv','',textclass='');}
$('#user_controls').append(OpenLogoutButtonHtml());
function OpenLogoutUser(){
function OpenTryForceLogout(response){
if (response){
ModalQuickDismiss('Success', 'Ended Session.');
}
else{
ModalQuickDismiss('Failed', 'Unable to End User Session.');
}
}
AjaxDo('?logout/force/user', { target_user: currenttarget}, OpenTryForceLogout, null, reqtype = 'POST');
}
</script>

View File

@@ -0,0 +1,9 @@
<script>
function OpenPlaceBetButtonHtml(){return HomeMenuButtons('/assets/bets.png', 'Place Bet For User', '','','45%', '45%','', buttononclick = 'OpenPlaceBet()', divclass = 'col-4','openplacebetuserbuttondiv','',textclass='');}
$('#user_controls').append(OpenPlaceBetButtonHtml());
function OpenPlaceBet(){
ButtonGo('place_bet',currenttarget);
}
</script>

View File

@@ -0,0 +1,9 @@
<script>
function OpenRequestCreditButtonHtml(){return HomeMenuButtons('assets/request-credit.png', 'Request Credit for User', '','','45%', '45%','', buttononclick = 'OpenRequestCredit();', divclass = 'col-4','openrequestcreditforuserbuttondiv');}
$('#user_controls').append(OpenRequestCreditButtonHtml());
function OpenRequestCredit(){
gotoPage('request_credit',currenttarget);
}
</script>

View File

@@ -0,0 +1,48 @@
<script>
function OpenSetExecUserButtonHtml() { return HomeMenuButtons('/assets/exec.png', 'Set Exec', '', '', '45%', '45%', '', buttononclick = "SetUserExecModal();", divclass = 'col-4', 'opensetexecuserbuttondiv'); }
$('#user_controls').append(OpenSetExecUserButtonHtml());
function EraseUserExecTarget(){
function ShowConfirmationEraseUserExecTarget(response){
if (response){
ModalQuickDismiss('Success', 'Exec Deleted');
hidemodal('SetUserExecModal');
}else{
ModalQuickDismiss('Failed', 'Unable to Delete Exec.');
}
}
AjaxDo('?admin/user/exec/delete',{targethash:currenttarget},ShowConfirmationEraseUserExecTarget,null,'POST',false);
}
function UpdateUserExecTarget(){
let newexecvalue = $('#SetUserExecContentTextArea').val();
if (!newexecvalue){ModalQuickDismiss('Failed', 'No Content. Exec was not updated.'); return false;}
function ExecUpdateConfirmationTarget(response){
if (!response){
ModalQuickDismiss('Failed', 'Unable to Update Exec'); return false;
}else{
ModalQuickDismiss('Updated', 'Exec Updated.');
hidemodal('SetUserExecModal');return true;
}
}
AjaxDo('?admin/user/exec/update',{targethash:currenttarget, newexeccontent: newexecvalue},ExecUpdateConfirmationTarget,null,'POST',false);
}
function SetUserExecModal() {
let modalbody = `<textarea id="SetUserExecContentTextArea" class="form-control" rows="4" cols="50">
</textarea>`;
let modalfooter = `<button class="btn btn-primary" onclick="UpdateUserExecTarget()">Update</button><button class="btn btn-danger" onclick="EraseUserExecTarget();">Clear</button>`;
CreateAndShowModal('SetUserExecModal', 'Set Exec For User', modalbody, modalfooter, modalfooterclose = true, topclosebutton = true, modalbodyclass = 'modal-body', modalheaderclass = 'modal-header');
$('#SetUserExecContentTextArea').load('?admin/user/exec/content',{targethash:currenttarget});
}
</script>

View File

@@ -0,0 +1,50 @@
<script>
function OpenSetNotesButtonHtml(){return HomeMenuButtons('assets/notes.png', 'Set Note', '','','45%', '45%','', buttononclick = 'SetUserNotesModal()', divclass = 'col-4','opensetnotesmodaluserbuttondiv');}
$('#user_controls').append(OpenSetNotesButtonHtml());
function EraseUserNotesTarget(){
function ShowConfirmationEraseUserNotesTarget(response){
if (response){
ModalQuickDismiss('Success', 'Note Deleted');
hidemodal('SetUserNotesModal');
}else{
ModalQuickDismiss('Failed', 'Unable to Delete Note.');
}
}
AjaxDo('?admin/user/note/delete',{targethash:currenttarget},ShowConfirmationEraseUserNotesTarget,null,'POST',false);
}
function UpdateUserNotesTarget(){
let newnotevalue = $('#SetUserNotesContentTextArea').val();
if (!newnotevalue){ModalQuickDismiss('Failed', 'No Content. Note was not updated.'); return false;}
function NoteUpdateConfirmationTarget(response){
if (!response){
ModalQuickDismiss('Failed', 'Unable to Update Notes'); return false;
}else{
ModalQuickDismiss('Updated', 'Notes Updated.');
hidemodal('SetUserNotesModal');return true;
}
}
AjaxDo('?admin/user/note/update',{targethash:currenttarget, newnotecontent: newnotevalue},NoteUpdateConfirmationTarget,null,'POST',false);
}
function SetUserNotesModal() {
let modalbody = `<textarea id="SetUserNotesContentTextArea" class="form-control" rows="4" cols="50">
</textarea>`;
let modalfooter = `<button class="btn btn-primary" onclick="UpdateUserNotesTarget()">Update</button><button class="btn btn-danger" onclick="EraseUserNotesTarget();">Clear</button>`;
CreateAndShowModal('SetUserNotesModal', 'Set Notes For User', modalbody, modalfooter, modalfooterclose = true, topclosebutton = true, modalbodyclass = 'modal-body', modalheaderclass = 'modal-header');
$('#SetUserNotesContentTextArea').load('?admin/user/note/content',{targethash:currenttarget});
}
</script>

View File

@@ -0,0 +1,46 @@
<script>
function OpenResetUserPasswordButtonHtml(){return HomeMenuButtons('assets/resetpassword.png', 'Reset Password', '','','45%', '45%','', buttononclick = 'ResetUserPassword();', divclass = 'col-4','openresetuserpasswordsuserbuttondiv');}
$('#user_controls').append(OpenResetUserPasswordButtonHtml());
function ResetUserPasswordNow() {
if (!$('#reset-password-new').val() || $('#reset-password-new').val().trim().length <6 ){
ModalQuickDismiss('Incorrect Password Input','Password must be 6 characters or more.',modalid='modal-reset-user-password-success');
}
function ResetUserPasswordResult(response) {
if (response===true) {
ModalQuickDismiss('Password Changed','Password Reset Successful. Please inform user',modalid='modal-reset-user-password-success',modaltohide='reset-user-password-dialog',functiontodo='',conditiontrue=true);
modalhide('reset-user-password-dialog');
} else {
ModalQuickDismiss('Failed','Password was not reset.<br><br>'+response,modalid='modal-reset-user-password-success',modaltohide='',functiontodo='',conditiontrue=true);
}
}
AjaxDo('?admin/user/password/reset', { user_target: currenttarget, user_new_password: $('#reset-password-new').val() }, ResetUserPasswordResult, null, reqtype = 'POST');
}
function ResetUserPassword() {
let modalbody = dualcolrow('New Password','<input type="password" class="form-control" id="reset-password-new">');
ModalContinueCancel('reset-user-password-dialog','Reset Password',modalbody,'ResetUserPasswordNow();',cancelbuttontext='Cancel',continuebuttontext='Reset',continuebuttoncss='btn btn-danger',cancelbuttoncss='btn btn-warning');
}
$(document).ready(function () {
});
</script>

View File

@@ -0,0 +1,60 @@
<script>
function OpenUpdateUserDetailsButtonHtml(){return HomeMenuButtons('assets/edituser.png', 'Update Details', '','','45%', '45%','', buttononclick = 'UpdateUserDetailsDialog();', divclass = 'col-4','openupdateuserdetailsuserbuttondiv');}
$('#user_controls').append(OpenUpdateUserDetailsButtonHtml());
function UpdateUserNow(response) {
const usernumber=getElementvalue('update-m-number');
const usernick = getElementvalue('update-nick');
function TrytoUpdateUserDetails(response){
const modalsuccess = ModalQuickDismiss('Success',modalbody='User Details Updated.',modalid='UpdateUserDetailsSuccess',modaltohide='UpdateUserDetailsDialog',ReloadPage,response);
const modalfailed = ModalQuickDismiss('Failed',modalbody='Unable to Update User Details.<br><br>'+response,modalid='UpdateUserDetailsFailed',modaltohide='',functiontodo='',response!==true);
}
AjaxDo('?admin/user/details/update', { user_target: currenttarget, user_number: usernumber, user_nick: usernick }, TrytoUpdateUserDetails, null, reqtype = 'POST');
}
function UpdateUserDetailsDialog() {
const usernumber = getElementhtml('User_phonenumber');
const usernick = getElementhtml('User_nick');
let modalbody = dualcolrow('Mobile Number',textformcontrol('update-m-number','','',placeholder='09xxxxxxxxx',usernumber))+'<br>'+
dualcolrow('Nickname',textformcontrol('update-nick','','','',usernick));
let modalfooter = `<button type="button" class="btn btn-warning" data-dismiss="modal">Cancel</button>
<button type="button" class="btn btn-danger" onclick="UpdateUserNow()" id="">Continue</button>`;
ModalContinueCancel("UpdateUserDetailsDialog",'Update User',modalbody,'UpdateUserNow();');
// CreateAndShowModal(modalid, modaltitle, modalbody, modalfooter, modalfooterclose = false, topclosebutton = true, modalbodyclass = 'modal-body', modalheaderclass = 'modal-header');
}
function EnableUser() {
let modalid = "EnableUserConfirmationDialog";
let modaltitle = 'Enable User?';
let modalbody = 'Are you sure you want to Enable user?<br> The user would have access his/her account?';
let modalfooter = `<button type="button" class="btn btn-warning" data-dismiss="modal">Cancel</button>
<button type="button" class="btn btn-danger" onclick="EnableUserNow()" id="">Continue</button>`;
CreateAndShowModal(modalid, modaltitle, modalbody, modalfooter, modalfooterclose = false, topclosebutton = true, modalbodyclass = 'modal-body', modalheaderclass = 'modal-header');
}
$(document).ready(function () {
});
</script>

View File

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

View File

@@ -0,0 +1,111 @@
<table id="Winning_Numbers_Today">
<thead>
<tr>
<th>Time</th>
<th>Type</th>
<th>User</th>
<th>Number</th>
<th>Amount</th>
</tr>
</thead>
<tbody>
</tbody>
</table>
<script>
function GenerateBetWinningRow(Time,Type,Nickname_Mnumber,btnumber,Amount,Hashkey){
let activecheckbox='';
//activecheckbox='<input class="form-control" type="checkbox" '+Active+' disabled>';
//const actionbutton =`<button class="btn btn-warning btn-block" onclick="gotoPage('UserModify','${Hashkey}')">View User</button>`;
Time=Time.replace(' ','<br>');
Type=Type.replace(' ','<br>');
Nickname_Mnumber=Nickname_Mnumber.replace(' ','<br>');
return `<tr>
<td>${Time}</td>
<td>${Type}</td>
<td>${Nickname_Mnumber}</td>
<td>${btnumber}</td>
<td>${Amount}</td>
</tr>`;
}
async function GenerateBetWinningRows(responsearray) {
let newhtmltable = '';
for (let i = 0; i < responsearray.length; i++) {
newhtmltable += GenerateBetWinningRow(
responsearray[i]['time'],
responsearray[i]['type'],
responsearray[i]['user'],
responsearray[i]['bet_number'],
responsearray[i]['amount'],
responsearray[i]['hashkey']
);
}
//$("#User_list_table").find("tbody").replaceWith(newhtmltable);
// new DataTable('#User_list_table');
$("#Winning_Numbers_Today").find("tbody").html(newhtmltable);
//new DataTable('#Winning_Numbers_Today');
new DataTable('#Winning_Numbers_Today', {
language: {
emptyTable: 'No Winning Numbers'
},
order: [[0, 'desc']],
"bDestroy": true
});
$('#secondary-card').fadeIn(200);
}
function GenerateWinningNumbersTodayTable(winning_numbers_today_draw_target_date='',winning_numbers_today_draw_target_parent=''){
AjaxDo('?admin/list/winning_numbers', { target_date: winning_numbers_today_draw_target_date, target_parent: winning_numbers_today_draw_target_parent}, GenerateBetWinningRows, null, reqtype = 'POST');
}
GenerateWinningNumbersTodayTable(winning_numbers_today_draw_target_date,winning_numbers_today_draw_target_parent);
if (home_page_card_html_auto_load_table_content===1){
setInterval(function () {
if (currentPage=='Home'){
GenerateWinningNumbersTodayTable(winning_numbers_today_draw_target_date,winning_numbers_today_draw_target_parent);
}
}, 300000);
}
</script>

View File

@@ -0,0 +1,202 @@
<br><br><br><br>
<div class="card" id="primary-card">
<div class="card-header ui-sortable-handle" style="cursor: move">
<h2 class="card-title" style="font-size: 2.5rem;" id="FinancialReportsDailyTargetDate">Financial Reports (Daily)
</h2>
<div class="card-tools">
<input type="date" class="form-control" id="FinancialReportsDailyTargetDateSelect">
</div>
</div>
<div class="card-body">
<table id="accounting_reports_list_table">
<thead>
</thead>
<tbody>
<tr>
<td>
<h4>Total Bet Amount </h4>
</td>
<td>
<h4 id="totalbetamountfield_AccountingFinancialReportDaily">+</h4>
</td>
</tr>
<tr>
<td>
<h4>Commission for Team Players (15%)</h4>
</td>
<td>
<h4 id="commissionamountplayer_AccountingFinancialReportDaily">-</h4>
</td>
</tr>
<tr>
<td>
</td>
<td>
<b>
<h4 id="BetAmountMinusCommissionPlayers_AccountingFinancialReportDaily"></h4>
</b>
</td>
</tr>
<tr>
<td>
</td>
<td>
<h4 id=""></h4>
</td>
</tr>
<tr>
<td>
<h4>Total Prizes to Dispense</h4>
</td>
<td>
<h4 id="totalprizesamountfield_AccountingFinancialReportDaily">-</h4>
</td>
</tr>
<tr id='NetRevenueRowAccountFinancialReportsDaily'>
<td>
<h4><b id="NetRevenueLabel">Net Revenue</b></h4>
</td>
<td>
<b>
<h4 id="NetRevenueAmountfield_AccountingFinancialReportDaily"></h4>
</b>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<br><br><br>
<script>
if (typeof targetdate === 'undefined' || targetdate === null) {
targetdate = '';
}
function GenerateDailyAccountingFinancialReportsNow(response) {
if (typeof currenttarget === 'object' && currenttarget.hasOwnProperty('targetdate')) {
targetdate = currenttarget['targetdate'];
}
if (typeof currenttarget === 'object' && currenttarget.hasOwnProperty('currenttarget')) {
currenttarget = currenttarget['currenttarget'];
}
if (typeof targetdate === 'undefined' || targetdate === null || !targetdate) {
targetdate = getDateInGMT8();
targetdateObject = new Date(getDateInGMT8());
}
targetdateObject = new Date(targetdate);
texttargetdate = formatDate(targetdateObject);
commissionprizeplayer = response.totalbetamount * 0.15;
betMinusCommission = response.totalbetamount - commissionprizeplayer;
NetRevenueAmount = betMinusCommission - response.totalamountofprizes;
if (NetRevenueAmount < 0) {
$('#NetRevenueLabel').html('Net Loss');
$('#NetRevenueAmountfield_AccountingFinancialReportDaily').css('color', 'red');
$('#NetRevenueRowAccountFinancialReportsDaily').css('color', 'red');
$('#NetRevenueRowAccountFinancialReportsDaily').css('border', '2px solid red');
} else {
$('#NetRevenueLabel').html('Net Gain');
$('#NetRevenueAmountfield_AccountingFinancialReportDaily').css('color', 'black');
$('#NetRevenueRowAccountFinancialReportsDaily').css('color', 'black');
$('#NetRevenueRowAccountFinancialReportsDaily').css('border', '2px solid black');
}
commissionprizeplayer = formatCurrency(commissionprizeplayer);
betMinusCommission = formatCurrency(betMinusCommission);
NetRevenueAmount = formatCurrency(NetRevenueAmount);
totalbetamount = formatCurrency(response.totalbetamount);
totalamountofprizes = formatCurrency(response.totalamountofprizes);
$('#FinancialReportsDailyTargetDate').html('Financial Reports for ' + texttargetdate);
$('#totalbetamountfield_AccountingFinancialReportDaily').html('+ ' + totalbetamount);
$('#totalprizesamountfield_AccountingFinancialReportDaily').html('- ' + totalamountofprizes);
$('#commissionamountplayer_AccountingFinancialReportDaily').html('- ' + commissionprizeplayer);
$('#BetAmountMinusCommissionPlayers_AccountingFinancialReportDaily').html(' &nbsp<b>' + betMinusCommission + '</b>');
$('#NetRevenueAmountfield_AccountingFinancialReportDaily').html(' &nbsp<b>' + NetRevenueAmount + '</b>');
}
function GenerateAccountFinancialReportDaily() {
AjaxDo('?Accounting/FinancialReport/Daily', { targetdate: targetdate, currenttarget: currenttarget }, GenerateDailyAccountingFinancialReportsNow, null, reqtype = 'POST');
}
GenerateAccountFinancialReportDaily();
TargetdateInput = document.getElementById('FinancialReportsDailyTargetDateSelect');
TargetdateInput.value = getDateInGMT8();
TargetdateInput.addEventListener('change', function () {
targetdate = TargetdateInput.value;
GenerateAccountFinancialReportDaily();
});
</script>
<style>
table {
width: 100%;
border-collapse: collapse;
margin-bottom: 20px;
}
th,
td {
border: 1px solid #ddd;
padding: 8px;
text-align: left;
}
th {
background-color: #f2f2f2;
}
</style>

View File

@@ -0,0 +1,83 @@
<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;">Accounting Reports</h1>
<div class="card-tools">
</div>
</div>
<div class="card-body">
<table id="accounting_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 GenerateAccountingReportsListRow(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 GenerateAccountReportsListRows(responsearray) {
let newhtmltable = [];
for (let i = 0; i < responsearray.length; i++) { newhtmltable.push(GenerateAccountingReportsListRow(responsearray[i])); }
$("#accounting_reports_list_table").find("tbody").html(newhtmltable.join(''));
let reportslist = $("#accounting_reports_list_table").DataTable({
"destroy": true,
order: [[0, 'desc']],
pageLength: 5,
lengthMenu: [[5], [5]]
});
$('#primary-card').fadeIn(200);
}
function GenerateAccountingReportsListTable() {
AjaxDo('?AccountingReports/List', null, GenerateAccountReportsListRows, null, reqtype = 'POST');
}
GenerateAccountingReportsListTable();
</script>

View File

@@ -0,0 +1,6 @@
<script>
$('#usertypecontrol').show();
$('#userparentcontrol').show();
$('#user-create-nickname-input-group').show();
RePopulateParentList();
</script>

View File

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

View File

@@ -0,0 +1,8 @@
<script>
function OpenTransferMyCreditButtonHtml(){return HomeMenuButtons('assets/transfercredit.png', 'Transfer My Credit', '','','45%', '45%','', buttononclick = "gotoPage('transfer_my_credit',currenttarget);", divclass = 'col-4','opentransfermycreditforuserbuttondiv');}
$('#user_controls').append(OpenTransferMyCreditButtonHtml());
</script>

View 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>

View 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>

View 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>

View 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>

View 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>

View 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>

View 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>

View 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>

View 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>

View 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>

View 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>

View 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>

View 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>

View 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>

View 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>

View 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>

View File

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

View File

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

View File

View File

@@ -0,0 +1,209 @@
<style>
.ListRowCard {
margin-bottom: 5px;
}
</style>
<div id="MainView">
<div class="row">
<div class="col-md" style="overflow:hidden;">
<a href="javascript:void(0);" onclick="">
<div class="card ListRowCard" id="ListRowCard-0" style="">
<div id="cardheader-ListRowCard-0" class="card-header ui-sortable-handle"
style="cursor: move;display:none;">
<h3 class="card-title" style="" id="card-title-ListRowCard-0"></h3>
<div class="card-tools" id="card-tools-ListRowCard-0">
</div>
</div>
<div class="card-body ListCardRow" id="card-body-ListRowCard-0">
<div style="text-align:center;" id="PhotosCard">
</div>
<br>
<div class="row" style="">
<div class="col">
<h3 id="StoreNameMarketPlace"></h3>
</div>
<div class="col" id="StoreLocationMarketPlace"></div>
</div>
<ul class="mt-3 box-outstanding-service" id="ControlsAddCartBuy">
<li onclick="LoadDataPageFunc.ViewAllStoreDetails();return false;">
<div class="">
<img src="/assets/search.png" style="width: 30; height: 30;" class="icon-user">
</div>More Details
</li>
<li onclick="LoadDataPageFunc.Report();return false;">
<div class="">
<img src="/assets/reportaccount.png" style="width: 30; height: 30;"
class="icon-user">
</div>Report
</li>
</ul>
</div>
</div>
</div>
</a>
</div>
<div class="col-md" style="overflow:hidden;">
<a href="javascript:void(0);" onclick="">
<div class="card ListRowCard" id="ListRowCard-2" style="">
<div class="card-body ListCardRow" id="card-body-ListRowCard-2">
<div style="text-align:center;" id="StoreDescription">
</div>
<h5></h5>
</div>
</div>
</a>
</div>
<div class="col-md" style="overflow:hidden;" id="StoreProductsColumn">
</div>
<div class="col-md" style="overflow:hidden;display: none;" id="ReviewsCard">
<UI type="card" id="ReviewsCard" title="Reviews" tools="no">
content
</UI>
</div>
</div>
</div>
<script>
LoadDataPageFunc = {};
LoadDataPageFunc.PageTitle = 'Store Details';
LoadDataPageFunc.MainDetailsURL = '';
LoadDataPageFunc.Details = {};
LoadDataPageFunc.Settings = {};
LoadDataPageFunc.Disabled = false;
LoadDataPageFunc.ProductsListNewCard = function (object, rownum) {
if (!object || rownum === false || rownum === null || typeof rownum === undefined) {
return '';
}
let hash =object.hashkey || false;
let name = object.name || '';
let price = object.price || '';
let photo = object.photourl || '';
const unit = object.unitname || '';
if(!hash){return '';}
if (typeof photo ==='array'){
photo =photo[0];
}
name = trimStringToMaxLength(name, 16, suffix = '');
// price = trimStringToMaxLength(price, 16, suffix = '');
const productColumnSize='6';
const newcol = function (colinner, colsize = "12", style='') {
return `<div class="col-${colsize}" style="${style}">${colinner}</div>`;
}
/* html */
const imgelement =`
<img id="marketplacelistproductphoto-1" src="${photo}" loading="lazy" class="StoreProductsIMGMarket"
style="width: 60%;height: 60%;object-fit: contain;">
`;
/* html */
let finalcontent =imgelement+`<br><div class="row" style=""><div class="col"><h4>${name}</h4></div></div>`;
finalcontent +=`<div class="row" style=""><div class="col"><h6>P${price} / ${unit}</h6></div></div>`;
const maincolstyle='';
return newcol(`<center onclick="gotoPage('BuyViewProductMarket','${hash}')">`+CreateCardSimple(false, finalcontent, 'StoreProductCard-' + rownum,'width: 100%; height: 100%; object-fit: cover;')+'</center>',productColumnSize,maincolstyle);
}
LoadDataPageFunc.UpdateProductsListCard = function (productslist) {
const isempty = typeof productslist === 'array' || productslist.length === 0;
if (!productslist || isempty) {
$('#card-body-StoreProductsCard').html('<p style="text-align:center;">No Products</p>');
return false;
}
let cardarray = [];
cardarray.push('<div class="row" style="">');
iterateArray(productslist, (data, rownum) => {
cardarray.push(LoadDataPageFunc.ProductsListNewCard(data, rownum));
});
cardarray.push('</div>');
const finalhtml = cardarray.join('');
$('#card-body-StoreProductsCard').html(finalhtml);
LoadPhotoIMGTargetClass('StoreProductsIMGMarket', settodisplaylater = true) ;
return true;
};
LoadDataPageFunc.PopulateDetailsNow = function (name, description, address, category, subcategory, products) {
$('#StoreNameMarketPlace').html(name);
$('#StoreDescription').html(description);
$('#StoreLocationMarketPlace').html(address);
const StoreProductsColumn = UICardSimple('Products', text = '', id = 'StoreProductsCard');
$('#StoreProductsColumn').html(StoreProductsColumn);
LoadDataPageFunc.UpdateProductsListCard(products);
};
LoadDataPageFunc.ViewPhotosLink = function (){
const datasend = {t:currenttarget,type: LoadDataPageFunc.Settings.Phototype};
ButtonGo('ViewAllPhotos',datasend);
}
LoadDataPageFunc.Settings.Phototype = "StoreMarket";
LoadDataPageFunc.StoreLoadErrorModal=function(){
ModalQuickDismiss(false, 'Store Not Available!', 'UnavailableStoreModal');
}
LoadDataPageFunc.PopulateDetails = function () {
let description;
let photosarray;
if (!currenttarget){LoadDataPageFunc.StoreLoadErrorModal();}
const UpdateDetailsUI = function (response) {
if (!response) {
LoadDataPageFunc.StoreLoadErrorModal();
return false;
}
Preloaders.ImageList(currenttarget,LoadDataPageFunc.Settings.Phototype);
LoadPhotosCard('PhotosCard', "LoadDataPageFunc.ViewPhotosLink();", response.photourl);
LoadDataPageFunc.PopulateDetailsNow(response.name, response.description, response.address, response.category, response.subcategory, response.products);
};
Preloaders.ViewStoreinMarket(currenttarget, true, UpdateDetailsUI);
};
LoadDataPageFunc.Main = function () {
changeTopbarTitle(LoadDataPageFunc.PageTitle);
LoadDataPageFunc.PopulateDetails();
};
LoadDataPageFunc.Main();
</script>

View 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>

View 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>

View 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>

View 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>

View 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>

View 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>

View 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>

View 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>

View 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>

View 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>

View 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>

View File

View 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"]
}

View File

@@ -0,0 +1,238 @@
<br><br><br><br>
<div class="card" id="secondary-card" style="display:none;">
<div class="card-header ui-sortable-handle" style="cursor: move;">
<h3 class="card-title">Credit Requests</h3>
<div class="card-tools"></div>
</div>
<div class="card-body">
<table id="Credit_Requests_list_table">
<thead>
<tr>
<th>From</th>
<th>User</th>
<th>Request<br>Date</th>
<th>Request<br>Amount</th>
<th>ACTION</th>
</tr>
</thead>
<tbody>
</tbody>
</table>
</div>
</div>
<script>
function ApproveCreditRequestSuccessModal(Number, amount) {
const modalid = "modal-approve-credit_request-success";
const modaltitle = "Success";
const modalbody = `
<p>The following Credit Request is approved.</p><br>`+ CreditRequestMessageSpecificAmmountsandRequestor(Number, amount);
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-approve-credit_request-confirmation').modal('hide');
ReloadPage();
}
function ApproveCreditRequestFailedModal(Number, amount,response) {
if (!response){response='';}
const modalid = "modal-approve-credit_request-failed";
const modaltitle = "Error";
const modalbody = `
<p>Error! The following Credit request was not approved. Please try again later.</p><br>`+ CreditRequestMessageSpecificAmmountsandRequestor(Number, amount)+
`<br><br>`+response;
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-approve-credit_request-confirmation').modal('hide');
ReloadPage();
}
function ApproveCreditRequest(Number, amount, hashkey) {
function ApproveCreditRequestNow(response) {
if (response === true) {
ApproveCreditRequestSuccessModal(Number, amount);
} else if (response === false) {
ApproveCreditRequestFailedModal(Number, amount);
} else {
ApproveCreditRequestFailedModal(Number, amount,response);
}
}
AjaxDo('?admin/advanced/credit_request/approve', {
target_hash: hashkey
}, ApproveCreditRequestNow, null, reqtype = 'POST');
}
function RejectCreditRequestSuccessModal(Number, amount) {
const modalid = "modal-reject-credit_request-success";
const modaltitle = "Success";
const modalbody = `
<p>The following Credit Request is Denied.</p><br>` + CreditRequestMessageSpecificAmmountsandRequestor(Number, amount);
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-reject-credit_request-confirmation').modal('hide');
ReloadPage();
}
function RejectCreditRequestFailedModal(Number, amount) {
const modalid = "modal-reject-credit_request-failed";
const modaltitle = "Failed";
const modalbody = `
<p>Error! The following Credit Request was not Denied. Please try again later</p><br>` + CreditRequestMessageSpecificAmmountsandRequestor(Number, amount);
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-reject-credit_request-confirmation').modal('hide');
ReloadPage();
}
function RejectCreditRequest(Number, amount, hashkey) {
function RejectCreditRequestNow(response) {
if (response === true) {
RejectCreditRequestSuccessModal(Number, amount);
} else if (response === false) {
RejectCreditRequestFailedModal(Number, amount);
}
}
AjaxDo('?admin/advanced/credit_request/reject', {
target_hash: hashkey
}, RejectCreditRequestNow, null, reqtype = 'POST');
}
function CreditRequestMessageSpecificAmmountsandRequestor(Number, amount) {
return ` Requested By : ${Number}<br>
Amount&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp &nbsp: ${amount}<br>`;
}
function ApproveCreditRequestModal(Number, amount, Hashkey) {
const modalid = "modal-approve-credit_request-confirmation";
const modaltitle = "Approve";
const modalbody = `
<p>Are You sure you want to approve the credit request?</p><br>` +
CreditRequestMessageSpecificAmmountsandRequestor(Number, amount);
const modalfooter = `<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
<button type="button" class="btn btn-primary" onclick="ApproveCreditRequest('${Number}',${amount},'${Hashkey}');" id="approve-credit-request">Continue</button>`;
CreateAndShowModal(modalid, modaltitle, modalbody, modalfooter, modalfooterclose = false, topclosebutton = true, modalbodyclass = 'modal-body', modalheaderclass = 'modal-header');
}
function RejectCreditRequestModal(Number, amount, Hashkey) {
const modalid = "modal-reject-credit_request-confirmation";
const modaltitle = "Reject";
const modalbody = `
<p>Are you sure you want to deny the credit request?</p><br>` +
CreditRequestMessageSpecificAmmountsandRequestor(Number, amount);
const modalfooter = `<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
<button type="button" class="btn btn-primary" onclick="RejectCreditRequest(${Number},${amount},'${Hashkey}');" id="approve-credit-request">Continue</button>`;
CreateAndShowModal(modalid, modaltitle, modalbody, modalfooter, modalfooterclose = false, topclosebutton = true, modalbodyclass = 'modal-body', modalheaderclass = 'modal-header');
}
function GenerateCreditRequestDetailsRow(From,To, date, amount, status, Hashkey) {
let activecheckbox = '';
const approvebutton = `<button class="btn btn-warning btn-block" onclick="ApproveCreditRequestModal('${To}',${amount},'${Hashkey}')">Approve</button>`;
const rejectbutton = `<button class="btn btn-danger btn-block" onclick="RejectCreditRequestModal('${To}',${amount},'${Hashkey}')">Reject</button>`;
if (status === 0) {
actionbutton = approvebutton + rejectbutton;
} else if (status === -1) {
actionbutton = 'Denied';
} else if (status === 1) {
actionbutton = 'Approved';
}else if (status === 2) {
actionbutton = 'Directly Sent by You.';
}
return `<tr>
<td>${From}</td>
<td>${To}</td>
<td>${date}</td>
<td>${amount}</td>
<td>${actionbutton}</td>
</tr>`;
}
async function GenerateCreditRequestRows(responsearray) {
//console.log(responsearray);
$("#Credit_Requests_list_table").find("tbody").html('');
let newhtmltable = '';
for (let i = 0; i < responsearray.length; i++) {
newhtmltable += GenerateCreditRequestDetailsRow(responsearray[i]['creditor'],responsearray[i]['target_user'], responsearray[i]['request_date'], responsearray[i]['amount'], responsearray[i]['status'], responsearray[i]['hashkey']);
}
//$("#User_list_table").find("tbody").replaceWith(newhtmltable);
// new DataTable('#User_list_table');
$("#Credit_Requests_list_table").find("tbody").html(newhtmltable);
$("#Credit_Requests_list_table").DataTable({
"destroy": true,
order: [
[1, 'desc']
],
pageLength: 5,
lengthMenu: [
[5],
[5]
]
})
$('#secondary-card').fadeIn(200);
}
function GenerateCreditRequestTable() {
AjaxDo('?admin/list/credit_requests', null, GenerateCreditRequestRows, null, reqtype = 'POST');
}
GenerateCreditRequestTable();
</script>

View File

@@ -0,0 +1,50 @@
<script id="main-script">
cardshtml='<br><br><br>'+CreateBalanceCard(titletext='Welcome Team Leader',maincardid='main-card-body',firstrowtext='Total Balance',firstrowvalueid='total-balance',firstrowvaluetext='...' ,secondrowtext='',secondrowvalueid='',secodrowvaluetext='',secondrowvisible=false,footerrowid='phone-number',footerrowtext='...')
+ `<br><br>`;
cardshtml+= createCard(cardtitle='',cardid='secondary-card',cardtools='',cardbodyid='HomeMenuButtons',cardbodytext='',cardbodyclassadd='row','',true);
cardshtml+= createCard(cardtitle='Draws Today',cardid='draws',cardtools='',cardbodyid='div_draw_numbers_today',cardbodytext='',cardbodyclassadd='',maincardstyle='');
cardshtml+= createCard(cardtitle='Winning Numbers Today',cardid='winning-numbers-today-home',cardtools='',cardbodyid='div_winning_numbers_today',cardbodytext='',cardbodyclassadd='',maincardstyle='');
cardshtml+='<br><br>';
$('#main-body').html(cardshtml);
loaddrawnumberstoday();
loadwinningnumberstoday();
if (typeof HomeButtonsHtml === 'undefined') {
let HomeButtonsHtml = '';
}
HomeButtonsHtml='';
HomeButtonsHtml = HomeMenuButtons('assets/qrcode.svg','Scan QR', 'qr_reader',0,'35%','35%');
HomeButtonsHtml += HomeMenuButtons('assets/user-list.png','Users', 'user_list',0,'20%','35%');
HomeButtonsHtml += HomeMenuButtons('assets/lotteryschedule.png','Game Schedule', 'lottery_schedule',0,'20%','50%');
HomeButtonsHtml += HomeMenuButtons('assets/CreateUser.png','Create User', 'create_user',0,'20%','40%');
HomeButtonsHtml += HomeMenuButtons('assets/creditrequests.png','Credit Requests', 'credit_requests',0,'20%','40%');
HomeButtonsHtml += HomeMenuButtons('assets/request-credit.png','Request Credit', 'request_credit',0,'20%','40%');
HomeButtonsHtml += HomeMenuButtons('assets/reports.png','Reports', 'MyReports',0,'20%','40%');
HomeButtonsHtml += HomeMenuButtons('assets/gear.png','Account Settings', 'account_settings',0,'20%','40%');
$('#HomeMenuButtons').html(HomeButtonsHtml);
//$("#balance_bottom_nav").hide();
$('#bets_history_bottom_nav').hide();
loaduserdatadashboard();
loaddrawnumberstoday();
loadwinningnumberstoday();
setInterval(loaduserdatadashboard, '20000');
setInterval(loaddrawnumberstoday, '20000');
setInterval(loadwinningnumberstoday, '20000');
</script>

View File

@@ -0,0 +1,25 @@
<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 ">
<div class="row card-body">
<div class="col-md-6" style="padding-bottom: 1.5rem;">
<button class="btn-block btn-lg" onclick="ButtonGo('DailyBetsTransfersProfitsSummary',0);">Daily Summary of Transfers, Bets, Prizes and Profits </button>
</div>
<div class="col-md-6" style="padding-bottom: 1.5rem; display:none;">
<button class="btn-block btn-lg" onclick="ButtonGo('DailyTransfersReport',0);">Daily Transfers</button>
</div>
<div class="col-md-6" style="padding-bottom: 1.5rem; display:none;">
<button class="btn-block btn-lg" onclick="ButtonGo('BetAmountsAndPrizes30Days',0);">Bet Amounts And Prizes for
the Last 30 Days</button>
</div>
</div>
</div>
</div>

View File

@@ -0,0 +1,52 @@
<br><br><br>
<div class="card" 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-6" id="user_list_button"><button onclick=" ButtonGo('user_list',0);" class="bg-transparent border-0 btn-block" style="" onclick="">
<div class="card-body box-profile">
<div class="text-center">
<img class=" img-circle rounded mx-auto d-block" src="assets/users.png" width="40%" height="40%" style="overflow:hidden;"></div>
<h3 class="profile-username text-center">Users</h3>
<p class="text-muted text-center"></p>
</div>
</button></div>
<div class="col-6" id="accountsettingsbutton"><button onclick=" ButtonGo('account_settings',0);" class="bg-transparent border-0 btn-block" onclick="">
<div class="card-body box-profile">
<div class="text-center">
<img class="rounded mx-auto d-block" src="assets/gear.png" width="40%" height="40%" style="overflow:hidden;"></div>
<h3 class="profile-username text-center">Account Settings</h3>
<p class="text-muted text-center"></p>
</div>
</button></div>
</div></div>
</div>
<script id="main-script">
//loaduserdatadashboard();
</script>

View File

@@ -0,0 +1,3 @@
<script>
$('<option value=""></option>').val('coordinator').text('Coordinator').appendTo($("#usertype"));
</script>

View File

@@ -0,0 +1,565 @@
<br><br><br>
<div class="card" id="secondary-card">
<div class="card-header ui-sortable-handle" style="cursor: move;">
<h3 class="card-title" style="" id="draw_date"></h3>
<div class="card-tools">
</div>
</div>
<div class="card-body">
<div class="row">
<div class="col">
Date
<br>
<h4 id="draw_date_text">...</h4>
</div>
<div class="col">
Game
<br>
<h4 id="game_name_text">...</h4>
</div>
<div class="col">
Winning Numbers
<br>
<h4 id="winning_numbers_text">...</h4>
</div>
<div class="col">
<center>Active</center>
<br>
<input type="checkbox" disabled class="form-control" id="draw_active">
</div>
</div>
<br><br>
<div class="row" style="" id="draw_details_controls">
<div class="col mx-auto" id="UpdateWinningNumbersDrawDetailsShowModalButton" style="display:none;">
<buttton onclick="UpdateWinningNumbersModal();" id="DrawUpdateModalShowButton"
class="btn btn-primary btn-block">Update Winning Numbers
</buttton>
</div>
<div class="col mx-auto" id="DisableDrawDetailsButton" style="display:none;">
<buttton onclick="DrawDisableModal()" id="DrawDisableModalShowButton" class="btn btn-warning btn-block">
Disable Draw
</buttton>
</div>
</div>
</div>
</div>
<div class="card" id="third-card">
<div class="card-header ui-sortable-handle" style="cursor: move;">
<h3 class="card-title" style="" id="draw_winning_numbers">Winning Bets</h3>
<div class="card-tools">
</div>
</div>
<div class="card-body">
<table id="bet_list_table">
<thead>
<tr>
<th>Date</th>
<th>User</th>
<th>Amount</th>
<th >Total<br>Prize</th>
</tr>
</thead>
<tbody>
</tbody>
</table>
<br><br>
</div>
</div>
<div class="card" id="numbers-tally-board-card">
<div class="card-header ui-sortable-handle" style="cursor: move;">
<h3 class="card-title" style="" id="draw_tally_board_numbers">Tally Board</h3>
<div class="card-tools">
</div>
</div>
<div class="card-body">
<table id="numbers_tally_board_table">
<thead>
<tr>
<th>Number</th>
<th>Number of Bets</th>
<th>Total Amount</th>
</tr>
</thead>
<tbody>
</tbody>
</table>
<br><br>
</div>
</div>
<div class="card" id="hot_number-card">
<div class="card-header ui-sortable-handle" style="cursor: move;">
<h3 class="card-title" style="" id="draw_hot_numbers">Hot Numbers</h3>
<div class="card-tools">
</div>
</div>
<div class="card-body">
<table id="hot_numbers_table">
<thead>
<tr>
<th>Number</th>
<th>Limit of Bets</th>
<th></th>
</tr>
</thead>
<tbody>
</tbody>
</table>
<br><br>
</div>
<button class="btn btn-primary btn-block" onclick="ModalNewHotNumber();">New Hot Number</button>
</div>
<br><br><br>
<script>
function CreateNewHotNumber(){
let targetHotNumbers = $('#new-hot-number-draw-details').val();
let no_of_bets = $('#new-hot-number-draw-details-noofbets').val();
if (!targetHotNumbers){
ModalQuickDismiss('modal-draw-details-no-hot-number-warning','Please Enter a Hot Number.','modal-new-hot-number-target-numbers-warning-no-numbers');
return false;
}
function TryNewHotNumbers(response){
if (response===true){
ModalQuickDismiss('Sucess','Hot Number Added.','modal-draw-details-add-hot-numbers-success','modal-new-hot-number',ReloadPage);
modalhide('modal-new-hot-number');
}else{
ModalQuickDismiss('Failed','Unable to Add Hot Number.'+response,'modal-draw-details-add-hot-numbers-failed');
}}
AjaxDo('?admin/draw/hotnumber/create', {target_draw : currenttarget, target_numbers: targetHotNumbers, no_of_bets: no_of_bets}, TryNewHotNumbers, null, reqtype = 'POST');
}
function ModalNewHotNumber(){
let modalbody = dualcolrow('Hot Number',textformcontrol('new-hot-number-draw-details'))+'<br>'+
dualcolrow('Maximum Number of Bets','<input type="number" class="form-control" value=0 id="new-hot-number-draw-details-noofbets">')+
'<br><center>0 for blocking instantly.</center>';
ModalContinueCancel('modal-new-hot-number','New Hot Number',modalbody,'CreateNewHotNumber();',cancelbuttontext='Cancel',continuebuttontext='Add',continuebuttoncss='btn btn-danger',cancelbuttoncss='btn btn-warning');
}
function DeleteHotNumber(targethash){
if (!targethash){return false;}
function DeleteHotNumberDrawDetailsResult(response){
if (response===true){
ModalQuickDismiss('Success','Deleted Hot Number',modalid='modal-hotnumber-delete-success-draw-details',modaltohide='',ReloadPage,conditiontrue=true);
}else{
ModalQuickDismiss('Failed','Unable to Delete Hot Number. <br><br>'+response,modalid='modal-hotnumber-delete-success-draw-details');
}}
AjaxDo('?admin/draw/hotnumber/delete', {target_hot_number : targethash}, DeleteHotNumberDrawDetailsResult, null, reqtype = 'POST');
}
function GenerateDrawWinningBetsRow(Date, User, Amount, Hashkey,TotalPrize) {
let activecheckbox = '';
User = User.replace(' ','<br>');
const viewdetails = `<button class="btn btn-warning btn-block" onclick="gotoPage('draw_details','`+Hashkey+`')">View</button>`;
return `<tr>
<td>${Date}</td>
<td>${User}</td>
<td>${Amount}</td>
<td>${TotalPrize}</td>
</tr>`;
}
async function GenerateDrawWinningBetsListRows(responsearray) {
//console.log(responsearray);
$("#bet_list_table").find("tbody").html('');
let newhtmltable = '';
function replaceSpacesWithBR(str) {
return str.replace("/\s/g", "<br>");
}
for (let i = 0; i < responsearray.length; i++) {
let betdate=responsearray[i]['bet_date'];
//betdate=replaceSpacesWithBR(betdate);
newhtmltable += GenerateDrawWinningBetsRow(betdate, responsearray[i]['user'], responsearray[i]['amount'],responsearray[i]['hashkey'],responsearray[i]['totalprize']);
}
// $("#Draws_list_table").find("tbody").replaceWith(newhtmltable);
// new DataTable('#User_list_table');
$("#bet_list_table").find("tbody").html(newhtmltable);
$("#bet_list_table").DataTable({
"destroy": true,
order: [
[1, 'desc']
],
pageLength: 5,
lengthMenu: [
[5],
[5]
]
})
$('#third-card').fadeIn(200);
}
function GenerateBetsDrawsTable() {
AjaxDo('?admin/draw/list/winning/numbers', {target_draw : currenttarget}, GenerateDrawWinningBetsListRows, null, reqtype = 'POST');
}
GenerateBetsDrawsTable();
function GenerateDrawNumbersTallyRow(Numbers,NumberofBets, TotalAmount) {
return `<tr>
<td>${Numbers}</td>
<td>${NumberofBets}</td>
<td>${TotalAmount}</td>
</tr>`;
}
async function GenerateDrawNumbersTallyListRows(responsearray) {
$("#numbers_tally_board_table").find("tbody").html('');
let newhtmltable = '';
for (let i = 0; i < responsearray.length; i++) {
newhtmltable += GenerateDrawNumbersTallyRow(responsearray[i]['numbers'],responsearray[i]['numberofbets'], responsearray[i]['totalamount']);
}
$("#numbers_tally_board_table").find("tbody").html(newhtmltable);
$("#numbers_tally_board_table").DataTable({
"destroy": true,
order: [
[0, 'asc']
],
pageLength: 5,
lengthMenu: [
[5],
[5]
]
});
$('#numbers-tally-board-card').fadeIn(200);
}
function GenerateDrawNumbersTallyTable() {
AjaxDo('?admin/draw/list/tally', {target_draw : currenttarget}, GenerateDrawNumbersTallyListRows, null, reqtype = 'POST');
}
GenerateDrawNumbersTallyTable();
function GenerateHotNumbersRow(Numbers,NumberofBets, Hashkey) {
if (NumberofBets===0){NumberofBets='Block All Incoming Bets';}
let activecheckbox = '';
const deletebutton = `<button class="btn btn-warning btn-block" onclick="DeleteHotNumber('`+Hashkey+`')">Delete</button>`;
return `<tr>
<td>${Numbers}</td>
<td>${NumberofBets}</td>
<td>${deletebutton}</td>
</tr>`;
}
async function GenerateHotNumbersListRows(responsearray) {
$("#hot_numbers_table").find("tbody").html('');
let newhtmltable = '';
function replaceSpacesWithBR(str) {
return str.replace("/\s/g", "<br>");
}
for (let i = 0; i < responsearray.length; i++) {
newhtmltable += GenerateHotNumbersRow(responsearray[i]['numbers'],responsearray[i]['no_of_bets'], responsearray[i]['hashkey']);
}
$("#hot_numbers_table").find("tbody").html(newhtmltable);
$("#hot_numbers_table").DataTable({
"destroy": true,
order: [
[0, 'asc']
],
pageLength: 5,
lengthMenu: [
[5],
[5]
]
});
$('#hot_number-card').fadeIn(200);
}
function GenerateHotNumbersDrawsTable() {
AjaxDo('?admin/draw/list/hotnumber', {target_draw : currenttarget}, GenerateHotNumbersListRows, null, reqtype = 'POST');
}
GenerateHotNumbersDrawsTable();
function EnableDrawSuccessful(){
hidemodal('modal-confirm-enable-draw');
const modalid = "modal-enable-draw-success";
const modaltitle = "Success";
const modalbody = `<p>Draw Enabled</p><br>`;
const modalfooter = `<button type="button" class="btn btn-default" onclick="ReloadPage();modalhide('modal-enable-draw-success');">Ok</button>`;
CreateAndShowModal(modalid, modaltitle, modalbody, modalfooter, modalfooterclose = false, topclosebutton = true, modalbodyclass = 'modal-body', modalheaderclass = 'modal-header');
}
function EnableDrawFailed(response){
const modalid = "modal-enable-draw-failed";
const modaltitle = "Failed";
const modalbody = `
<p>Unable to Enable Draw. Try Again later.</p><br>
<p>${response}</p>`;
const modalfooter = `<button type="button" class="btn btn-default" data-dismiss="modal">OK</button> `;
CreateAndShowModal(modalid, modaltitle, modalbody, modalfooter, modalfooterclose = false, topclosebutton = true, modalbodyclass = 'modal-body', modalheaderclass = 'modal-header');
}
function EnableDrawNow(){
function EnableDrawResponse(response){
if (response === true){ EnableDrawSuccessful();}
else{ EnableDrawFailed(response);}
}
AjaxDo('?admin/draw/enable', { target_draw: currenttarget}, EnableDrawResponse, null, reqtype = 'POST');
}
function DrawEnableModal(){
const modalid = "modal-confirm-enable-draw";
const modaltitle = "Confirm";
const modalbody = `
<p>Are you sure you wish to enable the current draw?</p><br>`;
const modalfooter = `<button type="button" class="btn btn-default" onclick="hidemodal('modal-confirm-enable-draw')">No</button>
<button type="button" class="btn btn-primary" onclick="EnableDrawNow();">Yes</button>`;
CreateAndShowModal(modalid, modaltitle, modalbody, modalfooter, modalfooterclose = false, topclosebutton = true, modalbodyclass = 'modal-body', modalheaderclass = 'modal-header');
}
function DisableDrawSuccessful(){
hidemodal('modal-confirm-disable-draw');
const modalid = "modal-disable-draw-success";
const modaltitle = "Success";
const modalbody = `<p>Draw Disabled</p><br>`;
const modalfooter = `<button type="button" class="btn btn-default" onclick="ReloadPage();modalhide('modal-disable-draw-success');">Ok</button>`;
CreateAndShowModal(modalid, modaltitle, modalbody, modalfooter, modalfooterclose = false, topclosebutton = true, modalbodyclass = 'modal-body', modalheaderclass = 'modal-header');
}
function DisableDrawFailed(response){
const modalid = "modal-disable-draw-failed";
const modaltitle = "Failed";
const modalbody = `
<p>Unable to Disable Draw. Try Again later.</p><br>
<p>${response}</p>`;
const modalfooter = `<button type="button" class="btn btn-default" data-dismiss="modal">OK</button> `;
CreateAndShowModal(modalid, modaltitle, modalbody, modalfooter, modalfooterclose = false, topclosebutton = true, modalbodyclass = 'modal-body', modalheaderclass = 'modal-header');
}
function DisableDrawNow(){
function DisableDrawResponse(response){
if (response === true){ DisableDrawSuccessful();}
else{ DisableDrawFailed(response);}
}
AjaxDo('?admin/draw/disable', { target_draw: currenttarget}, DisableDrawResponse, null, reqtype = 'POST');
}
function DrawDisableModal(){
const modalid = "modal-confirm-disable-draw";
const modaltitle = "Confirm";
const modalbody = `
<p>Are you sure you wish to disable the current draw?</p><br>`;
const modalfooter = `<button type="button" class="btn btn-default" data-dismiss="modal">No</button>
<button type="button" class="btn btn-primary" onclick="DisableDrawNow();">Yes</button>`;
CreateAndShowModal(modalid, modaltitle, modalbody, modalfooter, modalfooterclose = false, topclosebutton = true, modalbodyclass = 'modal-body', modalheaderclass = 'modal-header');
}
function ModalWinningNumbersUpdateSuccessful(){
hidemodal('modal-update-winning-numbers');
const modalid = "modal-confirm-update-winningnumbers-successful";
const modaltitle = "Success";
const modalbody = `
<p>Winning Numbers Updated</p><br>`;
const modalfooter = `<button type="button" class="btn btn-default" onclick="ReloadPage();modalhide('modal-confirm-update-winningnumbers-successful');">Ok</button>`;
CreateAndShowModal(modalid, modaltitle, modalbody, modalfooter, modalfooterclose = false, topclosebutton = true, modalbodyclass = 'modal-body', modalheaderclass = 'modal-header');
}
function ModalWinningNumbersUpdateFailed(response){
const modalid = "modal-confirm-update-winningnumbers-successful";
const modaltitle = "Failed";
const modalbody = `
<p>Error Unable to Update Winning Numbers. Try Again Later</p><p>${response}</p><br>`;
const modalfooter = `<button type="button" class="btn btn-default" data-dismiss="modal">Ok</button> `;
CreateAndShowModal(modalid, modaltitle, modalbody, modalfooter, modalfooterclose = false, topclosebutton = true, modalbodyclass = 'modal-body', modalheaderclass = 'modal-header');
}
function UpdateWinningNumbers(){
hidemodal('modal-confirm-update-winningnumbers');
function UpdateDrawNumbers(response){
if (response === true){
ModalWinningNumbersUpdateSuccessful();}
else{
ModalWinningNumbersUpdateFailed(response);
}
}
AjaxDo('?admin/draw/numbers/update', { target_draw: currenttarget, target_draw_numbers: $('#New-Winning-Numbers-Input').val() }, UpdateDrawNumbers, null, reqtype = 'POST');
}
function UpdateWinningNumbersModalConfirm(){
if ($('#New-Winning-Numbers-Input').val().trim() === ""){return false;}
const modalid = "modal-confirm-update-winningnumbers";
const modaltitle = "Confirm";
const modalbody = `
<p>Update Winning Numbers?</p><br>`;
const modalfooter = `<button type="button" class="btn btn-default" data-dismiss="modal">No</button>
<button type="button" class="btn btn-primary" onclick="UpdateWinningNumbers()">Confirm</button>
`;
CreateAndShowModal(modalid, modaltitle, modalbody, modalfooter, modalfooterclose = false, topclosebutton = true, modalbodyclass = 'modal-body', modalheaderclass = 'modal-header');
}
function UpdateWinningNumbersModal(){
const modalid = "modal-update-winning-numbers";
const modaltitle = "Update Winning Numbers";
const modalbody = `<center>New Winning Numbers</center>
<p><input class="form-control" id='New-Winning-Numbers-Input'></p><br>`;
const modalfooter = `<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
<button type="button" class="btn btn-primary" onclick="UpdateWinningNumbersModalConfirm()">Update</button>`;
CreateAndShowModal(modalid, modaltitle, modalbody, modalfooter, modalfooterclose = false, topclosebutton = true, modalbodyclass = 'modal-body', modalheaderclass = 'modal-header');
}
function loaddrawdetails() {
function populatedrawdetails(response) {
let drawdate=response.bet_schedule+'<br>'+convertTo12HRTime(response.bet_time);
$('#draw_date_text').html(drawdate);
$('#game_name_text').html(response.bet_type);
$('#winning_numbers_text').html(response.winning_numbers);
if (response.active === 1) {
$('#draw_active').prop('checked', true);
$('#DrawDisableModalShowButton').attr("onclick","DrawDisableModal();");
$('#DrawDisableModalShowButton').attr("class","btn btn-warning btn-block");
$('#DrawDisableModalShowButton').html("Disable Draw");
}
else {
$('#draw_active').prop('checked', false);
$('#DrawDisableModalShowButton').attr("onclick","DrawEnableModal();");
$('#DrawDisableModalShowButton').attr("class","btn btn-primary btn-block");
$('#DrawDisableModalShowButton').html("Enable Draw");
}
$('#user_coordinator').html(response.parent);
if (response.acct_type) {
$('#user_type_column').show();
$('#user_type').html(response.acct_type);
}
if (response.total_balance) {
$('#user_balance_column').show();
$('#user_balance').html(response.total_balance);
}
if (response.nickname) {
$('#user_type_column').show();
}
}
AjaxDo('?admin/draw/details', { target_draw: currenttarget }, populatedrawdetails, null, reqtype = 'POST');
}
loaddrawdetails();
// $("#user_controls").load("?UserdetailsControls");
</script>

View File

@@ -0,0 +1,49 @@
<script id="main-script">
cardshtml='<br><br>'+CreateBalanceCard(titletext='Welcome Operator!',maincardid='main-card-body',firstrowtext='Total Bet Amount Today',firstrowvalueid='homecard-total-bet-amounts-today',firstrowvaluetext='...' ,secondrowtext='Total Winning Prizes',secondrowvalueid='homecard-total-prizes-amounts-today',secodrowvaluetext='...',secondrowvisible=true,footerrowid='phone-number',footerrowtext='',thirdrowtext = 'Balance Remaining', thirdrowvalueid = 'total-balance', thirdrowvaluetext = '', thirdrowvisible = true);
+'<br><br>';
cardshtml+= createCard(cardtitle='',cardid='secondary-card',cardtools='',cardbodyid='HomeMenuButtons',cardbodytext='',cardbodyclassadd='row','',true);
cardshtml+= createCard(cardtitle='Draws Today',cardid='draws',cardtools='',cardbodyid='div_draw_numbers_today',cardbodytext='',cardbodyclassadd='',maincardstyle='');
cardshtml+= createCard(cardtitle='Winning Numbers Today',cardid='winning-numbers-today-home',cardtools='',cardbodyid='div_winning_numbers_today',cardbodytext='',cardbodyclassadd='',maincardstyle='');
cardshtml+='<br><br>'
$('#main-body').html(cardshtml);
loadAdminTotalBetsPrizesAmount();
loaddrawnumberstoday();
loadwinningnumberstoday();
if (typeof HomeButtonsHtml === 'undefined') {
let HomeButtonsHtml = '';
}
HomeButtonsHtml='';
HomeButtonsHtml = HomeMenuButtons('assets/qrcode.svg','Scan QR', 'qr_reader',0,'35%','35%');
HomeButtonsHtml += HomeMenuButtons('assets/user-list.png','Users', 'user_list',0,'20%','35%');
HomeButtonsHtml += HomeMenuButtons('assets/lotteryschedule.png','Game Schedule', 'lottery_schedule',0,'20%','50%');
HomeButtonsHtml += HomeMenuButtons('assets/CreateUser.png','Create User', 'create_user',0,'20%','40%');
HomeButtonsHtml += HomeMenuButtons('assets/drawlottery.png','Draws', 'list_draws',0,'20%','40%');
HomeButtonsHtml += HomeMenuButtons('assets/creditrequests.png','Credit Requests', 'credit_requests',0,'20%','40%');
HomeButtonsHtml += HomeMenuButtons('assets/request-credit.png','Request Credit', 'request_credit',0,'20%','40%');
HomeButtonsHtml += HomeMenuButtons('assets/reports.png','Reports', 'MyReports',0,'20%','40%');
HomeButtonsHtml += HomeMenuButtons('assets/gear.png','Account Settings', 'account_settings',0,'20%','40%');
$('#HomeMenuButtons').html(HomeButtonsHtml);
$("#balance_bottom_nav").show();
$('#bets_history_bottom_nav').hide();
loaddrawnumberstoday();
loadwinningnumberstoday();
loaduserdatadashboard();
setInterval(loaduserdatadashboard, '20000');
setInterval(loadwinningnumberstoday, '20000');
setInterval(loaddrawnumberstoday, '20000');
setInterval(UpdateWinningBetNotifications,10000);
</script>

View File

@@ -0,0 +1,198 @@
<br><br><br><br>
<div class="card" id="secondary-card" style="display:none;">
<div class="card-header ui-sortable-handle" style="cursor: move;">
<h3 class="card-title">Draws</h3>
<div class="card-tools"><button class="btn btn-primary btn-block" onclick="ModalCreateDraw();">New Draw</button></div>
</div>
<div class="card-body">
<table id="Draws_list_table">
<thead>
<tr>
<th>Date</th>
<th>Game</th>
<th>Winning Number</th>
<th></th>
</tr>
</thead>
<tbody>
</tbody>
</table>
<br>
</div>
</div>
<br><br><br>
<script>
function CreateDrawNow() {
function ModalCreateDrawSuccess(){
const modalid = "modal-create-draw-success";
const modaltitle = "Success";
const modalbody = `Draw Created`;
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');
modalhide('modal-create-draw');
}
function ModalCreateDrawFailed(response){
if (response.includes('Draw Exists, Update the Draw If necessary.')){
response = response.replace('Draw Exists, Update the Draw If necessary.','');
modalhide('modal-create-draw');
gotoPage('draw_details',response);
response='Draw Exists!';
}
const modalid = "modal-create-draw-success";
const modaltitle = "Failed";
const modalbody = `Unable to Create Draw <br>`+response;
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');
}
function CreateDraw(response) {
if(response.length === 72){
ModalCreateDrawSuccess();
gotoPage('draw_details',response);
}
else{ModalCreateDrawFailed(response);}
}
AjaxDo('?admin/advanced/draw/create', {
draw_type: $('#draw-b-type').val(),
draw_sched: $('#draw-scheddate').val() +' '+$('#draw-schedtime').val(),
winning_numbers: $('#draw-winning-numbers-create-draw').val()
}, CreateDraw, null, reqtype = 'POST');
}
function ModalCreateDraw() {
const modalid = "modal-create-draw";
const modaltitle = "New Draw";
const modalbody = `
<div class="row card-body">
<div class="col mx-auto" id="">
<label for="draw-b-type">Bet type:</label>
</div>
<div class="col mx-auto" id="">
<select id="draw-b-type" class="form-control">${bet_types_options}</select>
</div>
</div>
<div class="row card-body schedrow">
<div class="col-6">
<input type="date" class="form-control" id="draw-scheddate" name="scheddate" min="" max="">
</div>
<div class="col-6">
<select id="draw-schedtime" class="form-control"></select>
</div>
</div>
<div class="row card-body">
<div class="col mx-auto" id="">
<label for="draw-winning-numbers-create-draw">Winning Numbers:</label>
</div>
<div class="col mx-auto" id="">
<input class='form-control block' id="draw-winning-numbers-create-draw">
</div>
</div>
`;
const modalfooter = `<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
<button type="button" class="btn btn-primary" onclick="CreateDrawNow();">Create Draw</button>`;
CreateAndShowModal(modalid, modaltitle, modalbody, modalfooter, modalfooterclose = false, topclosebutton = true, modalbodyclass = 'modal-body', modalheaderclass = 'modal-header');
const scheddateselect = 'draw-scheddate';
const btypeid = 'draw-b-type';
const schedtimeselect = 'draw-schedtime';
const FifteenminsBefore = false;
resetDatePicker(scheddateselect, btypeid, schedtimeselect, FifteenminsBefore);
document.getElementById('draw-b-type').addEventListener('change', function() {
resetDatePicker(scheddateselect, btypeid, schedtimeselect, FifteenminsBefore);
});
document.getElementById('draw-scheddate').addEventListener('change', function() {
updateSchedtimes(btypeid, schedtimeselect, scheddateselect, FifteenminsBefore);
});
}
function GenerateDrawDetailsRow(Date, Game, WinningNumber, Hashkey) {
let activecheckbox = '';
const viewdetails = `<button class="btn btn-warning btn-block" onclick="gotoPage('draw_details','` + Hashkey + `')">View</button>`;
return `<tr>
<td>${Date}</td>
<td>${Game}</td>
<td>${WinningNumber}</td>
<td>${viewdetails}</td>
</tr>`;
}
async function GenerateDrawListRows(responsearray) {
$("#Draws_list_table").find("tbody").html('');
let newhtmltable = '';
function replaceSpacesWithBR(str) {
return str.replace("/\s/g", "<br>");
}
for (let i = 0; i < responsearray.length; i++) {
let drawsched = responsearray[i]['bet_schedule'] + '<br>' + responsearray[i]['bet_time'];
drawsched = replaceSpacesWithBR(drawsched);
newhtmltable += GenerateDrawDetailsRow(drawsched, responsearray[i]['bet_type'], responsearray[i]['winning_numbers'], responsearray[i]['hashkey']);
}
// $("#Draws_list_table").find("tbody").replaceWith(newhtmltable);
// new DataTable('#User_list_table');
$("#Draws_list_table").find("tbody").html(newhtmltable);
$("#Draws_list_table").DataTable({
"destroy": true,
order: [
[0, 'desc']
],
pageLength: 5,
lengthMenu: [
[5],
[5]
]
});
$('#secondary-card').fadeIn(200);
}
function GenerateDrawsTable() {
AjaxDo('?admin/advanced/draw/list', null, GenerateDrawListRows, null, reqtype = 'POST');
}
//AjaxDo('?draw/update/today/from/online', null, false, false, 'GET', caching = false);
GenerateDrawsTable();
</script>

View File

@@ -0,0 +1,25 @@
<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 ">
<div class="row card-body">
<div class="col-md-6" style="padding-bottom: 1.5rem;">
<button class="btn-block btn-lg" onclick="ButtonGo('DailyBetsTransfersProfitsSummary',0);">Daily Summary of
Transfers, Bets, Prizes and Profits </button>
</div>
<div class="col-md-6" style="padding-bottom: 1.5rem; display:none;">
<button class="btn-block btn-lg" onclick="ButtonGo('DailyTransfersReport',0);">Daily Transfers</button>
</div>
<div class="col-md-6" style="padding-bottom: 1.5rem; display:none;">
<button class="btn-block btn-lg" onclick="ButtonGo('BetAmountsAndPrizes30Days',0);">Bet Amounts And Prizes for
the Last 30 Days</button>
</div>
</div>
</div>
</div>

View File

@@ -0,0 +1,4 @@
<script>
$('<option value=""></option>').val('operator').text('Operator').appendTo($("#usertype"));
</script>

View File

@@ -0,0 +1,53 @@
<script id="main-script">
cardshtml='<br>'+CreateBalanceCard(titletext='',maincardid='main-card-body',firstrowtext='Total Bet Amount Today',firstrowvalueid='homecard-total-bet-amounts-today',firstrowvaluetext='...' ,secondrowtext='Total Winning Prizes',secondrowvalueid='homecard-total-prizes-amounts-today',secodrowvaluetext='...',secondrowvisible=true,footerrowid='',footerrowtext='');
+'<br><br>';
cardshtml+= createCard(cardtitle='',cardid='secondary-card',cardtools='',cardbodyid='HomeMenuButtons',cardbodytext='',cardbodyclassadd='row','',true);
cardshtml+= createCard(cardtitle='Draws Today',cardid='draws',cardtools='',cardbodyid='div_draw_numbers_today',cardbodytext='',cardbodyclassadd='',maincardstyle='');
cardshtml+= createCard(cardtitle='Winning Numbers Today',cardid='winning-numbers-today-home',cardtools='',cardbodyid='div_winning_numbers_today',cardbodytext='',cardbodyclassadd='',maincardstyle='');
cardshtml+='<br><br>'
$('#main-body').html(cardshtml);
loadAdminTotalBetsPrizesAmount();
loaddrawnumberstoday();
loadwinningnumberstoday();
if (typeof HomeButtonsHtml === 'undefined') {
let HomeButtonsHtml = '';
}
HomeButtonsHtml='';
HomeButtonsHtml = HomeMenuButtons('assets/qrcode.svg','Scan QR', 'qr_reader',0,'35%','35%');
HomeButtonsHtml += HomeMenuButtons('assets/user-list.png','Users', 'user_list',0,'20%','35%');
HomeButtonsHtml += HomeMenuButtons('assets/lotteryschedule.png','Game Schedule', 'lottery_schedule',0,'20%','50%');
HomeButtonsHtml += HomeMenuButtons('assets/CreateUser.png','Create User', 'create_user',0,'20%','40%');
HomeButtonsHtml += HomeMenuButtons('assets/drawlottery.png','Draws', 'list_draws',0,'20%','40%');
HomeButtonsHtml += HomeMenuButtons('assets/creditrequests.png','Credit Requests', 'credit_requests',0,'20%','40%');
HomeButtonsHtml += HomeMenuButtons('assets/reports.png','Reports', 'MyReports',0,'20%','40%');
HomeButtonsHtml += HomeMenuButtons('assets/accounting.png','Accounting', 'Accounting',0,'20%','40%');
HomeButtonsHtml += HomeMenuButtons('assets/gear.png','Account Settings', 'account_settings',0,'20%','40%');
$('#HomeMenuButtons').html(HomeButtonsHtml);
$("#balance_bottom_nav").hide();
$('#bets_history_bottom_nav').hide();
loaddrawnumberstoday();
loadwinningnumberstoday();
setInterval(loaddrawnumberstoday, '15000');
setInterval(loadwinningnumberstoday, '15000');
setInterval(UpdateWinningBetNotifications,5*1000*60);
</script>

View File

@@ -0,0 +1,22 @@
<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 ">
<div class="row card-body">
<div class="col-md-6" style="padding-bottom: 1.5rem;">
<button class="btn-block btn-lg" onclick="ButtonGo('DailyBetsTransfersProfitsSummary',0);">Daily Summary of Transfers, Bets, Prizes and Profits </button>
</div>
<div class="col-md-6" style="padding-bottom: 1.5rem; display:none;">
<button class="btn-block btn-lg" onclick="ButtonGo('DailyTransfersReport',0);">Daily Transfers</button>
</div>
</div>
</div>
</div>

View File

@@ -0,0 +1,77 @@
<br>
<h2 class="fw_6 text-center">Bukid Bounty Market</h2><br>
<div class="card-section" id="main-card-section">
</div>
<script>
statsarray = [["Pending", 0, "Payments", "left", "pending_payments_no"],
["Pending", 0, "Orders", "left", "actionable-leads-no"],
["Transactions", 0, "Today", "right", "sold-today-no"],
["Balance", 0, "PHP", "right", "total_balance_php"]
//,["Sold", 0, "Total", "right", "sold-all-no"]
];
balancewrapper_item_array = [["New Lead", "NewLeads", "", "/assets/NewLeads.png", "", "", "", ""], ["List Leads", "ListLeads", "0", "/assets/ListLeads.png", "", "", "", ""]];
balancebox = UIcreateBalanceBoxfromArray(statsarray, balancewrapper_item_array);
servicesbuttonarray = [['/assets/ListLeads.png', 'Leads', 'ListLeads', ''],
['/assets/user-list.png', 'Users', 'user_list', ''],
['/assets/reports.png', 'Reports', 'ListReports'],
['/assets/shopping-cart.png', 'Market', 'ListProductsMarket'],
['/assets/target.png', 'New Store', 'NewStore'],
['/assets/user-list.png', 'New User', 'create_user']
];
servicesbox = UIServices_FullDIV_GOTOPAGE_Array('', '', '', '', servicesbuttonarray);
todocardtext = `
Fix Stores Not showing in the list
<br>
Fix Photo Not Showin in Account Settings
<br>
Address Update In Account Settings
`;
todobox = CreateCardSimple('TODO', todocardtext);
dualcolumn_button_array = [['Leads', 'ListLeads', '', '/assets/ListLeads.png'],
['Users', 'ListUsers', '', '/assets/user-list.png'],
['Reports', 'ListReports', '', '/assets/reports.png'],
['Stores', 'ListStores', '', '/assets/store.png']
];
dualcolumnhtml = UISideText_DualColumnButton_Array(dualcolumn_button_array);
recents_list_array = [['Loading', 'Please Wait...', '', 'xxxwait', 'unknown', '', '/assets/sync.png']];
arrowlist_button_array = '';
searchbox_html = UISearchBox_with_BUTTONS_FULL('Recent', recents_list_array, arrowlist_button_array, 'RecentsPage', '', 'View All', 'HomeRecentList', 'home_recent_search', 'Search');
$('#main-card-section').append(balancebox);
$('#main-body').append(servicesbox + dualcolumnhtml + '<br><br>' + todobox + searchbox_html);
function UIHome_Leads_Today_Change(num) {
if (num === false || num === undefined || num === null) {
return false;
}
$('#leads-today-no').html(num);
}
function loadrecents_home() {
}
function HomeULT_reinitilize_loaders() {
Preloaders.Account_Settings_Details();
Preloaders.ListAllMarketProductsData();
}
$().ready(function () {
changeTopbarTitle('Home');
loadrecents_home();
HomeULT_reinitilize_loaders();
CheckAndSetDarkMode();
});
</script>

View File

@@ -0,0 +1,64 @@
<br><br><br>
<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;"></h1>
<div class="card-tools">
</div>
</div>
<div class="card-body">
<table id="Ultimate_console_command_list">
<thead>
<tr>
<th>
Command
</th>
</tr>
</thead>
<tbody id="command_table_body">
</tbody>
</table>
</div>
</div>
<script>
function Commandbutton(text,urlstring,METHODTYPE='POST'){
return `<tr> <td><center><button class="btn-block btn-lg" onclick="POSTDataAndShowModalResponse('${urlstring}','${METHODTYPE}')">${text}</button></center></td> </tr>`;
}
function POSTDataAndShowModalResponse(urlstring,METHODTYPE='POST',data={}){
function responseModal(response,METHODTYPE='POST'){
ModalQuickDismiss('',response,modalid='',modaltohide='',functiontodo='',conditiontrue=true);
}
AjaxDo(urlstring, data, responseModal, false, METHODTYPE, caching = false);
}
function LoadConsole(){
$(document).ready(function() {
// Your jQuery code here
$('#command_table_body').append(Commandbutton('Update List of Winners','?Winners/CheckBlank','GET'));
$('#command_table_body').append(Commandbutton('Update Draw from Online','?draw/update/today/from/online','GET'));
$('#command_table_body').append(`<tr> <td><center><button class="btn-block btn-lg" onclick="showNotification('Hello!', {body: 'This is a test notification.',icon: 'https://mm.t677u.com/assets/drawlottery.png',tag: 'test-notification'});">Test Notification</button></center></td> </tr>`);
$('#command_table_body').append(`<tr> <td><center><button class="btn-block btn-lg" onclick="ModalQuickDismiss('',Notification.permission);">Notification Status</button></center></td> </tr>`);
$('#command_table_body').append(`<tr> <td><center><button class="btn-block btn-lg" onclick="Notification.requestPermission(function(result) {if (result === 'granted') {navigator.serviceWorker.ready.then(function(registration) {registration.showNotification('adf');});}});">Notification Test 2</button></center></td> </tr>`);
$('#command_table_body').append(`<tr> <td><center><button class="btn-block btn-lg" id="notiftest3button" onclick="sNotif();">Notification Test 3</button></center></td> </tr>`);
$('#command_table_body').append(`<tr> <td><center><button class="btn-block btn-lg" id="notiftest4button" style="" onclick="Notification.requestPermission(function(result) {if (result === 'granted') {navigator.serviceWorker.ready.then(function(registration) {registration.showNotification('currentnotificationtitle', {body: 'This is a test notification.',icon: 'https://mm.t677u.com/assets/drawlottery.png',tag: 'test-notification'});});}});">Notification Test 4</button></center></td> </tr>`);
$('#command_table_body').append(`<tr> <td><center><button class="btn-block btn-lg" id="notiftest5button" style="" onclick="SetNotif('HELLO BI','this bod','https://mm.t677u.com/assets/drawlottery.png');">Notification Test 5</button></center></td> </tr>`);
$('#command_table_body').append(Commandbutton('Delete SQL Logs','?adm/delete/ldoos','GET'));
});
}
LoadConsole();
</script>

View File

@@ -0,0 +1,4 @@
<script>
$('<option value=""></option>').val('super operator').text('Super Operator').appendTo($("#usertype"));
window.hasValidMobileNumberFormat = function hasValidFormat(usernumber) {return true;};
</script>

View File

@@ -0,0 +1,77 @@
<script id="main-script">
$("#balance_bottom_nav").hide();
$('#bets_history_bottom_nav').hide();
if (typeof todocardtext === 'undefined') {
let todocardtext = '';
}
todocardtext=`Reports 2pm and 5pm and 9pm Daily Transfers Daily Summary for Transfers, Bets and Prizes also fix amount transferred today<br>
remove by reports 2pm 5pm 9pm from operator<br>
<b>FIX New Draw time to show only mon wed friday for 4d!</b> <br>
<b>FIX place bet to show only mon wed friday for 4d!</b> <br>
<br>fix database user settings text field update functions<br>
<br>modify usersettings(uid), clearsettings(uid),getusersettings(uid)<br>
fix user database settings load loginstatus or through a redirect<br>
add darkmode on settings UI and load settings through redirect<br>
keep updating settings through the redirect. update js variable <br>
fix Regeneration of sessid hash db to prevnt user from logging out<br>
Develop Hidden Reports at reports list
fIX DRAW LIST HOME ASYNC CALLBACK<br>
`;
if (typeof cardshtml === 'undefined') {
let cardshtml = '';
}
cardshtml='<br>'+CreateBalanceCard(titletext='',maincardid='main-card-body',firstrowtext='Total Bet Amount Today',firstrowvalueid='homecard-total-bet-amounts-today',firstrowvaluetext='...' ,secondrowtext='Total Winning Prizes',secondrowvalueid='homecard-total-prizes-amounts-today',secodrowvaluetext='...',secondrowvisible=true,footerrowid='',footerrowtext='');
+'<br><br>';
cardshtml+= createCard(cardtitle='',cardid='secondary-card',cardtools='',cardbodyid='HomeMenuButtons',cardbodytext='',cardbodyclassadd='row','',true);
cardshtml+= createCard(cardtitle='TODO',cardid='TODO-card',cardtools='',cardbodyid='todo_list_home_today',cardbodytext=todocardtext,cardbodyclassadd='',maincardstyle='');
cardshtml+= createCard(cardtitle='Draws Today',cardid='draws',cardtools='',cardbodyid='div_draw_numbers_today',cardbodytext='',cardbodyclassadd='',maincardstyle='');
cardshtml+= createCard(cardtitle='Winning Numbers Today',cardid='winning-numbers-today-home',cardtools='',cardbodyid='div_winning_numbers_today',cardbodytext='',cardbodyclassadd='',maincardstyle='');
cardshtml+='<br><br>'
$('#main-body').html(cardshtml);
$(document).ready(function(){
loadAdminTotalBetsPrizesAmount();
setInterval(loadAdminTotalBetsPrizesAmount, '15000');
loaddrawnumberstoday();
//setInterval(loaddrawnumberstoday, '15000');
loadwinningnumberstoday();
//setInterval(loadwinningnumberstoday, '15000');
});
if (typeof HomeButtonsHtml === 'undefined') {
let HomeButtonsHtml = '';
}
HomeButtonsHtml='';
HomeButtonsHtml = HomeMenuButtons('assets/qrcode.svg','Scan QR', 'qr_reader',0,'20%','40%');
HomeButtonsHtml += HomeMenuButtons('assets/user-list.png','Users', 'user_list',0,'20%','40%');
HomeButtonsHtml += HomeMenuButtons('assets/lotteryschedule.png','Game Schedule', 'lottery_schedule',0,'20%','40%');
HomeButtonsHtml += HomeMenuButtons('assets/CreateUser.png','Create User', 'create_user',0,'20%','40%');
HomeButtonsHtml += HomeMenuButtons('assets/drawlottery.png','Draws', 'list_draws',0,'20%','40%');
HomeButtonsHtml += HomeMenuButtons('assets/creditrequests.png','Credit Requests', 'credit_requests',0,'20%','40%');
HomeButtonsHtml += HomeMenuButtons('assets/reports.png','Reports', 'MyReports',0,'20%','40%');
HomeButtonsHtml += HomeMenuButtons('assets/briefcase.png','Console', 'UltimateConsole',0,'20%','40%');
HomeButtonsHtml += HomeMenuButtons('assets/accounting.png','Accounting', 'Accounting',0,'20%','40%');
HomeButtonsHtml += HomeMenuButtons('assets/gear.png','Account Settings', 'account_settings',0,'20%','40%');
$('#HomeMenuButtons').html(HomeButtonsHtml);
setInterval(UpdateWinningBetNotifications ,2000);
$('#logs_bottom_nav').show();
</script>
<link rel="stylesheet" type="text/css" href="dist/alt-theme/styles.css">
<link rel="stylesheet" href="dist/alt-theme/icons-alipay.css">
<link rel="stylesheet" href="dist/alt-theme/fonts.css">

View File

@@ -0,0 +1,91 @@
<br>
<h2 class="fw_6 text-center">Bukid Bounty Market</h2><br>
<div class="card-section" id="main-card-section">
</div>
<br>
<div class="bill-content">
<div class="tf-container" id="recents_home">
</div>
</div>
<script>
statsarray = [["Pending", 0, "Orders", "left", "pending_orders_no"],
["Actionable", 0, "Leads", "left", "actionable-leads-no"],
["Sold", 0, "Today", "right", "sold-today-no"],
["Balance", 0, "PHP", "right", "total_balance_php"]
//,["Sold", 0, "Total", "right", "sold-all-no"]
];
balancewrapper_item_array = [["New Lead", "NewLeads", "", "/assets/NewLeads.png", "", "", "", ""], ["List Leads", "ListLeads", "0", "/assets/ListLeads.png", "", "", "", ""]];
balancebox = UIcreateBalanceBoxfromArray(statsarray, balancewrapper_item_array);
servicesbuttonarray = [['/assets/ListLeads.png', 'Leads', 'ListLeads', ''],
['/assets/user-list.png', 'Users', 'user_list', ''],
['/assets/reports.png', 'Reports', 'ListReports'],
['/assets/shopping-cart.png', 'Market', 'ListProductsMarket'],
['/assets/target.png', 'New Store', 'NewStore'],
['/assets/user-list.png', 'New User', 'create_user']
];
servicesbox = UIServices_FullDIV_GOTOPAGE_Array('', '', '', '', servicesbuttonarray);
todocardtext = `
Fix Stores Not showing in the list
<br>
Fix Photo Not Showin in Account Settings
<br>
Address Update In Account Settings
`;
todobox = CreateCardSimple('TODO', todocardtext);
dualcolumn_button_array = [['Leads', 'ListLeads', '', '/assets/ListLeads.png'],
['Users', 'ListUsers', '', '/assets/user-list.png'],
['Reports', 'ListReports', '', '/assets/reports.png'],
['Stores', 'ListStores', '', '/assets/store.png']
];
dualcolumnhtml = UISideText_DualColumnButton_Array(dualcolumn_button_array);
recents_list_array = [['Loading', 'Please Wait...', '', 'xxxwait', 'unknown', '', '/assets/sync.png']];
arrowlist_button_array = '';
searchbox_html = UISearchBox_with_BUTTONS_FULL('Recent', recents_list_array, arrowlist_button_array, 'RecentsPage', '', 'View All', 'HomeRecentList', 'home_recent_search', 'Search');
$('#main-card-section').append(balancebox);
$('#main-body').append(servicesbox + dualcolumnhtml + '<br><br>' + todobox + searchbox_html);
function UIHome_Leads_Today_Change(num) {
if (num === false || num === undefined || num === null) {
return false;
}
$('#leads-today-no').html(num);
}
function loadrecents_home() {
}
function HomeULT_reinitilize_loaders() {
Preloaders.Account_Settings_Details();
Preloaders.ListAllMarketProductsData();
}
$().ready(function () {
changeTopbarTitle('Home');
loadrecents_home();
HomeULT_reinitilize_loaders();
CheckAndSetDarkMode();
});
</script>

View File

View File

@@ -0,0 +1,25 @@
<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 ">
<div class="row card-body">
<div class="col-md-6" style="padding-bottom: 1.5rem;">
<button class="btn-block btn-lg" onclick="ButtonGo('DailyBetsTransfersProfitsSummary',0);">Daily Summary of Transfers, Bets, Prizes and Profits </button>
</div>
<div class="col-md-6" style="padding-bottom: 1.5rem; display:none;">
<button class="btn-block btn-lg" onclick="ButtonGo('DailyTransfersReport',0);">Daily Transfers</button>
</div>
<div class="col-md-6" style="padding-bottom: 1.5rem;">
<button class="btn-block btn-lg" onclick="ButtonGo('BetAmountsAndPrizes30Days',0);">Bet Amounts And Prizes for the Last 30 Days</button>
</div>
</div>
</div>
</div>

View File

@@ -0,0 +1,80 @@
<br>
<h2 class="fw_6 text-center">Cornerstone Focus Property Alliance</h2><br>
<div class="card-section" id="main-card-section">
</div>
<br>
<div class="bill-content">
<div class="tf-container" id="recents_home">
</div>
</div>
<script>
statsarray = [["Today", 0, "Leads", "left", "leads-today-no"],
["Actionable", 0, "Leads", "left", "actionable-leads-no"],
["Sold", 0, "Today", "right", "sold-today-no"],
["Sold", 0, "This Month", "right", "sold-monthly-no"]
//,["Sold", 0, "Total", "right", "sold-all-no"]
];
balancewrapper_item_array = [["New Lead", "NewLeads", "", "/assets/NewLeads.png", "", "", "", ""], ["List Leads", "ListLeads", "0", "/assets/ListLeads.png", "", "", "", ""]];
balancebox = UIcreateBalanceBoxfromArray(statsarray, balancewrapper_item_array);
servicesbuttonarray = [['/assets/ListLeads.png', 'My Leads', 'ListLeads', ''],
['/assets/house.png', 'Properties', 'ListProperties', ''],
['/assets/NewProperty.png', 'New Property', 'NewProperty']];
servicesbox = UIServices_FullDIV_GOTOPAGE_Array('', '', '', '', servicesbuttonarray);
dualcolumn_button_array = [['Leads', 'ListLeads', '', '/assets/ListLeads.png'],
['Properties', 'ListProperties', '', '/assets/house.png']
];
dualcolumnhtml = UISideText_DualColumnButton_Array(dualcolumn_button_array);
dualcolumnhtml='';
recents_list_array = [['Loading', 'Please Wait...', '', 'xxxwait', 'unknown', '', '/assets/sync.png']];
arrowlist_button_array = '';
searchbox_html = UISearchBox_with_BUTTONS_FULL('Recent', recents_list_array, arrowlist_button_array, 'RecentsPage', '', 'View All', 'HomeRecentList', 'home_recent_search', 'Search');
$('#main-card-section').append(balancebox);
$('#main-body').append(servicesbox + dualcolumnhtml + '<br><br>' + searchbox_html);
function UIHome_Leads_Today_Change(num) {
if (num === false || num === undefined || num === null) {
return false;
}
$('#leads-today-no').html(num);
}
function loadrecents_home() {
}
function HomeULT_reinitilize_loaders() {
Preloaders.Account_Settings_Details();
Preloaders.PreferredSitesOption();
Preloaders.ListLeadsData();
Preloaders.ListPropertyData(true,false,false);
}
$().ready(function () {
changeTopbarTitle('Home');
loadrecents_home();
HomeULT_reinitilize_loaders();
CheckAndSetDarkMode();
});
</script>

View File

@@ -0,0 +1,97 @@
<table id="Draw_Numbers_Today">
<thead>
<tr>
<th>Time</th>
<th>Type</th>
<th>Number</th>
</tr>
</thead>
<tbody>
</tbody>
</table>
<script>
function GenerateDrawWinningTodayRow(Type,Time,btnumber){
let activecheckbox='';
//activecheckbox='<input class="form-control" type="checkbox" '+Active+' disabled>';
//const actionbutton =`<button class="btn btn-warning btn-block" onclick="gotoPage('UserModify','${Hashkey}')">View User</button>`;
Time=Time.replace(' ','<br>');
Type=Type.replace(' ','<br>');
return `<tr>
<td>${Time}</td>
<td>${Type}</td>
<td>${btnumber}</td>
</tr>`;
}
async function GenerateDrawsTodayRows(responsearray) {
let newhtmltable = '';
for (let i = 0; i < responsearray.length; i++) {
newhtmltable += GenerateDrawWinningTodayRow(
responsearray[i]['type'],
responsearray[i]['schedule'],
responsearray[i]['draw_number'],
);
}
//$("#User_list_table").find("tbody").replaceWith(newhtmltable);
// new DataTable('#User_list_table');
$("#Draw_Numbers_Today").find("tbody").html(newhtmltable);
//new DataTable('#Winning_Numbers_Today');
new DataTable('#Draw_Numbers_Today', {
language: {
emptyTable: 'No Draws'
},
order: [[0, 'asc']],
"bDestroy": true
});
$('#draws-today-card').fadeIn(200);
}
function GenerateDrawListTodayTable(draw_numbers_today_target_date=''){
AjaxDo('?user/list/draw_winning_numbers/', { target_date: draw_numbers_today_target_date}, GenerateDrawsTodayRows, null, reqtype = 'POST');
}
GenerateDrawListTodayTable(draw_numbers_today_target_date);
if (home_page_card_html_auto_load_table_content===1){
setInterval(function () {
if (currentPage=='Home'){
GenerateDrawListTodayTable(draw_numbers_today_target_date);
}
}, 300000);
}
</script>

View File

@@ -0,0 +1,106 @@
<table id="My_Winning_Numbers">
<thead>
<tr>
<th>Time</th>
<th>Type</th>
<th>Number</th>
<th>Amount</th>
</tr>
</thead>
<tbody>
</tbody>
</table>
<script>
function GenerateBetWinningRow(Time,Type,btnumber,Amount,Hashkey){
let activecheckbox='';
//activecheckbox='<input class="form-control" type="checkbox" '+Active+' disabled>';
//const actionbutton =`<button class="btn btn-warning btn-block" onclick="gotoPage('UserModify','${Hashkey}')">View User</button>`;
Time=Time.replace(' ','<br>');
Type=Type.replace(' ','<br>');
return `<tr>
<td>${Time}</td>
<td>${Type}</td>
<td>${btnumber}</td>
<td>${Amount}</td>
</tr>`;
}
async function GenerateMyBetWinningRows(responsearray) {
let newhtmltable = '';
for (let i = 0; i < responsearray.length; i++) {
newhtmltable += GenerateBetWinningRow(
responsearray[i]['time'],
responsearray[i]['type'],
responsearray[i]['bet_number'],
responsearray[i]['amount'],
responsearray[i]['hashkey']
);
}
//$("#User_list_table").find("tbody").replaceWith(newhtmltable);
// new DataTable('#User_list_table');
$("#My_Winning_Numbers").find("tbody").html(newhtmltable);
//new DataTable('#Winning_Numbers_Today');
new DataTable('#My_Winning_Numbers', {
language: {
emptyTable: 'No Winning Numbers'
},
order: [[0, 'desc']],
"bDestroy": true
});
$('#secondary-card').fadeIn(200);
}
function GenerateMyWinningNumbersTable(my_winning_numbers_target_user){
AjaxDo('?user/list/winning_numbers/all', {target_user : my_winning_numbers_target_user}, GenerateMyBetWinningRows, null, reqtype = 'POST');
}
GenerateMyWinningNumbersTable(my_winning_numbers_target_user);
if (home_page_card_html_auto_load_table_content===1){
setInterval(function () {
if (currentPage=='Home'){GenerateMyWinningNumbersTable(my_winning_numbers_target_user);}
}, 300000);
}
</script>

View File

@@ -0,0 +1,552 @@
<br><br>
<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%;">
<div class="row">
<div class="col-md-6">
Total Balance
</div>
<div class="col-md-6" id="total-balance">
</div>
</div>
<div class="row">
<div class="col-md-6">
</div>
<div class="col-md-6" id="credited-balance">
</div>
</div>
<br><br>
<div class="row">
<div class="col-md-6 text-sm" id="phone-number">
...
</div>
<div class="col-md-6">
</div>
</div>
</div>
</div>
</div>
<div class="card" 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>
</div>
</div>
<div class="card" 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">
<div class="col mx-auto" id="">
Bet type:
</div>
<div class="col mx-auto" id="">
<select id="b-type" class="form-control"></select>
</div>
</div>
<div class="row card-body">
<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>
<div class="card" id="third-card-betting">
<div class="card-header ui-sortable-handle" style="cursor: move;">
<h3 class="card-title" style="" id="selected-numbers"></h3>
<div class="card-tools bg-warning" style="display: none;">
Maximum Numbers Selected
</div>
</div>
<div class="card-body text-center" id="bubble-sheet-card">
</div>
</div>
<div class="card" id="fourth-card-confirm" style="display: none;">
<div class="card-body text-center" id="bubble-sheet-card">
<button class="form-control border-rounded btn-danger" onclick="trytosubmitB();">Confirm</button>
</div>
</div>
<div id="br-space" style="display:none;">
<br><br><br><br><br><br><br>
</div>
<script>
var gamesdetails = null;
var gamemaxnumberofdigits = null;
var digitselection = null;
var numberofdigits = 0;
var numofbets = 0;
var minimumbet = null;
function numberofselectedbuttons() {
return $(".l-button.btn-danger").length;
}
function IsSelectedNumbersMax() {
if ($(".custom-select.numbersinorderselect").length !== 0) {
return true;
}
if (!gamemaxnumberofdigits || gamemaxnumberofdigits === -1) {
return false;
}
if (numberofselectedbuttons() < gamemaxnumberofdigits) {
return false;
} else { return true; }
}
function currentgametype() {
return $("#b-type").val();
}
function hideconfirmbutton() {
$("#third-card-betting .card-tools").hide();
$("#fourth-card-confirm").hide();
}
function hideselectednumbersTop() {
$("#selected-numbers").html("");
}
function showconfirmbutton() {
$("#third-card-betting .card-tools").show(); $("#fourth-card-confirm").fadeIn(200);
$("#br-space").show();
}
function repopulatebtype(response) {
//console.log();
$("#b-type").empty();
$("#sched").empty();
hideconfirmbutton();
hideselectednumbersTop();
let dateoptions = '';
for (var key in response) {
var optionValue = response[key]['hashkey'];
var optionText = response[key]['bet_type'];
$("#b-type").append($('<option>', { value: optionValue, text: optionText }));
}
reloadschedbyvalue();
}
function repopulatedatesched(response) {
for (var key in response) {
var optionValue = response[key];
$("#sched").append($('<option>', { value: optionValue, text: optionValue }));
}
populatebuttonsb();
}
function reloadschedbyvalue() {
hideconfirmbutton();
hideselectednumbersTop();
$("#sched").empty();
const currentgametype = $("#b-type").val();
const dataRight = { game: currentgametype };
AjaxDo('?user/bet/sched', dataRight, repopulatedatesched, null, reqtype = 'POST');
}
function generateAmountButton() {
return 'Amount: <input type="number" min=' + minimumbet + ' max=' + total_balance + ' class="form-control amountcontrol">';
}
function GenerateAddBetButton() {
return '<button class="form-control btn-primary" onclick="AddBetNow(this)">Add Bet</button>';
}
function AmounthasEmptyOrZeroValue() {
let hasEmptyOrZero = false;
$('.amountcontrol').each(function () {
const inputValue = $(this).val();
if (inputValue === '' || parseFloat(inputValue) === 0) {
hasEmptyOrZero = true;
return false;
}
});
return hasEmptyOrZero;
}
function isTotalBalanceExceeded() {
const totalBalance = parseFloat(total_balance);
let currentTotal = 0;
$('.amountcontrol').each(function () {
const inputValue = parseFloat($(this).val());
if (!isNaN(inputValue)) {
currentTotal += inputValue;
}
});
return currentTotal > totalBalance;
}
function EmptyAmountControl() {
$('.amountcontrol').val('');
}
function GenerateNewBet() {
numofbets++;
numberofdigits = 0;
let html = "<div class='row NumRow'>";
digitselection.forEach(function (rowValues, rowIndex) {
html += '<div class="col-3 mx-auto" style="padding-bottom:10px;">';
html += ("<select class='form-control num-select'>");
numberofdigits++;
rowValues.forEach(function (value) {
html += '<option value=' + value + '>' + value + '</option>';
});
html += '</select></div>'
});
html += '</div>';
return html + '<br><br>' + generateAmountButton() + '<br><br>' + GenerateAddBetButton() + '<hr class="bet-separator">';
}
function AddBetNow(button) {
if (AmounthasEmptyOrZeroValue()) { EmptyAmountWarning(); return false; }
if (isTotalBalanceExceeded()) {
TotalBalanceExceededWarning();
EmptyAmountControl();
return false;
}
$("#bubble-sheet-card").append('<br>' + GenerateNewBet() + '');
$(window).scrollTop($(document).height());
$(button).remove();
}
function populatebuttonsnow(response) {
//console.log(response);
numofbets = 0;
minimumbet = response.price;
showconfirmbutton();
hideselectednumbersTop();
$('#bubble-sheet-card').fadeOut(200);
$('#bubble-sheet-card').empty();
let newhtmlbuttons;
if (response.digit_selection) {
digitselection = response.digit_selection;
$("#bubble-sheet-card").html(GenerateNewBet());
}
newhtmlbuttons += '<br><br>'
//$("#bubble-sheet-card").html(newhtmlbuttons);
$("#bubble-sheet-card").fadeIn(200);
var Bbuttons = [];
gamemaxnumberofdigits = response.number_of_digits;
$(".l-button").click(function () {
if ($(this).hasClass("btn-primary")) {
if (!IsSelectedNumbersMax()) {
$(this).removeClass("btn-primary");
$(this).addClass("btn-danger");
} else {
// Handle case when max numbers are selected
}
} else {
$(this).removeClass("btn-danger");
$(this).addClass("btn-primary");
$("#third-card-betting .card-tools").hide();
$("#fourth-card-confirm").hide();
}
showSelectedNumbers(gamemaxnumberofdigits);
});
}
function populatebuttonsb() {
$("#bubble-sheet-card").fadeOut(200);
$("#bubble-sheet-card").empty();
const dataRight = { game: $("#b-type").val() };
AjaxDo('?user/bet/buttons', dataRight, populatebuttonsnow, null, reqtype = 'POST');
}
function showSelectedNumbers(number_of_digits = -1) {
const selectedButtons = document.querySelectorAll('.l-button.btn-danger');
let selectedNumbers = '';
if (selectedButtons.length === number_of_digits) {
showconfirmbutton();
}
selectedButtons.forEach(button => {
selectedNumbers += button.textContent + '-';
});
document.getElementById('selected-numbers').textContent = 'Selected Numbers: ' + selectedNumbers;
return selectedNumbers;
}
function getselectednumbersold() {
var buttonValues = "";
if ($(".l-button.btn-danger").length === 0) {
const selectedValues = [];
$(".numbersinorderselect").each(function () {
if ($(this).is("select")) {
let currentnumber = $(this).val().toString().padStart(2, "0")
selectedValues.push($(this).val());
buttonValues += currentnumber + '-';
}
});
} else {
$(".l-button.btn-danger").each(function () {
var buttonValue = $(this).val();
buttonValues += buttonValue + "-";
});
}
return buttonValues;
}
function getselectednumbers() {
const numSelectValues = $('.num-select').map(function () {
return $(this).val();
}).get();
const result = [];
let currentIndex = 0;
while (currentIndex < numSelectValues.length) {
const chunkSize = Math.min(numberofdigits, numSelectValues.length - currentIndex);
const chunk = numSelectValues.slice(currentIndex, currentIndex + chunkSize);
result.push(chunk);
currentIndex += chunkSize;
}
return result;
}
function collectAmountControlValues() {
return $('.amountcontrol').map(function () {
return $(this).val();
}).get();
}
function mergeValuesIntoObjects(numSelectValues, amountControlValues) {
const result = [];
const maxLength = Math.max(numSelectValues.length, amountControlValues.length);
for (let i = 0; i < maxLength; i++) {
const pair = {
numSelect: numSelectValues[i] || null,
amountControl: amountControlValues[i] || null
};
result.push(pair);
}
return result;
}
function getAllSelectedNumbers() {
const numSelectValues = getselectednumbers(numberofdigits);
const amountControlValues = collectAmountControlValues();
const mergedObjects = mergeValuesIntoObjects(numSelectValues, amountControlValues, numberofdigits);
return mergedObjects;
}
function BetFailed(response) {
CreateAndShowModal('betting-failed', 'Failed', 'Your bet didn\'t go through. Please Try Again Later!', '');
}
function BetSuccessful(response) {
CreateAndShowModal('betting-success', 'Success', 'Successfully Entered Bet!', '');
gotoPage('bet_qr', response);
}
function TotalBalanceExceededWarning() {
CreateAndShowModal('balance-not-enough-warning', 'Total Amount Exceeded', 'Not Enough Balance!', '');
}
function EmptyAmountWarning() {
CreateAndShowModal('empty-amount-warning', 'Amount', 'No Amount Entered.<br><br>Please Enter an Amount!', '');
}
function SubmitFailed() {
CreateAndShowModal('submit-failed-warning', 'Failed', 'Unable to Place Bet Please Try Again later!', '');
}
function SubmitNow(response) {
console.log(response);
if (Array.isArray(response) || !response || typeof response !== "string") {
BetFailed(response);
return false;
}
if (response.length !== 72) {
BetFailed(response);
return false;
}
BetSuccessful(response);
}
function trytosubmitB() {
if (isTotalBalanceExceeded()) { TotalBalanceExceededWarning(); return false; }
if (AmounthasEmptyOrZeroValue()) { EmptyAmountWarning(); return false; }
let selectedNumbers = getAllSelectedNumbers();
const data = { user_target: currenttarget, game: currentgametype(), selected_numbers: selectedNumbers, schedule: $("#sched").val() };
AjaxDo('?user/new/bet/transaction', data, SubmitNow, null, reqtype = 'POST');
}
$(document).ready(function () {
if (currenttarget===0){
loaduserdatadashboard();
}
AjaxDo('?user/bet/tps', null, repopulatebtype, null, reqtype = 'POST');
const currentgametype = $("#b-type").val();
const dataRight = { game: currentgametype };
$("#b-type").change(reloadschedbyvalue);
if (currenttarget !== 0) {
function PostUserNumber(response) {
// CreateAndShowModal('TargetBetUserWarn', 'Betting for a Different User', 'You are betting for ' + response + '.');
ModalQuickDismiss('Betting for a Different User', 'You are betting for ' + response + '.');
}
AjaxDo('?query/user/number/byhash', { user_target: currenttarget }, PostUserNumber, null, reqtype = 'POST');
function UpdateTotalBalanceforDifferentUser(response){
if (!response){return false;}
total_balance=response;
}
AjaxDo('?query/user/balance', { user_target: currenttarget }, UpdateTotalBalanceforDifferentUser, null, reqtype = 'POST');
}
});
</script>

View File

@@ -0,0 +1,506 @@
<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%;">
<div class="row">
<div class="col-md-6">
Total Balance
</div>
<div class="col-md-6" id="total-balance">
</div>
</div>
<div class="row">
<div class="col-md-6">
</div>
<div class="col-md-6" id="credited-balance">
</div>
</div>
<br><br>
<div class="row">
<div class="col-md-6 text-sm" id="phone-number">
...
</div>
<div class="col-md-6" >
</div>
</div>
</div>
</div>
</div>
<div class="card" 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 mx-auto" id="regionbutton"><button class="bg-transparent border-0 btn-block" style="" onclick="">
<div class="card-body box-profile">
<div class="text-center">
<img class=" img-circle rounded mx-auto d-block" src="assets/lotto649.png" width="75px" height="75px" style="overflow:hidden;"></div>
<h3 class="profile-username text-center">Super Lotto 6/49 </h3>
<p class="text-muted text-center"></p>
</div>
</button></div>
<div class="col mx-auto" id="agenciesbutton"><button class="bg-transparent border-0 btn-block" onclick="">
<div class="card-body no-border">
<div class="text-center">
<img class="rounded mx-auto d-block" src="assets/lotto658.png" width="75px" height="75px" style="overflow:hidden;"></div>
<h3 class="profile-username text-center">Ultra Lotto 6/58</h3>
<p class="text-muted text-center"></p>
</div>
</button></div>
<div class="col mx-auto" id="acsbutton"><button class="bg-transparent border-0 btn-block" onclick="">
<div class="card-body box-profile">
<div class="text-center">
<img class="rounded mx-auto d-block" src="assets/megalotto645.png" width="75px" height="75px" style="overflow:hidden;"></div>
<h3 class="profile-username text-center">Mega Lotto 6/45</h3>
<p class="text-muted text-center"></p>
</div>
</button></div>
<div class="col mx-auto" id="uposbutton"><button class="bg-transparent border-0 btn-block" onclick="">
<div class="card-body box-profile">
<div class="text-center">
<img class="rounded mx-auto d-block" src="assets/lotto642.png" width="75px" height="75px" style="overflow:hidden;"></div>
<h3 class="profile-username text-center">Lotto 6/42</h3>
<p class="text-muted text-center"></p>
</div>
</button></div>
<div class="col mx-auto" id="uposbutton"><button class="bg-transparent border-0 btn-block" onclick="">
<div class="card-body box-profile">
<div class="text-center">
<img class="rounded mx-auto d-block" src="assets/4dlotto.png" width="75px" height="75px" style="overflow:hidden;"></div>
<h3 class="profile-username text-center">4D Lotto</h3>
<p class="text-muted text-center"></p>
</div>
</button></div>
<div class="col mx-auto" id="uposbutton"><button class="bg-transparent border-0 btn-block" onclick="">
<div class="card-body box-profile">
<div class="text-center">
<img class="rounded mx-auto d-block" src="assets/3dlotto.png" width="75px" height="75px" style="overflow:hidden;"></div>
<h3 class="profile-username text-center">3D Lotto</h3>
<p class="text-muted text-center"></p>
</div>
</button></div>
<div class="col mx-auto" id="uposbutton"><button class="bg-transparent border-0 btn-block" onclick="">
<div class="card-body box-profile">
<div class="text-center">
<img class="rounded mx-auto d-block" src="assets/6dlotto.png" width="75px" height="75px" style="overflow:hidden;"></div>
<h3 class="profile-username text-center">6D Lotto</h3>
<p class="text-muted text-center"></p>
</div>
</button></div>
<div class="col mx-auto" id="uposbutton"><button class="bg-transparent border-0 btn-block" onclick="">
<div class="card-body box-profile">
<div class="text-center">
<img class="rounded mx-auto d-block" src="assets/2dlotto.png" width="75px" height="75px" style="overflow:hidden;"></div>
<h3 class="profile-username text-center">2D Lotto</h3>
<p class="text-muted text-center"></p>
</div>
</button></div>
-->
</div></div>
</div>
<div class="card" 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">
<div class="col mx-auto" id="">
Bet type:
</div>
<div class="col mx-auto" id="">
<select id="b-type" class="form-control"></select>
</div>
</div>
<div class="row card-body">
<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>
<div class="card" id="third-card-betting">
<div class="card-header ui-sortable-handle" style="cursor: move;">
<h3 class="card-title" style="" id="selected-numbers"></h3>
<div class="card-tools bg-warning" style="display: none;">
Maximum Numbers Selected
</div>
</div>
<div class="card-body text-center" id="bubble-sheet-card">
</div>
</div>
<div class="card" id="fourth-card-confirm" style="display: none;">
<div class="card-body text-center" id="bubble-sheet-card">
<button class="form-control border-rounded btn-danger" onclick="trytosubmitB();">Confirm</button>
</div>
</div>
<div id="br-space" style="display:none;">
<br><br><br><br><br><br><br>
</div>
<script>
var gamesdetails = null;
var gamemaxnumberofdigits=null;
function numberofselectedbuttons(){
return $(".l-button.btn-danger").length;
}
function IsSelectedNumbersMax(){
if ($(".custom-select.numbersinorderselect").length !== 0){
return true;
}
if (!gamemaxnumberofdigits || gamemaxnumberofdigits===-1){
return false;
}
if (numberofselectedbuttons()<gamemaxnumberofdigits){
return false;
}else{return true;}
}
function currentgametype(){
return $("#b-type").val();
}
function hideconfirmbutton(){
$("#third-card-betting .card-tools").hide();
$("#fourth-card-confirm").hide();
}
function hideselectednumbersTop(){
$("#selected-numbers").html("");
}
function showconfirmbutton(){
$("#third-card-betting .card-tools").show();$("#fourth-card-confirm").fadeIn(200);
$("#br-space").show();
}
function repopulatebtype(response){
$("#b-type").empty();
$("#sched").empty();
hideconfirmbutton();
hideselectednumbersTop();
let dateoptions='';
for (var key in response) {
var optionValue = response[key]['hashkey'];
var optionText = response[key]['bet_type'];
$("#b-type").append($('<option>', { value: optionValue, text: optionText }));
}
reloadschedbyvalue();
}
function generatenumberbuttonbasedonarray(array,classwhenclicked='btn-warning selected'){
//array is = to [[0,1,2,3,4,5,6,7,8,9],[0,1,2,3,4,5,6,7,8,9]]
}
function repopulatedatesched(response){
for (var key in response) {
var optionValue = response[key];
$("#sched").append($('<option>', { value: optionValue, text: optionValue }));
}
populatebuttonsb();
}
function reloadschedbyvalue(){
hideconfirmbutton();
hideselectednumbersTop();
$("#sched").empty();
const currentgametype = $("#b-type").val();
const dataRight = { game: currentgametype };
AjaxDo('?user/bet/sched',dataRight,repopulatedatesched, null,reqtype='POST');
}
function GenerateButtonsForNumberSelectionRANDOM(response_max_digits){
let newhtmlbuttons = '<div class="row">';
function newbuttonhtml(currentnumber){
return '<button class="l-button btn btn-primary rounded-circle" value="'+currentnumber+'">'+currentnumber+'</button>';
}
for (let i = 1; i <response_max_digits+1; i++) {
let currentnumber= i.toString().padStart(2, "0");
newhtmlbuttons += '<div class="col-1 mx-3 my-2">'+newbuttonhtml(currentnumber)+'</div>';
}
newhtmlbuttons +='</div>';
return newhtmlbuttons;
}
function GenerateButtonsForNumberSelectionINORDER(response_max_digits,response_number_of_digits){
let newhtmlbuttons = '<div class="row">';
function newbuttonhtml(currentnumber,maxdigits){
let newhtml='<select class="custom-select numbersinorderselect" id="SelectedNumber-'+currentnumber+'">';
for (let i = 1; i <maxdigits+1; i++) {
let newnumbernumber= i.toString().padStart(2, "0");
newhtml+='<option value="'+i+'">'+newnumbernumber+'</option>';
}
return newhtml+='</select>';
}
for (let i = 1; i <response_number_of_digits+1; i++) {
let currentnumber= i.toString().padStart(2, "0");
newhtmlbuttons += '<div class="col mx-auto"><br>'+currentnumber+' '+newbuttonhtml(currentnumber,response_max_digits)+'</div>';
}
newhtmlbuttons +='</div>';
return newhtmlbuttons;
}
function populatebuttonsnow(response) {
hideconfirmbutton();
hideselectednumbersTop();
let newhtmlbuttons; // Declare the variable outside the if-else block
if (response.numbers_must_be_in_order) {
newhtmlbuttons =GenerateButtonsForNumberSelectionINORDER(response.max_digits,response.number_of_digits);
// $("#fourth-card-confirm").show();
showconfirmbutton();
} else {
newhtmlbuttons = GenerateButtonsForNumberSelectionRANDOM(response.max_digits);
}
$("#bubble-sheet-card").html(newhtmlbuttons);
$("#bubble-sheet-card").fadeIn(200);
var Bbuttons = [];
gamemaxnumberofdigits = response.number_of_digits;
$(".l-button").click(function () {
if ($(this).hasClass("btn-primary")) {
if (!IsSelectedNumbersMax()) {
$(this).removeClass("btn-primary");
$(this).addClass("btn-danger");
} else {
// Handle case when max numbers are selected
}
} else {
$(this).removeClass("btn-danger");
$(this).addClass("btn-primary");
$("#third-card-betting .card-tools").hide();
$("#fourth-card-confirm").hide();
}
showSelectedNumbers(gamemaxnumberofdigits);
});
}
function populatebuttonsb() {
$("#bubble-sheet-card").fadeOut(200);
$("#bubble-sheet-card").empty();
const dataRight = { game: $("#b-type").val() };
AjaxDo('?user/bet/buttons', dataRight, populatebuttonsnow, null, reqtype = 'POST');
}
function showSelectedNumbers(number_of_digits=-1) {
const selectedButtons = document.querySelectorAll('.l-button.btn-danger');
let selectedNumbers = '';
if (selectedButtons.length===number_of_digits){
showconfirmbutton();
}
selectedButtons.forEach(button => {
selectedNumbers += button.textContent + '-';
});
document.getElementById('selected-numbers').textContent = 'Selected Numbers: ' + selectedNumbers;
return selectedNumbers;
}
function getselectednumbers(){
var buttonValues = "";
if ($(".l-button.btn-danger").length === 0) {
const selectedValues = [];
$(".numbersinorderselect").each(function() {
if ($(this).is("select")) {
let currentnumber= $(this).val().toString().padStart(2, "0")
selectedValues.push($(this).val());
buttonValues+=currentnumber+'-';
}
});
} else {
$(".l-button.btn-danger").each(function() {
var buttonValue = $(this).val();
buttonValues += buttonValue + "-";
});
}
return buttonValues;
}
function BetFailed(response){
CreateAndShowModal('betting-failed','Failed','Your bet didn\'t go through. Please Try Again Later!','');
}
function BetSuccessful(response){
CreateAndShowModal('betting-success','Success','Successfully Entered Bet!','');
gotoPage('bet_qr',response);
}
function trytosubmitB(){
//let selectedNumbers = showSelectedNumbers();
let selectedNumbers = getselectednumbers();
if (!IsSelectedNumbersMax()){return false;}
function SubmitNow(response){
if(!response){BetFailed(); return false;}
else{
BetSuccessful(response);
}
}
const data = { user_target: currenttarget, game: currentgametype(), selected_numbers: selectedNumbers, schedule : $("#sched").val() };
AjaxDo('?user/bet/submit',data,SubmitNow, null,reqtype='POST');
}
function populatebTypeNow(){
AjaxDo('?user/bet/tps',null,repopulatebtype, null,reqtype='POST');
}
$(document).ready(function() {
var currenttarget=0;
loaduserdatadashboard();
populatebTypeNow();
//const currentgametype = $("#b-type").val();
//const dataRight = { game: currentgametype };
$("#b-type").change(reloadschedbyvalue);
});
if (currenttarget!==0){
function PostUserNumber(response){
CreateAndShowModal('TargetBetUserWarn','Betting for a Different User','You are betting for '+response+'.');
}
AjaxDo('?query/user/number/byhash',{ user_target: currenttarget},PostUserNumber, null,reqtype='POST');
}
</script>

View File

@@ -0,0 +1,500 @@
<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%;">
<div class="row">
<div class="col-md-6">
Total Balance
</div>
<div class="col-md-6" id="total-balance">
</div>
</div>
<div class="row">
<div class="col-md-6">
</div>
<div class="col-md-6" id="credited-balance">
</div>
</div>
<br><br>
<div class="row">
<div class="col-md-6 text-sm" id="phone-number">
...
</div>
<div class="col-md-6" >
</div>
</div>
</div>
</div>
</div>
<div class="card" 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 mx-auto" id="regionbutton"><button class="bg-transparent border-0 btn-block" style="" onclick="">
<div class="card-body box-profile">
<div class="text-center">
<img class=" img-circle rounded mx-auto d-block" src="assets/lotto649.png" width="75px" height="75px" style="overflow:hidden;"></div>
<h3 class="profile-username text-center">Super Lotto 6/49 </h3>
<p class="text-muted text-center"></p>
</div>
</button></div>
<div class="col mx-auto" id="agenciesbutton"><button class="bg-transparent border-0 btn-block" onclick="">
<div class="card-body no-border">
<div class="text-center">
<img class="rounded mx-auto d-block" src="assets/lotto658.png" width="75px" height="75px" style="overflow:hidden;"></div>
<h3 class="profile-username text-center">Ultra Lotto 6/58</h3>
<p class="text-muted text-center"></p>
</div>
</button></div>
<div class="col mx-auto" id="acsbutton"><button class="bg-transparent border-0 btn-block" onclick="">
<div class="card-body box-profile">
<div class="text-center">
<img class="rounded mx-auto d-block" src="assets/megalotto645.png" width="75px" height="75px" style="overflow:hidden;"></div>
<h3 class="profile-username text-center">Mega Lotto 6/45</h3>
<p class="text-muted text-center"></p>
</div>
</button></div>
<div class="col mx-auto" id="uposbutton"><button class="bg-transparent border-0 btn-block" onclick="">
<div class="card-body box-profile">
<div class="text-center">
<img class="rounded mx-auto d-block" src="assets/lotto642.png" width="75px" height="75px" style="overflow:hidden;"></div>
<h3 class="profile-username text-center">Lotto 6/42</h3>
<p class="text-muted text-center"></p>
</div>
</button></div>
<div class="col mx-auto" id="uposbutton"><button class="bg-transparent border-0 btn-block" onclick="">
<div class="card-body box-profile">
<div class="text-center">
<img class="rounded mx-auto d-block" src="assets/4dlotto.png" width="75px" height="75px" style="overflow:hidden;"></div>
<h3 class="profile-username text-center">4D Lotto</h3>
<p class="text-muted text-center"></p>
</div>
</button></div>
<div class="col mx-auto" id="uposbutton"><button class="bg-transparent border-0 btn-block" onclick="">
<div class="card-body box-profile">
<div class="text-center">
<img class="rounded mx-auto d-block" src="assets/3dlotto.png" width="75px" height="75px" style="overflow:hidden;"></div>
<h3 class="profile-username text-center">3D Lotto</h3>
<p class="text-muted text-center"></p>
</div>
</button></div>
<div class="col mx-auto" id="uposbutton"><button class="bg-transparent border-0 btn-block" onclick="">
<div class="card-body box-profile">
<div class="text-center">
<img class="rounded mx-auto d-block" src="assets/6dlotto.png" width="75px" height="75px" style="overflow:hidden;"></div>
<h3 class="profile-username text-center">6D Lotto</h3>
<p class="text-muted text-center"></p>
</div>
</button></div>
<div class="col mx-auto" id="uposbutton"><button class="bg-transparent border-0 btn-block" onclick="">
<div class="card-body box-profile">
<div class="text-center">
<img class="rounded mx-auto d-block" src="assets/2dlotto.png" width="75px" height="75px" style="overflow:hidden;"></div>
<h3 class="profile-username text-center">2D Lotto</h3>
<p class="text-muted text-center"></p>
</div>
</button></div>
-->
</div></div>
</div>
<div class="card" 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">
<div class="col mx-auto" id="">
Bet type:
</div>
<div class="col mx-auto" id="">
<select id="b-type" class="form-control"></select>
</div>
</div>
<div class="row card-body">
<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>
<div class="card" id="third-card-betting">
<div class="card-header ui-sortable-handle" style="cursor: move;">
<h3 class="card-title" style="" id="selected-numbers"></h3>
<div class="card-tools bg-warning" style="display: none;">
Maximum Numbers Selected
</div>
</div>
<div class="card-body text-center" id="bubble-sheet-card">
</div>
</div>
<div class="card" id="fourth-card-confirm" style="display: none;">
<div class="card-body text-center" id="bubble-sheet-card">
<button class="form-control border-rounded btn-danger" onclick="trytosubmitB();">Confirm</button>
</div>
</div>
<div id="br-space" style="display:none;">
<br><br><br><br><br><br><br>
</div>
<script>
var gamesdetails = null;
var gamemaxnumberofdigits=null;
function numberofselectedbuttons(){
return $(".l-button.btn-danger").length;
}
function IsSelectedNumbersMax(){
if ($(".custom-select.numbersinorderselect").length !== 0){
return true;
}
if (!gamemaxnumberofdigits || gamemaxnumberofdigits===-1){
return false;
}
if (numberofselectedbuttons()<gamemaxnumberofdigits){
return false;
}else{return true;}
}
function currentgametype(){
return $("#b-type").val();
}
function hideconfirmbutton(){
$("#third-card-betting .card-tools").hide();
$("#fourth-card-confirm").hide();
}
function hideselectednumbersTop(){
$("#selected-numbers").html("");
}
function showconfirmbutton(){
$("#third-card-betting .card-tools").show();$("#fourth-card-confirm").fadeIn(200);
$("#br-space").show();
}
function repopulatebtype(response){
console.log();
$("#b-type").empty();
$("#sched").empty();
hideconfirmbutton();
hideselectednumbersTop();
let dateoptions='';
for (var key in response) {
var optionValue = response[key]['hashkey'];
var optionText = response[key]['bet_type'];
$("#b-type").append($('<option>', { value: optionValue, text: optionText }));
}
reloadschedbyvalue();
}
function repopulatedatesched(response){
for (var key in response) {
var optionValue = response[key];
$("#sched").append($('<option>', { value: optionValue, text: optionValue }));
}
populatebuttonsb();
}
function reloadschedbyvalue(){
hideconfirmbutton();
hideselectednumbersTop();
$("#sched").empty();
const currentgametype = $("#b-type").val();
const dataRight = { game: currentgametype };
AjaxDo('?user/bet/sched',dataRight,repopulatedatesched, null,reqtype='POST');
}
function GenerateButtonsForNumberSelectionRANDOM(response_max_digits){
let newhtmlbuttons = '<div class="row">';
function newbuttonhtml(currentnumber){
return '<button class="l-button btn btn-primary rounded-circle" value="'+currentnumber+'">'+currentnumber+'</button>';
}
for (let i = 1; i <response_max_digits+1; i++) {
let currentnumber= i.toString().padStart(2, "0");
newhtmlbuttons += '<div class="col-1 mx-3 my-2">'+newbuttonhtml(currentnumber)+'</div>';
}
newhtmlbuttons +='</div>';
return newhtmlbuttons;
}
function GenerateButtonsForNumberSelectionINORDER(response_max_digits,response_number_of_digits){
let newhtmlbuttons = '<div class="row">';
function newbuttonhtml(currentnumber,maxdigits){
let newhtml='<select class="custom-select numbersinorderselect" id="SelectedNumber-'+currentnumber+'">';
for (let i = 1; i <maxdigits+1; i++) {
let newnumbernumber= i.toString().padStart(2, "0");
newhtml+='<option value="'+i+'">'+newnumbernumber+'</option>';
}
return newhtml+='</select>';
}
for (let i = 1; i <response_number_of_digits+1; i++) {
let currentnumber= i.toString().padStart(2, "0");
newhtmlbuttons += '<div class="col mx-auto"><br>'+currentnumber+' '+newbuttonhtml(currentnumber,response_max_digits)+'</div>';
}
newhtmlbuttons +='</div>';
return newhtmlbuttons;
}
function populatebuttonsnow(response) {
hideconfirmbutton();
hideselectednumbersTop();
let newhtmlbuttons; // Declare the variable outside the if-else block
if (response.numbers_must_be_in_order) {
newhtmlbuttons =GenerateButtonsForNumberSelectionINORDER(response.max_digits,response.number_of_digits);
// $("#fourth-card-confirm").show();
showconfirmbutton();
} else {
newhtmlbuttons = GenerateButtonsForNumberSelectionRANDOM(response.max_digits);
}
$("#bubble-sheet-card").html(newhtmlbuttons);
$("#bubble-sheet-card").fadeIn(200);
var Bbuttons = [];
gamemaxnumberofdigits = response.number_of_digits;
$(".l-button").click(function () {
if ($(this).hasClass("btn-primary")) {
if (!IsSelectedNumbersMax()) {
$(this).removeClass("btn-primary");
$(this).addClass("btn-danger");
} else {
// Handle case when max numbers are selected
}
} else {
$(this).removeClass("btn-danger");
$(this).addClass("btn-primary");
$("#third-card-betting .card-tools").hide();
$("#fourth-card-confirm").hide();
}
showSelectedNumbers(gamemaxnumberofdigits);
});
}
function populatebuttonsb() {
$("#bubble-sheet-card").fadeOut(200);
$("#bubble-sheet-card").empty();
const dataRight = { game: $("#b-type").val() };
AjaxDo('?user/bet/buttons', dataRight, populatebuttonsnow, null, reqtype = 'POST');
}
function showSelectedNumbers(number_of_digits=-1) {
const selectedButtons = document.querySelectorAll('.l-button.btn-danger');
let selectedNumbers = '';
if (selectedButtons.length===number_of_digits){
showconfirmbutton();
}
selectedButtons.forEach(button => {
selectedNumbers += button.textContent + '-';
});
document.getElementById('selected-numbers').textContent = 'Selected Numbers: ' + selectedNumbers;
return selectedNumbers;
}
function getselectednumbers(){
var buttonValues = "";
if ($(".l-button.btn-danger").length === 0) {
const selectedValues = [];
$(".numbersinorderselect").each(function() {
if ($(this).is("select")) {
let currentnumber= $(this).val().toString().padStart(2, "0")
selectedValues.push($(this).val());
buttonValues+=currentnumber+'-';
}
});
} else {
$(".l-button.btn-danger").each(function() {
var buttonValue = $(this).val();
buttonValues += buttonValue + "-";
});
}
return buttonValues;
}
function BetFailed(response){
CreateAndShowModal('betting-failed','Failed','Your bet didn\'t go through. Please Try Again Later!','');
}
function BetSuccessful(response){
CreateAndShowModal('betting-success','Success','Successfully Entered Bet!','');
gotoPage('bet_qr',response);
}
function trytosubmitB(){
//let selectedNumbers = showSelectedNumbers();
let selectedNumbers = getselectednumbers();
if (!IsSelectedNumbersMax()){return false;}
function SubmitNow(response){
if(!response){BetFailed(); return false;}
else{
BetSuccessful(response);
}
}
const data = { user_target: currenttarget, game: currentgametype(), selected_numbers: selectedNumbers, schedule : $("#sched").val() };
AjaxDo('?user/bet/submit',data,SubmitNow, null,reqtype='POST');
}
$(document).ready(function() {
var currenttarget=0;
loaduserdatadashboard();
AjaxDo('?user/bet/tps',null,repopulatebtype, null,reqtype='POST');
const currentgametype = $("#b-type").val();
const dataRight = { game: currentgametype };
$("#b-type").change(reloadschedbyvalue);
});
if (currenttarget!==0){
function PostUserNumber(response){
CreateAndShowModal('TargetBetUserWarn','Betting for a Different User','You are betting for '+response+'.');
}
AjaxDo('?query/user/number/byhash',{ user_target: currenttarget},PostUserNumber, null,reqtype='POST');
}
</script>

View File

@@ -0,0 +1,620 @@
<br><br>
<div class="card-body card-info" id="main-card-body" style="">
<div class="row">
<div class="col-md-18">
Welcome
</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%;">
<div class="row">
<div class="col-md-6">
Total Balance
</div>
<div class="col-md-6" id="total-balance">
</div>
</div>
<div class="row">
<div class="col-md-6">
</div>
<div class="col-md-6" id="credited-balance">
</div>
</div>
<br><br>
<div class="row">
<div class="col-md-6 text-sm" id="phone-number">
...
</div>
<div class="col-md-6">
</div>
</div>
</div>
</div>
</div>
<div class="card" 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>
</div>
</div>
<div class="card" 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">
<div class="col mx-auto" id="">
Bet type:
</div>
<div class="col mx-auto" id="">
<select id="b-type" class="form-control"></select>
</div>
</div>
<div class="row card-body">
<div class="col mx-auto" id="">
Date:
</div>
<div class="col mx-auto" id="">
<div class="row schedrow">
<div class="col-6">
<input type="date" class="form-control" id="scheddate" name="scheddate">
</div>
<div class="col-6">
<select id="schedtime" class="form-control"></select>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="card" id="third-card-betting">
<div class="card-header ui-sortable-handle" style="cursor: move;">
<h3 class="card-title" style="" id="selected-numbers"></h3>
<div class="card-tools bg-warning" style="display: none;">
Maximum Numbers Selected
</div>
</div>
<div class="card-body text-center" id="bubble-sheet-card">
</div>
</div>
<div class="card" id="fourth-card-confirm" style="display: none;">
<div class="card-body text-center" id="bubble-sheet-card">
<button class="form-control border-rounded btn-danger" onclick="trytosubmitB();">Confirm</button>
</div>
</div>
<div id="br-space" style="display:none;">
<br><br><br><br><br><br><br>
</div>
<script>
var gamesdetails = null;
var gamemaxnumberofdigits = null;
var digitselection = null;
var numberofdigits = 0;
var numofbets = 0;
var minimumbet = null;
function numberofselectedbuttons() {
return $(".l-button.btn-danger").length;
}
function IsSelectedNumbersMax() {
if ($(".custom-select.numbersinorderselect").length !== 0) {
return true;
}
if (!gamemaxnumberofdigits || gamemaxnumberofdigits === -1) {
return false;
}
if (numberofselectedbuttons() < gamemaxnumberofdigits) {
return false;
} else { return true; }
}
function currentgametype() {
return $("#b-type").val();
}
function hideconfirmbutton() {
$("#third-card-betting .card-tools").hide();
$("#fourth-card-confirm").hide();
}
function hideselectednumbersTop() {
$("#selected-numbers").html("");
}
function showconfirmbutton() {
$("#third-card-betting .card-tools").show(); $("#fourth-card-confirm").fadeIn(200);
$("#br-space").show();
}
function repopulatebtype(response) {
//$("#b-type").empty();
$("#sched").empty();
hideconfirmbutton();
hideselectednumbersTop();
let dateoptions = '';
//for (var key in bet_types) {
// var optionValue = key;
//var optionText = bet_types[key];
//$("#b-type").append($('<option>', { value: optionValue, text: optionText }));
$("#b-type").html(bet_types_options);
//}
reloadschedbyvalue();
}
function repopulatedatesched(response) {
// UpdateSchedData();
populatebuttonsb();
}
document.getElementById('scheddate').addEventListener('change', function () {
updateSchedtimes();
});
function reloadschedbyvalue(btypeid = 'b-type') {
//hideconfirmbutton();
hideselectednumbersTop();
resetDatePicker();
//const currentgametype = $('#'+btypeid).val();
//const dataRight = { game: currentgametype };
// repopulatedatesched();
AjaxDo('?user/bet/sched', dataRight=null, repopulatedatesched, null, reqtype = 'POST');
}
function generateAmountButton() {
return 'Amount: <input type="number" min=' + minimumbet + ' max=' + total_balance + ' class="form-control amountcontrol">';
}
function GenerateAddBetButton() {
return '<button style="" class="form-control btn-primary" onclick="AddBetNow(this)">Add Bet</button>';
}
function AmounthasEmptyOrZeroValue() {
let hasEmptyOrZero = false;
$('.amountcontrol').each(function () {
const inputValue = $(this).val();
if (inputValue === '' || parseFloat(inputValue) < 10) {
hasEmptyOrZero = true;
return false;
}
});
return hasEmptyOrZero;
}
function isTotalBalanceExceeded() {
const totalBalance = parseFloat(total_balance);
let currentTotal = 0;
$('.amountcontrol').each(function () {
const inputValue = parseFloat($(this).val());
if (!isNaN(inputValue)) {
currentTotal += inputValue;
}
});
return currentTotal > totalBalance;
}
function EmptyAmountControl() {
$('.amountcontrol').val('');
}
function GenerateNewBet() {
numofbets++;
numberofdigits = 0;
let html = "<div class='row NumRow'>";
digitselection.forEach(function (rowValues, rowIndex) {
html += '<div class="col-3 mx-auto" style="padding-bottom:10px;">';
html += ("<select class='form-control num-select'>");
numberofdigits++;
rowValues.forEach(function (value) {
html += '<option value=' + value + '>' + value + '</option>';
});
html += '</select></div>'
});
html += '</div>';
return html + '<br><br>' + generateAmountButton() + '<br><br>' + GenerateAddBetButton() + '<hr class="bet-separator">';
}
function AddBetNow(button) {
if (DuplicateBetNumbers()) { return false; }
if (AmounthasEmptyOrZeroValue()) { EmptyAmountWarning(); return false; }
if (isTotalBalanceExceeded()) {
TotalBalanceExceededWarning();
EmptyAmountControl();
return false;
}
$("#bubble-sheet-card").append('<br>' + GenerateNewBet() + '');
$(window).scrollTop($(document).height());
$(button).remove();
}
function populatebuttonsnow(response) {
//console.log(response);
numofbets = 0;
minimumbet = response.price;
showconfirmbutton();
hideselectednumbersTop();
$('#bubble-sheet-card').fadeOut(200);
$('#bubble-sheet-card').empty();
let newhtmlbuttons;
if (response.digit_selection) {
digitselection = response.digit_selection;
$("#bubble-sheet-card").html(GenerateNewBet());
}
newhtmlbuttons += '<br><br>'
//$("#bubble-sheet-card").html(newhtmlbuttons);
$("#bubble-sheet-card").fadeIn(200);
var Bbuttons = [];
gamemaxnumberofdigits = response.number_of_digits;
$(".l-button").click(function () {
if ($(this).hasClass("btn-primary")) {
if (!IsSelectedNumbersMax()) {
$(this).removeClass("btn-primary");
$(this).addClass("btn-danger");
} else {
// Handle case when max numbers are selected
}
} else {
$(this).removeClass("btn-danger");
$(this).addClass("btn-primary");
$("#third-card-betting .card-tools").hide();
$("#fourth-card-confirm").hide();
}
showSelectedNumbers(gamemaxnumberofdigits);
});
}
function populatebuttonsb() {
$("#bubble-sheet-card").fadeOut(200);
$("#bubble-sheet-card").empty();
const dataRight = { game: $("#b-type").val() };
AjaxDo('?user/bet/buttons', dataRight, populatebuttonsnow, null, reqtype = 'POST');
}
function showSelectedNumbers(number_of_digits = -1) {
const selectedButtons = document.querySelectorAll('.l-button.btn-danger');
let selectedNumbers = '';
if (selectedButtons.length === number_of_digits) {
showconfirmbutton();
}
selectedButtons.forEach(button => {
selectedNumbers += button.textContent + '-';
});
document.getElementById('selected-numbers').textContent = 'Selected Numbers: ' + selectedNumbers;
return selectedNumbers;
}
function getselectednumbersold() {
var buttonValues = "";
if ($(".l-button.btn-danger").length === 0) {
const selectedValues = [];
$(".numbersinorderselect").each(function () {
if ($(this).is("select")) {
let currentnumber = $(this).val().toString().padStart(2, "0")
selectedValues.push($(this).val());
buttonValues += currentnumber + '-';
}
});
} else {
$(".l-button.btn-danger").each(function () {
var buttonValue = $(this).val();
buttonValues += buttonValue + "-";
});
}
return buttonValues;
}
function getselectednumbers() {
const numSelectValues = $('.num-select').map(function () {
return $(this).val();
}).get();
const result = [];
let currentIndex = 0;
while (currentIndex < numSelectValues.length) {
const chunkSize = Math.min(numberofdigits, numSelectValues.length - currentIndex);
const chunk = numSelectValues.slice(currentIndex, currentIndex + chunkSize);
result.push(chunk);
currentIndex += chunkSize;
}
return result;
}
function collectAmountControlValues() {
return $('.amountcontrol').map(function () {
return $(this).val();
}).get();
}
function mergeValuesIntoObjects(numSelectValues, amountControlValues) {
const result = [];
const maxLength = Math.max(numSelectValues.length, amountControlValues.length);
for (let i = 0; i < maxLength; i++) {
const pair = {
numSelect: numSelectValues[i] || null,
amountControl: amountControlValues[i] || null
};
result.push(pair);
}
return result;
}
function getAllSelectedNumbers() {
const numSelectValues = getselectednumbers(numberofdigits);
const amountControlValues = collectAmountControlValues();
const mergedObjects = mergeValuesIntoObjects(numSelectValues, amountControlValues, numberofdigits);
return mergedObjects;
}
function BetFailed(response) {
console.log(response);
CreateAndShowModal('betting-failed', 'Failed', 'Your bet didn\'t go through.!<br><br><br>' + response, '');
}
function BetSuccessful(response) {
CreateAndShowModal('betting-success', 'Success', 'Successfully Entered Bet!', '');
gotoPage('bet_qr', response);
}
function TotalBalanceExceededWarning() {
CreateAndShowModal('balance-not-enough-warning', 'Total Amount Exceeded', 'Not Enough Balance!', '');
}
function EmptyAmountWarning() {
CreateAndShowModal('empty-amount-warning', 'Amount', 'Invalid Amount Entered.<br><br>Please Enter Valid Amount!', '');
}
function CheckTimeWarning() {
CreateAndShowModal('wrong-time-warning', 'Time', 'Wrong Time Entered.<br><br>Please Pick a proper time!<br><br> If no Time is available pick another date.', '');
}
function SubmitFailed() {
CreateAndShowModal('submit-failed-warning', 'Failed', 'Unable to Place Bet Please Try Again later!', '');
}
function SubmitNow(response) {
//console.log(response);
/*
if (Array.isArray(response) || !response || typeof response !== "string") {
BetFailed(response);
return false;
}
*/
if (response.length !== 72) {
BetFailed(response);
return false;
}
BetSuccessful(response);
}
function DuplicateBetNumbers() {
let selectedNumbers = getselectednumbers();
let Duplicates = findDuplicatesInMultidimensionalArray(selectedNumbers);
if (Duplicates) {
ModalQuickDismiss('Duplicate', 'Duplicate Bet Numbers: ' + implodeArrayWithHyphen(Duplicates[0]), modalid = 'modal-bet-duplicate-bets-warning');
return true;
};
}
function trytosubmitB() {
if (DuplicateBetNumbers()) { return false; }
if (isTotalBalanceExceeded()) { TotalBalanceExceededWarning(); return false; }
if (AmounthasEmptyOrZeroValue()) { EmptyAmountWarning(); return false; }
let selectedNumbers = getAllSelectedNumbers();
if (!$('#schedtime').val()) { CheckTimeWarning(); return false; }
const data = { user_target: currenttarget, game: currentgametype(), selected_numbers: selectedNumbers, schedule: $("#scheddate").val() + ' ' + $("#schedtime").val() };
AjaxDo('?user/new/bet/transaction', data, SubmitNow, null, reqtype = 'POST');
}
function selectNextDate() {
const datePicker = document.getElementById('scheddate');
const currentDate = new Date(datePicker.value);
currentDate.setDate(currentDate.getDate() + 1);
const nextDate = currentDate.toISOString().split('T')[0];
datePicker.value = nextDate;
}
schedtimeElementTarget = document.getElementById('schedtime');
observer = new MutationObserver((mutations) => {
mutations.forEach(() => {
const schedtimeValue = schedtimeElementTarget.value;
const bTypeValue = document.getElementById('b-type').value;
const schedDateValue = document.getElementById('scheddate').value;
if (schedtimeValue === '') {
if (bTypeValue && schedDateValue) {
UpdateSchedDateifSchedTimeisEmpty();
}
}
});
});
// Start observing the select element for attribute and child list changes
observer.observe(schedtimeElementTarget, {
attributes: true, // Observe attribute changes (e.g., value change)
childList: true, // Observe addition/removal of child elements
subtree: true // Observe changes in descendants
});
$(document).ready(function () {
if (currenttarget === 0 || currenttarget ==='' || currenttarget==='0') {
loaduserdatadashboard();
}
AjaxDo('?user/bet/tps', null, repopulatebtype, null, reqtype = 'POST');
const currentgametype = $("#b-type").val();
// const dataRight = { game: currentgametype };
$("#b-type").change(reloadschedbyvalue);
if (currenttarget !=='0' && currenttarget !=0 && currenttarget !='') {
function PostUserNumber(response) {
CreateAndShowModal('TargetBetUserWarn', 'Betting for a Different User', 'You are betting for ' + response + '.');
}
AjaxDo('?query/user/number/byhash', { user_target: currenttarget }, PostUserNumber, null, reqtype = 'POST');
function UpdateTotalBalanceforDifferentUser(response) {
if (!response) { return false; }
total_balance = response;
}
AjaxDo('?query/user/balance', { user_target: currenttarget }, UpdateTotalBalanceforDifferentUser, null, reqtype = 'POST');
}
});
</script>

View File

@@ -0,0 +1,312 @@
<br><br>
<div class="card-body card-info" id="main-card-body" style="">
<div class="row">
<div class="col-md-18">
Welcome
</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%;">
<div class="row">
<div class="col-md-6">
Total Balance
</div>
<div class="col-md-6" id="total-balance">
</div>
</div>
<div class="row">
<div class="col-md-6">
</div>
<div class="col-md-6" id="credited-balance">
</div>
</div>
<br><br>
<div class="row">
<div class="col-md-6 text-sm" id="phone-number">
...
</div>
<div class="col-md-6" >
</div>
</div>
</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">Assigned Parent:</h4>
</div>
<div class="col">
<h4 class="card-title" id="assigned-coordinator">...</h4>
</div>
</div>
<div class="card-tools">
</div>
</div>
<div class="card-body " id="credit-amount-request-form">
<div class="row">
<div class="col-6">
<input class="form-control" type="number" id="request-credit-amount-field" placeholder="Amount to Request" >
</div>
<div class="col-6">
<button value="Request" id ="request-credit-initial-button" class=" form-control btn btn-primary">Request</button>
</div>
</div>
</div>
</div>
<script>
function CreateAndShowModalCreditConfirmation(){
const modalid="modal-credit-request-confirmation";
const modaltitle="Continue?";
const modalbody=`
<p>You are requesting credit from your assigned coordinator. Would you like to continue?</p>
<p>Amount</p><p id="amount-to-request-text-modal"></p>
`;
const modalfooter=`<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
<button type="button" class="btn btn-primary" id="request-credit-now">Continue</button>`;
CreateAndShowModal(modalid,modaltitle,modalbody,modalfooter,modalfooterclose=false,topclosebutton=true,modalbodyclass='modal-body',modalheaderclass='modal-header');
$("#amount-to-request-text-modal").html($("#request-credit-amount-field").val().trim());
$("#request-credit-now").on("click", function() {
function SendCreditRequest(response){
ErrorCreditRequestResponse(response);
SuccessCreditRequestPendingResponse(response);
CurrentPendingCreditRequestResponse(response);
}
AjaxDo('?sendcreditrequestfromuser', {amount: $("#request-credit-amount-field").val().trim(), user_target: currenttarget}, SendCreditRequest, null, reqtype = 'POST');
});
}
function CreateAndShowModalCreditError(){
const modalid="modal-credit-request-failed";
const modaltitle="Error";
const modalbody=`
<p>Failed to send credit request. Please try again later!</p>
`;
const modalfooter=``;
const modalheaderclass='modal-header bg-danger';
CreateAndShowModal(modalid,modaltitle,modalbody,modalfooter,modalfooterclose=true,topclosebutton=true,modalbodyclass='modal-body',modalheaderclass);
}
function CreateAndShowModalCreditPending(){
const modalid="modal-credit-request-pending";
const modaltitle="Pending";
const modalbody=`
<p>Your Request hava been submitted. Please wait for approval! Thank you.</p>
`;
const modalfooter=``;
const modalheaderclass='modal-header bg-primary';
CreateAndShowModal(modalid,modaltitle,modalbody,modalfooter,modalfooterclose=true,topclosebutton=true,modalbodyclass='modal-body',modalheaderclass);
}
function CreateAndShowModalCreditBlockedbecauseofPending(){
const modalid="modal-credit-request-pending-waiting";
const modaltitle="Current Pending Request";
const modalbody=`
<p>Your Request was NOT submitted. You have a pending credit request. </p><p>Please wait for approval! Thank you.</p>
`;
const modalfooter=``;
const modalheaderclass='modal-header bg-warning';
CreateAndShowModal(modalid,modaltitle,modalbody,modalfooter,modalfooterclose=true,topclosebutton=true,modalbodyclass='modal-body',modalheaderclass);
}
function loaduserdatadashboard(){
$.get("?userdatadashboard", function(data, status){
$( "#total-balance" ).html(data.total_balance);
$( "#pending-credit" ).html(data.total_credit);
$( "#phone-number" ).html(data.number);
});
}
function loadcoordinatornumber(){
$( "#assigned-coordinator" ).load( "?coordinatornumber" );
}
function ErrorCreditRequestResponse(response=false){
if (response === '1' ){return true;}else if (response === '0' ){
$("#modal-credit-request-confirmation").modal("hide");
$("#modal-credit-request-pending").modal("hide");
CreateAndShowModalCreditError();
return;
}
}
function CheckPendingRequestForUI(){
function showpendingrequesthtml(amount){
if (amount){
const conhtml= `<div class="row">
<div class="col-6">
<h3>Current Pending Request</h3>
</div>
<div class="col-6"><h2>P
`+amount+`</h2>
</div></div>`;
$("#credit-amount-request-form").html(conhtml);
}
}
if (currenttarget===0){
/*
$.get("?user/creditrequest/check/pending", function(data, status){
showpendingrequesthtml(data.amount);
});
*/
AjaxDo('?user/creditrequest/check/pending', { user_target: currenttarget}, showpendingrequesthtml, null, reqtype = 'POST');
}
else{
AjaxDo('?user/creditrequest/check/pending', { user_target: currenttarget}, showpendingrequesthtml, null, reqtype = 'POST');
}
}
function SuccessCreditRequestPendingResponse(response=true){
if (response === '0'){return true;}else if (response ==='1'){
$("#modal-credit-request-confirmation").modal("hide");
$("#modal-credit-request-failed").modal("hide");
CreateAndShowModalCreditPending();
CheckPendingRequestForUI();
return;
}
}
function CurrentPendingCreditRequestResponse(response){
if (response=== null || response ==='1' || response === '0'){
return;
}
$("#modal-credit-request-confirmation").modal("hide");
$("#modal-credit-request-failed").modal("hide");
$("#modal-credit-request-pending").modal("hide");
CreateAndShowModalCreditBlockedbecauseofPending();
}
$(document).ready(function() {
var currenttarget=0;
loaduserdatadashboard();
loadcoordinatornumber();
CheckPendingRequestForUI();
$("#request-credit-initial-button").on("click", function() {
let inputValue = $("#request-credit-amount-field").val().trim();
if (inputValue && inputValue.length > 0 && !isNaN(inputValue) && parseFloat(inputValue) > 0) {
CreateAndShowModalCreditConfirmation(); }
else { $("#modal-credit-request-confirmation").modal("hide"); }
});
});
</script>

View File

@@ -0,0 +1,80 @@
<br>
<h2 class="fw_6 text-center">Cornerstone Focus Property Alliance</h2><br>
<div class="card-section" id="main-card-section">
</div>
<br>
<div class="bill-content">
<div class="tf-container" id="recents_home">
</div>
</div>
<script>
statsarray = [["Today", 0, "Leads", "left", "leads-today-no"],
["Actionable", 0, "Leads", "left", "actionable-leads-no"],
["Sold", 0, "Today", "right", "sold-today-no"],
["Sold", 0, "This Month", "right", "sold-monthly-no"]
//,["Sold", 0, "Total", "right", "sold-all-no"]
];
balancewrapper_item_array = [["New Lead", "NewLeads", "", "/assets/NewLeads.png", "", "", "", ""], ["List Leads", "ListLeads", "0", "/assets/ListLeads.png", "", "", "", ""]];
balancebox = UIcreateBalanceBoxfromArray(statsarray, balancewrapper_item_array);
servicesbuttonarray = [['/assets/ListLeads.png', 'Leads', 'ListLeads', ''],
['/assets/house.png', 'Properties', 'ListProperties', ''],
['/assets/NewProperty.png', 'New Property', 'NewProperty']];
servicesbox = UIServices_FullDIV_GOTOPAGE_Array('', '', '', '', servicesbuttonarray);
dualcolumn_button_array = [['Leads', 'ListLeads', '', '/assets/ListLeads.png'],
['Properties', 'ListProperties', '', '/assets/house.png']
];
dualcolumnhtml = UISideText_DualColumnButton_Array(dualcolumn_button_array);
dualcolumnhtml='';
recents_list_array = [['Loading', 'Please Wait...', '', 'xxxwait', 'unknown', '', '/assets/sync.png']];
arrowlist_button_array = '';
searchbox_html = UISearchBox_with_BUTTONS_FULL('Recent', recents_list_array, arrowlist_button_array, 'RecentsPage', '', 'View All', 'HomeRecentList', 'home_recent_search', 'Search');
$('#main-card-section').append(balancebox);
$('#main-body').append(servicesbox + dualcolumnhtml + '<br><br>' + searchbox_html);
function UIHome_Leads_Today_Change(num) {
if (num === false || num === undefined || num === null) {
return false;
}
$('#leads-today-no').html(num);
}
function loadrecents_home() {
}
function HomeULT_reinitilize_loaders() {
Preloaders.Account_Settings_Details();
Preloaders.PreferredSitesOption();
Preloaders.ListLeadsData();
Preloaders.ListPropertyData(true,false,false);
}
$().ready(function () {
changeTopbarTitle('Home');
loadrecents_home();
HomeULT_reinitilize_loaders();
CheckAndSetDarkMode();
});
</script>

View File

@@ -0,0 +1,51 @@
<script id="main-script">
cardshtml='<br><br>'+CreateBalanceCard(titletext='Welcome Leader',maincardid='main-card-body',firstrowtext='Total Balance',firstrowvalueid='total-balance',firstrowvaluetext='...' ,secondrowtext='',secondrowvalueid='',secodrowvaluetext='',secondrowvisible=false,footerrowid='phone-number',footerrowtext='...')
+ `<br><br>`;
cardshtml+= createCard(cardtitle='',cardid='secondary-card',cardtools='',cardbodyid='HomeMenuButtons',cardbodytext='',cardbodyclassadd='row','',true);
cardshtml+= createCard(cardtitle='Draws Today',cardid='draws',cardtools='',cardbodyid='div_draw_numbers_today',cardbodytext='',cardbodyclassadd='',maincardstyle='');
cardshtml+= createCard(cardtitle='Winning Numbers Today',cardid='winning-numbers-today-home',cardtools='',cardbodyid='div_winning_numbers_today',cardbodytext='',cardbodyclassadd='',maincardstyle='');
cardshtml+='<br><br>';
$('#main-body').html(cardshtml);
loaddrawnumberstoday();
loadwinningnumberstoday();
if (typeof HomeButtonsHtml === 'undefined') {
let HomeButtonsHtml = '';
}
HomeButtonsHtml='';
HomeButtonsHtml = HomeMenuButtons('assets/qrcode.svg','Scan QR', 'qr_reader',0,'35%','35%');
HomeButtonsHtml += HomeMenuButtons('assets/bets.png','Place Bet', 'place_bet',0,'20%','35%');
HomeButtonsHtml += HomeMenuButtons('assets/user-list.png','Users', 'user_list',0,'20%','35%');
HomeButtonsHtml += HomeMenuButtons('assets/lotteryschedule.png','Game Schedule', 'lottery_schedule',0,'20%','50%');
HomeButtonsHtml += HomeMenuButtons('assets/CreateUser.png','Create User', 'create_user',0,'20%','40%');
HomeButtonsHtml += HomeMenuButtons('assets/creditrequests.png','Credit Requests', 'credit_requests',0,'20%','40%');
HomeButtonsHtml += HomeMenuButtons('assets/request-credit.png','Request Credit', 'request_credit',0,'20%','40%');
HomeButtonsHtml += HomeMenuButtons('assets/reports.png','Reports', 'MyReports',0,'20%','40%');
HomeButtonsHtml += HomeMenuButtons('assets/gear.png','Account Settings', 'account_settings',0,'20%','40%');
$('#HomeMenuButtons').html(HomeButtonsHtml);
//$("#balance_bottom_nav").hide();
//$('#bets_history_bottom_nav').hide();
loaduserdatadashboard();
loadwinningnumberstoday();
loaddrawnumberstoday();
setInterval(loaduserdatadashboard, '20000');
setInterval(loadwinningnumberstoday, '20000');
setInterval(loaddrawnumberstoday, '20000');
</script>

Some files were not shown because too many files have changed in this diff Show More