Resolved missing Vehicle info on Import IO-440
This commit is contained in:
@@ -73,12 +73,16 @@ export function JobsAvailableContainer({
|
||||
})
|
||||
).data;
|
||||
|
||||
const existingVehicles = await client.query({
|
||||
query: SEARCH_VEHICLE_BY_VIN,
|
||||
variables: {
|
||||
vin: estData.data.available_jobs_by_pk.est_data.vehicle.data.v_vin,
|
||||
},
|
||||
});
|
||||
let existingVehicles;
|
||||
if (estData.data.available_jobs_by_pk.est_data.vehicle) {
|
||||
//There's vehicle data, need to double check the VIN.
|
||||
existingVehicles = await client.query({
|
||||
query: SEARCH_VEHICLE_BY_VIN,
|
||||
variables: {
|
||||
vin: estData.data.available_jobs_by_pk.est_data.vehicle.data.v_vin,
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
const newJob = {
|
||||
...estData.data.available_jobs_by_pk.est_data,
|
||||
@@ -86,7 +90,7 @@ export function JobsAvailableContainer({
|
||||
owner_owing: Dinero(newTotals.totals.custPayable.total).toFormat("0.00"),
|
||||
job_totals: newTotals,
|
||||
queued_for_parts: true,
|
||||
...(existingVehicles.data.vehicles.length > 0
|
||||
...(existingVehicles && existingVehicles.data.vehicles.length > 0
|
||||
? { vehicleid: existingVehicles.data.vehicles[0].id, vehicle: null }
|
||||
: {}),
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user