2020-01-30 11:46:35 +00:00
|
|
|
import { stringify as stringifyQs } from "qs";
|
|
|
|
import urlJoin from "url-join";
|
|
|
|
|
|
|
|
import {
|
|
|
|
ActiveTab,
|
|
|
|
Dialog,
|
|
|
|
Filters,
|
|
|
|
Pagination,
|
|
|
|
SingleAction,
|
2020-05-14 09:30:32 +00:00
|
|
|
Sort,
|
|
|
|
TabActionDialog
|
2020-01-30 11:46:35 +00:00
|
|
|
} from "../types";
|
|
|
|
|
|
|
|
export const warehouseSection = "/warehouses/";
|
|
|
|
|
|
|
|
export const warehouseListPath = warehouseSection;
|
|
|
|
export enum WarehouseListUrlFiltersEnum {
|
|
|
|
query = "query"
|
|
|
|
}
|
|
|
|
export type WarehouseListUrlFilters = Filters<WarehouseListUrlFiltersEnum>;
|
2020-01-30 12:06:24 +00:00
|
|
|
export type WarehouseListUrlDialog = "delete" | TabActionDialog;
|
2020-01-30 11:46:35 +00:00
|
|
|
export enum WarehouseListUrlSortField {
|
|
|
|
name = "name"
|
|
|
|
}
|
|
|
|
export type WarehouseListUrlSort = Sort<WarehouseListUrlSortField>;
|
|
|
|
export type WarehouseListUrlQueryParams = ActiveTab &
|
|
|
|
Dialog<WarehouseListUrlDialog> &
|
|
|
|
Pagination &
|
|
|
|
WarehouseListUrlFilters &
|
|
|
|
WarehouseListUrlSort &
|
|
|
|
SingleAction;
|
|
|
|
export const warehouseListUrl = (params?: WarehouseListUrlQueryParams) =>
|
|
|
|
warehouseListPath + "?" + stringifyQs(params);
|
|
|
|
|
|
|
|
export const warehousePath = (id: string) => urlJoin(warehouseSection, id);
|
2020-01-30 12:06:24 +00:00
|
|
|
export type WarehouseUrlDialog = "delete";
|
2020-01-30 11:46:35 +00:00
|
|
|
export type WarehouseUrlQueryParams = Dialog<WarehouseUrlDialog> & SingleAction;
|
|
|
|
export const warehouseUrl = (id: string, params?: WarehouseUrlQueryParams) =>
|
|
|
|
warehousePath(encodeURIComponent(id)) + "?" + stringifyQs(params);
|
|
|
|
|
|
|
|
export const warehouseAddPath = urlJoin(warehouseSection, "add");
|
|
|
|
export const warehouseAddUrl = warehouseAddPath;
|