From 3ced45c9cd8a2924483e2a4a5ca96d858c57ca30 Mon Sep 17 00:00:00 2001 From: Hamza-Ayed Date: Sun, 3 May 2026 01:19:24 +0300 Subject: [PATCH] =?UTF-8?q?=F0=9F=9A=80=20=D9=85=D9=8F=D8=B5=D8=A7=D8=AF?= =?UTF-8?q?=D9=8E=D9=82:=20=D8=AA=D8=AD=D8=AF=D9=8A=D8=AB=20=D8=A8=D8=B1?= =?UTF-8?q?=D9=85=D8=AC=D9=8A=20=D8=AC=D8=AF=D9=8A=D8=AF=202026-05-03=2001?= =?UTF-8?q?:19?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/shell.php | 10 ++++++---- scratch.js | 37 +++++++++++++++++++++++++++++++++++++ 2 files changed, 43 insertions(+), 4 deletions(-) create mode 100644 scratch.js diff --git a/public/shell.php b/public/shell.php index c212425..47b84eb 100644 --- a/public/shell.php +++ b/public/shell.php @@ -88,10 +88,11 @@ diff --git a/scratch.js b/scratch.js new file mode 100644 index 0000000..7eba491 --- /dev/null +++ b/scratch.js @@ -0,0 +1,37 @@ +const appRouter = () => ({ + isLoggedIn: !!localStorage.getItem('access_token'), + pageHtml: 'جاري التحميل...', + async init() { + console.log('App Initialized'); + await this.navigate(window.location.pathname); + window.onpopstate = () => this.navigate(window.location.pathname); + }, + async navigate(path) { + 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'); + } else { + this.pageHtml = await this.loadPage('dashboard'); + } + }, + initCharts() { + const ctx = document.getElementById('invoiceChart')?.getContext('2d'); + }, + async loadPage(page) { + if (page === 'dashboard') { + return `
`; + } + if (page === 'login') return ` +
+
+

مرحباً بك مجدداً

+
+
+ `; + return '
الصفحة قيد الإنشاء
'; + } +});