🚀 مُصادَق: تحديث برمجي جديد 2026-05-03 01:14

This commit is contained in:
Hamza-Ayed
2026-05-03 01:14:26 +03:00
parent a556e1db3b
commit ea7f58ae28

View File

@@ -6,7 +6,7 @@
<title>مُصادَق أتمتة الفوترة الضريبية</title> <title>مُصادَق أتمتة الفوترة الضريبية</title>
<!-- Styles --> <!-- 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 src="https://cdn.tailwindcss.com"></script>
<script defer src="https://unpkg.com/alpinejs@3.x.x/dist/cdn.min.js"></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> <script src="https://cdn.jsdelivr.net/npm/chart.js"></script>
@@ -86,28 +86,26 @@
</div> </div>
<script type="module"> <script type="module">
import API from '/assets/js/api.js'; import API from './assets/js/api.js';
window.appRouter = () => ({ window.appRouter = () => ({
isLoggedIn: !!localStorage.getItem('access_token'), isLoggedIn: !!localStorage.getItem('access_token'),
pageHtml: '', pageHtml: 'جاري التحميل...',
async init() { async init() {
this.navigate(window.location.pathname); console.log('App Initialized');
await this.navigate(window.location.pathname);
window.onpopstate = () => this.navigate(window.location.pathname); window.onpopstate = () => this.navigate(window.location.pathname);
}, },
async navigate(path) { async navigate(path) {
// Handle subdirectories and index.php in the path console.log('Navigating to:', path);
const isLogin = path.includes('/login'); const isLogin = path.includes('login');
const isDashboard = path.includes('/dashboard') || path.endsWith('/') || path.endsWith('index.php');
if (isLogin || !this.isLoggedIn) { if (!this.isLoggedIn && !isLogin) {
this.pageHtml = await this.loadPage('login');
} else if (isLogin) {
this.pageHtml = await this.loadPage('login'); 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 { } else {
this.pageHtml = await this.loadPage('dashboard'); // Default this.pageHtml = await this.loadPage('dashboard');
} }
}, },
initCharts() { initCharts() {