diff --git a/module/actor-sheet.js b/module/actor-sheet.js index 9cc84b58..bc955925 100644 --- a/module/actor-sheet.js +++ b/module/actor-sheet.js @@ -175,6 +175,31 @@ export class RdDActorSheet extends ActorSheet { this.actor.computeEncombrementTotal(); } + /* -------------------------------------------- */ + async confirmerSuppression(li) { + let itemId = li.data("item-id"); + let d = new Dialog({ + title: "Confirmer la suppression", + content: "

Etes vous certain de vouloir supprimer cet objet ?

", + buttons: { + delete: { + icon: '', + label: "Supprimer", + callback: () => { + this.actor.deleteOwnedItem( itemId ); + li.slideUp(200, () => this.render(false)); + } + }, + cancel: { + icon: '', + label: "Annuler" + } + }, + default: "cancel", + }); + d.render(true); + } + /* -------------------------------------------- */ /** @override */ activateListeners(html) { @@ -193,9 +218,7 @@ export class RdDActorSheet extends ActorSheet { // Delete Inventory Item html.find('.item-delete').click(ev => { const li = $(ev.currentTarget).parents(".item"); - this.actor.deleteOwnedItem(li.data("item-id")); - console.log("Delete item :", li.data("item-id") ); - li.slideUp(200, () => this.render(false)); + this.confirmerSuppression( li ); }); // Update Inventory Item