#11 Gestion conteneur et suppression

This commit is contained in:
sladecraven 2020-11-12 17:06:19 +01:00
parent 2f438ccd10
commit 41df6257d5

View File

@ -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: "<p>Etes vous certain de vouloir supprimer cet objet ?</p>",
buttons: {
delete: {
icon: '<i class="fas fa-check"></i>',
label: "Supprimer",
callback: () => {
this.actor.deleteOwnedItem( itemId );
li.slideUp(200, () => this.render(false));
}
},
cancel: {
icon: '<i class="fas fa-times"></i>',
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