fields
This commit is contained in:
@@ -54,23 +54,20 @@ const RequestDetail: FC = () => {
|
||||
</p>
|
||||
</div>
|
||||
|
||||
{/* Attributes */}
|
||||
{/* {fields?.data?.length ? (
|
||||
{/* Attributes from field */}
|
||||
{item.attributes?.length ? (
|
||||
<>
|
||||
<div className='font-bold mb-5 mt-7'>ویژگی ها</div>
|
||||
{
|
||||
fields.data.map((field) => {
|
||||
const value = item.attributes?.find((o) => String(o.attributeId) === String(field.id))
|
||||
return (
|
||||
<div className='flex gap-3 items-center mt-3' key={field.id}>
|
||||
<div className='text-sm text-gray-500'>{field.name}:</div>
|
||||
<div className='text-sm -mt-px'>{value?.value || '-'}</div>
|
||||
</div>
|
||||
)
|
||||
})
|
||||
}
|
||||
<div className='font-bold mb-5 mt-7'>ویژگیها</div>
|
||||
<div className='flex flex-col gap-3'>
|
||||
{item.attributes.map((attr) => (
|
||||
<div className='flex gap-3 items-center' key={attr.fieldId}>
|
||||
<div className='text-sm text-gray-500'>{attr.field?.name}:</div>
|
||||
<div className='text-sm -mt-px'>{attr.value ?? '—'}</div>
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
</>
|
||||
) : null} */}
|
||||
) : null}
|
||||
|
||||
{/* Attachments */}
|
||||
{item.attachments?.length ? (
|
||||
|
||||
@@ -99,7 +99,86 @@ export interface MyRequestType extends RowDataType {
|
||||
|
||||
export type MyRequestsResponseType = BaseResponse<MyRequestType[]>;
|
||||
|
||||
export type RequestDetailResponseType = BaseResponse<MyRequestType>;
|
||||
/** 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<RequestDetailType>;
|
||||
|
||||
export type AddTicketType = {
|
||||
content: string;
|
||||
|
||||
Reference in New Issue
Block a user