#112 - Quantite pour les objets pour le tchat

This commit is contained in:
2021-01-11 18:04:26 +01:00
parent f54bec0837
commit ce97911781
3 changed files with 22 additions and 10 deletions

View File

@ -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",
@ -63,12 +63,16 @@ 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"))