forked from Yara724/api
Fixed daqi being enforced on REPAIR
This commit is contained in:
@@ -42,9 +42,11 @@ export function getExpertReplyPricingValidationError(
|
||||
return `${label} requires typeOfDamage to be either '${TypeOfDamage.Repair}' or '${TypeOfDamage.Change}'.`;
|
||||
}
|
||||
|
||||
const daghi = part.daghi;
|
||||
if (
|
||||
!part.daghi ||
|
||||
!Object.values(DaghiOption).includes(part.daghi.option as DaghiOption)
|
||||
part.typeOfDamage === TypeOfDamage.Change &&
|
||||
(!daghi ||
|
||||
!Object.values(DaghiOption).includes(daghi.option as DaghiOption))
|
||||
) {
|
||||
return `${label} requires a valid daghi option.`;
|
||||
}
|
||||
@@ -52,7 +54,7 @@ export function getExpertReplyPricingValidationError(
|
||||
const price = parseMoneyAmountToman(part.price);
|
||||
const salary = parseMoneyAmountToman(part.salary);
|
||||
const totalPayment = parseMoneyAmountToman(part.totalPayment);
|
||||
const daghiPrice = parseMoneyAmountToman(part.daghi.price);
|
||||
const daghiPrice = parseMoneyAmountToman(daghi?.price);
|
||||
const hasPrice =
|
||||
part.price != null &&
|
||||
(typeof part.price !== "string" || part.price.trim() !== "");
|
||||
@@ -80,7 +82,7 @@ export function getExpertReplyPricingValidationError(
|
||||
}
|
||||
|
||||
if (
|
||||
part.daghi.option === DaghiOption.RECYCLED_PARTS_VALUE &&
|
||||
daghi?.option === DaghiOption.RECYCLED_PARTS_VALUE &&
|
||||
(daghiPrice === null ||
|
||||
daghiPrice < REPAIR_LINE_AMOUNT_TOMAN.MIN ||
|
||||
daghiPrice > REPAIR_LINE_AMOUNT_TOMAN.MAX)
|
||||
|
||||
Reference in New Issue
Block a user