Skip to content

Saleor Core: the high performance, composable, headless commerce API.

Add voucher bulk delete

dominik-zeglen04e6168fdc4a
diff --git a/saleor/static/dashboard-next/components/AppLayout/menuStructure.ts b/saleor/static/dashboard-next/components/AppLayout/menuStructure.ts
index 3515a54e7e..81ea796e8a 100644
--- a/saleor/static/dashboard-next/components/AppLayout/menuStructure.ts
+++ b/saleor/static/dashboard-next/components/AppLayout/menuStructure.ts
@@ -76,12 +76,12 @@ const menuStructure: IMenuItem[] = [
{
ariaLabel: "sales",
label: i18n.t("Sales", { context: "Menu label" }),
- url: saleListUrl
+ url: saleListUrl()
},
{
ariaLabel: "vouchers",
label: i18n.t("Vouchers", { context: "Menu label" }),
- url: voucherListUrl
+ url: voucherListUrl()
}
],
label: i18n.t("Discounts", { context: "Menu label" }),
diff --git a/saleor/static/dashboard-next/discounts/components/VoucherList/VoucherList.tsx b/saleor/static/dashboard-next/discounts/components/VoucherList/VoucherList.tsx
index 077eb34551..9d244419f8 100644
--- a/saleor/static/dashboard-next/discounts/components/VoucherList/VoucherList.tsx
+++ b/saleor/static/dashboard-next/discounts/components/VoucherList/VoucherList.tsx
@@ -1,10 +1,10 @@
import Card from "@material-ui/core/Card";
+import Checkbox from "@material-ui/core/Checkbox";
import { createStyles, WithStyles, withStyles } from "@material-ui/core/styles";
import Table from "@material-ui/core/Table";
import TableBody from "@material-ui/core/TableBody";
import TableCell from "@material-ui/core/TableCell";
import TableFooter from "@material-ui/core/TableFooter";
-import TableHead from "@material-ui/core/TableHead";
import TableRow from "@material-ui/core/TableRow";
import * as React from "react";
@@ -12,14 +12,15 @@ import Date from "../../../components/Date";
import Money from "../../../components/Money";
import Percent from "../../../components/Percent";
import Skeleton from "../../../components/Skeleton";
+import TableHead from "../../../components/TableHead";
import TablePagination from "../../../components/TablePagination";
import i18n from "../../../i18n";
import { maybe, renderCollection } from "../../../misc";
-import { ListProps } from "../../../types";
+import { ListActions, ListProps } from "../../../types";
import { VoucherDiscountValueType } from "../../../types/globalTypes";
import { VoucherList_vouchers_edges_node } from "../../types/VoucherList";
-export interface VoucherListProps extends ListProps {
+export interface VoucherListProps extends ListProps, ListActions {
defaultCurrency: string;
vouchers: VoucherList_vouchers_edges_node[];
}
@@ -47,12 +48,17 @@ const VoucherList = withStyles(styles, {
onPreviousPage,
onRowClick,
pageInfo,
- vouchers
+ vouchers,
+ isChecked,
+ selected,
+ toggle,
+ toolbar
}: VoucherListProps & WithStyles<typeof styles>) => (
<Card>
<Table>
- <TableHead>
+ <TableHead selected={selected} toolbar={toolbar}>
<TableRow>
+ <TableCell />
<TableCell className={classes.wideColumn}>
{i18n.t("Name", {
context: "voucher list table header"
@@ -88,7 +94,7 @@ const VoucherList = withStyles(styles, {
<TableFooter>
<TableRow>
<TablePagination
- colSpan={6}
+ colSpan={7}
hasNextPage={pageInfo && !disabled ? pageInfo.hasNextPage : false}
onNextPage={onNextPage}
hasPreviousPage={
@@ -101,79 +107,93 @@ const VoucherList = withStyles(styles, {
<TableBody>
{renderCollection(
vouchers,
- voucher => (
- <TableRow
- className={!!voucher ? classes.tableRow : undefined}
- hover={!!voucher}
- key={voucher ? voucher.id : "skeleton"}
- >
- <TableCell
- className={classes.textRight}
- onClick={voucher ? onRowClick(voucher.id) : undefined}
- >
- {maybe<React.ReactNode>(() => voucher.name, <Skeleton />)}
- </TableCell>
- <TableCell className={classes.textRight}>
- {voucher && voucher.minAmountSpent ? (
- <Money money={voucher.minAmountSpent} />
- ) : voucher && voucher.minAmountSpent === null ? (
- "-"
- ) : (
- <Skeleton />
- )}
- </TableCell>
- <TableCell className={classes.textRight}>
- {voucher && voucher.startDate ? (
- <Date date={voucher.startDate} />
- ) : (
- <Skeleton />
- )}
- </TableCell>
- <TableCell className={classes.textRight}>
- {voucher && voucher.endDate ? (
- <Date date={voucher.endDate} />
- ) : voucher && voucher.endDate === null ? (
- "-"
- ) : (
- <Skeleton />
- )}
- </TableCell>
- <TableCell
- className={classes.textRight}
+ voucher => {
+ const isSelected = voucher ? isChecked(voucher.id) : false;
+
+ return (
+ <TableRow
+ className={!!voucher ? classes.tableRow : undefined}
+ hover={!!voucher}
+ key={voucher ? voucher.id : "skeleton"}
+ selected={isSelected}
onClick={voucher ? onRowClick(voucher.id) : undefined}
>
- {voucher &&
- voucher.discountValueType &&
- voucher.discountValue ? (
- voucher.discountValueType ===
- VoucherDiscountValueType.FIXED ? (
- <Money
- money={{
- amount: voucher.discountValue,
- currency: defaultCurrency
- }}
- />
+ <TableCell padding="checkbox">
+ <Checkbox
+ color="primary"
+ checked={isSelected}
+ disabled={disabled}
+ onClick={event => {
+ toggle(voucher.id);
+ event.stopPropagation();
+ }}
+ />
+ </TableCell>
+ <TableCell>
+ {maybe<React.ReactNode>(() => voucher.name, <Skeleton />)}
+ </TableCell>
+ <TableCell className={classes.textRight}>
+ {voucher && voucher.minAmountSpent ? (
+ <Money money={voucher.minAmountSpent} />
+ ) : voucher && voucher.minAmountSpent === null ? (
+ "-"
) : (
- <Percent amount={voucher.discountValue} />
- )
- ) : (
- <Skeleton />
- )}
- </TableCell>
- <TableCell className={classes.textRight}>
- {voucher && voucher.usageLimit ? (
- voucher.usageLimit
- ) : voucher && voucher.usageLimit === null ? (
- "-"
- ) : (
- <Skeleton />
- )}
- </TableCell>
- </TableRow>
- ),
+ <Skeleton />
+ )}
+ </TableCell>
+ <TableCell className={classes.textRight}>
+ {voucher && voucher.startDate ? (
+ <Date date={voucher.startDate} />
+ ) : (
+ <Skeleton />
+ )}
+ </TableCell>
+ <TableCell className={classes.textRight}>
+ {voucher && voucher.endDate ? (
+ <Date date={voucher.endDate} />
+ ) : voucher && voucher.endDate === null ? (
+ "-"
+ ) : (
+ <Skeleton />
+ )}
+ </TableCell>
+ <TableCell
+ className={classes.textRight}
+ onClick={voucher ? onRowClick(voucher.id) : undefined}
+ >
+ {voucher &&
+ voucher.discountValueType &&
+ voucher.discountValue ? (
+ voucher.discountValueType ===
+ VoucherDiscountValueType.FIXED ? (
+ <Money
+ money={{
+ amount: voucher.discountValue,
+ currency: defaultCurrency
+ }}
+ />
+ ) : (
+ <Percent amount={voucher.discountValue} />
+ )
+ ) : (
+ <Skeleton />
+ )}
+ </TableCell>
+ <TableCell className={classes.textRight}>
+ {voucher && voucher.usageLimit ? (
+ voucher.usageLimit
+ ) : voucher && voucher.usageLimit === null ? (
+ "-"
+ ) : (
+ <Skeleton />
+ )}
+ </TableCell>
+ </TableRow>
+ );
+ },
() => (
<TableRow>
- <TableCell colSpan={6}>{i18n.t("No vouchers found")}</TableCell>
+ <TableCell colSpan={7}>{i18n.t("No vouchers found")}</TableCell>
</TableRow>
)
)}
diff --git a/saleor/static/dashboard-next/discounts/components/VoucherListPage/VoucherListPage.tsx b/saleor/static/dashboard-next/discounts/components/VoucherListPage/VoucherListPage.tsx
index 74c7e3eb52..e3c71be45c 100644
--- a/saleor/static/dashboard-next/discounts/components/VoucherListPage/VoucherListPage.tsx
+++ b/saleor/static/dashboard-next/discounts/components/VoucherListPage/VoucherListPage.tsx
@@ -5,11 +5,11 @@ import * as React from "react";
import Container from "../../../components/Container";
import PageHeader from "../../../components/PageHeader";
import i18n from "../../../i18n";
-import { PageListProps } from "../../../types";
+import { ListActions, PageListProps } from "../../../types";
import { VoucherList_vouchers_edges_node } from "../../types/VoucherList";
import VoucherList from "../VoucherList";
-export interface VoucherListPageProps extends PageListProps {
+export interface VoucherListPageProps extends PageListProps, ListActions {
defaultCurrency: string;
vouchers: VoucherList_vouchers_edges_node[];
}
@@ -22,7 +22,11 @@ const VoucherListPage: React.StatelessComponent<VoucherListPageProps> = ({
onPreviousPage,
onRowClick,
pageInfo,
- vouchers
+ vouchers,
+ isChecked,
+ selected,
+ toggle,
+ toolbar
}) => (
<Container>
<PageHeader title={i18n.t("Vouchers")}>
@@ -39,6 +43,10 @@ const VoucherListPage: React.StatelessComponent<VoucherListPageProps> = ({
onRowClick={onRowClick}
pageInfo={pageInfo}
vouchers={vouchers}
+ isChecked={isChecked}
+ selected={selected}
+ toggle={toggle}
+ toolbar={toolbar}
/>
</Container>
);
diff --git a/saleor/static/dashboard-next/discounts/index.tsx b/saleor/static/dashboard-next/discounts/index.tsx
index 39ce26909f..f80d9e48e0 100644
--- a/saleor/static/dashboard-next/discounts/index.tsx
+++ b/saleor/static/dashboard-next/discounts/index.tsx
@@ -13,6 +13,7 @@ import {
SaleUrlQueryParams,
voucherAddPath,
voucherListPath,
+ VoucherListUrlQueryParams,
voucherPath,
VoucherUrlQueryParams
} from "./urls";
@@ -21,18 +22,13 @@ import SaleDetailsViewComponent from "./views/SaleDetails";
import SaleListViewComponent, { SaleListQueryParams } from "./views/SaleList";
import VoucherCreateView from "./views/VoucherCreate";
import VoucherDetailsViewComponent from "./views/VoucherDetails";
-import VoucherListViewComponent, {
- VoucherListQueryParams
-} from "./views/VoucherList";
+import VoucherListViewComponent from "./views/VoucherList";
const SaleListView: React.StatelessComponent<RouteComponentProps<{}>> = ({
location
}) => {
- const { after, before } = parseQs(location.search.substr(1));
- const params: SaleListQueryParams = {
- after,
- before
- };
+ const qs = parseQs(location.search.substr(1));
+ const params: SaleListQueryParams = qs;
return <SaleListViewComponent params={params} />;
};
@@ -55,11 +51,8 @@ const SaleDetailsView: React.StatelessComponent<
const VoucherListView: React.StatelessComponent<RouteComponentProps<{}>> = ({
location
}) => {
- const { after, before } = parseQs(location.search.substr(1));
- const params: VoucherListQueryParams = {
- after,
- before
- };
+ const qs = parseQs(location.search.substr(1));
+ const params: VoucherListUrlQueryParams = qs;
return <VoucherListViewComponent params={params} />;
};
diff --git a/saleor/static/dashboard-next/discounts/mutations.ts b/saleor/static/dashboard-next/discounts/mutations.ts
index 0a6a065c5c..0a3529b52b 100644
--- a/saleor/static/dashboard-next/discounts/mutations.ts
+++ b/saleor/static/dashboard-next/discounts/mutations.ts
@@ -7,6 +7,10 @@ import {
voucherDetailsFragment,
voucherFragment
} from "./queries";
+import {
+ SaleBulkDelete,
+ SaleBulkDeleteVariables
+} from "./types/SaleBulkDelete";
import {
SaleCataloguesAdd,
SaleCataloguesAddVariables
@@ -18,6 +22,10 @@ import {
import { SaleCreate, SaleCreateVariables } from "./types/SaleCreate";
import { SaleDelete, SaleDeleteVariables } from "./types/SaleDelete";
import { SaleUpdate, SaleUpdateVariables } from "./types/SaleUpdate";
+import {
+ VoucherBulkDelete,
+ VoucherBulkDeleteVariables
+} from "./types/VoucherBulkDelete";
import {
VoucherCataloguesAdd,
VoucherCataloguesAddVariables
@@ -132,6 +140,21 @@ export const TypedSaleDelete = TypedMutation<SaleDelete, SaleDeleteVariables>(
saleDelete
);
+const saleBulkDelete = gql`
+ mutation SaleBulkDelete($ids: [ID]!) {
+ saleBulkDelete(ids: $ids) {
+ errors {
+ field
+ message
+ }
+ }
+ }
+`;
+export const TypedSaleBulkDelete = TypedMutation<
+ SaleBulkDelete,
+ SaleBulkDeleteVariables
+>(saleBulkDelete);
+
const voucherUpdate = gql`
${voucherFragment}
mutation VoucherUpdate($input: VoucherInput!, $id: ID!) {
@@ -236,3 +259,18 @@ export const TypedVoucherDelete = TypedMutation<
VoucherDelete,
VoucherDeleteVariables
>(voucherDelete);
+
+const voucherBulkDelete = gql`
+ mutation VoucherBulkDelete($ids: [ID]!) {
+ voucherBulkDelete(ids: $ids) {
+ errors {
+ field
+ message
+ }
+ }
+ }
+`;
+export const TypedVoucherBulkDelete = TypedMutation<
+ VoucherBulkDelete,
+ VoucherBulkDeleteVariables
+>(voucherBulkDelete);
diff --git a/saleor/static/dashboard-next/discounts/types/SaleBulkDelete.ts b/saleor/static/dashboard-next/discounts/types/SaleBulkDelete.ts
new file mode 100644
index 0000000000..e02fcbac07
--- /dev/null
+++ b/saleor/static/dashboard-next/discounts/types/SaleBulkDelete.ts
@@ -0,0 +1,26 @@
+/* tslint:disable */
+/* eslint-disable */
+// This file was automatically generated and should not be edited.
+
+// ====================================================
+// GraphQL mutation operation: SaleBulkDelete
+// ====================================================
+
+export interface SaleBulkDelete_saleBulkDelete_errors {
+ __typename: "Error";
+ field: string | null;
+ message: string | null;
+}
+
+export interface SaleBulkDelete_saleBulkDelete {
+ __typename: "SaleBulkDelete";
+ errors: SaleBulkDelete_saleBulkDelete_errors[] | null;
+}
+
+export interface SaleBulkDelete {
+ saleBulkDelete: SaleBulkDelete_saleBulkDelete | null;
+}
+
+export interface SaleBulkDeleteVariables {
+ ids: (string | null)[];
+}
diff --git a/saleor/static/dashboard-next/discounts/types/VoucherBulkDelete.ts b/saleor/static/dashboard-next/discounts/types/VoucherBulkDelete.ts
new file mode 100644
index 0000000000..ac3277e757
--- /dev/null
+++ b/saleor/static/dashboard-next/discounts/types/VoucherBulkDelete.ts
@@ -0,0 +1,26 @@
+/* tslint:disable */
+/* eslint-disable */
+// This file was automatically generated and should not be edited.
+
+// ====================================================
+// GraphQL mutation operation: VoucherBulkDelete
+// ====================================================
+
+export interface VoucherBulkDelete_voucherBulkDelete_errors {
+ __typename: "Error";
+ field: string | null;
+ message: string | null;
+}
+
+export interface VoucherBulkDelete_voucherBulkDelete {
+ __typename: "VoucherBulkDelete";
+ errors: VoucherBulkDelete_voucherBulkDelete_errors[] | null;
+}
+
+export interface VoucherBulkDelete {
+ voucherBulkDelete: VoucherBulkDelete_voucherBulkDelete | null;
+}
+
+export interface VoucherBulkDeleteVariables {
+ ids: (string | null)[];
+}
diff --git a/saleor/static/dashboard-next/discounts/urls.ts b/saleor/static/dashboard-next/discounts/urls.ts
index e737fd469d..a33556ed88 100644
--- a/saleor/static/dashboard-next/discounts/urls.ts
+++ b/saleor/static/dashboard-next/discounts/urls.ts
@@ -9,7 +9,12 @@ export const discountSection = "/discounts/";
export const saleSection = urlJoin(discountSection, "sales");
export const saleListPath = saleSection;
-export const saleListUrl = saleListPath;
+export type SaleListUrlDialog = "remove";
+export type SaleListUrlQueryParams = BulkAction &
+ Dialog<SaleListUrlDialog> &
+ Pagination;
+export const saleListUrl = (params?: SaleListUrlQueryParams) =>
+ saleListPath + "?" + stringifyQs(params);
export const salePath = (id: string) => urlJoin(saleSection, id);
export type SaleUrlDialog =
| "assign-category"
@@ -30,7 +35,12 @@ export const saleAddUrl = saleAddPath;
export const voucherSection = urlJoin(discountSection, "vouchers");
export const voucherListPath = voucherSection;
-export const voucherListUrl = voucherListPath;
+export type VoucherListUrlDialog = "remove";
+export type VoucherListUrlQueryParams = BulkAction &
+ Dialog<VoucherListUrlDialog> &
+ Pagination;
+export const voucherListUrl = (params?: VoucherListUrlQueryParams) =>
+ voucherListPath + "?" + stringifyQs(params);
export const voucherPath = (id: string) => urlJoin(voucherSection, id);
export type VoucherUrlDialog =
| "assign-category"
diff --git a/saleor/static/dashboard-next/discounts/views/SaleDetails.tsx b/saleor/static/dashboard-next/discounts/views/SaleDetails.tsx
index efc9422b78..a913c22ba3 100644
--- a/saleor/static/dashboard-next/discounts/views/SaleDetails.tsx
+++ b/saleor/static/dashboard-next/discounts/views/SaleDetails.tsx
@@ -260,7 +260,7 @@ export const SaleDetails: React.StatelessComponent<SaleDetailsProps> = ({
onProductClick={id => () =>
navigate(productUrl(id))}
activeTab={params.activeTab}
- onBack={() => navigate(saleListUrl)}
+ onBack={() => navigate(saleListUrl())}
onTabClick={changeTab}
onSubmit={formData =>
saleUpdate({
diff --git a/saleor/static/dashboard-next/discounts/views/VoucherDetails.tsx b/saleor/static/dashboard-next/discounts/views/VoucherDetails.tsx
index d91b18d308..57554a4107 100644
--- a/saleor/static/dashboard-next/discounts/views/VoucherDetails.tsx
+++ b/saleor/static/dashboard-next/discounts/views/VoucherDetails.tsx
@@ -314,7 +314,7 @@ export const VoucherDetails: React.StatelessComponent<VoucherDetailsProps> = ({
onProductClick={id => () =>
navigate(productUrl(id))}
activeTab={params.activeTab}
- onBack={() => navigate(voucherListUrl)}
+ onBack={() => navigate(voucherListUrl())}
onTabClick={changeTab}
onSubmit={formData =>
voucherUpdate({
diff --git a/saleor/static/dashboard-next/discounts/views/VoucherList.tsx b/saleor/static/dashboard-next/discounts/views/VoucherList.tsx
index 2e44a6f56e..37325b167f 100644
--- a/saleor/static/dashboard-next/discounts/views/VoucherList.tsx
+++ b/saleor/static/dashboard-next/discounts/views/VoucherList.tsx
@@ -1,64 +1,144 @@
+import DialogContentText from "@material-ui/core/DialogContentText";
+import IconButton from "@material-ui/core/IconButton";
+import DeleteIcon from "@material-ui/icons/Delete";
import * as React from "react";
-import Navigator from "../../components/Navigator";
-import { createPaginationState, Paginator } from "../../components/Paginator";
-import Shop from "../../components/Shop";
+import ActionDialog from "../../components/ActionDialog";
+import { createPaginationState } from "../../components/Paginator";
import { WindowTitle } from "../../components/WindowTitle";
+import useBulkActions from "../../hooks/useBulkActions";
+import useNavigator from "../../hooks/useNavigator";
+import useNotifier from "../../hooks/useNotifier";
+import usePaginator from "../../hooks/usePaginator";
+import useShop from "../../hooks/useShop";
import i18n from "../../i18n";
-import { maybe } from "../../misc";
-import { Pagination } from "../../types";
+import { getMutationState, maybe } from "../../misc";
import VoucherListPage from "../components/VoucherListPage";
+import { TypedVoucherBulkDelete } from "../mutations";
import { TypedVoucherList } from "../queries";
-import { voucherAddUrl, voucherUrl } from "../urls";
+import { VoucherBulkDelete } from "../types/VoucherBulkDelete";
+import {
+ voucherAddUrl,
+ voucherListUrl,
+ VoucherListUrlQueryParams,
+ voucherUrl
+} from "../urls";
const PAGINATE_BY = 20;
-export type VoucherListQueryParams = Pagination;
-
interface VoucherListProps {
- params: VoucherListQueryParams;
+ params: VoucherListUrlQueryParams;
}
export const VoucherList: React.StatelessComponent<VoucherListProps> = ({
params
-}) => (
- <>
- <WindowTitle title={i18n.t("Vouchers")} />
- <Shop>
- {shop => (
- <Navigator>
- {navigate => {
- const paginationState = createPaginationState(PAGINATE_BY, params);
- return (
- <TypedVoucherList displayLoader variables={paginationState}>
- {({ data, loading }) => (
- <Paginator
- pageInfo={maybe(() => data.vouchers.pageInfo)}
- paginationState={paginationState}
- queryString={params}
- >
- {({ loadNextPage, loadPreviousPage, pageInfo }) => (
- <VoucherListPage
- defaultCurrency={maybe(() => shop.defaultCurrency)}
- vouchers={maybe(() =>
- data.vouchers.edges.map(edge => edge.node)
- )}
- disabled={loading}
- pageInfo={pageInfo}
- onAdd={() => navigate(voucherAddUrl)}
- onNextPage={loadNextPage}
- onPreviousPage={loadPreviousPage}
- onRowClick={id => () => navigate(voucherUrl(id))}
- />
+}) => {
+ const navigate = useNavigator();
+ const notify = useNotifier();
+ const paginate = usePaginator();
+ const shop = useShop();
+ const { isSelected, listElements, reset, toggle } = useBulkActions();
+
+ const closeModal = () => navigate(voucherListUrl(), true);
+
+ const paginationState = createPaginationState(PAGINATE_BY, params);
+
+ return (
+ <TypedVoucherList displayLoader variables={paginationState}>
+ {({ data, loading, refetch }) => {
+ const { loadNextPage, loadPreviousPage, pageInfo } = paginate(
+ maybe(() => data.vouchers.pageInfo),
+ paginationState,
+ params
+ );
+
+ const handleVoucherBulkDelete = (data: VoucherBulkDelete) => {
+ if (data.voucherBulkDelete.errors.length === 0) {
+ notify({
+ text: i18n.t("Removed vouchers")
+ });
+ reset();
+ closeModal();
+ refetch();
+ }
+ };
+
+ return (
+ <TypedVoucherBulkDelete onCompleted={handleVoucherBulkDelete}>
+ {(voucherBulkDelete, voucherBulkDeleteOpts) => {
+ const bulkRemoveTransitionState = getMutationState(
+ voucherBulkDeleteOpts.called,
+ voucherBulkDeleteOpts.loading,
+ maybe(() => voucherBulkDeleteOpts.data.voucherBulkDelete.errors)
+ );
+ const onVoucherBulkDelete = () =>
+ voucherBulkDelete({
+ variables: {
+ ids: params.ids
+ }
+ });
+ return (
+ <>
+ <WindowTitle title={i18n.t("Vouchers")} />
+ <VoucherListPage
+ defaultCurrency={maybe(() => shop.defaultCurrency)}
+ vouchers={maybe(() =>
+ data.vouchers.edges.map(edge => edge.node)
)}
- </Paginator>
- )}
- </TypedVoucherList>
- );
- }}
- </Navigator>
- )}
- </Shop>
- </>
-);
+ disabled={loading}
+ pageInfo={pageInfo}
+ onAdd={() => navigate(voucherAddUrl)}
+ onNextPage={loadNextPage}
+ onPreviousPage={loadPreviousPage}
+ onRowClick={id => () => navigate(voucherUrl(id))}
+ isChecked={isSelected}
+ selected={listElements.length}
+ toggle={toggle}
+ toolbar={
+ <IconButton
+ color="primary"
+ onClick={() =>
+ navigate(
+ voucherListUrl({
+ action: "remove",
+ ids: listElements
+ })
+ )
+ }
+ >
+ <DeleteIcon />
+ </IconButton>
+ }
+ />
+ <ActionDialog
+ confirmButtonState={bulkRemoveTransitionState}
+ onClose={closeModal}
+ onConfirm={onVoucherBulkDelete}
+ open={params.action === "remove"}
+ title={i18n.t("Remove Vouchers")}
+ variant="delete"
+ >
+ <DialogContentText
+ dangerouslySetInnerHTML={{
+ __html: i18n.t(
+ "Are you sure you want to remove <strong>{{ number }}</strong> vouchers?",
+ {
+ number: maybe(
+ () => params.ids.length.toString(),
+ "..."
+ )
+ }
+ )
+ }}
+ />
+ </ActionDialog>
+ </>
+ );
+ }}
+ </TypedVoucherBulkDelete>
+ );
+ }}
+ </TypedVoucherList>
+ );
+};
export default VoucherList;