File: /home/workzeni/agency-erp-05.workzenix.com/resources/views/layouts/includes/scripts.blade.php
<script src="{{ asset('admin/assets/js/plugins/apexcharts.min.js') }}"></script>
<script src="{{ asset('admin/assets/js/pages/dashboard-default.js') }}"></script>
<!-- [Page Specific JS] end -->
<!-- Required Js -->
<script src="{{ asset('admin/assets/js/plugins/popper.min.js') }}"></script>
<script src="{{ asset('admin/assets/js/plugins/simplebar.min.js') }}"></script>
<script src="{{ asset('admin/assets/js/plugins/bootstrap.min.js') }}"></script>
<script src="{{ asset('admin/assets/js/fonts/custom-font.js') }}"></script>
<script src="{{ asset('admin/assets/js/pcoded.js') }}"></script>
<script src="{{ asset('admin/assets/js/plugins/feather.min.js') }}"></script>
<!-- Add in your layout before </body> -->
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@4.6.2/dist/js/bootstrap.bundle.min.js"></script>
<script>
document.getElementById('currentYear').textContent = new Date().getFullYear();
layout_change('light');
change_box_container('false');
layout_rtl_change('false');
preset_change("preset-1");
font_change("Public-Sans");
</script>
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
<script>
let previousBdt = 0;
let previousSar = 0;
function fetchCurrencyBalance() {
$.ajax({
url: "{{ route('currency.balance') }}",
method: "GET",
dataType: "json",
success: function(data) {
updateCurrency("#bdt-value", data.bdt_acct, previousBdt);
updateCurrency("#sar-value", data.sar_acct, previousSar);
previousBdt = data.bdt_acct;
previousSar = data.sar_acct;
},
error: function(xhr) {
console.error("Failed to fetch currency data.");
}
});
}
function updateCurrency(selector, newValue, oldValue) {
const el = $(selector);
newValue = parseFloat(newValue).toFixed(2);
if (newValue > oldValue) {
el.addClass('currency-up').removeClass('currency-down');
} else if (newValue < oldValue) {
el.addClass('currency-down').removeClass('currency-up');
} else {
el.removeClass('currency-up currency-down');
}
el.text(newValue);
setTimeout(() => {
el.removeClass('currency-up currency-down');
}, 1000);
}
fetchCurrencyBalance();
setInterval(fetchCurrencyBalance, 5000);
</script>
<script>
document.addEventListener('DOMContentLoaded', function() {
setTimeout(function() {
const alerts = document.querySelectorAll('.auto-dismiss');
alerts.forEach(alert => {
alert.classList.remove('show');
alert.classList.add('fade');
setTimeout(() => alert.remove(), 500);
});
}, 4000); // Adjust timeout (ms) as needed
});
</script>
@yield('scripts')
<script>
document.addEventListener('DOMContentLoaded', function() {
function updateTime() {
const now = new Date();
const days = ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'];
const day = days[now.getDay()];
const hours = String(now.getHours()).padStart(2, '0');
const minutes = String(now.getMinutes()).padStart(2, '0');
const seconds = String(now.getSeconds()).padStart(2, '0');
document.querySelector('.clock-day').textContent = day;
document.querySelector('.clock-hours').textContent = hours;
document.querySelector('.clock-minutes').textContent = minutes;
document.querySelector('.clock-seconds').textContent = seconds;
requestAnimationFrame(updateTime);
}
updateTime(); // Start the loop
});
</script>