Skip to content

Commit 0b6d9b3

Browse files
authored
COMP-641:Delete parent AP (front) (#540)
1 parent 407e3bd commit 0b6d9b3

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

compliance-web/src/components/App/Inspections/Profile/Enforcements/AdministrativePenalty/AdministrativePenaltyUpdateModal.tsx

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,9 @@ const AdministrativePenaltyUpdateModal: FC<
161161
const { mutate: deleteAdministrativePenalty, isPending: isPendingDelete } =
162162
useDeleteAdministrativePenalty(onDeleteSuccess);
163163

164+
// Check if AP is linked to other inspections
165+
const isLinkedToOtherInspections = administrativePenalty.inspection_id !== inspectionData.id;
166+
164167
const handleSubmitForm = useCallback(
165168
(data: AdministrativePenaltyUpdateFormType) => {
166169
const updateData: AdministrativePenaltyAPIData = {
@@ -230,7 +233,7 @@ const AdministrativePenaltyUpdateModal: FC<
230233
return (
231234
<FormProvider {...methods}>
232235
<form onSubmit={handleSubmit(handleSubmitForm)}>
233-
<ModalTitleBar title="Administrative Penalty Recommendation" />
236+
<ModalTitleBar title={administrativePenalty.administrative_penalty_number} />
234237
<DialogContent dividers sx={{ p: 0 }}>
235238
<Box sx={{ p: "1rem 1.5rem" }}>
236239
<ControlledAutoComplete
@@ -288,6 +291,11 @@ const AdministrativePenaltyUpdateModal: FC<
288291
secondaryActionButtonText="Cancel"
289292
onDeleteAction={handleDelete}
290293
isDeleteActionLoading={isPendingDelete}
294+
onDeleteConfirmationText={
295+
isLinkedToOtherInspections
296+
? "This AP is linked to other files. Deleting it will remove all linked APs."
297+
: undefined
298+
}
291299
/>
292300
)}
293301
</form>

0 commit comments

Comments
 (0)