Compare commits
2 Commits
74b67d1e2c
...
772cf2a253
| Author | SHA1 | Date | |
|---|---|---|---|
| 772cf2a253 | |||
| 811d0add60 |
@ -21,7 +21,8 @@ export const useCustomerSummaryPanelController = ({
|
||||
defaultVisibility: initialOpen ? "visible" : "hidden",
|
||||
});
|
||||
|
||||
const query = useCustomerGetQuery(customerId, {
|
||||
const query = useCustomerGetQuery({
|
||||
id: customerId,
|
||||
enabled: Boolean(customerId),
|
||||
});
|
||||
|
||||
|
||||
@ -1,8 +1,7 @@
|
||||
import type { CriteriaDTO } from "@erp/core";
|
||||
import { useDebounce } from "@repo/rdx-ui/components";
|
||||
import { useMemo, useState } from "react";
|
||||
|
||||
import { useCustomersListQuery } from "../../shared";
|
||||
import { type ListCustomersByCriteriaParams, useCustomersListQuery } from "../../shared";
|
||||
|
||||
export const useListCustomersController = () => {
|
||||
const [pageIndex, setPageIndex] = useState(0);
|
||||
@ -11,15 +10,17 @@ export const useListCustomersController = () => {
|
||||
|
||||
const debouncedQ = useDebounce(search, 300);
|
||||
|
||||
const criteria = useMemo<CriteriaDTO>(() => {
|
||||
return {
|
||||
const criteria = useMemo<NonNullable<ListCustomersByCriteriaParams["criteria"]>>(
|
||||
() => ({
|
||||
q: debouncedQ || "",
|
||||
pageSize,
|
||||
pageNumber: pageIndex,
|
||||
pageSize,
|
||||
order: "desc",
|
||||
orderBy: "name",
|
||||
};
|
||||
}, [pageSize, pageIndex, debouncedQ]);
|
||||
//filters: statusFilter === "all" ? [] : [{ field: "status", operator: "eq", value: statusFilter }],
|
||||
}),
|
||||
[debouncedQ, pageIndex, pageSize /*statusFilter*/]
|
||||
);
|
||||
|
||||
const query = useCustomersListQuery({ criteria });
|
||||
|
||||
|
||||
@ -1,37 +1,7 @@
|
||||
import { MetadataSchema } from "@erp/core";
|
||||
import { z } from "zod/v4";
|
||||
import {
|
||||
type GetSupplierByIdResponseDTO,
|
||||
GetSupplierByIdResponseSchema,
|
||||
} from "./get-supplier-by-id.response.dto";
|
||||
|
||||
export const UpdateSupplierByIdResponseSchema = z.object({
|
||||
id: z.uuid(),
|
||||
company_id: z.uuid(),
|
||||
reference: z.string(),
|
||||
|
||||
is_company: z.string(),
|
||||
name: z.string(),
|
||||
trade_name: z.string(),
|
||||
tin: z.string(),
|
||||
|
||||
street: z.string(),
|
||||
street2: z.string(),
|
||||
city: z.string(),
|
||||
province: z.string(),
|
||||
postal_code: z.string(),
|
||||
country: z.string(),
|
||||
|
||||
email_primary: z.string(),
|
||||
email_secondary: z.string(),
|
||||
phone_primary: z.string(),
|
||||
phone_secondary: z.string(),
|
||||
mobile_primary: z.string(),
|
||||
mobile_secondary: z.string(),
|
||||
|
||||
fax: z.string(),
|
||||
website: z.string(),
|
||||
|
||||
language_code: z.string(),
|
||||
currency_code: z.string(),
|
||||
|
||||
metadata: MetadataSchema.optional(),
|
||||
});
|
||||
|
||||
export type UpdateSupplierByIdResponseDTO = z.infer<typeof UpdateSupplierByIdResponseSchema>;
|
||||
export const UpdateSupplierByIdResponseSchema = GetSupplierByIdResponseSchema;
|
||||
export type UpdateSupplierByIdResponseDTO = GetSupplierByIdResponseDTO;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user