atchara commited on
Commit
9f1fa8b
·
verified ·
1 Parent(s): e6d023e

Create group of master data eg employee , vendor , customer , Service which can be view add edit and has input form - Initial Deployment

Browse files
Files changed (2) hide show
  1. README.md +7 -5
  2. index.html +1183 -19
README.md CHANGED
@@ -1,10 +1,12 @@
1
  ---
2
- title: B1
3
- emoji: 🏢
4
- colorFrom: purple
5
- colorTo: gray
6
  sdk: static
7
  pinned: false
 
 
8
  ---
9
 
10
- Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
 
1
  ---
2
+ title: b1
3
+ emoji: 🐳
4
+ colorFrom: yellow
5
+ colorTo: blue
6
  sdk: static
7
  pinned: false
8
+ tags:
9
+ - deepsite
10
  ---
11
 
12
+ Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
index.html CHANGED
@@ -1,19 +1,1183 @@
1
- <!doctype html>
2
- <html>
3
- <head>
4
- <meta charset="utf-8" />
5
- <meta name="viewport" content="width=device-width" />
6
- <title>My static Space</title>
7
- <link rel="stylesheet" href="style.css" />
8
- </head>
9
- <body>
10
- <div class="card">
11
- <h1>Welcome to your static Space!</h1>
12
- <p>You can modify this app directly by editing <i>index.html</i> in the Files and versions tab.</p>
13
- <p>
14
- Also don't forget to check the
15
- <a href="https://huggingface.co/docs/hub/spaces" target="_blank">Spaces documentation</a>.
16
- </p>
17
- </div>
18
- </body>
19
- </html>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <title>Master Data Management</title>
7
+ <script src="https://cdn.tailwindcss.com"></script>
8
+ <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
9
+ <style>
10
+ .slide-in {
11
+ animation: slideIn 0.3s forwards;
12
+ }
13
+ .slide-out {
14
+ animation: slideOut 0.3s forwards;
15
+ }
16
+ @keyframes slideIn {
17
+ from { transform: translateX(100%); opacity: 0; }
18
+ to { transform: translateX(0); opacity: 1; }
19
+ }
20
+ @keyframes slideOut {
21
+ from { transform: translateX(0); opacity: 1; }
22
+ to { transform: translateX(100%); opacity: 0; }
23
+ }
24
+ .fade-in {
25
+ animation: fadeIn 0.3s forwards;
26
+ }
27
+ @keyframes fadeIn {
28
+ from { opacity: 0; }
29
+ to { opacity: 1; }
30
+ }
31
+ </style>
32
+ </head>
33
+ <body class="bg-gray-100 font-sans">
34
+ <div class="min-h-screen flex flex-col">
35
+ <!-- Header -->
36
+ <header class="bg-indigo-600 text-white shadow-lg">
37
+ <div class="container mx-auto px-4 py-4 flex justify-between items-center">
38
+ <h1 class="text-2xl font-bold">Master Data Management</h1>
39
+ <div class="flex items-center space-x-4">
40
+ <button id="theme-toggle" class="p-2 rounded-full hover:bg-indigo-500">
41
+ <i class="fas fa-moon"></i>
42
+ </button>
43
+ <div class="relative">
44
+ <button class="p-2 rounded-full hover:bg-indigo-500">
45
+ <i class="fas fa-bell"></i>
46
+ </button>
47
+ <span class="absolute top-0 right-0 h-2 w-2 rounded-full bg-red-500"></span>
48
+ </div>
49
+ </div>
50
+ </div>
51
+ </header>
52
+
53
+ <!-- Main Content -->
54
+ <main class="flex-1 container mx-auto px-4 py-6">
55
+ <div class="flex flex-col lg:flex-row gap-6">
56
+ <!-- Sidebar -->
57
+ <aside class="w-full lg:w-64 bg-white rounded-lg shadow-md p-4">
58
+ <nav>
59
+ <ul class="space-y-2">
60
+ <li>
61
+ <button data-tab="dashboard" class="tab-btn w-full text-left px-4 py-2 rounded hover:bg-indigo-50 text-indigo-600 font-medium">
62
+ <i class="fas fa-tachometer-alt mr-2"></i> Dashboard
63
+ </button>
64
+ </li>
65
+ <li>
66
+ <button data-tab="employee" class="tab-btn w-full text-left px-4 py-2 rounded hover:bg-indigo-50 font-medium">
67
+ <i class="fas fa-users mr-2"></i> Employees
68
+ </button>
69
+ </li>
70
+ <li>
71
+ <button data-tab="vendor" class="tab-btn w-full text-left px-4 py-2 rounded hover:bg-indigo-50 font-medium">
72
+ <i class="fas fa-truck mr-2"></i> Vendors
73
+ </button>
74
+ </li>
75
+ <li>
76
+ <button data-tab="customer" class="tab-btn w-full text-left px-4 py-2 rounded hover:bg-indigo-50 font-medium">
77
+ <i class="fas fa-user-tie mr-2"></i> Customers
78
+ </button>
79
+ </li>
80
+ <li>
81
+ <button data-tab="service" class="tab-btn w-full text-left px-4 py-2 rounded hover:bg-indigo-50 font-medium">
82
+ <i class="fas fa-cogs mr-2"></i> Services
83
+ </button>
84
+ </li>
85
+ </ul>
86
+ </nav>
87
+ </aside>
88
+
89
+ <!-- Content Area -->
90
+ <div class="flex-1">
91
+ <!-- Dashboard (Default View) -->
92
+ <div id="dashboard" class="tab-content bg-white rounded-lg shadow-md p-6">
93
+ <div class="flex justify-between items-center mb-6">
94
+ <h2 class="text-xl font-bold text-gray-800">Dashboard Overview</h2>
95
+ <div class="flex space-x-2">
96
+ <button class="px-3 py-1 bg-indigo-100 text-indigo-600 rounded-md text-sm">Today</button>
97
+ <button class="px-3 py-1 bg-gray-100 text-gray-600 rounded-md text-sm">Week</button>
98
+ <button class="px-3 py-1 bg-gray-100 text-gray-600 rounded-md text-sm">Month</button>
99
+ </div>
100
+ </div>
101
+
102
+ <div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-4 mb-6">
103
+ <div class="bg-indigo-50 p-4 rounded-lg">
104
+ <div class="flex justify-between items-center">
105
+ <div>
106
+ <p class="text-sm text-indigo-600">Employees</p>
107
+ <h3 class="text-2xl font-bold">124</h3>
108
+ </div>
109
+ <div class="p-3 bg-indigo-100 rounded-full">
110
+ <i class="fas fa-users text-indigo-600"></i>
111
+ </div>
112
+ </div>
113
+ <p class="text-xs text-green-600 mt-2"><i class="fas fa-arrow-up mr-1"></i> 12% from last month</p>
114
+ </div>
115
+
116
+ <div class="bg-blue-50 p-4 rounded-lg">
117
+ <div class="flex justify-between items-center">
118
+ <div>
119
+ <p class="text-sm text-blue-600">Vendors</p>
120
+ <h3 class="text-2xl font-bold">42</h3>
121
+ </div>
122
+ <div class="p-3 bg-blue-100 rounded-full">
123
+ <i class="fas fa-truck text-blue-600"></i>
124
+ </div>
125
+ </div>
126
+ <p class="text-xs text-green-600 mt-2"><i class="fas fa-arrow-up mr-1"></i> 5% from last month</p>
127
+ </div>
128
+
129
+ <div class="bg-purple-50 p-4 rounded-lg">
130
+ <div class="flex justify-between items-center">
131
+ <div>
132
+ <p class="text-sm text-purple-600">Customers</p>
133
+ <h3 class="text-2xl font-bold">356</h3>
134
+ </div>
135
+ <div class="p-3 bg-purple-100 rounded-full">
136
+ <i class="fas fa-user-tie text-purple-600"></i>
137
+ </div>
138
+ </div>
139
+ <p class="text-xs text-green-600 mt-2"><i class="fas fa-arrow-up mr-1"></i> 23% from last month</p>
140
+ </div>
141
+
142
+ <div class="bg-green-50 p-4 rounded-lg">
143
+ <div class="flex justify-between items-center">
144
+ <div>
145
+ <p class="text-sm text-green-600">Services</p>
146
+ <h3 class="text-2xl font-bold">18</h3>
147
+ </div>
148
+ <div class="p-3 bg-green-100 rounded-full">
149
+ <i class="fas fa-cogs text-green-600"></i>
150
+ </div>
151
+ </div>
152
+ <p class="text-xs text-red-600 mt-2"><i class="fas fa-arrow-down mr-1"></i> 2% from last month</p>
153
+ </div>
154
+ </div>
155
+
156
+ <div class="bg-white border border-gray-200 rounded-lg p-4 mb-6">
157
+ <h3 class="font-medium mb-3">Recent Activities</h3>
158
+ <div class="space-y-3">
159
+ <div class="flex items-start">
160
+ <div class="p-2 bg-indigo-100 rounded-full mr-3">
161
+ <i class="fas fa-user-plus text-indigo-600 text-sm"></i>
162
+ </div>
163
+ <div>
164
+ <p class="text-sm">New employee <span class="font-medium">John Doe</span> added</p>
165
+ <p class="text-xs text-gray-500">2 hours ago</p>
166
+ </div>
167
+ </div>
168
+ <div class="flex items-start">
169
+ <div class="p-2 bg-blue-100 rounded-full mr-3">
170
+ <i class="fas fa-edit text-blue-600 text-sm"></i>
171
+ </div>
172
+ <div>
173
+ <p class="text-sm">Vendor <span class="font-medium">Tech Solutions</span> updated</p>
174
+ <p class="text-xs text-gray-500">5 hours ago</p>
175
+ </div>
176
+ </div>
177
+ <div class="flex items-start">
178
+ <div class="p-2 bg-purple-100 rounded-full mr-3">
179
+ <i class="fas fa-user-tie text-purple-600 text-sm"></i>
180
+ </div>
181
+ <div>
182
+ <p class="text-sm">New customer <span class="font-medium">ABC Corp</span> registered</p>
183
+ <p class="text-xs text-gray-500">1 day ago</p>
184
+ </div>
185
+ </div>
186
+ </div>
187
+ </div>
188
+ </div>
189
+
190
+ <!-- Employee Management -->
191
+ <div id="employee" class="tab-content hidden bg-white rounded-lg shadow-md p-6">
192
+ <div class="flex justify-between items-center mb-6">
193
+ <h2 class="text-xl font-bold text-gray-800">Employee Management</h2>
194
+ <button id="add-employee-btn" class="px-4 py-2 bg-indigo-600 text-white rounded-md hover:bg-indigo-700 flex items-center">
195
+ <i class="fas fa-plus mr-2"></i> Add Employee
196
+ </button>
197
+ </div>
198
+
199
+ <div class="overflow-x-auto">
200
+ <table class="min-w-full divide-y divide-gray-200">
201
+ <thead class="bg-gray-50">
202
+ <tr>
203
+ <th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">ID</th>
204
+ <th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Name</th>
205
+ <th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Position</th>
206
+ <th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Department</th>
207
+ <th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Status</th>
208
+ <th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Actions</th>
209
+ </tr>
210
+ </thead>
211
+ <tbody class="bg-white divide-y divide-gray-200" id="employee-table-body">
212
+ <!-- Employee data will be inserted here by JavaScript -->
213
+ </tbody>
214
+ </table>
215
+ </div>
216
+ </div>
217
+
218
+ <!-- Vendor Management -->
219
+ <div id="vendor" class="tab-content hidden bg-white rounded-lg shadow-md p-6">
220
+ <div class="flex justify-between items-center mb-6">
221
+ <h2 class="text-xl font-bold text-gray-800">Vendor Management</h2>
222
+ <button id="add-vendor-btn" class="px-4 py-2 bg-indigo-600 text-white rounded-md hover:bg-indigo-700 flex items-center">
223
+ <i class="fas fa-plus mr-2"></i> Add Vendor
224
+ </button>
225
+ </div>
226
+
227
+ <div class="overflow-x-auto">
228
+ <table class="min-w-full divide-y divide-gray-200">
229
+ <thead class="bg-gray-50">
230
+ <tr>
231
+ <th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">ID</th>
232
+ <th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Name</th>
233
+ <th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Contact</th>
234
+ <th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Products</th>
235
+ <th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Rating</th>
236
+ <th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Actions</th>
237
+ </tr>
238
+ </thead>
239
+ <tbody class="bg-white divide-y divide-gray-200" id="vendor-table-body">
240
+ <!-- Vendor data will be inserted here by JavaScript -->
241
+ </tbody>
242
+ </table>
243
+ </div>
244
+ </div>
245
+
246
+ <!-- Customer Management -->
247
+ <div id="customer" class="tab-content hidden bg-white rounded-lg shadow-md p-6">
248
+ <div class="flex justify-between items-center mb-6">
249
+ <h2 class="text-xl font-bold text-gray-800">Customer Management</h2>
250
+ <button id="add-customer-btn" class="px-4 py-2 bg-indigo-600 text-white rounded-md hover:bg-indigo-700 flex items-center">
251
+ <i class="fas fa-plus mr-2"></i> Add Customer
252
+ </button>
253
+ </div>
254
+
255
+ <div class="overflow-x-auto">
256
+ <table class="min-w-full divide-y divide-gray-200">
257
+ <thead class="bg-gray-50">
258
+ <tr>
259
+ <th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">ID</th>
260
+ <th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Name</th>
261
+ <th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Company</th>
262
+ <th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Email</th>
263
+ <th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Value</th>
264
+ <th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Actions</th>
265
+ </tr>
266
+ </thead>
267
+ <tbody class="bg-white divide-y divide-gray-200" id="customer-table-body">
268
+ <!-- Customer data will be inserted here by JavaScript -->
269
+ </tbody>
270
+ </table>
271
+ </div>
272
+ </div>
273
+
274
+ <!-- Service Management -->
275
+ <div id="service" class="tab-content hidden bg-white rounded-lg shadow-md p-6">
276
+ <div class="flex justify-between items-center mb-6">
277
+ <h2 class="text-xl font-bold text-gray-800">Service Management</h2>
278
+ <button id="add-service-btn" class="px-4 py-2 bg-indigo-600 text-white rounded-md hover:bg-indigo-700 flex items-center">
279
+ <i class="fas fa-plus mr-2"></i> Add Service
280
+ </button>
281
+ </div>
282
+
283
+ <div class="overflow-x-auto">
284
+ <table class="min-w-full divide-y divide-gray-200">
285
+ <thead class="bg-gray-50">
286
+ <tr>
287
+ <th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">ID</th>
288
+ <th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Name</th>
289
+ <th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Category</th>
290
+ <th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Price</th>
291
+ <th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Duration</th>
292
+ <th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Actions</th>
293
+ </tr>
294
+ </thead>
295
+ <tbody class="bg-white divide-y divide-gray-200" id="service-table-body">
296
+ <!-- Service data will be inserted here by JavaScript -->
297
+ </tbody>
298
+ </table>
299
+ </div>
300
+ </div>
301
+ </div>
302
+ </div>
303
+ </main>
304
+
305
+ <!-- Form Modal (Hidden by default) -->
306
+ <div id="form-modal" class="fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50 hidden">
307
+ <div class="bg-white rounded-lg shadow-xl w-full max-w-2xl max-h-screen overflow-y-auto slide-in">
308
+ <div class="p-6">
309
+ <div class="flex justify-between items-center mb-4">
310
+ <h3 id="form-title" class="text-xl font-bold text-gray-800">Add New Record</h3>
311
+ <button id="close-modal" class="text-gray-500 hover:text-gray-700">
312
+ <i class="fas fa-times"></i>
313
+ </button>
314
+ </div>
315
+
316
+ <form id="data-form" class="space-y-4">
317
+ <input type="hidden" id="record-id">
318
+ <input type="hidden" id="record-type">
319
+
320
+ <!-- Employee Form Fields -->
321
+ <div id="employee-fields" class="hidden">
322
+ <div class="grid grid-cols-1 md:grid-cols-2 gap-4">
323
+ <div>
324
+ <label for="emp-name" class="block text-sm font-medium text-gray-700">Full Name</label>
325
+ <input type="text" id="emp-name" name="emp-name" class="mt-1 block w-full border border-gray-300 rounded-md shadow-sm py-2 px-3 focus:outline-none focus:ring-indigo-500 focus:border-indigo-500">
326
+ </div>
327
+ <div>
328
+ <label for="emp-email" class="block text-sm font-medium text-gray-700">Email</label>
329
+ <input type="email" id="emp-email" name="emp-email" class="mt-1 block w-full border border-gray-300 rounded-md shadow-sm py-2 px-3 focus:outline-none focus:ring-indigo-500 focus:border-indigo-500">
330
+ </div>
331
+ </div>
332
+ <div class="grid grid-cols-1 md:grid-cols-2 gap-4">
333
+ <div>
334
+ <label for="emp-phone" class="block text-sm font-medium text-gray-700">Phone</label>
335
+ <input type="tel" id="emp-phone" name="emp-phone" class="mt-1 block w-full border border-gray-300 rounded-md shadow-sm py-2 px-3 focus:outline-none focus:ring-indigo-500 focus:border-indigo-500">
336
+ </div>
337
+ <div>
338
+ <label for="emp-position" class="block text-sm font-medium text-gray-700">Position</label>
339
+ <input type="text" id="emp-position" name="emp-position" class="mt-1 block w-full border border-gray-300 rounded-md shadow-sm py-2 px-3 focus:outline-none focus:ring-indigo-500 focus:border-indigo-500">
340
+ </div>
341
+ </div>
342
+ <div class="grid grid-cols-1 md:grid-cols-2 gap-4">
343
+ <div>
344
+ <label for="emp-department" class="block text-sm font-medium text-gray-700">Department</label>
345
+ <select id="emp-department" name="emp-department" class="mt-1 block w-full border border-gray-300 rounded-md shadow-sm py-2 px-3 focus:outline-none focus:ring-indigo-500 focus:border-indigo-500">
346
+ <option value="">Select Department</option>
347
+ <option value="IT">IT</option>
348
+ <option value="HR">HR</option>
349
+ <option value="Finance">Finance</option>
350
+ <option value="Marketing">Marketing</option>
351
+ <option value="Operations">Operations</option>
352
+ </select>
353
+ </div>
354
+ <div>
355
+ <label for="emp-status" class="block text-sm font-medium text-gray-700">Status</label>
356
+ <select id="emp-status" name="emp-status" class="mt-1 block w-full border border-gray-300 rounded-md shadow-sm py-2 px-3 focus:outline-none focus:ring-indigo-500 focus:border-indigo-500">
357
+ <option value="Active">Active</option>
358
+ <option value="Inactive">Inactive</option>
359
+ <option value="On Leave">On Leave</option>
360
+ </select>
361
+ </div>
362
+ </div>
363
+ <div>
364
+ <label for="emp-address" class="block text-sm font-medium text-gray-700">Address</label>
365
+ <textarea id="emp-address" name="emp-address" rows="3" class="mt-1 block w-full border border-gray-300 rounded-md shadow-sm py-2 px-3 focus:outline-none focus:ring-indigo-500 focus:border-indigo-500"></textarea>
366
+ </div>
367
+ </div>
368
+
369
+ <!-- Vendor Form Fields -->
370
+ <div id="vendor-fields" class="hidden">
371
+ <div class="grid grid-cols-1 md:grid-cols-2 gap-4">
372
+ <div>
373
+ <label for="vendor-name" class="block text-sm font-medium text-gray-700">Vendor Name</label>
374
+ <input type="text" id="vendor-name" name="vendor-name" class="mt-1 block w-full border border-gray-300 rounded-md shadow-sm py-2 px-3 focus:outline-none focus:ring-indigo-500 focus:border-indigo-500">
375
+ </div>
376
+ <div>
377
+ <label for="vendor-contact" class="block text-sm font-medium text-gray-700">Contact Person</label>
378
+ <input type="text" id="vendor-contact" name="vendor-contact" class="mt-1 block w-full border border-gray-300 rounded-md shadow-sm py-2 px-3 focus:outline-none focus:ring-indigo-500 focus:border-indigo-500">
379
+ </div>
380
+ </div>
381
+ <div class="grid grid-cols-1 md:grid-cols-2 gap-4">
382
+ <div>
383
+ <label for="vendor-email" class="block text-sm font-medium text-gray-700">Email</label>
384
+ <input type="email" id="vendor-email" name="vendor-email" class="mt-1 block w-full border border-gray-300 rounded-md shadow-sm py-2 px-3 focus:outline-none focus:ring-indigo-500 focus:border-indigo-500">
385
+ </div>
386
+ <div>
387
+ <label for="vendor-phone" class="block text-sm font-medium text-gray-700">Phone</label>
388
+ <input type="tel" id="vendor-phone" name="vendor-phone" class="mt-1 block w-full border border-gray-300 rounded-md shadow-sm py-2 px-3 focus:outline-none focus:ring-indigo-500 focus:border-indigo-500">
389
+ </div>
390
+ </div>
391
+ <div>
392
+ <label for="vendor-products" class="block text-sm font-medium text-gray-700">Products/Services</label>
393
+ <textarea id="vendor-products" name="vendor-products" rows="3" class="mt-1 block w-full border border-gray-300 rounded-md shadow-sm py-2 px-3 focus:outline-none focus:ring-indigo-500 focus:border-indigo-500"></textarea>
394
+ </div>
395
+ <div class="grid grid-cols-1 md:grid-cols-2 gap-4">
396
+ <div>
397
+ <label for="vendor-rating" class="block text-sm font-medium text-gray-700">Rating (1-5)</label>
398
+ <select id="vendor-rating" name="vendor-rating" class="mt-1 block w-full border border-gray-300 rounded-md shadow-sm py-2 px-3 focus:outline-none focus:ring-indigo-500 focus:border-indigo-500">
399
+ <option value="1">1 - Poor</option>
400
+ <option value="2">2 - Fair</option>
401
+ <option value="3">3 - Good</option>
402
+ <option value="4">4 - Very Good</option>
403
+ <option value="5">5 - Excellent</option>
404
+ </select>
405
+ </div>
406
+ <div>
407
+ <label for="vendor-status" class="block text-sm font-medium text-gray-700">Status</label>
408
+ <select id="vendor-status" name="vendor-status" class="mt-1 block w-full border border-gray-300 rounded-md shadow-sm py-2 px-3 focus:outline-none focus:ring-indigo-500 focus:border-indigo-500">
409
+ <option value="Active">Active</option>
410
+ <option value="Inactive">Inactive</option>
411
+ <option value="On Hold">On Hold</option>
412
+ </select>
413
+ </div>
414
+ </div>
415
+ </div>
416
+
417
+ <!-- Customer Form Fields -->
418
+ <div id="customer-fields" class="hidden">
419
+ <div class="grid grid-cols-1 md:grid-cols-2 gap-4">
420
+ <div>
421
+ <label for="customer-name" class="block text-sm font-medium text-gray-700">Customer Name</label>
422
+ <input type="text" id="customer-name" name="customer-name" class="mt-1 block w-full border border-gray-300 rounded-md shadow-sm py-2 px-3 focus:outline-none focus:ring-indigo-500 focus:border-indigo-500">
423
+ </div>
424
+ <div>
425
+ <label for="customer-company" class="block text-sm font-medium text-gray-700">Company</label>
426
+ <input type="text" id="customer-company" name="customer-company" class="mt-1 block w-full border border-gray-300 rounded-md shadow-sm py-2 px-3 focus:outline-none focus:ring-indigo-500 focus:border-indigo-500">
427
+ </div>
428
+ </div>
429
+ <div class="grid grid-cols-1 md:grid-cols-2 gap-4">
430
+ <div>
431
+ <label for="customer-email" class="block text-sm font-medium text-gray-700">Email</label>
432
+ <input type="email" id="customer-email" name="customer-email" class="mt-1 block w-full border border-gray-300 rounded-md shadow-sm py-2 px-3 focus:outline-none focus:ring-indigo-500 focus:border-indigo-500">
433
+ </div>
434
+ <div>
435
+ <label for="customer-phone" class="block text-sm font-medium text-gray-700">Phone</label>
436
+ <input type="tel" id="customer-phone" name="customer-phone" class="mt-1 block w-full border border-gray-300 rounded-md shadow-sm py-2 px-3 focus:outline-none focus:ring-indigo-500 focus:border-indigo-500">
437
+ </div>
438
+ </div>
439
+ <div class="grid grid-cols-1 md:grid-cols-2 gap-4">
440
+ <div>
441
+ <label for="customer-value" class="block text-sm font-medium text-gray-700">Customer Value</label>
442
+ <select id="customer-value" name="customer-value" class="mt-1 block w-full border border-gray-300 rounded-md shadow-sm py-2 px-3 focus:outline-none focus:ring-indigo-500 focus:border-indigo-500">
443
+ <option value="High">High</option>
444
+ <option value="Medium">Medium</option>
445
+ <option value="Low">Low</option>
446
+ </select>
447
+ </div>
448
+ <div>
449
+ <label for="customer-status" class="block text-sm font-medium text-gray-700">Status</label>
450
+ <select id="customer-status" name="customer-status" class="mt-1 block w-full border border-gray-300 rounded-md shadow-sm py-2 px-3 focus:outline-none focus:ring-indigo-500 focus:border-indigo-500">
451
+ <option value="Active">Active</option>
452
+ <option value="Inactive">Inactive</option>
453
+ <option value="Prospect">Prospect</option>
454
+ </select>
455
+ </div>
456
+ </div>
457
+ <div>
458
+ <label for="customer-notes" class="block text-sm font-medium text-gray-700">Notes</label>
459
+ <textarea id="customer-notes" name="customer-notes" rows="3" class="mt-1 block w-full border border-gray-300 rounded-md shadow-sm py-2 px-3 focus:outline-none focus:ring-indigo-500 focus:border-indigo-500"></textarea>
460
+ </div>
461
+ </div>
462
+
463
+ <!-- Service Form Fields -->
464
+ <div id="service-fields" class="hidden">
465
+ <div class="grid grid-cols-1 md:grid-cols-2 gap-4">
466
+ <div>
467
+ <label for="service-name" class="block text-sm font-medium text-gray-700">Service Name</label>
468
+ <input type="text" id="service-name" name="service-name" class="mt-1 block w-full border border-gray-300 rounded-md shadow-sm py-2 px-3 focus:outline-none focus:ring-indigo-500 focus:border-indigo-500">
469
+ </div>
470
+ <div>
471
+ <label for="service-category" class="block text-sm font-medium text-gray-700">Category</label>
472
+ <select id="service-category" name="service-category" class="mt-1 block w-full border border-gray-300 rounded-md shadow-sm py-2 px-3 focus:outline-none focus:ring-indigo-500 focus:border-indigo-500">
473
+ <option value="">Select Category</option>
474
+ <option value="IT">IT Services</option>
475
+ <option value="Consulting">Consulting</option>
476
+ <option value="Maintenance">Maintenance</option>
477
+ <option value="Training">Training</option>
478
+ <option value="Support">Support</option>
479
+ </select>
480
+ </div>
481
+ </div>
482
+ <div class="grid grid-cols-1 md:grid-cols-2 gap-4">
483
+ <div>
484
+ <label for="service-price" class="block text-sm font-medium text-gray-700">Price ($)</label>
485
+ <input type="number" id="service-price" name="service-price" class="mt-1 block w-full border border-gray-300 rounded-md shadow-sm py-2 px-3 focus:outline-none focus:ring-indigo-500 focus:border-indigo-500">
486
+ </div>
487
+ <div>
488
+ <label for="service-duration" class="block text-sm font-medium text-gray-700">Duration</label>
489
+ <input type="text" id="service-duration" name="service-duration" class="mt-1 block w-full border border-gray-300 rounded-md shadow-sm py-2 px-3 focus:outline-none focus:ring-indigo-500 focus:border-indigo-500" placeholder="e.g. 2 hours, 1 day">
490
+ </div>
491
+ </div>
492
+ <div>
493
+ <label for="service-description" class="block text-sm font-medium text-gray-700">Description</label>
494
+ <textarea id="service-description" name="service-description" rows="3" class="mt-1 block w-full border border-gray-300 rounded-md shadow-sm py-2 px-3 focus:outline-none focus:ring-indigo-500 focus:border-indigo-500"></textarea>
495
+ </div>
496
+ <div class="grid grid-cols-1 md:grid-cols-2 gap-4">
497
+ <div>
498
+ <label for="service-status" class="block text-sm font-medium text-gray-700">Status</label>
499
+ <select id="service-status" name="service-status" class="mt-1 block w-full border border-gray-300 rounded-md shadow-sm py-2 px-3 focus:outline-none focus:ring-indigo-500 focus:border-indigo-500">
500
+ <option value="Active">Active</option>
501
+ <option value="Inactive">Inactive</option>
502
+ <option value="Seasonal">Seasonal</option>
503
+ </select>
504
+ </div>
505
+ <div>
506
+ <label for="service-popularity" class="block text-sm font-medium text-gray-700">Popularity</label>
507
+ <select id="service-popularity" name="service-popularity" class="mt-1 block w-full border border-gray-300 rounded-md shadow-sm py-2 px-3 focus:outline-none focus:ring-indigo-500 focus:border-indigo-500">
508
+ <option value="High">High</option>
509
+ <option value="Medium">Medium</option>
510
+ <option value="Low">Low</option>
511
+ </select>
512
+ </div>
513
+ </div>
514
+ </div>
515
+
516
+ <div class="flex justify-end space-x-3 pt-4">
517
+ <button type="button" id="cancel-form" class="px-4 py-2 border border-gray-300 rounded-md text-sm font-medium text-gray-700 hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500">
518
+ Cancel
519
+ </button>
520
+ <button type="submit" class="px-4 py-2 border border-transparent rounded-md shadow-sm text-sm font-medium text-white bg-indigo-600 hover:bg-indigo-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500">
521
+ Save
522
+ </button>
523
+ </div>
524
+ </form>
525
+ </div>
526
+ </div>
527
+ </div>
528
+
529
+ <!-- Confirmation Modal -->
530
+ <div id="confirm-modal" class="fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50 hidden">
531
+ <div class="bg-white rounded-lg shadow-xl w-full max-w-md p-6 fade-in">
532
+ <div class="flex justify-between items-center mb-4">
533
+ <h3 class="text-lg font-bold text-gray-800">Confirm Action</h3>
534
+ <button id="close-confirm-modal" class="text-gray-500 hover:text-gray-700">
535
+ <i class="fas fa-times"></i>
536
+ </button>
537
+ </div>
538
+ <p id="confirm-message" class="mb-6">Are you sure you want to delete this record?</p>
539
+ <div class="flex justify-end space-x-3">
540
+ <button type="button" id="cancel-confirm" class="px-4 py-2 border border-gray-300 rounded-md text-sm font-medium text-gray-700 hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500">
541
+ Cancel
542
+ </button>
543
+ <button type="button" id="confirm-action" class="px-4 py-2 border border-transparent rounded-md shadow-sm text-sm font-medium text-white bg-red-600 hover:bg-red-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-red-500">
544
+ Confirm
545
+ </button>
546
+ </div>
547
+ </div>
548
+ </div>
549
+ </div>
550
+
551
+ <script>
552
+ // Sample data for demonstration
553
+ const sampleData = {
554
+ employees: [
555
+ { id: 'EMP001', name: 'John Doe', email: 'john@example.com', position: 'Developer', department: 'IT', status: 'Active' },
556
+ { id: 'EMP002', name: 'Jane Smith', email: 'jane@example.com', position: 'HR Manager', department: 'HR', status: 'Active' },
557
+ { id: 'EMP003', name: 'Mike Johnson', email: 'mike@example.com', position: 'Accountant', department: 'Finance', status: 'Active' },
558
+ { id: 'EMP004', name: 'Sarah Williams', email: 'sarah@example.com', position: 'Marketing Specialist', department: 'Marketing', status: 'Inactive' },
559
+ { id: 'EMP005', name: 'David Brown', email: 'david@example.com', position: 'Operations Manager', department: 'Operations', status: 'Active' }
560
+ ],
561
+ vendors: [
562
+ { id: 'VDR001', name: 'Tech Solutions', contact: 'Robert Taylor', email: 'robert@techsolutions.com', products: 'Software, Hardware', rating: '4', status: 'Active' },
563
+ { id: 'VDR002', name: 'Office Supplies Co', contact: 'Lisa Green', email: 'lisa@officesupplies.com', products: 'Office furniture, stationery', rating: '3', status: 'Active' },
564
+ { id: 'VDR003', name: 'Cloud Services Inc', contact: 'Mark Wilson', email: 'mark@cloudservices.com', products: 'Cloud hosting, Storage', rating: '5', status: 'Active' },
565
+ { id: 'VDR004', name: 'Marketing Pros', contact: 'Emily Davis', email: 'emily@marketingpros.com', products: 'Digital marketing services', rating: '4', status: 'On Hold' }
566
+ ],
567
+ customers: [
568
+ { id: 'CST001', name: 'Alex Johnson', company: 'ABC Corp', email: 'alex@abccorp.com', value: 'High', status: 'Active' },
569
+ { id: 'CST002', name: 'Maria Garcia', company: 'XYZ Ltd', email: 'maria@xyzltd.com', value: 'Medium', status: 'Active' },
570
+ { id: 'CST003', name: 'James Wilson', company: 'Global Enterprises', email: 'james@global.com', value: 'High', status: 'Active' },
571
+ { id: 'CST004', name: 'Sophia Lee', company: 'Tech Innovations', email: 'sophia@techinnov.com', value: 'Medium', status: 'Prospect' },
572
+ { id: 'CST005', name: 'Daniel Kim', company: 'Sunrise Solutions', email: 'daniel@sunrise.com', value: 'Low', status: 'Inactive' }
573
+ ],
574
+ services: [
575
+ { id: 'SRV001', name: 'Website Development', category: 'IT', price: '2500', duration: '4 weeks', status: 'Active', popularity: 'High' },
576
+ { id: 'SRV002', name: 'IT Consulting', category: 'Consulting', price: '150', duration: '1 hour', status: 'Active', popularity: 'Medium' },
577
+ { id: 'SRV003', name: 'Server Maintenance', category: 'Maintenance', price: '500', duration: 'Monthly', status: 'Active', popularity: 'High' },
578
+ { id: 'SRV004', name: 'Employee Training', category: 'Training', price: '1200', duration: '2 days', status: 'Active', popularity: 'Medium' },
579
+ { id: 'SRV005', name: '24/7 Support', category: 'Support', price: '200', duration: 'Per incident', status: 'Active', popularity: 'High' }
580
+ ]
581
+ };
582
+
583
+ // DOM Elements
584
+ const tabBtns = document.querySelectorAll('.tab-btn');
585
+ const tabContents = document.querySelectorAll('.tab-content');
586
+ const formModal = document.getElementById('form-modal');
587
+ const confirmModal = document.getElementById('confirm-modal');
588
+ const formTitle = document.getElementById('form-title');
589
+ const dataForm = document.getElementById('data-form');
590
+ const recordIdInput = document.getElementById('record-id');
591
+ const recordTypeInput = document.getElementById('record-type');
592
+ const employeeFields = document.getElementById('employee-fields');
593
+ const vendorFields = document.getElementById('vendor-fields');
594
+ const customerFields = document.getElementById('customer-fields');
595
+ const serviceFields = document.getElementById('service-fields');
596
+ const confirmMessage = document.getElementById('confirm-message');
597
+ const themeToggle = document.getElementById('theme-toggle');
598
+
599
+ // Current state
600
+ let currentAction = '';
601
+ let currentRecordId = '';
602
+ let currentRecordType = '';
603
+
604
+ // Initialize the application
605
+ function init() {
606
+ // Load sample data
607
+ renderEmployeeTable();
608
+ renderVendorTable();
609
+ renderCustomerTable();
610
+ renderServiceTable();
611
+
612
+ // Set up event listeners
613
+ setupEventListeners();
614
+ }
615
+
616
+ // Set up event listeners
617
+ function setupEventListeners() {
618
+ // Tab navigation
619
+ tabBtns.forEach(btn => {
620
+ btn.addEventListener('click', () => {
621
+ const tabId = btn.getAttribute('data-tab');
622
+ showTab(tabId);
623
+
624
+ // Update active tab style
625
+ tabBtns.forEach(b => b.classList.remove('text-indigo-600'));
626
+ btn.classList.add('text-indigo-600');
627
+ });
628
+ });
629
+
630
+ // Add buttons
631
+ document.getElementById('add-employee-btn').addEventListener('click', () => showForm('employee', 'add'));
632
+ document.getElementById('add-vendor-btn').addEventListener('click', () => showForm('vendor', 'add'));
633
+ document.getElementById('add-customer-btn').addEventListener('click', () => showForm('customer', 'add'));
634
+ document.getElementById('add-service-btn').addEventListener('click', () => showForm('service', 'add'));
635
+
636
+ // Form modal
637
+ document.getElementById('close-modal').addEventListener('click', closeForm);
638
+ document.getElementById('cancel-form').addEventListener('click', closeForm);
639
+ dataForm.addEventListener('submit', handleFormSubmit);
640
+
641
+ // Confirm modal
642
+ document.getElementById('close-confirm-modal').addEventListener('click', closeConfirmModal);
643
+ document.getElementById('cancel-confirm').addEventListener('click', closeConfirmModal);
644
+ document.getElementById('confirm-action').addEventListener('click', handleConfirmAction);
645
+
646
+ // Theme toggle
647
+ themeToggle.addEventListener('click', toggleTheme);
648
+ }
649
+
650
+ // Show tab content
651
+ function showTab(tabId) {
652
+ tabContents.forEach(content => {
653
+ if (content.id === tabId) {
654
+ content.classList.remove('hidden');
655
+ } else {
656
+ content.classList.add('hidden');
657
+ }
658
+ });
659
+ }
660
+
661
+ // Show form modal
662
+ function showForm(type, action, id = '') {
663
+ currentAction = action;
664
+ currentRecordType = type;
665
+ currentRecordId = id;
666
+
667
+ // Set form title
668
+ formTitle.textContent = `${action === 'add' ? 'Add New' : 'Edit'} ${capitalizeFirstLetter(type)}`;
669
+
670
+ // Hide all form fields first
671
+ employeeFields.classList.add('hidden');
672
+ vendorFields.classList.add('hidden');
673
+ customerFields.classList.add('hidden');
674
+ serviceFields.classList.add('hidden');
675
+
676
+ // Show the correct form fields
677
+ switch (type) {
678
+ case 'employee':
679
+ employeeFields.classList.remove('hidden');
680
+ if (action === 'edit') {
681
+ const employee = sampleData.employees.find(emp => emp.id === id);
682
+ if (employee) {
683
+ document.getElementById('emp-name').value = employee.name;
684
+ document.getElementById('emp-email').value = employee.email;
685
+ document.getElementById('emp-phone').value = employee.phone || '';
686
+ document.getElementById('emp-position').value = employee.position;
687
+ document.getElementById('emp-department').value = employee.department;
688
+ document.getElementById('emp-status').value = employee.status;
689
+ document.getElementById('emp-address').value = employee.address || '';
690
+ }
691
+ } else {
692
+ // Reset form for new employee
693
+ dataForm.reset();
694
+ }
695
+ break;
696
+ case 'vendor':
697
+ vendorFields.classList.remove('hidden');
698
+ if (action === 'edit') {
699
+ const vendor = sampleData.vendors.find(v => v.id === id);
700
+ if (vendor) {
701
+ document.getElementById('vendor-name').value = vendor.name;
702
+ document.getElementById('vendor-contact').value = vendor.contact;
703
+ document.getElementById('vendor-email').value = vendor.email;
704
+ document.getElementById('vendor-phone').value = vendor.phone || '';
705
+ document.getElementById('vendor-products').value = vendor.products;
706
+ document.getElementById('vendor-rating').value = vendor.rating;
707
+ document.getElementById('vendor-status').value = vendor.status;
708
+ }
709
+ } else {
710
+ // Reset form for new vendor
711
+ dataForm.reset();
712
+ }
713
+ break;
714
+ case 'customer':
715
+ customerFields.classList.remove('hidden');
716
+ if (action === 'edit') {
717
+ const customer = sampleData.customers.find(c => c.id === id);
718
+ if (customer) {
719
+ document.getElementById('customer-name').value = customer.name;
720
+ document.getElementById('customer-company').value = customer.company;
721
+ document.getElementById('customer-email').value = customer.email;
722
+ document.getElementById('customer-phone').value = customer.phone || '';
723
+ document.getElementById('customer-value').value = customer.value;
724
+ document.getElementById('customer-status').value = customer.status;
725
+ document.getElementById('customer-notes').value = customer.notes || '';
726
+ }
727
+ } else {
728
+ // Reset form for new customer
729
+ dataForm.reset();
730
+ }
731
+ break;
732
+ case 'service':
733
+ serviceFields.classList.remove('hidden');
734
+ if (action === 'edit') {
735
+ const service = sampleData.services.find(s => s.id === id);
736
+ if (service) {
737
+ document.getElementById('service-name').value = service.name;
738
+ document.getElementById('service-category').value = service.category;
739
+ document.getElementById('service-price').value = service.price;
740
+ document.getElementById('service-duration').value = service.duration;
741
+ document.getElementById('service-description').value = service.description || '';
742
+ document.getElementById('service-status').value = service.status;
743
+ document.getElementById('service-popularity').value = service.popularity;
744
+ }
745
+ } else {
746
+ // Reset form for new service
747
+ dataForm.reset();
748
+ }
749
+ break;
750
+ }
751
+
752
+ // Set record ID and type
753
+ recordIdInput.value = id;
754
+ recordTypeInput.value = type;
755
+
756
+ // Show modal
757
+ formModal.classList.remove('hidden');
758
+ }
759
+
760
+ // Close form modal
761
+ function closeForm() {
762
+ formModal.classList.add('hidden');
763
+ setTimeout(() => {
764
+ formModal.classList.remove('slide-in');
765
+ formModal.classList.add('slide-out');
766
+ }, 0);
767
+ setTimeout(() => {
768
+ formModal.classList.remove('slide-out');
769
+ formModal.classList.add('slide-in');
770
+ }, 300);
771
+ }
772
+
773
+ // Handle form submission
774
+ function handleFormSubmit(e) {
775
+ e.preventDefault();
776
+
777
+ const type = recordTypeInput.value;
778
+ const action = currentAction;
779
+ const id = recordIdInput.value;
780
+
781
+ if (action === 'add') {
782
+ // Create new record
783
+ const newId = generateId(type);
784
+ const newRecord = getFormData(type, newId);
785
+
786
+ sampleData[`${type}s`].push(newRecord);
787
+ showToast(`${capitalizeFirstLetter(type)} added successfully!`);
788
+ } else if (action === 'edit') {
789
+ // Update existing record
790
+ const index = sampleData[`${type}s`].findIndex(item => item.id === id);
791
+ if (index !== -1) {
792
+ const updatedRecord = getFormData(type, id);
793
+ sampleData[`${type}s`][index] = updatedRecord;
794
+ showToast(`${capitalizeFirstLetter(type)} updated successfully!`);
795
+ }
796
+ }
797
+
798
+ // Refresh the table
799
+ refreshTable(type);
800
+
801
+ // Close the form
802
+ closeForm();
803
+ }
804
+
805
+ // Get form data
806
+ function getFormData(type, id) {
807
+ switch (type) {
808
+ case 'employee':
809
+ return {
810
+ id,
811
+ name: document.getElementById('emp-name').value,
812
+ email: document.getElementById('emp-email').value,
813
+ phone: document.getElementById('emp-phone').value,
814
+ position: document.getElementById('emp-position').value,
815
+ department: document.getElementById('emp-department').value,
816
+ status: document.getElementById('emp-status').value,
817
+ address: document.getElementById('emp-address').value
818
+ };
819
+ case 'vendor':
820
+ return {
821
+ id,
822
+ name: document.getElementById('vendor-name').value,
823
+ contact: document.getElementById('vendor-contact').value,
824
+ email: document.getElementById('vendor-email').value,
825
+ phone: document.getElementById('vendor-phone').value,
826
+ products: document.getElementById('vendor-products').value,
827
+ rating: document.getElementById('vendor-rating').value,
828
+ status: document.getElementById('vendor-status').value
829
+ };
830
+ case 'customer':
831
+ return {
832
+ id,
833
+ name: document.getElementById('customer-name').value,
834
+ company: document.getElementById('customer-company').value,
835
+ email: document.getElementById('customer-email').value,
836
+ phone: document.getElementById('customer-phone').value,
837
+ value: document.getElementById('customer-value').value,
838
+ status: document.getElementById('customer-status').value,
839
+ notes: document.getElementById('customer-notes').value
840
+ };
841
+ case 'service':
842
+ return {
843
+ id,
844
+ name: document.getElementById('service-name').value,
845
+ category: document.getElementById('service-category').value,
846
+ price: document.getElementById('service-price').value,
847
+ duration: document.getElementById('service-duration').value,
848
+ description: document.getElementById('service-description').value,
849
+ status: document.getElementById('service-status').value,
850
+ popularity: document.getElementById('service-popularity').value
851
+ };
852
+ default:
853
+ return {};
854
+ }
855
+ }
856
+
857
+ // Generate ID
858
+ function generateId(type) {
859
+ const prefix = type === 'employee' ? 'EMP' :
860
+ type === 'vendor' ? 'VDR' :
861
+ type === 'customer' ? 'CST' : 'SRV';
862
+ const maxId = sampleData[`${type}s`].reduce((max, item) => {
863
+ const num = parseInt(item.id.replace(prefix, ''));
864
+ return num > max ? num : max;
865
+ }, 0);
866
+ return `${prefix}${String(maxId + 1).padStart(3, '0')}`;
867
+ }
868
+
869
+ // Show confirm modal
870
+ function showConfirmModal(type, id) {
871
+ currentRecordType = type;
872
+ currentRecordId = id;
873
+ confirmMessage.textContent = `Are you sure you want to delete this ${type}?`;
874
+ confirmModal.classList.remove('hidden');
875
+ }
876
+
877
+ // Close confirm modal
878
+ function closeConfirmModal() {
879
+ confirmModal.classList.add('hidden');
880
+ }
881
+
882
+ // Handle confirm action
883
+ function handleConfirmAction() {
884
+ const type = currentRecordType;
885
+ const id = currentRecordId;
886
+
887
+ // Delete the record
888
+ const index = sampleData[`${type}s`].findIndex(item => item.id === id);
889
+ if (index !== -1) {
890
+ sampleData[`${type}s`].splice(index, 1);
891
+ showToast(`${capitalizeFirstLetter(type)} deleted successfully!`);
892
+ }
893
+
894
+ // Refresh the table
895
+ refreshTable(type);
896
+
897
+ // Close the modal
898
+ closeConfirmModal();
899
+ }
900
+
901
+ // Render employee table
902
+ function renderEmployeeTable() {
903
+ const tbody = document.getElementById('employee-table-body');
904
+ tbody.innerHTML = '';
905
+
906
+ sampleData.employees.forEach(employee => {
907
+ const tr = document.createElement('tr');
908
+ tr.className = 'hover:bg-gray-50';
909
+ tr.innerHTML = `
910
+ <td class="px-6 py-4 whitespace-nowrap text-sm font-medium text-gray-900">${employee.id}</td>
911
+ <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">${employee.name}</td>
912
+ <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">${employee.position}</td>
913
+ <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">${employee.department}</td>
914
+ <td class="px-6 py-4 whitespace-nowrap">
915
+ <span class="px-2 inline-flex text-xs leading-5 font-semibold rounded-full ${getStatusClass(employee.status)}">
916
+ ${employee.status}
917
+ </span>
918
+ </td>
919
+ <td class="px-6 py-4 whitespace-nowrap text-right text-sm font-medium">
920
+ <button class="text-indigo-600 hover:text-indigo-900 mr-3 edit-btn" data-type="employee" data-id="${employee.id}">Edit</button>
921
+ <button class="text-red-600 hover:text-red-900 delete-btn" data-type="employee" data-id="${employee.id}">Delete</button>
922
+ </td>
923
+ `;
924
+ tbody.appendChild(tr);
925
+ });
926
+
927
+ // Add event listeners to edit and delete buttons
928
+ document.querySelectorAll('.edit-btn').forEach(btn => {
929
+ btn.addEventListener('click', () => {
930
+ const type = btn.getAttribute('data-type');
931
+ const id = btn.getAttribute('data-id');
932
+ showForm(type, 'edit', id);
933
+ });
934
+ });
935
+
936
+ document.querySelectorAll('.delete-btn').forEach(btn => {
937
+ btn.addEventListener('click', () => {
938
+ const type = btn.getAttribute('data-type');
939
+ const id = btn.getAttribute('data-id');
940
+ showConfirmModal(type, id);
941
+ });
942
+ });
943
+ }
944
+
945
+ // Render vendor table
946
+ function renderVendorTable() {
947
+ const tbody = document.getElementById('vendor-table-body');
948
+ tbody.innerHTML = '';
949
+
950
+ sampleData.vendors.forEach(vendor => {
951
+ const tr = document.createElement('tr');
952
+ tr.className = 'hover:bg-gray-50';
953
+ tr.innerHTML = `
954
+ <td class="px-6 py-4 whitespace-nowrap text-sm font-medium text-gray-900">${vendor.id}</td>
955
+ <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">${vendor.name}</td>
956
+ <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">${vendor.contact}</td>
957
+ <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500 truncate max-w-xs">${vendor.products}</td>
958
+ <td class="px-6 py-4 whitespace-nowrap">
959
+ ${getRatingStars(vendor.rating)}
960
+ </td>
961
+ <td class="px-6 py-4 whitespace-nowrap text-right text-sm font-medium">
962
+ <button class="text-indigo-600 hover:text-indigo-900 mr-3 edit-btn" data-type="vendor" data-id="${vendor.id}">Edit</button>
963
+ <button class="text-red-600 hover:text-red-900 delete-btn" data-type="vendor" data-id="${vendor.id}">Delete</button>
964
+ </td>
965
+ `;
966
+ tbody.appendChild(tr);
967
+ });
968
+
969
+ // Add event listeners to edit and delete buttons
970
+ document.querySelectorAll('.edit-btn').forEach(btn => {
971
+ btn.addEventListener('click', () => {
972
+ const type = btn.getAttribute('data-type');
973
+ const id = btn.getAttribute('data-id');
974
+ showForm(type, 'edit', id);
975
+ });
976
+ });
977
+
978
+ document.querySelectorAll('.delete-btn').forEach(btn => {
979
+ btn.addEventListener('click', () => {
980
+ const type = btn.getAttribute('data-type');
981
+ const id = btn.getAttribute('data-id');
982
+ showConfirmModal(type, id);
983
+ });
984
+ });
985
+ }
986
+
987
+ // Render customer table
988
+ function renderCustomerTable() {
989
+ const tbody = document.getElementById('customer-table-body');
990
+ tbody.innerHTML = '';
991
+
992
+ sampleData.customers.forEach(customer => {
993
+ const tr = document.createElement('tr');
994
+ tr.className = 'hover:bg-gray-50';
995
+ tr.innerHTML = `
996
+ <td class="px-6 py-4 whitespace-nowrap text-sm font-medium text-gray-900">${customer.id}</td>
997
+ <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">${customer.name}</td>
998
+ <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">${customer.company}</td>
999
+ <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">${customer.email}</td>
1000
+ <td class="px-6 py-4 whitespace-nowrap">
1001
+ <span class="px-2 inline-flex text-xs leading-5 font-semibold rounded-full ${getValueClass(customer.value)}">
1002
+ ${customer.value}
1003
+ </span>
1004
+ </td>
1005
+ <td class="px-6 py-4 whitespace-nowrap text-right text-sm font-medium">
1006
+ <button class="text-indigo-600 hover:text-indigo-900 mr-3 edit-btn" data-type="customer" data-id="${customer.id}">Edit</button>
1007
+ <button class="text-red-600 hover:text-red-900 delete-btn" data-type="customer" data-id="${customer.id}">Delete</button>
1008
+ </td>
1009
+ `;
1010
+ tbody.appendChild(tr);
1011
+ });
1012
+
1013
+ // Add event listeners to edit and delete buttons
1014
+ document.querySelectorAll('.edit-btn').forEach(btn => {
1015
+ btn.addEventListener('click', () => {
1016
+ const type = btn.getAttribute('data-type');
1017
+ const id = btn.getAttribute('data-id');
1018
+ showForm(type, 'edit', id);
1019
+ });
1020
+ });
1021
+
1022
+ document.querySelectorAll('.delete-btn').forEach(btn => {
1023
+ btn.addEventListener('click', () => {
1024
+ const type = btn.getAttribute('data-type');
1025
+ const id = btn.getAttribute('data-id');
1026
+ showConfirmModal(type, id);
1027
+ });
1028
+ });
1029
+ }
1030
+
1031
+ // Render service table
1032
+ function renderServiceTable() {
1033
+ const tbody = document.getElementById('service-table-body');
1034
+ tbody.innerHTML = '';
1035
+
1036
+ sampleData.services.forEach(service => {
1037
+ const tr = document.createElement('tr');
1038
+ tr.className = 'hover:bg-gray-50';
1039
+ tr.innerHTML = `
1040
+ <td class="px-6 py-4 whitespace-nowrap text-sm font-medium text-gray-900">${service.id}</td>
1041
+ <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">${service.name}</td>
1042
+ <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">${service.category}</td>
1043
+ <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">$${service.price}</td>
1044
+ <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">${service.duration}</td>
1045
+ <td class="px-6 py-4 whitespace-nowrap text-right text-sm font-medium">
1046
+ <button class="text-indigo-600 hover:text-indigo-900 mr-3 edit-btn" data-type="service" data-id="${service.id}">Edit</button>
1047
+ <button class="text-red-600 hover:text-red-900 delete-btn" data-type="service" data-id="${service.id}">Delete</button>
1048
+ </td>
1049
+ `;
1050
+ tbody.appendChild(tr);
1051
+ });
1052
+
1053
+ // Add event listeners to edit and delete buttons
1054
+ document.querySelectorAll('.edit-btn').forEach(btn => {
1055
+ btn.addEventListener('click', () => {
1056
+ const type = btn.getAttribute('data-type');
1057
+ const id = btn.getAttribute('data-id');
1058
+ showForm(type, 'edit', id);
1059
+ });
1060
+ });
1061
+
1062
+ document.querySelectorAll('.delete-btn').forEach(btn => {
1063
+ btn.addEventListener('click', () => {
1064
+ const type = btn.getAttribute('data-type');
1065
+ const id = btn.getAttribute('data-id');
1066
+ showConfirmModal(type, id);
1067
+ });
1068
+ });
1069
+ }
1070
+
1071
+ // Refresh table after changes
1072
+ function refreshTable(type) {
1073
+ switch (type) {
1074
+ case 'employee':
1075
+ renderEmployeeTable();
1076
+ break;
1077
+ case 'vendor':
1078
+ renderVendorTable();
1079
+ break;
1080
+ case 'customer':
1081
+ renderCustomerTable();
1082
+ break;
1083
+ case 'service':
1084
+ renderServiceTable();
1085
+ break;
1086
+ }
1087
+ }
1088
+
1089
+ // Get status class for styling
1090
+ function getStatusClass(status) {
1091
+ switch (status) {
1092
+ case 'Active':
1093
+ return 'bg-green-100 text-green-800';
1094
+ case 'Inactive':
1095
+ return 'bg-red-100 text-red-800';
1096
+ case 'On Leave':
1097
+ case 'On Hold':
1098
+ return 'bg-yellow-100 text-yellow-800';
1099
+ default:
1100
+ return 'bg-gray-100 text-gray-800';
1101
+ }
1102
+ }
1103
+
1104
+ // Get value class for styling
1105
+ function getValueClass(value) {
1106
+ switch (value) {
1107
+ case 'High':
1108
+ return 'bg-green-100 text-green-800';
1109
+ case 'Medium':
1110
+ return 'bg-blue-100 text-blue-800';
1111
+ case 'Low':
1112
+ return 'bg-gray-100 text-gray-800';
1113
+ default:
1114
+ return 'bg-gray-100 text-gray-800';
1115
+ }
1116
+ }
1117
+
1118
+ // Get rating stars
1119
+ function getRatingStars(rating) {
1120
+ const stars = [];
1121
+ for (let i = 1; i <= 5; i++) {
1122
+ stars.push(
1123
+ i <= rating
1124
+ ? '<i class="fas fa-star text-yellow-400"></i>'
1125
+ : '<i class="far fa-star text-gray-300"></i>'
1126
+ );
1127
+ }
1128
+ return stars.join('');
1129
+ }
1130
+
1131
+ // Show toast notification
1132
+ function showToast(message) {
1133
+ const toast = document.createElement('div');
1134
+ toast.className = 'fixed bottom-4 right-4 px-4 py-2 bg-green-600 text-white rounded-md shadow-lg flex items-center fade-in';
1135
+ toast.innerHTML = `
1136
+ <i class="fas fa-check-circle mr-2"></i>
1137
+ <span>${message}</span>
1138
+ `;
1139
+ document.body.appendChild(toast);
1140
+
1141
+ setTimeout(() => {
1142
+ toast.classList.remove('fade-in');
1143
+ toast.classList.add('fade-out');
1144
+ setTimeout(() => toast.remove(), 300);
1145
+ }, 3000);
1146
+ }
1147
+
1148
+ // Toggle theme
1149
+ function toggleTheme() {
1150
+ const html = document.documentElement;
1151
+ if (html.classList.contains('dark')) {
1152
+ html.classList.remove('dark');
1153
+ themeToggle.innerHTML = '<i class="fas fa-moon"></i>';
1154
+ localStorage.setItem('theme', 'light');
1155
+ } else {
1156
+ html.classList.add('dark');
1157
+ themeToggle.innerHTML = '<i class="fas fa-sun"></i>';
1158
+ localStorage.setItem('theme', 'dark');
1159
+ }
1160
+ }
1161
+
1162
+ // Check for saved theme preference
1163
+ function checkTheme() {
1164
+ const savedTheme = localStorage.getItem('theme') || 'light';
1165
+ if (savedTheme === 'dark') {
1166
+ document.documentElement.classList.add('dark');
1167
+ themeToggle.innerHTML = '<i class="fas fa-sun"></i>';
1168
+ }
1169
+ }
1170
+
1171
+ // Capitalize first letter
1172
+ function capitalizeFirstLetter(string) {
1173
+ return string.charAt(0).toUpperCase() + string.slice(1);
1174
+ }
1175
+
1176
+ // Initialize the app when DOM is loaded
1177
+ document.addEventListener('DOMContentLoaded', () => {
1178
+ checkTheme();
1179
+ init();
1180
+ });
1181
+ </script>
1182
+ <p style="border-radius: 8px; text-align: center; font-size: 12px; color: #fff; margin-top: 16px;position: fixed; left: 8px; bottom: 8px; z-index: 10; background: rgba(0, 0, 0, 0.8); padding: 4px 8px;">Made with <img src="https://enzostvs-deepsite.hf.space/logo.svg" alt="DeepSite Logo" style="width: 16px; height: 16px; vertical-align: middle;display:inline-block;margin-right:3px;filter:brightness(0) invert(1);"><a href="https://enzostvs-deepsite.hf.space" style="color: #fff;text-decoration: underline;" target="_blank" >DeepSite</a> - 🧬 <a href="https://enzostvs-deepsite.hf.space?remix=atchara/b1" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body>
1183
+ </html>