working on getting input to respond correctly.

This commit is contained in:
Jordan Hewitt
2024-06-28 17:04:30 -07:00
parent 93c0c25eb5
commit 7c2289098e
8 changed files with 206 additions and 53 deletions

View File

@ -87,6 +87,18 @@ export class Product {
throw new Error(`Invalid dimensions: ${dimensions}`);
}
get priceDisplay() {
const u = this.presentUnits;
if (this.area) {
const w = Math.round(convert(this.area.w, this.area.u).to(this.presentUnits));
const l = Math.round(convert(this.area.l, this.area.u).to(this.presentUnits));
return `$ ${this.pricePerUnit} / ${l} x ${w} ${u}`;
} else if (this.length) {
const l = Math.round(convert(this.length.l, this.length.u).to(this.presentUnits));
return `$ ${this.pricePerUnit} per ${l} ${u}`;
}
}
get attributesAsList() {
return Object.entries(this.attributes).map(([key, value]) => {
return { key, value }