Upload 3 files
Browse files- app.js +23 -4
- index.html +12 -7
- style.css +17 -0
app.js
CHANGED
|
@@ -35,7 +35,7 @@ const elements = Object.fromEntries(
|
|
| 35 |
"madonDialog", "closeMadonDialog", "madonForm", "madonRepresentativeOptions",
|
| 36 |
"madonMessagePreview", "copyMadonMessage", "openMadonGroup", "sendMadonMessage",
|
| 37 |
"documentationDialog", "closeDocumentationDialog", "documentationEntity",
|
| 38 |
-
"documentationUnavailable", "documentationForm", "fieldStatus", "fieldStatement",
|
| 39 |
"statementCount", "documentationPhotos", "photoPreviews", "documentationError",
|
| 40 |
"uploadProgress", "uploadProgressBar", "cancelDocumentationButton", "saveDocumentationButton",
|
| 41 |
"adminView", "adminLogoutButton", "adminUpdatedAt", "refreshAdminButton", "adminStats",
|
|
@@ -469,7 +469,7 @@ function renderAdminRecords() {
|
|
| 469 |
details.className = "admin-record-details";
|
| 470 |
details.append(
|
| 471 |
detailItem("السجل التجاري", record.commercialRecord || "-"),
|
| 472 |
-
detailItem("حالة ال
|
| 473 |
detailItem("عدد الصور", record.photoCount || 0),
|
| 474 |
);
|
| 475 |
if (record.statement) details.append(detailItem("الإفادة", record.statement, "wide"));
|
|
@@ -1132,6 +1132,8 @@ function openDocumentationDialog(row) {
|
|
| 1132 |
detailItem("رقم العقد", row.contractNumber || "لا يوجد رقم عقد", "ltr-value"),
|
| 1133 |
);
|
| 1134 |
elements.fieldStatus.value = "";
|
|
|
|
|
|
|
| 1135 |
elements.fieldStatement.value = "";
|
| 1136 |
elements.statementCount.textContent = "0";
|
| 1137 |
elements.documentationPhotos.value = "";
|
|
@@ -1552,6 +1554,17 @@ elements.cancelDocumentationButton.addEventListener("click", closeDocumentationD
|
|
| 1552 |
elements.documentationDialog.addEventListener("click", (event) => {
|
| 1553 |
if (event.target === elements.documentationDialog) closeDocumentationDialog();
|
| 1554 |
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1555 |
elements.fieldStatement.addEventListener("input", () => {
|
| 1556 |
elements.statementCount.textContent = String(elements.fieldStatement.value.length);
|
| 1557 |
elements.documentationError.textContent = "";
|
|
@@ -1574,10 +1587,16 @@ elements.documentationForm.addEventListener("submit", async (event) => {
|
|
| 1574 |
return;
|
| 1575 |
}
|
| 1576 |
if (!elements.fieldStatus.value) {
|
| 1577 |
-
elements.documentationError.textContent = "اختر حالة ال
|
| 1578 |
elements.fieldStatus.focus();
|
| 1579 |
return;
|
| 1580 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1581 |
if (!elements.fieldStatement.value.trim()) {
|
| 1582 |
elements.documentationError.textContent = "اكتب الإفادة الميدانية.";
|
| 1583 |
elements.fieldStatement.focus();
|
|
@@ -1609,7 +1628,7 @@ elements.documentationForm.addEventListener("submit", async (event) => {
|
|
| 1609 |
commercialRecord: documentationRow.commercialRecord,
|
| 1610 |
contractNumber: documentationRow.contractNumber,
|
| 1611 |
city: documentationRow.city,
|
| 1612 |
-
fieldStatus: elements.fieldStatus.value,
|
| 1613 |
statement: elements.fieldStatement.value.trim(),
|
| 1614 |
photos,
|
| 1615 |
}),
|
|
|
|
| 35 |
"madonDialog", "closeMadonDialog", "madonForm", "madonRepresentativeOptions",
|
| 36 |
"madonMessagePreview", "copyMadonMessage", "openMadonGroup", "sendMadonMessage",
|
| 37 |
"documentationDialog", "closeDocumentationDialog", "documentationEntity",
|
| 38 |
+
"documentationUnavailable", "documentationForm", "fieldStatus", "otherStatusField", "otherStatus", "fieldStatement",
|
| 39 |
"statementCount", "documentationPhotos", "photoPreviews", "documentationError",
|
| 40 |
"uploadProgress", "uploadProgressBar", "cancelDocumentationButton", "saveDocumentationButton",
|
| 41 |
"adminView", "adminLogoutButton", "adminUpdatedAt", "refreshAdminButton", "adminStats",
|
|
|
|
| 469 |
details.className = "admin-record-details";
|
| 470 |
details.append(
|
| 471 |
detailItem("السجل التجاري", record.commercialRecord || "-"),
|
| 472 |
+
detailItem("الحالة الميدانية", record.fieldStatus || "-"),
|
| 473 |
detailItem("عدد الصور", record.photoCount || 0),
|
| 474 |
);
|
| 475 |
if (record.statement) details.append(detailItem("الإفادة", record.statement, "wide"));
|
|
|
|
| 1132 |
detailItem("رقم العقد", row.contractNumber || "لا يوجد رقم عقد", "ltr-value"),
|
| 1133 |
);
|
| 1134 |
elements.fieldStatus.value = "";
|
| 1135 |
+
elements.otherStatus.value = "";
|
| 1136 |
+
elements.otherStatusField.hidden = true;
|
| 1137 |
elements.fieldStatement.value = "";
|
| 1138 |
elements.statementCount.textContent = "0";
|
| 1139 |
elements.documentationPhotos.value = "";
|
|
|
|
| 1554 |
elements.documentationDialog.addEventListener("click", (event) => {
|
| 1555 |
if (event.target === elements.documentationDialog) closeDocumentationDialog();
|
| 1556 |
});
|
| 1557 |
+
elements.fieldStatus.addEventListener("change", () => {
|
| 1558 |
+
const isOther = elements.fieldStatus.value === "أخرى";
|
| 1559 |
+
elements.otherStatusField.hidden = !isOther;
|
| 1560 |
+
elements.otherStatus.required = isOther;
|
| 1561 |
+
if (!isOther) elements.otherStatus.value = "";
|
| 1562 |
+
elements.documentationError.textContent = "";
|
| 1563 |
+
if (isOther) elements.otherStatus.focus();
|
| 1564 |
+
});
|
| 1565 |
+
elements.otherStatus.addEventListener("input", () => {
|
| 1566 |
+
elements.documentationError.textContent = "";
|
| 1567 |
+
});
|
| 1568 |
elements.fieldStatement.addEventListener("input", () => {
|
| 1569 |
elements.statementCount.textContent = String(elements.fieldStatement.value.length);
|
| 1570 |
elements.documentationError.textContent = "";
|
|
|
|
| 1587 |
return;
|
| 1588 |
}
|
| 1589 |
if (!elements.fieldStatus.value) {
|
| 1590 |
+
elements.documentationError.textContent = "اختر الحالة الميدانية.";
|
| 1591 |
elements.fieldStatus.focus();
|
| 1592 |
return;
|
| 1593 |
}
|
| 1594 |
+
const customStatus = elements.otherStatus.value.trim();
|
| 1595 |
+
if (elements.fieldStatus.value === "أخرى" && customStatus.length < 3) {
|
| 1596 |
+
elements.documentationError.textContent = "اكتب توضيح الحالة الأخرى.";
|
| 1597 |
+
elements.otherStatus.focus();
|
| 1598 |
+
return;
|
| 1599 |
+
}
|
| 1600 |
if (!elements.fieldStatement.value.trim()) {
|
| 1601 |
elements.documentationError.textContent = "اكتب الإفادة الميدانية.";
|
| 1602 |
elements.fieldStatement.focus();
|
|
|
|
| 1628 |
commercialRecord: documentationRow.commercialRecord,
|
| 1629 |
contractNumber: documentationRow.contractNumber,
|
| 1630 |
city: documentationRow.city,
|
| 1631 |
+
fieldStatus: elements.fieldStatus.value === "أخرى" ? `أخرى: ${customStatus}` : elements.fieldStatus.value,
|
| 1632 |
statement: elements.fieldStatement.value.trim(),
|
| 1633 |
photos,
|
| 1634 |
}),
|
index.html
CHANGED
|
@@ -264,7 +264,7 @@
|
|
| 264 |
<input id="adminDateFilter" class="date-input" type="date" />
|
| 265 |
</label>
|
| 266 |
<label class="field-group">
|
| 267 |
-
<span>حالة ال
|
| 268 |
<div class="select-shell">
|
| 269 |
<select id="adminStatusFilter"><option value="">جميع الحالات</option></select>
|
| 270 |
<svg viewBox="0 0 24 24"><path d="m7 10 5 5 5-5" /></svg>
|
|
@@ -428,21 +428,26 @@
|
|
| 428 |
|
| 429 |
<form id="documentationForm" class="share-form" novalidate>
|
| 430 |
<label class="dialog-field" for="fieldStatus">
|
| 431 |
-
<span>حالة ال
|
| 432 |
<div class="select-shell">
|
| 433 |
<select id="fieldStatus" required>
|
| 434 |
<option value="">اختر الحالة</option>
|
| 435 |
-
<option value="
|
| 436 |
-
<option value="
|
| 437 |
-
<option value="ت
|
| 438 |
-
<option value="
|
| 439 |
-
<option value="مغلقة">مغلقة</option>
|
| 440 |
<option value="أخرى">أخرى</option>
|
| 441 |
</select>
|
| 442 |
<svg viewBox="0 0 24 24"><path d="m7 10 5 5 5-5" /></svg>
|
| 443 |
</div>
|
| 444 |
</label>
|
| 445 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 446 |
<label class="dialog-field" for="fieldStatement">
|
| 447 |
<span>الإفادة الميدانية</span>
|
| 448 |
<textarea id="fieldStatement" rows="5" maxlength="1500" placeholder="اكتب الإفادة بشكل واضح ومختصر..." required></textarea>
|
|
|
|
| 264 |
<input id="adminDateFilter" class="date-input" type="date" />
|
| 265 |
</label>
|
| 266 |
<label class="field-group">
|
| 267 |
+
<span>الحالة الميدانية</span>
|
| 268 |
<div class="select-shell">
|
| 269 |
<select id="adminStatusFilter"><option value="">جميع الحالات</option></select>
|
| 270 |
<svg viewBox="0 0 24 24"><path d="m7 10 5 5 5-5" /></svg>
|
|
|
|
| 428 |
|
| 429 |
<form id="documentationForm" class="share-form" novalidate>
|
| 430 |
<label class="dialog-field" for="fieldStatus">
|
| 431 |
+
<span>الحالة الميدانية</span>
|
| 432 |
<div class="select-shell">
|
| 433 |
<select id="fieldStatus" required>
|
| 434 |
<option value="">اختر الحالة</option>
|
| 435 |
+
<option value="مغلقة مؤقتًا">مغلقة مؤقتًا</option>
|
| 436 |
+
<option value="مغلقة نهائيًا">مغلقة نهائيًا</option>
|
| 437 |
+
<option value="تم الاستيفاء">تم الاستيفاء</option>
|
| 438 |
+
<option value="رفض الإدلاء بالبيانات">رفض الإدلاء بالبيانات</option>
|
|
|
|
| 439 |
<option value="أخرى">أخرى</option>
|
| 440 |
</select>
|
| 441 |
<svg viewBox="0 0 24 24"><path d="m7 10 5 5 5-5" /></svg>
|
| 442 |
</div>
|
| 443 |
</label>
|
| 444 |
|
| 445 |
+
<label id="otherStatusField" class="dialog-field other-status-field" for="otherStatus" hidden>
|
| 446 |
+
<span>توضيح الحالة الأخرى</span>
|
| 447 |
+
<input id="otherStatus" type="text" maxlength="120" placeholder="اكتب الحالة الميدانية..." />
|
| 448 |
+
<small>ستظهر هذه العبارة كحالة المنشأة في لوحة المشرف.</small>
|
| 449 |
+
</label>
|
| 450 |
+
|
| 451 |
<label class="dialog-field" for="fieldStatement">
|
| 452 |
<span>الإفادة الميدانية</span>
|
| 453 |
<textarea id="fieldStatement" rows="5" maxlength="1500" placeholder="اكتب الإفادة بشكل واضح ومختصر..." required></textarea>
|
style.css
CHANGED
|
@@ -1475,6 +1475,23 @@ footer {
|
|
| 1475 |
line-height: 1.75;
|
| 1476 |
}
|
| 1477 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1478 |
#fieldStatement:focus {
|
| 1479 |
border-color: var(--primary);
|
| 1480 |
box-shadow: 0 0 0 3px rgba(65, 55, 168, 0.12);
|
|
|
|
| 1475 |
line-height: 1.75;
|
| 1476 |
}
|
| 1477 |
|
| 1478 |
+
.other-status-field input {
|
| 1479 |
+
width: 100%;
|
| 1480 |
+
min-height: 50px;
|
| 1481 |
+
padding: 0 12px;
|
| 1482 |
+
color: var(--ink);
|
| 1483 |
+
background: #fff;
|
| 1484 |
+
border: 1px solid #cfdee5;
|
| 1485 |
+
border-radius: 8px;
|
| 1486 |
+
outline: 0;
|
| 1487 |
+
font: inherit;
|
| 1488 |
+
}
|
| 1489 |
+
|
| 1490 |
+
.other-status-field input:focus {
|
| 1491 |
+
border-color: var(--primary);
|
| 1492 |
+
box-shadow: 0 0 0 3px rgba(65, 55, 168, 0.12);
|
| 1493 |
+
}
|
| 1494 |
+
|
| 1495 |
#fieldStatement:focus {
|
| 1496 |
border-color: var(--primary);
|
| 1497 |
box-shadow: 0 0 0 3px rgba(65, 55, 168, 0.12);
|