Merge pull request #795 from Safelite/feature/digital/SSR-1140
SSR-1140 Remove unused method from FMG
This commit is contained in:
commit
8cb12ab68b
1 changed files with 0 additions and 62 deletions
|
|
@ -1169,68 +1169,6 @@ export const useMainStore = defineStore({
|
|||
endpoint: `${endpoints.GetServiceabilityDetails.url}?zip=${serviceZipCode}&carId=${carId}${lineItems}&${glassPieces}`
|
||||
});
|
||||
},
|
||||
mapTaxedLineItemsToStoreFormat(availableLineItems, storeLineItems) {
|
||||
// clone the lineItems array because what we're passing in is referencing the store directly
|
||||
const lineItems = deepClone(storeLineItems);
|
||||
|
||||
// eslint-disable-next-line no-restricted-syntax, prefer-const
|
||||
for (let [category, lineItemsInCategory] of Object.entries(lineItems)) {
|
||||
lineItemsInCategory = lineItemsInCategory ?? [];
|
||||
|
||||
if (category === 'supportingItems') {
|
||||
// if the category is supporting items we need to filter out the items that aren't repair chips
|
||||
const nonRepairChipSupportItemsLineItems = lineItemsInCategory.filter((lineItem) => lineItem.partNumber !== 'WSREPAIR');
|
||||
|
||||
/*
|
||||
Because repair chips all have the same part number but different prices based on the quantity,
|
||||
we have to sort the store line items and available line items by descending labor amount in order to
|
||||
map the tax correctly to each repair chip
|
||||
*/
|
||||
// get the supporting items that ARE repair chips and sort them by descending labor amount
|
||||
let repairChipLineItems = lineItemsInCategory.filter((lineItem) => lineItem.partNumber === 'WSREPAIR');
|
||||
repairChipLineItems = repairChipLineItems.sort((a, b) => parseFloat(b.laborAmount) - parseFloat(a.laborAmount));
|
||||
|
||||
// get the supporting items from the available line items (taxed) that ARE repair chips and sort them by descending labor amount
|
||||
let availableRepairChipLineItems = availableLineItems.filter((lineItem) => lineItem.partNumber === 'WSREPAIR');
|
||||
availableRepairChipLineItems = availableRepairChipLineItems.sort((a, b) => parseFloat(b.laborAmount) - parseFloat(a.laborAmount));
|
||||
|
||||
// go through each one of those mapping the taxes to the correct chip
|
||||
for (let i = 0; i < availableRepairChipLineItems.length; i++) {
|
||||
repairChipLineItems[i].salesTax = availableRepairChipLineItems[i].salesTax;
|
||||
}
|
||||
|
||||
// then we map the non-repair chip items based on part number
|
||||
for (
|
||||
let lineItemIndex = 0;
|
||||
lineItemIndex < nonRepairChipSupportItemsLineItems.length;
|
||||
lineItemIndex++
|
||||
) {
|
||||
const availableLineItem = availableLineItems.find((ali) =>
|
||||
ali.partNumber === nonRepairChipSupportItemsLineItems[lineItemIndex].partNumber);
|
||||
if (availableLineItem) {
|
||||
nonRepairChipSupportItemsLineItems[lineItemIndex].salesTax =
|
||||
availableLineItem.salesTax;
|
||||
}
|
||||
}
|
||||
|
||||
// finally we splice the two arrays back into one
|
||||
lineItemsInCategory = nonRepairChipSupportItemsLineItems.concat(repairChipLineItems);
|
||||
} else {
|
||||
for (
|
||||
let lineItemIndex = 0;
|
||||
lineItemIndex < lineItemsInCategory.length;
|
||||
lineItemIndex++
|
||||
) {
|
||||
const availableLineItem = availableLineItems.find((ali) => ali.partNumber === lineItemsInCategory[lineItemIndex].partNumber);
|
||||
if (availableLineItem) {
|
||||
lineItemsInCategory[lineItemIndex].salesTax = availableLineItem.salesTax;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return lineItems;
|
||||
},
|
||||
lookupVehicleByVin(vin) {
|
||||
return globalMethods.callHttpClient({
|
||||
method: endpoints.LookupVehicleByVin.method,
|
||||
|
|
|
|||
Loading…
Reference in a new issue