fix: valider le champs des dialogs
Forcer la validation des champs saisis avant de fermer les dialogs et d'appeler le callback pour avoir la dernière valuer saisie par l'utilisateur
This commit is contained in:
parent
b5c8bb85fd
commit
0524540f5a
@ -39,6 +39,8 @@ export class DialogCreateSigneDraconique extends Dialog {
|
||||
}
|
||||
|
||||
async _onCreerSigneActeurs() {
|
||||
await $("[name='signe.data.ephemere']").change();
|
||||
await $(".signe-xp-sort").change();
|
||||
this.validerSigne();
|
||||
this.dialogData.actors.filter(it => it.selected).map(it => game.actors.get(it._id))
|
||||
.forEach(actor => this._createSigneForActor(actor, this.dialogData.signe));
|
||||
@ -75,6 +77,7 @@ export class DialogCreateSigneDraconique extends Dialog {
|
||||
html.find(".select-actor").change((event) => this.onSelectActor(event));
|
||||
html.find(".signe-xp-sort").change((event) => this.onValeurXpSort(event));
|
||||
}
|
||||
|
||||
async setSigneAleatoire() {
|
||||
const newSigne = await RdDItemSigneDraconique.randomSigneDraconique({ephemere: true});
|
||||
|
||||
|
@ -64,6 +64,7 @@ export class DialogItemAchat extends Dialog {
|
||||
}
|
||||
|
||||
async onAchat() {
|
||||
await $(".nombreLots").change();
|
||||
(this.vendeur ?? this.acheteur).achatVente(
|
||||
this.vendeur?.id,
|
||||
this.acheteur?.id,
|
||||
|
@ -17,9 +17,7 @@ export class DialogConsommer extends Dialog {
|
||||
default: consommerData.buttonName,
|
||||
buttons: {
|
||||
[consommerData.buttonName]: {
|
||||
label: consommerData.buttonName, callback: it => {
|
||||
this.actor.consommer(this.item, this.consommerData.choix);
|
||||
}
|
||||
label: consommerData.buttonName, callback: it => this.onConsommer(it)
|
||||
}
|
||||
}
|
||||
};
|
||||
@ -31,6 +29,12 @@ export class DialogConsommer extends Dialog {
|
||||
this.consommerData = consommerData;
|
||||
}
|
||||
|
||||
async onConsommer(event) {
|
||||
await $(".se-forcer").change();
|
||||
await $(".consommer-doses").change();
|
||||
this.actor.consommer(this.item, this.consommerData.choix);
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
static prepareData(actor, item, options) {
|
||||
const itemData = duplicate(Misc.data(item));
|
||||
@ -68,15 +72,19 @@ export class DialogConsommer extends Dialog {
|
||||
/* -------------------------------------------- */
|
||||
activateListeners(html) {
|
||||
super.activateListeners(html);
|
||||
html.find(".se-forcer").change(event => {
|
||||
this.consommerData.choix.seForcer = event.currentTarget.checked;
|
||||
});
|
||||
html.find(".consommer-doses").change(event => {
|
||||
this.consommerData.choix.doses = Number(event.currentTarget.value);
|
||||
DialogConsommer.calculDoses(this.consommerData);
|
||||
$(".total-sust").text(this.consommerData.totalSust)
|
||||
$(".total-desaltere").text(this.consommerData.totalDesaltere)
|
||||
});
|
||||
html.find(".se-forcer").change(event => this.setSeForcer(event));
|
||||
html.find(".consommer-doses").change(event => this.selectDoses(event));
|
||||
}
|
||||
|
||||
|
||||
setSeForcer(event) {
|
||||
this.consommerData.choix.seForcer = event.currentTarget.checked;
|
||||
}
|
||||
|
||||
selectDoses(event) {
|
||||
this.consommerData.choix.doses = Number(event.currentTarget.value);
|
||||
DialogConsommer.calculDoses(this.consommerData);
|
||||
$(".total-sust").text(this.consommerData.totalSust);
|
||||
$(".total-desaltere").text(this.consommerData.totalDesaltere);
|
||||
}
|
||||
}
|
@ -30,7 +30,7 @@ export class DialogItemVente extends Dialog {
|
||||
title: "Proposer",
|
||||
content: html,
|
||||
default: "proposer",
|
||||
buttons: { "proposer": { label: "Proposer", callback: it => { this.onProposer(); } } }
|
||||
buttons: { "proposer": { label: "Proposer", callback: it => { this.onProposer(it); } } }
|
||||
};
|
||||
|
||||
super(conf, options);
|
||||
@ -38,7 +38,11 @@ export class DialogItemVente extends Dialog {
|
||||
this.venteData = venteData;
|
||||
}
|
||||
|
||||
async onProposer() {
|
||||
async onProposer(it) {
|
||||
await $(".tailleLot").change();
|
||||
await $(".quantiteNbLots").change();
|
||||
await $(".quantiteIllimite").change();
|
||||
await $(".prixLot").change();
|
||||
this.callback(this.venteData);
|
||||
}
|
||||
|
||||
|
@ -36,6 +36,7 @@ export class DialogSplitItem extends Dialog {
|
||||
}
|
||||
|
||||
async onSplit(){
|
||||
await $(".choix-quantite").change();
|
||||
this.callback(this.item, this.splitData.choix.quantite);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user