tawkto bring customer data

This commit is contained in:
iBNu Maksum 2024-10-22 10:34:44 +07:00
parent 53aa187d1f
commit 8086802bf6
No known key found for this signature in database
GPG Key ID: 7FC82848810579E5
3 changed files with 119 additions and 89 deletions

View File

@ -852,5 +852,6 @@
"info": "info", "info": "info",
"Registration_code": "Registration code", "Registration_code": "Registration code",
"Admin_can_only_have_single_session_login__it_will_logout_another_session": "Admin can only have single session login, it will logout another session", "Admin_can_only_have_single_session_login__it_will_logout_another_session": "Admin can only have single session login, it will logout another session",
"Single_session_Admin": "Single session Admin" "Single_session_Admin": "Single session Admin",
"Get_Directions": "Get Directions"
} }

View File

@ -56,113 +56,142 @@
{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 Tawk_API = Tawk_API || {}, var isLoggedIn = false;
Tawk_LoadStart = new Date(); var Tawk_API = {
(function() { onLoad: function() {
var s1 = document.createElement("script"), if (!isLoggedIn) {
s0 = document.getElementsByTagName("script")[0]; isLoggedIn = true;
s1.async = true; window.Tawk_API.login({
s1.src='https://embed.tawk.to/{$_c['tawkto']}'; name: '{$_user['fullname']}',
s1.charset = 'UTF-8'; email: '{$_user['email']}',
s1.setAttribute('crossorigin', '*'); userId: '{$_user['id']}'
s0.parentNode.insertBefore(s1, s0); }, function(error) {
})(); //do something if there's an error
</script> });
<!--End of Tawk.to Script--> }
{/if} Tawk_API.setAttributes({
'id' : '{$_user['id']}',
'username' : '{$_user['username']}',
'service_type' : '{$_user['service_type']}',
'balance' : '{$_user['balance']}',
'account_type' : '{$_user['account_type']}',
'phone' : '{$_user['phonenumber']}'
}, function(error) {});
}
};
var Tawk_LoadStart = new Date();Tawk_API.visitor = {
name : '{$_user['fullname']}',
email : '{$_user['email']}',
userId: '{$_user['id']}'
};
(function() {
var s1 = document.createElement("script"),
s0 = document.getElementsByTagName("script")[0];
s1.async = true;
s1.src = 'https://embed.tawk.to/{$_c['tawkto']}';
s1.charset = 'UTF-8';
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 = '🌞';
} }
}
toggleIcon.addEventListener('click', () => { function setMode(mode) {
if (body.classList.contains('dark-mode')) { if (mode === 'dark') {
setMode('light'); body.classList.add('dark-mode');
localStorage.setItem('mode', 'light'); toggleIcon.textContent = '🌜';
} else { } else {
setMode('dark'); body.classList.remove('dark-mode');
localStorage.setItem('mode', 'dark'); toggleIcon.textContent = '🌞';
}
} }
});
</script>
{literal} toggleIcon.addEventListener('click', () => {
<script> if (body.classList.contains('dark-mode')) {
var listAtts = document.querySelectorAll(`[api-get-text]`); setMode('light');
listAtts.forEach(function(el) { localStorage.setItem('mode', 'light');
$.get(el.getAttribute('api-get-text'), function(data) { } else {
el.innerHTML = data; setMode('dark');
}); localStorage.setItem('mode', 'dark');
}
}); });
$(document).ready(function() { </script>
var listAtts = document.querySelectorAll(`button[type="submit"]`);
{literal}
<script>
var listAtts = document.querySelectorAll(`[api-get-text]`);
listAtts.forEach(function(el) { listAtts.forEach(function(el) {
if (el.addEventListener) { // all browsers except IE before version 9 $.get(el.getAttribute('api-get-text'), function(data) {
el.addEventListener("click", function() { el.innerHTML = data;
$(this).html( });
`<span class="loading"></span>` });
); $(document).ready(function() {
setTimeout(() => { var listAtts = document.querySelectorAll(`button[type="submit"]`);
$(this).prop("disabled", true); listAtts.forEach(function(el) {
}, 100); if (el.addEventListener) { // all browsers except IE before version 9
}, false); el.addEventListener("click", function() {
} 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() {
$(this).html(
`<span class="loading"></span>`
);
setTimeout(() => {
$(this).prop("disabled", true);
}, 100);
});
}
} }
} $(function() {
$(function() { $('[data-toggle="tooltip"]').tooltip()
$('[data-toggle="tooltip"]').tooltip() })
}) });
}); });
});
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;
} }
return null; setCookie('user_language', '
} {/literal}{$user_language}
setCookie('user_language', '{/literal}{$user_language}{literal}', 365); {literal}', 365);
</script> </script>
{/literal} {/literal}
</body> </body>
</html> </html>

View File

@ -163,7 +163,7 @@
color: #fff; color: #fff;
background-color: #169210; background-color: #169210;
border-color: #25e01c; border-color: #25e01c;
} }
.panel-cron-warning>.panel-heading { .panel-cron-warning>.panel-heading {