Compare commits
No commits in common. "ad3613465531b7a098b914ab9d53503619232778" and "8b0401a6a7b4a4e7291a324d63f443eb2a80865d" have entirely different histories.
ad36134655
...
8b0401a6a7
|
|
@ -55,11 +55,8 @@ interface LocalFilters {
|
||||||
stockId: string[] | null;
|
stockId: string[] | null;
|
||||||
sellerId: string | null;
|
sellerId: string | null;
|
||||||
sellerName: string | null;
|
sellerName: string | null;
|
||||||
deliveryType: string[] | null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const DELIVERY_TYPES = ['RI', 'EN', 'EF', 'RP'];
|
|
||||||
|
|
||||||
const getInitialLocalFilters = (
|
const getInitialLocalFilters = (
|
||||||
urlFilters: Partial<LocalFilters>
|
urlFilters: Partial<LocalFilters>
|
||||||
): LocalFilters => ({
|
): LocalFilters => ({
|
||||||
|
|
@ -77,7 +74,6 @@ const getInitialLocalFilters = (
|
||||||
stockId: urlFilters.stockId ?? null,
|
stockId: urlFilters.stockId ?? null,
|
||||||
sellerId: urlFilters.sellerId ?? null,
|
sellerId: urlFilters.sellerId ?? null,
|
||||||
sellerName: urlFilters.sellerName ?? null,
|
sellerName: urlFilters.sellerName ?? null,
|
||||||
deliveryType: urlFilters.deliveryType ?? null,
|
|
||||||
});
|
});
|
||||||
|
|
||||||
export const SearchBar = () => {
|
export const SearchBar = () => {
|
||||||
|
|
@ -139,7 +135,6 @@ export const SearchBar = () => {
|
||||||
partnerName: null,
|
partnerName: null,
|
||||||
productId: null,
|
productId: null,
|
||||||
productName: null,
|
productName: null,
|
||||||
deliveryType: null,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
setLocalFilters(getInitialLocalFilters(resetState));
|
setLocalFilters(getInitialLocalFilters(resetState));
|
||||||
|
|
@ -204,7 +199,6 @@ export const SearchBar = () => {
|
||||||
localFilters.sellerId,
|
localFilters.sellerId,
|
||||||
localFilters.partnerId,
|
localFilters.partnerId,
|
||||||
localFilters.productId,
|
localFilters.productId,
|
||||||
localFilters.deliveryType?.length,
|
|
||||||
].filter(Boolean).length;
|
].filter(Boolean).length;
|
||||||
|
|
||||||
const toggleDrawer = (open: boolean) => (event: React.KeyboardEvent | React.MouseEvent) => {
|
const toggleDrawer = (open: boolean) => (event: React.KeyboardEvent | React.MouseEvent) => {
|
||||||
|
|
@ -460,16 +454,6 @@ export const SearchBar = () => {
|
||||||
filterOptions={(x) => x}
|
filterOptions={(x) => x}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
{/* Tipo de Entrega */}
|
|
||||||
<Autocomplete
|
|
||||||
multiple
|
|
||||||
size="small"
|
|
||||||
options={DELIVERY_TYPES}
|
|
||||||
value={localFilters.deliveryType ?? []}
|
|
||||||
onChange={(_, newValue) => updateLocalFilter('deliveryType', newValue.length > 0 ? newValue : null)}
|
|
||||||
renderInput={(params) => <TextField {...params} label="Tipo de Entrega" placeholder="Selecione tipo" />}
|
|
||||||
/>
|
|
||||||
|
|
||||||
</Stack>
|
</Stack>
|
||||||
</Box>
|
</Box>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -34,7 +34,6 @@ export const useOrderFilters = () => {
|
||||||
createDateEnd: parseAsString,
|
createDateEnd: parseAsString,
|
||||||
|
|
||||||
searchTriggered: parseAsBoolean.withDefault(false),
|
searchTriggered: parseAsBoolean.withDefault(false),
|
||||||
deliveryType: parseAsArrayOf(parseAsString, ','),
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
shallow: true,
|
shallow: true,
|
||||||
|
|
|
||||||
|
|
@ -38,7 +38,7 @@ export const findOrdersSchema = z.object({
|
||||||
deliveryDate: z.string().optional(),
|
deliveryDate: z.string().optional(),
|
||||||
|
|
||||||
shippimentId: z.coerce.number().optional(),
|
shippimentId: z.coerce.number().optional(),
|
||||||
deliveryType: z.union([z.string(), z.array(z.string())]).optional(),
|
deliveryType: z.string().optional(),
|
||||||
status: z.string().optional(),
|
status: z.string().optional(),
|
||||||
type: z.string().optional(),
|
type: z.string().optional(),
|
||||||
|
|
||||||
|
|
@ -111,7 +111,7 @@ export const orderApiParamsSchema = findOrdersSchema
|
||||||
const queryParams: any = { ...rest };
|
const queryParams: any = { ...rest };
|
||||||
|
|
||||||
if (customerId) queryParams.customerId = customerId;
|
if (customerId) queryParams.customerId = customerId;
|
||||||
if (customerName) queryParams.customerName = customerName;
|
else if (customerName) queryParams.customerName = customerName;
|
||||||
|
|
||||||
if (filters.partnerId) queryParams.partnerId = filters.partnerId;
|
if (filters.partnerId) queryParams.partnerId = filters.partnerId;
|
||||||
if (filters.productId) queryParams.productId = filters.productId;
|
if (filters.productId) queryParams.productId = filters.productId;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue