refactor: replace the javascript popup with sweetalert which prevent some devices to purchase data plans and packages via captive portal, clean up footer template and improve script formatting
This commit is contained in:
parent
27fd677a0a
commit
0a29ec9a86
@ -1,25 +1,25 @@
|
|||||||
</section>
|
</section>
|
||||||
</div>
|
</div>
|
||||||
{if isset($_c['CompanyFooter'])}
|
{if isset($_c['CompanyFooter'])}
|
||||||
<footer class="main-footer">
|
<footer class="main-footer">
|
||||||
{$_c['CompanyFooter']}
|
{$_c['CompanyFooter']}
|
||||||
<div class="pull-right">
|
<div class="pull-right">
|
||||||
<a href="javascript:showPrivacy()">Privacy</a>
|
<a href="javascript:showPrivacy()">Privacy</a>
|
||||||
•
|
•
|
||||||
<a href="javascript:showTaC()">T & C</a>
|
<a href="javascript:showTaC()">T & C</a>
|
||||||
</div>
|
</div>
|
||||||
</footer>
|
</footer>
|
||||||
{else}
|
{else}
|
||||||
<footer class="main-footer">
|
<footer class="main-footer">
|
||||||
PHPNuxBill by <a href="https://github.com/hotspotbilling/phpnuxbill" rel="nofollow noreferrer noopener"
|
PHPNuxBill by <a href="https://github.com/hotspotbilling/phpnuxbill" rel="nofollow noreferrer noopener"
|
||||||
target="_blank">iBNuX</a>, Theme by <a href="https://adminlte.io/" rel="nofollow noreferrer noopener"
|
target="_blank">iBNuX</a>, Theme by <a href="https://adminlte.io/" rel="nofollow noreferrer noopener"
|
||||||
target="_blank">AdminLTE</a>
|
target="_blank">AdminLTE</a>
|
||||||
<div class="pull-right">
|
<div class="pull-right">
|
||||||
<a href="javascript:showPrivacy()">Privacy</a>
|
<a href="javascript:showPrivacy()">Privacy</a>
|
||||||
•
|
•
|
||||||
<a href="javascript:showTaC()">T & C</a>
|
<a href="javascript:showTaC()">T & C</a>
|
||||||
</div>
|
</div>
|
||||||
</footer>
|
</footer>
|
||||||
{/if}
|
{/if}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@ -50,156 +50,175 @@
|
|||||||
<script src="{$app_url}/ui/ui/scripts/custom.js?2025.2.5"></script>
|
<script src="{$app_url}/ui/ui/scripts/custom.js?2025.2.5"></script>
|
||||||
|
|
||||||
{if isset($xfooter)}
|
{if isset($xfooter)}
|
||||||
{$xfooter}
|
{$xfooter}
|
||||||
{/if}
|
{/if}
|
||||||
|
|
||||||
{if $_c['tawkto'] != ''}
|
{if $_c['tawkto'] != ''}
|
||||||
<!--Start of Tawk.to Script-->
|
<!--Start of Tawk.to Script-->
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
var isLoggedIn = false;
|
var isLoggedIn = false;
|
||||||
var Tawk_API = {
|
var Tawk_API = {
|
||||||
onLoad: function() {
|
onLoad: function () {
|
||||||
Tawk_API.setAttributes({
|
Tawk_API.setAttributes({
|
||||||
'username' : '{$_user['username']}',
|
'username': '{$_user['username']}',
|
||||||
'service' : '{$_user['service_type']}',
|
'service': '{$_user['service_type']}',
|
||||||
'balance' : '{$_user['balance']}',
|
'balance': '{$_user['balance']}',
|
||||||
'account' : '{$_user['account_type']}',
|
'account': '{$_user['account_type']}',
|
||||||
'phone' : '{$_user['phonenumber']}'
|
'phone': '{$_user['phonenumber']}'
|
||||||
}, function(error) {
|
}, function (error) {
|
||||||
console.log(error)
|
console.log(error)
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
};
|
||||||
|
var Tawk_LoadStart = new Date();
|
||||||
|
Tawk_API.visitor = {
|
||||||
|
name: '{$_user['fullname']}',
|
||||||
|
email: '{$_user['email']}',
|
||||||
|
phone: '{$_user['phonenumber']}'
|
||||||
};
|
};
|
||||||
var Tawk_LoadStart = new Date();
|
(function () {
|
||||||
Tawk_API.visitor = {
|
var s1 = document.createElement("script"),
|
||||||
name: '{$_user['fullname']}',
|
s0 = document.getElementsByTagName("script")[0];
|
||||||
email: '{$_user['email']}',
|
s1.async = true;
|
||||||
phone: '{$_user['phonenumber']}'
|
s1.src = 'https://embed.tawk.to/{$_c['tawkto']}';
|
||||||
};
|
s1.charset = 'UTF-8';
|
||||||
(function() {
|
s1.setAttribute('crossorigin', '*');
|
||||||
var s1 = document.createElement("script"),
|
s0.parentNode.insertBefore(s1, s0);
|
||||||
s0 = document.getElementsByTagName("script")[0];
|
})();
|
||||||
s1.async = true;
|
</script>
|
||||||
s1.src = 'https://embed.tawk.to/{$_c['tawkto']}';
|
<!--End of Tawk.to Script-->
|
||||||
s1.charset = 'UTF-8';
|
{/if}
|
||||||
s1.setAttribute('crossorigin', '*');
|
|
||||||
s0.parentNode.insertBefore(s1, s0);
|
|
||||||
})();
|
|
||||||
</script>
|
|
||||||
<!--End of Tawk.to Script-->
|
|
||||||
{/if}
|
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
const toggleIcon = document.getElementById('toggleIcon');
|
const toggleIcon = document.getElementById('toggleIcon');
|
||||||
const body = document.body;
|
const body = document.body;
|
||||||
const savedMode = localStorage.getItem('mode');
|
const savedMode = localStorage.getItem('mode');
|
||||||
if (savedMode === 'dark') {
|
if (savedMode === 'dark') {
|
||||||
|
body.classList.add('dark-mode');
|
||||||
|
toggleIcon.textContent = '🌞';
|
||||||
|
}
|
||||||
|
|
||||||
|
function setMode(mode) {
|
||||||
|
if (mode === 'dark') {
|
||||||
body.classList.add('dark-mode');
|
body.classList.add('dark-mode');
|
||||||
toggleIcon.textContent = '🌞';
|
toggleIcon.textContent = '🌞';
|
||||||
|
} else {
|
||||||
|
body.classList.remove('dark-mode');
|
||||||
|
toggleIcon.textContent = '🌜';
|
||||||
}
|
}
|
||||||
|
}
|
||||||
function setMode(mode) {
|
|
||||||
if (mode === 'dark') {
|
toggleIcon.addEventListener('click', () => {
|
||||||
body.classList.add('dark-mode');
|
if (body.classList.contains('dark-mode')) {
|
||||||
toggleIcon.textContent = '🌞';
|
setMode('light');
|
||||||
} else {
|
localStorage.setItem('mode', 'light');
|
||||||
body.classList.remove('dark-mode');
|
} else {
|
||||||
toggleIcon.textContent = '🌜';
|
setMode('dark');
|
||||||
}
|
localStorage.setItem('mode', 'dark');
|
||||||
}
|
}
|
||||||
|
});
|
||||||
toggleIcon.addEventListener('click', () => {
|
</script>
|
||||||
if (body.classList.contains('dark-mode')) {
|
|
||||||
setMode('light');
|
|
||||||
localStorage.setItem('mode', 'light');
|
|
||||||
} else {
|
|
||||||
setMode('dark');
|
|
||||||
localStorage.setItem('mode', 'dark');
|
|
||||||
}
|
|
||||||
});
|
|
||||||
</script>
|
|
||||||
|
|
||||||
|
|
||||||
{literal}
|
{literal}
|
||||||
<script>
|
<script>
|
||||||
var listAtts = document.querySelectorAll(`[api-get-text]`);
|
var listAtts = document.querySelectorAll(`[api-get-text]`);
|
||||||
listAtts.forEach(function(el) {
|
listAtts.forEach(function (el) {
|
||||||
$.get(el.getAttribute('api-get-text'), function(data) {
|
$.get(el.getAttribute('api-get-text'), function (data) {
|
||||||
el.innerHTML = data;
|
el.innerHTML = data;
|
||||||
});
|
|
||||||
});
|
});
|
||||||
$(document).ready(function() {
|
});
|
||||||
var listAtts = document.querySelectorAll(`button[type="submit"]`);
|
$(document).ready(function () {
|
||||||
listAtts.forEach(function(el) {
|
var listAtts = document.querySelectorAll(`button[type="submit"]`);
|
||||||
if (el.addEventListener) { // all browsers except IE before version 9
|
listAtts.forEach(function (el) {
|
||||||
el.addEventListener("click", function() {
|
if (el.addEventListener) { // all browsers except IE before version 9
|
||||||
|
el.addEventListener("click", function () {
|
||||||
|
$(this).html(
|
||||||
|
`<span class="loading"></span>`
|
||||||
|
);
|
||||||
|
setTimeout(() => {
|
||||||
|
$(this).prop("disabled", true);
|
||||||
|
}, 100);
|
||||||
|
}, false);
|
||||||
|
} else {
|
||||||
|
if (el.attachEvent) { // IE before version 9
|
||||||
|
el.attachEvent("click", function () {
|
||||||
$(this).html(
|
$(this).html(
|
||||||
`<span class="loading"></span>`
|
`<span class="loading"></span>`
|
||||||
);
|
);
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
$(this).prop("disabled", true);
|
$(this).prop("disabled", true);
|
||||||
}, 100);
|
}, 100);
|
||||||
}, false);
|
});
|
||||||
} else {
|
}
|
||||||
if (el.attachEvent) { // IE before version 9
|
}
|
||||||
el.attachEvent("click", function() {
|
$(function () {
|
||||||
$(this).html(
|
$('[data-toggle="tooltip"]').tooltip()
|
||||||
`<span class="loading"></span>`
|
})
|
||||||
);
|
});
|
||||||
setTimeout(() => {
|
});
|
||||||
$(this).prop("disabled", true);
|
|
||||||
}, 100);
|
function ask(field, text) {
|
||||||
});
|
const txt = field.innerHTML;
|
||||||
|
|
||||||
|
field.innerHTML = `<span class="loading"></span>`;
|
||||||
|
field.setAttribute("disabled", true);
|
||||||
|
|
||||||
|
Swal.fire({
|
||||||
|
title: 'Are you sure?',
|
||||||
|
text: text,
|
||||||
|
icon: 'warning',
|
||||||
|
showCancelButton: true,
|
||||||
|
confirmButtonText: 'Yes, proceed',
|
||||||
|
cancelButtonText: 'Cancel',
|
||||||
|
}).then((result) => {
|
||||||
|
let delay = result.isConfirmed ? 400 : 500;
|
||||||
|
|
||||||
|
setTimeout(() => {
|
||||||
|
field.innerHTML = txt;
|
||||||
|
field.removeAttribute("disabled");
|
||||||
|
|
||||||
|
if (result.isConfirmed) {
|
||||||
|
const form = field.closest('form');
|
||||||
|
if (form) {
|
||||||
|
form.submit(); // manually submit the form
|
||||||
|
} else {
|
||||||
|
//fallback if not in a form
|
||||||
|
const href = field.getAttribute("href") || field.dataset.href;
|
||||||
|
if (href) window.location.href = href;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$(function() {
|
}, delay);
|
||||||
$('[data-toggle="tooltip"]').tooltip()
|
|
||||||
})
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
|
||||||
function ask(field, text){
|
return false;
|
||||||
var txt = field.innerHTML;
|
}
|
||||||
if (confirm(text)) {
|
|
||||||
setTimeout(() => {
|
|
||||||
field.innerHTML = field.innerHTML.replace(`<span class="loading"></span>`, txt);
|
|
||||||
field.removeAttribute("disabled");
|
|
||||||
}, 5000);
|
|
||||||
return true;
|
|
||||||
} else {
|
|
||||||
setTimeout(() => {
|
|
||||||
field.innerHTML = field.innerHTML.replace(`<span class="loading"></span>`, txt);
|
|
||||||
field.removeAttribute("disabled");
|
|
||||||
}, 500);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function setCookie(name, value, days) {
|
function setCookie(name, value, days) {
|
||||||
var expires = "";
|
var expires = "";
|
||||||
if (days) {
|
if (days) {
|
||||||
var date = new Date();
|
var date = new Date();
|
||||||
date.setTime(date.getTime() + (days * 24 * 60 * 60 * 1000));
|
date.setTime(date.getTime() + (days * 24 * 60 * 60 * 1000));
|
||||||
expires = "; expires=" + date.toUTCString();
|
expires = "; expires=" + date.toUTCString();
|
||||||
}
|
|
||||||
document.cookie = name + "=" + (value || "") + expires + "; path=/";
|
|
||||||
}
|
}
|
||||||
|
document.cookie = name + "=" + (value || "") + expires + "; path=/";
|
||||||
|
}
|
||||||
|
|
||||||
function getCookie(name) {
|
function getCookie(name) {
|
||||||
var nameEQ = name + "=";
|
var nameEQ = name + "=";
|
||||||
var ca = document.cookie.split(';');
|
var ca = document.cookie.split(';');
|
||||||
for (var i = 0; i < ca.length; i++) {
|
for (var i = 0; i < ca.length; i++) {
|
||||||
var c = ca[i];
|
var c = ca[i];
|
||||||
while (c.charAt(0) == ' ') c = c.substring(1, c.length);
|
while (c.charAt(0) == ' ') c = c.substring(1, c.length);
|
||||||
if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length, c.length);
|
if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length, c.length);
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
</script>
|
return null;
|
||||||
|
}
|
||||||
|
</script>
|
||||||
{/literal}
|
{/literal}
|
||||||
<script>
|
<script>
|
||||||
setCookie('user_language', '{$user_language}', 365);
|
setCookie('user_language', '{$user_language}', 365);
|
||||||
</script>
|
</script>
|
||||||
</body>
|
</body>
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user