Chore: Reformatted everthing

Fix: Product ledger was not totalling.
This is because for some reason, pydantic was sending the data as string when the field was nullable
This commit is contained in:
2023-08-04 21:00:26 +05:30
parent af27bf74ef
commit ac868257b7
194 changed files with 513 additions and 1580 deletions
@@ -54,16 +54,14 @@ export class IncentiveComponent implements OnInit {
incentives: new FormArray<FormGroup<{ points: FormControl<number> }>>([]),
});
// Listen to Date Change
this.form.controls.date.valueChanges
.pipe(map((x) => moment(x).format('DD-MMM-YYYY')))
.subscribe((x) => {
if (x !== this.voucher.date && !this.voucher.id) {
return this.ser.getIncentive(x).subscribe((voucher: Voucher) => {
this.loadVoucher(voucher);
});
}
return '';
});
this.form.controls.date.valueChanges.pipe(map((x) => moment(x).format('DD-MMM-YYYY'))).subscribe((x) => {
if (x !== this.voucher.date && !this.voucher.id) {
return this.ser.getIncentive(x).subscribe((voucher: Voucher) => {
this.loadVoucher(voucher);
});
}
return '';
});
}
ngOnInit() {
@@ -90,9 +88,7 @@ export class IncentiveComponent implements OnInit {
}
totalPoints() {
return this.voucher.incentives
.map((item) => item.daysWorked * item.points)
.reduce((sum, item) => sum + item);
return this.voucher.incentives.map((item) => item.daysWorked * item.points).reduce((sum, item) => sum + item);
}
pointValue() {
@@ -129,10 +125,7 @@ export class IncentiveComponent implements OnInit {
if (this.voucher.posted && this.auth.allowed('edit-posted-vouchers')) {
return true;
}
return (
this.voucher.user.id === (this.auth.user as User).id ||
this.auth.allowed("edit-other-user's-vouchers")
);
return this.voucher.user.id === (this.auth.user as User).id || this.auth.allowed("edit-other-user's-vouchers");
}
post() {