This commit is contained in:
hamid zarghami
2026-02-22 12:03:32 +03:30
parent e6e1878cb2
commit 11f8f4326b
19 changed files with 64 additions and 62 deletions
+2 -2
View File
@@ -14,7 +14,7 @@ const PrintForm: FC = () => {
const navigate = useNavigate()
const { itemId, orderId } = useParams()
const { data: item } = useGetOrderItem(+itemId!)
const { data: item } = useGetOrderItem(itemId!)
const { isPending, mutate } = useCreatePrintForm()
const { data } = useGetSections()
@@ -24,7 +24,7 @@ const PrintForm: FC = () => {
printAttributes: []
},
onSubmit: (values) => {
mutate({ itemId: +itemId!, orderId: orderId!, params: values }, {
mutate({ itemId: itemId!, orderId: orderId!, params: values }, {
onSuccess: () => {
toast('با موفقیت ذخیره شد', 'success')
navigate(-1)
+2 -2
View File
@@ -20,7 +20,7 @@ const ManageForms: FC<Props> = (props) => {
const { attributes, formik } = props
const handleChange = (attributeId: number, value: string) => {
const handleChange = (attributeId: string, value: string) => {
const attribute = formik.values.printAttributes
const index: number = attribute.findIndex(o => o.fieldId === attributeId)
if (index > -1) {
@@ -28,7 +28,7 @@ const ManageForms: FC<Props> = (props) => {
} else {
attribute.push({ fieldId: attributeId, value: value })
}
formik.setFieldValue('attributes', attribute)
formik.setFieldValue('printAttributes', attribute)
}
+1 -1
View File
@@ -64,7 +64,7 @@ export const useCreatePrintForm = () => {
params,
}: {
orderId: string;
itemId: number;
itemId: string;
params: CreatePrintFormType;
}) => api.createPrintForm(orderId, itemId, params),
// onSuccess: (_, params) => {
+4 -4
View File
@@ -23,7 +23,7 @@ export const updateSection = async (id: number, params: CreateSectionType) => {
export const getSectionDetail = async (id: number) => {
const { data } = await axios.get<SectionDetailResponseType>(
`/admin/section/${id}`
`/admin/section/${id}`,
);
return data;
};
@@ -35,12 +35,12 @@ export const deleteSection = async (id: number) => {
export const createPrintForm = async (
orderId: string,
itemId: number,
params: CreatePrintFormType
itemId: string,
params: CreatePrintFormType,
) => {
const { data } = await axios.patch(
`/admin/orders/${orderId}/item/${itemId}/print`,
params
params,
);
return data;
};
+1 -1
View File
@@ -18,7 +18,7 @@ export type SectionsResponseType = BaseResponse<SectionItemType[]>;
export type SectionDetailResponseType = BaseResponse<SectionItemType>;
export type PrintAttributesType = {
fieldId: number;
fieldId: string;
value: string;
};