Compare commits
2 Commits
cd89dff9fa
...
46cc8f89d8
| Author | SHA1 | Date |
|---|---|---|
|
|
46cc8f89d8 | |
|
|
4d2e6e4859 |
|
|
@ -72,7 +72,7 @@ export const OrderTable = () => {
|
||||||
const tableHeight = calculateTableHeight(rows.length, 10);
|
const tableHeight = calculateTableHeight(rows.length, 10);
|
||||||
|
|
||||||
const mobileTableHeight = calculateTableHeight(rows.length, 5, {
|
const mobileTableHeight = calculateTableHeight(rows.length, 5, {
|
||||||
minHeight: 300,
|
minHeight: 500,
|
||||||
rowHeight: 40,
|
rowHeight: 40,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -57,6 +57,7 @@ interface LocalFilters {
|
||||||
sellerName: string | null;
|
sellerName: string | null;
|
||||||
deliveryType: string[] | null;
|
deliveryType: string[] | null;
|
||||||
statusTransfer: string[] | null;
|
statusTransfer: string[] | null;
|
||||||
|
markName: string | null;
|
||||||
}
|
}
|
||||||
|
|
||||||
const DELIVERY_TYPES = ['RI', 'EN', 'EF', 'RP'];
|
const DELIVERY_TYPES = ['RI', 'EN', 'EF', 'RP'];
|
||||||
|
|
@ -81,6 +82,7 @@ const getInitialLocalFilters = (
|
||||||
sellerName: urlFilters.sellerName ?? null,
|
sellerName: urlFilters.sellerName ?? null,
|
||||||
deliveryType: urlFilters.deliveryType ?? null,
|
deliveryType: urlFilters.deliveryType ?? null,
|
||||||
statusTransfer: urlFilters.statusTransfer ?? null,
|
statusTransfer: urlFilters.statusTransfer ?? null,
|
||||||
|
markName: urlFilters.markName ?? null,
|
||||||
});
|
});
|
||||||
|
|
||||||
export const SearchBar = () => {
|
export const SearchBar = () => {
|
||||||
|
|
@ -144,6 +146,7 @@ export const SearchBar = () => {
|
||||||
productName: null,
|
productName: null,
|
||||||
deliveryType: null,
|
deliveryType: null,
|
||||||
statusTransfer: null,
|
statusTransfer: null,
|
||||||
|
markName: null,
|
||||||
};
|
};
|
||||||
|
|
||||||
setLocalFilters(getInitialLocalFilters(resetState));
|
setLocalFilters(getInitialLocalFilters(resetState));
|
||||||
|
|
@ -210,6 +213,7 @@ export const SearchBar = () => {
|
||||||
localFilters.productId,
|
localFilters.productId,
|
||||||
localFilters.deliveryType?.length,
|
localFilters.deliveryType?.length,
|
||||||
localFilters.statusTransfer?.length,
|
localFilters.statusTransfer?.length,
|
||||||
|
localFilters.markName,
|
||||||
].filter(Boolean).length;
|
].filter(Boolean).length;
|
||||||
|
|
||||||
const toggleDrawer = (open: boolean) => (event: React.KeyboardEvent | React.MouseEvent) => {
|
const toggleDrawer = (open: boolean) => (event: React.KeyboardEvent | React.MouseEvent) => {
|
||||||
|
|
@ -311,6 +315,19 @@ export const SearchBar = () => {
|
||||||
Limpar
|
Limpar
|
||||||
</Button>
|
</Button>
|
||||||
|
|
||||||
|
<Button
|
||||||
|
variant="contained"
|
||||||
|
color="primary"
|
||||||
|
size="small"
|
||||||
|
onClick={handleFilter}
|
||||||
|
disabled={!isDateValid || !!dateError || isFetching}
|
||||||
|
startIcon={isFetching ? <CircularProgress size={16} color="inherit" /> : <SearchIcon />}
|
||||||
|
fullWidth
|
||||||
|
sx={{ textTransform: 'none', minWidth: { xs: '100%', sm: 100 } }}
|
||||||
|
>
|
||||||
|
Buscar
|
||||||
|
</Button>
|
||||||
|
|
||||||
<Badge badgeContent={activeDrawerFiltersCount} color="primary" sx={{ width: { xs: '100%', sm: 'auto' } }}>
|
<Badge badgeContent={activeDrawerFiltersCount} color="primary" sx={{ width: { xs: '100%', sm: 'auto' } }}>
|
||||||
<Button
|
<Button
|
||||||
variant="outlined"
|
variant="outlined"
|
||||||
|
|
@ -324,19 +341,6 @@ export const SearchBar = () => {
|
||||||
Filtros
|
Filtros
|
||||||
</Button>
|
</Button>
|
||||||
</Badge>
|
</Badge>
|
||||||
|
|
||||||
<Button
|
|
||||||
variant="contained"
|
|
||||||
color="primary"
|
|
||||||
size="small"
|
|
||||||
onClick={handleFilter}
|
|
||||||
disabled={!isDateValid || !!dateError || isFetching}
|
|
||||||
startIcon={isFetching ? <CircularProgress size={16} color="inherit" /> : <SearchIcon />}
|
|
||||||
fullWidth
|
|
||||||
sx={{ textTransform: 'none', minWidth: { xs: '100%', sm: 100 } }}
|
|
||||||
>
|
|
||||||
Buscar
|
|
||||||
</Button>
|
|
||||||
</Grid>
|
</Grid>
|
||||||
</Grid>
|
</Grid>
|
||||||
|
|
||||||
|
|
@ -430,8 +434,17 @@ export const SearchBar = () => {
|
||||||
updateLocalFilter('sellerId', newValue?.seller.id.toString() || null);
|
updateLocalFilter('sellerId', newValue?.seller.id.toString() || null);
|
||||||
updateLocalFilter('sellerName', newValue?.seller.name || null);
|
updateLocalFilter('sellerName', newValue?.seller.name || null);
|
||||||
}}
|
}}
|
||||||
|
isOptionEqualToValue={(option, value) => option.value === value.value}
|
||||||
loading={sellers.isLoading}
|
loading={sellers.isLoading}
|
||||||
renderInput={(params) => <TextField {...params} label="Vendedor" placeholder="Selecione vendedor" />}
|
renderInput={(params) => <TextField {...params} label="Vendedor" placeholder="Selecione vendedor" />}
|
||||||
|
renderOption={(props, option) => {
|
||||||
|
const { key, ...restProps } = props;
|
||||||
|
return (
|
||||||
|
<li key={option.id} {...restProps}>
|
||||||
|
{option.label}
|
||||||
|
</li>
|
||||||
|
);
|
||||||
|
}}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
{/* Parceiro */}
|
{/* Parceiro */}
|
||||||
|
|
@ -468,6 +481,16 @@ export const SearchBar = () => {
|
||||||
filterOptions={(x) => x}
|
filterOptions={(x) => x}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
|
{/* Marca */}
|
||||||
|
<Autocomplete
|
||||||
|
freeSolo
|
||||||
|
size="small"
|
||||||
|
options={[]}
|
||||||
|
value={localFilters.markName ?? ''}
|
||||||
|
onInputChange={(_, newValue) => updateLocalFilter('markName', newValue || null)}
|
||||||
|
renderInput={(params) => <TextField {...params} label="Marca" placeholder="Digite a marca..." />}
|
||||||
|
/>
|
||||||
|
|
||||||
{/* Tipo de Entrega */}
|
{/* Tipo de Entrega */}
|
||||||
<Autocomplete
|
<Autocomplete
|
||||||
multiple
|
multiple
|
||||||
|
|
|
||||||
|
|
@ -36,6 +36,7 @@ export const useOrderFilters = () => {
|
||||||
searchTriggered: parseAsBoolean.withDefault(false),
|
searchTriggered: parseAsBoolean.withDefault(false),
|
||||||
deliveryType: parseAsArrayOf(parseAsString, ','),
|
deliveryType: parseAsArrayOf(parseAsString, ','),
|
||||||
statusTransfer: parseAsArrayOf(parseAsString, ','),
|
statusTransfer: parseAsArrayOf(parseAsString, ','),
|
||||||
|
markName: parseAsString,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
shallow: true,
|
shallow: true,
|
||||||
|
|
|
||||||
|
|
@ -130,6 +130,7 @@ export const orderApiParamsSchema = findOrdersSchema
|
||||||
|
|
||||||
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;
|
||||||
|
if (filters.markName) queryParams.markName = filters.markName;
|
||||||
|
|
||||||
return queryParams;
|
return queryParams;
|
||||||
})
|
})
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue