Ajout bouton Item diminuer quantité
Pour diminuer la quantité des objets multiples sans avoir à éditer
This commit is contained in:
parent
2aa62cffe9
commit
de56fa909a
@ -152,6 +152,8 @@ export class RdDBaseActorSheet extends ActorSheet {
|
|||||||
const item = this.getItem(event);
|
const item = this.getItem(event);
|
||||||
RdDSheetUtility.splitItem(item, this.actor);
|
RdDSheetUtility.splitItem(item, this.actor);
|
||||||
});
|
});
|
||||||
|
this.html.find('.item-quantite-plus').click(async event => this.actor.itemQuantiteIncDec(this.getItemId(event), 1));
|
||||||
|
this.html.find('.item-quantite-moins').click(async event => this.actor.itemQuantiteIncDec(this.getItemId(event), -1));
|
||||||
this.html.find('.item-delete').click(async event => RdDUtility.confirmActorItemDelete(this, this.getItem(event)));
|
this.html.find('.item-delete').click(async event => RdDUtility.confirmActorItemDelete(this, this.getItem(event)));
|
||||||
this.html.find('.item-vendre').click(async event => this.vendre(this.getItem(event)));
|
this.html.find('.item-vendre').click(async event => this.vendre(this.getItem(event)));
|
||||||
|
|
||||||
@ -161,12 +163,6 @@ export class RdDBaseActorSheet extends ActorSheet {
|
|||||||
this.html.find('.nettoyer-conteneurs').click(async event => {
|
this.html.find('.nettoyer-conteneurs').click(async event => {
|
||||||
this.actor.nettoyerConteneurs();
|
this.actor.nettoyerConteneurs();
|
||||||
});
|
});
|
||||||
this.html.find('.monnaie-plus').click(async event => {
|
|
||||||
this.actor.monnaieIncDec(this.getItemId(event), 1);
|
|
||||||
});
|
|
||||||
this.html.find('.monnaie-moins').click(async event => {
|
|
||||||
this.actor.monnaieIncDec(this.getItemId(event), -1);
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
_rechercherKeyup(event) {
|
_rechercherKeyup(event) {
|
||||||
|
@ -150,11 +150,11 @@ export class RdDBaseActor extends Actor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
async monnaieIncDec(id, value) {
|
async itemQuantiteIncDec(id, value) {
|
||||||
let monnaie = this.getMonnaie(id);
|
let item = this.getItem(id);
|
||||||
if (monnaie) {
|
if (item && item.isInventaire()) {
|
||||||
const quantite = Math.max(0, monnaie.system.quantite + value);
|
const quantite = Math.max(0, item.system.quantite + value);
|
||||||
await this.updateEmbeddedDocuments('Item', [{ _id: monnaie.id, 'system.quantite': quantite }]);
|
await this.updateEmbeddedDocuments('Item', [{ _id: item.id, 'system.quantite': quantite }]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -209,6 +209,14 @@ export class RdDItemSheet extends ItemSheet {
|
|||||||
this.html.find('.item-vendre').click(async event => RdDSheetUtility.getItem(event, this.actor)?.proposerVente());
|
this.html.find('.item-vendre').click(async event => RdDSheetUtility.getItem(event, this.actor)?.proposerVente());
|
||||||
this.html.find('.item-montrer').click(async event => RdDSheetUtility.getItem(event, this.actor)?.postItemToChat());
|
this.html.find('.item-montrer').click(async event => RdDSheetUtility.getItem(event, this.actor)?.postItemToChat());
|
||||||
this.html.find('.item-action').click(async event => RdDSheetUtility.getItem(event, this.actor)?.actionPrincipale(this.actor, async () => this.render(true)));
|
this.html.find('.item-action').click(async event => RdDSheetUtility.getItem(event, this.actor)?.actionPrincipale(this.actor, async () => this.render(true)));
|
||||||
|
this.html.find('.item-quantite-plus').click(async event => {
|
||||||
|
await this.actor.itemQuantiteIncDec(RdDSheetUtility.getItemId(event), 1)
|
||||||
|
this.render();
|
||||||
|
});
|
||||||
|
this.html.find('.item-quantite-moins').click(async event => {
|
||||||
|
await this.actor.itemQuantiteIncDec(RdDSheetUtility.getItemId(event), -1)
|
||||||
|
this.render();
|
||||||
|
});
|
||||||
|
|
||||||
const updateItemTimestamp = (path, timestamp) => this.item.update({ [path]: duplicate(timestamp) })
|
const updateItemTimestamp = (path, timestamp) => this.item.update({ [path]: duplicate(timestamp) })
|
||||||
|
|
||||||
|
@ -15,7 +15,11 @@
|
|||||||
</a>
|
</a>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
</span>
|
</span>
|
||||||
<span class="equipement-detail">{{item.system.quantite}}
|
<span class="equipement-detail">
|
||||||
|
{{#if (gt item.system.quantite 1)}}
|
||||||
|
<a class="item-quantite-moins"><i class="fas fa-minus-square"></i></a>
|
||||||
|
{{/if}}
|
||||||
|
{{item.system.quantite}}
|
||||||
{{#if (gt item.system.quantite 1)}}
|
{{#if (gt item.system.quantite 1)}}
|
||||||
<a class="item-split" title="Séparer"><i class="fas fa-unlink"></i></a>
|
<a class="item-split" title="Séparer"><i class="fas fa-unlink"></i></a>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
@ -10,7 +10,7 @@
|
|||||||
</span>
|
</span>
|
||||||
{{#if @root.options.isOwner}}
|
{{#if @root.options.isOwner}}
|
||||||
<span class="equipement-button item-controls">
|
<span class="equipement-button item-controls">
|
||||||
<a class="monnaie-moins"><i class="fas fa-minus-square"></i></a>
|
<a class="item-quantite-moins"><i class="fas fa-minus-square"></i></a>
|
||||||
</span>
|
</span>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
<span class="equipement-detail">
|
<span class="equipement-detail">
|
||||||
@ -18,7 +18,7 @@
|
|||||||
</span>
|
</span>
|
||||||
{{#if @root.options.isOwner}}
|
{{#if @root.options.isOwner}}
|
||||||
<span class="equipement-button item-controls">
|
<span class="equipement-button item-controls">
|
||||||
<a class="monnaie-plus"><i class="fas fa-plus-square"></i></a>
|
<a class="item-quantite-plus"><i class="fas fa-plus-square"></i></a>
|
||||||
</span>
|
</span>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
<span class="equipement-actions item-controls">
|
<span class="equipement-actions item-controls">
|
||||||
|
Loading…
Reference in New Issue
Block a user