feat: check for type before try parse field
This commit is contained in:
parent
3193403f90
commit
601deffce4
1 changed files with 12 additions and 5 deletions
|
|
@ -477,15 +477,22 @@ export class ProductController extends Controller {
|
||||||
? "serviceFee"
|
? "serviceFee"
|
||||||
: "processingFee",
|
: "processingFee",
|
||||||
shared: item.shared === "ใช่" ? true : false,
|
shared: item.shared === "ใช่" ? true : false,
|
||||||
price: item?.price ? +parseFloat(item.price.replace(",", "")).toFixed(6) : 0,
|
price:
|
||||||
|
typeof item.price === "number"
|
||||||
|
? item.price
|
||||||
|
: +parseFloat(item.price.replace(",", "")).toFixed(6),
|
||||||
calcVat: item.calcVat === "ใช่" ? true : false,
|
calcVat: item.calcVat === "ใช่" ? true : false,
|
||||||
vatIncluded: item.vatIncluded === "รวม" ? true : false,
|
vatIncluded: item.vatIncluded === "รวม" ? true : false,
|
||||||
agentPrice: item?.agentPrice ? +parseFloat(item.agentPrice.replace(",", "")).toFixed(6) : 0,
|
agentPrice:
|
||||||
|
typeof item.agentPrice === "number"
|
||||||
|
? item.agentPrice
|
||||||
|
: +parseFloat(item.agentPrice.replace(",", "")).toFixed(6),
|
||||||
agentPriceCalcVat: item.agentPriceCalcVat === "ใช่" ? true : false,
|
agentPriceCalcVat: item.agentPriceCalcVat === "ใช่" ? true : false,
|
||||||
agentPriceVatIncluded: item.agentPriceVatIncluded === "รวม" ? true : false,
|
agentPriceVatIncluded: item.agentPriceVatIncluded === "รวม" ? true : false,
|
||||||
serviceCharge: item?.serviceCharge
|
serviceCharge:
|
||||||
? +parseFloat(item.serviceCharge.replace(",", "")).toFixed(6)
|
typeof item.serviceCharge === "number"
|
||||||
: 0,
|
? item.serviceCharge
|
||||||
|
: +parseFloat(item.serviceCharge.replace(",", "")).toFixed(6),
|
||||||
serviceChargeCalcVat: item.serviceChargeCalcVat === "ใช่" ? true : false,
|
serviceChargeCalcVat: item.serviceChargeCalcVat === "ใช่" ? true : false,
|
||||||
serviceChargeVatIncluded: item.serviceChargeVatIncluded === "รวม" ? true : false,
|
serviceChargeVatIncluded: item.serviceChargeVatIncluded === "รวม" ? true : false,
|
||||||
};
|
};
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue