IO-1304 Resolve ins co nm update on import.
This commit is contained in:
@@ -90,13 +90,7 @@ export function JobsAvailableContainer({
|
||||
|
||||
const estData = replaceEmpty(estDataRaw.data.available_jobs_by_pk);
|
||||
|
||||
if (
|
||||
!(
|
||||
|
||||
estData &&
|
||||
estData.est_data
|
||||
)
|
||||
) {
|
||||
if (!(estData && estData.est_data)) {
|
||||
//We don't have the right data. Error!
|
||||
setInsertLoading(false);
|
||||
notification["error"]({
|
||||
@@ -115,10 +109,7 @@ export function JobsAvailableContainer({
|
||||
).data;
|
||||
|
||||
let existingVehicles;
|
||||
if (
|
||||
estData.est_data.vehicle &&
|
||||
estData.est_data.vin
|
||||
) {
|
||||
if (estData.est_data.vehicle && estData.est_data.vin) {
|
||||
//There's vehicle data, need to double check the VIN.
|
||||
existingVehicles = await client.query({
|
||||
query: SEARCH_VEHICLE_BY_VIN,
|
||||
@@ -197,13 +188,7 @@ export function JobsAvailableContainer({
|
||||
setJobModalVisible(false);
|
||||
setInsertLoading(true);
|
||||
const estData = replaceEmpty(estDataRaw.data.available_jobs_by_pk);
|
||||
if (
|
||||
!(
|
||||
|
||||
estData &&
|
||||
estData.est_data
|
||||
)
|
||||
) {
|
||||
if (!(estData && estData.est_data)) {
|
||||
//We don't have the right data. Error!
|
||||
setInsertLoading(false);
|
||||
notification["error"]({
|
||||
@@ -215,7 +200,8 @@ export function JobsAvailableContainer({
|
||||
|
||||
delete supp.owner;
|
||||
delete supp.vehicle;
|
||||
if (importOptions.overrideHeaders) {
|
||||
delete supp.ins_co_nm;
|
||||
if (!importOptions.overrideHeaders) {
|
||||
HeaderFields.forEach((item) => delete supp[item]);
|
||||
}
|
||||
|
||||
@@ -396,7 +382,7 @@ export default connect(
|
||||
function replaceEmpty(someObj, replaceValue = null) {
|
||||
const replacer = (key, value) => (value === "" ? replaceValue : value);
|
||||
//^ because you seem to want to replace (strings) "null" or "undefined" too
|
||||
console.log(someObj)
|
||||
console.log(someObj);
|
||||
const temp = JSON.stringify(someObj, replacer);
|
||||
console.log(`temp`, temp);
|
||||
return JSON.parse(temp);
|
||||
|
||||
Reference in New Issue
Block a user