Feature: add 'onsoftDelete'-option for tagrenderings which will clear when a soft-delete is performed, apply this on pharmacies

This commit is contained in:
Pieter Vander Vennet 2024-11-24 22:40:05 +01:00
parent 34672075d4
commit e5f0846edd
6 changed files with 186 additions and 102 deletions

View file

@ -21,6 +21,7 @@
import AccordionSingle from "../../Flowbite/AccordionSingle.svelte"
import Trash from "@babeard/svelte-heroicons/mini/Trash"
import Invalid from "../../../assets/svg/Invalid.svelte"
import { And } from "../../../Logic/Tags/And"
export let state: SpecialVisualizationState
export let deleteConfig: DeleteConfig
@ -60,10 +61,14 @@
const changedProperties = TagUtils.changeAsProperties(selectedTags.asChange(tags?.data ?? {}))
const deleteReason = changedProperties[DeleteConfig.deleteReasonKey]
if (deleteReason) {
const softDeletionTags= new And([deleteConfig.softDeletionTags,
...layer.tagRenderings.flatMap(tr => tr.onSoftDelete ?? [])
])
// This is a proper, hard deletion
actionToTake = new DeleteAction(
featureId,
deleteConfig.softDeletionTags,
softDeletionTags,
{
theme: state?.theme?.id ?? "unknown",
specialMotivation: deleteReason,