Warenausgabe Edit Page: Show Price with two decimal places

This commit is contained in:
Sebastian
2020-09-04 20:56:40 +02:00
parent 9c4f2b8395
commit 62acbdecc5
3 changed files with 19 additions and 1 deletions

View File

@@ -0,0 +1,6 @@
export function toDecimalPlaces(
value: number,
decimalPlaces: number = 2
): string {
return Number(value).toFixed(decimalPlaces);
}

View File

@@ -25,6 +25,7 @@ import { DatePipe } from '@angular/common';
import { ProcessingStatusNameMap } from '../constants';
import { Select } from '@ngxs/store';
import { VatState } from '../../../core/store/state/vat.state';
import { toDecimalPlaces } from '../../../core/utils/price.util';
@Injectable({ providedIn: 'root' })
export class ShelfEditFormService {
@@ -231,7 +232,10 @@ export class ShelfEditFormService {
],
quantity: [{ value: orderItem.quantity, disabled: true }],
price: [
{ value: String(orderItem.price).replace('.', ','), disabled: false },
{
value: toDecimalPlaces(orderItem.price, 2).replace('.', ','),
disabled: false,
},
[Validators.required, Validators.pattern(/^\d+(,\d{1,2})?$/)],
],
ean: [

View File

@@ -9,6 +9,14 @@ label {
display: flex;
width: calc(95% - #{$status-width});
}
input {
padding-top: 2px;
}
.suffix {
margin-top: -1px;
}
}
.status {