diff --git a/cirras-underwriting-war/cirras-underwriting-war/src/main/angular/src/app/components/inventory/forage/forage-inventory.component.ts b/cirras-underwriting-war/cirras-underwriting-war/src/main/angular/src/app/components/inventory/forage/forage-inventory.component.ts index 4a3013e5..c9fbdcfd 100644 --- a/cirras-underwriting-war/cirras-underwriting-war/src/main/angular/src/app/components/inventory/forage/forage-inventory.component.ts +++ b/cirras-underwriting-war/cirras-underwriting-war/src/main/angular/src/app/components/inventory/forage/forage-inventory.component.ts @@ -197,8 +197,8 @@ export class ForageInventoryComponent extends BaseComponent implements OnChanges fldPlantings.push( self.fb.group( addPlantingObject(pltg.cropYear, pltg.fieldId, pltg.insurancePlanId, pltg.inventoryFieldGuid, pltg.lastYearCropCommodityId, pltg.lastYearCropCommodityName, pltg.lastYearCropVarietyId, pltg.lastYearCropVarietyName, - pltg.plantingNumber, pltg.isHiddenOnPrintoutInd, - pltg.inventoryUnseeded, null, new FormArray ([]), pltgInventorySeededForages ) ) ) + pltg.plantingNumber, pltg.isHiddenOnPrintoutInd, null, + pltg.inventoryUnseeded, new FormArray ([]), pltgInventorySeededForages ) ) ) } ) diff --git a/cirras-underwriting-war/cirras-underwriting-war/src/main/angular/src/app/components/inventory/grain/grain-inventory.component.ts b/cirras-underwriting-war/cirras-underwriting-war/src/main/angular/src/app/components/inventory/grain/grain-inventory.component.ts index c173af96..29a31c34 100644 --- a/cirras-underwriting-war/cirras-underwriting-war/src/main/angular/src/app/components/inventory/grain/grain-inventory.component.ts +++ b/cirras-underwriting-war/cirras-underwriting-war/src/main/angular/src/app/components/inventory/grain/grain-inventory.component.ts @@ -1203,16 +1203,24 @@ onDeleteField(field) { if ( frmPlanting.value.deletedByUserInd == true || areNotEqual(lastYearCropCommodityId, originalPlanting.lastYearCropCommodityId) || areNotEqual(lastYearCropVarietyId, originalPlanting.lastYearCropVarietyId) || - areNotEqual(frmPlanting.value.acresToBeSeeded, originalPlanting.inventoryUnseeded.acresToBeSeeded) || - areNotEqual(frmPlanting.value.cropCommodityId, originalPlanting.inventoryUnseeded.cropCommodityId) || - areNotEqual(frmPlanting.value.cropVarietyId, originalPlanting.inventoryUnseeded.cropVarietyId) || - areNotEqual(frmPlanting.value.isUnseededInsurableInd, originalPlanting.inventoryUnseeded.isUnseededInsurableInd) || areNotEqual(frmPlanting.value.isHiddenOnPrintoutInd, originalPlanting.isHiddenOnPrintoutInd) ) { return true } + if ( originalPlanting.inventoryUnseeded && + (frmPlanting.value.deletedByUserInd == true || + areNotEqual(frmPlanting.value.acresToBeSeeded, originalPlanting.inventoryUnseeded.acresToBeSeeded) || + areNotEqual(frmPlanting.value.cropCommodityId, originalPlanting.inventoryUnseeded.cropCommodityId) || + areNotEqual(frmPlanting.value.cropVarietyId, originalPlanting.inventoryUnseeded.cropVarietyId) || + areNotEqual(frmPlanting.value.isUnseededInsurableInd, originalPlanting.inventoryUnseeded.isUnseededInsurableInd) + ) + ) { + + return true + } + // now check inventory seeded grains for (let n = 0; n < frmPlanting.value.inventorySeededGrains.controls.length; n++) { diff --git a/cirras-underwriting-war/cirras-underwriting-war/src/main/angular/src/app/components/inventory/inventory-common.ts b/cirras-underwriting-war/cirras-underwriting-war/src/main/angular/src/app/components/inventory/inventory-common.ts index 998afdef..dd78f710 100644 --- a/cirras-underwriting-war/cirras-underwriting-war/src/main/angular/src/app/components/inventory/inventory-common.ts +++ b/cirras-underwriting-war/cirras-underwriting-war/src/main/angular/src/app/components/inventory/inventory-common.ts @@ -24,7 +24,7 @@ export interface CropCommodityVarietyOptionsType { export function addPlantingObject(cropYear, fieldId, insurancePlanId, inventoryFieldGuid, lastYearCropCommodityId, lastYearCropCommodityName, lastYearCropVarietyId, lastYearCropVarietyName, plantingNumber, isHiddenOnPrintoutInd, underseededInventorySeededForageGuid, - inventoryUnseeded: InventoryUnseeded, inventorySeededGrains: FormArray, inventorySeededForages: FormArray,) { + inventoryUnseeded: InventoryUnseeded, inventorySeededGrains: FormArray, inventorySeededForages: FormArray) { return { cropYear: [ cropYear ], @@ -44,8 +44,10 @@ export function addPlantingObject(cropYear, fieldId, insurancePlanId, inventoryF cropCommodityName: [ (inventoryUnseeded && inventoryUnseeded.cropCommodityName) ? inventoryUnseeded.cropCommodityName : CROP_COMMODITY_UNSPECIFIED.NAME ], cropVarietyId: [ (inventoryUnseeded && inventoryUnseeded.cropVarietyId) ? inventoryUnseeded.cropVarietyId : CROP_COMMODITY_UNSPECIFIED.ID ], cropVarietyName: [ (inventoryUnseeded && inventoryUnseeded.cropVarietyName) ? inventoryUnseeded.cropVarietyName : CROP_COMMODITY_UNSPECIFIED.NAME ], - cropCommodityVarietyId: [ `${inventoryUnseeded.cropCommodityId||0}_${inventoryUnseeded.cropVarietyId||0}` ], - cropCommodityVarietyName: [ inventoryUnseeded.cropVarietyName ? inventoryUnseeded.cropVarietyName : inventoryUnseeded.cropCommodityName ], + cropCommodityVarietyId: [ `${(inventoryUnseeded && inventoryUnseeded.cropCommodityId)||0}_${(inventoryUnseeded && inventoryUnseeded.cropVarietyId)||0}` ], + cropCommodityVarietyName: [ inventoryUnseeded ? + (inventoryUnseeded.cropVarietyName ? inventoryUnseeded.cropVarietyName : inventoryUnseeded.cropCommodityName) + : '' ], deletedByUserInd: [ (inventoryUnseeded && inventoryUnseeded.deletedByUserInd) ? inventoryUnseeded.deletedByUserInd : false ], isUnseededInsurableInd: [ (!inventoryUnseeded || inventoryUnseeded.isUnseededInsurableInd == undefined) ? true : inventoryUnseeded.isUnseededInsurableInd], // defaults to true isHiddenOnPrintoutInd: [ isHiddenOnPrintoutInd ],