#112 - Quantite pour les objets pour le tchat
This commit is contained in:
parent
f54bec0837
commit
ce97911781
@ -21,8 +21,8 @@ export class RdDItem extends Item {
|
||||
chatData.data.cout_deniers = Math.floor(sols * 100);
|
||||
dialogResult = await new Promise( (resolve, reject) => {new Dialog({
|
||||
content :
|
||||
`<p hidden>Modifier la quantité?</p>
|
||||
<div hidden class="form-group">
|
||||
`<p>Modifier la quantité?</p>
|
||||
<div class="form-group">
|
||||
<label> Quantité</label>
|
||||
<input name="quantity" type="text" placeholder="Ne rien mettre pour quantité infinie"/>
|
||||
</div>
|
||||
@ -32,7 +32,7 @@ export class RdDItem extends Item {
|
||||
<input name="price" type="text" value="${chatData.data.cout}"/>
|
||||
</div>
|
||||
`,
|
||||
title : "Quantité",
|
||||
title : "Quantité & Prix",
|
||||
buttons : {
|
||||
post : {
|
||||
label : "Soumettre",
|
||||
@ -64,11 +64,15 @@ export class RdDItem extends Item {
|
||||
}
|
||||
}
|
||||
|
||||
if (dialogResult[0] > 0)
|
||||
chatData.postQuantity = dialogResult[0];
|
||||
if (dialogResult[1] > 0) {
|
||||
chatData.postPrice = dialogResult[1];
|
||||
chatData.data.cout_deniers = Math.floor(dialogResult[1] * 100); // Mise à jour cout en deniers
|
||||
if ( chatData.hasPrice ) {
|
||||
if (dialogResult[0] > 0)
|
||||
chatData.postQuantity = Number(dialogResult[0]);
|
||||
if (dialogResult[1] > 0) {
|
||||
chatData.postPrice = dialogResult[1];
|
||||
chatData.data.cout_deniers = Math.floor(dialogResult[1] * 100); // Mise à jour cout en deniers
|
||||
}
|
||||
chatData.finalPrice = Number(chatData.postPrice) * Number(chatData.postQuantity);
|
||||
chatData.data.cout_deniers_total *= Number(chatData.postQuantity);
|
||||
}
|
||||
// Don't post any image for the item (which would leave a large gap) if the default image is used
|
||||
if (chatData.img.includes("/blank.png"))
|
||||
|
@ -200,3 +200,4 @@
|
||||
{"_id":"zQWlnUsd8bPySujd","name":"Aiguille à coudre","permission":{"default":0,"rYShh2P1DNavdoBD":3},"type":"objet","data":{"description":"","quantite":1,"encombrement":0.01,"equipe":false,"resistance":0,"qualite":0,"cout":0.1},"flags":{},"img":"systems/foundryvtt-reve-de-dragon/icons/objets/aiguille.webp","effects":[]}
|
||||
{"_id":"zYI8mDiysWtmsSyy","name":"Carquois","permission":{"default":0,"jOzRscDxoXZWpGS6":3},"type":"conteneur","data":{"description":"","capacite":2,"encombrement":0.1,"equipe":false,"qualite":0,"cout":0.5},"flags":{},"img":"systems/foundryvtt-reve-de-dragon/icons/objets/carquois.webp","effects":[]}
|
||||
{"_id":"zlDa1vwmls6Uf4pt","name":"Bourse de cuir","permission":{"default":0,"rYShh2P1DNavdoBD":3},"type":"conteneur","data":{"description":"","capacite":0.5,"encombrement":0.01,"equipe":false,"qualite":0,"contenu":[],"cout":0.1},"flags":{},"img":"systems/foundryvtt-reve-de-dragon/icons/objets/bourse.webp","effects":[]}
|
||||
{"_id":"zQWlnUsd8bPySujd","name":"Aiguille à coudre","permission":{"default":0,"rYShh2P1DNavdoBD":3},"type":"objet","data":{"description":"","quantite":1,"encombrement":0.01,"equipe":false,"resistance":0,"qualite":0,"cout":0.1},"flags":{},"img":"systems/foundryvtt-reve-de-dragon/icons/objets/aiguille.webp","effects":[]}
|
||||
|
@ -17,9 +17,16 @@
|
||||
<b>Quantité: </b> <span class="postQuantity">{{postQuantity}}</span>
|
||||
{{/if}}
|
||||
</div>
|
||||
|
||||
{{#if finalPrice}}
|
||||
<div>
|
||||
<b>Prix Total: </b> <span class="postPrice">{{finalPrice}} Sols</span>
|
||||
</div>
|
||||
{{/if}}
|
||||
|
||||
{{#if hasPrice}}
|
||||
<span class="chat-card-button-area">
|
||||
<a id='payer-button' class='chat-card-button market-button' data-jsondata='{{jsondata}}' data-somme-denier="{{data.cout_deniers}}">Payer</a>
|
||||
<a id='payer-button' class='chat-card-button market-button' data-jsondata='{{jsondata}}' data-somme-denier="{{data.cout_deniers_total}}">Payer</a>
|
||||
</span>
|
||||
{{/if}}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user