diff --git a/app/ui/LocationDeleteForm.tsx b/app/ui/LocationDeleteForm.tsx index 0347b28..c51b456 100644 --- a/app/ui/LocationDeleteForm.tsx +++ b/app/ui/LocationDeleteForm.tsx @@ -1,6 +1,6 @@ "use client"; -import { FC, ReactNode } from "react"; +import { FC, ReactNode, useState } from "react"; import { BillingLocation } from "../lib/db-types"; import { deleteLocationById } from "../lib/actions/locationActions"; import { useFormState } from "react-dom"; @@ -17,6 +17,7 @@ export const LocationDeleteForm:FC = ({ location }) => const handleAction = deleteLocationById.bind(null, location._id, location.yearMonth); const [ , dispatch ] = useFormState(handleAction, null); const t = useTranslations("location-delete-form"); + const [deleteInSubsequentMonths, setDeleteInSubsequentMonths] = useState(false); return(
@@ -34,9 +35,27 @@ export const LocationDeleteForm:FC = ({ location }) =>
+ + {deleteInSubsequentMonths && ( +
+
+ ⚠️ +
+

{t("warning-title")}

+
{t("warning-message")}
+
+
+
+ )}
{t("cancel-button")} diff --git a/messages/en.json b/messages/en.json index 7c61f48..b5566b3 100644 --- a/messages/en.json +++ b/messages/en.json @@ -88,10 +88,12 @@ "back-button": "Back" }, "location-delete-form": { - "text": "Please confirm deletion of realestate “{name}“.", + "text": "Please confirm deletion of realestate \"{name}\".", "cancel-button": "Cancel", "confirm-button": "Confirm", - "delete-in-subsequent-months": "Delete in all subsequent months" + "delete-in-subsequent-months": "Also delete in all subsequent months", + "warning-title": "Warning", + "warning-message": "This operation cannot be undone and will delete the location in all future months!" }, "location-edit-form": { "location-name-placeholder": "Realestate name", diff --git a/messages/hr.json b/messages/hr.json index b4e7bec..1cba01e 100644 --- a/messages/hr.json +++ b/messages/hr.json @@ -87,10 +87,12 @@ "back-button": "Nazad" }, "location-delete-form": { - "text": "Molim potvrdi brisanje nekretnine “{name}“.", + "text": "Molim potvrdi brisanje nekretnine \"{name}\".", "cancel-button": "Odustani", "confirm-button": "Potvrdi", - "delete-in-subsequent-months": "Obriši u svim mjesecima koji slijede" + "delete-in-subsequent-months": "Također obriši i u svim mjesecima koji slijede", + "warning-title": "Upozorenje", + "warning-message": "Ova operacija je nepovratna i obrisat će lokaciju u svim mjesecima koji slijede!" }, "location-edit-form": { "location-name-placeholder": "Ime nekretnine",