diff --git a/module/actor-sheet.js b/module/actor-sheet.js index e5ac0586..808b1c70 100644 --- a/module/actor-sheet.js +++ b/module/actor-sheet.js @@ -188,6 +188,11 @@ export class RdDActorSheet extends ActorSheet { const item = RdDSheetUtility.getItem(event, this.actor); item?.proposerVente(); }); + html.find('.item-montrer').click(async event => { + const item = RdDSheetUtility.getItem(event, this.actor); + item?.postItem(); + }); + html.find('.item-action').click(async event => { const item = RdDSheetUtility.getItem(event, this.actor); this.actor.actionItem(item); diff --git a/module/item-sheet.js b/module/item-sheet.js index d46a8a83..204fa00b 100644 --- a/module/item-sheet.js +++ b/module/item-sheet.js @@ -34,18 +34,16 @@ export class RdDItemSheet extends ItemSheet { // We previously restricted this to GM and editable items only. If you ever find this comment because it broke something: eh, sorry! if ("cout" in Misc.templateData(this.object) && this.object.isVideOuNonConteneur()) { buttons.unshift({ - class: "post", + class: "vendre", icon: "fas fa-comments-dollar", onclick: ev => this.item.proposerVente() }); } - else { - buttons.unshift({ - class: "post", - icon: "fas fa-comment", - onclick: ev => this.item.postItem() - }); - } + buttons.unshift({ + class: "montrer", + icon: "fas fa-comment", + onclick: ev => this.item.postItem() + }); return buttons } @@ -202,6 +200,10 @@ export class RdDItemSheet extends ItemSheet { const item = RdDSheetUtility.getItem(event, this.actor); item?.proposerVente(); }); + html.find('.item-montrer').click(async event => { + const item = RdDSheetUtility.getItem(event, this.actor); + item?.postItem(); + }); html.find('.item-action').click(async event => { const item = RdDSheetUtility.getItem(event, this.actor); this.actor.actionItem(item, async () => itemSheetDialog.render(true)); diff --git a/module/item.js b/module/item.js index f6fc38d9..23bfb441 100644 --- a/module/item.js +++ b/module/item.js @@ -262,70 +262,6 @@ export class RdDItem extends Item { if (this.actor) { chatData.actor = { id: this.actor.id }; } - //Check if the posted item should have availability/pay buttons - chatData.hasPrice = "cout" in chatData.data; - chatData.data.cout_deniers = 0; - - let dialogResult = [-1, -1]; // dialogResult[0] = quantité, dialogResult[1] = prix - if (chatData.hasPrice) { - chatData.data.cout_deniers = Math.floor(chatData.data.cout * 100); - dialogResult = await new Promise((resolve, reject) => { - new Dialog({ - content: - `

Modifier la quantité?

-
- - -
-

Modifier la prix?

-
- - -
- `, - title: "Quantité & Prix", - buttons: { - post: { - label: "Soumettre", - callback: (dlg) => { - resolve([Number(dlg.find('[name="quantity"]').val()), Number(dlg.find('[name="price"]').val())]) - } - }, - } - }).render(true) - }) - } - - let quantiteEnvoi = this.isOwned ? Math.min(dialogResult[0], chatData.data.quantite) : dialogResult[0]; - const prixTotal = dialogResult[1]; - if (quantiteEnvoi > 0) { - if (this.isOwned) { - if (chatData.data.quantite == 0) { - quantiteEnvoi = -1 - } - else if (quantiteEnvoi > chatData.data.quantite) { - quantiteEnvoi = chatData.data.quantite; - ui.notifications.notify(`Impossible de poster plus que ce que vous avez. La quantité à été réduite à ${quantiteEnvoi}.`) - } - if (quantiteEnvoi > 0) { - this.diminuerQuantite(quantiteEnvoi); - } - } - } - - if (chatData.hasPrice) { - if (quantiteEnvoi > 0) - chatData.postQuantity = Number(quantiteEnvoi); - if (prixTotal >= 0) { - chatData.postPrice = prixTotal; - chatData.data.cout_deniers = Math.floor(prixTotal * 100); // Mise à jour cout en deniers - } - chatData.finalPrice = Number(chatData.postPrice) * Number(chatData.postQuantity); - chatData.data.cout_deniers_total = chatData.data.cout_deniers * Number(chatData.postQuantity); - chatData.data.quantite = chatData.postQuantity; - console.log("POST : ", chatData.finalPrice, chatData.data.cout_deniers_total, chatData.postQuantity); - } - // JSON object for easy creation chatData.jsondata = JSON.stringify( { diff --git a/templates/actor-sheet-inventaire-conteneur.html b/templates/actor-sheet-inventaire-conteneur.html index b206db08..92d90dde 100644 --- a/templates/actor-sheet-inventaire-conteneur.html +++ b/templates/actor-sheet-inventaire-conteneur.html @@ -24,6 +24,7 @@   {{/if}} + {{#if item.data.actionPrincipale}} {{item.data.actionPrincipale}} {{/if}} diff --git a/templates/post-item.html b/templates/post-item.html index 36347ccf..57ef44aa 100644 --- a/templates/post-item.html +++ b/templates/post-item.html @@ -9,28 +9,6 @@ {{#each properties as |property p|}} {{{property}}}
{{/each}} - {{#if (or postQuantity postPrice)}} - - {{#if postQuantity}} - Quantité: {{postQuantity}} - {{/if}} - {{#if postPrice}} - Prix: {{postPrice}} Sols - {{/if}} -
- {{/if}} - - Prix Total: {{finalPrice}} Sols
-

- {{#if hasPrice}} - - Payer - - {{/if}} -