1880-refactor_loggable #337

Merged
joan merged 7 commits from 1880-refactor_loggable into dev 2020-07-16 12:12:19 +00:00
3 changed files with 15 additions and 6 deletions
Showing only changes of commit ab8d2be1ae - Show all commits

View File

@ -22,9 +22,8 @@ module.exports = Self => {
async function claimIsEditable(ctx) { async function claimIsEditable(ctx) {
const loopBackContext = LoopBackContext.getCurrentContext(); const loopBackContext = LoopBackContext.getCurrentContext();
const httpCtx = {req: loopBackContext.active}; const httpCtx = {req: loopBackContext.active};
console.log(ctx, 'ctx.where.id'); const claimBeginning = await Self.findById(ctx.where.id);
console.log(ctx.where, 'ctx.where.id'); const isEditable = await Self.app.models.Claim.isEditable(httpCtx, claimBeginning.claimFk);
const isEditable = await Self.app.models.Claim.isEditable(httpCtx, ctx.where.id);
if (!isEditable) if (!isEditable)
throw new UserError(`The current claim can't be modified`); throw new UserError(`The current claim can't be modified`);

View File

@ -22,16 +22,25 @@ class Controller extends Section {
}; };
} }
set salesClaimed(value) { get claim() {
this._salesClaimed = value; return this._claim;
}
set claim(value) {
this._claim = value;
if (value) { if (value) {
this.calculateTotals();
this.isClaimEditable(); this.isClaimEditable();
this.isTicketEditable(); this.isTicketEditable();
} }
} }
set salesClaimed(value) {
this._salesClaimed = value;
if (value) this.calculateTotals();
}
get salesClaimed() { get salesClaimed() {
return this._salesClaimed; return this._salesClaimed;
} }

View File

@ -2,6 +2,7 @@
url="Clients/consumption" url="Clients/consumption"
link="{clientFk: $ctrl.$params.id}" link="{clientFk: $ctrl.$params.id}"
filter="::$ctrl.filter" filter="::$ctrl.filter"
limit="20"
user-params="::$ctrl.filterParams" user-params="::$ctrl.filterParams"
data="sales" data="sales"
order="itemTypeFk, itemName, itemSize"> order="itemTypeFk, itemName, itemSize">