Loading src/app/p_product/admin/productCatalogManagement/edit-product-specs/assign-service-specification/assign-service-specification.component.ts +21 −5 Original line number Diff line number Diff line Loading @@ -165,7 +165,7 @@ export class AssignServiceSpecificationComponent implements OnInit { }); } else { this.executeAssignment(false); this.executeAssignment(null); } } Loading Loading @@ -251,7 +251,6 @@ export class AssignServiceSpecificationComponent implements OnInit { } removeUnwantedCharacteristics(spec: ProductSpecification) { // identify characteristics to remove (from CFSS) if user clicks no const unwantedNames: string[] = []; this.selectedSpecs.forEach(s => { Loading @@ -262,11 +261,26 @@ export class AssignServiceSpecificationComponent implements OnInit { } }); const originalNames = (this.data.productSpec.productSpecCharacteristic || []).map(c => c.name); const currentChars = spec.productSpecCharacteristic || []; const newSpecCharacteristicArray = currentChars.filter(c => !unwantedNames.includes(c.name)); // If there is nothing to change, just close const newSpecCharacteristicArray = currentChars.filter(char => { const isUnwanted = unwantedNames.includes(char.name); const wasPreExisting = originalNames.includes(char.name); // If it is NOT in the unwanted list, keep it. if (!isUnwanted) return true; // If it IS in the unwanted list, BUT it existed before we started, keep it. if (wasPreExisting) return true; return false; }); // If there is nothing to change (lengths match), just close if (newSpecCharacteristicArray.length === currentChars.length) { this.toast.success('Product Specification updated successfully'); this.dialogRef.close('updated'); return; } Loading @@ -281,10 +295,12 @@ export class AssignServiceSpecificationComponent implements OnInit { }).subscribe( data => {}, error => { console.error(error); this.toast.warning('Service assigned, but failed to clean up auto-assigned characteristics.'); this.dialogRef.close('updated'); }, () => { this.toast.success("Product Specification Characteristics list was successfully updated"); this.dialogRef.close('updated'); } ) Loading Loading
src/app/p_product/admin/productCatalogManagement/edit-product-specs/assign-service-specification/assign-service-specification.component.ts +21 −5 Original line number Diff line number Diff line Loading @@ -165,7 +165,7 @@ export class AssignServiceSpecificationComponent implements OnInit { }); } else { this.executeAssignment(false); this.executeAssignment(null); } } Loading Loading @@ -251,7 +251,6 @@ export class AssignServiceSpecificationComponent implements OnInit { } removeUnwantedCharacteristics(spec: ProductSpecification) { // identify characteristics to remove (from CFSS) if user clicks no const unwantedNames: string[] = []; this.selectedSpecs.forEach(s => { Loading @@ -262,11 +261,26 @@ export class AssignServiceSpecificationComponent implements OnInit { } }); const originalNames = (this.data.productSpec.productSpecCharacteristic || []).map(c => c.name); const currentChars = spec.productSpecCharacteristic || []; const newSpecCharacteristicArray = currentChars.filter(c => !unwantedNames.includes(c.name)); // If there is nothing to change, just close const newSpecCharacteristicArray = currentChars.filter(char => { const isUnwanted = unwantedNames.includes(char.name); const wasPreExisting = originalNames.includes(char.name); // If it is NOT in the unwanted list, keep it. if (!isUnwanted) return true; // If it IS in the unwanted list, BUT it existed before we started, keep it. if (wasPreExisting) return true; return false; }); // If there is nothing to change (lengths match), just close if (newSpecCharacteristicArray.length === currentChars.length) { this.toast.success('Product Specification updated successfully'); this.dialogRef.close('updated'); return; } Loading @@ -281,10 +295,12 @@ export class AssignServiceSpecificationComponent implements OnInit { }).subscribe( data => {}, error => { console.error(error); this.toast.warning('Service assigned, but failed to clean up auto-assigned characteristics.'); this.dialogRef.close('updated'); }, () => { this.toast.success("Product Specification Characteristics list was successfully updated"); this.dialogRef.close('updated'); } ) Loading