Added deleting of custom templates for BOD-85.
This commit is contained in:
@@ -7,9 +7,12 @@ import Skeleton from "../loading-skeleton/loading-skeleton.component";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { useHistory, useLocation } from "react-router-dom";
|
||||
import queryString from "query-string";
|
||||
import { TemplateList } from "../../utils/constants";
|
||||
import ShopTemplateAdd from "../shop-template-add/shop-template-add.component";
|
||||
import ShopTemplateDeleteComponent from "../shop-template-delete/shop-template-delete.component";
|
||||
|
||||
export default function ShopTemplatesListContainer() {
|
||||
const { loading, error, data } = useQuery(QUERY_CUSTOM_TEMPLATES);
|
||||
const { loading, error, data, refetch } = useQuery(QUERY_CUSTOM_TEMPLATES);
|
||||
const { t } = useTranslation();
|
||||
const search = queryString.parse(useLocation().search);
|
||||
const history = useHistory();
|
||||
@@ -29,7 +32,11 @@ export default function ShopTemplatesListContainer() {
|
||||
|
||||
return (
|
||||
<div>
|
||||
<div>CUSTOM TEMPLATES</div>
|
||||
<div>{t("bodyshop.labels.customtemplates")}</div>
|
||||
<ShopTemplateAdd
|
||||
shopTemplateList={data ? data.templates : []}
|
||||
refetch={refetch}
|
||||
/>
|
||||
<List
|
||||
loading={loading}
|
||||
itemLayout='horizontal'
|
||||
@@ -40,12 +47,15 @@ export default function ShopTemplatesListContainer() {
|
||||
<Button onClick={() => handleEdit(item)}>
|
||||
{t("general.actions.edit")}
|
||||
</Button>,
|
||||
<Button>{t("general.actions.delete")}</Button>,
|
||||
<ShopTemplateDeleteComponent
|
||||
templateId={item.id}
|
||||
refetch={refetch}
|
||||
/>,
|
||||
]}>
|
||||
<Skeleton title={false} loading={item.loading} active>
|
||||
<List.Item.Meta
|
||||
title={item.name}
|
||||
description='TODO CROSS MATCH DESCRIPTION'
|
||||
title={TemplateList[item.name].title}
|
||||
description={TemplateList[item.name].description}
|
||||
/>
|
||||
</Skeleton>
|
||||
</List.Item>
|
||||
|
||||
Reference in New Issue
Block a user