poluser commited on
Commit
015a2d4
·
verified ·
1 Parent(s): 1487507

Add 3 files

Browse files
Files changed (3) hide show
  1. README.md +7 -5
  2. index.html +1242 -19
  3. prompts.txt +0 -0
README.md CHANGED
@@ -1,10 +1,12 @@
1
  ---
2
- title: Eps Test
3
- emoji: 🚀
4
- colorFrom: blue
5
- colorTo: indigo
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: eps-test
3
+ emoji: 🐳
4
+ colorFrom: yellow
5
+ colorTo: purple
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,1242 @@
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>ConstructTrack - Construction Project Cost Tracker</title>
7
+ <script src="https://cdn.tailwindcss.com"></script>
8
+ <script src="https://cdn.jsdelivr.net/npm/chart.js"></script>
9
+ <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
10
+ <style>
11
+ .sidebar {
12
+ transition: all 0.3s;
13
+ }
14
+ .sidebar.collapsed {
15
+ width: 80px;
16
+ }
17
+ .sidebar.collapsed .nav-text {
18
+ display: none;
19
+ }
20
+ .sidebar.collapsed .logo-text {
21
+ display: none;
22
+ }
23
+ .main-content {
24
+ transition: all 0.3s;
25
+ }
26
+ .sidebar.collapsed + .main-content {
27
+ margin-left: 80px;
28
+ }
29
+ .progress-bar {
30
+ transition: width 0.6s ease;
31
+ }
32
+ .chart-container {
33
+ position: relative;
34
+ height: 300px;
35
+ width: 100%;
36
+ }
37
+ .custom-scrollbar::-webkit-scrollbar {
38
+ width: 6px;
39
+ height: 6px;
40
+ }
41
+ .custom-scrollbar::-webkit-scrollbar-track {
42
+ background: #f1f1f1;
43
+ }
44
+ .custom-scrollbar::-webkit-scrollbar-thumb {
45
+ background: #888;
46
+ border-radius: 3px;
47
+ }
48
+ .custom-scrollbar::-webkit-scrollbar-thumb:hover {
49
+ background: #555;
50
+ }
51
+ .editable-field {
52
+ border-bottom: 1px dashed #ccc;
53
+ cursor: pointer;
54
+ min-width: 80px;
55
+ }
56
+ .editable-field:hover {
57
+ background-color: #f0f9ff;
58
+ }
59
+ .editable-field:focus {
60
+ outline: none;
61
+ border-bottom: 2px solid #3b82f6;
62
+ background-color: white;
63
+ }
64
+ [contenteditable="true"] {
65
+ padding: 2px 4px;
66
+ }
67
+ .profit-positive {
68
+ color: #10B981;
69
+ }
70
+ .profit-negative {
71
+ color: #EF4444;
72
+ }
73
+ .modal {
74
+ transition: opacity 0.3s ease, visibility 0.3s ease;
75
+ }
76
+ .status-budget {
77
+ background-color: #EFF6FF;
78
+ color: #1D4ED8;
79
+ }
80
+ .status-time {
81
+ background-color: #ECFDF5;
82
+ color: #047857;
83
+ }
84
+ .status-budget-time {
85
+ background-color: #FEF3C7;
86
+ color: #92400E;
87
+ }
88
+ .status-over {
89
+ background-color: #FEE2E2;
90
+ color: #B91C1C;
91
+ }
92
+ .status-proposal {
93
+ background-color: #F5F3FF;
94
+ color: #6D28D9;
95
+ }
96
+ .status-awarded {
97
+ background-color: #ECFDF5;
98
+ color: #059669;
99
+ }
100
+ .status-not-started {
101
+ background-color: #F3F4F6;
102
+ color: #4B5563;
103
+ }
104
+ .status-completed {
105
+ background-color: #F0FDF4;
106
+ color: #16A34A;
107
+ }
108
+ </style>
109
+ </head>
110
+ <body class="bg-gray-100 font-sans">
111
+ <div class="flex h-screen overflow-hidden">
112
+ <!-- Sidebar -->
113
+ <div class="sidebar bg-blue-800 text-white w-64 flex flex-col">
114
+ <div class="p-4 flex items-center justify-between border-b border-blue-700">
115
+ <div class="flex items-center">
116
+ <i class="fas fa-hard-hat text-2xl mr-3"></i>
117
+ <span class="logo-text text-xl font-bold">CKI Builders</span>
118
+ </div>
119
+ <button id="toggleSidebar" class="text-white focus:outline-none">
120
+ <i class="fas fa-bars"></i>
121
+ </button>
122
+ </div>
123
+ <div class="p-4 border-b border-blue-700">
124
+ <div class="flex items-center">
125
+ <div class="w-10 h-10 rounded-full bg-blue-600 flex items-center justify-center">
126
+ <i class="fas fa-user"></i>
127
+ </div>
128
+ <div class="ml-3 nav-text">
129
+ <div class="font-medium">Administrator</div>
130
+ <div class="text-xs text-blue-200">Admin</div>
131
+ </div>
132
+ </div>
133
+ </div>
134
+ <nav class="flex-1 overflow-y-auto">
135
+ <div class="p-2">
136
+ <a href="#" class="flex items-center p-2 rounded hover:bg-blue-700">
137
+ <i class="fas fa-tachometer-alt mr-3"></i>
138
+ <span class="nav-text">Dashboard</span>
139
+ </a>
140
+ <a href="#projects" class="flex items-center p-2 rounded bg-blue-700">
141
+ <i class="fas fa-project-diagram mr-3"></i>
142
+ <span class="nav-text">Projects</span>
143
+ </a>
144
+ <a href="#" class="flex items-center p-2 rounded hover:bg-blue-700">
145
+ <i class="fas fa-dollar-sign mr-3"></i>
146
+ <span class="nav-text">Cost Tracking</span>
147
+ </a>
148
+ <a href="#" class="flex items-center p-2 rounded hover:bg-blue-700">
149
+ <i class="fas fa-chart-bar mr-3"></i>
150
+ <span class="nav-text">Reports</span>
151
+ </a>
152
+ <a href="#" class="flex items-center p-2 rounded hover:bg-blue-700">
153
+ <i class="fas fa-users mr-3"></i>
154
+ <span class="nav-text">Contractors</span>
155
+ </a>
156
+ <a href="#" class="flex items-center p-2 rounded hover:bg-blue-700">
157
+ <i class="fas fa-truck mr-3"></i>
158
+ <span class="nav-text">Materials</span>
159
+ </a>
160
+ <a href="#" class="flex items-center p-2 rounded hover:bg-blue-700">
161
+ <i class="fas fa-calendar-alt mr-3"></i>
162
+ <span class="nav-text">Schedule</span>
163
+ </a>
164
+ </div>
165
+ <div class="p-2 border-t border-blue-700">
166
+ <a href="#" class="flex items-center p-2 rounded hover:bg-blue-700">
167
+ <i class="fas fa-cog mr-3"></i>
168
+ <span class="nav-text">Settings</span>
169
+ </a>
170
+ <a href="#" class="flex items-center p-2 rounded hover:bg-blue-700">
171
+ <i class="fas fa-sign-out-alt mr-3"></i>
172
+ <span class="nav-text">Logout</span>
173
+ </a>
174
+ </div>
175
+ </nav>
176
+ </div>
177
+
178
+ <!-- Main Content -->
179
+ <div class="main-content flex-1 overflow-auto">
180
+ <header class="bg-white shadow-sm p-4 flex justify-between items-center">
181
+ <h1 class="text-2xl font-bold text-gray-800">Portfolio Management</h1>
182
+ <div class="flex items-center space-x-4">
183
+ <button class="p-2 rounded-full hover:bg-gray-100 relative">
184
+ <i class="fas fa-bell text-gray-600"></i>
185
+ <span class="absolute top-0 right-0 h-2 w-2 rounded-full bg-red-500"></span>
186
+ </button>
187
+ <div class="flex items-center">
188
+ <i class="fas fa-peso-sign mr-1 text-gray-600"></i>
189
+ <span class="text-sm font-medium">PHP</span>
190
+ </div>
191
+ </div>
192
+ </header>
193
+
194
+ <main class="p-6" id="projects">
195
+ <!-- Projects Header -->
196
+ <div class="flex justify-between items-center mb-6">
197
+ <div>
198
+ <h2 class="text-xl font-semibold text-gray-800">All Projects</h2>
199
+ <p class="text-gray-600">Overview of all active and completed construction projects</p>
200
+ </div>
201
+ <button id="newProjectBtn" class="bg-blue-600 hover:bg-blue-700 text-white px-4 py-2 rounded-lg flex items-center">
202
+ <i class="fas fa-plus mr-2"></i> New Project
203
+ </button>
204
+ </div>
205
+
206
+ <!-- Projects Summary Cards -->
207
+ <div class="grid grid-cols-1 md:grid-cols-4 gap-6 mb-6" id="summaryCards">
208
+ <!-- Cards will be updated dynamically -->
209
+ </div>
210
+
211
+ <!-- Projects Table -->
212
+ <div class="bg-white rounded-lg shadow overflow-hidden mb-6">
213
+ <div class="p-4 border-b flex justify-between items-center">
214
+ <div class="flex items-center space-x-4">
215
+ <h2 class="text-lg font-semibold">Active Projects</h2>
216
+ <div class="relative">
217
+ <input type="text" id="projectSearch" placeholder="Search projects..." class="pl-10 pr-4 py-2 border rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 w-64">
218
+ <i class="fas fa-search absolute left-3 top-3 text-gray-400"></i>
219
+ </div>
220
+ </div>
221
+ <div class="flex space-x-2">
222
+ <button id="allFilter" class="px-3 py-1 text-xs bg-blue-100 text-blue-600 rounded">All</button>
223
+ <button id="commercialFilter" class="px-3 py-1 text-xs bg-gray-100 text-gray-600 rounded">Commercial</button>
224
+ <button id="residentialFilter" class="px-3 py-1 text-xs bg-gray-100 text-gray-600 rounded">Residential</button>
225
+ <button id="industrialFilter" class="px-3 py-1 text-xs bg-gray-100 text-gray-600 rounded">Industrial</button>
226
+ <button id="customFilter" class="px-3 py-1 text-xs bg-gray-100 text-gray-600 rounded">Custom</button>
227
+ </div>
228
+ </div>
229
+ <div class="overflow-x-auto custom-scrollbar">
230
+ <table class="min-w-full divide-y divide-gray-200">
231
+ <thead class="bg-gray-50">
232
+ <tr>
233
+ <th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Project</th>
234
+ <th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Client</th>
235
+ <th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Contract Value</th>
236
+ <th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Budget</th>
237
+ <th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Spent</th>
238
+ <th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Profit %</th>
239
+ <th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Progress</th>
240
+ <th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Timeline</th>
241
+ <th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Status</th>
242
+ <th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Actions</th>
243
+ </tr>
244
+ </thead>
245
+ <tbody class="bg-white divide-y divide-gray-200" id="projectsTableBody">
246
+ <!-- Projects will be loaded here by JavaScript -->
247
+ </tbody>
248
+ </table>
249
+ </div>
250
+ </div>
251
+ </main>
252
+ </div>
253
+ </div>
254
+
255
+ <!-- New Project Modal -->
256
+ <div id="newProjectModal" class="modal fixed inset-0 bg-gray-600 bg-opacity-50 overflow-y-auto h-full w-full hidden">
257
+ <div class="relative top-20 mx-auto p-5 border w-11/12 max-w-2xl shadow-lg rounded-md bg-white">
258
+ <div class="flex justify-between items-center mb-4">
259
+ <h3 class="text-xl font-semibold">Add New Project</h3>
260
+ <button id="closeModal" class="text-gray-500 hover:text-gray-700">
261
+ <i class="fas fa-times"></i>
262
+ </button>
263
+ </div>
264
+ <form id="projectForm">
265
+ <div class="grid grid-cols-1 md:grid-cols-2 gap-4 mb-4">
266
+ <div>
267
+ <label class="block text-sm font-medium text-gray-700 mb-1">Project Name</label>
268
+ <input type="text" id="projectName" class="w-full px-3 py-2 border rounded-md">
269
+ </div>
270
+ <div>
271
+ <label class="block text-sm font-medium text-gray-700 mb-1">Project Code</label>
272
+ <input type="text" id="projectCode" class="w-full px-3 py-2 border rounded-md">
273
+ </div>
274
+ <div>
275
+ <label class="block text-sm font-medium text-gray-700 mb-1">Client Name</label>
276
+ <input type="text" id="clientName" class="w-full px-3 py-2 border rounded-md">
277
+ </div>
278
+ <div>
279
+ <label class="block text-sm font-medium text-gray-700 mb-1">Client Contact</label>
280
+ <input type="text" id="clientContact" class="w-full px-3 py-2 border rounded-md">
281
+ </div>
282
+ <div>
283
+ <label class="block text-sm font-medium text-gray-700 mb-1">Contract Value (₱)</label>
284
+ <input type="number" id="contractValue" class="w-full px-3 py-2 border rounded-md" value="0" step="0.01">
285
+ </div>
286
+ <div>
287
+ <label class="block text-sm font-medium text-gray-700 mb-1">Project Budget (₱)</label>
288
+ <input type="number" id="projectBudget" class="w-full px-3 py-2 border rounded-md" value="0" step="0.01">
289
+ </div>
290
+ <div>
291
+ <label class="block text-sm font-medium text-gray-700 mb-1">Amount Spent (₱)</label>
292
+ <input type="number" id="projectSpent" class="w-full px-3 py-2 border rounded-md" value="0" step="0.01">
293
+ </div>
294
+ <div>
295
+ <label class="block text-sm font-medium text-gray-700 mb-1">Project Progress (%)</label>
296
+ <input type="number" id="projectProgress" class="w-full px-3 py-2 border rounded-md" value="0" step="0.01">
297
+ </div>
298
+ <div>
299
+ <label class="block text-sm font-medium text-gray-700 mb-1">Start Date</label>
300
+ <input type="date" id="startDate" class="w-full px-3 py-2 border rounded-md">
301
+ </div>
302
+ <div>
303
+ <label class="block text-sm font-medium text-gray-700 mb-1">End Date</label>
304
+ <input type="date" id="endDate" class="w-full px-3 py-2 border rounded-md">
305
+ </div>
306
+ <div>
307
+ <label class="block text-sm font-medium text-gray-700 mb-1">Project Phase</label>
308
+ <select id="projectPhase" class="w-full px-3 py-2 border rounded-md">
309
+ <option value="proposal">Proposal</option>
310
+ <option value="awarded">Awarded (Not Started)</option>
311
+ <option value="ongoing" selected>On-going</option>
312
+ <option value="completed">Completed</option>
313
+ </select>
314
+ </div>
315
+ <div>
316
+ <label class="block text-sm font-medium text-gray-700 mb-1">Award Date</label>
317
+ <input type="date" id="awardDate" class="w-full px-3 py-2 border rounded-md">
318
+ </div>
319
+ <div class="md:col-span-2">
320
+ <label class="block text-sm font-medium text-gray-700 mb-1">Project Type</label>
321
+ <div class="flex items-center">
322
+ <select id="projectType" class="w-full px-3 py-2 border rounded-md mr-2">
323
+ <option value="">Select project type</option>
324
+ <option value="commercial">Commercial</option>
325
+ <option value="residential">Residential</option>
326
+ <option value="industrial">Industrial</option>
327
+ <option value="custom">Custom</option>
328
+ </select>
329
+ <input type="text" id="customProjectType" class="w-full px-3 py-2 border rounded-md hidden" placeholder="Enter custom type">
330
+ </div>
331
+ </div>
332
+ <div class="md:col-span-2">
333
+ <label class="block text-sm font-medium text-gray-700 mb-1">Project Description</label>
334
+ <textarea id="projectDescription" class="w-full px-3 py-2 border rounded-md" rows="3"></textarea>
335
+ </div>
336
+ </div>
337
+ <div class="flex justify-end space-x-3">
338
+ <button type="button" id="cancelProject" class="px-4 py-2 border rounded-md hover:bg-gray-100">Cancel</button>
339
+ <button type="submit" class="px-4 py-2 bg-blue-600 text-white rounded-md hover:bg-blue-700">Save Project</button>
340
+ </div>
341
+ </form>
342
+ </div>
343
+ </div>
344
+
345
+ <!-- Edit Project Modal -->
346
+ <div id="editProjectModal" class="modal fixed inset-0 bg-gray-600 bg-opacity-50 overflow-y-auto h-full w-full hidden">
347
+ <div class="relative top-20 mx-auto p-5 border w-11/12 max-w-2xl shadow-lg rounded-md bg-white">
348
+ <div class="flex justify-between items-center mb-4">
349
+ <h3 class="text-xl font-semibold">Edit Project</h3>
350
+ <button id="closeEditModal" class="text-gray-500 hover:text-gray-700">
351
+ <i class="fas fa-times"></i>
352
+ </button>
353
+ </div>
354
+ <form id="editProjectForm">
355
+ <input type="hidden" id="editProjectId">
356
+ <div class="grid grid-cols-1 md:grid-cols-2 gap-4 mb-4">
357
+ <div>
358
+ <label class="block text-sm font-medium text-gray-700 mb-1">Project Name</label>
359
+ <input type="text" id="editProjectName" class="w-full px-3 py-2 border rounded-md">
360
+ </div>
361
+ <div>
362
+ <label class="block text-sm font-medium text-gray-700 mb-1">Project Code</label>
363
+ <input type="text" id="editProjectCode" class="w-full px-3 py-2 border rounded-md">
364
+ </div>
365
+ <div>
366
+ <label class="block text-sm font-medium text-gray-700 mb-1">Client Name</label>
367
+ <input type="text" id="editClientName" class="w-full px-3 py-2 border rounded-md">
368
+ </div>
369
+ <div>
370
+ <label class="block text-sm font-medium text-gray-700 mb-1">Client Contact</label>
371
+ <input type="text" id="editClientContact" class="w-full px-3 py-2 border rounded-md">
372
+ </div>
373
+ <div>
374
+ <label class="block text-sm font-medium text-gray-700 mb-1">Contract Value (₱)</label>
375
+ <input type="number" id="editContractValue" class="w-full px-3 py-2 border rounded-md" step="0.01">
376
+ </div>
377
+ <div>
378
+ <label class="block text-sm font-medium text-gray-700 mb-1">Project Budget (₱)</label>
379
+ <input type="number" id="editProjectBudget" class="w-full px-3 py-2 border rounded-md" step="0.01">
380
+ </div>
381
+ <div>
382
+ <label class="block text-sm font-medium text-gray-700 mb-1">Amount Spent (₱)</label>
383
+ <input type="number" id="editProjectSpent" class="w-full px-3 py-2 border rounded-md" step="0.01">
384
+ </div>
385
+ <div>
386
+ <label class="block text-sm font-medium text-gray-700 mb-1">Project Progress (%)</label>
387
+ <input type="number" id="editProjectProgress" class="w-full px-3 py-2 border rounded-md" step="0.01">
388
+ </div>
389
+ <div>
390
+ <label class="block text-sm font-medium text-gray-700 mb-1">Start Date</label>
391
+ <input type="date" id="editStartDate" class="w-full px-3 py-2 border rounded-md">
392
+ </div>
393
+ <div>
394
+ <label class="block text-sm font-medium text-gray-700 mb-1">End Date</label>
395
+ <input type="date" id="editEndDate" class="w-full px-3 py-2 border rounded-md">
396
+ </div>
397
+ <div>
398
+ <label class="block text-sm font-medium text-gray-700 mb-1">Project Phase</label>
399
+ <select id="editProjectPhase" class="w-full px-3 py-2 border rounded-md">
400
+ <option value="proposal">Proposal</option>
401
+ <option value="awarded">Awarded (Not Started)</option>
402
+ <option value="ongoing">On-going</option>
403
+ <option value="completed">Completed</option>
404
+ </select>
405
+ </div>
406
+ <div>
407
+ <label class="block text-sm font-medium text-gray-700 mb-1">Award Date</label>
408
+ <input type="date" id="editAwardDate" class="w-full px-3 py-2 border rounded-md">
409
+ </div>
410
+ <div class="md:col-span-2">
411
+ <label class="block text-sm font-medium text-gray-700 mb-1">Project Type</label>
412
+ <div class="flex items-center">
413
+ <select id="editProjectType" class="w-full px-3 py-2 border rounded-md mr-2">
414
+ <option value="">Select project type</option>
415
+ <option value="commercial">Commercial</option>
416
+ <option value="residential">Residential</option>
417
+ <option value="industrial">Industrial</option>
418
+ <option value="custom">Custom</option>
419
+ </select>
420
+ <input type="text" id="editCustomProjectType" class="w-full px-3 py-2 border rounded-md hidden" placeholder="Enter custom type">
421
+ </div>
422
+ </div>
423
+ <div class="md:col-span-2">
424
+ <label class="block text-sm font-medium text-gray-700 mb-1">Project Description</label>
425
+ <textarea id="editProjectDescription" class="w-full px-3 py-2 border rounded-md" rows="3"></textarea>
426
+ </div>
427
+ </div>
428
+ <div class="flex justify-end space-x-3">
429
+ <button type="button" id="cancelEditProject" class="px-4 py-2 border rounded-md hover:bg-gray-100">Cancel</button>
430
+ <button type="submit" class="px-4 py-2 bg-blue-600 text-white rounded-md hover:bg-blue-700">Update Project</button>
431
+ </div>
432
+ </form>
433
+ </div>
434
+ </div>
435
+
436
+ <!-- Delete Confirmation Modal -->
437
+ <div id="deleteProjectModal" class="modal fixed inset-0 bg-gray-600 bg-opacity-50 overflow-y-auto h-full w-full hidden">
438
+ <div class="relative top-20 mx-auto p-5 border w-96 shadow-lg rounded-md bg-white">
439
+ <div class="flex justify-between items-center mb-4">
440
+ <h3 class="text-xl font-semibold">Confirm Deletion</h3>
441
+ <button id="closeDeleteModal" class="text-gray-500 hover:text-gray-700">
442
+ <i class="fas fa-times"></i>
443
+ </button>
444
+ </div>
445
+ <div class="mb-6">
446
+ <p>Are you sure you want to delete this project? This action cannot be undone.</p>
447
+ <p class="font-semibold mt-2" id="projectToDeleteName"></p>
448
+ </div>
449
+ <div class="flex justify-end space-x-3">
450
+ <button type="button" id="cancelDeleteProject" class="px-4 py-2 border rounded-md hover:bg-gray-100">Cancel</button>
451
+ <button type="button" id="confirmDeleteProject" class="px-4 py-2 bg-red-600 text-white rounded-md hover:bg-red-700">Delete Project</button>
452
+ </div>
453
+ </div>
454
+ </div>
455
+
456
+ <script>
457
+ // Sample project data
458
+ let projects = [
459
+ {
460
+ id: 1,
461
+ name: "Downtown Office Tower",
462
+ code: "PROJ-2023-001",
463
+ client: "Global Corp",
464
+ contact: "John Smith",
465
+ type: "commercial",
466
+ contractValue: 62500000.50,
467
+ budget: 55000000.75,
468
+ spent: 43750000.25,
469
+ profitMargin: 12.5,
470
+ progress: 65.5,
471
+ startDate: "2023-06-01",
472
+ endDate: "2023-09-15",
473
+ phase: "ongoing",
474
+ awardDate: "2023-05-15",
475
+ daysLeft: 45,
476
+ status: "On Budget",
477
+ statusClass: "status-budget",
478
+ description: "35-story office building in downtown business district"
479
+ },
480
+ {
481
+ id: 2,
482
+ name: "Riverside Condos",
483
+ code: "PROJ-2023-002",
484
+ client: "Urban Living",
485
+ contact: "Sarah Johnson",
486
+ type: "residential",
487
+ contractValue: 42500000.00,
488
+ budget: 40000000.00,
489
+ spent: 36000000.00,
490
+ profitMargin: 15.3,
491
+ progress: 82.0,
492
+ startDate: "2023-04-15",
493
+ endDate: "2023-08-30",
494
+ phase: "ongoing",
495
+ awardDate: "2023-03-01",
496
+ daysLeft: 22,
497
+ status: "Ahead of Time",
498
+ statusClass: "status-time",
499
+ description: "Luxury condominium complex with river views"
500
+ }
501
+ ];
502
+
503
+ // Custom project types
504
+ let customProjectTypes = ["commercial", "residential", "industrial"];
505
+
506
+ // Filter variables
507
+ let filteredProjects = [...projects];
508
+ let currentFilter = "all";
509
+ let projectToDelete = null;
510
+
511
+ // DOM elements
512
+ const projectsTableBody = document.getElementById('projectsTableBody');
513
+ const projectSearch = document.getElementById('projectSearch');
514
+ const allFilter = document.getElementById('allFilter');
515
+ const commercialFilter = document.getElementById('commercialFilter');
516
+ const residentialFilter = document.getElementById('residentialFilter');
517
+ const industrialFilter = document.getElementById('industrialFilter');
518
+ const customFilter = document.getElementById('customFilter');
519
+ const summaryCards = document.getElementById('summaryCards');
520
+
521
+ // Modal elements
522
+ const newProjectModal = document.getElementById('newProjectModal');
523
+ const editProjectModal = document.getElementById('editProjectModal');
524
+ const deleteProjectModal = document.getElementById('deleteProjectModal');
525
+
526
+ // Initialize the page
527
+ document.addEventListener('DOMContentLoaded', function() {
528
+ renderProjects();
529
+ updateSummaryCards();
530
+ setupEventListeners();
531
+ });
532
+
533
+ // Render all projects
534
+ function renderProjects() {
535
+ // Clear existing rows
536
+ projectsTableBody.innerHTML = '';
537
+
538
+ // Add rows for each project
539
+ filteredProjects.forEach(project => {
540
+ // Calculate profit margin if not already set
541
+ if (project.profitMargin === undefined || isNaN(project.profitMargin)) {
542
+ project.profitMargin = ((project.contractValue - project.spent) / project.contractValue) * 100;
543
+ }
544
+
545
+ const profitText = `${project.profitMargin.toFixed(2)}%`;
546
+ const profitClass = project.profitMargin >= 0 ? 'profit-positive' : 'profit-negative';
547
+
548
+ // Determine phase status
549
+ let phaseStatus = "";
550
+ let phaseClass = "";
551
+
552
+ if (project.phase === "proposal") {
553
+ phaseStatus = "Proposal";
554
+ phaseClass = "status-proposal";
555
+ } else if (project.phase === "awarded") {
556
+ phaseStatus = "Awarded (Not Started)";
557
+ phaseClass = "status-awarded";
558
+ } else if (project.phase === "ongoing") {
559
+ // For ongoing projects, show the budget/time status
560
+ phaseStatus = project.status;
561
+ phaseClass = project.statusClass;
562
+ } else if (project.phase === "completed") {
563
+ phaseStatus = "Completed";
564
+ phaseClass = "status-completed";
565
+ }
566
+
567
+ const row = document.createElement('tr');
568
+ row.innerHTML = `
569
+ <td class="px-6 py-4 whitespace-nowrap">
570
+ <div class="flex items-center">
571
+ <div class="flex-shrink-0 h-10 w-10 rounded-full ${getProjectIconClass(project.type)} flex items-center justify-center">
572
+ <i class="${getProjectIcon(project.type)}"></i>
573
+ </div>
574
+ <div class="ml-4">
575
+ <div class="text-sm font-medium text-gray-900">${project.name}</div>
576
+ <div class="text-sm text-gray-500">${project.code}</div>
577
+ </div>
578
+ </div>
579
+ </td>
580
+ <td class="px-6 py-4 whitespace-nowrap">
581
+ <div class="text-sm font-medium text-gray-900">${project.client}</div>
582
+ <div class="text-sm text-gray-500">${project.contact}</div>
583
+ </td>
584
+ <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-900">₱${formatNumber(project.contractValue)}</td>
585
+ <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-900">₱${formatNumber(project.budget)}</td>
586
+ <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-900">₱${formatNumber(project.spent)}</td>
587
+ <td class="px-6 py-4 whitespace-nowrap text-sm font-medium ${profitClass}">${profitText}</td>
588
+ <td class="px-6 py-4 whitespace-nowrap">
589
+ <div class="flex items-center">
590
+ <div class="w-16 mr-2">
591
+ <div class="w-full bg-gray-200 rounded-full h-2">
592
+ <div class="${getProgressBarColor(project.progress)} h-2 rounded-full" style="width: ${project.progress}%"></div>
593
+ </div>
594
+ </div>
595
+ <span class="text-sm text-gray-900">${project.progress.toFixed(2)}%</span>
596
+ </div>
597
+ </td>
598
+ <td class="px-6 py-4 whitespace-nowrap">
599
+ ${project.startDate ? `
600
+ <div class="text-sm text-gray-900">${formatDate(project.startDate)} - ${formatDate(project.endDate)}</div>
601
+ <div class="text-sm text-gray-500">${project.daysLeft} days left</div>
602
+ ` : `
603
+ <div class="text-sm text-gray-500">Not started</div>
604
+ `}
605
+ </td>
606
+ <td class="px-6 py-4 whitespace-nowrap">
607
+ <span class="px-2 inline-flex text-xs leading-5 font-semibold rounded-full ${phaseClass}">${phaseStatus}</span>
608
+ </td>
609
+ <td class="px-6 py-4 whitespace-nowrap text-sm font-medium">
610
+ <button class="text-blue-600 hover:text-blue-900 mr-3 edit-project" data-id="${project.id}"><i class="fas fa-edit"></i></button>
611
+ <button class="text-red-600 hover:text-red-900 delete-project" data-id="${project.id}"><i class="fas fa-trash-alt"></i></button>
612
+ </td>
613
+ `;
614
+ projectsTableBody.appendChild(row);
615
+ });
616
+
617
+ // Update summary cards after rendering projects
618
+ updateSummaryCards();
619
+ }
620
+
621
+ // Update summary cards based on filtered projects
622
+ function updateSummaryCards() {
623
+ if (filteredProjects.length === 0) {
624
+ summaryCards.innerHTML = '<p class="text-gray-500">No projects match the current filter</p>';
625
+ return;
626
+ }
627
+
628
+ // Calculate summary statistics
629
+ const totalProjects = filteredProjects.length;
630
+ const totalContractValue = filteredProjects.reduce((sum, project) => sum + project.contractValue, 0);
631
+
632
+ // Count projects by phase
633
+ const proposalProjects = filteredProjects.filter(p => p.phase === "proposal").length;
634
+ const awardedProjects = filteredProjects.filter(p => p.phase === "awarded").length;
635
+ const ongoingProjects = filteredProjects.filter(p => p.phase === "ongoing").length;
636
+ const completedProjects = filteredProjects.filter(p => p.phase === "completed").length;
637
+
638
+ // Calculate average project duration in days (only for ongoing/completed projects)
639
+ const projectsWithDates = filteredProjects.filter(p => p.startDate && p.endDate);
640
+ const totalDuration = projectsWithDates.reduce((sum, project) => {
641
+ const start = new Date(project.startDate);
642
+ const end = new Date(project.endDate);
643
+ const duration = (end - start) / (1000 * 60 * 60 * 24);
644
+ return sum + duration;
645
+ }, 0);
646
+ const avgDuration = projectsWithDates.length > 0 ? Math.round(totalDuration / projectsWithDates.length) : 0;
647
+
648
+ // Calculate average profit margin (only for ongoing/completed projects)
649
+ const projectsWithProfit = filteredProjects.filter(p => p.phase === "ongoing" || p.phase === "completed");
650
+ const totalProfitMargin = projectsWithProfit.reduce((sum, project) => sum + project.profitMargin, 0);
651
+ const avgProfitMargin = projectsWithProfit.length > 0 ? (totalProfitMargin / projectsWithProfit.length).toFixed(2) : 0;
652
+
653
+ // Find highest and lowest profit margins
654
+ const profitMargins = projectsWithProfit.map(project => project.profitMargin);
655
+ const highestProfit = profitMargins.length > 0 ? Math.max(...profitMargins).toFixed(2) : 0;
656
+ const lowestProfit = profitMargins.length > 0 ? Math.min(...profitMargins).toFixed(2) : 0;
657
+
658
+ // Find highest and lowest invoiced amounts
659
+ const invoicedAmounts = filteredProjects.map(project => project.contractValue);
660
+ const highestInvoiced = Math.max(...invoicedAmounts);
661
+ const lowestInvoiced = Math.min(...invoicedAmounts);
662
+
663
+ // Find shortest and longest durations
664
+ const durations = projectsWithDates.map(project => {
665
+ const start = new Date(project.startDate);
666
+ const end = new Date(project.endDate);
667
+ return (end - start) / (1000 * 60 * 60 * 24);
668
+ });
669
+ const shortestDuration = durations.length > 0 ? Math.min(...durations) : 0;
670
+ const longestDuration = durations.length > 0 ? Math.max(...durations) : 0;
671
+
672
+ // Update the summary cards
673
+ summaryCards.innerHTML = `
674
+ <div class="bg-white rounded-lg shadow p-6">
675
+ <div class="flex justify-between items-start">
676
+ <div>
677
+ <p class="text-gray-500">Total Projects</p>
678
+ <h3 class="text-2xl font-bold">${totalProjects}</h3>
679
+ </div>
680
+ <div class="p-3 rounded-full bg-blue-100 text-blue-600">
681
+ <i class="fas fa-project-diagram text-xl"></i>
682
+ </div>
683
+ </div>
684
+ <div class="mt-4">
685
+ <div class="flex justify-between text-sm text-gray-500">
686
+ <span>Proposals</span>
687
+ <span class="font-medium">${proposalProjects}</span>
688
+ </div>
689
+ <div class="flex justify-between text-sm text-gray-500">
690
+ <span>Awarded</span>
691
+ <span class="font-medium">${awardedProjects}</span>
692
+ </div>
693
+ <div class="flex justify-between text-sm text-gray-500">
694
+ <span>On-going</span>
695
+ <span class="font-medium">${ongoingProjects}</span>
696
+ </div>
697
+ <div class="flex justify-between text-sm text-gray-500">
698
+ <span>Completed</span>
699
+ <span class="font-medium">${completedProjects}</span>
700
+ </div>
701
+ </div>
702
+ </div>
703
+ <div class="bg-white rounded-lg shadow p-6">
704
+ <div class="flex justify-between items-start">
705
+ <div>
706
+ <p class="text-gray-500">Total Contract Value</p>
707
+ <h3 class="text-2xl font-bold">₱${formatNumber(totalContractValue)}</h3>
708
+ </div>
709
+ <div class="p-3 rounded-full bg-green-100 text-green-600">
710
+ <i class="fas fa-file-contract text-xl"></i>
711
+ </div>
712
+ </div>
713
+ <div class="mt-4">
714
+ <div class="flex justify-between text-sm text-gray-500">
715
+ <span>Highest</span>
716
+ <span class="font-medium">₱${formatNumber(highestInvoiced)}</span>
717
+ </div>
718
+ <div class="flex justify-between text-sm text-gray-500">
719
+ <span>Lowest</span>
720
+ <span class="font-medium">₱${formatNumber(lowestInvoiced)}</span>
721
+ </div>
722
+ </div>
723
+ </div>
724
+ <div class="bg-white rounded-lg shadow p-6">
725
+ <div class="flex justify-between items-start">
726
+ <div>
727
+ <p class="text-gray-500">Avg. Project Duration</p>
728
+ <h3 class="text-2xl font-bold">${avgDuration} days</h3>
729
+ </div>
730
+ <div class="p-3 rounded-full bg-purple-100 text-purple-600">
731
+ <i class="fas fa-calendar-alt text-xl"></i>
732
+ </div>
733
+ </div>
734
+ <div class="mt-4">
735
+ <div class="flex justify-between text-sm text-gray-500">
736
+ <span>Shortest</span>
737
+ <span class="font-medium">${shortestDuration} days</span>
738
+ </div>
739
+ <div class="flex justify-between text-sm text-gray-500">
740
+ <span>Longest</span>
741
+ <span class="font-medium">${longestDuration} days</span>
742
+ </div>
743
+ </div>
744
+ </div>
745
+ <div class="bg-white rounded-lg shadow p-6">
746
+ <div class="flex justify-between items-start">
747
+ <div>
748
+ <p class="text-gray-500">Avg. Profit Margin</p>
749
+ <h3 class="text-2xl font-bold">${avgProfitMargin}%</h3>
750
+ </div>
751
+ <div class="p-3 rounded-full bg-orange-100 text-orange-600">
752
+ <i class="fas fa-chart-pie text-xl"></i>
753
+ </div>
754
+ </div>
755
+ <div class="mt-4">
756
+ <div class="flex justify-between text-sm text-gray-500">
757
+ <span>Highest</span>
758
+ <span class="font-medium profit-positive">${highestProfit}%</span>
759
+ </div>
760
+ <div class="flex justify-between text-sm text-gray-500">
761
+ <span>Lowest</span>
762
+ <span class="font-medium profit-negative">${lowestProfit}%</span>
763
+ </div>
764
+ </div>
765
+ </div>
766
+ `;
767
+ }
768
+
769
+ // Filter projects based on search term
770
+ function filterProjects(searchTerm = '', filterType = currentFilter) {
771
+ currentFilter = filterType;
772
+
773
+ filteredProjects = projects.filter(project => {
774
+ // Apply type filter
775
+ const typeMatch = filterType === 'all' ||
776
+ (filterType === 'custom' ? !['commercial', 'residential', 'industrial'].includes(project.type) :
777
+ project.type === filterType);
778
+
779
+ // Apply search term filter
780
+ const searchMatch =
781
+ project.name.toLowerCase().includes(searchTerm.toLowerCase()) ||
782
+ project.code.toLowerCase().includes(searchTerm.toLowerCase()) ||
783
+ project.client.toLowerCase().includes(searchTerm.toLowerCase()) ||
784
+ project.contact.toLowerCase().includes(searchTerm.toLowerCase());
785
+
786
+ return typeMatch && searchMatch;
787
+ });
788
+
789
+ renderProjects();
790
+ }
791
+
792
+ // Helper functions
793
+ function formatNumber(num) {
794
+ return num.toFixed(2).replace(/\B(?=(\d{3})+(?!\d))/g, ",");
795
+ }
796
+
797
+ function formatDate(dateString) {
798
+ if (!dateString) return "";
799
+ const options = { year: 'numeric', month: 'short', day: 'numeric' };
800
+ return new Date(dateString).toLocaleDateString(undefined, options);
801
+ }
802
+
803
+ function getProjectIcon(type) {
804
+ switch(type) {
805
+ case 'commercial': return 'fas fa-building';
806
+ case 'residential': return 'fas fa-home';
807
+ case 'industrial': return 'fas fa-warehouse';
808
+ default: return 'fas fa-project-diagram';
809
+ }
810
+ }
811
+
812
+ function getProjectIconClass(type) {
813
+ switch(type) {
814
+ case 'commercial': return 'bg-blue-100 text-blue-600';
815
+ case 'residential': return 'bg-green-100 text-green-600';
816
+ case 'industrial': return 'bg-yellow-100 text-yellow-600';
817
+ default: return 'bg-gray-100 text-gray-600';
818
+ }
819
+ }
820
+
821
+ function getProgressBarColor(progress) {
822
+ if (progress >= 80) return 'bg-green-500';
823
+ if (progress >= 50) return 'bg-blue-500';
824
+ return 'bg-yellow-500';
825
+ }
826
+
827
+ function calculateDaysLeft(endDate) {
828
+ if (!endDate) return 0;
829
+ const today = new Date();
830
+ const end = new Date(endDate);
831
+ const diffTime = end - today;
832
+ const diffDays = Math.ceil(diffTime / (1000 * 60 * 60 * 24));
833
+ return diffDays > 0 ? diffDays : 0;
834
+ }
835
+
836
+ function calculateStatus(progress, daysLeft, originalDays, spent, budget) {
837
+ // Only calculate status for ongoing projects
838
+ if (progress <= 0) return { status: "Not Started", class: "status-not-started" };
839
+ if (progress >= 100) return { status: "Completed", class: "status-completed" };
840
+
841
+ // Calculate time status
842
+ const progressRatio = progress / 100;
843
+ const timeRatio = 1 - (daysLeft / originalDays);
844
+
845
+ let timeStatus = "";
846
+ if (progressRatio > timeRatio + 0.2) {
847
+ timeStatus = "Ahead of Time";
848
+ } else if (progressRatio < timeRatio - 0.2) {
849
+ timeStatus = "Behind Time";
850
+ } else {
851
+ timeStatus = "On Time";
852
+ }
853
+
854
+ // Calculate budget status
855
+ let budgetStatus = "";
856
+ if (spent > budget * 1.1) { // 10% over budget
857
+ budgetStatus = "Over Budget";
858
+ } else if (spent < budget * 0.9) { // 10% under budget
859
+ budgetStatus = "Under Budget";
860
+ } else {
861
+ budgetStatus = "On Budget";
862
+ }
863
+
864
+ // Combine statuses
865
+ if (budgetStatus === "On Budget" && timeStatus === "On Time") {
866
+ return { status: "On Budget & Time", class: "status-budget-time" };
867
+ } else if (budgetStatus === "Over Budget" && timeStatus === "Behind Time") {
868
+ return { status: "Over Budget & Time", class: "status-over" };
869
+ } else if (budgetStatus === "On Budget") {
870
+ return { status: timeStatus, class: timeStatus === "Ahead of Time" ? "status-time" : "status-budget" };
871
+ } else if (timeStatus === "On Time") {
872
+ return { status: budgetStatus, class: "status-budget" };
873
+ } else {
874
+ return { status: `${budgetStatus}, ${timeStatus}`, class: "status-budget-time" };
875
+ }
876
+ }
877
+
878
+ // Set up event listeners
879
+ function setupEventListeners() {
880
+ // Toggle sidebar
881
+ document.getElementById('toggleSidebar').addEventListener('click', function() {
882
+ document.querySelector('.sidebar').classList.toggle('collapsed');
883
+ });
884
+
885
+ // Search input
886
+ projectSearch.addEventListener('input', (e) => {
887
+ filterProjects(e.target.value, currentFilter);
888
+ });
889
+
890
+ // Filter buttons
891
+ allFilter.addEventListener('click', () => {
892
+ currentFilter = 'all';
893
+ updateFilterButtons();
894
+ filterProjects(projectSearch.value, 'all');
895
+ });
896
+
897
+ commercialFilter.addEventListener('click', () => {
898
+ currentFilter = 'commercial';
899
+ updateFilterButtons();
900
+ filterProjects(projectSearch.value, 'commercial');
901
+ });
902
+
903
+ residentialFilter.addEventListener('click', () => {
904
+ currentFilter = 'residential';
905
+ updateFilterButtons();
906
+ filterProjects(projectSearch.value, 'residential');
907
+ });
908
+
909
+ industrialFilter.addEventListener('click', () => {
910
+ currentFilter = 'industrial';
911
+ updateFilterButtons();
912
+ filterProjects(projectSearch.value, 'industrial');
913
+ });
914
+
915
+ customFilter.addEventListener('click', () => {
916
+ currentFilter = 'custom';
917
+ updateFilterButtons();
918
+ filterProjects(projectSearch.value, 'custom');
919
+ });
920
+
921
+ // New Project Modal
922
+ const newProjectBtn = document.getElementById('newProjectBtn');
923
+ const closeModal = document.getElementById('closeModal');
924
+ const cancelProject = document.getElementById('cancelProject');
925
+ const projectForm = document.getElementById('projectForm');
926
+ const projectTypeSelect = document.getElementById('projectType');
927
+ const customProjectTypeInput = document.getElementById('customProjectType');
928
+
929
+ // Show/hide custom project type input based on selection
930
+ projectTypeSelect.addEventListener('change', function() {
931
+ if (this.value === 'custom') {
932
+ customProjectTypeInput.classList.remove('hidden');
933
+ customProjectTypeInput.required = true;
934
+ } else {
935
+ customProjectTypeInput.classList.add('hidden');
936
+ customProjectTypeInput.required = false;
937
+ }
938
+ });
939
+
940
+ newProjectBtn.addEventListener('click', () => {
941
+ newProjectModal.classList.remove('hidden');
942
+ });
943
+
944
+ closeModal.addEventListener('click', () => {
945
+ newProjectModal.classList.add('hidden');
946
+ });
947
+
948
+ cancelProject.addEventListener('click', () => {
949
+ newProjectModal.classList.add('hidden');
950
+ });
951
+
952
+ projectForm.addEventListener('submit', (e) => {
953
+ e.preventDefault();
954
+
955
+ // Get form values with defaults for empty fields
956
+ const name = document.getElementById('projectName').value || 'Unnamed Project';
957
+ const code = document.getElementById('projectCode').value || 'PROJ-' + new Date().getFullYear() + '-' + (projects.length + 1).toString().padStart(3, '0');
958
+ const client = document.getElementById('clientName').value || 'Unknown Client';
959
+ const contact = document.getElementById('clientContact').value || 'N/A';
960
+ const contractValue = parseFloat(document.getElementById('contractValue').value) || 0;
961
+ const budget = parseFloat(document.getElementById('projectBudget').value) || 0;
962
+ const spent = parseFloat(document.getElementById('projectSpent').value) || 0;
963
+ const progress = parseFloat(document.getElementById('projectProgress').value) || 0;
964
+ const startDate = document.getElementById('startDate').value || '';
965
+ const endDate = document.getElementById('endDate').value || '';
966
+ const phase = document.getElementById('projectPhase').value || 'proposal';
967
+ const awardDate = document.getElementById('awardDate').value || '';
968
+ let type = document.getElementById('projectType').value || 'commercial';
969
+ const description = document.getElementById('projectDescription').value || 'No description provided';
970
+
971
+ // If custom type is selected, use the custom input value
972
+ if (type === 'custom') {
973
+ type = document.getElementById('customProjectType').value || 'custom';
974
+ // Add to custom project types if not already there
975
+ if (!customProjectTypes.includes(type)) {
976
+ customProjectTypes.push(type);
977
+ }
978
+ }
979
+
980
+ // Calculate profit margin
981
+ const profitMargin = ((contractValue - spent) / contractValue) * 100;
982
+
983
+ // Calculate days left
984
+ const daysLeft = calculateDaysLeft(endDate);
985
+
986
+ // Calculate original duration if dates are available
987
+ let originalDays = 0;
988
+ if (startDate && endDate) {
989
+ const start = new Date(startDate);
990
+ const end = new Date(endDate);
991
+ originalDays = (end - start) / (1000 * 60 * 60 * 24);
992
+ }
993
+
994
+ // Determine status based on phase
995
+ let statusInfo;
996
+ if (phase === "proposal") {
997
+ statusInfo = { status: "Proposal", class: "status-proposal" };
998
+ } else if (phase === "awarded") {
999
+ statusInfo = { status: "Awarded (Not Started)", class: "status-awarded" };
1000
+ } else if (phase === "completed") {
1001
+ statusInfo = { status: "Completed", class: "status-completed" };
1002
+ } else {
1003
+ // For ongoing projects, calculate budget/time status
1004
+ statusInfo = calculateStatus(progress, daysLeft, originalDays, spent, budget);
1005
+ }
1006
+
1007
+ // Create new project
1008
+ const newProject = {
1009
+ id: projects.length > 0 ? Math.max(...projects.map(p => p.id)) + 1 : 1,
1010
+ name,
1011
+ code,
1012
+ client,
1013
+ contact,
1014
+ type,
1015
+ contractValue,
1016
+ budget,
1017
+ spent,
1018
+ profitMargin,
1019
+ progress,
1020
+ startDate,
1021
+ endDate,
1022
+ phase,
1023
+ awardDate,
1024
+ daysLeft,
1025
+ status: statusInfo.status,
1026
+ statusClass: statusInfo.class,
1027
+ description
1028
+ };
1029
+
1030
+ // Add to projects array
1031
+ projects.push(newProject);
1032
+
1033
+ // Reset form and close modal
1034
+ projectForm.reset();
1035
+ newProjectModal.classList.add('hidden');
1036
+
1037
+ // Re-render projects
1038
+ filterProjects(projectSearch.value, currentFilter);
1039
+ });
1040
+
1041
+ // Edit Project Modal
1042
+ const closeEditModal = document.getElementById('closeEditModal');
1043
+ const cancelEditProject = document.getElementById('cancelEditProject');
1044
+ const editProjectForm = document.getElementById('editProjectForm');
1045
+ const editProjectTypeSelect = document.getElementById('editProjectType');
1046
+ const editCustomProjectTypeInput = document.getElementById('editCustomProjectType');
1047
+
1048
+ // Show/hide custom project type input based on selection
1049
+ editProjectTypeSelect.addEventListener('change', function() {
1050
+ if (this.value === 'custom') {
1051
+ editCustomProjectTypeInput.classList.remove('hidden');
1052
+ editCustomProjectTypeInput.required = true;
1053
+ } else {
1054
+ editCustomProjectTypeInput.classList.add('hidden');
1055
+ editCustomProjectTypeInput.required = false;
1056
+ }
1057
+ });
1058
+
1059
+ closeEditModal.addEventListener('click', () => {
1060
+ editProjectModal.classList.add('hidden');
1061
+ });
1062
+
1063
+ cancelEditProject.addEventListener('click', () => {
1064
+ editProjectModal.classList.add('hidden');
1065
+ });
1066
+
1067
+ editProjectForm.addEventListener('submit', (e) => {
1068
+ e.preventDefault();
1069
+
1070
+ // Get form values with defaults
1071
+ const id = parseInt(document.getElementById('editProjectId').value);
1072
+ const name = document.getElementById('editProjectName').value || 'Unnamed Project';
1073
+ const code = document.getElementById('editProjectCode').value || 'PROJ-' + new Date().getFullYear() + '-' + id.toString().padStart(3, '0');
1074
+ const client = document.getElementById('editClientName').value || 'Unknown Client';
1075
+ const contact = document.getElementById('editClientContact').value || 'N/A';
1076
+ const contractValue = parseFloat(document.getElementById('editContractValue').value) || 0;
1077
+ const budget = parseFloat(document.getElementById('editProjectBudget').value) || 0;
1078
+ const spent = parseFloat(document.getElementById('editProjectSpent').value) || 0;
1079
+ const progress = parseFloat(document.getElementById('editProjectProgress').value) || 0;
1080
+ const startDate = document.getElementById('editStartDate').value || '';
1081
+ const endDate = document.getElementById('editEndDate').value || '';
1082
+ const phase = document.getElementById('editProjectPhase').value || 'proposal';
1083
+ const awardDate = document.getElementById('editAwardDate').value || '';
1084
+ let type = document.getElementById('editProjectType').value || 'commercial';
1085
+ const description = document.getElementById('editProjectDescription').value || 'No description provided';
1086
+
1087
+ // If custom type is selected, use the custom input value
1088
+ if (type === 'custom') {
1089
+ type = document.getElementById('editCustomProjectType').value || 'custom';
1090
+ // Add to custom project types if not already there
1091
+ if (!customProjectTypes.includes(type)) {
1092
+ customProjectTypes.push(type);
1093
+ }
1094
+ }
1095
+
1096
+ // Calculate profit margin
1097
+ const profitMargin = ((contractValue - spent) / contractValue) * 100;
1098
+
1099
+ // Calculate days left
1100
+ const daysLeft = calculateDaysLeft(endDate);
1101
+
1102
+ // Calculate original duration if dates are available
1103
+ let originalDays = 0;
1104
+ if (startDate && endDate) {
1105
+ const start = new Date(startDate);
1106
+ const end = new Date(endDate);
1107
+ originalDays = (end - start) / (1000 * 60 * 60 * 24);
1108
+ }
1109
+
1110
+ // Determine status based on phase
1111
+ let statusInfo;
1112
+ if (phase === "proposal") {
1113
+ statusInfo = { status: "Proposal", class: "status-proposal" };
1114
+ } else if (phase === "awarded") {
1115
+ statusInfo = { status: "Awarded (Not Started)", class: "status-awarded" };
1116
+ } else if (phase === "completed") {
1117
+ statusInfo = { status: "Completed", class: "status-completed" };
1118
+ } else {
1119
+ // For ongoing projects, calculate budget/time status
1120
+ statusInfo = calculateStatus(progress, daysLeft, originalDays, spent, budget);
1121
+ }
1122
+
1123
+ // Find and update project
1124
+ const projectIndex = projects.findIndex(p => p.id === id);
1125
+ if (projectIndex !== -1) {
1126
+ projects[projectIndex] = {
1127
+ ...projects[projectIndex],
1128
+ name,
1129
+ code,
1130
+ client,
1131
+ contact,
1132
+ type,
1133
+ contractValue,
1134
+ budget,
1135
+ spent,
1136
+ profitMargin,
1137
+ progress,
1138
+ startDate,
1139
+ endDate,
1140
+ phase,
1141
+ awardDate,
1142
+ daysLeft,
1143
+ status: statusInfo.status,
1144
+ statusClass: statusInfo.class,
1145
+ description
1146
+ };
1147
+ }
1148
+
1149
+ // Close modal
1150
+ editProjectModal.classList.add('hidden');
1151
+
1152
+ // Re-render projects
1153
+ filterProjects(projectSearch.value, currentFilter);
1154
+ });
1155
+
1156
+ // Delete Project Modal
1157
+ const closeDeleteModal = document.getElementById('closeDeleteModal');
1158
+ const cancelDeleteProject = document.getElementById('cancelDeleteProject');
1159
+ const confirmDeleteProject = document.getElementById('confirmDeleteProject');
1160
+
1161
+ closeDeleteModal.addEventListener('click', () => {
1162
+ deleteProjectModal.classList.add('hidden');
1163
+ });
1164
+
1165
+ cancelDeleteProject.addEventListener('click', () => {
1166
+ deleteProjectModal.classList.add('hidden');
1167
+ });
1168
+
1169
+ confirmDeleteProject.addEventListener('click', () => {
1170
+ if (projectToDelete) {
1171
+ // Remove project from array
1172
+ projects = projects.filter(p => p.id !== projectToDelete.id);
1173
+
1174
+ // Close modal
1175
+ deleteProjectModal.classList.add('hidden');
1176
+
1177
+ // Re-render projects
1178
+ filterProjects(projectSearch.value, currentFilter);
1179
+ }
1180
+ });
1181
+
1182
+ // Edit and Delete buttons (delegated since rows are dynamic)
1183
+ projectsTableBody.addEventListener('click', (e) => {
1184
+ if (e.target.closest('.edit-project')) {
1185
+ const projectId = parseInt(e.target.closest('.edit-project').getAttribute('data-id'));
1186
+ const project = projects.find(p => p.id === projectId);
1187
+
1188
+ // Fill edit form with project data
1189
+ document.getElementById('editProjectId').value = project.id;
1190
+ document.getElementById('editProjectName').value = project.name;
1191
+ document.getElementById('editProjectCode').value = project.code;
1192
+ document.getElementById('editClientName').value = project.client;
1193
+ document.getElementById('editClientContact').value = project.contact;
1194
+ document.getElementById('editContractValue').value = project.contractValue;
1195
+ document.getElementById('editProjectBudget').value = project.budget;
1196
+ document.getElementById('editProjectSpent').value = project.spent;
1197
+ document.getElementById('editProjectProgress').value = project.progress;
1198
+ document.getElementById('editStartDate').value = project.startDate;
1199
+ document.getElementById('editEndDate').value = project.endDate;
1200
+ document.getElementById('editProjectPhase').value = project.phase;
1201
+ document.getElementById('editAwardDate').value = project.awardDate;
1202
+
1203
+ // Handle project type (check if it's custom)
1204
+ if (['commercial', 'residential', 'industrial'].includes(project.type)) {
1205
+ document.getElementById('editProjectType').value = project.type;
1206
+ document.getElementById('editCustomProjectType').classList.add('hidden');
1207
+ } else {
1208
+ document.getElementById('editProjectType').value = 'custom';
1209
+ document.getElementById('editCustomProjectType').value = project.type;
1210
+ document.getElementById('editCustomProjectType').classList.remove('hidden');
1211
+ }
1212
+
1213
+ document.getElementById('editProjectDescription').value = project.description || '';
1214
+
1215
+ // Show edit modal
1216
+ editProjectModal.classList.remove('hidden');
1217
+ }
1218
+
1219
+ if (e.target.closest('.delete-project')) {
1220
+ const projectId = parseInt(e.target.closest('.delete-project').getAttribute('data-id'));
1221
+ projectToDelete = projects.find(p => p.id === projectId);
1222
+
1223
+ // Set project name in confirmation modal
1224
+ document.getElementById('projectToDeleteName').textContent = projectToDelete.name;
1225
+
1226
+ // Show delete modal
1227
+ deleteProjectModal.classList.remove('hidden');
1228
+ }
1229
+ });
1230
+ }
1231
+
1232
+ // Update filter button styles
1233
+ function updateFilterButtons() {
1234
+ allFilter.className = `px-3 py-1 text-xs rounded ${currentFilter === 'all' ? 'bg-blue-100 text-blue-600' : 'bg-gray-100 text-gray-600'}`;
1235
+ commercialFilter.className = `px-3 py-1 text-xs rounded ${currentFilter === 'commercial' ? 'bg-blue-100 text-blue-600' : 'bg-gray-100 text-gray-600'}`;
1236
+ residentialFilter.className = `px-3 py-1 text-xs rounded ${currentFilter === 'residential' ? 'bg-blue-100 text-blue-600' : 'bg-gray-100 text-gray-600'}`;
1237
+ industrialFilter.className = `px-3 py-1 text-xs rounded ${currentFilter === 'industrial' ? 'bg-blue-100 text-blue-600' : 'bg-gray-100 text-gray-600'}`;
1238
+ customFilter.className = `px-3 py-1 text-xs rounded ${currentFilter === 'custom' ? 'bg-blue-100 text-blue-600' : 'bg-gray-100 text-gray-600'}`;
1239
+ }
1240
+ </script>
1241
+ <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=poluser/eps-test" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body>
1242
+ </html>
prompts.txt ADDED
File without changes