From 40fdff4057733d21c63d0d4a7546228af12c824d Mon Sep 17 00:00:00 2001 From: Vincent Vandemeulebrouck Date: Sun, 15 Jan 2023 21:32:32 +0100 Subject: [PATCH] =?UTF-8?q?Image=20du=20token=20pour=20les=20Commerces=20n?= =?UTF-8?q?on=20li=C3=A9s?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- module/actor/commerce-sheet.js | 29 +++++++++++++++++++---- styles/simple.css | 8 +++---- templates/actor/commerce-actor-sheet.html | 7 ++++++ 3 files changed, 36 insertions(+), 8 deletions(-) diff --git a/module/actor/commerce-sheet.js b/module/actor/commerce-sheet.js index 0aa89a2a..a342f2bf 100644 --- a/module/actor/commerce-sheet.js +++ b/module/actor/commerce-sheet.js @@ -22,17 +22,38 @@ export class RdDCommerceSheet extends RdDBaseActorSheet { dragDrop: [{ dragSelector: ".item-list .item", dropSelector: undefined }] }); } + get title() { + if (this.actor.token && this.actor.token != this.actor.prototypeToken) { + return this.actor.token.name; + } + return super.title + } + async getData() { + const formData = await super.getData(); + if (this.actor.token && this.actor.token != this.actor.prototypeToken) { + mergeObject(formData, + { + title: this.actor.token.name, + token: { + img: this.actor.token.texture.src + } + }, + { overwrite: true }); + + } + return formData; + } /* -------------------------------------------- */ /** @override */ activateListeners(html) { super.activateListeners(html); this.html.find('a.item-acheter').click(async event => await this.vente(this.getItem(event))); - + if (!this.options.editable) return; - - this.html.find('a.item-quantite-moins').click(async event => await this.getItem(event)?.quantiteIncDec(-1, { supprimerSiZero: false})); + + this.html.find('a.item-quantite-moins').click(async event => await this.getItem(event)?.quantiteIncDec(-1, { supprimerSiZero: false })); this.html.find('a.item-quantite-plus').click(async event => await this.getItem(event)?.quantiteIncDec(1)); this.html.find('input.item-quantite').change(async event => { const newQuantite = Math.max(0, Number.parseInt(this.html.find(event.currentTarget).val())); @@ -48,7 +69,7 @@ export class RdDCommerceSheet extends RdDBaseActorSheet { return RdDItem.getItemTypesInventaire('all'); } - + async vente(item) { const acheteur = RdDUtility.getSelectedActor(); if (!acheteur) { diff --git a/styles/simple.css b/styles/simple.css index 76d3c57c..b5247d88 100644 --- a/styles/simple.css +++ b/styles/simple.css @@ -174,11 +174,11 @@ i:is(.fas, .far) { margin-bottom: -8px; } -.system-foundryvtt-reve-de-dragon .sheet-header :is(.header-compteurs,.header-etats,.profile-img){ +.system-foundryvtt-reve-de-dragon .sheet-header :is(.header-compteurs,.header-etats,.profile-img, .profile-img-token){ padding: 0 3%; } -.system-foundryvtt-reve-de-dragon .sheet-header .profile-img { +.system-foundryvtt-reve-de-dragon .sheet-header :is(.profile-img, .profile-img-token) { -webkit-box-flex: 0; -ms-flex: 0 0 110px; flex: 0 0 110px; @@ -492,7 +492,7 @@ input:is(.blessure-premiers_soins, .blessure-soins_complets) { max-height: 1.5em; border-width: 0; } -div.dimmed .img-signe-heure { +.dimmed { opacity: 50%; } .button-effect-img { @@ -844,7 +844,7 @@ form.rdddialogchrono input[type=datetime-local] { section.sheet-body{padding: 0.25rem 0.5rem;} -.sheet header.sheet-header .profile-img { +.sheet header.sheet-header :is(.profile-img, .profile-img-token) { object-fit: scale-down; object-position: 50% 0; margin: 0.5rem 0 0.5rem 0.5rem; diff --git a/templates/actor/commerce-actor-sheet.html b/templates/actor/commerce-actor-sheet.html index 4792bbe7..9bff7277 100644 --- a/templates/actor/commerce-actor-sheet.html +++ b/templates/actor/commerce-actor-sheet.html @@ -4,7 +4,14 @@
+ {{#if token}} + {{#if options.isOwner}} + + {{/if}} + + {{else}} + {{/if}}

{{#if @root.options.isObserver}}