cities filter
This commit is contained in:
		@@ -1,5 +1,6 @@
 | 
				
			|||||||
import apiClient from "./apiClient";
 | 
					import apiClient from "./apiClient";
 | 
				
			||||||
import {ShippingWarehouse} from "../types/shippingWarehouse";
 | 
					import {ShippingWarehouse} from "../types/shippingWarehouse";
 | 
				
			||||||
 | 
					import {City} from "../types/city";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
const router = '/general';
 | 
					const router = '/general';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -8,5 +9,9 @@ const generalApi = {
 | 
				
			|||||||
        let response = await apiClient.get(`${router}/getShippingWarehouses`);
 | 
					        let response = await apiClient.get(`${router}/getShippingWarehouses`);
 | 
				
			||||||
        return response.data;
 | 
					        return response.data;
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
 | 
					    getCities: async (): Promise<City[]> => {
 | 
				
			||||||
 | 
					        let response = await apiClient.get(`${router}/getCities`);
 | 
				
			||||||
 | 
					        return response.data;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
export default generalApi;
 | 
					export default generalApi;
 | 
				
			||||||
@@ -3,6 +3,7 @@ import {Order} from "../types/order";
 | 
				
			|||||||
import * as inspector from "inspector";
 | 
					import * as inspector from "inspector";
 | 
				
			||||||
import {OrderStatus} from "../features/ordersFilter/ordersFilterSlice";
 | 
					import {OrderStatus} from "../features/ordersFilter/ordersFilterSlice";
 | 
				
			||||||
import {ShippingWarehouse} from "../types/shippingWarehouse";
 | 
					import {ShippingWarehouse} from "../types/shippingWarehouse";
 | 
				
			||||||
 | 
					import {City} from "../types/city";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
const router = '/orders';
 | 
					const router = '/orders';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -25,12 +26,14 @@ const ordersApi = {
 | 
				
			|||||||
        desc: boolean,
 | 
					        desc: boolean,
 | 
				
			||||||
        status: OrderStatus,
 | 
					        status: OrderStatus,
 | 
				
			||||||
        shipmentDate: string,
 | 
					        shipmentDate: string,
 | 
				
			||||||
        shippingWarehouse: ShippingWarehouse
 | 
					        shippingWarehouse: ShippingWarehouse,
 | 
				
			||||||
 | 
					        city: City
 | 
				
			||||||
    }): Promise<Order[]> => {
 | 
					    }): Promise<Order[]> => {
 | 
				
			||||||
        let response = await apiClient.get(`${router}/getByProductId`, {
 | 
					        let response = await apiClient.get(`${router}/getByProductId`, {
 | 
				
			||||||
            params: {
 | 
					            params: {
 | 
				
			||||||
                ...params,
 | 
					                ...params,
 | 
				
			||||||
                shippingWarehouse: params.shippingWarehouse.id
 | 
					                shippingWarehouse: params.shippingWarehouse.id,
 | 
				
			||||||
 | 
					                city: params.city.id
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
        });
 | 
					        });
 | 
				
			||||||
        return response.data;
 | 
					        return response.data;
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										42
									
								
								src/components/CitySelect/CitySelect.tsx
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										42
									
								
								src/components/CitySelect/CitySelect.tsx
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,42 @@
 | 
				
			|||||||
 | 
					import {FC, useEffect} from "react";
 | 
				
			||||||
 | 
					import {useDispatch, useSelector} from "react-redux";
 | 
				
			||||||
 | 
					import {RootState} from "../../redux/store";
 | 
				
			||||||
 | 
					import {Picker} from "@react-native-picker/picker";
 | 
				
			||||||
 | 
					import generalApi from "../../api/generalApi";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import {responsiveWidth} from "react-native-responsive-dimensions";
 | 
				
			||||||
 | 
					import {View} from "react-native";
 | 
				
			||||||
 | 
					import {initializeCitySelect, selectCity} from "../../features/citySelect/citySelectSlice";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					const CitySelect: FC = () => {
 | 
				
			||||||
 | 
					    const state = useSelector((state: RootState) => state.citySelect);
 | 
				
			||||||
 | 
					    const dispatch = useDispatch();
 | 
				
			||||||
 | 
					    useEffect(() => {
 | 
				
			||||||
 | 
					        if (state.initialized) return;
 | 
				
			||||||
 | 
					        generalApi.getCities().then(cities =>
 | 
				
			||||||
 | 
					            dispatch(initializeCitySelect(cities)))
 | 
				
			||||||
 | 
					    }, []);
 | 
				
			||||||
 | 
					    return (
 | 
				
			||||||
 | 
					        <View style={{
 | 
				
			||||||
 | 
					            borderWidth: responsiveWidth(0.1),
 | 
				
			||||||
 | 
					            borderRadius: responsiveWidth(1)
 | 
				
			||||||
 | 
					        }}>
 | 
				
			||||||
 | 
					            <Picker
 | 
				
			||||||
 | 
					                selectedValue={state.selectedCity?.id}
 | 
				
			||||||
 | 
					                onValueChange={(value, event) => dispatch(selectCity({cityId: value}))}
 | 
				
			||||||
 | 
					            >
 | 
				
			||||||
 | 
					                {state.cities.map(city => (
 | 
				
			||||||
 | 
					                    <Picker.Item
 | 
				
			||||||
 | 
					                        key={city.id}
 | 
				
			||||||
 | 
					                        label={city.name}
 | 
				
			||||||
 | 
					                        value={city.id}
 | 
				
			||||||
 | 
					                        style={{fontSize: responsiveWidth(3)}}
 | 
				
			||||||
 | 
					                    />
 | 
				
			||||||
 | 
					                ))}
 | 
				
			||||||
 | 
					            </Picker>
 | 
				
			||||||
 | 
					        </View>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    )
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					export default CitySelect;
 | 
				
			||||||
@@ -13,11 +13,12 @@ import DateTimePicker from '@react-native-community/datetimepicker';
 | 
				
			|||||||
import {RootState} from "../../../redux/store";
 | 
					import {RootState} from "../../../redux/store";
 | 
				
			||||||
import {
 | 
					import {
 | 
				
			||||||
    closeOrdersFilterModal,
 | 
					    closeOrdersFilterModal,
 | 
				
			||||||
    orderStatuses,
 | 
					    orderStatuses, setCity,
 | 
				
			||||||
    setDesc,
 | 
					    setDesc,
 | 
				
			||||||
    setOrderBy, setShipmentDate, setShippingWarehouse, setStatus
 | 
					    setOrderBy, setShipmentDate, setShippingWarehouse, setStatus
 | 
				
			||||||
} from "../../../features/ordersFilter/ordersFilterSlice";
 | 
					} from "../../../features/ordersFilter/ordersFilterSlice";
 | 
				
			||||||
import ShippingWarehouseSelect from "../../ShippingWarehouseSelect/ShippingWarehouseSelect";
 | 
					import ShippingWarehouseSelect from "../../ShippingWarehouseSelect/ShippingWarehouseSelect";
 | 
				
			||||||
 | 
					import CitySelect from "../../CitySelect/CitySelect";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
export type SortingModalHandles = {
 | 
					export type SortingModalHandles = {
 | 
				
			||||||
    present: () => void;
 | 
					    present: () => void;
 | 
				
			||||||
@@ -49,6 +50,7 @@ const createRadioButton = (element: SortingModalElement) => {
 | 
				
			|||||||
const SortingModal = () => {
 | 
					const SortingModal = () => {
 | 
				
			||||||
    const state = useSelector((state: RootState) => state.ordersFilter);
 | 
					    const state = useSelector((state: RootState) => state.ordersFilter);
 | 
				
			||||||
    const shipmentWarehouseSelectorState = useSelector((state: RootState) => state.shippingWarehouseSelect);
 | 
					    const shipmentWarehouseSelectorState = useSelector((state: RootState) => state.shippingWarehouseSelect);
 | 
				
			||||||
 | 
					    const citySelectorState = useSelector((state: RootState) => state.citySelect);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    const elements = [
 | 
					    const elements = [
 | 
				
			||||||
        {id: 'createdOnAsc', value: 'createdOnAsc', label: 'Дата создания по возрастанию'},
 | 
					        {id: 'createdOnAsc', value: 'createdOnAsc', label: 'Дата создания по возрастанию'},
 | 
				
			||||||
@@ -77,6 +79,9 @@ const SortingModal = () => {
 | 
				
			|||||||
    useEffect(() => {
 | 
					    useEffect(() => {
 | 
				
			||||||
        dispatch(setShippingWarehouse(shipmentWarehouseSelectorState.selectedShippingWarehouse));
 | 
					        dispatch(setShippingWarehouse(shipmentWarehouseSelectorState.selectedShippingWarehouse));
 | 
				
			||||||
    }, [shipmentWarehouseSelectorState.selectedShippingWarehouse]);
 | 
					    }, [shipmentWarehouseSelectorState.selectedShippingWarehouse]);
 | 
				
			||||||
 | 
					    useEffect(() => {
 | 
				
			||||||
 | 
					        dispatch(setCity(citySelectorState.selectedCity));
 | 
				
			||||||
 | 
					    }, [citySelectorState.selectedCity]);
 | 
				
			||||||
    return (
 | 
					    return (
 | 
				
			||||||
        <BottomSheetModal
 | 
					        <BottomSheetModal
 | 
				
			||||||
            ref={modalRef}
 | 
					            ref={modalRef}
 | 
				
			||||||
@@ -104,37 +109,38 @@ const SortingModal = () => {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                    <View style={styles.selectors}>
 | 
					                    <View style={styles.selectors}>
 | 
				
			||||||
                        <View style={styles.selector}>
 | 
					                        {/*<View style={styles.selector}>*/}
 | 
				
			||||||
                            <Picker selectedValue={state.status}
 | 
					                        {/*    <Picker selectedValue={state.status}*/}
 | 
				
			||||||
                                    onValueChange={(value, event) => dispatch(setStatus(value))}>
 | 
					                        {/*            onValueChange={(value, event) => dispatch(setStatus(value))}>*/}
 | 
				
			||||||
                                {orderStatuses.map((status) => {
 | 
					                        {/*        {orderStatuses.map((status) => {*/}
 | 
				
			||||||
                                    return (
 | 
					                        {/*            return (*/}
 | 
				
			||||||
                                        <Picker.Item
 | 
					                        {/*                <Picker.Item*/}
 | 
				
			||||||
                                            key={status.key}
 | 
					                        {/*                    key={status.key}*/}
 | 
				
			||||||
                                            label={status.label}
 | 
					                        {/*                    label={status.label}*/}
 | 
				
			||||||
                                            value={status.key}
 | 
					                        {/*                    value={status.key}*/}
 | 
				
			||||||
                                            style={{fontSize: responsiveWidth(3)}}
 | 
					                        {/*                    style={{fontSize: responsiveWidth(3)}}*/}
 | 
				
			||||||
                                        />
 | 
					                        {/*                />*/}
 | 
				
			||||||
                                    )
 | 
					                        {/*            )*/}
 | 
				
			||||||
                                })}
 | 
					                        {/*        })}*/}
 | 
				
			||||||
                            </Picker>
 | 
					                        {/*    </Picker>*/}
 | 
				
			||||||
                        </View>
 | 
					                        {/*</View>*/}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                        <ShippingWarehouseSelect/>
 | 
					                        <ShippingWarehouseSelect/>
 | 
				
			||||||
 | 
					                        <CitySelect/>
 | 
				
			||||||
                    </View>
 | 
					                    </View>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                    <BasicButton onPress={() => setShowShipmentPicker(oldValue => !oldValue)}
 | 
					                    {/*<BasicButton onPress={() => setShowShipmentPicker(oldValue => !oldValue)}*/}
 | 
				
			||||||
                                 label={"Выбрать дату отгрузки"}/>
 | 
					                    {/*             label={"Выбрать дату отгрузки"}/>*/}
 | 
				
			||||||
                    {showShipmentPicker &&
 | 
					                    {/*{showShipmentPicker &&*/}
 | 
				
			||||||
                        <DateTimePicker value={new Date(state.shipmentDate)}
 | 
					                    {/*    <DateTimePicker value={new Date(state.shipmentDate)}*/}
 | 
				
			||||||
                                        onChange={(event) => {
 | 
					                    {/*                    onChange={(event) => {*/}
 | 
				
			||||||
                                            if (!event.nativeEvent.timestamp) return;
 | 
					                    {/*                        if (!event.nativeEvent.timestamp) return;*/}
 | 
				
			||||||
                                            setShowShipmentPicker(false);
 | 
					                    {/*                        setShowShipmentPicker(false);*/}
 | 
				
			||||||
                                            if (event.type === 'set') {
 | 
					                    {/*                        if (event.type === 'set') {*/}
 | 
				
			||||||
                                                const selectedDate = new Date(event.nativeEvent.timestamp);
 | 
					                    {/*                            const selectedDate = new Date(event.nativeEvent.timestamp);*/}
 | 
				
			||||||
                                                dispatch(setShipmentDate(selectedDate.toISOString()));
 | 
					                    {/*                            dispatch(setShipmentDate(selectedDate.toISOString()));*/}
 | 
				
			||||||
                                            }
 | 
					                    {/*                        }*/}
 | 
				
			||||||
                                        }}/>}
 | 
					                    {/*                    }}/>}*/}
 | 
				
			||||||
                </View>
 | 
					                </View>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -43,10 +43,11 @@ const OrderCard: FC<Props> = ({onPress, onSelect, order}) => {
 | 
				
			|||||||
                    <DText>Создан: {order.createdOn}</DText>
 | 
					                    <DText>Создан: {order.createdOn}</DText>
 | 
				
			||||||
                    <DText>Отгрузка: {order.shipmentDate}</DText>
 | 
					                    <DText>Отгрузка: {order.shipmentDate}</DText>
 | 
				
			||||||
                    <DText>Склад отгрузки: {order.shippingWarehouse}</DText>
 | 
					                    <DText>Склад отгрузки: {order.shippingWarehouse}</DText>
 | 
				
			||||||
 | 
					                    <DText>Город: {order.city}</DText>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                </View>
 | 
					                </View>
 | 
				
			||||||
                <View style={styles.descriptionStatus}>
 | 
					                <View style={styles.descriptionStatus}>
 | 
				
			||||||
                    <DText style={order.status >= OrderStatus.CANCELLED  && {color: "red"}}>
 | 
					                    <DText style={order.status >= OrderStatus.CANCELLED && {color: "red"}}>
 | 
				
			||||||
                        {OrderStatusDictionary[order.status as OrderStatus]}
 | 
					                        {OrderStatusDictionary[order.status as OrderStatus]}
 | 
				
			||||||
                    </DText>
 | 
					                    </DText>
 | 
				
			||||||
                </View>
 | 
					                </View>
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										36
									
								
								src/features/citySelect/citySelectSlice.ts
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										36
									
								
								src/features/citySelect/citySelectSlice.ts
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,36 @@
 | 
				
			|||||||
 | 
					import {City, noCity} from "../../types/city";
 | 
				
			||||||
 | 
					import {createSlice, PayloadAction} from "@reduxjs/toolkit";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					export interface CitySelectState {
 | 
				
			||||||
 | 
					    cities: City[];
 | 
				
			||||||
 | 
					    selectedCity: City;
 | 
				
			||||||
 | 
					    initialized: boolean;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					const initialState: CitySelectState = {
 | 
				
			||||||
 | 
					    cities: [],
 | 
				
			||||||
 | 
					    selectedCity: noCity,
 | 
				
			||||||
 | 
					    initialized: false
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					export const citySelect = createSlice({
 | 
				
			||||||
 | 
					    name: 'citySelect',
 | 
				
			||||||
 | 
					    initialState,
 | 
				
			||||||
 | 
					    reducers: {
 | 
				
			||||||
 | 
					        initializeCitySelect: (state, action: PayloadAction<City[]>) => {
 | 
				
			||||||
 | 
					            state.cities = action.payload;
 | 
				
			||||||
 | 
					            state.initialized = true;
 | 
				
			||||||
 | 
					            if (state.cities.length > 0) state.selectedCity = state.cities[0];
 | 
				
			||||||
 | 
					        },
 | 
				
			||||||
 | 
					        selectCity: (state, action: PayloadAction<{ cityId: number }>) => {
 | 
				
			||||||
 | 
					            let selectedCity = state.cities.find(city => city.id == action.payload.cityId);
 | 
				
			||||||
 | 
					            if (!selectedCity) return;
 | 
				
			||||||
 | 
					            state.selectedCity = selectedCity;
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					})
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					export const {initializeCitySelect, selectCity} = citySelect.actions;
 | 
				
			||||||
 | 
					export default citySelect.reducer;
 | 
				
			||||||
@@ -1,6 +1,7 @@
 | 
				
			|||||||
import {createSlice, PayloadAction} from "@reduxjs/toolkit";
 | 
					import {createSlice, PayloadAction} from "@reduxjs/toolkit";
 | 
				
			||||||
import {ShippingWarehouse} from "../../types/shippingWarehouse";
 | 
					import {noShippingWarehouse, ShippingWarehouse} from "../../types/shippingWarehouse";
 | 
				
			||||||
import ShippingWarehouseSelect from "../../components/ShippingWarehouseSelect/ShippingWarehouseSelect";
 | 
					import ShippingWarehouseSelect from "../../components/ShippingWarehouseSelect/ShippingWarehouseSelect";
 | 
				
			||||||
 | 
					import {City, noCity} from "../../types/city";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
export enum OrderStatus {
 | 
					export enum OrderStatus {
 | 
				
			||||||
    ALL = -1,
 | 
					    ALL = -1,
 | 
				
			||||||
@@ -44,7 +45,8 @@ export interface OrdersFilterState {
 | 
				
			|||||||
    status: OrderStatus;
 | 
					    status: OrderStatus;
 | 
				
			||||||
    shipmentDate: string;
 | 
					    shipmentDate: string;
 | 
				
			||||||
    page: number;
 | 
					    page: number;
 | 
				
			||||||
    shippingWarehouse: ShippingWarehouse
 | 
					    shippingWarehouse: ShippingWarehouse;
 | 
				
			||||||
 | 
					    city: City;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
const initialState: OrdersFilterState = {
 | 
					const initialState: OrdersFilterState = {
 | 
				
			||||||
@@ -54,10 +56,8 @@ const initialState: OrdersFilterState = {
 | 
				
			|||||||
    shipmentDate: (new Date()).toISOString(),
 | 
					    shipmentDate: (new Date()).toISOString(),
 | 
				
			||||||
    status: OrderStatus.AWAITING_PACKAGING,
 | 
					    status: OrderStatus.AWAITING_PACKAGING,
 | 
				
			||||||
    page: 0,
 | 
					    page: 0,
 | 
				
			||||||
    shippingWarehouse: {
 | 
					    shippingWarehouse: noShippingWarehouse,
 | 
				
			||||||
        id: -1,
 | 
					    city: noCity
 | 
				
			||||||
        name: 'Все склады отгрузки'
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
export const ordersFilterSlice = createSlice({
 | 
					export const ordersFilterSlice = createSlice({
 | 
				
			||||||
@@ -85,6 +85,9 @@ export const ordersFilterSlice = createSlice({
 | 
				
			|||||||
        setShippingWarehouse: (state, action: PayloadAction<ShippingWarehouse>) => {
 | 
					        setShippingWarehouse: (state, action: PayloadAction<ShippingWarehouse>) => {
 | 
				
			||||||
            state.shippingWarehouse = action.payload;
 | 
					            state.shippingWarehouse = action.payload;
 | 
				
			||||||
        },
 | 
					        },
 | 
				
			||||||
 | 
					        setCity: (state, action: PayloadAction<City>) => {
 | 
				
			||||||
 | 
					            state.city = action.payload;
 | 
				
			||||||
 | 
					        },
 | 
				
			||||||
        setPage: (state, action: PayloadAction<number>) => {
 | 
					        setPage: (state, action: PayloadAction<number>) => {
 | 
				
			||||||
            console.log(action)
 | 
					            console.log(action)
 | 
				
			||||||
            state.page = action.payload;
 | 
					            state.page = action.payload;
 | 
				
			||||||
@@ -107,6 +110,7 @@ export const {
 | 
				
			|||||||
    setDesc,
 | 
					    setDesc,
 | 
				
			||||||
    setStatus,
 | 
					    setStatus,
 | 
				
			||||||
    setShipmentDate,
 | 
					    setShipmentDate,
 | 
				
			||||||
 | 
					    setCity,
 | 
				
			||||||
    setPage,
 | 
					    setPage,
 | 
				
			||||||
    setShippingWarehouse
 | 
					    setShippingWarehouse
 | 
				
			||||||
} = ordersFilterSlice.actions;
 | 
					} = ordersFilterSlice.actions;
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,5 +1,5 @@
 | 
				
			|||||||
import {createSlice, PayloadAction} from "@reduxjs/toolkit";
 | 
					import {createSlice, PayloadAction} from "@reduxjs/toolkit";
 | 
				
			||||||
import {ShippingWarehouse} from "../../types/shippingWarehouse";
 | 
					import {noShippingWarehouse, ShippingWarehouse} from "../../types/shippingWarehouse";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
export interface ShippingWarehouseSelectState {
 | 
					export interface ShippingWarehouseSelectState {
 | 
				
			||||||
    shippingWarehouses: ShippingWarehouse[]
 | 
					    shippingWarehouses: ShippingWarehouse[]
 | 
				
			||||||
@@ -9,10 +9,7 @@ export interface ShippingWarehouseSelectState {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
const initialState: ShippingWarehouseSelectState = {
 | 
					const initialState: ShippingWarehouseSelectState = {
 | 
				
			||||||
    shippingWarehouses: [],
 | 
					    shippingWarehouses: [],
 | 
				
			||||||
    selectedShippingWarehouse: {
 | 
					    selectedShippingWarehouse: noShippingWarehouse,
 | 
				
			||||||
        id: -1,
 | 
					 | 
				
			||||||
        name: "Все склады отгрузки"
 | 
					 | 
				
			||||||
    },
 | 
					 | 
				
			||||||
    initialized: false
 | 
					    initialized: false
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -10,6 +10,7 @@ import printingReducer from 'features/printing/printingSlice';
 | 
				
			|||||||
import reprintModalReducer from 'features/reprintModal/reprintModalSlice';
 | 
					import reprintModalReducer from 'features/reprintModal/reprintModalSlice';
 | 
				
			||||||
import ordersFilterReducer from 'features/ordersFilter/ordersFilterSlice';
 | 
					import ordersFilterReducer from 'features/ordersFilter/ordersFilterSlice';
 | 
				
			||||||
import shippingWarehouseSelectReducer from 'features/shippingWarehouseSelect/shippingWarehouseSelectSlice';
 | 
					import shippingWarehouseSelectReducer from 'features/shippingWarehouseSelect/shippingWarehouseSelectSlice';
 | 
				
			||||||
 | 
					import citySelectReducer from 'features/citySelect/citySelectSlice';
 | 
				
			||||||
import {useDispatch} from "react-redux";
 | 
					import {useDispatch} from "react-redux";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
export const store = configureStore({
 | 
					export const store = configureStore({
 | 
				
			||||||
@@ -23,7 +24,8 @@ export const store = configureStore({
 | 
				
			|||||||
        reprintModal: reprintModalReducer,
 | 
					        reprintModal: reprintModalReducer,
 | 
				
			||||||
        imageZoomModal: imageZoomModalReducer,
 | 
					        imageZoomModal: imageZoomModalReducer,
 | 
				
			||||||
        ordersFilter: ordersFilterReducer,
 | 
					        ordersFilter: ordersFilterReducer,
 | 
				
			||||||
        shippingWarehouseSelect: shippingWarehouseSelectReducer
 | 
					        shippingWarehouseSelect: shippingWarehouseSelectReducer,
 | 
				
			||||||
 | 
					        citySelect: citySelectReducer
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
});
 | 
					});
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -19,10 +19,11 @@ const useBarcodeOrders = (props: Props) => {
 | 
				
			|||||||
        desc,
 | 
					        desc,
 | 
				
			||||||
        shipmentDate,
 | 
					        shipmentDate,
 | 
				
			||||||
        status,
 | 
					        status,
 | 
				
			||||||
        shippingWarehouse
 | 
					        shippingWarehouse,
 | 
				
			||||||
 | 
					        city
 | 
				
			||||||
    } = useSelector((state: RootState) => state.ordersFilter);
 | 
					    } = useSelector((state: RootState) => state.ordersFilter);
 | 
				
			||||||
    const fetchOrders = async (): Promise<Order[]> => {
 | 
					    const fetchOrders = async (): Promise<Order[]> => {
 | 
				
			||||||
        return ordersApi.getOrdersByProduct({productId, orderBy, shipmentDate, status, shippingWarehouse, desc});
 | 
					        return ordersApi.getOrdersByProduct({productId, orderBy, shipmentDate, status, shippingWarehouse,city, desc});
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    useEffect(() => {
 | 
					    useEffect(() => {
 | 
				
			||||||
        if (isVisible || productId < 0) return;
 | 
					        if (isVisible || productId < 0) return;
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -64,6 +64,7 @@ function CommonPage() {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    const checkUpdates = async () => {
 | 
					    const checkUpdates = async () => {
 | 
				
			||||||
        const currentVersion = Constants.manifest2?.extra?.expoClient?.version || Constants.manifest?.version;
 | 
					        const currentVersion = Constants.manifest2?.extra?.expoClient?.version || Constants.manifest?.version;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        applicationApi.getVersion('assemblr').then(({latest_version}) => {
 | 
					        applicationApi.getVersion('assemblr').then(({latest_version}) => {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            if (currentVersion == latest_version) return;
 | 
					            if (currentVersion == latest_version) return;
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -244,6 +244,7 @@ const OrderScreen: FC<OrderScreenProps> = ({order}) => {
 | 
				
			|||||||
                        <DText>Отгрузка: {order.shipmentDate}</DText>
 | 
					                        <DText>Отгрузка: {order.shipmentDate}</DText>
 | 
				
			||||||
                        <DText>Статус: {OrderStatusDictionary[order.status as OrderStatus]}</DText>
 | 
					                        <DText>Статус: {OrderStatusDictionary[order.status as OrderStatus]}</DText>
 | 
				
			||||||
                        <DText>Склад отгрузки: {order.shippingWarehouse}</DText>
 | 
					                        <DText>Склад отгрузки: {order.shippingWarehouse}</DText>
 | 
				
			||||||
 | 
					                        <DText>Город: {order.city}</DText>
 | 
				
			||||||
                        <DText>{}</DText>
 | 
					                        <DText>{}</DText>
 | 
				
			||||||
                        <DTitle style={styles.contentTitle}>Товар</DTitle>
 | 
					                        <DTitle style={styles.contentTitle}>Товар</DTitle>
 | 
				
			||||||
                        <DText>Арт. DENCO: {selectedProduct?.dencoArticle}</DText>
 | 
					                        <DText>Арт. DENCO: {selectedProduct?.dencoArticle}</DText>
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										9
									
								
								src/types/city.ts
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										9
									
								
								src/types/city.ts
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,9 @@
 | 
				
			|||||||
 | 
					export type City = {
 | 
				
			||||||
 | 
					    id: number;
 | 
				
			||||||
 | 
					    name: string;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					export const noCity = {
 | 
				
			||||||
 | 
					    id: -1,
 | 
				
			||||||
 | 
					    name: "Все города"
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
@@ -27,5 +27,6 @@ export type Order = {
 | 
				
			|||||||
    shipmentDate: string;
 | 
					    shipmentDate: string;
 | 
				
			||||||
    createdOn: string;
 | 
					    createdOn: string;
 | 
				
			||||||
    shippingWarehouse: string;
 | 
					    shippingWarehouse: string;
 | 
				
			||||||
 | 
					    city: string;
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -2,3 +2,8 @@ export type ShippingWarehouse = {
 | 
				
			|||||||
    id: number;
 | 
					    id: number;
 | 
				
			||||||
    name: string;
 | 
					    name: string;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					export const noShippingWarehouse = {
 | 
				
			||||||
 | 
					    id: -1,
 | 
				
			||||||
 | 
					    name: "Все склады отгрузки"
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
		Reference in New Issue
	
	Block a user