Loading src/app/p_product/admin/productCatalogManagement/edit-product-specs/edit-product-spec-characteristics/edit-product-spec-characteristics.component.html +4 −4 Original line number Diff line number Diff line Loading @@ -7,7 +7,7 @@ <h4 mat-dialog-title class=" shadowed mb-3" *ngIf="!newSpec"> <i class="far fa-edit mr-2"></i> <span>Edit Service Characteristic</span> <span>Edit Product Characteristic</span> </h4> <form [formGroup]="editFormCharacteristic"> Loading Loading @@ -103,7 +103,7 @@ <h5 class="shadowed mb-3 d-flex align-items-center"> <div class="mr-4"> <i class="fas fa-sort-numeric-up-alt mr-2"></i> <span>Service Characteristic Value</span> <span>Product Characteristic Value</span> </div> <div> <button type="button" class="btn btn-success btn-sm" (click)="createFormArrayItem()"><i Loading @@ -111,9 +111,9 @@ </div> </h5> <div formArrayName="serviceSpecCharacteristicValue" class="container-fluid"> <div formArrayName="productSpecCharacteristicValue" class="container-fluid"> <div *ngFor="let val of editFormCharacteristic.get('serviceSpecCharacteristicValue')['controls']; let i = index;" <div *ngFor="let val of editFormCharacteristic.get('productSpecCharacteristicValue')['controls']; let i = index;" [formGroupName]="i" class="row align-items-center justify-content-center characteristic-value-container" [@fadeIn]> <ng-template [ngIf]="!isCharValueBlockExpanded[i]" [ngIfElse]="blockExpanded"> Loading src/app/p_product/admin/productCatalogManagement/edit-product-specs/edit-product-spec-characteristics/edit-product-spec-characteristics.component.ts +9 −9 Original line number Diff line number Diff line Loading @@ -42,7 +42,7 @@ export class EditProductSpecCharacteristicsComponent implements OnInit { startDateTime: new UntypedFormControl(new Date()) }), valueType: new UntypedFormControl(), serviceSpecCharacteristicValue: new UntypedFormArray([]) productSpecCharacteristicValue: new UntypedFormArray([]) }) subValueTypeCtrl = new UntypedFormControl('INTEGER') Loading @@ -64,7 +64,7 @@ export class EditProductSpecCharacteristicsComponent implements OnInit { if (!this.data.specToBeUpdated.validFor) this.data.specToBeUpdated.validFor = { endDateTime: null, startDateTime: null } this.editFormCharacteristic.patchValue(this.data.specToBeUpdated) const formArray = this.editFormCharacteristic.get('serviceSpecCharacteristicValue') as UntypedFormArray const formArray = this.editFormCharacteristic.get('productSpecCharacteristicValue') as UntypedFormArray this.data.specToBeUpdated.productSpecCharacteristicValue.forEach(val => { formArray.push(this.updateFormArrayItem(val)) this.isCharValueBlockExpanded.push(false) Loading @@ -83,7 +83,7 @@ export class EditProductSpecCharacteristicsComponent implements OnInit { ) .subscribe( val => { this.editFormCharacteristic.setControl('serviceSpecCharacteristicValue', new UntypedFormArray([])) this.editFormCharacteristic.setControl('productSpecCharacteristicValue', new UntypedFormArray([])) this.createFormArrayItem() Loading @@ -94,7 +94,7 @@ export class EditProductSpecCharacteristicsComponent implements OnInit { ) .subscribe( subVal => { this.editFormCharacteristic.setControl('serviceSpecCharacteristicValue', new UntypedFormArray([])) this.editFormCharacteristic.setControl('productSpecCharacteristicValue', new UntypedFormArray([])) this.createFormArrayItem() } ) Loading Loading @@ -134,7 +134,7 @@ export class EditProductSpecCharacteristicsComponent implements OnInit { createFormArrayItem() { const formArray = this.editFormCharacteristic.get('serviceSpecCharacteristicValue') as UntypedFormArray const formArray = this.editFormCharacteristic.get('productSpecCharacteristicValue') as UntypedFormArray // let isDisabled: boolean = true let subType: string = this.editFormCharacteristic.get('valueType').value Loading @@ -159,7 +159,7 @@ export class EditProductSpecCharacteristicsComponent implements OnInit { } deleteFormArrayItem(index) { const formArray = this.editFormCharacteristic.get('serviceSpecCharacteristicValue') as UntypedFormArray const formArray = this.editFormCharacteristic.get('productSpecCharacteristicValue') as UntypedFormArray formArray.removeAt(index) this.isCharValueBlockExpanded.splice(index, 1) } Loading @@ -170,7 +170,7 @@ export class EditProductSpecCharacteristicsComponent implements OnInit { isDefaultCheckboxChanged(index, event: MatCheckboxChange) { if (this.editFormCharacteristic.get('valueType').value === "ENUM" && event.checked) { const formArray = this.editFormCharacteristic.get('serviceSpecCharacteristicValue') as UntypedFormArray const formArray = this.editFormCharacteristic.get('productSpecCharacteristicValue') as UntypedFormArray for (let i = 0; i < formArray.controls.length; i++) { if (i !== index) formArray.controls[i].get('isDefault').setValue(false) } Loading @@ -187,8 +187,8 @@ export class EditProductSpecCharacteristicsComponent implements OnInit { if (this.newSpec) { this.data.productSpec.productSpecCharacteristic.push(this.editFormCharacteristic.getRawValue()) } else { // const updateCharacteristIndex = this.data.productSpec.productSpecCharacteristic.findIndex(char => char.id === this.data.specToBeUpdated.id) // this.data.productSpec.productSpecCharacteristic[updateCharacteristIndex] = this.editFormCharacteristic.getRawValue() const updateCharacteristIndex = this.data.productSpec.productSpecCharacteristic.findIndex(char => char.uuid === this.data.specToBeUpdated.uuid) this.data.productSpec.productSpecCharacteristic[updateCharacteristIndex] = this.editFormCharacteristic.getRawValue() } const updateCharacteristicObj: ProductSpecificationUpdate = { Loading src/app/p_product/admin/productCatalogManagement/edit-product-specs/edit-product-specs.component.ts +24 −23 Original line number Diff line number Diff line Loading @@ -13,6 +13,7 @@ import { AppService } from 'src/app/shared/services/app.service'; import { AssignServiceSpecificationComponent } from './assign-service-specification/assign-service-specification.component'; import { MatTableDataSource } from '@angular/material/table'; import { EditProductSpecCharacteristicsComponent } from './edit-product-spec-characteristics/edit-product-spec-characteristics.component'; import { DeleteProductSpecCharacteristicsComponent } from './delete-product-spec-characteristics/delete-product-spec-characteristics.component'; @Component({ selector: 'app-edit-product-specs', Loading Loading @@ -257,34 +258,34 @@ export class EditProductSpecsComponent implements OnInit { } openCharacteristicDeleteDialog(characteristic: ProductSpecificationCharacteristicRes) { // const specToBeDeletedIndex = this.spec.productSpecCharacteristic.findIndex(char => char.id === characteristic.id) const specToBeDeletedIndex = this.spec.productSpecCharacteristic.findIndex(char => char.uuid === characteristic.uuid) // const newSpecCharacteristicArray: ProductSpecificationCharacteristicRes[] = this.spec.productSpecCharacteristic.slice() const newSpecCharacteristicArray: ProductSpecificationCharacteristicRes[] = this.spec.productSpecCharacteristic.slice() // newSpecCharacteristicArray.splice(specToBeDeletedIndex, 1) newSpecCharacteristicArray.splice(specToBeDeletedIndex, 1) // const dialogRef = this.dialog.open(DeleteProductSpecCharacteristicsComponent, { // data: { // serviceSpec: this.spec, // serviceSpecCharacteristicArray: newSpecCharacteristicArray, // specToBeDeleted: this.spec.productSpecCharacteristic[specToBeDeletedIndex] // } // }) const dialogRef = this.dialog.open(DeleteProductSpecCharacteristicsComponent, { data: { productSpec: this.spec, productSpecCharacteristicArray: newSpecCharacteristicArray, specToBeDeleted: this.spec.productSpecCharacteristic[specToBeDeletedIndex] } }) // dialogRef.afterClosed().subscribe ( // result => { // if (result){ // this.toast.success("Product Specification Characteristics list was successfully updated") // this.retrieveProductSpec() // } // } // ) dialogRef.afterClosed().subscribe ( result => { if (result){ this.toast.success("Product Specification Characteristics list was successfully updated") this.retrieveProductSpec() } } ) } openCharacteristicDesignDialog(characteristic: ProductSpecificationCharacteristicRes) { const dialogRef = this.dialog.open(EditProductSpecCharacteristicsComponent, { data: { serviceSpec: this.spec, productSpec: this.spec, specToBeUpdated: characteristic }, disableClose: true Loading Loading
src/app/p_product/admin/productCatalogManagement/edit-product-specs/edit-product-spec-characteristics/edit-product-spec-characteristics.component.html +4 −4 Original line number Diff line number Diff line Loading @@ -7,7 +7,7 @@ <h4 mat-dialog-title class=" shadowed mb-3" *ngIf="!newSpec"> <i class="far fa-edit mr-2"></i> <span>Edit Service Characteristic</span> <span>Edit Product Characteristic</span> </h4> <form [formGroup]="editFormCharacteristic"> Loading Loading @@ -103,7 +103,7 @@ <h5 class="shadowed mb-3 d-flex align-items-center"> <div class="mr-4"> <i class="fas fa-sort-numeric-up-alt mr-2"></i> <span>Service Characteristic Value</span> <span>Product Characteristic Value</span> </div> <div> <button type="button" class="btn btn-success btn-sm" (click)="createFormArrayItem()"><i Loading @@ -111,9 +111,9 @@ </div> </h5> <div formArrayName="serviceSpecCharacteristicValue" class="container-fluid"> <div formArrayName="productSpecCharacteristicValue" class="container-fluid"> <div *ngFor="let val of editFormCharacteristic.get('serviceSpecCharacteristicValue')['controls']; let i = index;" <div *ngFor="let val of editFormCharacteristic.get('productSpecCharacteristicValue')['controls']; let i = index;" [formGroupName]="i" class="row align-items-center justify-content-center characteristic-value-container" [@fadeIn]> <ng-template [ngIf]="!isCharValueBlockExpanded[i]" [ngIfElse]="blockExpanded"> Loading
src/app/p_product/admin/productCatalogManagement/edit-product-specs/edit-product-spec-characteristics/edit-product-spec-characteristics.component.ts +9 −9 Original line number Diff line number Diff line Loading @@ -42,7 +42,7 @@ export class EditProductSpecCharacteristicsComponent implements OnInit { startDateTime: new UntypedFormControl(new Date()) }), valueType: new UntypedFormControl(), serviceSpecCharacteristicValue: new UntypedFormArray([]) productSpecCharacteristicValue: new UntypedFormArray([]) }) subValueTypeCtrl = new UntypedFormControl('INTEGER') Loading @@ -64,7 +64,7 @@ export class EditProductSpecCharacteristicsComponent implements OnInit { if (!this.data.specToBeUpdated.validFor) this.data.specToBeUpdated.validFor = { endDateTime: null, startDateTime: null } this.editFormCharacteristic.patchValue(this.data.specToBeUpdated) const formArray = this.editFormCharacteristic.get('serviceSpecCharacteristicValue') as UntypedFormArray const formArray = this.editFormCharacteristic.get('productSpecCharacteristicValue') as UntypedFormArray this.data.specToBeUpdated.productSpecCharacteristicValue.forEach(val => { formArray.push(this.updateFormArrayItem(val)) this.isCharValueBlockExpanded.push(false) Loading @@ -83,7 +83,7 @@ export class EditProductSpecCharacteristicsComponent implements OnInit { ) .subscribe( val => { this.editFormCharacteristic.setControl('serviceSpecCharacteristicValue', new UntypedFormArray([])) this.editFormCharacteristic.setControl('productSpecCharacteristicValue', new UntypedFormArray([])) this.createFormArrayItem() Loading @@ -94,7 +94,7 @@ export class EditProductSpecCharacteristicsComponent implements OnInit { ) .subscribe( subVal => { this.editFormCharacteristic.setControl('serviceSpecCharacteristicValue', new UntypedFormArray([])) this.editFormCharacteristic.setControl('productSpecCharacteristicValue', new UntypedFormArray([])) this.createFormArrayItem() } ) Loading Loading @@ -134,7 +134,7 @@ export class EditProductSpecCharacteristicsComponent implements OnInit { createFormArrayItem() { const formArray = this.editFormCharacteristic.get('serviceSpecCharacteristicValue') as UntypedFormArray const formArray = this.editFormCharacteristic.get('productSpecCharacteristicValue') as UntypedFormArray // let isDisabled: boolean = true let subType: string = this.editFormCharacteristic.get('valueType').value Loading @@ -159,7 +159,7 @@ export class EditProductSpecCharacteristicsComponent implements OnInit { } deleteFormArrayItem(index) { const formArray = this.editFormCharacteristic.get('serviceSpecCharacteristicValue') as UntypedFormArray const formArray = this.editFormCharacteristic.get('productSpecCharacteristicValue') as UntypedFormArray formArray.removeAt(index) this.isCharValueBlockExpanded.splice(index, 1) } Loading @@ -170,7 +170,7 @@ export class EditProductSpecCharacteristicsComponent implements OnInit { isDefaultCheckboxChanged(index, event: MatCheckboxChange) { if (this.editFormCharacteristic.get('valueType').value === "ENUM" && event.checked) { const formArray = this.editFormCharacteristic.get('serviceSpecCharacteristicValue') as UntypedFormArray const formArray = this.editFormCharacteristic.get('productSpecCharacteristicValue') as UntypedFormArray for (let i = 0; i < formArray.controls.length; i++) { if (i !== index) formArray.controls[i].get('isDefault').setValue(false) } Loading @@ -187,8 +187,8 @@ export class EditProductSpecCharacteristicsComponent implements OnInit { if (this.newSpec) { this.data.productSpec.productSpecCharacteristic.push(this.editFormCharacteristic.getRawValue()) } else { // const updateCharacteristIndex = this.data.productSpec.productSpecCharacteristic.findIndex(char => char.id === this.data.specToBeUpdated.id) // this.data.productSpec.productSpecCharacteristic[updateCharacteristIndex] = this.editFormCharacteristic.getRawValue() const updateCharacteristIndex = this.data.productSpec.productSpecCharacteristic.findIndex(char => char.uuid === this.data.specToBeUpdated.uuid) this.data.productSpec.productSpecCharacteristic[updateCharacteristIndex] = this.editFormCharacteristic.getRawValue() } const updateCharacteristicObj: ProductSpecificationUpdate = { Loading
src/app/p_product/admin/productCatalogManagement/edit-product-specs/edit-product-specs.component.ts +24 −23 Original line number Diff line number Diff line Loading @@ -13,6 +13,7 @@ import { AppService } from 'src/app/shared/services/app.service'; import { AssignServiceSpecificationComponent } from './assign-service-specification/assign-service-specification.component'; import { MatTableDataSource } from '@angular/material/table'; import { EditProductSpecCharacteristicsComponent } from './edit-product-spec-characteristics/edit-product-spec-characteristics.component'; import { DeleteProductSpecCharacteristicsComponent } from './delete-product-spec-characteristics/delete-product-spec-characteristics.component'; @Component({ selector: 'app-edit-product-specs', Loading Loading @@ -257,34 +258,34 @@ export class EditProductSpecsComponent implements OnInit { } openCharacteristicDeleteDialog(characteristic: ProductSpecificationCharacteristicRes) { // const specToBeDeletedIndex = this.spec.productSpecCharacteristic.findIndex(char => char.id === characteristic.id) const specToBeDeletedIndex = this.spec.productSpecCharacteristic.findIndex(char => char.uuid === characteristic.uuid) // const newSpecCharacteristicArray: ProductSpecificationCharacteristicRes[] = this.spec.productSpecCharacteristic.slice() const newSpecCharacteristicArray: ProductSpecificationCharacteristicRes[] = this.spec.productSpecCharacteristic.slice() // newSpecCharacteristicArray.splice(specToBeDeletedIndex, 1) newSpecCharacteristicArray.splice(specToBeDeletedIndex, 1) // const dialogRef = this.dialog.open(DeleteProductSpecCharacteristicsComponent, { // data: { // serviceSpec: this.spec, // serviceSpecCharacteristicArray: newSpecCharacteristicArray, // specToBeDeleted: this.spec.productSpecCharacteristic[specToBeDeletedIndex] // } // }) const dialogRef = this.dialog.open(DeleteProductSpecCharacteristicsComponent, { data: { productSpec: this.spec, productSpecCharacteristicArray: newSpecCharacteristicArray, specToBeDeleted: this.spec.productSpecCharacteristic[specToBeDeletedIndex] } }) // dialogRef.afterClosed().subscribe ( // result => { // if (result){ // this.toast.success("Product Specification Characteristics list was successfully updated") // this.retrieveProductSpec() // } // } // ) dialogRef.afterClosed().subscribe ( result => { if (result){ this.toast.success("Product Specification Characteristics list was successfully updated") this.retrieveProductSpec() } } ) } openCharacteristicDesignDialog(characteristic: ProductSpecificationCharacteristicRes) { const dialogRef = this.dialog.open(EditProductSpecCharacteristicsComponent, { data: { serviceSpec: this.spec, productSpec: this.spec, specToBeUpdated: characteristic }, disableClose: true Loading