create-cedro-app 1.0.2 → 1.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (69) hide show
  1. package/bin/index.js +32 -18
  2. package/package.json +1 -1
  3. package/templates/invoice-service-management-system/client/README.md +16 -0
  4. package/templates/invoice-service-management-system/client/eslint.config.js +21 -0
  5. package/templates/invoice-service-management-system/client/index.html +13 -0
  6. package/templates/invoice-service-management-system/client/package.json +35 -0
  7. package/templates/invoice-service-management-system/client/public/favicon.svg +1 -0
  8. package/templates/invoice-service-management-system/client/public/icons.svg +24 -0
  9. package/templates/invoice-service-management-system/client/src/App.jsx +15 -0
  10. package/templates/invoice-service-management-system/client/src/assets/hero.png +0 -0
  11. package/templates/invoice-service-management-system/client/src/assets/react.svg +1 -0
  12. package/templates/invoice-service-management-system/client/src/assets/vite.svg +1 -0
  13. package/templates/invoice-service-management-system/client/src/components/AppRoutes.jsx +39 -0
  14. package/templates/invoice-service-management-system/client/src/components/Customer.jsx +326 -0
  15. package/templates/invoice-service-management-system/client/src/components/Dashboard.jsx +512 -0
  16. package/templates/invoice-service-management-system/client/src/components/Invoice.jsx +523 -0
  17. package/templates/invoice-service-management-system/client/src/components/Login.jsx +170 -0
  18. package/templates/invoice-service-management-system/client/src/components/PageNotFound.jsx +11 -0
  19. package/templates/invoice-service-management-system/client/src/components/Register.jsx +171 -0
  20. package/templates/invoice-service-management-system/client/src/components/Report.jsx +383 -0
  21. package/templates/invoice-service-management-system/client/src/components/Service.jsx +390 -0
  22. package/templates/invoice-service-management-system/client/src/index.css +1 -0
  23. package/templates/invoice-service-management-system/client/src/main.jsx +13 -0
  24. package/templates/invoice-service-management-system/client/vite.config.js +9 -0
  25. package/templates/invoice-service-management-system/server/.env +8 -0
  26. package/templates/invoice-service-management-system/server/Functions/Customer.js +79 -0
  27. package/templates/invoice-service-management-system/server/Functions/Invoice.js +192 -0
  28. package/templates/invoice-service-management-system/server/Functions/Service.js +86 -0
  29. package/templates/invoice-service-management-system/server/Functions/dashboard.js +33 -0
  30. package/templates/invoice-service-management-system/server/Functions/report.js +50 -0
  31. package/templates/invoice-service-management-system/server/Functions/users.js +101 -0
  32. package/templates/invoice-service-management-system/server/db.js +22 -0
  33. package/templates/invoice-service-management-system/server/package.json +23 -0
  34. package/templates/invoice-service-management-system/server/server.js +294 -0
  35. package/templates/slot-car-management-system/client/README.md +16 -0
  36. package/templates/slot-car-management-system/client/eslint.config.js +21 -0
  37. package/templates/slot-car-management-system/client/index.html +13 -0
  38. package/templates/slot-car-management-system/client/package.json +35 -0
  39. package/templates/slot-car-management-system/client/public/favicon.svg +1 -0
  40. package/templates/slot-car-management-system/client/public/icons.svg +24 -0
  41. package/templates/slot-car-management-system/client/src/App.css +184 -0
  42. package/templates/slot-car-management-system/client/src/App.jsx +49 -0
  43. package/templates/slot-car-management-system/client/src/assets/hero.png +0 -0
  44. package/templates/slot-car-management-system/client/src/assets/react.svg +1 -0
  45. package/templates/slot-car-management-system/client/src/assets/vite.svg +1 -0
  46. package/templates/slot-car-management-system/client/src/components/Cars.jsx +246 -0
  47. package/templates/slot-car-management-system/client/src/components/Dashboard.jsx +629 -0
  48. package/templates/slot-car-management-system/client/src/components/Login.jsx +170 -0
  49. package/templates/slot-car-management-system/client/src/components/PageNotFound.jsx +11 -0
  50. package/templates/slot-car-management-system/client/src/components/ParkingRecord.jsx +553 -0
  51. package/templates/slot-car-management-system/client/src/components/ParkingSlot.jsx +268 -0
  52. package/templates/slot-car-management-system/client/src/components/Payment.jsx +464 -0
  53. package/templates/slot-car-management-system/client/src/components/Register.jsx +171 -0
  54. package/templates/slot-car-management-system/client/src/components/Report.jsx +407 -0
  55. package/templates/slot-car-management-system/client/src/index.css +1 -0
  56. package/templates/slot-car-management-system/client/src/main.jsx +10 -0
  57. package/templates/slot-car-management-system/client/vite.config.js +9 -0
  58. package/templates/slot-car-management-system/parking_slot.sql +218 -0
  59. package/templates/slot-car-management-system/server/.env +8 -0
  60. package/templates/slot-car-management-system/server/Functions/Payment.js +107 -0
  61. package/templates/slot-car-management-system/server/Functions/car.js +93 -0
  62. package/templates/slot-car-management-system/server/Functions/dashboard.js +64 -0
  63. package/templates/slot-car-management-system/server/Functions/parkingRecord.js +220 -0
  64. package/templates/slot-car-management-system/server/Functions/parkingslot.js +58 -0
  65. package/templates/slot-car-management-system/server/Functions/report.js +48 -0
  66. package/templates/slot-car-management-system/server/Functions/users.js +101 -0
  67. package/templates/slot-car-management-system/server/db.js +22 -0
  68. package/templates/slot-car-management-system/server/package.json +23 -0
  69. package/templates/slot-car-management-system/server/server.js +192 -0
