This repository has been archived on 2024-10-22. You can view files and clone it, but cannot push or open issues or pull requests.
foundryvtt-beam-saber/module/blades-faction-sheet.js

56 lines
1.5 KiB
JavaScript
Raw Normal View History

2021-04-22 11:27:10 +00:00
import { BladesSheet } from "./blades-sheet.js";
/**
* @extends {BladesSheet}
*/
export class BladesFactionSheet extends BladesSheet {
/** @override */
static get defaultOptions() {
return foundry.utils.mergeObject(super.defaultOptions, {
2021-04-22 11:27:10 +00:00
classes: ["blades-in-the-dark", "sheet", "actor"],
template: "systems/blades-in-the-dark/templates/faction-sheet.html",
width: 900,
height: 'auto',
tabs: [{navSelector: ".tabs", contentSelector: ".tab-content"}]
});
}
/* -------------------------------------------- */
/** @override */
getData() {
const data = super.getData();
data.editable = this.options.editable;
const actorData = data.data;
data.actor = actorData;
data.data = actorData.data;
return data;
}
/* -------------------------------------------- */
2021-04-22 11:27:10 +00:00
/** @override */
activateListeners(html) {
super.activateListeners(html);
// Everything below here is only needed if the sheet is editable
if (!this.options.editable) return;
// Update Inventory Item
html.find('.item-body').click(ev => {
const element = $(ev.currentTarget).parents(".item");
const item = this.actor.items.get(element.data("itemId"));
2021-04-22 11:27:10 +00:00
item.sheet.render(true);
});
// Delete Inventory Item
html.find('.item-delete').click( async ev => {
2021-04-22 11:27:10 +00:00
const element = $(ev.currentTarget).parents(".item");
await this.actor.deleteEmbeddedDocuments("Item", [element.data("itemId")]);
2021-04-22 11:27:10 +00:00
element.slideUp(200, () => this.render(false));
});
}
}