#1 Fix item deletion

This commit is contained in:
sladecraven 2021-02-22 20:32:12 +01:00
parent 4f61eb3ef2
commit 9ea19a5509
3 changed files with 32 additions and 2 deletions

View File

@ -92,7 +92,7 @@ export class SoSActorSheet extends ActorSheet {
// Delete Inventory Item
html.find('.item-delete').click(ev => {
const li = $(ev.currentTarget).parents(".item");
RdDUtility.confirmerSuppression(this, li);
SoSUtility.confirmDelete(this, li);
});
html.find('.stat-label a').click((event) => {

View File

@ -219,6 +219,36 @@ export class SoSUtility extends Entity {
return 0;
}
/* -------------------------------------------- */
static async confirmDelete(actorSheet, li) {
let itemId = li.data("item-id");
let objet = actorSheet.actor.items.find(item => item._id == itemId);
let msgTxt = "<p>Are you sure to delete this item ?";
let buttons = {
delete: {
icon: '<i class="fas fa-check"></i>',
label: "Yes, delete it",
callback: () => {
console.log("Delete : ", itemId);
actorSheet.actor.deleteOwnedItem(itemId);
li.slideUp(200, () => actorSheet.render(false));
}
},
cancel: {
icon: '<i class="fas fa-times"></i>',
label: "Cancel"
}
}
msgTxt += "</p>";
let d = new Dialog({
title: "Confirm deletion",
content: msgTxt,
buttons: buttons,
default: "cancel"
});
d.render(true);
}
/* -------------------------------------------- */
static async applyDamage( flipData ) {
if (!this.registry) this.registry = {};

View File

@ -2,7 +2,7 @@
"name": "foundryvtt-shadows-over-sol",
"title": "Shadows over Sol",
"description": "Shadows over Sol for FoundryVTT",
"version": "0.1.1",
"version": "0.1.2",
"manifestPlusVersion": "1.0.0",
"minimumCoreVersion": "0.7.5",
"compatibleCoreVersion": "0.7.9",