Add 3 files
Browse files- README.md +6 -4
- index.html +573 -18
- prompts.txt +1 -0
README.md
CHANGED
|
@@ -1,10 +1,12 @@
|
|
| 1 |
---
|
| 2 |
-
title:
|
| 3 |
-
emoji:
|
| 4 |
colorFrom: gray
|
| 5 |
-
colorTo:
|
| 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: penalty
|
| 3 |
+
emoji: 🐳
|
| 4 |
colorFrom: gray
|
| 5 |
+
colorTo: red
|
| 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,574 @@
|
|
| 1 |
-
<!
|
| 2 |
-
<html>
|
| 3 |
-
|
| 4 |
-
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
| 5 |
+
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
| 6 |
+
<title>Penalty Contractor Recorder</title>
|
| 7 |
+
<style>
|
| 8 |
+
@import url('https://fonts.googleapis.com/css2?family=Roboto:wght@400;700&display=swap');
|
| 9 |
+
|
| 10 |
+
* {
|
| 11 |
+
box-sizing: border-box;
|
| 12 |
+
}
|
| 13 |
+
|
| 14 |
+
body {
|
| 15 |
+
font-family: 'Roboto', sans-serif;
|
| 16 |
+
background: #f4f7fb;
|
| 17 |
+
margin: 0;
|
| 18 |
+
padding: 0;
|
| 19 |
+
min-height: 100vh;
|
| 20 |
+
color: #333;
|
| 21 |
+
}
|
| 22 |
+
|
| 23 |
+
.container {
|
| 24 |
+
max-width: 900px;
|
| 25 |
+
width: 100%;
|
| 26 |
+
background: #fff;
|
| 27 |
+
margin: 40px auto 60px;
|
| 28 |
+
padding: 30px 40px;
|
| 29 |
+
border-radius: 10px;
|
| 30 |
+
box-shadow: 0 10px 25px rgba(0,0,0,0.1);
|
| 31 |
+
}
|
| 32 |
+
|
| 33 |
+
h1 {
|
| 34 |
+
text-align: center;
|
| 35 |
+
color: #1976d2;
|
| 36 |
+
margin-bottom: 30px;
|
| 37 |
+
}
|
| 38 |
+
|
| 39 |
+
/* Tabs */
|
| 40 |
+
.tabs {
|
| 41 |
+
display: flex;
|
| 42 |
+
border-bottom: 3px solid #1976d2;
|
| 43 |
+
margin-bottom: 25px;
|
| 44 |
+
}
|
| 45 |
+
|
| 46 |
+
.tab {
|
| 47 |
+
flex: 1;
|
| 48 |
+
padding: 15px 0;
|
| 49 |
+
text-align: center;
|
| 50 |
+
font-weight: 700;
|
| 51 |
+
color: #1976d2;
|
| 52 |
+
cursor: pointer;
|
| 53 |
+
border-bottom: 3px solid transparent;
|
| 54 |
+
transition: border-color 0.3s, background-color 0.3s;
|
| 55 |
+
user-select: none;
|
| 56 |
+
}
|
| 57 |
+
|
| 58 |
+
.tab.active {
|
| 59 |
+
border-bottom-color: #1976d2;
|
| 60 |
+
background-color: #e6f0fa;
|
| 61 |
+
}
|
| 62 |
+
|
| 63 |
+
/* Form Styling */
|
| 64 |
+
form {
|
| 65 |
+
display: grid;
|
| 66 |
+
grid-template-columns: 1fr 1fr;
|
| 67 |
+
gap: 20px 30px;
|
| 68 |
+
}
|
| 69 |
+
|
| 70 |
+
label {
|
| 71 |
+
font-weight: 700;
|
| 72 |
+
margin-bottom: 8px;
|
| 73 |
+
display: block;
|
| 74 |
+
color: #444;
|
| 75 |
+
}
|
| 76 |
+
|
| 77 |
+
input[type="text"],
|
| 78 |
+
input[type="date"],
|
| 79 |
+
input[type="number"],
|
| 80 |
+
textarea,
|
| 81 |
+
input[type="file"] {
|
| 82 |
+
width: 100%;
|
| 83 |
+
padding: 8px 12px;
|
| 84 |
+
border: 2px solid #ddd;
|
| 85 |
+
border-radius: 6px;
|
| 86 |
+
font-size: 1rem;
|
| 87 |
+
transition: border-color 0.3s;
|
| 88 |
+
}
|
| 89 |
+
|
| 90 |
+
input[type="text"]:focus,
|
| 91 |
+
input[type="date"]:focus,
|
| 92 |
+
input[type="number"]:focus,
|
| 93 |
+
textarea:focus,
|
| 94 |
+
input[type="file"]:focus {
|
| 95 |
+
border-color: #1976d2;
|
| 96 |
+
outline: none;
|
| 97 |
+
}
|
| 98 |
+
|
| 99 |
+
textarea {
|
| 100 |
+
resize: vertical;
|
| 101 |
+
min-height: 60px;
|
| 102 |
+
}
|
| 103 |
+
|
| 104 |
+
.full-width {
|
| 105 |
+
grid-column: 1 / -1;
|
| 106 |
+
}
|
| 107 |
+
|
| 108 |
+
button {
|
| 109 |
+
grid-column: 1 / -1;
|
| 110 |
+
background-color: #1976d2;
|
| 111 |
+
color: white;
|
| 112 |
+
border: none;
|
| 113 |
+
padding: 14px;
|
| 114 |
+
font-size: 1.1rem;
|
| 115 |
+
border-radius: 8px;
|
| 116 |
+
cursor: pointer;
|
| 117 |
+
font-weight: 600;
|
| 118 |
+
transition: background-color 0.3s;
|
| 119 |
+
}
|
| 120 |
+
|
| 121 |
+
button:hover {
|
| 122 |
+
background-color: #155a9f;
|
| 123 |
+
}
|
| 124 |
+
|
| 125 |
+
/* Penalty list and filter styling */
|
| 126 |
+
.penalty-list {
|
| 127 |
+
margin-top: 10px;
|
| 128 |
+
}
|
| 129 |
+
.penalty-list h2 {
|
| 130 |
+
color: #1976d2;
|
| 131 |
+
border-bottom: 2px solid #1976d2;
|
| 132 |
+
padding-bottom: 8px;
|
| 133 |
+
margin-bottom: 10px;
|
| 134 |
+
}
|
| 135 |
+
table {
|
| 136 |
+
width: 100%;
|
| 137 |
+
border-collapse: collapse;
|
| 138 |
+
margin-top: 12px;
|
| 139 |
+
}
|
| 140 |
+
th, td {
|
| 141 |
+
text-align: left;
|
| 142 |
+
padding: 12px 15px;
|
| 143 |
+
border-bottom: 1px solid #ddd;
|
| 144 |
+
vertical-align: middle;
|
| 145 |
+
}
|
| 146 |
+
th {
|
| 147 |
+
background-color: #1976d2;
|
| 148 |
+
color: white;
|
| 149 |
+
text-transform: uppercase;
|
| 150 |
+
font-weight: 700;
|
| 151 |
+
}
|
| 152 |
+
tr:hover {
|
| 153 |
+
background-color: #f1f9ff;
|
| 154 |
+
}
|
| 155 |
+
.btn-delete {
|
| 156 |
+
background-color: #e53935;
|
| 157 |
+
color: white;
|
| 158 |
+
border: none;
|
| 159 |
+
padding: 6px 10px;
|
| 160 |
+
border-radius: 5px;
|
| 161 |
+
cursor: pointer;
|
| 162 |
+
font-weight: 700;
|
| 163 |
+
transition: background-color 0.3s;
|
| 164 |
+
}
|
| 165 |
+
.btn-delete:hover {
|
| 166 |
+
background-color: #b71c1c;
|
| 167 |
+
}
|
| 168 |
+
|
| 169 |
+
/* Filters */
|
| 170 |
+
.filters {
|
| 171 |
+
margin-bottom: 20px;
|
| 172 |
+
display: grid;
|
| 173 |
+
grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
|
| 174 |
+
gap: 15px 20px;
|
| 175 |
+
}
|
| 176 |
+
|
| 177 |
+
.filters label {
|
| 178 |
+
font-weight: 600;
|
| 179 |
+
margin-bottom: 4px;
|
| 180 |
+
}
|
| 181 |
+
|
| 182 |
+
.filters input[type="text"],
|
| 183 |
+
.filters input[type="date"],
|
| 184 |
+
.filters input[type="number"] {
|
| 185 |
+
padding: 6px 10px;
|
| 186 |
+
font-size: 0.95rem;
|
| 187 |
+
border-radius: 5px;
|
| 188 |
+
border: 1.5px solid #ccc;
|
| 189 |
+
transition: border-color 0.3s;
|
| 190 |
+
}
|
| 191 |
+
|
| 192 |
+
.filters input[type="text"]:focus,
|
| 193 |
+
.filters input[type="date"]:focus,
|
| 194 |
+
.filters input[type="number"]:focus {
|
| 195 |
+
border-color: #1976d2;
|
| 196 |
+
outline: none;
|
| 197 |
+
}
|
| 198 |
+
|
| 199 |
+
/* Responsive */
|
| 200 |
+
@media (max-width: 600px) {
|
| 201 |
+
form {
|
| 202 |
+
grid-template-columns: 1fr;
|
| 203 |
+
}
|
| 204 |
+
.filters {
|
| 205 |
+
grid-template-columns: 1fr;
|
| 206 |
+
}
|
| 207 |
+
}
|
| 208 |
+
|
| 209 |
+
.filename-display {
|
| 210 |
+
margin-top: 4px;
|
| 211 |
+
font-size: 0.9rem;
|
| 212 |
+
color: #1976d2;
|
| 213 |
+
font-style: italic;
|
| 214 |
+
}
|
| 215 |
+
|
| 216 |
+
.no-data {
|
| 217 |
+
text-align: center;
|
| 218 |
+
margin-top: 20px;
|
| 219 |
+
color: #777;
|
| 220 |
+
font-style: italic;
|
| 221 |
+
}
|
| 222 |
+
</style>
|
| 223 |
+
</head>
|
| 224 |
+
<body>
|
| 225 |
+
<div class="container">
|
| 226 |
+
<h1>Penalty Contractor Recorder</h1>
|
| 227 |
+
<div class="tabs">
|
| 228 |
+
<div class="tab active" data-tab="add">Add Penalty</div>
|
| 229 |
+
<div class="tab" data-tab="history">Historical Data</div>
|
| 230 |
+
</div>
|
| 231 |
+
|
| 232 |
+
<!-- Add Penalty Tab -->
|
| 233 |
+
<div id="tab-add" class="tab-content">
|
| 234 |
+
<form id="penaltyForm" autocomplete="off">
|
| 235 |
+
<div>
|
| 236 |
+
<label for="contractorName">Contractor Name *</label>
|
| 237 |
+
<input type="text" id="contractorName" name="contractorName" required placeholder="John Doe" />
|
| 238 |
+
</div>
|
| 239 |
+
<div>
|
| 240 |
+
<label for="companyName">Company Name *</label>
|
| 241 |
+
<input type="text" id="companyName" name="companyName" required placeholder="Acme Construction" />
|
| 242 |
+
</div>
|
| 243 |
+
<div>
|
| 244 |
+
<label for="penaltyDate">Penalty Date *</label>
|
| 245 |
+
<input type="date" id="penaltyDate" name="penaltyDate" required />
|
| 246 |
+
</div>
|
| 247 |
+
<div>
|
| 248 |
+
<label for="penaltyAmount">Penalty Amount ($) *</label>
|
| 249 |
+
<input type="number" id="penaltyAmount" name="penaltyAmount" min="0" step="0.01" required placeholder="100.00" />
|
| 250 |
+
</div>
|
| 251 |
+
<div class="full-width">
|
| 252 |
+
<label for="penaltyReason">Penalty Reason *</label>
|
| 253 |
+
<textarea id="penaltyReason" name="penaltyReason" required placeholder="Describe the reason for penalty"></textarea>
|
| 254 |
+
</div>
|
| 255 |
+
<div class="full-width">
|
| 256 |
+
<label for="penaltyDocument">Upload Document</label>
|
| 257 |
+
<input type="file" id="penaltyDocument" name="penaltyDocument" accept=".pdf,.doc,.docx,.xls,.xlsx,.png,.jpg,.jpeg,.txt" />
|
| 258 |
+
<div id="fileNameDisplay" class="filename-display" aria-live="polite"></div>
|
| 259 |
+
</div>
|
| 260 |
+
<div class="full-width">
|
| 261 |
+
<button type="submit">Add Penalty Record</button>
|
| 262 |
+
</div>
|
| 263 |
+
</form>
|
| 264 |
+
</div>
|
| 265 |
+
|
| 266 |
+
<!-- Historical Data Tab -->
|
| 267 |
+
<div id="tab-history" class="tab-content" style="display:none;">
|
| 268 |
+
<div class="filters" aria-label="Filters for penalty records">
|
| 269 |
+
<div>
|
| 270 |
+
<label for="filterContractor">Contractor Name</label>
|
| 271 |
+
<input type="text" id="filterContractor" placeholder="Filter by contractor" />
|
| 272 |
+
</div>
|
| 273 |
+
<div>
|
| 274 |
+
<label for="filterCompany">Company Name</label>
|
| 275 |
+
<input type="text" id="filterCompany" placeholder="Filter by company" />
|
| 276 |
+
</div>
|
| 277 |
+
<div>
|
| 278 |
+
<label for="filterDateFrom">Date From</label>
|
| 279 |
+
<input type="date" id="filterDateFrom" />
|
| 280 |
+
</div>
|
| 281 |
+
<div>
|
| 282 |
+
<label for="filterDateTo">Date To</label>
|
| 283 |
+
<input type="date" id="filterDateTo" />
|
| 284 |
+
</div>
|
| 285 |
+
<div>
|
| 286 |
+
<label for="filterAmountMin">Min Amount ($)</label>
|
| 287 |
+
<input type="number" id="filterAmountMin" min="0" step="0.01" placeholder="0.00" />
|
| 288 |
+
</div>
|
| 289 |
+
<div>
|
| 290 |
+
<label for="filterAmountMax">Max Amount ($)</label>
|
| 291 |
+
<input type="number" id="filterAmountMax" min="0" step="0.01" placeholder="0.00" />
|
| 292 |
+
</div>
|
| 293 |
+
</div>
|
| 294 |
+
|
| 295 |
+
<section class="penalty-list" id="penaltyListSection">
|
| 296 |
+
<h2>Recorded Penalties</h2>
|
| 297 |
+
<table id="penaltyTable" aria-live="polite" aria-relevant="all">
|
| 298 |
+
<thead>
|
| 299 |
+
<tr>
|
| 300 |
+
<th>Contractor</th>
|
| 301 |
+
<th>Company</th>
|
| 302 |
+
<th>Date</th>
|
| 303 |
+
<th>Amount ($)</th>
|
| 304 |
+
<th>Reason</th>
|
| 305 |
+
<th>Document</th>
|
| 306 |
+
<th>Actions</th>
|
| 307 |
+
</tr>
|
| 308 |
+
</thead>
|
| 309 |
+
<tbody id="penaltyTableBody"></tbody>
|
| 310 |
+
</table>
|
| 311 |
+
<div id="noDataMessage" class="no-data" style="display:none;">No penalty records to display.</div>
|
| 312 |
+
</section>
|
| 313 |
+
</div>
|
| 314 |
+
</div>
|
| 315 |
+
|
| 316 |
+
<script>
|
| 317 |
+
(function() {
|
| 318 |
+
const tabs = [...document.querySelectorAll('.tab')];
|
| 319 |
+
const tabContents = {
|
| 320 |
+
add: document.getElementById('tab-add'),
|
| 321 |
+
history: document.getElementById('tab-history')
|
| 322 |
+
};
|
| 323 |
+
|
| 324 |
+
function switchTab(selectedTab) {
|
| 325 |
+
tabs.forEach(tab => {
|
| 326 |
+
const isActive = tab.dataset.tab === selectedTab;
|
| 327 |
+
tab.classList.toggle('active', isActive);
|
| 328 |
+
tabContents[tab.dataset.tab].style.display = isActive ? 'block' : 'none';
|
| 329 |
+
});
|
| 330 |
+
// When switching to history tab, render penalties with current filters
|
| 331 |
+
if (selectedTab === 'history') {
|
| 332 |
+
renderPenalties();
|
| 333 |
+
}
|
| 334 |
+
}
|
| 335 |
+
|
| 336 |
+
tabs.forEach(tab => {
|
| 337 |
+
tab.addEventListener('click', () => {
|
| 338 |
+
switchTab(tab.dataset.tab);
|
| 339 |
+
});
|
| 340 |
+
});
|
| 341 |
+
|
| 342 |
+
// LocalStorage key
|
| 343 |
+
const STORAGE_KEY = 'penaltyRecords';
|
| 344 |
+
|
| 345 |
+
// Retrieve records from localStorage or initialize empty array
|
| 346 |
+
let penaltyRecords = JSON.parse(localStorage.getItem(STORAGE_KEY)) || [];
|
| 347 |
+
|
| 348 |
+
// Form elements
|
| 349 |
+
const form = document.getElementById('penaltyForm');
|
| 350 |
+
const fileInput = document.getElementById('penaltyDocument');
|
| 351 |
+
const fileNameDisplay = document.getElementById('fileNameDisplay');
|
| 352 |
+
|
| 353 |
+
// Filter inputs
|
| 354 |
+
const filterContractor = document.getElementById('filterContractor');
|
| 355 |
+
const filterCompany = document.getElementById('filterCompany');
|
| 356 |
+
const filterDateFrom = document.getElementById('filterDateFrom');
|
| 357 |
+
const filterDateTo = document.getElementById('filterDateTo');
|
| 358 |
+
const filterAmountMin = document.getElementById('filterAmountMin');
|
| 359 |
+
const filterAmountMax = document.getElementById('filterAmountMax');
|
| 360 |
+
|
| 361 |
+
const penaltyTableBody = document.getElementById('penaltyTableBody');
|
| 362 |
+
const noDataMessage = document.getElementById('noDataMessage');
|
| 363 |
+
|
| 364 |
+
// Show selected file name below file input
|
| 365 |
+
fileInput.addEventListener('change', () => {
|
| 366 |
+
if (fileInput.files.length > 0) {
|
| 367 |
+
fileNameDisplay.textContent = `Selected: ${fileInput.files[0].name}`;
|
| 368 |
+
} else {
|
| 369 |
+
fileNameDisplay.textContent = '';
|
| 370 |
+
}
|
| 371 |
+
});
|
| 372 |
+
|
| 373 |
+
// Format date to locale string
|
| 374 |
+
function formatDate(dateStr) {
|
| 375 |
+
const d = new Date(dateStr);
|
| 376 |
+
if (isNaN(d)) return '';
|
| 377 |
+
return d.toLocaleDateString(undefined, { year: 'numeric', month: 'short', day: 'numeric' });
|
| 378 |
+
}
|
| 379 |
+
|
| 380 |
+
// Save records to localStorage
|
| 381 |
+
function saveRecords() {
|
| 382 |
+
localStorage.setItem(STORAGE_KEY, JSON.stringify(penaltyRecords));
|
| 383 |
+
}
|
| 384 |
+
|
| 385 |
+
// Render penalty records in table, applying current filters
|
| 386 |
+
function renderPenalties() {
|
| 387 |
+
penaltyTableBody.innerHTML = '';
|
| 388 |
+
const filtered = filterRecords(penaltyRecords);
|
| 389 |
+
|
| 390 |
+
if (filtered.length === 0) {
|
| 391 |
+
noDataMessage.style.display = 'block';
|
| 392 |
+
return;
|
| 393 |
+
}
|
| 394 |
+
noDataMessage.style.display = 'none';
|
| 395 |
+
|
| 396 |
+
filtered.forEach((record, index) => {
|
| 397 |
+
const tr = document.createElement('tr');
|
| 398 |
+
|
| 399 |
+
const contractorTD = document.createElement('td');
|
| 400 |
+
contractorTD.textContent = record.contractorName;
|
| 401 |
+
tr.appendChild(contractorTD);
|
| 402 |
+
|
| 403 |
+
const companyTD = document.createElement('td');
|
| 404 |
+
companyTD.textContent = record.companyName;
|
| 405 |
+
tr.appendChild(companyTD);
|
| 406 |
+
|
| 407 |
+
const dateTD = document.createElement('td');
|
| 408 |
+
dateTD.textContent = formatDate(record.penaltyDate);
|
| 409 |
+
tr.appendChild(dateTD);
|
| 410 |
+
|
| 411 |
+
const amountTD = document.createElement('td');
|
| 412 |
+
amountTD.textContent = Number(record.penaltyAmount).toFixed(2);
|
| 413 |
+
tr.appendChild(amountTD);
|
| 414 |
+
|
| 415 |
+
const reasonTD = document.createElement('td');
|
| 416 |
+
reasonTD.textContent = record.penaltyReason;
|
| 417 |
+
tr.appendChild(reasonTD);
|
| 418 |
+
|
| 419 |
+
const docTD = document.createElement('td');
|
| 420 |
+
if (record.documentName) {
|
| 421 |
+
// Provide a download link if document data is available in session (non persistent)
|
| 422 |
+
if(record.documentData){
|
| 423 |
+
// Create a blob URL from data string and link
|
| 424 |
+
const link = document.createElement('a');
|
| 425 |
+
link.textContent = record.documentName;
|
| 426 |
+
link.href = record.documentData;
|
| 427 |
+
link.download = record.documentName;
|
| 428 |
+
link.style.color = '#1976d2';
|
| 429 |
+
link.style.textDecoration = 'underline';
|
| 430 |
+
docTD.appendChild(link);
|
| 431 |
+
} else {
|
| 432 |
+
// No data for download (persisted records), just display file name
|
| 433 |
+
docTD.textContent = record.documentName;
|
| 434 |
+
docTD.title = "Document upload not available for past sessions.";
|
| 435 |
+
docTD.style.fontStyle = "italic";
|
| 436 |
+
docTD.style.color = "#777";
|
| 437 |
+
}
|
| 438 |
+
} else {
|
| 439 |
+
docTD.textContent = '-';
|
| 440 |
+
docTD.style.color = "#777";
|
| 441 |
+
docTD.style.fontStyle = "italic";
|
| 442 |
+
}
|
| 443 |
+
tr.appendChild(docTD);
|
| 444 |
+
|
| 445 |
+
const actionTD = document.createElement('td');
|
| 446 |
+
const deleteBtn = document.createElement('button');
|
| 447 |
+
deleteBtn.textContent = 'Delete';
|
| 448 |
+
deleteBtn.className = 'btn-delete';
|
| 449 |
+
deleteBtn.addEventListener('click', () => {
|
| 450 |
+
if (confirm(`Delete penalty record for "${record.contractorName}"?`)) {
|
| 451 |
+
// Find index in original penaltyRecords
|
| 452 |
+
const originalIndex = penaltyRecords.findIndex(r => r.id === record.id);
|
| 453 |
+
if (originalIndex !== -1) {
|
| 454 |
+
penaltyRecords.splice(originalIndex, 1);
|
| 455 |
+
saveRecords();
|
| 456 |
+
renderPenalties();
|
| 457 |
+
}
|
| 458 |
+
}
|
| 459 |
+
});
|
| 460 |
+
actionTD.appendChild(deleteBtn);
|
| 461 |
+
tr.appendChild(actionTD);
|
| 462 |
+
|
| 463 |
+
penaltyTableBody.appendChild(tr);
|
| 464 |
+
});
|
| 465 |
+
}
|
| 466 |
+
|
| 467 |
+
// Generate unique id for records
|
| 468 |
+
function generateId() {
|
| 469 |
+
return '_' + Math.random().toString(36).substr(2, 9) + Date.now();
|
| 470 |
+
}
|
| 471 |
+
|
| 472 |
+
// Filter records based on filter inputs
|
| 473 |
+
function filterRecords(records) {
|
| 474 |
+
const cFilter = filterContractor.value.trim().toLowerCase();
|
| 475 |
+
const coFilter = filterCompany.value.trim().toLowerCase();
|
| 476 |
+
const dFrom = filterDateFrom.value;
|
| 477 |
+
const dTo = filterDateTo.value;
|
| 478 |
+
const aMin = parseFloat(filterAmountMin.value);
|
| 479 |
+
const aMax = parseFloat(filterAmountMax.value);
|
| 480 |
+
|
| 481 |
+
return records.filter(r => {
|
| 482 |
+
if (cFilter && !r.contractorName.toLowerCase().includes(cFilter)) return false;
|
| 483 |
+
if (coFilter && !r.companyName.toLowerCase().includes(coFilter)) return false;
|
| 484 |
+
if (dFrom && r.penaltyDate < dFrom) return false;
|
| 485 |
+
if (dTo && r.penaltyDate > dTo) return false;
|
| 486 |
+
if (!isNaN(aMin) && r.penaltyAmount < aMin) return false;
|
| 487 |
+
if (!isNaN(aMax) && r.penaltyAmount > aMax) return false;
|
| 488 |
+
return true;
|
| 489 |
+
});
|
| 490 |
+
}
|
| 491 |
+
|
| 492 |
+
// Clear filters
|
| 493 |
+
function clearFilters() {
|
| 494 |
+
filterContractor.value = '';
|
| 495 |
+
filterCompany.value = '';
|
| 496 |
+
filterDateFrom.value = '';
|
| 497 |
+
filterDateTo.value = '';
|
| 498 |
+
filterAmountMin.value = '';
|
| 499 |
+
filterAmountMax.value = '';
|
| 500 |
+
}
|
| 501 |
+
|
| 502 |
+
// Event listeners for filter inputs to update table as user types or changes
|
| 503 |
+
[filterContractor, filterCompany, filterDateFrom, filterDateTo, filterAmountMin, filterAmountMax].forEach(input => {
|
| 504 |
+
input.addEventListener('input', renderPenalties);
|
| 505 |
+
});
|
| 506 |
+
|
| 507 |
+
// Form submit handler
|
| 508 |
+
form.addEventListener('submit', event => {
|
| 509 |
+
event.preventDefault();
|
| 510 |
+
|
| 511 |
+
const contractorName = form.contractorName.value.trim();
|
| 512 |
+
const companyName = form.companyName.value.trim();
|
| 513 |
+
const penaltyDate = form.penaltyDate.value;
|
| 514 |
+
const penaltyAmount = parseFloat(form.penaltyAmount.value);
|
| 515 |
+
const penaltyReason = form.penaltyReason.value.trim();
|
| 516 |
+
|
| 517 |
+
if (!contractorName || !companyName || !penaltyDate || isNaN(penaltyAmount) || !penaltyReason) {
|
| 518 |
+
alert('Please fill in all required fields.');
|
| 519 |
+
return;
|
| 520 |
+
}
|
| 521 |
+
if (penaltyAmount < 0) {
|
| 522 |
+
alert('Penalty amount cannot be negative.');
|
| 523 |
+
return;
|
| 524 |
+
}
|
| 525 |
+
|
| 526 |
+
// Prepare new record object
|
| 527 |
+
const newRecord = {
|
| 528 |
+
id: generateId(),
|
| 529 |
+
contractorName,
|
| 530 |
+
companyName,
|
| 531 |
+
penaltyDate,
|
| 532 |
+
penaltyAmount,
|
| 533 |
+
penaltyReason,
|
| 534 |
+
documentName: fileInput.files.length > 0 ? fileInput.files[0].name : null,
|
| 535 |
+
// We cannot persist file content due to base64 restriction, but to allow download during session,
|
| 536 |
+
// we store in memory a blob URL for the uploaded file
|
| 537 |
+
documentData: null // will fill below if a file is selected
|
| 538 |
+
};
|
| 539 |
+
|
| 540 |
+
if (fileInput.files.length > 0) {
|
| 541 |
+
// Create URL to file for download in session
|
| 542 |
+
const file = fileInput.files[0];
|
| 543 |
+
newRecord.documentData = URL.createObjectURL(file);
|
| 544 |
+
}
|
| 545 |
+
|
| 546 |
+
// Add to penalty records
|
| 547 |
+
penaltyRecords.push(newRecord);
|
| 548 |
+
saveRecords();
|
| 549 |
+
|
| 550 |
+
// Reset form and clear file display
|
| 551 |
+
form.reset();
|
| 552 |
+
fileNameDisplay.textContent = '';
|
| 553 |
+
form.contractorName.focus();
|
| 554 |
+
|
| 555 |
+
// Switch to history tab and render table
|
| 556 |
+
switchTab('history');
|
| 557 |
+
});
|
| 558 |
+
|
| 559 |
+
// On page unload revoke all blob URLs to avoid memory leaks (those for documentData)
|
| 560 |
+
window.addEventListener('beforeunload', () => {
|
| 561 |
+
penaltyRecords.forEach(r => {
|
| 562 |
+
if (r.documentData) {
|
| 563 |
+
URL.revokeObjectURL(r.documentData);
|
| 564 |
+
}
|
| 565 |
+
});
|
| 566 |
+
});
|
| 567 |
+
|
| 568 |
+
// Initialize by showing the add tab
|
| 569 |
+
switchTab('add');
|
| 570 |
+
})();
|
| 571 |
+
</script>
|
| 572 |
+
<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=alterzick/penalty" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body>
|
| 573 |
</html>
|
| 574 |
+
|
prompts.txt
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
tolong buatkan approval program dashboard yang memiliki page form yang bentuk interfacenya seperti ini
|