🚀 مُصادَق: تحديث برمجي جديد 2026-05-03 01:14
This commit is contained in:
@@ -6,7 +6,7 @@
|
||||
<title>مُصادَق — أتمتة الفوترة الضريبية</title>
|
||||
|
||||
<!-- Styles -->
|
||||
<link rel="stylesheet" href="/assets/css/app.css">
|
||||
<link rel="stylesheet" href="assets/css/app.css">
|
||||
<script src="https://cdn.tailwindcss.com"></script>
|
||||
<script defer src="https://unpkg.com/alpinejs@3.x.x/dist/cdn.min.js"></script>
|
||||
<script src="https://cdn.jsdelivr.net/npm/chart.js"></script>
|
||||
@@ -86,28 +86,26 @@
|
||||
</div>
|
||||
|
||||
<script type="module">
|
||||
import API from '/assets/js/api.js';
|
||||
import API from './assets/js/api.js';
|
||||
|
||||
window.appRouter = () => ({
|
||||
isLoggedIn: !!localStorage.getItem('access_token'),
|
||||
pageHtml: '',
|
||||
pageHtml: 'جاري التحميل...',
|
||||
async init() {
|
||||
this.navigate(window.location.pathname);
|
||||
console.log('App Initialized');
|
||||
await this.navigate(window.location.pathname);
|
||||
window.onpopstate = () => this.navigate(window.location.pathname);
|
||||
},
|
||||
async navigate(path) {
|
||||
// Handle subdirectories and index.php in the path
|
||||
const isLogin = path.includes('/login');
|
||||
const isDashboard = path.includes('/dashboard') || path.endsWith('/') || path.endsWith('index.php');
|
||||
|
||||
if (isLogin || !this.isLoggedIn) {
|
||||
console.log('Navigating to:', path);
|
||||
const isLogin = path.includes('login');
|
||||
|
||||
if (!this.isLoggedIn && !isLogin) {
|
||||
this.pageHtml = await this.loadPage('login');
|
||||
} else if (isLogin) {
|
||||
this.pageHtml = await this.loadPage('login');
|
||||
if (!path.includes('/login')) window.history.pushState({}, '', 'login');
|
||||
} else if (isDashboard) {
|
||||
this.pageHtml = await this.loadPage('dashboard');
|
||||
if (!path.includes('/dashboard')) window.history.pushState({}, '', 'dashboard');
|
||||
} else {
|
||||
this.pageHtml = await this.loadPage('dashboard'); // Default
|
||||
this.pageHtml = await this.loadPage('dashboard');
|
||||
}
|
||||
},
|
||||
initCharts() {
|
||||
|
||||
Reference in New Issue
Block a user