parent
85f94a5070
commit
e86255756a
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -0,0 +1,32 @@
|
|||||||
|
import { Layer } from "react-map-gl";
|
||||||
|
import { cancelledPointLayer } from "./layers-config";
|
||||||
|
import { useLayersVisibility } from "../../stores/useLayersVisibility";
|
||||||
|
import { STATUSES } from "../../config";
|
||||||
|
import { useRegionFilterExpression } from "./useRegionFilterExpression";
|
||||||
|
import { LAYER_IDS } from "./constants";
|
||||||
|
|
||||||
|
const statusExpression = ["==", ["get", "status"], STATUSES.cancelled];
|
||||||
|
|
||||||
|
export const CancelledPoints = () => {
|
||||||
|
const { isVisible } = useLayersVisibility();
|
||||||
|
const regionFilterExpression = useRegionFilterExpression();
|
||||||
|
|
||||||
|
const filter = regionFilterExpression
|
||||||
|
? ["all", statusExpression, regionFilterExpression]
|
||||||
|
: statusExpression;
|
||||||
|
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<Layer
|
||||||
|
{...cancelledPointLayer}
|
||||||
|
id={LAYER_IDS.cancelled}
|
||||||
|
source={"points"}
|
||||||
|
source-layer={"public.service_placementpoint"}
|
||||||
|
layout={{
|
||||||
|
visibility: isVisible[LAYER_IDS.cancelled] ? "visible" : "none",
|
||||||
|
}}
|
||||||
|
filter={filter}
|
||||||
|
/>
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
};
|
||||||
@ -0,0 +1,22 @@
|
|||||||
|
import { Layer } from "react-map-gl";
|
||||||
|
import { otherPostamatesLayer } from "./layers-config";
|
||||||
|
import { useLayersVisibility } from "../../stores/useLayersVisibility";
|
||||||
|
import { LAYER_IDS } from "./constants";
|
||||||
|
|
||||||
|
export const OtherPostamates = () => {
|
||||||
|
const { isVisible } = useLayersVisibility();
|
||||||
|
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<Layer
|
||||||
|
{...otherPostamatesLayer}
|
||||||
|
id={LAYER_IDS.other}
|
||||||
|
source={"rivals"}
|
||||||
|
source-layer={"public.service_rivals"}
|
||||||
|
layout={{
|
||||||
|
visibility: isVisible[LAYER_IDS.other] ? "visible" : "none",
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
};
|
||||||
@ -0,0 +1,22 @@
|
|||||||
|
import { Layer } from "react-map-gl";
|
||||||
|
import { pvzPointLayer } from "./layers-config";
|
||||||
|
import { useLayersVisibility } from "../../stores/useLayersVisibility";
|
||||||
|
import { LAYER_IDS } from "./constants";
|
||||||
|
|
||||||
|
export const PVZ = () => {
|
||||||
|
const { isVisible } = useLayersVisibility();
|
||||||
|
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<Layer
|
||||||
|
{...pvzPointLayer}
|
||||||
|
id={LAYER_IDS.pvz}
|
||||||
|
source={"rivals"}
|
||||||
|
source-layer={"public.service_rivals"}
|
||||||
|
layout={{
|
||||||
|
visibility: isVisible[LAYER_IDS.pvz] ? "visible" : "none",
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
};
|
||||||
@ -1,36 +1,58 @@
|
|||||||
import { Title } from "../../components/Title";
|
|
||||||
import { useLayersVisibility } from "../../stores/useLayersVisibility";
|
import { useLayersVisibility } from "../../stores/useLayersVisibility";
|
||||||
import { useMode } from "../../stores/useMode";
|
import { useMode } from "../../stores/useMode";
|
||||||
|
import Checkbox from "antd/es/checkbox/Checkbox";
|
||||||
|
import { MODES } from "../../config";
|
||||||
|
import { LAYER_IDS } from "../Layers/constants";
|
||||||
|
|
||||||
export const LayersVisibility = () => {
|
export const LayersVisibility = () => {
|
||||||
const { toggleVisibility, isVisible } = useLayersVisibility();
|
const { toggleVisibility, isVisible } = useLayersVisibility();
|
||||||
const { mode } = useMode();
|
const { mode } = useMode();
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div>
|
<div className={"space-y-1 flex flex-col"}>
|
||||||
<Title text={"Слои"} className={"mb-1"} />
|
{mode === MODES.INITIAL && (
|
||||||
<div className={"space-y-1 flex flex-col"}>
|
<>
|
||||||
{/*{mode === MODES.INITIAL && (*/}
|
<Checkbox
|
||||||
{/* <Checkbox*/}
|
className={"!ml-0"}
|
||||||
{/* onChange={() => toggleVisibility(LAYER_IDS.initial)}*/}
|
onChange={() => toggleVisibility(LAYER_IDS.working)}
|
||||||
{/* checked={isVisible[LAYER_IDS.initial]}*/}
|
checked={isVisible[LAYER_IDS.working]}
|
||||||
{/* >*/}
|
>
|
||||||
{/* Локации к рассмотрению*/}
|
Работающие постаматы
|
||||||
{/* </Checkbox>*/}
|
</Checkbox>
|
||||||
{/*)}*/}
|
<Checkbox
|
||||||
|
className={"!ml-0"}
|
||||||
{/*{mode === MODES.WORKING && (*/}
|
onChange={() => toggleVisibility(LAYER_IDS.cancelled)}
|
||||||
{/* <>*/}
|
checked={isVisible[LAYER_IDS.cancelled]}
|
||||||
{/* <Checkbox*/}
|
>
|
||||||
{/* className={"!ml-0"}*/}
|
Отмененные локации
|
||||||
{/* onChange={() => toggleVisibility(LAYER_IDS.working)}*/}
|
</Checkbox>
|
||||||
{/* checked={isVisible[LAYER_IDS.working]}*/}
|
</>
|
||||||
{/* >*/}
|
)}
|
||||||
{/* Работает*/}
|
<Checkbox
|
||||||
{/* </Checkbox>*/}
|
className={"!ml-0"}
|
||||||
{/* </>*/}
|
onChange={() => toggleVisibility(LAYER_IDS.pvz)}
|
||||||
{/*)}*/}
|
checked={isVisible[LAYER_IDS.pvz]}
|
||||||
</div>
|
>
|
||||||
|
ПВЗ
|
||||||
|
</Checkbox>
|
||||||
|
<Checkbox
|
||||||
|
className={"!ml-0"}
|
||||||
|
onChange={() => toggleVisibility(LAYER_IDS.other)}
|
||||||
|
checked={isVisible[LAYER_IDS.other]}
|
||||||
|
>
|
||||||
|
Постаматы прочих сетей
|
||||||
|
</Checkbox>
|
||||||
|
{/*{mode === MODES.WORKING && (*/}
|
||||||
|
{/* <>*/}
|
||||||
|
{/* <Checkbox*/}
|
||||||
|
{/* className={"!ml-0"}*/}
|
||||||
|
{/* onChange={() => toggleVisibility(LAYER_IDS.working)}*/}
|
||||||
|
{/* checked={isVisible[LAYER_IDS.working]}*/}
|
||||||
|
{/* >*/}
|
||||||
|
{/* Работает*/}
|
||||||
|
{/* </Checkbox>*/}
|
||||||
|
{/* </>*/}
|
||||||
|
{/*)}*/}
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|||||||
@ -0,0 +1,31 @@
|
|||||||
|
import { Select } from "antd";
|
||||||
|
import { STATUS_LABEL_MAPPER, STATUSES } from "../config";
|
||||||
|
|
||||||
|
const statusOptions = [
|
||||||
|
{ label: STATUS_LABEL_MAPPER[STATUSES.initial], value: STATUSES.initial },
|
||||||
|
{ label: STATUS_LABEL_MAPPER[STATUSES.approve], value: STATUSES.approve },
|
||||||
|
{ label: STATUS_LABEL_MAPPER[STATUSES.working], value: STATUSES.working },
|
||||||
|
{ label: STATUS_LABEL_MAPPER[STATUSES.cancelled], value: STATUSES.cancelled },
|
||||||
|
];
|
||||||
|
|
||||||
|
export const StatusSelect = ({ value, onChange, disabled }) => {
|
||||||
|
const handleClick = (e) => e.stopPropagation();
|
||||||
|
|
||||||
|
const handleChange = (value) => {
|
||||||
|
onChange(value);
|
||||||
|
};
|
||||||
|
|
||||||
|
return (
|
||||||
|
<Select
|
||||||
|
style={{
|
||||||
|
width: 250,
|
||||||
|
}}
|
||||||
|
value={value}
|
||||||
|
onChange={handleChange}
|
||||||
|
options={statusOptions}
|
||||||
|
disabled={disabled}
|
||||||
|
placeholder="Выберите статус"
|
||||||
|
onClick={handleClick}
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
};
|
||||||
Loading…
Reference in new issue