feat(ui) : add confirmation dialogs on all delete and unlink actions
This commit is contained in:
@@ -255,7 +255,16 @@ const handleResolve = async (commentId: string) => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const { confirm } = useConfirm()
|
||||||
|
|
||||||
const handleDelete = async (commentId: string) => {
|
const handleDelete = async (commentId: string) => {
|
||||||
|
const ok = await confirm({
|
||||||
|
title: 'Supprimer ce commentaire ?',
|
||||||
|
message: 'Cette action est irréversible.',
|
||||||
|
confirmText: 'Supprimer',
|
||||||
|
dangerous: true,
|
||||||
|
})
|
||||||
|
if (!ok) return
|
||||||
const result = await deleteComment(commentId)
|
const result = await deleteComment(commentId)
|
||||||
if (result.success) {
|
if (result.success) {
|
||||||
comments.value = comments.value.filter(c => c.id !== commentId)
|
comments.value = comments.value.filter(c => c.id !== commentId)
|
||||||
|
|||||||
@@ -90,7 +90,7 @@
|
|||||||
@files-added="d.handleMachineFilesAdded"
|
@files-added="d.handleMachineFilesAdded"
|
||||||
@preview="d.openPreview"
|
@preview="d.openPreview"
|
||||||
@download="d.downloadDocument"
|
@download="d.downloadDocument"
|
||||||
@remove="d.removeMachineDocument"
|
@remove="confirmRemoveDocument"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<!-- Produits associés -->
|
<!-- Produits associés -->
|
||||||
@@ -99,7 +99,7 @@
|
|||||||
:products="d.machineDirectProducts.value"
|
:products="d.machineDirectProducts.value"
|
||||||
:is-edit-mode="d.isEditMode.value"
|
:is-edit-mode="d.isEditMode.value"
|
||||||
@add-product="openAddModal('product')"
|
@add-product="openAddModal('product')"
|
||||||
@remove-product="async (id) => { await d.removeProductLink(id); refreshVersions() }"
|
@remove-product="confirmRemoveProduct"
|
||||||
@fill-entity="(linkId, typeId) => handleFillEntity(linkId, 'product', typeId)"
|
@fill-entity="(linkId, typeId) => handleFillEntity(linkId, 'product', typeId)"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
@@ -115,7 +115,7 @@
|
|||||||
@edit-piece="d.updatePieceFromComponent"
|
@edit-piece="d.updatePieceFromComponent"
|
||||||
@custom-field-update="d.handleCustomFieldUpdate"
|
@custom-field-update="d.handleCustomFieldUpdate"
|
||||||
@add-component="openAddModal('component')"
|
@add-component="openAddModal('component')"
|
||||||
@remove-component="async (id) => { await d.removeComponentLink(id); refreshVersions() }"
|
@remove-component="confirmRemoveComponent"
|
||||||
@fill-entity="(linkId, typeId) => handleFillEntity(linkId, 'component', typeId)"
|
@fill-entity="(linkId, typeId) => handleFillEntity(linkId, 'component', typeId)"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
@@ -130,7 +130,7 @@
|
|||||||
@edit-piece="d.editPiece"
|
@edit-piece="d.editPiece"
|
||||||
@custom-field-update="d.handleCustomFieldUpdate"
|
@custom-field-update="d.handleCustomFieldUpdate"
|
||||||
@add-piece="openAddModal('piece')"
|
@add-piece="openAddModal('piece')"
|
||||||
@remove-piece="async (id) => { await d.removePieceLink(id); refreshVersions() }"
|
@remove-piece="confirmRemovePiece"
|
||||||
@fill-entity="(linkId, typeId) => handleFillEntity(linkId, 'piece', typeId)"
|
@fill-entity="(linkId, typeId) => handleFillEntity(linkId, 'piece', typeId)"
|
||||||
@toggle-collapse="d.toggleAllPieces"
|
@toggle-collapse="d.toggleAllPieces"
|
||||||
/>
|
/>
|
||||||
@@ -254,6 +254,7 @@ const d = useMachineDetailData(machineId)
|
|||||||
const machineInfoCardRef = ref(null)
|
const machineInfoCardRef = ref(null)
|
||||||
const versionRefreshKey = ref(0)
|
const versionRefreshKey = ref(0)
|
||||||
const refreshVersions = () => { versionRefreshKey.value++ }
|
const refreshVersions = () => { versionRefreshKey.value++ }
|
||||||
|
const { confirm: confirmDialog } = useConfirm()
|
||||||
|
|
||||||
const {
|
const {
|
||||||
history,
|
history,
|
||||||
@@ -340,6 +341,29 @@ const submitMachineEdition = async () => {
|
|||||||
refreshVersions()
|
refreshVersions()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const confirmRemoveProduct = async (id) => {
|
||||||
|
if (!await confirmDialog({ title: 'Retirer ce produit ?', message: 'Le produit sera dissocié de la machine.', confirmText: 'Retirer', dangerous: true })) return
|
||||||
|
await d.removeProductLink(id)
|
||||||
|
refreshVersions()
|
||||||
|
}
|
||||||
|
|
||||||
|
const confirmRemoveComponent = async (id) => {
|
||||||
|
if (!await confirmDialog({ title: 'Retirer ce composant ?', message: 'Le composant sera dissocié de la machine.', confirmText: 'Retirer', dangerous: true })) return
|
||||||
|
await d.removeComponentLink(id)
|
||||||
|
refreshVersions()
|
||||||
|
}
|
||||||
|
|
||||||
|
const confirmRemovePiece = async (id) => {
|
||||||
|
if (!await confirmDialog({ title: 'Retirer cette pièce ?', message: 'La pièce sera dissociée de la machine.', confirmText: 'Retirer', dangerous: true })) return
|
||||||
|
await d.removePieceLink(id)
|
||||||
|
refreshVersions()
|
||||||
|
}
|
||||||
|
|
||||||
|
const confirmRemoveDocument = async (id) => {
|
||||||
|
if (!await confirmDialog({ title: 'Supprimer ce document ?', message: 'Le fichier sera supprimé définitivement.', confirmText: 'Supprimer', dangerous: true })) return
|
||||||
|
d.removeMachineDocument(id)
|
||||||
|
}
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
d.loadMachineData()
|
d.loadMachineData()
|
||||||
d.loadInitialData()
|
d.loadInitialData()
|
||||||
|
|||||||
Reference in New Issue
Block a user