From 0250e3240dda75911e6b401156aa76041c20a6e2 Mon Sep 17 00:00:00 2001 From: SHENGXING LU Date: Wed, 8 Oct 2025 11:09:20 +0200 Subject: [PATCH 01/13] did party char --- .../org-info/org-info.component.html | 5 +++++ .../profile-sections/org-info/org-info.component.ts | 13 +++++++++++-- src/assets/i18n/en.json | 1 + src/assets/i18n/es.json | 1 + 4 files changed, 18 insertions(+), 2 deletions(-) diff --git a/src/app/pages/user-profile/profile-sections/org-info/org-info.component.html b/src/app/pages/user-profile/profile-sections/org-info/org-info.component.html index ba74fa4e..a1dc3334 100644 --- a/src/app/pages/user-profile/profile-sections/org-info/org-info.component.html +++ b/src/app/pages/user-profile/profile-sections/org-info/org-info.component.html @@ -33,6 +33,11 @@

{{ 'PROFILE._did' | translate }} + +
diff --git a/src/app/pages/user-profile/profile-sections/org-info/org-info.component.ts b/src/app/pages/user-profile/profile-sections/org-info/org-info.component.ts index 46bd181b..b2c81349 100644 --- a/src/app/pages/user-profile/profile-sections/org-info/org-info.component.ts +++ b/src/app/pages/user-profile/profile-sections/org-info/org-info.component.ts @@ -36,6 +36,7 @@ export class OrgInfoComponent { website: new FormControl(''), description: new FormControl(''), country: new FormControl(''), + did: new FormControl(''), }); mediumForm = new FormGroup({ email: new FormControl('', [Validators.required, Validators.email, Validators.pattern('^[a-z0-9._%+-]+@[a-z0-9.-]+\\.[a-z]{2,4}$'), Validators.maxLength(320)]), @@ -186,7 +187,13 @@ export class OrgInfoComponent { chars.push({ name: 'country', value: this.profileForm.value.country - }) + }) + } + if(this.profileForm.value.did != ''){ + chars.push({ + name: 'did', + value: this.profileForm.value.did + }) } for(let i=0; i Date: Wed, 8 Oct 2025 18:06:06 +0200 Subject: [PATCH 02/13] product spec creation with 2 more chars --- .../create-product-spec.component.html | 21 ++++- .../create-product-spec.component.ts | 79 ++++++++++++++++--- src/assets/i18n/en.json | 2 + src/assets/i18n/es.json | 2 + 4 files changed, 92 insertions(+), 12 deletions(-) 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 09ba92b0..08385989 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 @@ -545,11 +545,13 @@

{{ 'CREATE_

-
@@ -659,8 +661,21 @@

{{ 'CREATE_ + + +

+ } @else if (credentialsConfigSelected || policyConfigSelected){ +
+ + +
}
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 b7645ebf..85c259da 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 @@ -89,6 +89,8 @@ export class CreateProductSpecComponent implements OnInit { stringCharSelected:boolean=true; numberCharSelected:boolean=false; rangeCharSelected:boolean=false; + credentialsConfigSelected:boolean=false; + policyConfigSelected:boolean=false; prodChars:ProductSpecificationCharacteristic[]=[]; finishChars:ProductSpecificationCharacteristic[]=[]; creatingChars:CharacteristicValueSpecification[]=[]; @@ -169,6 +171,7 @@ export class CreateProductSpecComponent implements OnInit { fromValue: string = ''; toValue: string = ''; rangeUnit: string = ''; + jsonValue: string = ''; filenameRegex = /^[A-Za-z0-9_.-]+$/; @@ -624,6 +627,8 @@ export class CreateProductSpecComponent implements OnInit { this.stringCharSelected=true; this.numberCharSelected=false; this.rangeCharSelected=false; + this.credentialsConfigSelected=false; + this.policyConfigSelected=false; this.showPreview=false; this.refreshChars(); } @@ -928,9 +933,12 @@ export class CreateProductSpecComponent implements OnInit { this.fromValue = ''; this.toValue = ''; this.rangeUnit = ''; + this.jsonValue = ''; this.stringCharSelected=true; this.numberCharSelected=false; this.rangeCharSelected=false; + this.credentialsConfigSelected=false; + this.policyConfigSelected=false; this.creatingChars=[]; } @@ -994,14 +1002,32 @@ export class CreateProductSpecComponent implements OnInit { this.stringCharSelected=true; this.numberCharSelected=false; this.rangeCharSelected=false; + this.credentialsConfigSelected=false; + this.policyConfigSelected=false; }else if (event.target.value=='number'){ this.stringCharSelected=false; this.numberCharSelected=true; this.rangeCharSelected=false; - }else{ + this.credentialsConfigSelected=false; + this.policyConfigSelected=false; + }else if(event.target.value=='range'){ this.stringCharSelected=false; this.numberCharSelected=false; this.rangeCharSelected=true; + this.credentialsConfigSelected=false; + this.policyConfigSelected=false; + }else if(event.target.value=='credentialsConfiguration'){ + this.stringCharSelected=false; + this.numberCharSelected=false; + this.rangeCharSelected=false; + this.credentialsConfigSelected=true; + this.policyConfigSelected=false; + }else if(event.target.value=='authorizationPolicy'){ + this.stringCharSelected=false; + this.numberCharSelected=false; + this.rangeCharSelected=false; + this.credentialsConfigSelected=false; + this.policyConfigSelected=true; } this.creatingChars=[]; } @@ -1020,7 +1046,7 @@ export class CreateProductSpecComponent implements OnInit { value:this.stringValue as any }) } - this.stringValue=''; + this.stringValue=''; } else if (this.numberCharSelected){ console.log('number') if(this.creatingChars.length==0){ @@ -1038,7 +1064,7 @@ export class CreateProductSpecComponent implements OnInit { } this.numberUnit=''; this.numberValue=''; - }else{ + }else if(this.rangeCharSelected){ console.log('range') if(this.creatingChars.length==0){ this.creatingChars.push({ @@ -1053,11 +1079,34 @@ export class CreateProductSpecComponent implements OnInit { valueFrom:this.fromValue as any, valueTo:this.toValue as any, unitOfMeasure:this.rangeUnit}) - } + } + this.fromValue=''; + this.toValue=''; + this.rangeUnit=''; + }else if(this.credentialsConfigSelected || this.policyConfigSelected){ + console.log('json') + try { + const jsonObj = JSON.parse(this.jsonValue); + if(this.creatingChars.length==0){ + this.creatingChars.push({ + isDefault:true, + value:jsonObj as any + }) + } else{ + this.creatingChars.push({ + isDefault:false, + value:jsonObj as any + }) + } + this.jsonValue=''; + } catch (e) { + this.errorMessage='Invalid JSON format'; + this.showError=true; + setTimeout(() => { + this.showError = false; + }, 3000); + } } - this.fromValue=''; - this.toValue=''; - this.rangeUnit=''; } removeCharValue(char:any,idx:any){ @@ -1078,12 +1127,22 @@ export class CreateProductSpecComponent implements OnInit { saveChar(){ if(this.charsForm.value.name!=null){ - this.prodChars.push({ + let characteristic: any = { id: 'urn:ngsi-ld:characteristic:'+uuidv4(), name: this.charsForm.value.name, description: this.charsForm.value.description != null ? this.charsForm.value.description : '', productSpecCharacteristicValue: this.creatingChars - }) + }; + + if(this.credentialsConfigSelected){ + characteristic.valueType = 'credentialsConfiguration'; + characteristic['@schemaLocation'] = 'https://raw.githubusercontent.com/FIWARE/contract-management/refs/heads/main/schemas/credentials/credentialConfigCharacteristic.json'; + } else if(this.policyConfigSelected){ + characteristic.valueType = 'authorizationPolicy'; + characteristic['@schemaLocation'] = 'https://raw.githubusercontent.com/FIWARE/contract-management/refs/heads/policy-support/schemas/odrl/policyCharacteristic.json'; + } + + this.prodChars.push(characteristic); } this.charsForm.reset(); @@ -1092,6 +1151,8 @@ export class CreateProductSpecComponent implements OnInit { this.stringCharSelected=true; this.numberCharSelected=false; this.rangeCharSelected=false; + this.credentialsConfigSelected=false; + this.policyConfigSelected=false; this.refreshChars(); this.cdr.detectChanges(); } diff --git a/src/assets/i18n/en.json b/src/assets/i18n/en.json index 4bd30328..9024f9c2 100644 --- a/src/assets/i18n/en.json +++ b/src/assets/i18n/en.json @@ -514,6 +514,8 @@ "_from": "From", "_to": "To", "_save_char": "Save characteristic", + "_json_value": "JSON Value", + "_add_json": "Add JSON Value", "_resource_specs": "Resource specifications", "_service_specs": "Service specifications", "_add_prod_img": "Add product image", diff --git a/src/assets/i18n/es.json b/src/assets/i18n/es.json index 4bd30328..9024f9c2 100644 --- a/src/assets/i18n/es.json +++ b/src/assets/i18n/es.json @@ -514,6 +514,8 @@ "_from": "From", "_to": "To", "_save_char": "Save characteristic", + "_json_value": "JSON Value", + "_add_json": "Add JSON Value", "_resource_specs": "Resource specifications", "_service_specs": "Service specifications", "_add_prod_img": "Add product image", From 1b52128a6034b8b2cf3f16602ace173850dc49e0 Mon Sep 17 00:00:00 2001 From: SHENGXING LU Date: Wed, 8 Oct 2025 18:06:55 +0200 Subject: [PATCH 03/13] characteristics post and patch --- .../update-product-spec/update-product-spec.component.ts | 5 +++-- .../configuration-profile-drawer.component.ts | 5 ++++- .../price-component-drawer.component.ts | 6 +++++- .../offer/procurement-mode/procurement-mode.component.ts | 4 ---- .../shared/price-plan-drawer/price-plan-drawer.component.ts | 6 +++++- 5 files changed, 17 insertions(+), 9 deletions(-) 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 62ce2e9d..b17e0263 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 @@ -326,6 +326,8 @@ export class UpdateProductSpecComponent implements OnInit { id: 'urn:ngsi-ld:characteristic:'+uuidv4(), name: this.prod.productSpecCharacteristic[i].name, description: this.prod.productSpecCharacteristic[i].description ? this.prod.productSpecCharacteristic[i].description : '', + valueType: this.prod.productSpecCharacteristic[i].valueType, + '@schemaLocation': this.prod.productSpecCharacteristic[i]['@schemaLocation'], productSpecCharacteristicValue: this.prod.productSpecCharacteristic[i].productSpecCharacteristicValue }); } @@ -1361,11 +1363,10 @@ export class UpdateProductSpecComponent implements OnInit { lifecycleStatus: this.prodStatus, //isBundle: this.bundleChecked, //bundledProductSpecification: this.prodSpecsBundle, - productSpecCharacteristic: this.finishChars, productSpecificationRelationship: rels, attachment: this.prodAttachments, resourceSpecification: this.selectedResourceSpecs, - serviceSpecification: this.selectedServiceSpecs + serviceSpecification: this.selectedServiceSpecs } } this.selectStep('summary','summary-circle'); 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..28531eed 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,10 @@ 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' + && this.profileData[i].valueType != 'credentialsConfiguration' + && this.profileData[i].valueType != 'authorizationPolicy') { 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 8c02a48c..b4ff589c 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 @@ -62,7 +62,10 @@ 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 != 'Compliance:SelfAtt' + && this.prodChars[i].valueType != 'credentialsConfiguration' + && this.prodChars[i].valueType != 'authorizationPolicy') { this.filteredChars.push(this.prodChars[i]); } } @@ -185,6 +188,7 @@ export class PriceComponentDrawerComponent implements OnInit { id: this.selectedCharacteristic.id, name: this.selectedCharacteristic.name, description: this.selectedCharacteristic.description || '', + valueType: this.selectedCharacteristic.valueType } // Add the productSpecCharacteristicValue only if needed diff --git a/src/app/shared/forms/offer/procurement-mode/procurement-mode.component.ts b/src/app/shared/forms/offer/procurement-mode/procurement-mode.component.ts index ce9cbfac..1c361ad4 100644 --- a/src/app/shared/forms/offer/procurement-mode/procurement-mode.component.ts +++ b/src/app/shared/forms/offer/procurement-mode/procurement-mode.component.ts @@ -166,10 +166,6 @@ export class ProcurementModeComponent implements ControlValueAccessor, AfterView this.errorMessage = ""; this.showProcurementError = false; this.form.setErrors(null) - } else if (this.gatewayCount == 0){ - this.errorMessage = "You can't select this procurement mode as you are not registered on the payment gateway."; - this.showProcurementError = true; - this.form.setErrors({ invalidProcurement: true }); } const mode = this.procurementModes.find(m => m.id === value.mode) || this.procurementModes[0]; 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 34e753f4..82a781ec 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 @@ -196,7 +196,11 @@ export class PricePlanDrawerComponent implements OnInit, OnDestroy { filterCharacteristics() { this.filteredCharacteristics = []; for(let i = 0; i < this.characteristics.length; i++){ - if (!certifications.some(certification => certification.name === this.characteristics[i].name) && this.characteristics[i].name != 'Compliance:SelfAtt') { + if (!certifications.some(certification => certification.name === this.characteristics[i].name) + && this.characteristics[i].name != 'Compliance:SelfAtt' + && this.characteristics[i].valueType != 'credentialsConfiguration' + && this.characteristics[i].valueType != 'authorizationPolicy' + ) { this.filteredCharacteristics.push(this.characteristics[i]); } } From d57c60a0d5adfc96b17300e6eaed1e48b8d21e05 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lara=20Mi=C3=B1ones?= <49403564+laraminones@users.noreply.github.com> Date: Mon, 3 Nov 2025 17:21:28 +0100 Subject: [PATCH 04/13] ADD boolean chars as checkboxes on price simulator (#134) * ADD boolean chars as checkboxes on price simulator * Disable select when char is disabled --- .../create-product-spec.component.ts | 4 +- .../update-product-spec.component.ts | 4 +- .../characteristic.component.html | 3 +- .../characteristic.component.ts | 2 + .../price-plan-drawer.component.html | 24 +++++++- .../price-plan-drawer.component.ts | 59 +++++++++++++++---- 6 files changed, 77 insertions(+), 19 deletions(-) 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 777c1421..df5c7384 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 @@ -1115,11 +1115,11 @@ export class CreateProductSpecComponent implements OnInit { if(this.booleanCharSelected){ this.creatingChars=[ { - isDefault:true, + isDefault:false, value: true as any }, { - isDefault:false, + isDefault:true, value:false as any } ] 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 0cfb55ad..b99a0232 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 @@ -1329,11 +1329,11 @@ export class UpdateProductSpecComponent implements OnInit { if(this.booleanCharSelected){ this.creatingChars=[ { - isDefault:true, + isDefault:false, value: true as any }, { - isDefault:false, + isDefault:true, value:false as any } ] diff --git a/src/app/shared/characteristic/characteristic.component.html b/src/app/shared/characteristic/characteristic.component.html index cf1f5f00..231ae9d1 100644 --- a/src/app/shared/characteristic/characteristic.component.html +++ b/src/app/shared/characteristic/characteristic.component.html @@ -4,7 +4,7 @@

{{ characteristic.name }}

- + @if(!isDisabled){ @if (isSlider()){
@@ -32,6 +32,7 @@

{{ charact

} + } } @else {
diff --git a/src/app/shared/characteristic/characteristic.component.ts b/src/app/shared/characteristic/characteristic.component.ts index 4f06566d..0ed4214c 100644 --- a/src/app/shared/characteristic/characteristic.component.ts +++ b/src/app/shared/characteristic/characteristic.component.ts @@ -35,6 +35,8 @@ interface Characteristic { export class CharacteristicComponent implements OnInit { @Input() characteristic!: ProductSpecificationCharacteristic; @Input() readOnly: boolean = false; + @Input() isDisabled: boolean = false; + @Input() canBeDisabled: boolean = false; @Output() valueChange = new EventEmitter(); control = new FormControl(); diff --git a/src/app/shared/price-plan-drawer/price-plan-drawer.component.html b/src/app/shared/price-plan-drawer/price-plan-drawer.component.html index 7ef7edb2..f9f22af6 100644 --- a/src/app/shared/price-plan-drawer/price-plan-drawer.component.html +++ b/src/app/shared/price-plan-drawer/price-plan-drawer.component.html @@ -61,15 +61,33 @@
This price plan has an associate profile. That means that the following characteristics are already set for you.

@for (ch of filteredCharacteristics ; track ch.id) { + @if(!ch.name?.endsWith('- enabled')){ + } }
} @else if(filteredCharacteristics.length > 0) {

Please select the characteristics you need to suit this offer to you.

- @for (ch of filteredCharacteristics ; track ch.id) { - @if (!disabledCharacteristics.includes(ch.id)) { - + @for (ch of filteredCharacteristics ; track ch.id; let i = $index) { + @if(!ch.name?.endsWith('- enabled')){ +
+ @if(canBeDisabledChars.includes(ch.id)){ + + } +
+ + +
+
} }
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 f477a399..e41576af 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 @@ -65,6 +65,7 @@ export class PricePlanDrawerComponent implements OnInit, OnDestroy { characteristics: ProductSpecificationCharacteristic[] = []; // Características dinámicas filteredCharacteristics: ProductSpecificationCharacteristic[] = []; disabledCharacteristics: any[] = []; + canBeDisabledChars: any[]=[]; @HostListener('document:keydown.escape', ['$event']) handleEscape(event: KeyboardEvent): void { @@ -231,15 +232,46 @@ export class PricePlanDrawerComponent implements OnInit, OnDestroy { characteristicsGroup.addControl( characteristic.id, - this.fb.control(defaultValue || null, Validators.required) + this.fb.control(defaultValue ?? null, Validators.required) ); + if(!characteristic.name?.endsWith('- enabled') && this.filteredCharacteristics.some((char => char.name === characteristic.name+' - enabled'))){ + this.canBeDisabledChars.push(characteristic.id) + this.disabledCharacteristics.push(characteristic.id) + } } }); this.form.setControl('characteristics', characteristicsGroup); } - - + + onToggleChange(event: Event, charName: any): void { + const inputElement = event.target as HTMLInputElement; + const isChecked = inputElement.checked; + let char = this.filteredCharacteristics.find(char => char.name == charName+' - enabled') + const characteristicsGroup = this.form.get('characteristics') as FormGroup; + if(char && char.id) + characteristicsGroup.get(char.id)?.setValue(isChecked) + + const cleanName = char?.name?.replace(/- enabled$/, '').trim(); + const disabledChar = this.filteredCharacteristics.find( + item => item.name === cleanName + ); + //const isSelected = event.selectedValue === true || event.selectedValue === 'true'; + if (disabledChar) { + if (!isChecked) { + // Add it if it's not already in the array + if (!this.disabledCharacteristics.includes(disabledChar.id)) { + this.disabledCharacteristics.push(disabledChar.id); + } + } else { + // Remove it if it exists + this.disabledCharacteristics = this.disabledCharacteristics.filter( + id => id !== disabledChar.id + ); + } + } + this.calculatePrice(); + } // Handle price plan selection async onPricePlanSelected(pricePlan: any) { @@ -326,7 +358,7 @@ export class PricePlanDrawerComponent implements OnInit, OnDestroy { const characteristicsGroup = this.form.get('characteristics') as FormGroup; characteristicsGroup.get(event.characteristicId)?.setValue(event.selectedValue); - let char = this.filteredCharacteristics.find(item => item.id === event.characteristicId); + /*let char = this.filteredCharacteristics.find(item => item.id === event.characteristicId); if (char?.name?.endsWith('- enabled')) { const cleanName = char.name.replace(/- enabled$/, '').trim(); const disabledChar = this.filteredCharacteristics.find( @@ -348,7 +380,7 @@ export class PricePlanDrawerComponent implements OnInit, OnDestroy { } } } - console.log(char) + console.log(char)*/ this.calculatePrice(); } @@ -407,14 +439,19 @@ export class PricePlanDrawerComponent implements OnInit, OnDestroy { if(value==null && valueType=='number'){ value=0 } - - this.orderChars.push({ - "name": this.filteredCharacteristics[idx].name, - "value": value, - "valueType": valueType, - }) + + if(!this.filteredCharacteristics[idx].name?.endsWith('- enabled')){ + this.orderChars.push({ + "name": this.filteredCharacteristics[idx].name, + "value": value, + "valueType": valueType, + }) + } + } } + console.log('Calculating the price with...') + console.log(this.orderChars) } // Método para calcular el precio usando el servicio From bfc8a096734fdf5d7c044d9b2f7c6428db6ad7ab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lara=20Mi=C3=B1ones?= <49403564+laraminones@users.noreply.github.com> Date: Mon, 3 Nov 2025 17:21:50 +0100 Subject: [PATCH 05/13] FIX QA tickets (#132) * FIX ticket #832666 typo in invalid phone number message * FIX Ticket#831480 relationships and attatchments names dont break * FIX landing page now showing only default catalog's categories * FIX cypress tests * FIX delete default dome blog entries * FIX ticket #832290 now showing price info properly on inventory * FIX ticket #83516 chatbot button * FIX dome blog allowed roles * FIX dome blog admin role check - now user level * ADD dome blog admin restriction at path --- cypress/e2e/catalog.cy.ts | 4 +- cypress/support/constants.ts | 23 ++++++- src/app/app-routing.module.ts | 6 +- src/app/app.component.html | 2 +- src/app/guard/auth.guard.ts | 3 + .../offerings/featured/featured.component.ts | 2 +- .../pages/dome-blog/dome-blog.component.ts | 40 ++---------- .../product-details.component.html | 6 +- .../inventory-products.component.html | 49 ++++++++------- .../inventory-products.component.ts | 63 +++++++++++++------ src/assets/i18n/en.json | 4 +- src/assets/i18n/es.json | 4 +- 12 files changed, 114 insertions(+), 92 deletions(-) diff --git a/cypress/e2e/catalog.cy.ts b/cypress/e2e/catalog.cy.ts index 0e9a5067..4cbe45a0 100644 --- a/cypress/e2e/catalog.cy.ts +++ b/cypress/e2e/catalog.cy.ts @@ -31,7 +31,7 @@ describe('/my-offerings',{ cy.visit('/my-offerings') cy.wait('@catalog') - cy.get('@catalog.all').should('have.length', 2) + cy.get('@catalog.all').should('have.length', 4) cy.getBySel('newCatalog').click() cy.getBySel('catalogName').type(name) cy.getBySel('catalogDsc').type(description) @@ -72,7 +72,7 @@ describe('/my-offerings',{ cy.visit('/my-offerings') cy.wait('@catalog') - cy.get('@catalog.all').should('have.length', 2) + cy.get('@catalog.all').should('have.length', 4) cy.getBySel('newCatalog').click() cy.getBySel('catalogName').type(name) cy.getBySel('catalogDsc').type(description) diff --git a/cypress/support/constants.ts b/cypress/support/constants.ts index a6d78a4c..cc6b1189 100644 --- a/cypress/support/constants.ts +++ b/cypress/support/constants.ts @@ -109,6 +109,21 @@ export const login_token = () => { } } +export const default_catalog = { + "id": "urn:ngsi-ld:catalog:32828e1d-4652-4f4c-b13e-327450ce83c6", + "href": "urn:ngsi-ld:catalog:32828e1d-4652-4f4c-b13e-327450ce83c6", + "lifecycleStatus": "Launched", + "name": "default", + "version": "1.0", + "category": [ + { + "id": "urn:ngsi-ld:category:26435cca-2707-4c89-8f0c-79464573c9e2", + "href": "urn:ngsi-ld:category:26435cca-2707-4c89-8f0c-79464573c9e2", + "name": "dft cat" + } + ] +} + export const catalog_launched = [ { "id": "urn:ngsi-ld:catalog:32828e1d-4652-4f4c-b13e-327450ce83c6", @@ -194,7 +209,9 @@ export const local_items = { cy.intercept( {method:'GET', url: 'http://proxy.docker:8004/stats'}, init_stat).as('stats') //cy.intercept( {method: 'GET', url: 'http://proxy.docker:8004/catalog/productOffering?*'}, product_offering).as('productOffering') cy.intercept( {method: 'GET', url: 'http://proxy.docker:8004/config'}, init_config).as('config') - cy.intercept( {method:'GET', url: 'http://proxy.docker:8004/catalog/category?*'}, category_launched).as('category') + //cy.intercept('GET', '**/catalog/category/urn:ngsi-ld:category:*', category_dft).as('category'); + cy.intercept({method: 'GET', url: 'catalog/catalog/?*'}, default_catalog).as('catalog') + cy.intercept( {method: 'GET', url: 'http://proxy.docker:8004/catalog/category/?*'}, category_dft).as('category') // Verify mocks are called 1 time cy.visit('/', {onBeforeLoad(win) { win.localStorage.setItem('color-theme', 'dark'); @@ -205,6 +222,8 @@ export const local_items = { cy.get('@config.all').should('have.length', 1) //cy.wait('@productOffering') //cy.get('@productOffering.all').should('have.length', 1) + cy.wait('@catalog') + cy.get('@catalog.all').should('have.length', 1) cy.wait('@category') cy.get('@category.all').should('have.length', 1) // Verify header interactive elemements are displayed and work as expected @@ -277,6 +296,8 @@ export const loginAcc = () => { cy.get('@config.all').should('have.length', 2) //cy.wait('@productOffering') //cy.get('@productOffering.all').should('have.length', 2) + cy.wait('@catalog') + cy.get('@catalog.all').should('have.length', 2) cy.wait('@category') cy.get('@category.all').should('have.length', 2) cy.wait('@login_token') diff --git a/src/app/app-routing.module.ts b/src/app/app-routing.module.ts index 10f768a5..d42cd461 100644 --- a/src/app/app-routing.module.ts +++ b/src/app/app-routing.module.ts @@ -102,10 +102,12 @@ const routes: Routes = [ component: BlogEntryDetailComponent }, { path: 'blog-entry', - component: EntryFormComponent + component: EntryFormComponent, + canActivate: [AuthGuard], data: { roles: ['admin'] } }, { path: 'blog-entry/:id', - component: EntryFormComponent + component: EntryFormComponent, + canActivate: [AuthGuard], data: { roles: ['admin'] } }, { path: '**', redirectTo: 'dashboard', pathMatch: 'full' }, ] diff --git a/src/app/app.component.html b/src/app/app.component.html index 24e84480..53d8dfcd 100644 --- a/src/app/app.component.html +++ b/src/app/app.component.html @@ -1,5 +1,5 @@ -
+
@if(providerThemeName=='DOME') { diff --git a/src/app/guard/auth.guard.ts b/src/app/guard/auth.guard.ts index b82fc906..81d246b4 100644 --- a/src/app/guard/auth.guard.ts +++ b/src/app/guard/auth.guard.ts @@ -31,6 +31,9 @@ export class AuthGuard implements CanActivate { for(let i=0;i role.name === 'admin')){ + userRoles.push('admin') + } } } else { this.router.navigate(['/dashboard']); diff --git a/src/app/offerings/featured/featured.component.ts b/src/app/offerings/featured/featured.component.ts index 10005d89..3780a2d0 100644 --- a/src/app/offerings/featured/featured.component.ts +++ b/src/app/offerings/featured/featured.component.ts @@ -23,7 +23,7 @@ export class FeaturedComponent implements OnInit { } ngOnInit(): void { - this.api.getLaunchedCategories().then(data => { + this.api.getDefaultCategories().then(data => { for(let i=0; i < data.length; i++){ if(data[i].isRoot==true){ this.categories.push(data[i]) diff --git a/src/app/pages/dome-blog/dome-blog.component.ts b/src/app/pages/dome-blog/dome-blog.component.ts index 10826baf..cca87431 100644 --- a/src/app/pages/dome-blog/dome-blog.component.ts +++ b/src/app/pages/dome-blog/dome-blog.component.ts @@ -33,36 +33,7 @@ export class DomeBlogComponent implements OnInit { partyId:any=''; checkAdmin:boolean=false; - entries:any[]=[ - { - id: '1', - title: 'First entry', - author: 'Author', - date: '2025-08-08T09:32:44.548Z', - content: 'Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo ligula eget dolor. Aenean massa. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Donec quam felis, ultricies nec, pellentesque eu, pretium quis, sem. Nulla consequat massa quis enim. Donec pede justo, fringilla vel, aliquet nec, vulputate eget, arcu. In enim justo, rhoncus ut, imperdiet a, venenatis vitae, justo. Nullam dictum felis eu pede mollis pretium. Integer tincidunt. Cras dapibus. Vivamus elementum semper nisi. Aenean vulputate eleifend tellus. Aenean leo ligula, porttitor eu, consequat vitae, eleifend ac, enim. Aliquam lorem ante, dapibus in, viverra quis, feugiat a, tellus. Phasellus viverra nulla ut metus varius laoreet. Quisque rutrum. Aenean imperdiet. Etiam ultricies nisi vel augue. Curabitur ullamcorper ultricies nisi. Nam eget dui. Etiam rhoncus. Maecenas tempus, tellus eget condimentum rhoncus, sem quam semper libero, sit amet adipiscing sem neque sed ipsum. Nam quam nunc, blandit vel, luctus pulvinar, hendrerit id, lorem. Maecenas nec odio et ante tincidunt tempus. Donec vitae sapien ut libero venenatis faucibus. Nullam quis ante. Etiam sit amet orci eget eros faucibus tincidunt. Duis leo. Sed fringilla mauris sit amet nibh. Donec sodales sagittis magna. Sed consequat, leo eget bibendum sodales, augue velit cursus nunc, quis gravida magna mi a libero. Fusce vulputate eleifend sapien. Vestibulum purus quam, scelerisque ut, mollis sed, nonummy id, metus. Nullam accumsan lorem in dui. Cras ultricies mi eu turpis hendrerit fringilla. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; In ac dui quis mi consectetuer lacinia. Nam pretium turpis et arcu. Duis arcu tortor, suscipit eget, imperdiet nec, imperdiet iaculis, ipsum. Sed aliquam ultrices mauris. Integer ante arcu, accumsan a, consectetuer eget, posuere ut, mauris. Praesent adipiscing. Phasellus ullamcorper ipsum rutrum nunc. Nunc nonummy metus. Vestibulum volutpat pretium libero. Cras id dui. Aenean ut eros et nisl sagittis vestibulum. Nullam nulla eros, ultricies sit amet, nonummy id, imperdiet feugiat, pede. Sed lectus. Donec mollis hendrerit risus. Phasellus nec sem in justo pellentesque facilisis. Etiam imperdiet imperdiet orci. Nunc nec neque. Phasellus leo dolor, tempus non, auctor et, hendrerit quis, nisi. Curabitur ligula sapien, tincidunt non, euismod vitae, posuere imperdiet, leo. Maecenas malesuada. Praesent congue erat at massa. Sed cursus turpis vitae tortor. Donec posuere vulputate arcu. Phasellus accumsan cursus velit. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Sed aliquam, nisi quis porttitor congue, elit erat euismod orci, ac placerat dolor lectus quis orci. Phasellus consectetuer vestibulum elit. Aenean tellus metus, bibendum sed, posuere ac, mattis non, nunc. Vestibulum fringilla pede sit amet augue. In turpis. Pellentesque posuere. Praesent turpis. Aenean posuere, tortor sed cursus feugiat, nunc augue blandit nunc, eu sollicitudin urna dolor sagittis lacus. Donec elit libero, sodales nec, volutpat a, suscipit non, turpis. Nullam sagittis. Suspendisse pulvinar, augue ac venenatis condimentum, sem libero volutpat nibh, nec pellentesque velit pede quis nunc. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Fusce id purus. Ut varius tincidunt libero. ' - }, - { - id: '2', - title: 'Second entry', - author: 'Author', - date: '2025-09-08T09:32:44.548Z', - content: 'Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo ligula eget dolor. Aenean massa. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Donec quam felis, ultricies nec, pellentesque eu, pretium quis, sem. Nulla consequat massa quis enim. Donec pede justo, fringilla vel, aliquet nec, vulputate eget, arcu. In enim justo, rhoncus ut, imperdiet a, venenatis vitae, justo. Nullam dictum felis eu pede mollis pretium. Integer tincidunt. Cras dapibus. Vivamus elementum semper nisi. Aenean vulputate eleifend tellus. Aenean leo ligula, porttitor eu, consequat vitae, eleifend ac, enim. Aliquam lorem ante, dapibus in, viverra quis, feugiat a, tellus. Phasellus viverra nulla ut metus varius laoreet. Quisque rutrum. Aenean imperdiet. Etiam ultricies nisi vel augue. Curabitur ullamcorper ultricies nisi. Nam eget dui. Etiam rhoncus. Maecenas tempus, tellus eget condimentum rhoncus, sem quam semper libero, sit amet adipiscing sem neque sed ipsum. Nam quam nunc, blandit vel, luctus pulvinar, hendrerit id, lorem. Maecenas nec odio et ante tincidunt tempus. Donec vitae sapien ut libero venenatis faucibus. Nullam quis ante. Etiam sit amet orci eget eros faucibus tincidunt. Duis leo. Sed fringilla mauris sit amet nibh. Donec sodales sagittis magna. Sed consequat, leo eget bibendum sodales, augue velit cursus nunc, quis gravida magna mi a libero. Fusce vulputate eleifend sapien. Vestibulum purus quam, scelerisque ut, mollis sed, nonummy id, metus. Nullam accumsan lorem in dui. Cras ultricies mi eu turpis hendrerit fringilla. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; In ac dui quis mi consectetuer lacinia. Nam pretium turpis et arcu. Duis arcu tortor, suscipit eget, imperdiet nec, imperdiet iaculis, ipsum. Sed aliquam ultrices mauris. Integer ante arcu, accumsan a, consectetuer eget, posuere ut, mauris. Praesent adipiscing. Phasellus ullamcorper ipsum rutrum nunc. Nunc nonummy metus. Vestibulum volutpat pretium libero. Cras id dui. Aenean ut eros et nisl sagittis vestibulum. Nullam nulla eros, ultricies sit amet, nonummy id, imperdiet feugiat, pede. Sed lectus. Donec mollis hendrerit risus. Phasellus nec sem in justo pellentesque facilisis. Etiam imperdiet imperdiet orci. Nunc nec neque. Phasellus leo dolor, tempus non, auctor et, hendrerit quis, nisi. Curabitur ligula sapien, tincidunt non, euismod vitae, posuere imperdiet, leo. Maecenas malesuada. Praesent congue erat at massa. Sed cursus turpis vitae tortor. Donec posuere vulputate arcu. Phasellus accumsan cursus velit. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Sed aliquam, nisi quis porttitor congue, elit erat euismod orci, ac placerat dolor lectus quis orci. Phasellus consectetuer vestibulum elit. Aenean tellus metus, bibendum sed, posuere ac, mattis non, nunc. Vestibulum fringilla pede sit amet augue. In turpis. Pellentesque posuere. Praesent turpis. Aenean posuere, tortor sed cursus feugiat, nunc augue blandit nunc, eu sollicitudin urna dolor sagittis lacus. Donec elit libero, sodales nec, volutpat a, suscipit non, turpis. Nullam sagittis. Suspendisse pulvinar, augue ac venenatis condimentum, sem libero volutpat nibh, nec pellentesque velit pede quis nunc. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Fusce id purus. Ut varius tincidunt libero. ' - }, - { - id: '3', - title: 'Third entry', - author: 'Author', - date: '2025-03-08T11:32:44.548Z', - content: 'Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo ligula eget dolor. Aenean massa. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Donec quam felis, ultricies nec, pellentesque eu, pretium quis, sem. Nulla consequat massa quis enim. Donec pede justo, fringilla vel, aliquet nec, vulputate eget, arcu. In enim justo, rhoncus ut, imperdiet a, venenatis vitae, justo. Nullam dictum felis eu pede mollis pretium. Integer tincidunt. Cras dapibus. Vivamus elementum semper nisi. Aenean vulputate eleifend tellus. Aenean leo ligula, porttitor eu, consequat vitae, eleifend ac, enim. Aliquam lorem ante, dapibus in, viverra quis, feugiat a, tellus. Phasellus viverra nulla ut metus varius laoreet. Quisque rutrum. Aenean imperdiet. Etiam ultricies nisi vel augue. Curabitur ullamcorper ultricies nisi. Nam eget dui. Etiam rhoncus. Maecenas tempus, tellus eget condimentum rhoncus, sem quam semper libero, sit amet adipiscing sem neque sed ipsum. Nam quam nunc, blandit vel, luctus pulvinar, hendrerit id, lorem. Maecenas nec odio et ante tincidunt tempus. Donec vitae sapien ut libero venenatis faucibus. Nullam quis ante. Etiam sit amet orci eget eros faucibus tincidunt. Duis leo. Sed fringilla mauris sit amet nibh. Donec sodales sagittis magna. Sed consequat, leo eget bibendum sodales, augue velit cursus nunc, quis gravida magna mi a libero. Fusce vulputate eleifend sapien. Vestibulum purus quam, scelerisque ut, mollis sed, nonummy id, metus. Nullam accumsan lorem in dui. Cras ultricies mi eu turpis hendrerit fringilla. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; In ac dui quis mi consectetuer lacinia. Nam pretium turpis et arcu. Duis arcu tortor, suscipit eget, imperdiet nec, imperdiet iaculis, ipsum. Sed aliquam ultrices mauris. Integer ante arcu, accumsan a, consectetuer eget, posuere ut, mauris. Praesent adipiscing. Phasellus ullamcorper ipsum rutrum nunc. Nunc nonummy metus. Vestibulum volutpat pretium libero. Cras id dui. Aenean ut eros et nisl sagittis vestibulum. Nullam nulla eros, ultricies sit amet, nonummy id, imperdiet feugiat, pede. Sed lectus. Donec mollis hendrerit risus. Phasellus nec sem in justo pellentesque facilisis. Etiam imperdiet imperdiet orci. Nunc nec neque. Phasellus leo dolor, tempus non, auctor et, hendrerit quis, nisi. Curabitur ligula sapien, tincidunt non, euismod vitae, posuere imperdiet, leo. Maecenas malesuada. Praesent congue erat at massa. Sed cursus turpis vitae tortor. Donec posuere vulputate arcu. Phasellus accumsan cursus velit. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Sed aliquam, nisi quis porttitor congue, elit erat euismod orci, ac placerat dolor lectus quis orci. Phasellus consectetuer vestibulum elit. Aenean tellus metus, bibendum sed, posuere ac, mattis non, nunc. Vestibulum fringilla pede sit amet augue. In turpis. Pellentesque posuere. Praesent turpis. Aenean posuere, tortor sed cursus feugiat, nunc augue blandit nunc, eu sollicitudin urna dolor sagittis lacus. Donec elit libero, sodales nec, volutpat a, suscipit non, turpis. Nullam sagittis. Suspendisse pulvinar, augue ac venenatis condimentum, sem libero volutpat nibh, nec pellentesque velit pede quis nunc. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Fusce id purus. Ut varius tincidunt libero. ' - }, - { - id: '4', - title: 'Fourth entry', - author: 'Author', - date: '2025-03-08T11:32:44.548Z', - content: 'Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo ligula eget dolor. Aenean massa. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Donec quam felis, ultricies nec, pellentesque eu, pretium quis, sem. Nulla consequat massa quis enim. Donec pede justo, fringilla vel, aliquet nec, vulputate eget, arcu. In enim justo, rhoncus ut, imperdiet a, venenatis vitae, justo. Nullam dictum felis eu pede mollis pretium. Integer tincidunt. Cras dapibus. Vivamus elementum semper nisi. Aenean vulputate eleifend tellus. Aenean leo ligula, porttitor eu, consequat vitae, eleifend ac, enim. Aliquam lorem ante, dapibus in, viverra quis, feugiat a, tellus. Phasellus viverra nulla ut metus varius laoreet. Quisque rutrum. Aenean imperdiet. Etiam ultricies nisi vel augue. Curabitur ullamcorper ultricies nisi. Nam eget dui. Etiam rhoncus. Maecenas tempus, tellus eget condimentum rhoncus, sem quam semper libero, sit amet adipiscing sem neque sed ipsum. Nam quam nunc, blandit vel, luctus pulvinar, hendrerit id, lorem. Maecenas nec odio et ante tincidunt tempus. Donec vitae sapien ut libero venenatis faucibus. Nullam quis ante. Etiam sit amet orci eget eros faucibus tincidunt. Duis leo. Sed fringilla mauris sit amet nibh. Donec sodales sagittis magna. Sed consequat, leo eget bibendum sodales, augue velit cursus nunc, quis gravida magna mi a libero. Fusce vulputate eleifend sapien. Vestibulum purus quam, scelerisque ut, mollis sed, nonummy id, metus. Nullam accumsan lorem in dui. Cras ultricies mi eu turpis hendrerit fringilla. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; In ac dui quis mi consectetuer lacinia. Nam pretium turpis et arcu. Duis arcu tortor, suscipit eget, imperdiet nec, imperdiet iaculis, ipsum. Sed aliquam ultrices mauris. Integer ante arcu, accumsan a, consectetuer eget, posuere ut, mauris. Praesent adipiscing. Phasellus ullamcorper ipsum rutrum nunc. Nunc nonummy metus. Vestibulum volutpat pretium libero. Cras id dui. Aenean ut eros et nisl sagittis vestibulum. Nullam nulla eros, ultricies sit amet, nonummy id, imperdiet feugiat, pede. Sed lectus. Donec mollis hendrerit risus. Phasellus nec sem in justo pellentesque facilisis. Etiam imperdiet imperdiet orci. Nunc nec neque. Phasellus leo dolor, tempus non, auctor et, hendrerit quis, nisi. Curabitur ligula sapien, tincidunt non, euismod vitae, posuere imperdiet, leo. Maecenas malesuada. Praesent congue erat at massa. Sed cursus turpis vitae tortor. Donec posuere vulputate arcu. Phasellus accumsan cursus velit. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Sed aliquam, nisi quis porttitor congue, elit erat euismod orci, ac placerat dolor lectus quis orci. Phasellus consectetuer vestibulum elit. Aenean tellus metus, bibendum sed, posuere ac, mattis non, nunc. Vestibulum fringilla pede sit amet augue. In turpis. Pellentesque posuere. Praesent turpis. Aenean posuere, tortor sed cursus feugiat, nunc augue blandit nunc, eu sollicitudin urna dolor sagittis lacus. Donec elit libero, sodales nec, volutpat a, suscipit non, turpis. Nullam sagittis. Suspendisse pulvinar, augue ac venenatis condimentum, sem libero volutpat nibh, nec pellentesque velit pede quis nunc. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Fusce id purus. Ut varius tincidunt libero. ' - } - ] + entries:any[]=[ ] async ngOnInit(): Promise { this.initPartyInfo(); @@ -77,16 +48,13 @@ export class DomeBlogComponent implements OnInit { console.log(aux) if(aux.logged_as==aux.id){ this.partyId = aux.partyId; - this.checkAdmin=aux.roles.some(role => - role.name === 'admin' - ); } else { let loggedOrg = aux.organizations.find((element: { id: any; }) => element.id == aux.logged_as) this.partyId = loggedOrg.partyId; - this.checkAdmin=loggedOrg.roles.some((role: { name: string; }) => - role.name === 'admin' || role.name === 'orgAdmin' - ); } + this.checkAdmin=aux.roles.some(role => + role.name === 'admin' + ); } } diff --git a/src/app/pages/product-details/product-details.component.html b/src/app/pages/product-details/product-details.component.html index 79267c05..d49df8b1 100644 --- a/src/app/pages/product-details/product-details.component.html +++ b/src/app/pages/product-details/product-details.component.html @@ -424,7 +424,7 @@

-

{{att.name}}

+

{{att.name}}

@@ -501,7 +501,7 @@

-

{{rel.name}}

+

{{rel.name}}

{{rel.relationshipType}}

@if(rel.relationshipType == 'dependency'){ diff --git a/src/app/pages/product-inventory/inventory-items/inventory-products/inventory-products.component.html b/src/app/pages/product-inventory/inventory-items/inventory-products/inventory-products.component.html index 218d6f8b..c8be9d10 100644 --- a/src/app/pages/product-inventory/inventory-items/inventory-products/inventory-products.component.html +++ b/src/app/pages/product-inventory/inventory-items/inventory-products/inventory-products.component.html @@ -258,22 +258,22 @@

{{ 'PRODUCT_INVENTORY._pricing' | translate }}

- @if(selectedProduct?.productPrice != undefined){ + @if(productOff?.productOfferingPrice != undefined){ @if(checkCustom){ -
- @for (price of selectedProduct?.productPrice; track price.id) { +
+ @for (price of productOff?.productOfferingPrice; track price.id) { @if (price.priceType == 'custom') {
-

{{price.name}}

+

{{price.name}}

} } - @if(selectedProduct?.productPrice?.length==0){ + @if(productOff?.productOfferingPrice?.length==0){
-
+
{{ 'SHOPPING_CART._free' | translate }}
@@ -281,45 +281,46 @@
- @for (price of selectedProduct?.productPrice; track price) { +
+ @for (price of productOff?.productOfferingPrice; track price.id) { @if (price.priceType == 'recurring') { -
+
-
{{price.name}}
+
{{price.name}}
+
+
+
-

{{price.price?.taxIncludedAmount?.value}} {{price.price?.taxIncludedAmount?.unit}}

-

/{{price.recurringChargePeriodType}}

-

{{price?.description}}

} @else if (price.priceType == 'usage') { -
+
{{price.name}}
-

{{price.price?.taxIncludedAmount?.value}} {{price.price?.taxIncludedAmount?.unit}}

-

/{{price.unitOfMeasure}}

-

{{price?.description}}

+
+ +
} @else { -
+
{{price.name}}
-

{{price.price?.taxIncludedAmount?.value}} {{price.price?.taxIncludedAmount?.unit}}

-

{{price?.description}}

+
+ +
} } - @if(selectedProduct?.productPrice?.length==0){ -
+ @if(productOff?.productOfferingPrice?.length==0){ +
{{ 'SHOPPING_CART._free' | translate }}

{{ 'SHOPPING_CART._free_desc' | translate }}

-
+
}
} diff --git a/src/app/pages/product-inventory/inventory-items/inventory-products/inventory-products.component.ts b/src/app/pages/product-inventory/inventory-items/inventory-products/inventory-products.component.ts index 5331ebcd..bbe5f6a8 100644 --- a/src/app/pages/product-inventory/inventory-items/inventory-products/inventory-products.component.ts +++ b/src/app/pages/product-inventory/inventory-items/inventory-products/inventory-products.component.ts @@ -52,6 +52,7 @@ export class InventoryProductsComponent implements OnInit { selectedInv:any; selectedResources:any[]=[]; selectedServices:any[]=[]; + productOff:any; errorMessage:any=''; showError:boolean=false; @@ -231,37 +232,63 @@ export class InventoryProductsComponent implements OnInit { console.log(id) } - selectProduct(prod:any){ + async selectProduct(prod:any){ this.selectedProduct=prod; console.log('selecting prod') console.log(this.selectedProduct) this.selectedResources=[]; this.selectedServices=[]; - for(let i=0; i { - if(spec.serviceSpecification != undefined){ - for(let j=0; j < spec.serviceSpecification.length; j++){ - this.api.getServiceSpec(spec.serviceSpecification[j].id).then(serv => { - this.selectedServices.push(serv); - console.log(serv) - }) - } + let spec = await this.api.getProductSpecification(this.selectedProduct.product.productSpecification.id) + if(spec.serviceSpecification != undefined){ + for(let j=0; j < spec.serviceSpecification.length; j++){ + let serv = await this.api.getServiceSpec(spec.serviceSpecification[j].id); + this.selectedServices.push(serv); } - if(spec.resourceSpecification != undefined){ - for(let j=0; j < spec.resourceSpecification.length; j++){ - this.api.getResourceSpec(spec.resourceSpecification[j].id).then(res => { - this.selectedResources.push(res); - console.log(res) - }) + } + if(spec.resourceSpecification != undefined){ + for(let j=0; j < spec.resourceSpecification.length; j++){ + let res = await this.api.getResourceSpec(spec.resourceSpecification[j].id); + this.selectedResources.push(res); + } + } + console.log('--- spec') + console.log(spec) + + let prodOff = await this.api.getProductById(this.selectedProduct.productOffering.id); + let prodPrices: any[] | undefined= prodOff.productOfferingPrice; + let prices: any[]=[]; + if(prodPrices!== undefined){ + for(let j=0; j < prodPrices.length; j++){ + let price = await this.api.getProductPrice(prodPrices[j].id); + prices.push(price); + console.log(price) + if(price.priceType == 'custom'){ + this.checkCustom = true; } } - }) + } + + this.productOff={ + id: prodOff.id, + name: prodOff.name, + category: prodOff.category, + description: prodOff.description, + lastUpdate: prodOff.lastUpdate, + attachment: spec.attachment, + productOfferingPrice: prices, + productSpecification: prodOff.productSpecification, + productOfferingTerm: prodOff.productOfferingTerm, + serviceLevelAgreement: prodOff.serviceLevelAgreement, + version: prodOff.version + } this.showDetails=true; console.log(this.selectedProduct) diff --git a/src/assets/i18n/en.json b/src/assets/i18n/en.json index acf6e7ff..9d6b1434 100644 --- a/src/assets/i18n/en.json +++ b/src/assets/i18n/en.json @@ -309,7 +309,7 @@ "_delete": "Yes, delete", "_confirm_delete": "Are you sure about deleting the following billing address?", "_cancel": "No, cancel", - "_invalid_phone": "Phonenumber is invalid!", + "_invalid_phone": "Phone number is invalid!", "_invalid_email": "Email is invalid!", "_save": "Save", "_success": "Updated successfully", @@ -395,7 +395,7 @@ "_delete": "Yes, delete", "_confirm_delete": "Are you sure about deleting the following billing address?", "_cancel": "No, cancel", - "_invalid_phone": "Phonenumber is invalid!", + "_invalid_phone": "Phone number is invalid!", "_invalid_email": "Email is invalid!", "_no_billing": "There's no billing information.", "_close_modal": "Close modal", diff --git a/src/assets/i18n/es.json b/src/assets/i18n/es.json index acf6e7ff..9d6b1434 100644 --- a/src/assets/i18n/es.json +++ b/src/assets/i18n/es.json @@ -309,7 +309,7 @@ "_delete": "Yes, delete", "_confirm_delete": "Are you sure about deleting the following billing address?", "_cancel": "No, cancel", - "_invalid_phone": "Phonenumber is invalid!", + "_invalid_phone": "Phone number is invalid!", "_invalid_email": "Email is invalid!", "_save": "Save", "_success": "Updated successfully", @@ -395,7 +395,7 @@ "_delete": "Yes, delete", "_confirm_delete": "Are you sure about deleting the following billing address?", "_cancel": "No, cancel", - "_invalid_phone": "Phonenumber is invalid!", + "_invalid_phone": "Phone number is invalid!", "_invalid_email": "Email is invalid!", "_no_billing": "There's no billing information.", "_close_modal": "Close modal", From b3598fe0d6d7d471fe42029044527f10762bf4fd Mon Sep 17 00:00:00 2001 From: sluFicodes <126780134+sluFicodes@users.noreply.github.com> Date: Mon, 3 Nov 2025 17:22:04 +0100 Subject: [PATCH 06/13] testing deployment (#135) Co-authored-by: SHENGXING LU --- src/app/offerings/featured/featured.component.html | 2 +- src/app/pages/dashboard/dashboard.component.html | 2 +- .../inventory-products/inventory-products.component.html | 2 +- src/app/pages/product-orders/product-orders.component.html | 2 +- .../sections/invoices-info/invoices-info.component.html | 4 ++-- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/app/offerings/featured/featured.component.html b/src/app/offerings/featured/featured.component.html index 1f270a02..109d7cfd 100644 --- a/src/app/offerings/featured/featured.component.html +++ b/src/app/offerings/featured/featured.component.html @@ -16,7 +16,7 @@
- - diff --git a/src/app/pages/product-orders/sections/invoices-info/invoices-info.component.html b/src/app/pages/product-orders/sections/invoices-info/invoices-info.component.html index ea711f9f..cded41ab 100644 --- a/src/app/pages/product-orders/sections/invoices-info/invoices-info.component.html +++ b/src/app/pages/product-orders/sections/invoices-info/invoices-info.component.html @@ -59,7 +59,7 @@ @for (invoice of invoices; track invoice.id; let idx = $index) { - + {{invoice?.billDate | date:'EEEE, dd/MM/yy, HH:mm'}} @@ -136,7 +136,7 @@ @if (showInvoiceDetails){