WIPVOLONT

This commit is contained in:
fullofempt
2025-12-14 21:14:55 +05:00
parent 433b9e896c
commit 0df52352a8
12 changed files with 893 additions and 440 deletions

View File

@@ -102,15 +102,18 @@ const HistoryRequestModeratorPage = () => {
const list = Array.isArray(data) ? data : [];
// RequestListItem: id, title, description, address, city, urgency, status, requester_name, request_type_name, created_at
// оставляем только approved / rejected
const filtered = list.filter(
(item) => item.status === "approved" || item.status === "rejected"
);
// status: { request_status: "approved" | "rejected", valid: true }
const filtered = list.filter((item) => {
const s = String(item.status?.request_status || "").toLowerCase();
return s === "approved" || s === "rejected";
});
const mapped = filtered.map((item) => {
const m = statusMap[item.status] || {
label: item.status,
const rawStatus = String(
item.status?.request_status || ""
).toLowerCase();
const m = statusMap[rawStatus] || {
label: rawStatus || "Неизвестен",
color: "#E2E2E2",
};
@@ -131,10 +134,9 @@ const HistoryRequestModeratorPage = () => {
time,
createdAt: date,
fullName: item.requester_name,
address: item.city
? `${item.city}, ${item.address}`
: item.address,
rawStatus: item.status, // "approved" | "rejected"
rejectReason: item.moderation_comment || "",
address: item.city ? `${item.city}, ${item.address}` : item.address,
rawStatus, // "approved" | "rejected"
};
});
@@ -163,7 +165,9 @@ const HistoryRequestModeratorPage = () => {
const handleModeratedUpdate = (updated) => {
setRequests((prev) =>
prev.map((r) => (r.id === updated.id ? { ...r, rawStatus: updated.status } : r))
prev.map((r) =>
r.id === updated.id ? { ...r, rawStatus: updated.status } : r
)
);
};
@@ -217,7 +221,7 @@ const HistoryRequestModeratorPage = () => {
key={req.id}
type="button"
onClick={() => handleOpen(req)}
className="w-full text-left bg.white rounded-xl px-3 py-2 flex flex-col gap-1"
className="w-full text-left bg-white rounded-xl px-3 py-2 flex flex-col gap-1"
>
<div className="flex items-center justify-between gap-2">
<span
@@ -226,7 +230,7 @@ const HistoryRequestModeratorPage = () => {
>
{req.status}
</span>
<div className="text-right.leading-tight">
<div className="text-right leading-tight">
<p className="font-montserrat text-[10px] text-black">
{req.date}
</p>
@@ -247,7 +251,7 @@ const HistoryRequestModeratorPage = () => {
{req.address}
</p>
<div className="mt-2 w-full bg-[#94E067] rounded-lg py-3 flex.items-center justify-center">
<div className="mt-2 w-full bg-[#94E067] rounded-lg py-3 flex items-center justify-center">
<span className="font-montserrat font-bold text-[15px] leading-[18px] text-white">
Развернуть
</span>