From df4a730091d288e470b9c5212dc265a5adcf3fc0 Mon Sep 17 00:00:00 2001
From: hamid zarghami
Date: Tue, 24 Feb 2026 11:29:59 +0330
Subject: [PATCH] fields
---
src/pages/request/RequestDetail.tsx | 27 +++++-----
src/pages/request/type/Types.ts | 81 ++++++++++++++++++++++++++++-
2 files changed, 92 insertions(+), 16 deletions(-)
diff --git a/src/pages/request/RequestDetail.tsx b/src/pages/request/RequestDetail.tsx
index cc04c4b..9d1e3e7 100644
--- a/src/pages/request/RequestDetail.tsx
+++ b/src/pages/request/RequestDetail.tsx
@@ -54,23 +54,20 @@ const RequestDetail: FC = () => {
- {/* Attributes */}
- {/* {fields?.data?.length ? (
+ {/* Attributes from field */}
+ {item.attributes?.length ? (
<>
- ویژگی ها
- {
- fields.data.map((field) => {
- const value = item.attributes?.find((o) => String(o.attributeId) === String(field.id))
- return (
-
-
{field.name}:
-
{value?.value || '-'}
-
- )
- })
- }
+ ویژگیها
+
+ {item.attributes.map((attr) => (
+
+
{attr.field?.name}:
+
{attr.value ?? '—'}
+
+ ))}
+
>
- ) : null} */}
+ ) : null}
{/* Attachments */}
{item.attachments?.length ? (
diff --git a/src/pages/request/type/Types.ts b/src/pages/request/type/Types.ts
index a5ee681..fcee83c 100644
--- a/src/pages/request/type/Types.ts
+++ b/src/pages/request/type/Types.ts
@@ -99,7 +99,86 @@ export interface MyRequestType extends RowDataType {
export type MyRequestsResponseType = BaseResponse;
-export type RequestDetailResponseType = BaseResponse;
+/** User in request detail response */
+export type RequestDetailUserType = {
+ id: string;
+ createdAt: string;
+ deletedAt: string | null;
+ firstName: string | null;
+ lastName: string | null;
+ isActive: boolean;
+ gender: boolean;
+ maxCredit: number;
+ addresse: string | null;
+ phone: string;
+};
+
+/** Option inside field (in request detail item attribute) */
+export type RequestDetailFieldOptionType = {
+ id: string;
+ createdAt: string;
+ deletedAt: string | null;
+ value: string;
+ field: string;
+ order: number | null;
+};
+
+/** Field inside request detail item attribute */
+export type RequestDetailFieldType = {
+ id: string;
+ createdAt: string;
+ deletedAt: string | null;
+ entityType: string;
+ entityId: string;
+ name: string;
+ type: string;
+ isRequired: boolean;
+ multiple: boolean;
+ order: number;
+ options: RequestDetailFieldOptionType[];
+};
+
+/** Attribute in request detail item */
+export type RequestDetailItemAttributeType = {
+ value: string;
+ fieldId: string;
+ field: RequestDetailFieldType;
+};
+
+/** Product in request detail (category is id string, linkUrl can be null) */
+export type RequestDetailProductType = Omit<
+ ProductType,
+ "category" | "linkUrl"
+> & {
+ category: string;
+ linkUrl: string | null;
+};
+
+/** Item in request detail response */
+export type RequestDetailItemType = {
+ id: string;
+ createdAt: string;
+ deletedAt: string | null;
+ product: RequestDetailProductType;
+ attributes: RequestDetailItemAttributeType[];
+ request: string;
+ quantity: number;
+ description: string;
+ attachments: AttachmentsType[];
+};
+
+/** Request detail (single request by id) */
+export type RequestDetailType = {
+ id: string;
+ createdAt: string;
+ deletedAt: string | null;
+ user: RequestDetailUserType;
+ requestNumber: number;
+ status: string;
+ items: RequestDetailItemType[];
+};
+
+export type RequestDetailResponseType = BaseResponse;
export type AddTicketType = {
content: string;