+ {isLoading ? (
+
+
+
+ ) : isError ? (
+
+
+ {errorMessage}
+
+
+ ) : filteredComplaints.length === 0 ? (
+
+ No {activeTab} complaints available.
+
+ ) : (
+ filteredComplaints.map((complaint) => {
+ const iconInfo = STATUS_ICON[activeTab] || STATUS_ICON.pending;
+ const IconComp = iconInfo.Icon;
+ const isOverdue = complaint.sla_deadline && new Date(complaint.sla_deadline) < new Date()
+ && ![2, 3, 5].includes(complaint.status);
+ const latestReopenStatus = complaint.latest_reopen_request_status;
+ const reopenStatusInfo = REOPEN_REQUEST_STATUS_MAP[latestReopenStatus] || null;
+ const hasPendingReopen = !!complaint.has_pending_reopen_request;
+
+ return (
+
+
+
+
+
+ Complaint Id: {complaint.id}
+
+
+ {complaint.complaint_type}
+
+ {complaint.priority && (
- {complaint.complaint_type}
+ {complaint.priority}
+
+ )}
+ {isOverdue && (
+ OVERDUE
+ )}
+ {reopenStatusInfo && (complaint.status === 5 || complaint.status === 3) && (
+
+ {reopenStatusInfo.label}
-
- {activeTab === "resolved" ? (
-
- ) : activeTab === "declined" ? (
-
- ) : (
-
)}
-
-
-
- Date:{" "}
- {formatDateTime(complaint.complaint_date)}
-
-
- Location: {complaint.specific_location},{" "}
- {complaint.location}
-
-
-
-
-
+
+
+
+
+ Date: {formatDateTime(complaint.complaint_date)}
+
+
+ Location: {complaint.specific_location}, {complaint.location}
+
+ {complaint.sla_deadline && (
- Description: {complaint.details}
+ SLA Deadline: {formatDateTime(complaint.sla_deadline)}
+ )}
+
+
+
+
+ Description: {complaint.details}
+
+
+ {/* Show Close/Verify for Resolved complaints */}
+ {complaint.status === 2 && (
+
+ )}
+ {/* Show Reopen for Closed/Declined complaints */}
+ {(complaint.status === 5 || complaint.status === 3) && (
+
+ )}
-
- ))
- )}
-
- >
- )}
+
+
+ );
+ })
+ )}
+