diff --git a/src/app/pages/product-details/product-details.component.html b/src/app/pages/product-details/product-details.component.html index 707d19b3..c1bea892 100644 --- a/src/app/pages/product-details/product-details.component.html +++ b/src/app/pages/product-details/product-details.component.html @@ -262,7 +262,10 @@

+ 3rd party certifications: +

@for (char of complianceProf; track char.id) {
@@ -307,6 +310,23 @@

{{char.name}}

}
+ } + @if(additionalCerts.length>0){ +

+ Additional certifications: +

+
+ @for (char of additionalCerts; track char.id) { +
+
+ +

{{normalizeName(char.name)}}

+ +
+
+ } +
+ }

{{ 'PRODUCT_DETAILS._product_pricing' | translate }}

diff --git a/src/app/pages/product-details/product-details.component.ts b/src/app/pages/product-details/product-details.component.ts index 0629e6e5..9d5267b0 100644 --- a/src/app/pages/product-details/product-details.component.ts +++ b/src/app/pages/product-details/product-details.component.ts @@ -57,6 +57,7 @@ export class ProductDetailsComponent implements OnInit, OnDestroy { attatchments: AttachmentRefOrValue[] = []; prodSpec:ProductSpecification = {}; complianceProf:any[] = []; + additionalCerts:any[] = []; complianceLevel:string='NL'; complianceDescription:string='No level. This product hasnt reached any compliance level yet.' serviceSpecs:any[] = []; @@ -259,25 +260,48 @@ export class ProductDetailsComponent implements OnInit, OnDestroy { if(this.prodSpec.productSpecCharacteristic != undefined) { // Avoid displaying the compliance credential && Avoid showing "- enabled" chars this.prodChars = this.prodSpec.productSpecCharacteristic.filter((char: any) => { - return char.name != 'Compliance:VC' && char.name != 'Compliance:SelfAtt' && !char.name?.endsWith(' - enabled') + return !char.name.startsWith('Compliance:') && !char.name?.endsWith(' - enabled') }) - for(let i=0; i { - return p.name === certifications[i].name - })); - if(compProf){ - let cert:any = certifications[i] - cert.href = compProf.productSpecCharacteristicValue?.at(0)?.value - this.complianceProf.push(certifications[i]) + this.additionalCerts = this.prodSpec.productSpecCharacteristic.filter((char: any) => { + const cleanedName = char.name.replace('Compliance:', '').trim(); + + return ( + char.name.startsWith('Compliance:') && + !certifications.some(cert => cert.name === cleanedName) && char.name != 'Compliance:SelfAtt' + ); + }); + console.log('--- additional') + console.log(this.additionalCerts) + + const normalizeName = (name?: string): string => + name?.replace(/compliance:/i, '').trim() ?? ''; + + for (let i = 0; i < certifications.length; i++) { + + // Buscar característica quitando el prefijo "Compliance:" + let compProf = this.prodSpec.productSpecCharacteristic.find(p => { + return normalizeName(p.name) === certifications[i].name; + }); + + if (compProf) { + let cert: any = certifications[i]; + cert.href = compProf.productSpecCharacteristicValue?.at(0)?.value; + this.complianceProf.push(cert); } - //Deleting certifications out of characteristics' array - const index = this.prodChars.findIndex(item => item.name === certifications[i].name); - if(index!==-1){ + + // Eliminar certificaciones del array de características + const index = this.prodChars.findIndex(item => + normalizeName(item.name) === certifications[i].name + ); + + if (index !== -1) { this.prodChars.splice(index, 1); } } + + console.log(this.complianceProf) + } @@ -894,4 +918,8 @@ async deleteProduct(product: Product | undefined){ } } + normalizeName(name?: string): string { + return name?.replace(/compliance:/i, '').trim() ?? ''; + } + } diff --git a/src/app/pages/seller-offerings/offerings/seller-offer/new-price-plan/new-price-plan.component.ts b/src/app/pages/seller-offerings/offerings/seller-offer/new-price-plan/new-price-plan.component.ts index 38acca22..28c4ab67 100644 --- a/src/app/pages/seller-offerings/offerings/seller-offer/new-price-plan/new-price-plan.component.ts +++ b/src/app/pages/seller-offerings/offerings/seller-offer/new-price-plan/new-price-plan.component.ts @@ -143,7 +143,8 @@ export class NewPricePlanComponent implements OnInit, OnDestroy { checkPriceInfo(){ for(let i=0;i certification.name === this.selectedProdSpec.productSpecCharacteristic[i].name)) { + //if (!certifications.some(certification => certification.name === this.selectedProdSpec.productSpecCharacteristic[i].name)) { + if (!certifications.some(certification => certification.name === this.selectedProdSpec.productSpecCharacteristic[i].name) && !this.selectedProdSpec.productSpecCharacteristic[i].name.startsWith('Compliance:')) { this.createdPriceProfile.push(this.selectedProdSpec.productSpecCharacteristic[i]); this.filteredCharacteristics.push(this.selectedProdSpec.productSpecCharacteristic[i]); } diff --git a/src/app/pages/seller-offerings/offerings/seller-product-spec/create-product-spec/create-product-spec.component.html b/src/app/pages/seller-offerings/offerings/seller-product-spec/create-product-spec/create-product-spec.component.html index 477ef3cb..42c44cdc 100644 --- a/src/app/pages/seller-offerings/offerings/seller-product-spec/create-product-spec/create-product-spec.component.html +++ b/src/app/pages/seller-offerings/offerings/seller-product-spec/create-product-spec/create-product-spec.component.html @@ -282,7 +282,7 @@

'break-all': hasLongWord(sel.name, 20), 'break-words': !hasLongWord(sel.name, 20) }" class="px-6 py-4 text-wrap break-words"> - {{sel.name}} + {{normalizeName(sel.name)}} {{sel.url}} @@ -347,7 +347,116 @@

--> - + @if(additionalISOS.length>0){ +

+ You added the following additional certifications: +

+
+ + + + + + + + + + @for (cert of additionalISOS; track cert.name; let idx = $index) { + + + + + + } + +
+ {{ 'UPDATE_PROD_SPEC._product_name' | translate }} + + {{ 'UPDATE_PROD_SPEC._value' | translate }} + + {{ 'UPDATE_PROD_SPEC._actions' | translate }} +
+ {{normalizeName(cert.name)}} + + {{cert.url}} + + +
+
+ } + @if(showCert==false){ +
+ +
+ } @else { +
+

+ Add an additional certification: +

+
+
+ + +
+ @if(isoToCreate==''){ + + +
+ +
+

{{ 'UPDATE_PROD_SPEC._drop_files' | translate }} + +

+
+
+
+
+ } @else { + + } +
+
+ + +
+
+ } } @if ((currentStep === 2 && !BUNDLE_ENABLED) || (currentStep === 3 && BUNDLE_ENABLED)) { @@ -384,6 +493,7 @@

@for (prod of prodChars; track prod;) { + @if(!prod.name?.startsWith('Compliance:')){ + } } diff --git a/src/app/pages/seller-offerings/offerings/seller-product-spec/create-product-spec/create-product-spec.component.ts b/src/app/pages/seller-offerings/offerings/seller-product-spec/create-product-spec/create-product-spec.component.ts index 1e6c9173..fc7b6d3c 100644 --- a/src/app/pages/seller-offerings/offerings/seller-product-spec/create-product-spec/create-product-spec.component.ts +++ b/src/app/pages/seller-offerings/offerings/seller-product-spec/create-product-spec/create-product-spec.component.ts @@ -116,11 +116,14 @@ export class CreateProductSpecComponent implements OnInit, OnDestroy { buttonISOClicked:boolean=false; availableISOS:any[]=[]; selectedISOS:any[]=[]; + additionalISOS:any[]=[]; selectedISO:any; showUploadFile:boolean=false; disableCompNext:boolean=true; selfAtt:any; showUploadAtt:boolean=false; + isoToCreate:string=''; + showCert:boolean=false; //SERVICE INFO: serviceSpecPage=0; @@ -160,6 +163,7 @@ export class CreateProductSpecComponent implements OnInit, OnDestroy { prodAttachments:AttachmentRefOrValue[]=[]; attachToCreate:AttachmentRefOrValue={url:'',attachmentType:''}; attFileName = new FormControl('', [Validators.required, Validators.pattern('[a-zA-Z0-9 _.-]*')]); + certFileName = new FormControl('', [Validators.required, Validators.pattern('[a-zA-Z0-9 _.-]*')]); attImageName = new FormControl('', [Validators.required, Validators.pattern('^https?:\\/\\/.*\\.(?:png|jpg|jpeg|gif|bmp|webp)$')]) //FINAL PRODUCT USING API CALL STRUCTURE @@ -220,6 +224,7 @@ export class CreateProductSpecComponent implements OnInit, OnDestroy { @ViewChild('attachName') attachName!: ElementRef; @ViewChild('imgURL') imgURL!: ElementRef; + @ViewChild('certificationName') certificationName!: ElementRef; public files: NgxFileDropEntry[] = []; @@ -398,7 +403,7 @@ export class CreateProductSpecComponent implements OnInit, OnDestroy { if (index !== -1) { console.log('seleccionar') this.availableISOS.splice(index, 1); - this.selectedISOS.push({name: iso.name, url: '', mandatory: iso.mandatory, domesupported: iso.domesupported}); + this.selectedISOS.push({name: 'Compliance:'+iso.name, url: '', mandatory: iso.mandatory, domesupported: iso.domesupported}); } this.buttonISOClicked=!this.buttonISOClicked; this.cdr.detectChanges(); @@ -407,13 +412,31 @@ export class CreateProductSpecComponent implements OnInit, OnDestroy { } removeISO(iso:any){ + const cleanedName = iso.name + .replace('Compliance:', '') + .trim(); const index = this.selectedISOS.findIndex(item => item.name === iso.name); if (index !== -1) { console.log('seleccionar') this.selectedISOS.splice(index, 1); - this.availableISOS.push({name: iso.name, mandatory: iso.mandatory, domesupported: iso.domesupported}); + this.availableISOS.push({name: cleanedName, mandatory: iso.mandatory, domesupported: iso.domesupported}); + + //if (iso.name in this.verifiedISO) { + // delete this.verifiedISO[iso.name] + //} } - this.cdr.detectChanges(); + this.cdr.detectChanges(); + console.log(this.prodSpecsBundle) + } + + removeCert(iso:any){ + const index = this.additionalISOS.findIndex(item => item.name === iso.name); + if (index !== -1) { + console.log('eliminar additional cert') + this.additionalISOS.splice(index, 1); + console.log(this.additionalISOS) + } + this.cdr.detectChanges(); } removeSelfAtt(){ @@ -489,16 +512,19 @@ export class CreateProductSpecComponent implements OnInit, OnDestroy { }, 3000); return; } - if(this.showCompliance && !this.showUploadAtt){ + if(((this.currentStep === 1 && !this.BUNDLE_ENABLED) || (this.currentStep === 2 && this.BUNDLE_ENABLED)) && !this.showUploadAtt){ const index = this.selectedISOS.findIndex(item => item.name === sel.name); this.attachmentService.uploadFile(fileBody).subscribe({ next: data => { - console.log(data) + if(index!==-1){ this.selectedISOS[index].url=data.content; //this.selectedISOS[index].attachmentType=file.type; this.showUploadFile=false; this.cdr.detectChanges(); console.log('uploaded') + } else { + this.isoToCreate=data.content; + } }, error: error => { console.error('There was an error while uploading the file!', error); @@ -518,7 +544,7 @@ export class CreateProductSpecComponent implements OnInit, OnDestroy { } }); } - if(this.showUploadAtt){ + if(((this.currentStep === 1 && !this.BUNDLE_ENABLED) || (this.currentStep === 2 && this.BUNDLE_ENABLED)) && this.showUploadAtt){ const index = this.finishChars.findIndex(item => item.name === this.selfAtt.name); this.attachmentService.uploadFile(fileBody).subscribe({ next: data => { @@ -886,6 +912,26 @@ export class CreateProductSpecComponent implements OnInit, OnDestroy { this.attachToCreate={url:'',attachmentType:''}; } + saveAdditionalCert(){ + console.log('saving') + this.additionalISOS.push({ + name: 'Compliance:'+this.certificationName.nativeElement.value, + url: this.isoToCreate + }) + this.certificationName.nativeElement.value=''; + this.isoToCreate=''; + this.certFileName.reset(); + this.showCert=false; + } + + clearAdditionalCert(urlonly:boolean){ + if(!urlonly){ + this.certificationName.nativeElement.value=''; + this.certFileName.reset(); + } + this.isoToCreate=''; + } + toggleRelationship(){ this.prodSpecRels=[]; this.prodSpecRelPage=0; @@ -1248,13 +1294,42 @@ export class CreateProductSpecComponent implements OnInit, OnDestroy { showFinish(){ this.relationshipDone=true; this.finishDone=true; + console.log('--- set product data') + console.log(this.prodChars) for(let i=0; i< this.prodChars.length; i++){ const index = this.finishChars.findIndex(item => item.name === this.prodChars[i].name); if (index == -1) { - this.finishChars.push(this.prodChars[i]) + const cleanedName = this.prodChars[i]?.name + ?.replace('Compliance:', '') + .trim(); + + const checkIso = this.availableISOS.findIndex( + item => item.name === cleanedName + ); + if (checkIso == -1) { + if (this.prodChars[i].name != 'Compliance:SelfAtt') { + console.log('--- check if deleted additional cert') + console.log(this.prodChars[i].name) + const checkAdditional = this.additionalISOS.findIndex( + item => item.name === cleanedName + ); + if(checkAdditional != -1){ + this.finishChars.push(this.prodChars[i]) + } + if(!this.prodChars[i].name?.startsWith('Compliance:')){ + this.finishChars.push(this.prodChars[i]) + } + } else { + this.finishChars.push(this.prodChars[i]) + } + } else { + this.finishChars.push(this.prodChars[i]) + } + } } - for(let i=0; i item.name === this.selectedISOS[i].name); if (index == -1) { this.finishChars.push({ @@ -1267,6 +1342,25 @@ export class CreateProductSpecComponent implements OnInit, OnDestroy { }) } } + + for(let i=0; i item.name === this.additionalISOS[i].name); + if (index == -1) { + this.finishChars.push({ + id: 'urn:ngsi-ld:characteristic:'+uuidv4(), + name: this.additionalISOS[i].name, + productSpecCharacteristicValue: [{ + isDefault: true, + value: this.additionalISOS[i].url + }] + }) + } + console.log(this.finishChars) + } let rels = []; for(let i=0; i{{ 'UPDATE_PROD_SPEC._ho 'break-all': hasLongWord(sel.name, 20), 'break-words': !hasLongWord(sel.name, 20) }" class="px-6 py-4 text-wrap break-words"> - {{sel.name}} + {{normalizeName(sel.name)}} {{sel.url}} @@ -451,7 +451,116 @@

{{ 'UPDATE_PROD_SPEC._ho --> - + @if(additionalISOS.length>0){ +

+ You added the following additional certifications: +

+
+ + + + + + + + + + @for (cert of additionalISOS; track cert.name; let idx = $index) { + + + + + + } + +
+ {{ 'UPDATE_PROD_SPEC._product_name' | translate }} + + {{ 'UPDATE_PROD_SPEC._value' | translate }} + + {{ 'UPDATE_PROD_SPEC._actions' | translate }} +
+ {{normalizeName(cert.name)}} + + {{cert.url}} + + +
+
+ } + @if(showCert==false){ +
+ +
+ } @else { +
+

+ Add an additional certification: +

+
+
+ + +
+ @if(isoToCreate==''){ + + +
+ +
+

{{ 'UPDATE_PROD_SPEC._drop_files' | translate }} + +

+
+
+
+
+ } @else { + + } +
+
+ + +
+
+ } } @if ((currentStep === 2 && !BUNDLE_ENABLED) || (currentStep === 3 && BUNDLE_ENABLED)) { @@ -488,6 +597,7 @@

{{ 'UPDATE_PROD_SPEC._ho @for (prod of prodChars; track prod;) { + @if(!prod.name?.startsWith('Compliance:')){ {{ 'UPDATE_PROD_SPEC._ho + } } diff --git a/src/app/pages/seller-offerings/offerings/seller-product-spec/update-product-spec/update-product-spec.component.ts b/src/app/pages/seller-offerings/offerings/seller-product-spec/update-product-spec/update-product-spec.component.ts index 05dce3e4..e4405752 100644 --- a/src/app/pages/seller-offerings/offerings/seller-product-spec/update-product-spec/update-product-spec.component.ts +++ b/src/app/pages/seller-offerings/offerings/seller-product-spec/update-product-spec/update-product-spec.component.ts @@ -111,6 +111,7 @@ export class UpdateProductSpecComponent implements OnInit, OnDestroy { buttonISOClicked:boolean=false; availableISOS:any[]=[]; selectedISOS:any[]=[]; + additionalISOS:any[]=[]; verifiedISO:string[] = []; selectedISO:any; complianceVC:any = null; @@ -118,6 +119,8 @@ export class UpdateProductSpecComponent implements OnInit, OnDestroy { selfAtt:any; checkExistingSelfAtt:boolean=false; showUploadAtt:boolean=false; + isoToCreate:string=''; + showCert:boolean=false; //SERVICE INFO: serviceSpecPage=0; @@ -158,6 +161,7 @@ export class UpdateProductSpecComponent implements OnInit, OnDestroy { prodAttachments:AttachmentRefOrValue[]=[]; attachToCreate:AttachmentRefOrValue={url:'',attachmentType:''}; attFileName = new FormControl('', [Validators.required, Validators.pattern('[a-zA-Z0-9 _.-]*')]); + certFileName = new FormControl('', [Validators.required, Validators.pattern('[a-zA-Z0-9 _.-]*')]); attImageName = new FormControl('', [Validators.required, Validators.pattern('^https?:\\/\\/.*\\.(?:png|jpg|jpeg|gif|bmp|webp)$')]) //FINAL PRODUCT USING API CALL STRUCTURE @@ -219,6 +223,7 @@ export class UpdateProductSpecComponent implements OnInit, OnDestroy { @ViewChild('attachName') attachName!: ElementRef; @ViewChild('imgURL') imgURL!: ElementRef; + @ViewChild('certificationName') certificationName!: ElementRef; public files: NgxFileDropEntry[] = []; @@ -333,7 +338,15 @@ export class UpdateProductSpecComponent implements OnInit, OnDestroy { } - const index = this.availableISOS.findIndex(item => item.name === this.prod.productSpecCharacteristic[i].name); + //const index = this.availableISOS.findIndex(item => item.name === this.prod.productSpecCharacteristic[i].name); + const cleanedName = this.prod.productSpecCharacteristic[i].name + .replace('Compliance:', '') + .trim(); + + const index = this.availableISOS.findIndex( + item => item.name === cleanedName + ); + if (index !== -1) { console.log('adding sel iso') this.selectedISOS.push({ @@ -343,10 +356,16 @@ export class UpdateProductSpecComponent implements OnInit, OnDestroy { domesupported: this.availableISOS[index].domesupported }); this.availableISOS.splice(index, 1); - } - if (this.prod.productSpecCharacteristic[i].name == 'Compliance:SelfAtt') { + } else if (this.prod.productSpecCharacteristic[i].name == 'Compliance:SelfAtt') { this.selfAtt=this.prod.productSpecCharacteristic[i] this.checkExistingSelfAtt=true; + } else if(this.prod.productSpecCharacteristic[i].name.startsWith('Compliance:')){ + console.log('--- additional isos') + console.log(this.prod.productSpecCharacteristic[i]) + this.additionalISOS.push({ + name: this.prod.productSpecCharacteristic[i].name, + url: this.prod.productSpecCharacteristic[i].productSpecCharacteristicValue[0].value + }) } } console.log('selected isos') @@ -567,7 +586,7 @@ export class UpdateProductSpecComponent implements OnInit, OnDestroy { if (index !== -1) { console.log('seleccionar') this.availableISOS.splice(index, 1); - this.selectedISOS.push({name: iso.name, url: '', mandatory: iso.mandatory, domesupported: iso.domesupported}); + this.selectedISOS.push({name: 'Compliance:'+iso.name, url: '', mandatory: iso.mandatory, domesupported: iso.domesupported}); } this.buttonISOClicked=!this.buttonISOClicked; this.cdr.detectChanges(); @@ -576,11 +595,14 @@ export class UpdateProductSpecComponent implements OnInit, OnDestroy { } removeISO(iso:any){ + const cleanedName = iso.name + .replace('Compliance:', '') + .trim(); const index = this.selectedISOS.findIndex(item => item.name === iso.name); if (index !== -1) { console.log('seleccionar') this.selectedISOS.splice(index, 1); - this.availableISOS.push({name: iso.name, mandatory: iso.mandatory, domesupported: iso.domesupported}); + this.availableISOS.push({name: cleanedName, mandatory: iso.mandatory, domesupported: iso.domesupported}); //if (iso.name in this.verifiedISO) { // delete this.verifiedISO[iso.name] @@ -590,6 +612,16 @@ export class UpdateProductSpecComponent implements OnInit, OnDestroy { console.log(this.prodSpecsBundle) } + removeCert(iso:any){ + const index = this.additionalISOS.findIndex(item => item.name === iso.name); + if (index !== -1) { + console.log('eliminar additional cert') + this.additionalISOS.splice(index, 1); + console.log(this.additionalISOS) + } + this.cdr.detectChanges(); + } + removeSelfAtt(){ const index = this.finishChars.findIndex(item => item.name === this.selfAtt.name); if (index !== -1) { @@ -693,16 +725,20 @@ export class UpdateProductSpecComponent implements OnInit, OnDestroy { }, 3000); return; } - if(this.showCompliance && !this.showUploadAtt){ + if(((this.currentStep === 1 && !this.BUNDLE_ENABLED) || (this.currentStep === 2 && this.BUNDLE_ENABLED)) && !this.showUploadAtt){ const index = this.selectedISOS.findIndex(item => item.name === sel.name); this.attachmentService.uploadFile(fileBody).subscribe({ next: data => { console.log(data) - this.selectedISOS[index].url=data.content; - //this.selectedISOS[index].attachmentType=file.type; - this.showUploadFile=false; - this.cdr.detectChanges(); - console.log('uploaded') + if(index!==-1){ + this.selectedISOS[index].url=data.content; + //this.selectedISOS[index].attachmentType=file.type; + this.showUploadFile=false; + this.cdr.detectChanges(); + console.log('uploaded') + } else { + this.isoToCreate=data.content; + } }, error: error => { console.error('There was an error while uploading file!', error); @@ -722,7 +758,7 @@ export class UpdateProductSpecComponent implements OnInit, OnDestroy { } }); } - if(this.showUploadAtt){ + if(((this.currentStep === 1 && !this.BUNDLE_ENABLED) || (this.currentStep === 2 && this.BUNDLE_ENABLED)) && this.showUploadAtt){ const index = this.finishChars.findIndex(item => item.name === this.selfAtt.name); this.attachmentService.uploadFile(fileBody).subscribe({ next: data => { @@ -1096,6 +1132,26 @@ export class UpdateProductSpecComponent implements OnInit, OnDestroy { this.attachToCreate={url:'',attachmentType:''}; } + saveAdditionalCert(){ + console.log('saving') + this.additionalISOS.push({ + name: 'Compliance:'+this.certificationName.nativeElement.value, + url: this.isoToCreate + }) + this.certificationName.nativeElement.value=''; + this.isoToCreate=''; + this.certFileName.reset(); + this.showCert=false; + } + + clearAdditionalCert(urlonly:boolean){ + if(!urlonly){ + this.certificationName.nativeElement.value=''; + this.certFileName.reset(); + } + this.isoToCreate=''; + } + toggleRelationship(){ this.prodSpecRels=[]; this.prodSpecRelPage=0; @@ -1377,6 +1433,7 @@ export class UpdateProductSpecComponent implements OnInit, OnDestroy { } if(this.charsForm.value.name!=null){ + console.log('saving char') this.prodChars.push({ id: 'urn:ngsi-ld:characteristic:'+uuidv4(), name: this.charsForm.value.name, @@ -1405,6 +1462,8 @@ export class UpdateProductSpecComponent implements OnInit, OnDestroy { } } + console.log('--- value of prodChars after saving') + console.log(this.prodChars) this.charsForm.reset(); this.creatingChars=[]; this.showCreateChar=false; @@ -1478,10 +1537,38 @@ export class UpdateProductSpecComponent implements OnInit, OnDestroy { } setProductData(){ + console.log('--- set product data') + console.log(this.prodChars) for(let i=0; i< this.prodChars.length; i++){ const index = this.finishChars.findIndex(item => item.name === this.prodChars[i].name); if (index == -1) { - this.finishChars.push(this.prodChars[i]) + const cleanedName = this.prodChars[i]?.name + ?.replace('Compliance:', '') + .trim(); + + const checkIso = this.availableISOS.findIndex( + item => item.name === cleanedName + ); + if (checkIso == -1) { + if (this.prodChars[i].name != 'Compliance:SelfAtt') { + console.log('--- check if deleted additional cert') + console.log(this.prodChars[i].name) + const checkAdditional = this.additionalISOS.findIndex( + item => item.name === cleanedName + ); + if(checkAdditional != -1){ + this.finishChars.push(this.prodChars[i]) + } + if(!this.prodChars[i].name?.startsWith('Compliance:')){ + this.finishChars.push(this.prodChars[i]) + } + } else { + this.finishChars.push(this.prodChars[i]) + } + } else { + this.finishChars.push(this.prodChars[i]) + } + } } // Load compliance profile @@ -1499,6 +1586,25 @@ export class UpdateProductSpecComponent implements OnInit, OnDestroy { } } + for(let i=0; i item.name === this.additionalISOS[i].name); + if (index == -1) { + this.finishChars.push({ + id: 'urn:ngsi-ld:characteristic:'+uuidv4(), + name: this.additionalISOS[i].name, + productSpecCharacteristicValue: [{ + isDefault: true, + value: this.additionalISOS[i].url + }] + }) + } + console.log(this.finishChars) + } + // Load compliance VCs if(this.complianceVC != null) { this.finishChars.push({ @@ -1690,6 +1796,11 @@ export class UpdateProductSpecComponent implements OnInit, OnDestroy { this.highestStep=this.currentStep } this.refreshChars(); + if((this.currentStep === 1 && !this.BUNDLE_ENABLED) || (this.currentStep === 2 && this.BUNDLE_ENABLED)){ + setTimeout(() => { + initFlowbite(); + }, 100); + } //Resource if((this.currentStep==4 && this.BUNDLE_ENABLED) || (this.currentStep==3 && !this.BUNDLE_ENABLED)){ this.getResSpecs(false); @@ -1733,4 +1844,8 @@ export class UpdateProductSpecComponent implements OnInit, OnDestroy { } } + normalizeName(name?: string): string { + return name?.replace(/compliance:/i, '').trim() ?? ''; + } + } diff --git a/src/app/shared/forms/offer/price-plans/configuration-profile-drawer/configuration-profile-drawer.component.ts b/src/app/shared/forms/offer/price-plans/configuration-profile-drawer/configuration-profile-drawer.component.ts index 1406d325..120cefa5 100644 --- a/src/app/shared/forms/offer/price-plans/configuration-profile-drawer/configuration-profile-drawer.component.ts +++ b/src/app/shared/forms/offer/price-plans/configuration-profile-drawer/configuration-profile-drawer.component.ts @@ -34,7 +34,8 @@ export class ConfigurationProfileDrawerComponent implements OnInit { //const characteristicsData = this.profileData || []; let profileChars = []; for(let i=0;i certification.name === this.profileData[i].name) && this.profileData[i].name != 'Compliance:SelfAtt') { + //if (!certifications.some(certification => certification.name === this.profileData[i].name) && this.profileData[i].name != 'Compliance:SelfAtt') { + if (!certifications.some(certification => certification.name === this.profileData[i].name) && !this.profileData[i].name.startsWith('Compliance:')) { profileChars.push(this.profileData[i]); } } diff --git a/src/app/shared/forms/offer/price-plans/price-component-drawer/price-component-drawer.component.ts b/src/app/shared/forms/offer/price-plans/price-component-drawer/price-component-drawer.component.ts index fb5dc2a0..b4e0b3fa 100644 --- a/src/app/shared/forms/offer/price-plans/price-component-drawer/price-component-drawer.component.ts +++ b/src/app/shared/forms/offer/price-plans/price-component-drawer/price-component-drawer.component.ts @@ -63,7 +63,7 @@ export class PriceComponentDrawerComponent implements OnInit { }, 50); for(let i=0;i certification.name === this.prodChars[i].name) && this.prodChars[i].name != 'Compliance:SelfAtt') { + if (!certifications.some(certification => certification.name === this.prodChars[i].name) && !this.prodChars[i].name.startsWith('Compliance:')) { this.filteredChars.push(this.prodChars[i]); } } diff --git a/src/app/shared/price-plan-drawer/price-plan-drawer.component.ts b/src/app/shared/price-plan-drawer/price-plan-drawer.component.ts index 827e2752..dd56db30 100644 --- a/src/app/shared/price-plan-drawer/price-plan-drawer.component.ts +++ b/src/app/shared/price-plan-drawer/price-plan-drawer.component.ts @@ -215,12 +215,13 @@ export class PricePlanDrawerComponent implements OnInit, OnDestroy { // Filter out certifications, self-att, and disabled prefixes this.filteredCharacteristics = this.characteristics.filter(char => { const isCertification = certifications.some(cert => cert.name === char.name); - const isSelfAtt = char.name === 'Compliance:SelfAtt'; + //const isSelfAtt = char.name === 'Compliance:SelfAtt'; + const isCompliance = char?.name?.startsWith('Compliance:') /*const isDisabledByPrefix = disabledPrefixes.some(prefix => char.name === prefix || char.name === `${prefix} - enabled` );*/ - return !isCertification && !isSelfAtt; + return !isCertification && !isCompliance; }); const characteristicsGroup = this.fb.group({}); diff --git a/src/assets/i18n/en.json b/src/assets/i18n/en.json index a8182c95..ebffad22 100644 --- a/src/assets/i18n/en.json +++ b/src/assets/i18n/en.json @@ -506,7 +506,7 @@ "_select": "Select", "_simple": "Simple", "_load_more": "Load more", - "_add_comp": "Add Compliance profile", + "_add_comp": "3rd party certifications", "_value": "Value", "_actions": "Actions", "_no_chars": "No characteristics included.", @@ -581,7 +581,7 @@ "_select": "Select", "_simple": "Simple", "_load_more": "Load more", - "_add_comp": "Add Compliance profile", + "_add_comp": "3rd party certifications", "_value": "Value", "_actions": "Actions", "_no_chars": "No characteristics included.", @@ -774,7 +774,7 @@ "_select": "Select", "_simple": "Simple", "_load_more": "Load more", - "_add_comp": "Add Compliance profile", + "_add_comp": "3rd party certifications", "_value": "Value", "_actions": "Actions", "_no_chars": "No characteristics included.", @@ -875,7 +875,7 @@ "_select": "Select", "_simple": "Simple", "_load_more": "Load more", - "_add_comp": "Add Compliance profile", + "_add_comp": "3rd party certifications", "_value": "Value", "_actions": "Actions", "_no_chars": "No characteristics included.", diff --git a/src/assets/i18n/es.json b/src/assets/i18n/es.json index a8182c95..ebffad22 100644 --- a/src/assets/i18n/es.json +++ b/src/assets/i18n/es.json @@ -506,7 +506,7 @@ "_select": "Select", "_simple": "Simple", "_load_more": "Load more", - "_add_comp": "Add Compliance profile", + "_add_comp": "3rd party certifications", "_value": "Value", "_actions": "Actions", "_no_chars": "No characteristics included.", @@ -581,7 +581,7 @@ "_select": "Select", "_simple": "Simple", "_load_more": "Load more", - "_add_comp": "Add Compliance profile", + "_add_comp": "3rd party certifications", "_value": "Value", "_actions": "Actions", "_no_chars": "No characteristics included.", @@ -774,7 +774,7 @@ "_select": "Select", "_simple": "Simple", "_load_more": "Load more", - "_add_comp": "Add Compliance profile", + "_add_comp": "3rd party certifications", "_value": "Value", "_actions": "Actions", "_no_chars": "No characteristics included.", @@ -875,7 +875,7 @@ "_select": "Select", "_simple": "Simple", "_load_more": "Load more", - "_add_comp": "Add Compliance profile", + "_add_comp": "3rd party certifications", "_value": "Value", "_actions": "Actions", "_no_chars": "No characteristics included.",