Merge branch 'develop' into feature/Digital/SSR-193
This commit is contained in:
commit
db94b0639a
3 changed files with 40 additions and 18 deletions
|
|
@ -31,6 +31,10 @@ const endpoints = {
|
|||
url: "/parts/api/v1/parts/damage-options",
|
||||
method: "GET",
|
||||
},
|
||||
GetPartsOrQuestions: {
|
||||
url: "/parts/api/v1/parts/parts-or-questions",
|
||||
method: "POST",
|
||||
},
|
||||
GetParts: {
|
||||
url: "/parts/api/v1/parts/parts",
|
||||
method: "POST",
|
||||
|
|
|
|||
|
|
@ -15,19 +15,6 @@
|
|||
validationRules="policy-number-required" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="row mt-4">
|
||||
<div class="col">
|
||||
<textboxQuestion
|
||||
inputId="policyZipField"
|
||||
cmsWidgetName="PolicyZipQuestion"
|
||||
ref="policyZip"
|
||||
v-model="welcomePageModel.policyZipCode"
|
||||
isRequired
|
||||
disableAutoFill
|
||||
mask="#####"
|
||||
validationRules="policy-zip-required|policy-zip-format" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="row mt-4">
|
||||
<div class="col">
|
||||
<textboxQuestion
|
||||
|
|
@ -157,7 +144,6 @@
|
|||
defineRule("loss-date-required", required(errorMessages.LOSS_DATE_REQUIRED));
|
||||
defineRule("loss-cause-required", required(errorMessages.LOSS_CAUSE_REQUIRED));
|
||||
defineRule("policy-number-required", required(errorMessages.POLICY_NUMBER_REQUIRED));
|
||||
defineRule("policy-zip-required", required(errorMessages.POLICY_ZIP_REQUIRED));
|
||||
defineRule("loss-date-required", required(errorMessages.LOSS_DATE_REQUIRED));
|
||||
defineRule("loss-state-required", required(errorMessages.LOSS_STATE_REQUIRED));
|
||||
defineRule("loss-city-required", required(errorMessages.LOSS_CITY_REQUIRED));
|
||||
|
|
@ -165,10 +151,6 @@
|
|||
defineRule("email-address-required", required(errorMessages.EMAIL_ADDRESS_REQUIRED));
|
||||
defineRule("damage-option-required", required(errorMessages.DAMAGE_OPTION_REQUIRED));
|
||||
|
||||
defineRule("policy-zip-format",
|
||||
regex(/(^\d{5}$)|(^\d{5}-\d{4}$)/, errorMessages.POLICY_ZIP_FORMAT)
|
||||
);
|
||||
|
||||
defineRule("email-address-format",
|
||||
regex(
|
||||
/^([a-zA-Z0-9_\-.+]+)@([a-zA-Z0-9_\-.]+)\.([a-zA-Z]{2,})$/,
|
||||
|
|
|
|||
|
|
@ -235,6 +235,42 @@ export const useMainStore = defineStore({
|
|||
});
|
||||
},
|
||||
|
||||
// PartsOrQuestions API Actions
|
||||
async getPartsOrQuestions() {
|
||||
const vehicle = this.vehicle;
|
||||
const damage = this.damage;
|
||||
const order = this.order;
|
||||
|
||||
const carId = vehicle.carId;
|
||||
const glassArray = damage.glassToReplace;
|
||||
// zip code is not available yet at the time of writing
|
||||
// const zipCode = order.serviceLocation.zipCode;
|
||||
// To Do: replace with actual zip code
|
||||
const zipCode = '43215';
|
||||
const vin = vehicle.vin;
|
||||
|
||||
// create a new array to avoid mutating state
|
||||
const glassArrayForPayload = convertGlassPieceNamingForApi(glassArray);
|
||||
|
||||
const response = await globalMethods.callHttpClient({
|
||||
method: endpoints.GetPartsOrQuestions.method,
|
||||
endpoint: endpoints.GetPartsOrQuestions.url,
|
||||
payload: {
|
||||
carId: carId,
|
||||
glassPieces: glassArrayForPayload,
|
||||
zip: zipCode,
|
||||
vin: vin,
|
||||
},
|
||||
});
|
||||
|
||||
// Flatten location and name properties
|
||||
response.data.partsOrQuestions = convertGlassPieceNamingFromApi(
|
||||
response.data.partsOrQuestions
|
||||
);
|
||||
|
||||
return response;
|
||||
},
|
||||
|
||||
async getParts() {
|
||||
const vehicle = this.getters.vehicle;
|
||||
const damage = this.getters.damage;
|
||||
|
|
|
|||
Loading…
Reference in a new issue