@@ -0,0 +1,512 @@
1
+ import React, { useEffect, useState } from "react";
2
+ import axios from "axios";
3
+
4
+ import {
5
+ LayoutDashboard,
6
+ Users,
7
+ Wrench,
8
+ Receipt,
9
+ FileBarChart,
10
+ LogOut,
11
+ Search,
12
+ UserCircle
13
+ } from "lucide-react";
14
+
15
+ import { useNavigate } from "react-router-dom";
16
+ import Customers from "./Customer";
17
+ import Services from "./Service";
18
+ import Invoices from "./Invoice";
19
+ import Report from "./Report";
20
+
21
+ // COMPONENTS
22
+
23
+
24
+ function Dashboard() {
25
+
26
+ const token = localStorage.getItem("token");
27
+
28
+ const navigate = useNavigate();
29
+
30
+ // =========================
31
+ // CHECK TOKEN
32
+ // =========================
33
+ useEffect(() => {
34
+
35
+ const token = localStorage.getItem("token");
36
+
37
+ if (!token) {
38
+ navigate("/");
39
+ }
40
+
41
+ }, [navigate]);
42
+
43
+ // =========================
44
+ // STATES
45
+ // =========================
46
+ const [stats, setStats] = useState({
47
+ customers: 0,
48
+ services: 0,
49
+ invoices: 0
50
+ });
51
+
52
+ const [activeTab, setActiveTab] =
53
+ useState("Dashboard");
54
+
55
+ // =========================
56
+ // FETCH DASHBOARD STATS
57
+ // =========================
58
+ const fetchStats = async () => {
59
+ try {
60
+ const res = await axios.get(
61
+ "http://localhost:3000/dashboard-stats",
62
+ {
63
+ headers: {
64
+ Authorization: `Bearer ${token}`
65
+ }
66
+ }
67
+ );
68
+
69
+ setStats({
70
+ customers: res.data.customers || 0,
71
+ services: res.data.services || 0,
72
+ invoices: res.data.invoices || 0
73
+ });
74
+
75
+ } catch (error) {
76
+ console.log(error);
77
+ }
78
+ };
79
+
80
+ useEffect(() => {
81
+
82
+ fetchStats();
83
+
84
+ }, []);
85
+
86
+ // =========================
87
+ // LOGOUT
88
+ // =========================
89
+ const handleLogout = () => {
90
+
91
+ localStorage.clear();
92
+
93
+ navigate("/");
94
+ };
95
+
96
+ return (
97
+
98
+ <div className="min-h-screen bg-gray-100 flex">
99
+
100
+ {/* SIDEBAR */}
101
+ <aside className="w-72 bg-slate-900 text-white flex flex-col shadow-2xl">
102
+
103
+ {/* LOGO */}
104
+ <div className="p-6 border-b border-slate-700">
105
+
106
+ <h1 className="text-3xl font-bold text-indigo-400">
107
+ VSBMS
108
+ </h1>
109
+
110
+ <p className="text-gray-400 text-sm mt-2">
111
+ Vehicle Service Billing Management System
112
+ </p>
113
+
114
+ </div>
115
+
116
+ {/* MENU */}
117
+ <nav className="flex-1 px-4 py-6 space-y-3">
118
+
119
+ {/* DASHBOARD */}
120
+ <button
121
+ onClick={() => setActiveTab("Dashboard")}
122
+ className={`w-full flex items-center gap-4 px-4 py-3 rounded-xl transition ${
123
+ activeTab === "Dashboard"
124
+ ? "bg-indigo-600"
125
+ : "hover:bg-slate-800"
126
+ }`}
127
+ >
128
+
129
+ <LayoutDashboard size={22} />
130
+
131
+ Dashboard
132
+
133
+ </button>
134
+
135
+ {/* CUSTOMERS */}
136
+ <button
137
+ onClick={() => setActiveTab("Customers")}
138
+ className={`w-full flex items-center gap-4 px-4 py-3 rounded-xl transition ${
139
+ activeTab === "Customers"
140
+ ? "bg-indigo-600"
141
+ : "hover:bg-slate-800"
142
+ }`}
143
+ >
144
+
145
+ <Users size={22} />
146
+
147
+ Customers
148
+
149
+ </button>
150
+
151
+ {/* SERVICES */}
152
+ <button
153
+ onClick={() => setActiveTab("Services")}
154
+ className={`w-full flex items-center gap-4 px-4 py-3 rounded-xl transition ${
155
+ activeTab === "Services"
156
+ ? "bg-indigo-600"
157
+ : "hover:bg-slate-800"
158
+ }`}
159
+ >
160
+
161
+ <Wrench size={22} />
162
+
163
+ Services
164
+
165
+ </button>
166
+
167
+ {/* INVOICES */}
168
+ <button
169
+ onClick={() => setActiveTab("Invoices")}
170
+ className={`w-full flex items-center gap-4 px-4 py-3 rounded-xl transition ${
171
+ activeTab === "Invoices"
172
+ ? "bg-indigo-600"
173
+ : "hover:bg-slate-800"
174
+ }`}
175
+ >
176
+
177
+ <Receipt size={22} />
178
+
179
+ Invoices
180
+
181
+ </button>
182
+
183
+ {/* REPORT */}
184
+ <button
185
+ onClick={() => setActiveTab("Report")}
186
+ className={`w-full flex items-center gap-4 px-4 py-3 rounded-xl transition ${
187
+ activeTab === "Report"
188
+ ? "bg-indigo-600"
189
+ : "hover:bg-slate-800"
190
+ }`}
191
+ >
192
+
193
+ <FileBarChart size={22} />
194
+
195
+ Reports
196
+
197
+ </button>
198
+
199
+ </nav>
200
+
201
+ {/* LOGOUT */}
202
+ <div className="p-4 border-t border-slate-700">
203
+
204
+ <button
205
+ onClick={handleLogout}
206
+ className="w-full flex items-center justify-center gap-3 bg-red-500 hover:bg-red-600 py-3 rounded-xl font-semibold transition"
207
+ >
208
+
209
+ <LogOut size={20} />
210
+
211
+ Logout
212
+
213
+ </button>
214
+
215
+ </div>
216
+
217
+ </aside>
218
+
219
+ {/* MAIN CONTENT */}
220
+ <div className="flex-1 flex flex-col">
221
+
222
+ {/* HEADER */}
223
+ <header className="bg-white shadow-md px-8 py-5 flex items-center justify-between">
224
+
225
+ <div>
226
+
227
+ <h2 className="text-3xl font-bold text-gray-800">
228
+ VSBMS Dashboard
229
+ </h2>
230
+
231
+ <p className="text-gray-500">
232
+ Welcome to Vehicle Service Billing System
233
+ </p>
234
+
235
+ </div>
236
+
237
+ {/* SEARCH + USER */}
238
+ <div className="flex items-center gap-6">
239
+
240
+ {/* SEARCH */}
241
+ <div className="flex items-center bg-gray-100 px-4 py-2 rounded-xl">
242
+
243
+ <Search
244
+ size={18}
245
+ className="text-gray-500"
246
+ />
247
+
248
+ <input
249
+ placeholder="Search..."
250
+ className="bg-transparent outline-none px-2"
251
+ />
252
+
253
+ </div>
254
+
255
+ {/* USER */}
256
+ <div className="flex items-center gap-3">
257
+
258
+ <UserCircle
259
+ size={40}
260
+ className="text-indigo-600"
261
+ />
262
+
263
+ <div>
264
+
265
+ <p className="font-semibold">
266
+ System Admin
267
+ </p>
268
+
269
+ <p className="text-sm text-gray-500">
270
+ VSBMS User
271
+ </p>
272
+
273
+ </div>
274
+
275
+ </div>
276
+
277
+ </div>
278
+
279
+ </header>
280
+
281
+ {/* MAIN */}
282
+ <main className="flex-1 p-8 overflow-y-auto bg-gray-100">
283
+
284
+ {/* DASHBOARD */}
285
+ {activeTab === "Dashboard" && (
286
+
287
+ <div>
288
+
289
+ {/* TITLE */}
290
+ <div className="mb-10">
291
+
292
+ <h1 className="text-4xl font-bold text-gray-800">
293
+ Vehicle Service Overview
294
+ </h1>
295
+
296
+ <p className="text-gray-500 mt-2 text-lg">
297
+ Vehicle Service Billing Management System
298
+ </p>
299
+
300
+ </div>
301
+
302
+ {/* CARDS */}
303
+ <div className="grid grid-cols-1 md:grid-cols-2 xl:grid-cols-3 gap-8">
304
+
305
+ {/* CUSTOMERS */}
306
+ <div className="bg-white rounded-3xl p-8 shadow-md border-l-[8px] border-blue-600">
307
+
308
+ <div className="flex items-center justify-between">
309
+
310
+ <div>
311
+
312
+ <h2 className="text-gray-500 text-lg">
313
+ Customers
314
+ </h2>
315
+
316
+ <h1 className="text-5xl font-bold text-blue-600 mt-4">
317
+ {stats.customers}
318
+ </h1>
319
+
320
+ </div>
321
+
322
+ <div className="bg-blue-100 p-5 rounded-full">
323
+
324
+ <Users
325
+ size={40}
326
+ className="text-blue-600"
327
+ />
328
+
329
+ </div>
330
+
331
+ </div>
332
+
333
+ </div>
334
+
335
+ {/* SERVICES */}
336
+ <div className="bg-white rounded-3xl p-8 shadow-md border-l-[8px] border-green-600">
337
+
338
+ <div className="flex items-center justify-between">
339
+
340
+ <div>
341
+
342
+ <h2 className="text-gray-500 text-lg">
343
+ Services
344
+ </h2>
345
+
346
+ <h1 className="text-5xl font-bold text-green-600 mt-4">
347
+ {stats.services}
348
+ </h1>
349
+
350
+ </div>
351
+
352
+ <div className="bg-green-100 p-5 rounded-full">
353
+
354
+ <Wrench
355
+ size={40}
356
+ className="text-green-600"
357
+ />
358
+
359
+ </div>
360
+
361
+ </div>
362
+
363
+ </div>
364
+
365
+ {/* INVOICES */}
366
+ <div className="bg-white rounded-3xl p-8 shadow-md border-l-[8px] border-orange-500">
367
+
368
+ <div className="flex items-center justify-between">
369
+
370
+ <div>
371
+
372
+ <h2 className="text-gray-500 text-lg">
373
+ Invoices
374
+ </h2>
375
+
376
+ <h1 className="text-5xl font-bold text-orange-500 mt-4">
377
+ {stats.invoices}
378
+ </h1>
379
+
380
+ </div>
381
+
382
+ <div className="bg-orange-100 p-5 rounded-full">
383
+
384
+ <Receipt
385
+ size={40}
386
+ className="text-orange-500"
387
+ />
388
+
389
+ </div>
390
+
391
+ </div>
392
+
393
+ </div>
394
+
395
+ </div>
396
+
397
+ {/* INFO SECTION */}
398
+ <div className="mt-12 bg-white rounded-3xl shadow-md overflow-hidden">
399
+
400
+ <div className="p-6 border-b border-gray-200">
401
+
402
+ <h2 className="text-2xl font-bold text-gray-800">
403
+ System Information
404
+ </h2>
405
+
406
+ <p className="text-gray-500 mt-1">
407
+ Vehicle Service Billing Management System
408
+ </p>
409
+
410
+ </div>
411
+
412
+ <div className="p-8 grid grid-cols-1 md:grid-cols-2 gap-8">
413
+
414
+ {/* FEATURES */}
415
+ <div className="bg-indigo-50 rounded-2xl p-6">
416
+
417
+ <h3 className="text-xl font-bold text-indigo-700 mb-4">
418
+ System Features
419
+ </h3>
420
+
421
+ <ul className="space-y-3 text-gray-700">
422
+
423
+ <li>• Customer Registration</li>
424
+
425
+ <li>• Service Management</li>
426
+
427
+ <li>• Invoice Generation</li>
428
+
429
+ <li>• Payment Tracking</li>
430
+
431
+ <li>• Reporting System</li>
432
+
433
+ </ul>
434
+
435
+ </div>
436
+
437
+ {/* STATISTICS */}
438
+ <div className="bg-green-50 rounded-2xl p-6">
439
+
440
+ <h3 className="text-xl font-bold text-green-700 mb-4">
441
+ System Statistics
442
+ </h3>
443
+
444
+ <div className="space-y-4">
445
+
446
+ <div className="flex justify-between">
447
+
448
+ <span>Total Customers</span>
449
+
450
+ <span className="font-bold text-blue-600">
451
+ {stats.customers}
452
+ </span>
453
+
454
+ </div>
455
+
456
+ <div className="flex justify-between">
457
+
458
+ <span>Total Services</span>
459
+
460
+ <span className="font-bold text-green-600">
461
+ {stats.services}
462
+ </span>
463
+
464
+ </div>
465
+
466
+ <div className="flex justify-between">
467
+
468
+ <span>Total Invoices</span>
469
+
470
+ <span className="font-bold text-orange-500">
471
+ {stats.invoices}
472
+ </span>
473
+
474
+ </div>
475
+
476
+ </div>
477
+
478
+ </div>
479
+
480
+ </div>
481
+
482
+ </div>
483
+
484
+ </div>
485
+
486
+ )}
487
+
488
+ {/* OTHER PAGES */}
489
+ {activeTab === "Customers" && <Customers />}
490
+
491
+ {activeTab === "Services" && <Services />}
492
+
493
+ {activeTab === "Invoices" && <Invoices />}
494
+
495
+ {activeTab === "Report" && <Report />}
496
+
497
+ </main>
498
+
499
+ {/* FOOTER */}
500
+ <footer className="bg-white border-t py-4 px-8 text-sm text-gray-500">
501
+
502
+ © 2026 VSBMS - Vehicle Service Billing Management System
503
+
504
+ </footer>
505
+
506
+ </div>
507
+
508
+ </div>
509
+ );
510
+ }
511
+
512
+ export default Dashboard;