IO-1394 Disable delete on vendor create.

This commit is contained in:
Patrick Fic
2022-04-12 07:47:21 -07:00
parent 515de38fe6
commit ca71b0479a
2 changed files with 8 additions and 1 deletions

View File

@@ -25,6 +25,7 @@ export default function VendorsFormComponent({
formLoading,
handleDelete,
responsibilityCenters,
selectedvendor,
}) {
const { t } = useTranslation();
const client = useApolloClient();
@@ -52,7 +53,12 @@ export default function VendorsFormComponent({
>
{t("general.actions.save")}
</Button>
<Button type="danger" onClick={handleDelete} loading={formLoading}>
<Button
type="danger"
disabled={selectedvendor === "new"}
onClick={handleDelete}
loading={formLoading}
>
{t("general.actions.delete")}
</Button>

View File

@@ -139,6 +139,7 @@ function VendorsFormContainer({ refetch, bodyshop }) {
formLoading={formLoading}
handleDelete={handleDelete}
responsibilityCenters={bodyshop.md_responsibility_centers || null}
selectedvendor={selectedvendor}
/>
) : (
t("vendors.labels.noneselected")