فینورا پرو - سامانه جامع حسابداری و صدور فاکتور
Phase 1: Core infrastructure complete
Davood Mehraban committed
Sep 18, 2026 at 05:20 UTC
0dd4ed842ef92e09254a5d38725302bc078e3921
14 files changed
+2094
index.html
new
+78
@@ -0,0 +1,78 @@
1
+<!DOCTYPE html>
2
+<html lang="fa" dir="rtl">
3
+<head>
4
+ <meta charset="UTF-8" />
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0, viewport-fit=cover" />
6
+ <meta name="theme-color" content="#0d9488" />
7
+ <title>فینورا پرو | سامانه حسابداری و صدور فاکتور</title>
8
+
9
+ <link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/rastikerdar/vazirmatn@v33.003/misc/Farsi-Digits/Vazirmatn-FD-font-face.css" />
10
+ <link rel="stylesheet" href="/src/styles/main.css" />
11
+</head>
12
+<body>
13
+ <div id="app" class="app">
14
+ <div id="splash">
15
+ <div class="splash-logo">فینورا پرو</div>
16
+ <div class="splash-spinner"></div>
17
+ </div>
18
+
19
+ <aside class="sidebar" id="sidebar">
20
+ <div class="sidebar-brand">
21
+ <div class="brand-logo">فینورا</div>
22
+ <div class="brand-text hide-on-collapse">
23
+ <h1>فینورا پرو</h1>
24
+ <small>نسخه ۰.۱.۰</small>
25
+ </div>
26
+ </div>
27
+
28
+ <ul class="sidebar-menu" id="sidebarMenu">
29
+ <li><a data-page="dashboard"><span class="icon">📊</span><span class="label">داشبورد</span></a></li>
30
+ <li><a data-page="invoices"><span class="icon">🧾</span><span class="label">فاکتورها</span></a></li>
31
+ <li><a data-page="products"><span class="icon">📦</span><span class="label">کالا و انبار</span></a></li>
32
+ <li><a data-page="contacts"><span class="icon">👥</span><span class="label">اشخاص</span></a></li>
33
+ <li><a data-page="treasury"><span class="icon">🏦</span><span class="label">خزانه و بانک</span></a></li>
34
+ <li><a data-page="cheques"><span class="icon">💳</span><span class="label">چکها</span></a></li>
35
+ <li><a data-page="expenses"><span class="icon">💰</span><span class="label">هزینه و درآمد</span></a></li>
36
+ <li><a data-page="reports"><span class="icon">📈</span><span class="label">گزارش سود و زیان</span></a></li>
37
+ <li><a data-page="settings"><span class="icon">⚙️</span><span class="label">تنظیمات</span></a></li>
38
+ </ul>
39
+
40
+ <div class="sidebar-footer">
41
+ <div class="user-chip">
42
+ <div class="user-avatar" id="userAvatar">م</div>
43
+ <div class="user-info">
44
+ <strong id="userName">مدیر سیستم</strong>
45
+ <small id="userRole">Admin</small>
46
+ </div>
47
+ <button class="icon-btn hide-on-collapse" onclick="FINORA.Auth.logout()" title="خروج" style="width:32px;height:32px;font-size:14px">🚪</button>
48
+ </div>
49
+ </div>
50
+ </aside>
51
+
52
+ <main class="main" id="main">
53
+ <header class="header">
54
+ <button class="hamburger" onclick="document.getElementById('sidebar').classList.toggle('collapsed');document.getElementById('main').classList.toggle('sidebar-collapsed')">☰</button>
55
+
56
+ <div class="header-title">
57
+ <h2 id="pageTitle">داشبورد</h2>
58
+ <small id="greeting">در حال بارگذاری...</small>
59
+ </div>
60
+
61
+ <div class="header-stats">
62
+ <div class="stat-chip"><strong id="statInvoices">۰</strong><small>فاکتور</small></div>
63
+ <div class="stat-chip"><strong id="statContacts">۰</strong><small>شخص</small></div>
64
+ <div class="stat-chip"><strong id="statProducts">۰</strong><small>کالا</small></div>
65
+ </div>
66
+
67
+ <div class="header-tools">
68
+ <button class="icon-btn" id="themeToggleBtn" onclick="FINORA.Theme.toggle()" title="تغییر تم">🌙</button>
69
+ </div>
70
+ </header>
71
+
72
+ <div class="content" id="pageContent"></div>
73
+ </main>
74
+ </div>
75
+
76
+ <script type="module" src="/src/main.js"></script>
77
+</body>
78
+</html>
\ No newline at end of file
package-lock.json
new
+829
@@ -0,0 +1,829 @@
1
+{
2
+ "name": "factor-easypro",
3
+ "version": "1.0.0",
4
+ "lockfileVersion": 3,
5
+ "requires": true,
6
+ "packages": {
7
+ "": {
8
+ "name": "factor-easypro",
9
+ "version": "1.0.0",
10
+ "license": "ISC",
11
+ "devDependencies": {
12
+ "vite": "^8.3.0"
13
+ }
14
+ },
15
+ "node_modules/@oxc-project/types": {
16
+ "version": "0.150.0",
17
+ "resolved": "https://registry.npmjs.org/@oxc-project/types/-/types-0.150.0.tgz",
18
+ "integrity": "sha512-rDS5/31E9HfPl/CIzGrn0DOlvBbXFseQ5URJ9sYMfstbKLD/c6Gm9vmRzRGDdAXyOIL4zmO37lc9RIwYqVruZw==",
19
+ "dev": true,
20
+ "license": "MIT",
21
+ "funding": {
22
+ "url": "https://github.com/sponsors/oxc-project"
23
+ }
24
+ },
25
+ "node_modules/@rolldown/binding-android-arm-eabi": {
26
+ "version": "1.2.9",
27
+ "resolved": "https://registry.npmjs.org/@rolldown/binding-android-arm-eabi/-/binding-android-arm-eabi-1.2.9.tgz",
28
+ "integrity": "sha512-tNISae1QEf/vkb3xkRcjV5SEdzPE97We5IVaa2Z8jSszQPZ8U60B/YCYpw4QI7VidYsBtKavczXf+DyDs9WGxw==",
29
+ "cpu": [
30
+ "arm"
31
+ ],
32
+ "dev": true,
33
+ "license": "MIT",
34
+ "optional": true,
35
+ "os": [
36
+ "android"
37
+ ],
38
+ "engines": {
39
+ "node": "^20.19.0 || >=22.12.0"
40
+ }
41
+ },
42
+ "node_modules/@rolldown/binding-android-arm64": {
43
+ "version": "1.2.9",
44
+ "resolved": "https://registry.npmjs.org/@rolldown/binding-android-arm64/-/binding-android-arm64-1.2.9.tgz",
45
+ "integrity": "sha512-YC8YsI30o606GTZi0VyzYlsDKFP8W61i/QzayHDkLbNEz/IShqAmTa+hsJRj13xTHA0H+6fk4b2UmGn+Q/cMlg==",
46
+ "cpu": [
47
+ "arm64"
48
+ ],
49
+ "dev": true,
50
+ "license": "MIT",
51
+ "optional": true,
52
+ "os": [
53
+ "android"
54
+ ],
55
+ "engines": {
56
+ "node": "^20.19.0 || >=22.12.0"
57
+ }
58
+ },
59
+ "node_modules/@rolldown/binding-darwin-arm64": {
60
+ "version": "1.2.9",
61
+ "resolved": "https://registry.npmjs.org/@rolldown/binding-darwin-arm64/-/binding-darwin-arm64-1.2.9.tgz",
62
+ "integrity": "sha512-IwhlH3qK5urrY8hZiEgGkHKEFN901p/p2bjxCxJlr4GyNnF7wYpUvK+Y43uaRYuC4hpfjzbR3SJC3arX1jGvmw==",
63
+ "cpu": [
64
+ "arm64"
65
+ ],
66
+ "dev": true,
67
+ "license": "MIT",
68
+ "optional": true,
69
+ "os": [
70
+ "darwin"
71
+ ],
72
+ "engines": {
73
+ "node": "^20.19.0 || >=22.12.0"
74
+ }
75
+ },
76
+ "node_modules/@rolldown/binding-darwin-x64": {
77
+ "version": "1.2.9",
78
+ "resolved": "https://registry.npmjs.org/@rolldown/binding-darwin-x64/-/binding-darwin-x64-1.2.9.tgz",
79
+ "integrity": "sha512-XxpJfVzFh+jilRxIXUqcfYAYcunIc/XEzIizsOL1fcJee5Sf7H3mH8WlLmfHfluz5amqR88QQo9izKtmMlavAw==",
80
+ "cpu": [
81
+ "x64"
82
+ ],
83
+ "dev": true,
84
+ "license": "MIT",
85
+ "optional": true,
86
+ "os": [
87
+ "darwin"
88
+ ],
89
+ "engines": {
90
+ "node": "^20.19.0 || >=22.12.0"
91
+ }
92
+ },
93
+ "node_modules/@rolldown/binding-freebsd-x64": {
94
+ "version": "1.2.9",
95
+ "resolved": "https://registry.npmjs.org/@rolldown/binding-freebsd-x64/-/binding-freebsd-x64-1.2.9.tgz",
96
+ "integrity": "sha512-kSfvhmgeWyfkbT3p/1s5vSgboogoah2zkm9fX2zjg2hHxSV7T4KhMWRUUaRk4OXNqoD3QAUeRqLcs1aZOK4U1g==",
97
+ "cpu": [
98
+ "x64"
99
+ ],
100
+ "dev": true,
101
+ "license": "MIT",
102
+ "optional": true,
103
+ "os": [
104
+ "freebsd"
105
+ ],
106
+ "engines": {
107
+ "node": "^20.19.0 || >=22.12.0"
108
+ }
109
+ },
110
+ "node_modules/@rolldown/binding-linux-arm-gnueabihf": {
111
+ "version": "1.2.9",
112
+ "resolved": "https://registry.npmjs.org/@rolldown/binding-linux-arm-gnueabihf/-/binding-linux-arm-gnueabihf-1.2.9.tgz",
113
+ "integrity": "sha512-1RVzG17pxqbTfYLC352JlLt6kKLG+6Hr30n8DlIJqsnV5luUDd2Qdx9Ayw1Cabfyb1K9k0jXEZ7evxkRoT+uiw==",
114
+ "cpu": [
115
+ "arm"
116
+ ],
117
+ "dev": true,
118
+ "license": "MIT",
119
+ "optional": true,
120
+ "os": [
121
+ "linux"
122
+ ],
123
+ "engines": {
124
+ "node": "^20.19.0 || >=22.12.0"
125
+ }
126
+ },
127
+ "node_modules/@rolldown/binding-linux-arm64-gnu": {
128
+ "version": "1.2.9",
129
+ "resolved": "https://registry.npmjs.org/@rolldown/binding-linux-arm64-gnu/-/binding-linux-arm64-gnu-1.2.9.tgz",
130
+ "integrity": "sha512-BXqPvZ2drqVD+/Z8UpKwcs4Mp7grM+eGFku4CAEKrEtcbAsUpzREphK1sogCRZGreVPiMkiiBtw0n3TPteuqvw==",
131
+ "cpu": [
132
+ "arm64"
133
+ ],
134
+ "dev": true,
135
+ "libc": [
136
+ "glibc"
137
+ ],
138
+ "license": "MIT",
139
+ "optional": true,
140
+ "os": [
141
+ "linux"
142
+ ],
143
+ "engines": {
144
+ "node": "^20.19.0 || >=22.12.0"
145
+ }
146
+ },
147
+ "node_modules/@rolldown/binding-linux-arm64-musl": {
148
+ "version": "1.2.9",
149
+ "resolved": "https://registry.npmjs.org/@rolldown/binding-linux-arm64-musl/-/binding-linux-arm64-musl-1.2.9.tgz",
150
+ "integrity": "sha512-11vWvo8YDwLzukt27J3aYDWU+gg2P7J+ZOmiJ0hkF5BXZDW7pVya7r40MXDy6ya0i9KamoENSVKIugvJNgFXIA==",
151
+ "cpu": [
152
+ "arm64"
153
+ ],
154
+ "dev": true,
155
+ "libc": [
156
+ "musl"
157
+ ],
158
+ "license": "MIT",
159
+ "optional": true,
160
+ "os": [
161
+ "linux"
162
+ ],
163
+ "engines": {
164
+ "node": "^20.19.0 || >=22.12.0"
165
+ }
166
+ },
167
+ "node_modules/@rolldown/binding-linux-ppc64-gnu": {
168
+ "version": "1.2.9",
169
+ "resolved": "https://registry.npmjs.org/@rolldown/binding-linux-ppc64-gnu/-/binding-linux-ppc64-gnu-1.2.9.tgz",
170
+ "integrity": "sha512-a1tijMkdwsIARtc0F39ApURROkf3NwqinI6TOiSSWCTR7dT96dffNvMUtDHnq64wKNTIZOIlzKrFvvFUznJiyw==",
171
+ "cpu": [
172
+ "ppc64"
173
+ ],
174
+ "dev": true,
175
+ "libc": [
176
+ "glibc"
177
+ ],
178
+ "license": "MIT",
179
+ "optional": true,
180
+ "os": [
181
+ "linux"
182
+ ],
183
+ "engines": {
184
+ "node": "^20.19.0 || >=22.12.0"
185
+ }
186
+ },
187
+ "node_modules/@rolldown/binding-linux-s390x-gnu": {
188
+ "version": "1.2.9",
189
+ "resolved": "https://registry.npmjs.org/@rolldown/binding-linux-s390x-gnu/-/binding-linux-s390x-gnu-1.2.9.tgz",
190
+ "integrity": "sha512-x6SQNdAvv4c3hWqTMaWuawzMX9myaCs/yEmlGsxJzkdClnHW7FbrjQuSiRDhuSYzEYoEMhsaJy9qHG/XNemJPQ==",
191
+ "cpu": [
192
+ "s390x"
193
+ ],
194
+ "dev": true,
195
+ "libc": [
196
+ "glibc"
197
+ ],
198
+ "license": "MIT",
199
+ "optional": true,
200
+ "os": [
201
+ "linux"
202
+ ],
203
+ "engines": {
204
+ "node": "^20.19.0 || >=22.12.0"
205
+ }
206
+ },
207
+ "node_modules/@rolldown/binding-linux-x64-gnu": {
208
+ "version": "1.2.9",
209
+ "resolved": "https://registry.npmjs.org/@rolldown/binding-linux-x64-gnu/-/binding-linux-x64-gnu-1.2.9.tgz",
210
+ "integrity": "sha512-9s0AZ8BFK5/n7B/TBoa2yJE3gI3KURrbXcPBlsAsvjU4VeJKgE90y1YtNxyEUIcHPQkg6/yfF3qihUrcM/Kf0Q==",
211
+ "cpu": [
212
+ "x64"
213
+ ],
214
+ "dev": true,
215
+ "libc": [
216
+ "glibc"
217
+ ],
218
+ "license": "MIT",
219
+ "optional": true,
220
+ "os": [
221
+ "linux"
222
+ ],
223
+ "engines": {
224
+ "node": "^20.19.0 || >=22.12.0"
225
+ }
226
+ },
227
+ "node_modules/@rolldown/binding-linux-x64-musl": {
228
+ "version": "1.2.9",
229
+ "resolved": "https://registry.npmjs.org/@rolldown/binding-linux-x64-musl/-/binding-linux-x64-musl-1.2.9.tgz",
230
+ "integrity": "sha512-P7VWAmV+WdJluH7ovnRGoiv2i8To7GAZ+kGzfGup635cyL7SyYl3lSUaA3Gp5THf0n/Co5EyEqb2zbqq+nMOHQ==",
231
+ "cpu": [
232
+ "x64"
233
+ ],
234
+ "dev": true,
235
+ "libc": [
236
+ "musl"
237
+ ],
238
+ "license": "MIT",
239
+ "optional": true,
240
+ "os": [
241
+ "linux"
242
+ ],
243
+ "engines": {
244
+ "node": "^20.19.0 || >=22.12.0"
245
+ }
246
+ },
247
+ "node_modules/@rolldown/binding-openharmony-arm64": {
248
+ "version": "1.2.9",
249
+ "resolved": "https://registry.npmjs.org/@rolldown/binding-openharmony-arm64/-/binding-openharmony-arm64-1.2.9.tgz",
250
+ "integrity": "sha512-1qixtsE4BK8h+yS3BfmZ09UhA7O/N4IACva6YBr7EBvCJraByTuRcgOTaiA62Tm0vey3UcKXLOaoGHtYmNGEVg==",
251
+ "cpu": [
252
+ "arm64"
253
+ ],
254
+ "dev": true,
255
+ "license": "MIT",
256
+ "optional": true,
257
+ "os": [
258
+ "openharmony"
259
+ ],
260
+ "engines": {
261
+ "node": "^20.19.0 || >=22.12.0"
262
+ }
263
+ },
264
+ "node_modules/@rolldown/binding-win32-arm64-msvc": {
265
+ "version": "1.2.9",
266
+ "resolved": "https://registry.npmjs.org/@rolldown/binding-win32-arm64-msvc/-/binding-win32-arm64-msvc-1.2.9.tgz",
267
+ "integrity": "sha512-ok8IQjcEPs1AKZfuEUznVBrJw+gK4soq+bx8b1X2XoMqVClarc1q5JDmVtWXY1xfr6ZuHTAsPXHTgTrqKTZeww==",
268
+ "cpu": [
269
+ "arm64"
270
+ ],
271
+ "dev": true,
272
+ "license": "MIT",
273
+ "optional": true,
274
+ "os": [
275
+ "win32"
276
+ ],
277
+ "engines": {
278
+ "node": "^20.19.0 || >=22.12.0"
279
+ }
280
+ },
281
+ "node_modules/@rolldown/binding-win32-x64-msvc": {
282
+ "version": "1.2.9",
283
+ "resolved": "https://registry.npmjs.org/@rolldown/binding-win32-x64-msvc/-/binding-win32-x64-msvc-1.2.9.tgz",
284
+ "integrity": "sha512-Ip2mXoU0hM0boq3Rf+ekuT653OROSo6aSYcPT1VHE4q52KvyxgFkQgrgb/IEsxOuvQ2fZZbs8khJAyCEPM24/g==",
285
+ "cpu": [
286
+ "x64"
287
+ ],
288
+ "dev": true,
289
+ "license": "MIT",
290
+ "optional": true,
291
+ "os": [
292
+ "win32"
293
+ ],
294
+ "engines": {
295
+ "node": "^20.19.0 || >=22.12.0"
296
+ }
297
+ },
298
+ "node_modules/@rolldown/pluginutils": {
299
+ "version": "1.0.1",
300
+ "resolved": "https://registry.npmjs.org/@rolldown/pluginutils/-/pluginutils-1.0.1.tgz",
301
+ "integrity": "sha512-2j9bGt5Jh8hj+vPtgzPtl72j0yRxHAyumoo6TNfAjsLB04UtpSvPbPcDcBMxz7n+9CYB0c1GxQFxYRg2jimqGw==",
302
+ "dev": true,
303
+ "license": "MIT"
304
+ },
305
+ "node_modules/detect-libc": {
306
+ "version": "2.1.2",
307
+ "resolved": "https://registry.npmjs.org/detect-libc/-/detect-libc-2.1.2.tgz",
308
+ "integrity": "sha512-Btj2BOOO83o3WyH59e8MgXsxEQVcarkUOpEYrubB0urwnN10yQ364rsiByU11nZlqWYZm05i/of7io4mzihBtQ==",
309
+ "dev": true,
310
+ "license": "Apache-2.0",
311
+ "engines": {
312
+ "node": ">=8"
313
+ }
314
+ },
315
+ "node_modules/fdir": {
316
+ "version": "6.5.0",
317
+ "resolved": "https://registry.npmjs.org/fdir/-/fdir-6.5.0.tgz",
318
+ "integrity": "sha512-tIbYtZbucOs0BRGqPJkshJUYdL+SDH7dVM8gjy+ERp3WAUjLEFJE+02kanyHtwjWOnwrKYBiwAmM0p4kLJAnXg==",
319
+ "dev": true,
320
+ "license": "MIT",
321
+ "engines": {
322
+ "node": ">=12.0.0"
323
+ },
324
+ "peerDependencies": {
325
+ "picomatch": "^3 || ^4"
326
+ },
327
+ "peerDependenciesMeta": {
328
+ "picomatch": {
329
+ "optional": true
330
+ }
331
+ }
332
+ },
333
+ "node_modules/fsevents": {
334
+ "version": "2.3.3",
335
+ "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz",
336
+ "integrity": "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==",
337
+ "dev": true,
338
+ "hasInstallScript": true,
339
+ "license": "MIT",
340
+ "optional": true,
341
+ "os": [
342
+ "darwin"
343
+ ],
344
+ "engines": {
345
+ "node": "^8.16.0 || ^10.6.0 || >=11.0.0"
346
+ }
347
+ },
348
+ "node_modules/lightningcss": {
349
+ "version": "1.33.0",
350
+ "resolved": "https://registry.npmjs.org/lightningcss/-/lightningcss-1.33.0.tgz",
351
+ "integrity": "sha512-WkUDrojuJs0xkgGf2udWxa3yGBRxPtxUkB79i6aCZLRgc7PM8fZe9TosfPDcvEpQZbuFASnHYmRLBLUbmLOIIA==",
352
+ "dev": true,
353
+ "license": "MPL-2.0",
354
+ "dependencies": {
355
+ "detect-libc": "^2.0.3"
356
+ },
357
+ "engines": {
358
+ "node": ">= 12.0.0"
359
+ },
360
+ "funding": {
361
+ "type": "opencollective",
362
+ "url": "https://opencollective.com/parcel"
363
+ },
364
+ "optionalDependencies": {
365
+ "lightningcss-android-arm64": "1.33.0",
366
+ "lightningcss-darwin-arm64": "1.33.0",
367
+ "lightningcss-darwin-x64": "1.33.0",
368
+ "lightningcss-freebsd-x64": "1.33.0",
369
+ "lightningcss-linux-arm-gnueabihf": "1.33.0",
370
+ "lightningcss-linux-arm64-gnu": "1.33.0",
371
+ "lightningcss-linux-arm64-musl": "1.33.0",
372
+ "lightningcss-linux-x64-gnu": "1.33.0",
373
+ "lightningcss-linux-x64-musl": "1.33.0",
374
+ "lightningcss-win32-arm64-msvc": "1.33.0",
375
+ "lightningcss-win32-x64-msvc": "1.33.0"
376
+ }
377
+ },
378
+ "node_modules/lightningcss-android-arm64": {
379
+ "version": "1.33.0",
380
+ "resolved": "https://registry.npmjs.org/lightningcss-android-arm64/-/lightningcss-android-arm64-1.33.0.tgz",
381
+ "integrity": "sha512-gEpRTalKdosp4Bb8qWtc2iOgE5SeIHlpS1up9bFq2wAyYhl1UdTObYiHe98zEM9SQvSoqQZ1IQD0JNpg3Ml5pg==",
382
+ "cpu": [
383
+ "arm64"
384
+ ],
385
+ "dev": true,
386
+ "license": "MPL-2.0",
387
+ "optional": true,
388
+ "os": [
389
+ "android"
390
+ ],
391
+ "engines": {
392
+ "node": ">= 12.0.0"
393
+ },
394
+ "funding": {
395
+ "type": "opencollective",
396
+ "url": "https://opencollective.com/parcel"
397
+ }
398
+ },
399
+ "node_modules/lightningcss-darwin-arm64": {
400
+ "version": "1.33.0",
401
+ "resolved": "https://registry.npmjs.org/lightningcss-darwin-arm64/-/lightningcss-darwin-arm64-1.33.0.tgz",
402
+ "integrity": "sha512-Sciaz8eenNTKn9b3t7+xr0ipTp9YxKQY4npwQ3mrRuL0BAVHBLyZxofhaKBAVtzmtRZ/zTyo0/to4B1uWG/Djg==",
403
+ "cpu": [
404
+ "arm64"
405
+ ],
406
+ "dev": true,
407
+ "license": "MPL-2.0",
408
+ "optional": true,
409
+ "os": [
410
+ "darwin"
411
+ ],
412
+ "engines": {
413
+ "node": ">= 12.0.0"
414
+ },
415
+ "funding": {
416
+ "type": "opencollective",
417
+ "url": "https://opencollective.com/parcel"
418
+ }
419
+ },
420
+ "node_modules/lightningcss-darwin-x64": {
421
+ "version": "1.33.0",
422
+ "resolved": "https://registry.npmjs.org/lightningcss-darwin-x64/-/lightningcss-darwin-x64-1.33.0.tgz",
423
+ "integrity": "sha512-Z5UPAxzrjlWNNyGy6i65cJzzvgJ5D3T6wMvs+gWpY9d7qRhANrxqAp6LhxIgZhWEw18RfJTGcRxjuLIBr+m8XQ==",
424
+ "cpu": [
425
+ "x64"
426
+ ],
427
+ "dev": true,
428
+ "license": "MPL-2.0",
429
+ "optional": true,
430
+ "os": [
431
+ "darwin"
432
+ ],
433
+ "engines": {
434
+ "node": ">= 12.0.0"
435
+ },
436
+ "funding": {
437
+ "type": "opencollective",
438
+ "url": "https://opencollective.com/parcel"
439
+ }
440
+ },
441
+ "node_modules/lightningcss-freebsd-x64": {
442
+ "version": "1.33.0",
443
+ "resolved": "https://registry.npmjs.org/lightningcss-freebsd-x64/-/lightningcss-freebsd-x64-1.33.0.tgz",
444
+ "integrity": "sha512-QQM/Ti/hQajJwCY+RiWuCZ9sdtI/XQk7nDK5vC8kkdwixezOlDgvDx7+RT+QjK6FcFT4MpsuoBnHIo/O3StRRg==",
445
+ "cpu": [
446
+ "x64"
447
+ ],
448
+ "dev": true,
449
+ "license": "MPL-2.0",
450
+ "optional": true,
451
+ "os": [
452
+ "freebsd"
453
+ ],
454
+ "engines": {
455
+ "node": ">= 12.0.0"
456
+ },
457
+ "funding": {
458
+ "type": "opencollective",
459
+ "url": "https://opencollective.com/parcel"
460
+ }
461
+ },
462
+ "node_modules/lightningcss-linux-arm-gnueabihf": {
463
+ "version": "1.33.0",
464
+ "resolved": "https://registry.npmjs.org/lightningcss-linux-arm-gnueabihf/-/lightningcss-linux-arm-gnueabihf-1.33.0.tgz",
465
+ "integrity": "sha512-N7FVBe6iS24MlM6R/4RBTxGhQheZGs7tiQ9U32UtF75NzP5Q7xWPRqLBCKxlRQRk3rY1jCIPLzx7WzOhuUIRLQ==",
466
+ "cpu": [
467
+ "arm"
468
+ ],
469
+ "dev": true,
470
+ "license": "MPL-2.0",
471
+ "optional": true,
472
+ "os": [
473
+ "linux"
474
+ ],
475
+ "engines": {
476
+ "node": ">= 12.0.0"
477
+ },
478
+ "funding": {
479
+ "type": "opencollective",
480
+ "url": "https://opencollective.com/parcel"
481
+ }
482
+ },
483
+ "node_modules/lightningcss-linux-arm64-gnu": {
484
+ "version": "1.33.0",
485
+ "resolved": "https://registry.npmjs.org/lightningcss-linux-arm64-gnu/-/lightningcss-linux-arm64-gnu-1.33.0.tgz",
486
+ "integrity": "sha512-j2v/itmy4HlNxlc6voKXYgBqNi0Ng2LShg4z7GufpEgs05P+2suBVyi9I6YHq5uoVFx9ETin3eCEhLVyXGQnKg==",
487
+ "cpu": [
488
+ "arm64"
489
+ ],
490
+ "dev": true,
491
+ "libc": [
492
+ "glibc"
493
+ ],
494
+ "license": "MPL-2.0",
495
+ "optional": true,
496
+ "os": [
497
+ "linux"
498
+ ],
499
+ "engines": {
500
+ "node": ">= 12.0.0"
501
+ },
502
+ "funding": {
503
+ "type": "opencollective",
504
+ "url": "https://opencollective.com/parcel"
505
+ }
506
+ },
507
+ "node_modules/lightningcss-linux-arm64-musl": {
508
+ "version": "1.33.0",
509
+ "resolved": "https://registry.npmjs.org/lightningcss-linux-arm64-musl/-/lightningcss-linux-arm64-musl-1.33.0.tgz",
510
+ "integrity": "sha512-yiO5ROMuYQgXbC60yjZU5CYSFZGKXL0HFATXt9mHJn1+zW55oCtMI9NfcVhYLMFDL7gV7oBPon/EmMMGg2OvtQ==",
511
+ "cpu": [
512
+ "arm64"
513
+ ],
514
+ "dev": true,
515
+ "libc": [
516
+ "musl"
517
+ ],
518
+ "license": "MPL-2.0",
519
+ "optional": true,
520
+ "os": [
521
+ "linux"
522
+ ],
523
+ "engines": {
524
+ "node": ">= 12.0.0"
525
+ },
526
+ "funding": {
527
+ "type": "opencollective",
528
+ "url": "https://opencollective.com/parcel"
529
+ }
530
+ },
531
+ "node_modules/lightningcss-linux-x64-gnu": {
532
+ "version": "1.33.0",
533
+ "resolved": "https://registry.npmjs.org/lightningcss-linux-x64-gnu/-/lightningcss-linux-x64-gnu-1.33.0.tgz",
534
+ "integrity": "sha512-ar+Ju7LmcN0Jo4FpL4hpFybwNG9/3A/Br5KW2n2jyODg3MEZXaDYADdemoNS+BDNfMgKvylJLj4S5tyRActuAg==",
535
+ "cpu": [
536
+ "x64"
537
+ ],
538
+ "dev": true,
539
+ "libc": [
540
+ "glibc"
541
+ ],
542
+ "license": "MPL-2.0",
543
+ "optional": true,
544
+ "os": [
545
+ "linux"
546
+ ],
547
+ "engines": {
548
+ "node": ">= 12.0.0"
549
+ },
550
+ "funding": {
551
+ "type": "opencollective",
552
+ "url": "https://opencollective.com/parcel"
553
+ }
554
+ },
555
+ "node_modules/lightningcss-linux-x64-musl": {
556
+ "version": "1.33.0",
557
+ "resolved": "https://registry.npmjs.org/lightningcss-linux-x64-musl/-/lightningcss-linux-x64-musl-1.33.0.tgz",
558
+ "integrity": "sha512-RYiYbkokw0trfKqqzfF55lginwEPrD3OJDfTuJzFs1MK6iFnDenaz1fqLLtX4ITG3OktJQXOeTaw1awrBAlZPw==",
559
+ "cpu": [
560
+ "x64"
561
+ ],
562
+ "dev": true,
563
+ "libc": [
564
+ "musl"
565
+ ],
566
+ "license": "MPL-2.0",
567
+ "optional": true,
568
+ "os": [
569
+ "linux"
570
+ ],
571
+ "engines": {
572
+ "node": ">= 12.0.0"
573
+ },
574
+ "funding": {
575
+ "type": "opencollective",
576
+ "url": "https://opencollective.com/parcel"
577
+ }
578
+ },
579
+ "node_modules/lightningcss-win32-arm64-msvc": {
580
+ "version": "1.33.0",
581
+ "resolved": "https://registry.npmjs.org/lightningcss-win32-arm64-msvc/-/lightningcss-win32-arm64-msvc-1.33.0.tgz",
582
+ "integrity": "sha512-1K+MPfLSFVpphzpdbfkhlWk6wBrTObBzS2T6db10PNOZgR9GoVsAWzwNyuhUYYbTp23j+4RrncfujZ4uAzXvwA==",
583
+ "cpu": [
584
+ "arm64"
585
+ ],
586
+ "dev": true,
587
+ "license": "MPL-2.0",
588
+ "optional": true,
589
+ "os": [
590
+ "win32"
591
+ ],
592
+ "engines": {
593
+ "node": ">= 12.0.0"
594
+ },
595
+ "funding": {
596
+ "type": "opencollective",
597
+ "url": "https://opencollective.com/parcel"
598
+ }
599
+ },
600
+ "node_modules/lightningcss-win32-x64-msvc": {
601
+ "version": "1.33.0",
602
+ "resolved": "https://registry.npmjs.org/lightningcss-win32-x64-msvc/-/lightningcss-win32-x64-msvc-1.33.0.tgz",
603
+ "integrity": "sha512-OlEICDx/Xl0FqSp4bry8zFnCvGpig3Gl4gCquvYwHuqJKEC1+n9NgDniFvqHGmMv1ZkqDJrDqKKSykTDX+ehuA==",
604
+ "cpu": [
605
+ "x64"
606
+ ],
607
+ "dev": true,
608
+ "license": "MPL-2.0",
609
+ "optional": true,
610
+ "os": [
611
+ "win32"
612
+ ],
613
+ "engines": {
614
+ "node": ">= 12.0.0"
615
+ },
616
+ "funding": {
617
+ "type": "opencollective",
618
+ "url": "https://opencollective.com/parcel"
619
+ }
620
+ },
621
+ "node_modules/nanoid": {
622
+ "version": "3.3.19",
623
+ "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.19.tgz",
624
+ "integrity": "sha512-Y2tUNy4ouw6tq5oDSKeQYGOyhkUBhNOcGV/02KC+6kd9eDGqdZd++mjMiIDilrBYvjEnCYvVtsuHCuP+okSfug==",
625
+ "dev": true,
626
+ "funding": [
627
+ {
628
+ "type": "github",
629
+ "url": "https://github.com/sponsors/ai"
630
+ }
631
+ ],
632
+ "license": "MIT",
633
+ "bin": {
634
+ "nanoid": "bin/nanoid.cjs"
635
+ },
636
+ "engines": {
637
+ "node": "^10 || ^12 || ^13.7 || ^14 || >=15.0.1"
638
+ }
639
+ },
640
+ "node_modules/picocolors": {
641
+ "version": "1.1.1",
642
+ "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.1.1.tgz",
643
+ "integrity": "sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA==",
644
+ "dev": true,
645
+ "license": "ISC"
646
+ },
647
+ "node_modules/picomatch": {
648
+ "version": "4.0.7",
649
+ "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-4.0.7.tgz",
650
+ "integrity": "sha512-qcJu88Q2IWqJsDD529JKMdwGm/dvInW4HvQnRwiH9JtihJvzGOscDtHE3x1pBKeUOTysQ8kVmLnJ2kJu7yhcGA==",
651
+ "dev": true,
652
+ "license": "MIT",
653
+ "engines": {
654
+ "node": ">=12"
655
+ },
656
+ "funding": {
657
+ "url": "https://github.com/sponsors/jonschlinkert"
658
+ }
659
+ },
660
+ "node_modules/postcss": {
661
+ "version": "8.5.28",
662
+ "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.5.28.tgz",
663
+ "integrity": "sha512-RRuzqDtt5Y9h3quz5hWhK+TPnsmVs6WwSU6LkJMeY4HstUEDuYTG8UJSdawMRzmzAtV+KEoG8N3Qg2qLy5vM/A==",
664
+ "dev": true,
665
+ "funding": [
666
+ {
667
+ "type": "opencollective",
668
+ "url": "https://opencollective.com/postcss/"
669
+ },
670
+ {
671
+ "type": "tidelift",
672
+ "url": "https://tidelift.com/funding/github/npm/postcss"
673
+ },
674
+ {
675
+ "type": "github",
676
+ "url": "https://github.com/sponsors/ai"
677
+ }
678
+ ],
679
+ "license": "MIT",
680
+ "dependencies": {
681
+ "nanoid": "^3.3.18",
682
+ "picocolors": "^1.1.1",
683
+ "source-map-js": "^1.2.1"
684
+ },
685
+ "engines": {
686
+ "node": "^10 || ^12 || >=14"
687
+ }
688
+ },
689
+ "node_modules/rolldown": {
690
+ "version": "1.2.9",
691
+ "resolved": "https://registry.npmjs.org/rolldown/-/rolldown-1.2.9.tgz",
692
+ "integrity": "sha512-hx/Pv0N1haXRb11qkfnK5MXB/iqr7i0yjWQqmO9uHqZpBgQSqzc8UsSnEpalsh+j1I8qQ2CkXAkJC8Br3dKSlg==",
693
+ "dev": true,
694
+ "license": "MIT",
695
+ "dependencies": {
696
+ "@oxc-project/types": "=0.150.0",
697
+ "@rolldown/pluginutils": "^1.0.0"
698
+ },
699
+ "bin": {
700
+ "rolldown": "bin/cli.mjs"
701
+ },
702
+ "engines": {
703
+ "node": "^20.19.0 || >=22.12.0"
704
+ },
705
+ "optionalDependencies": {
706
+ "@rolldown/binding-android-arm-eabi": "1.2.9",
707
+ "@rolldown/binding-android-arm64": "1.2.9",
708
+ "@rolldown/binding-darwin-arm64": "1.2.9",
709
+ "@rolldown/binding-darwin-x64": "1.2.9",
710
+ "@rolldown/binding-freebsd-x64": "1.2.9",
711
+ "@rolldown/binding-linux-arm-gnueabihf": "1.2.9",
712
+ "@rolldown/binding-linux-arm64-gnu": "1.2.9",
713
+ "@rolldown/binding-linux-arm64-musl": "1.2.9",
714
+ "@rolldown/binding-linux-ppc64-gnu": "1.2.9",
715
+ "@rolldown/binding-linux-s390x-gnu": "1.2.9",
716
+ "@rolldown/binding-linux-x64-gnu": "1.2.9",
717
+ "@rolldown/binding-linux-x64-musl": "1.2.9",
718
+ "@rolldown/binding-openharmony-arm64": "1.2.9",
719
+ "@rolldown/binding-win32-arm64-msvc": "1.2.9",
720
+ "@rolldown/binding-win32-x64-msvc": "1.2.9"
721
+ }
722
+ },
723
+ "node_modules/source-map-js": {
724
+ "version": "1.2.1",
725
+ "resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.2.1.tgz",
726
+ "integrity": "sha512-UXWMKhLOwVKb728IUtQPXxfYU+usdybtUrK/8uGE8CQMvrhOpwvzDBwj0QhSL7MQc7vIsISBG8VQ8+IDQxpfQA==",
727
+ "dev": true,
728
+ "license": "BSD-3-Clause",
729
+ "engines": {
730
+ "node": ">=0.10.0"
731
+ }
732
+ },
733
+ "node_modules/tinyglobby": {
734
+ "version": "0.2.17",
735
+ "resolved": "https://registry.npmjs.org/tinyglobby/-/tinyglobby-0.2.17.tgz",
736
+ "integrity": "sha512-wXR/dYpcqKmfWpEdZjiKJOwCNFndD0DMnrW/cYjVGttEkBfVgcLFHoNrlj47mjOVic9yyNu65alsgF4NQyTa2g==",
737
+ "dev": true,
738
+ "license": "MIT",
739
+ "dependencies": {
740
+ "fdir": "^6.5.0",
741
+ "picomatch": "^4.0.4"
742
+ },
743
+ "engines": {
744
+ "node": ">=12.0.0"
745
+ },
746
+ "funding": {
747
+ "url": "https://github.com/sponsors/SuperchupuDev"
748
+ }
749
+ },
750
+ "node_modules/vite": {
751
+ "version": "8.3.0",
752
+ "resolved": "https://registry.npmjs.org/vite/-/vite-8.3.0.tgz",
753
+ "integrity": "sha512-lhZBVvEHefgE+HQZC9O7EBJgCU/nVzFNl7vkS4RE0APtWLP02/8QVIkQtzBxPquh7lq5/78NHipTj7ODQ6XuyQ==",
754
+ "dev": true,
755
+ "license": "MIT",
756
+ "dependencies": {
757
+ "lightningcss": "^1.33.0",
758
+ "picomatch": "^4.0.7",
759
+ "postcss": "^8.5.28",
760
+ "rolldown": "~1.2.6",
761
+ "tinyglobby": "^0.2.17"
762
+ },
763
+ "bin": {
764
+ "vite": "bin/vite.js"
765
+ },
766
+ "engines": {
767
+ "node": "^20.19.0 || >=22.12.0"
768
+ },
769
+ "funding": {
770
+ "url": "https://github.com/vitejs/vite?sponsor=1"
771
+ },
772
+ "optionalDependencies": {
773
+ "fsevents": "~2.3.3"
774
+ },
775
+ "peerDependencies": {
776
+ "@types/node": "^20.19.0 || >=22.12.0",
777
+ "@vitejs/devtools": "^0.7.1",
778
+ "esbuild": "^0.27.0 || ^0.28.0",
779
+ "jiti": ">=1.21.0",
780
+ "less": "^4.0.0",
781
+ "sass": "^1.70.0",
782
+ "sass-embedded": "^1.70.0",
783
+ "stylus": ">=0.54.8",
784
+ "sugarss": "^5.0.0",
785
+ "terser": "^5.16.0",
786
+ "tsx": "^4.8.1",
787
+ "yaml": "^2.4.2"
788
+ },
789
+ "peerDependenciesMeta": {
790
+ "@types/node": {
791
+ "optional": true
792
+ },
793
+ "@vitejs/devtools": {
794
+ "optional": true
795
+ },
796
+ "esbuild": {
797
+ "optional": true
798
+ },
799
+ "jiti": {
800
+ "optional": true
801
+ },
802
+ "less": {
803
+ "optional": true
804
+ },
805
+ "sass": {
806
+ "optional": true
807
+ },
808
+ "sass-embedded": {
809
+ "optional": true
810
+ },
811
+ "stylus": {
812
+ "optional": true
813
+ },
814
+ "sugarss": {
815
+ "optional": true
816
+ },
817
+ "terser": {
818
+ "optional": true
819
+ },
820
+ "tsx": {
821
+ "optional": true
822
+ },
823
+ "yaml": {
824
+ "optional": true
825
+ }
826
+ }
827
+ }
828
+ }
829
+}
package.json
new
+26
@@ -0,0 +1,26 @@
1
+{
2
+ "name": "factor-easypro",
3
+ "version": "1.0.0",
4
+ "description": "فینورا پرو - سامانه جامع حسابداری و صدور فاکتور",
5
+ "main": "index.js",
6
+ "scripts": {
7
+ "dev": "vite",
8
+ "build": "vite build",
9
+ "preview": "vite preview"
10
+},
11
+ "repository": {
12
+ "type": "git",
13
+ "url": "git+https://github.com/davoodmehraban89/Factor-easyPro.git"
14
+ },
15
+ "keywords": [],
16
+ "author": "",
17
+ "license": "ISC",
18
+ "type": "commonjs",
19
+ "bugs": {
20
+ "url": "https://github.com/davoodmehraban89/Factor-easyPro/issues"
21
+ },
22
+ "homepage": "https://github.com/davoodmehraban89/Factor-easyPro#readme",
23
+ "devDependencies": {
24
+ "vite": "^8.3.0"
25
+ }
26
+}
src/core/Auth.js
new
+74
@@ -0,0 +1,74 @@
1
+// ============================================================
2
+// Auth — احراز هویت ساده
3
+// ============================================================
4
+
5
+import { StorageService } from './StorageService.js';
6
+import { EventBus } from './EventBus.js';
7
+
8
+class AuthImpl {
9
+ constructor() {
10
+ this.currentUser = null;
11
+ this.sessionKey = 'finora_pro_session';
12
+ }
13
+
14
+ async init() {
15
+ const sessionUser = sessionStorage.getItem(this.sessionKey);
16
+ if (sessionUser) {
17
+ this.currentUser = JSON.parse(sessionUser);
18
+ } else {
19
+ const users = await StorageService.getAll('users');
20
+ if (users.length === 0) {
21
+ const admin = {
22
+ id: 'user_admin',
23
+ username: 'admin',
24
+ pass: 'admin123',
25
+ role: 'admin',
26
+ displayName: 'مدیر سیستم',
27
+ createdAt: new Date().toISOString()
28
+ };
29
+ await StorageService.put('users', admin);
30
+ users.push(admin);
31
+ }
32
+ this.currentUser = users[0];
33
+ sessionStorage.setItem(this.sessionKey, JSON.stringify(this.currentUser));
34
+ }
35
+ this._updateUI();
36
+ EventBus.emit('auth:ready', this.currentUser);
37
+ return this.currentUser;
38
+ }
39
+
40
+ _updateUI() {
41
+ const u = this.currentUser;
42
+ if (!u) return;
43
+ const avatar = document.getElementById('userAvatar');
44
+ const name = document.getElementById('userName');
45
+ const role = document.getElementById('userRole');
46
+ if (avatar) avatar.textContent = (u.displayName || u.username || 'م').charAt(0);
47
+ if (name) name.textContent = u.displayName || u.username;
48
+ if (role) role.textContent = u.role === 'admin' ? 'مدیر سیستم' : 'کاربر';
49
+ }
50
+
51
+ current() { return this.currentUser; }
52
+ isAdmin() { return this.currentUser?.role === 'admin'; }
53
+
54
+ async login(username, password) {
55
+ const users = await StorageService.getAll('users');
56
+ const user = users.find(u => u.username === username && u.pass === password);
57
+ if (!user) throw new Error('نام کاربری یا رمز عبور اشتباه است');
58
+ this.currentUser = user;
59
+ sessionStorage.setItem(this.sessionKey, JSON.stringify(user));
60
+ this._updateUI();
61
+ EventBus.emit('auth:login', user);
62
+ return user;
63
+ }
64
+
65
+ logout() {
66
+ if (!confirm('از حساب کاربری خارج میشوید؟')) return;
67
+ this.currentUser = null;
68
+ sessionStorage.removeItem(this.sessionKey);
69
+ EventBus.emit('auth:logout');
70
+ window.location.reload();
71
+ }
72
+}
73
+
74
+export const Auth = new AuthImpl();
\ No newline at end of file
src/core/EventBus.js
new
+38
@@ -0,0 +1,38 @@
1
+// ============================================================
2
+// EventBus — ارتباط بین ماژولها
3
+// ============================================================
4
+
5
+class EventBusImpl {
6
+ constructor() {
7
+ this.listeners = new Map();
8
+ }
9
+
10
+ on(event, callback) {
11
+ if (!this.listeners.has(event)) this.listeners.set(event, []);
12
+ this.listeners.get(event).push(callback);
13
+ return () => this.off(event, callback);
14
+ }
15
+
16
+ off(event, callback) {
17
+ if (!this.listeners.has(event)) return;
18
+ const arr = this.listeners.get(event);
19
+ const idx = arr.indexOf(callback);
20
+ if (idx > -1) arr.splice(idx, 1);
21
+ }
22
+
23
+ emit(event, data) {
24
+ if (!this.listeners.has(event)) return;
25
+ this.listeners.get(event).forEach(cb => {
26
+ try { cb(data); } catch (e) { console.error(`EventBus [${event}] error:`, e); }
27
+ });
28
+ }
29
+
30
+ once(event, callback) {
31
+ const unsubscribe = this.on(event, (data) => {
32
+ unsubscribe();
33
+ callback(data);
34
+ });
35
+ }
36
+}
37
+
38
+export const EventBus = new EventBusImpl();
\ No newline at end of file
src/core/Router.js
new
+86
@@ -0,0 +1,86 @@
1
+// ============================================================
2
+// Router — SPA routing
3
+// ============================================================
4
+
5
+import { EventBus } from './EventBus.js';
6
+
7
+class RouterImpl {
8
+ constructor() {
9
+ this.routes = new Map();
10
+ this.currentRoute = null;
11
+ this.defaultRoute = 'dashboard';
12
+ this.container = null;
13
+ }
14
+
15
+ init(containerId = 'pageContent') {
16
+ this.container = document.getElementById(containerId);
17
+ if (!this.container) {
18
+ console.error('Router: container not found:', containerId);
19
+ return;
20
+ }
21
+ window.addEventListener('hashchange', () => this._handleHash());
22
+ }
23
+
24
+ register(name, config) {
25
+ this.routes.set(name, {
26
+ title: config.title || name,
27
+ render: config.render || (() => '<div>صفحه یافت نشد</div>'),
28
+ onMount: config.onMount || (() => {}),
29
+ onUnmount: config.onUnmount || (() => {})
30
+ });
31
+ }
32
+
33
+ async navigate(name, params = {}) {
34
+ if (!this.routes.has(name)) {
35
+ console.warn('Router: unknown route:', name);
36
+ name = this.defaultRoute;
37
+ }
38
+ const route = this.routes.get(name);
39
+
40
+ if (this.currentRoute && this.currentRoute.onUnmount) {
41
+ try { this.currentRoute.onUnmount(); } catch (e) { console.error(e); }
42
+ }
43
+
44
+ this.currentRoute = route;
45
+ this.currentRoute.name = name;
46
+
47
+ if (window.location.hash !== `#${name}`) {
48
+ window.location.hash = name;
49
+ }
50
+
51
+ if (this.container) {
52
+ try {
53
+ const html = await route.render(params);
54
+ this.container.innerHTML = html;
55
+ if (route.onMount) await route.onMount(params);
56
+ } catch (err) {
57
+ console.error('Router render error:', err);
58
+ this.container.innerHTML = `
59
+ <div class="card" style="text-align:center;padding:40px">
60
+ <div style="font-size:40px;margin-bottom:12px">⚠️</div>
61
+ <h3>خطا در بارگذاری صفحه</h3>
62
+ <p style="color:var(--text-muted);margin-top:8px;font-size:13px">${err.message}</p>
63
+ </div>`;
64
+ }
65
+ }
66
+
67
+ document.querySelectorAll('[data-page]').forEach(a => {
68
+ a.classList.toggle('active', a.dataset.page === name);
69
+ });
70
+
71
+ EventBus.emit('route:changed', { name, params, route });
72
+ localStorage.setItem('finora_pro_last_route', name);
73
+ }
74
+
75
+ _handleHash() {
76
+ const hash = window.location.hash.replace('#', '') || this.defaultRoute;
77
+ if (this.routes.has(hash) && hash !== this.currentRoute?.name) {
78
+ this.navigate(hash);
79
+ }
80
+ }
81
+
82
+ current() { return this.currentRoute?.name || null; }
83
+ go(name) { return this.navigate(name); }
84
+}
85
+
86
+export const Router = new RouterImpl();
\ No newline at end of file
src/core/StorageService.js
new
+171
@@ -0,0 +1,171 @@
1
+// ============================================================
2
+// StorageService — IndexedDB wrapper
3
+// ============================================================
4
+
5
+const DB_NAME = 'finora_pro_db';
6
+const DB_VERSION = 1;
7
+
8
+const STORES = [
9
+ 'users', 'companies', 'contacts', 'products',
10
+ 'invoices', 'invoice_items', 'stock_movements',
11
+ 'transactions', 'cheques', 'expenses',
12
+ 'settings', 'logs'
13
+];
14
+
15
+class StorageServiceImpl {
16
+ constructor() {
17
+ this.db = null;
18
+ }
19
+
20
+ async init() {
21
+ if (this.db) return this.db;
22
+ return new Promise((resolve, reject) => {
23
+ const req = indexedDB.open(DB_NAME, DB_VERSION);
24
+ req.onupgradeneeded = (e) => {
25
+ const db = e.target.result;
26
+ STORES.forEach(name => {
27
+ if (!db.objectStoreNames.contains(name)) {
28
+ const store = db.createObjectStore(name, { keyPath: 'id' });
29
+ if (name !== 'settings' && name !== 'logs') {
30
+ store.createIndex('ownerUserId', 'ownerUserId', { unique: false });
31
+ }
32
+ if (name === 'invoices') {
33
+ store.createIndex('date', 'date', { unique: false });
34
+ store.createIndex('number', 'number', { unique: false });
35
+ store.createIndex('clientUuid', 'clientUuid', { unique: false });
36
+ }
37
+ if (name === 'stock_movements') {
38
+ store.createIndex('productId', 'productId', { unique: false });
39
+ }
40
+ if (name === 'invoice_items') {
41
+ store.createIndex('invoiceId', 'invoiceId', { unique: false });
42
+ }
43
+ }
44
+ });
45
+ };
46
+ req.onsuccess = () => {
47
+ this.db = req.result;
48
+ console.log('✅ IndexedDB ready');
49
+ resolve(this.db);
50
+ };
51
+ req.onerror = () => reject(req.error);
52
+ });
53
+ }
54
+
55
+ async _tx(store, mode = 'readonly') {
56
+ if (!this.db) await this.init();
57
+ return this.db.transaction(store, mode).objectStore(store);
58
+ }
59
+
60
+ async getAll(store) {
61
+ return new Promise(async (resolve, reject) => {
62
+ const s = await this._tx(store);
63
+ const req = s.getAll();
64
+ req.onsuccess = () => resolve(req.result || []);
65
+ req.onerror = () => reject(req.error);
66
+ });
67
+ }
68
+
69
+ async getByOwner(store, ownerId) {
70
+ return new Promise(async (resolve, reject) => {
71
+ const s = await this._tx(store);
72
+ const idx = s.index('ownerUserId');
73
+ const req = idx.getAll(ownerId);
74
+ req.onsuccess = () => resolve(req.result || []);
75
+ req.onerror = () => reject(req.error);
76
+ });
77
+ }
78
+
79
+ async get(store, id) {
80
+ return new Promise(async (resolve, reject) => {
81
+ const s = await this._tx(store);
82
+ const req = s.get(id);
83
+ req.onsuccess = () => resolve(req.result);
84
+ req.onerror = () => reject(req.error);
85
+ });
86
+ }
87
+
88
+ async put(store, obj) {
89
+ if (!obj.id) obj.id = this.uid();
90
+ obj.updatedAt = new Date().toISOString();
91
+ if (!obj.createdAt) obj.createdAt = obj.updatedAt;
92
+ return new Promise(async (resolve, reject) => {
93
+ const s = await this._tx(store, 'readwrite');
94
+ const req = s.put(obj);
95
+ req.onsuccess = () => resolve(obj);
96
+ req.onerror = () => reject(req.error);
97
+ });
98
+ }
99
+
100
+ async bulkPut(store, items) {
101
+ const db = await this.init();
102
+ const tx = db.transaction(store, 'readwrite');
103
+ const s = tx.objectStore(store);
104
+ items.forEach(item => {
105
+ if (!item.id) item.id = this.uid();
106
+ s.put(item);
107
+ });
108
+ return new Promise((resolve, reject) => {
109
+ tx.oncomplete = () => resolve(items.length);
110
+ tx.onerror = () => reject(tx.error);
111
+ });
112
+ }
113
+
114
+ async delete(store, id) {
115
+ return new Promise(async (resolve, reject) => {
116
+ const s = await this._tx(store, 'readwrite');
117
+ const req = s.delete(id);
118
+ req.onsuccess = () => resolve();
119
+ req.onerror = () => reject(req.error);
120
+ });
121
+ }
122
+
123
+ async count(store) {
124
+ return new Promise(async (resolve, reject) => {
125
+ const s = await this._tx(store);
126
+ const req = s.count();
127
+ req.onsuccess = () => resolve(req.result);
128
+ req.onerror = () => reject(req.error);
129
+ });
130
+ }
131
+
132
+ async clearAll() {
133
+ const db = await this.init();
134
+ const tx = db.transaction(STORES, 'readwrite');
135
+ STORES.forEach(name => tx.objectStore(name).clear());
136
+ return new Promise((resolve, reject) => {
137
+ tx.oncomplete = () => resolve();
138
+ tx.onerror = () => reject(tx.error);
139
+ });
140
+ }
141
+
142
+ async exportAll() {
143
+ const data = {};
144
+ for (const store of STORES) {
145
+ data[store] = await this.getAll(store);
146
+ }
147
+ return {
148
+ app: 'Finora Pro',
149
+ version: DB_VERSION,
150
+ exportedAt: new Date().toISOString(),
151
+ data
152
+ };
153
+ }
154
+
155
+ async importAll(json) {
156
+ if (!json || !json.data) throw new Error('فرمت فایل نامعتبر است');
157
+ for (const store of STORES) {
158
+ if (Array.isArray(json.data[store])) {
159
+ await this.bulkPut(store, json.data[store]);
160
+ }
161
+ }
162
+ return true;
163
+ }
164
+
165
+ uid(prefix = '') {
166
+ return prefix + Date.now().toString(36) + Math.random().toString(36).substr(2, 8);
167
+ }
168
+}
169
+
170
+export const StorageService = new StorageServiceImpl();
171
+export { STORES };
\ No newline at end of file
src/core/Theme.js
new
+33
@@ -0,0 +1,33 @@
1
+// ============================================================
2
+// Theme — روشن/تاریک
3
+// ============================================================
4
+
5
+const THEMES = ['light', 'dark'];
6
+const KEY = 'finora_pro_theme';
7
+
8
+class ThemeManager {
9
+ init() {
10
+ const saved = localStorage.getItem(KEY) || 'light';
11
+ this.apply(saved);
12
+ }
13
+
14
+ apply(theme) {
15
+ if (!THEMES.includes(theme)) theme = 'light';
16
+ document.documentElement.setAttribute('data-theme', theme);
17
+ localStorage.setItem(KEY, theme);
18
+ const btn = document.getElementById('themeToggleBtn');
19
+ if (btn) btn.textContent = theme === 'dark' ? '☀️' : '🌙';
20
+ }
21
+
22
+ toggle() {
23
+ const next = this.current() === 'light' ? 'dark' : 'light';
24
+ this.apply(next);
25
+ return next;
26
+ }
27
+
28
+ current() {
29
+ return document.documentElement.getAttribute('data-theme') || 'light';
30
+ }
31
+}
32
+
33
+export const Theme = new ThemeManager();
\ No newline at end of file
src/core/Toast.js
new
+50
@@ -0,0 +1,50 @@
1
+// ============================================================
2
+// Toast Notifications
3
+// ============================================================
4
+
5
+const ICONS = { success: '✅', error: '❌', warning: '⚠️', info: 'ℹ️' };
6
+const DURATIONS = { success: 3000, info: 3500, warning: 5000, error: 6000 };
7
+
8
+class ToastManager {
9
+ constructor() { this.container = null; }
10
+
11
+ _ensure() {
12
+ if (!this.container) {
13
+ this.container = document.createElement('div');
14
+ this.container.className = 'toast-container';
15
+ this.container.id = 'toastContainer';
16
+ document.body.appendChild(this.container);
17
+ }
18
+ return this.container;
19
+ }
20
+
21
+ show(message, type = 'info', title = '') {
22
+ const c = this._ensure();
23
+ const el = document.createElement('div');
24
+ el.className = `toast toast-${type}`;
25
+ el.innerHTML = `
26
+ <div class="toast-icon">${ICONS[type]}</div>
27
+ <div class="toast-content">
28
+ ${title ? `<strong>${this._esc(title)}</strong>` : ''}
29
+ <p>${this._esc(message)}</p>
30
+ </div>
31
+ <button class="toast-close" aria-label="بستن">×</button>`;
32
+ el.querySelector('.toast-close').onclick = () => el.remove();
33
+ c.appendChild(el);
34
+ setTimeout(() => {
35
+ el.style.animation = 'slideOut .3s ease forwards';
36
+ setTimeout(() => el.remove(), 300);
37
+ }, DURATIONS[type] || 4000);
38
+ }
39
+
40
+ success(m, t) { this.show(m, 'success', t); }
41
+ error(m, t) { this.show(m, 'error', t); }
42
+ warning(m, t) { this.show(m, 'warning', t); }
43
+ info(m, t) { this.show(m, 'info', t); }
44
+
45
+ _esc(s) {
46
+ return String(s || '').replace(/[&<>"']/g, c => ({'&':'&','<':'<','>':'>','"':'"',"'":'''}[c]));
47
+ }
48
+}
49
+
50
+export const Toast = new ToastManager();
\ No newline at end of file
src/main.js
new
+223
@@ -0,0 +1,223 @@
1
+// ============================================================
2
+// Finora Pro — Main Entry Point
3
+// ============================================================
4
+
5
+import { StorageService } from './core/StorageService.js';
6
+import { Theme } from './core/Theme.js';
7
+import { Toast } from './core/Toast.js';
8
+import { Router } from './core/Router.js';
9
+import { Auth } from './core/Auth.js';
10
+import { EventBus } from './core/EventBus.js';
11
+import { Formatters } from './utils/Formatters.js';
12
+import { Jalali } from './utils/Jalali.js';
13
+import { numberToWords } from './utils/NumberToWords.js';
14
+
15
+const FINORA = {
16
+ version: '0.1.0',
17
+ Storage: StorageService,
18
+ Theme, Toast, Router, Auth, EventBus,
19
+ Utils: { Formatters, Jalali, numberToWords }
20
+};
21
+window.FINORA = FINORA;
22
+
23
+function registerRoutes() {
24
+ const placeholder = (title, phase) => async () => `
25
+ <div class="page-title">
26
+ <h2>${title}</h2>
27
+ <p>این ماژول در فاز ${phase} پیادهسازی میشود</p>
28
+ </div>
29
+ <div class="card" style="text-align:center;padding:60px 20px">
30
+ <div style="font-size:60px;margin-bottom:16px">🚧</div>
31
+ <h3 style="margin-bottom:8px">در حال توسعه</h3>
32
+ <p class="text-muted">این بخش بهزودی اضافه میشود</p>
33
+ </div>
34
+ `;
35
+
36
+ Router.register('dashboard', {
37
+ title: 'داشبورد',
38
+ render: async () => {
39
+ const user = Auth.current();
40
+ const invoices = await StorageService.getByOwner('invoices', user.id);
41
+ const contacts = await StorageService.getByOwner('contacts', user.id);
42
+ const products = await StorageService.getByOwner('products', user.id);
43
+
44
+ const totalSales = invoices.reduce((s, i) => s + (i.grandTotal || 0), 0);
45
+
46
+ return `
47
+ <div class="page-title">
48
+ <h2>داشبورد مدیریتی</h2>
49
+ <p>نمای کلی از وضعیت کسبوکار شما</p>
50
+ </div>
51
+
52
+ <div class="grid-kpi">
53
+ <div class="card" style="margin:0">
54
+ <div style="font-size:11px;color:var(--text-muted);margin-bottom:6px">فروش کل</div>
55
+ <div style="font-size:20px;font-weight:800;color:var(--primary);margin-bottom:4px">${Formatters.money(totalSales)}</div>
56
+ <div style="font-size:11px;color:var(--text-muted)">${Formatters.number(invoices.length)} فاکتور</div>
57
+ </div>
58
+ <div class="card" style="margin:0">
59
+ <div style="font-size:11px;color:var(--text-muted);margin-bottom:6px">اشخاص ثبتشده</div>
60
+ <div style="font-size:20px;font-weight:800;color:var(--info);margin-bottom:4px">${Formatters.number(contacts.length)}</div>
61
+ <div style="font-size:11px;color:var(--text-muted)">مشتری و تامینکننده</div>
62
+ </div>
63
+ <div class="card" style="margin:0">
64
+ <div style="font-size:11px;color:var(--text-muted);margin-bottom:6px">کالاها</div>
65
+ <div style="font-size:20px;font-weight:800;color:var(--success);margin-bottom:4px">${Formatters.number(products.length)}</div>
66
+ <div style="font-size:11px;color:var(--text-muted)">کالا و خدمات</div>
67
+ </div>
68
+ </div>
69
+
70
+ <div class="card">
71
+ <div class="card-title"><span>🎉 خوش آمدید به فینورا پرو</span></div>
72
+ <p style="font-size:13.5px;line-height:1.9;color:var(--text-muted)">
73
+ این <strong>فاز ۱</strong> از پروژه است. زیرساخت آماده است:
74
+ </p>
75
+ <ul style="margin-top:12px;padding-right:20px;font-size:13px;line-height:2;color:var(--text-muted)">
76
+ <li>✅ پایگاهداده IndexedDB</li>
77
+ <li>✅ معماری ماژولار ES Modules</li>
78
+ <li>✅ Router داخلی SPA</li>
79
+ <li>✅ تم روشن/تاریک</li>
80
+ <li>✅ Toast حرفهای</li>
81
+ <li>✅ تاریخ شمسی توکار</li>
82
+ <li>✅ عدد به حروف فارسی</li>
83
+ <li>✅ EventBus</li>
84
+ </ul>
85
+ </div>
86
+
87
+ <div class="card">
88
+ <div class="card-title"><span>🧪 تست سریع</span></div>
89
+ <div style="display:flex;gap:10px;flex-wrap:wrap">
90
+ <button class="btn" onclick="FINORA.Toast.success('این یک پیام موفقیت است')">تست Toast موفق</button>
91
+ <button class="btn btn-danger" onclick="FINORA.Toast.error('این یک خطا است')">تست Toast خطا</button>
92
+ <button class="btn btn-secondary" onclick="FINORA.Theme.toggle()">تغییر تم</button>
93
+ <button class="btn btn-secondary" onclick="FINORA.Toast.info(FINORA.Utils.numberToWords(1234567890))">تست عدد به حروف</button>
94
+ <button class="btn btn-secondary" onclick="FINORA.Toast.info(FINORA.Utils.Jalali.todayLong())">تاریخ امروز</button>
95
+ </div>
96
+ </div>
97
+ `;
98
+ }
99
+ });
100
+
101
+ Router.register('invoices', { title: 'فاکتورها', render: placeholder('فاکتورها', 4) });
102
+ Router.register('products', { title: 'کالا و انبار', render: placeholder('کالا و انبار', 2) });
103
+ Router.register('contacts', { title: 'اشخاص', render: placeholder('اشخاص', 3) });
104
+ Router.register('treasury', { title: 'خزانه و بانک', render: placeholder('خزانه و بانک', 6) });
105
+ Router.register('cheques', { title: 'چکها', render: placeholder('چکها', 6) });
106
+ Router.register('expenses', { title: 'هزینه و درآمد', render: placeholder('هزینه و درآمد', 6) });
107
+ Router.register('reports', { title: 'گزارش سود و زیان', render: placeholder('گزارش سود و زیان', 7) });
108
+ Router.register('settings', { title: 'تنظیمات', render: placeholder('تنظیمات', 9) });
109
+}
110
+
111
+function getGreeting() {
112
+ const h = new Date().getHours();
113
+ if (h >= 5 && h < 12) return 'صبح بخیر';
114
+ if (h >= 12 && h < 17) return 'وقت بخیر';
115
+ if (h >= 17 && h < 21) return 'عصر بخیر';
116
+ return 'شب بخیر';
117
+}
118
+
119
+function updateHeader() {
120
+ const greetEl = document.getElementById('greeting');
121
+ if (greetEl) greetEl.textContent = `${getGreeting()} • ${Jalali.formatLong()}`;
122
+
123
+ const titleEl = document.getElementById('pageTitle');
124
+ if (titleEl) {
125
+ const titles = {
126
+ dashboard: 'داشبورد مدیریتی',
127
+ invoices: 'فاکتورها',
128
+ products: 'کالا و انبار',
129
+ contacts: 'اشخاص',
130
+ treasury: 'خزانه و بانک',
131
+ cheques: 'چکها',
132
+ expenses: 'هزینه و درآمد',
133
+ reports: 'گزارش سود و زیان',
134
+ settings: 'تنظیمات'
135
+ };
136
+ titleEl.textContent = titles[Router.current()] || 'فینورا پرو';
137
+ }
138
+}
139
+
140
+async function updateStats() {
141
+ const user = Auth.current();
142
+ if (!user) return;
143
+ const [inv, con, pro] = await Promise.all([
144
+ StorageService.count('invoices'),
145
+ StorageService.count('contacts'),
146
+ StorageService.count('products')
147
+ ]);
148
+ const set = (id, val) => { const el = document.getElementById(id); if (el) el.textContent = Formatters.number(val); };
149
+ set('statInvoices', inv);
150
+ set('statContacts', con);
151
+ set('statProducts', pro);
152
+}
153
+
154
+function setupSidebar() {
155
+ document.querySelectorAll('[data-page]').forEach(a => {
156
+ a.addEventListener('click', e => {
157
+ e.preventDefault();
158
+ Router.go(a.dataset.page);
159
+ });
160
+ });
161
+
162
+ if (localStorage.getItem('finora_pro_sidebar_collapsed') === 'true') {
163
+ document.getElementById('sidebar').classList.add('collapsed');
164
+ document.getElementById('main').classList.add('sidebar-collapsed');
165
+ }
166
+}
167
+
168
+function setupKeyboard() {
169
+ document.addEventListener('keydown', e => {
170
+ if ((e.ctrlKey || e.metaKey) && e.key === 's') {
171
+ e.preventDefault();
172
+ Toast.info('میانبر ذخیره در فازهای بعدی فعال میشود');
173
+ }
174
+ });
175
+}
176
+
177
+async function bootstrap() {
178
+ try {
179
+ console.log('🚀 Finora Pro v' + FINORA.version);
180
+
181
+ Theme.init();
182
+ await StorageService.init();
183
+ await Auth.init();
184
+
185
+ registerRoutes();
186
+ Router.init('pageContent');
187
+ setupSidebar();
188
+ setupKeyboard();
189
+
190
+ EventBus.on('route:changed', () => {
191
+ updateHeader();
192
+ updateStats();
193
+ });
194
+
195
+ const lastRoute = localStorage.getItem('finora_pro_last_route') || 'dashboard';
196
+ await Router.go(lastRoute);
197
+
198
+ updateHeader();
199
+ updateStats();
200
+ setInterval(updateHeader, 60000);
201
+
202
+ document.getElementById('splash').style.display = 'none';
203
+
204
+ setTimeout(() => Toast.success('فینورا پرو با موفقیت بارگذاری شد', 'خوش آمدید'), 300);
205
+ } catch (err) {
206
+ console.error('Bootstrap failed:', err);
207
+ const splash = document.getElementById('splash');
208
+ if (splash) {
209
+ splash.innerHTML = `
210
+ <div style="padding:20px;text-align:center;color:#fff;max-width:400px">
211
+ <div style="font-size:40px;margin-bottom:12px">⚠️</div>
212
+ <div style="font-size:16px;font-weight:700">خطا در بارگذاری</div>
213
+ <div style="font-size:12px;margin-top:8px;opacity:.85">${err.message}</div>
214
+ </div>`;
215
+ }
216
+ }
217
+}
218
+
219
+if (document.readyState === 'loading') {
220
+ document.addEventListener('DOMContentLoaded', bootstrap);
221
+} else {
222
+ bootstrap();
223
+}
\ No newline at end of file
src/styles/main.css
new
+301
@@ -0,0 +1,301 @@
1
+/* ============================================================
2
+ Finora Pro — Main Stylesheet
3
+ ============================================================ */
4
+
5
+:root {
6
+ --primary: #0d9488;
7
+ --primary-hover: #0f766e;
8
+ --primary-light: #ccfbf1;
9
+ --primary-dark: #115e59;
10
+ --bg: #f8fafc;
11
+ --card-bg: #ffffff;
12
+ --text: #0f172a;
13
+ --text-muted: #64748b;
14
+ --border: #e2e8f0;
15
+ --danger: #dc2626;
16
+ --success: #059669;
17
+ --warning: #d97706;
18
+ --info: #0284c7;
19
+ --shadow-sm: 0 1px 3px rgba(0,0,0,.05);
20
+ --shadow-md: 0 4px 12px rgba(0,0,0,.08);
21
+ --sidebar-w: 260px;
22
+ --sidebar-mini: 72px;
23
+ --header-h: 64px;
24
+ --radius: 12px;
25
+ --font-size-base: 14px;
26
+}
27
+
28
+[data-theme="dark"] {
29
+ --bg: #0f172a;
30
+ --card-bg: #1e293b;
31
+ --text: #f1f5f9;
32
+ --text-muted: #94a3b8;
33
+ --border: #334155;
34
+ --primary-light: #134e4a;
35
+ --shadow-sm: 0 1px 3px rgba(0,0,0,.3);
36
+ --shadow-md: 0 4px 12px rgba(0,0,0,.4);
37
+}
38
+
39
+* { box-sizing: border-box; margin: 0; padding: 0; }
40
+html, body { height: 100%; }
41
+body {
42
+ background: var(--bg);
43
+ color: var(--text);
44
+ font-family: 'Vazirmatn FD', Tahoma, sans-serif;
45
+ font-size: var(--font-size-base);
46
+ overflow-x: hidden;
47
+ transition: background .3s, color .3s;
48
+}
49
+button { cursor: pointer; font-family: inherit; }
50
+input, select, textarea { font-family: inherit; font-size: inherit; }
51
+a { color: inherit; }
52
+
53
+/* Splash */
54
+#splash {
55
+ position: fixed; inset: 0;
56
+ background: linear-gradient(135deg, var(--primary), var(--primary-dark));
57
+ display: flex; flex-direction: column;
58
+ align-items: center; justify-content: center;
59
+ gap: 20px; color: #fff; z-index: 9999;
60
+}
61
+.splash-logo { font-size: 38px; font-weight: 900; letter-spacing: 2px; }
62
+.splash-spinner {
63
+ width: 40px; height: 40px;
64
+ border: 3px solid rgba(255,255,255,.3);
65
+ border-top-color: #fff;
66
+ border-radius: 50%;
67
+ animation: spin 1s linear infinite;
68
+}
69
+@keyframes spin { to { transform: rotate(360deg); } }
70
+
71
+/* App Layout */
72
+.app { display: flex; min-height: 100vh; }
73
+
74
+.sidebar {
75
+ width: var(--sidebar-w);
76
+ background: var(--card-bg);
77
+ border-left: 1px solid var(--border);
78
+ position: fixed; top: 0; bottom: 0; right: 0;
79
+ z-index: 100;
80
+ display: flex; flex-direction: column;
81
+ transition: width .25s ease;
82
+}
83
+.sidebar.collapsed { width: var(--sidebar-mini); }
84
+.sidebar.collapsed .hide-on-collapse { display: none; }
85
+.sidebar.collapsed .sidebar-brand { justify-content: center; padding: 20px 0; }
86
+.sidebar.collapsed .sidebar-menu a { justify-content: center; padding: 12px; }
87
+.sidebar.collapsed .sidebar-menu a .label { display: none; }
88
+.sidebar.collapsed .user-info { display: none; }
89
+
90
+.sidebar-brand {
91
+ padding: 18px 20px;
92
+ border-bottom: 1px solid var(--border);
93
+ display: flex; align-items: center; gap: 12px;
94
+ min-height: var(--header-h);
95
+}
96
+.brand-logo {
97
+ width: 42px; height: 42px;
98
+ background: linear-gradient(135deg, var(--primary), var(--primary-dark));
99
+ border-radius: 10px;
100
+ display: flex; align-items: center; justify-content: center;
101
+ color: #fff; font-weight: 800; font-size: 13px;
102
+ flex-shrink: 0;
103
+}
104
+.brand-text h1 { font-size: 15px; font-weight: 800; }
105
+.brand-text small { font-size: 10.5px; color: var(--text-muted); }
106
+
107
+.sidebar-menu { list-style: none; flex: 1; overflow-y: auto; padding: 12px 8px; }
108
+.sidebar-menu a {
109
+ display: flex; align-items: center; gap: 12px;
110
+ padding: 11px 14px; border-radius: 10px;
111
+ color: var(--text); text-decoration: none;
112
+ font-size: 13.5px; font-weight: 500;
113
+ margin-bottom: 2px; cursor: pointer;
114
+ transition: all .15s; white-space: nowrap;
115
+}
116
+.sidebar-menu a:hover { background: var(--primary-light); }
117
+.sidebar-menu a.active {
118
+ background: var(--primary); color: #fff;
119
+ font-weight: 700; box-shadow: var(--shadow-sm);
120
+}
121
+.sidebar-menu a .icon { font-size: 16px; width: 20px; text-align: center; flex-shrink: 0; }
122
+
123
+.sidebar-footer { padding: 10px; border-top: 1px solid var(--border); }
124
+.user-chip {
125
+ display: flex; align-items: center; gap: 10px;
126
+ padding: 8px; border-radius: 10px;
127
+ background: var(--bg);
128
+}
129
+.user-avatar {
130
+ width: 34px; height: 34px; border-radius: 50%;
131
+ background: var(--primary); color: #fff;
132
+ display: flex; align-items: center; justify-content: center;
133
+ font-weight: 700; font-size: 13px; flex-shrink: 0;
134
+}
135
+.user-info { flex: 1; min-width: 0; }
136
+.user-info strong { display: block; font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
137
+.user-info small { font-size: 10.5px; color: var(--text-muted); }
138
+
139
+.main {
140
+ margin-right: var(--sidebar-w);
141
+ flex: 1; min-height: 100vh;
142
+ transition: margin .25s ease;
143
+ max-width: 100%; overflow-x: hidden;
144
+}
145
+.main.sidebar-collapsed { margin-right: var(--sidebar-mini); }
146
+
147
+/* Header */
148
+.header {
149
+ height: var(--header-h);
150
+ background: var(--card-bg);
151
+ border-bottom: 1px solid var(--border);
152
+ position: sticky; top: 0; z-index: 90;
153
+ display: flex; align-items: center;
154
+ padding: 0 20px; gap: 14px;
155
+}
156
+.hamburger {
157
+ background: none; border: none;
158
+ font-size: 22px; color: var(--text);
159
+ padding: 6px 10px; border-radius: 8px;
160
+ display: none;
161
+}
162
+.hamburger:hover { background: var(--bg); }
163
+@media (max-width: 900px) { .hamburger { display: block; } }
164
+
165
+.header-title { flex: 1; min-width: 0; }
166
+.header-title h2 {
167
+ font-size: 15px; font-weight: 700;
168
+ white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
169
+}
170
+.header-title small {
171
+ font-size: 11px; color: var(--text-muted);
172
+ display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
173
+}
174
+
175
+.header-stats { display: flex; gap: 8px; align-items: center; }
176
+@media (max-width: 1000px) { .header-stats { display: none; } }
177
+.stat-chip {
178
+ display: flex; flex-direction: column;
179
+ padding: 5px 11px; border-radius: 8px;
180
+ background: var(--bg); border: 1px solid var(--border);
181
+ font-size: 11px; line-height: 1.3; min-width: 60px;
182
+}
183
+.stat-chip strong { color: var(--primary); font-size: 13px; font-weight: 800; }
184
+.stat-chip small { color: var(--text-muted); font-size: 10px; }
185
+
186
+.header-tools { display: flex; gap: 6px; align-items: center; }
187
+.icon-btn {
188
+ background: none; border: 1px solid var(--border);
189
+ color: var(--text); width: 38px; height: 38px;
190
+ border-radius: 10px;
191
+ display: flex; align-items: center; justify-content: center;
192
+ font-size: 16px; transition: all .15s;
193
+ position: relative;
194
+}
195
+.icon-btn:hover { background: var(--bg); border-color: var(--primary); }
196
+
197
+/* Content */
198
+.content {
199
+ padding: 22px;
200
+ padding-bottom: 100px;
201
+ min-height: calc(100vh - var(--header-h));
202
+}
203
+
204
+.page-title { margin-bottom: 18px; }
205
+.page-title h2 { font-size: 22px; font-weight: 800; margin-bottom: 4px; }
206
+.page-title p { color: var(--text-muted); font-size: 13px; }
207
+
208
+.card {
209
+ background: var(--card-bg);
210
+ border: 1px solid var(--border);
211
+ border-radius: var(--radius);
212
+ padding: 20px;
213
+ box-shadow: var(--shadow-sm);
214
+ margin-bottom: 16px;
215
+}
216
+.card-title {
217
+ font-size: 15px; font-weight: 700;
218
+ margin-bottom: 14px;
219
+ display: flex; align-items: center;
220
+ justify-content: space-between; gap: 10px;
221
+}
222
+
223
+.grid-kpi {
224
+ display: grid;
225
+ grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
226
+ gap: 14px; margin-bottom: 20px;
227
+}
228
+
229
+/* Buttons */
230
+.btn {
231
+ display: inline-flex; align-items: center; justify-content: center;
232
+ gap: 8px; padding: 10px 18px; min-height: 42px;
233
+ background: var(--primary); color: #fff;
234
+ border: none; border-radius: 10px;
235
+ font-size: 13.5px; font-weight: 700;
236
+ transition: all .15s; text-decoration: none;
237
+ font-family: inherit;
238
+}
239
+.btn:hover {
240
+ background: var(--primary-hover);
241
+ transform: translateY(-1px);
242
+ box-shadow: var(--shadow-md);
243
+}
244
+.btn-secondary {
245
+ background: var(--bg); color: var(--text);
246
+ border: 1px solid var(--border);
247
+}
248
+.btn-secondary:hover { background: var(--card-bg); border-color: var(--primary); }
249
+.btn-danger { background: var(--danger); }
250
+.btn-success { background: var(--success); }
251
+.btn-warning { background: var(--warning); }
252
+
253
+/* Toast */
254
+.toast-container {
255
+ position: fixed; top: 80px; left: 20px;
256
+ z-index: 9999;
257
+ display: flex; flex-direction: column;
258
+ gap: 10px; max-width: 380px;
259
+}
260
+.toast {
261
+ background: var(--card-bg);
262
+ border: 1px solid var(--border);
263
+ border-right: 4px solid var(--primary);
264
+ border-radius: 10px;
265
+ padding: 14px 16px;
266
+ box-shadow: var(--shadow-md);
267
+ display: flex; gap: 12px; align-items: flex-start;
268
+ animation: slideIn .3s ease; min-width: 280px;
269
+}
270
+.toast-success { border-right-color: var(--success); }
271
+.toast-error { border-right-color: var(--danger); }
272
+.toast-warning { border-right-color: var(--warning); }
273
+.toast-info { border-right-color: var(--info); }
274
+.toast-icon { font-size: 20px; flex-shrink: 0; }
275
+.toast-content { flex: 1; min-width: 0; }
276
+.toast-content strong { display: block; font-size: 13px; margin-bottom: 2px; }
277
+.toast-content p { font-size: 12px; color: var(--text-muted); line-height: 1.5; }
278
+.toast-close {
279
+ background: none; border: none;
280
+ color: var(--text-muted); font-size: 18px;
281
+ padding: 0; width: 20px; height: 20px;
282
+ display: flex; align-items: center; justify-content: center;
283
+}
284
+@keyframes slideIn {
285
+ from { transform: translateX(-100%); opacity: 0; }
286
+ to { transform: translateX(0); opacity: 1; }
287
+}
288
+@keyframes slideOut {
289
+ from { transform: translateX(0); opacity: 1; }
290
+ to { transform: translateX(-100%); opacity: 0; }
291
+}
292
+
293
+/* Utilities */
294
+.hidden { display: none !important; }
295
+.text-muted { color: var(--text-muted); }
296
+
297
+/* Scrollbar */
298
+::-webkit-scrollbar { width: 8px; height: 8px; }
299
+::-webkit-scrollbar-track { background: var(--bg); }
300
+::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }
301
+::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }
\ No newline at end of file
src/utils/Formatters.js
new
+43
@@ -0,0 +1,43 @@
1
+// ============================================================
2
+// توابع فرمتدهی
3
+// ============================================================
4
+
5
+export const Formatters = {
6
+ toPersianDigits(str) {
7
+ if (str === null || str === undefined) return '';
8
+ return String(str).replace(/[0-9]/g, d => '۰۱۲۳۴۵۶۷۸۹'[d]);
9
+ },
10
+ toLatinDigits(str) {
11
+ if (!str) return '';
12
+ return String(str).replace(/[۰-۹]/g, d => '۰۱۲۳۴۵۶۷۸۹'.indexOf(d));
13
+ },
14
+ number(num, usePersian = true) {
15
+ if (num === null || num === undefined || isNaN(num)) return '۰';
16
+ const s = Number(num).toLocaleString('en-US');
17
+ return usePersian ? this.toPersianDigits(s) : s;
18
+ },
19
+ money(num, currency = 'ریال', usePersian = true) {
20
+ return `${this.number(num, usePersian)} ${currency}`;
21
+ },
22
+ percent(num) {
23
+ return this.toPersianDigits(num.toFixed(2)) + '٪';
24
+ },
25
+ date(date) {
26
+ const d = date instanceof Date ? date : new Date(date);
27
+ if (isNaN(d.getTime())) return '—';
28
+ const y = d.getFullYear();
29
+ const m = String(d.getMonth() + 1).padStart(2, '0');
30
+ const day = String(d.getDate()).padStart(2, '0');
31
+ return this.toPersianDigits(`${y}/${m}/${day}`);
32
+ },
33
+ phone(num) {
34
+ if (!num) return '—';
35
+ const clean = String(num).replace(/\D/g, '');
36
+ if (clean.length === 11) return this.toPersianDigits(`${clean.slice(0,4)} ${clean.slice(4,7)} ${clean.slice(7)}`);
37
+ return this.toPersianDigits(clean);
38
+ },
39
+ truncate(str, len = 40) {
40
+ if (!str) return '';
41
+ return str.length > len ? str.slice(0, len) + '...' : str;
42
+ }
43
+};
\ No newline at end of file
src/utils/Jalali.js
new
+92
@@ -0,0 +1,92 @@
1
+// ============================================================
2
+// Jalali Date Utilities — توکار بدون پکیج خارجی
3
+// ============================================================
4
+
5
+const MONTHS = ['فروردین','اردیبهشت','خرداد','تیر','مرداد','شهریور','مهر','آبان','آذر','دی','بهمن','اسفند'];
6
+const WEEKDAYS = ['شنبه','یکشنبه','دوشنبه','سهشنبه','چهارشنبه','پنجشنبه','جمعه'];
7
+const WEEKDAYS_SHORT = ['ش','ی','د','س','چ','پ','ج'];
8
+
9
+function div(a, b) { return Math.floor(a / b); }
10
+
11
+function g2j(gy, gm, gd) {
12
+ const g_d_m = [0,31,59,90,120,151,181,212,243,273,304,334];
13
+ let jy = (gy <= 1600) ? 0 : 979;
14
+ gy -= (gy <= 1600) ? 621 : 1600;
15
+ const gy2 = (gm > 2) ? (gy + 1) : gy;
16
+ let days = (365 * gy) + div((gy2 + 3), 4) - div((gy2 + 99), 100) + div((gy2 + 399), 400) - 80 + gd + g_d_m[gm - 1];
17
+ jy += 33 * div(days, 12053);
18
+ days %= 12053;
19
+ jy += 4 * div(days, 1461);
20
+ days %= 1461;
21
+ if (days > 365) { jy += div((days - 1), 365); days = (days - 1) % 365; }
22
+ const jm = (days < 186) ? 1 + div(days, 31) : 7 + div((days - 186), 30);
23
+ const jd = 1 + ((days < 186) ? (days % 31) : ((days - 186) % 30));
24
+ return [jy, jm, jd];
25
+}
26
+
27
+function j2g(jy, jm, jd) {
28
+ let gy = (jy <= 979) ? 621 : 1600;
29
+ jy -= (jy <= 979) ? 0 : 979;
30
+ let days = (365 * jy) + (div(jy, 33) * 8) + div(((jy % 33) + 3), 4) + 78 + jd + ((jm < 7) ? (jm - 1) * 31 : ((jm - 7) * 30) + 186);
31
+ gy += 400 * div(days, 146097);
32
+ days %= 146097;
33
+ if (days > 36524) {
34
+ gy += 100 * div(--days, 36524);
35
+ days %= 36524;
36
+ if (days >= 365) days++;
37
+ }
38
+ gy += 4 * div(days, 1461);
39
+ days %= 1461;
40
+ if (days > 365) { gy += div((days - 1), 365); days = (days - 1) % 365; }
41
+ let gd = days + 1;
42
+ const sal_a = [0,31,((gy % 4 === 0 && gy % 100 !== 0) || (gy % 400 === 0)) ? 29 : 28,31,30,31,30,31,31,30,31,30,31];
43
+ let gm = 0;
44
+ for (gm = 0; gm < 13 && gd > sal_a[gm]; gm++) gd -= sal_a[gm];
45
+ return [gy, gm, gd];
46
+}
47
+
48
+export const Jalali = {
49
+ now() {
50
+ const d = new Date();
51
+ const [jy, jm, jd] = g2j(d.getFullYear(), d.getMonth() + 1, d.getDate());
52
+ return { year: jy, month: jm, day: jd, weekday: (d.getDay() + 1) % 7 };
53
+ },
54
+ fromDate(date = new Date()) {
55
+ if (!(date instanceof Date)) date = new Date(date);
56
+ const [jy, jm, jd] = g2j(date.getFullYear(), date.getMonth() + 1, date.getDate());
57
+ return { year: jy, month: jm, day: jd, weekday: (date.getDay() + 1) % 7 };
58
+ },
59
+ toDate(jy, jm, jd) {
60
+ const [gy, gm, gd] = j2g(jy, jm, jd);
61
+ return new Date(gy, gm - 1, gd, 12, 0, 0);
62
+ },
63
+ parse(str) {
64
+ if (!str) return new Date();
65
+ str = String(str).replace(/[۰-۹]/g, d => '۰۱۲۳۴۵۶۷۸۹'.indexOf(d));
66
+ const parts = str.split(/[\/\-\.]/).map(Number);
67
+ if (parts.length !== 3) return new Date();
68
+ return this.toDate(parts[0], parts[1], parts[2]);
69
+ },
70
+ format(date = new Date(), sep = '/') {
71
+ const { year, month, day } = this.fromDate(date);
72
+ return `${year}${sep}${String(month).padStart(2,'0')}${sep}${String(day).padStart(2,'0')}`;
73
+ },
74
+ formatLong(date = new Date()) {
75
+ const { year, month, day, weekday } = this.fromDate(date);
76
+ return `${WEEKDAYS[weekday]}، ${day} ${MONTHS[month - 1]} ${year}`;
77
+ },
78
+ monthName(m) { return MONTHS[m - 1] || ''; },
79
+ monthNames() { return [...MONTHS]; },
80
+ weekdayNames() { return [...WEEKDAYS]; },
81
+ weekdayShort() { return [...WEEKDAYS_SHORT]; },
82
+ addDays(date, days) {
83
+ const d = new Date(date);
84
+ d.setDate(d.getDate() + days);
85
+ return d;
86
+ },
87
+ diffDays(from, to) {
88
+ return Math.floor((to - from) / (1000 * 60 * 60 * 24));
89
+ },
90
+ today() { return this.format(new Date()); },
91
+ todayLong() { return this.formatLong(new Date()); }
92
+};
\ No newline at end of file
src/utils/NumberToWords.js
new
+50
@@ -0,0 +1,50 @@
1
+// ============================================================
2
+// تبدیل عدد به حروف فارسی
3
+// ============================================================
4
+
5
+const YEGAN = ['','یک','دو','سه','چهار','پنج','شش','هفت','هشت','نه'];
6
+const DAHGAN = ['','','بیست','سی','چهل','پنجاه','شصت','هفتاد','هشتاد','نود'];
7
+const DAH_TA_BIST = ['ده','یازده','دوازده','سیزده','چهارده','پانزده','شانزده','هفده','هجده','نوزده'];
8
+const SADGAN = ['','صد','دویست','سیصد','چهارصد','پانصد','ششصد','هفتصد','هشتصد','نهصد'];
9
+const PART_NAMES = ['','هزار','میلیون','میلیارد','تریلیون','کوادریلیون'];
10
+
11
+function threeDigitToWords(n) {
12
+ const c = Math.floor(n / 100);
13
+ const d = Math.floor((n % 100) / 10);
14
+ const y = n % 10;
15
+ const parts = [];
16
+ if (c > 0) parts.push(SADGAN[c]);
17
+ if (d === 1) parts.push(DAH_TA_BIST[y]);
18
+ else {
19
+ if (d > 1) parts.push(DAHGAN[d]);
20
+ if (y > 0) parts.push(YEGAN[y]);
21
+ }
22
+ return parts.join(' و ');
23
+}
24
+
25
+export function numberToWords(num, currency = 'ریال') {
26
+ if (num === null || num === undefined || isNaN(num)) return 'صفر ' + currency;
27
+ num = Math.round(Number(num));
28
+ if (num === 0) return 'صفر ' + currency;
29
+ const isNegative = num < 0;
30
+ num = Math.abs(num);
31
+ const parts = [];
32
+ let idx = 0;
33
+ let temp = num;
34
+ while (temp > 0) {
35
+ const chunk = temp % 1000;
36
+ if (chunk > 0) {
37
+ let w = threeDigitToWords(chunk);
38
+ if (PART_NAMES[idx]) w += ' ' + PART_NAMES[idx];
39
+ parts.unshift(w);
40
+ }
41
+ temp = Math.floor(temp / 1000);
42
+ idx++;
43
+ }
44
+ const result = parts.join(' و ') + ' ' + currency;
45
+ return isNegative ? 'منفی ' + result : result;
46
+}
47
+
48
+export function numberToWordsShort(num) {
49
+ return numberToWords(num, '');
50
+}
\ No newline at end of file