Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
372772b
Use configuration for role names
fdelavega Oct 29, 2025
35903ae
Merge main
fdelavega Nov 4, 2025
530b2e0
Replace Owner by seller role
fdelavega Nov 4, 2025
bd1e90c
Configure certifier role
fdelavega Nov 4, 2025
44c1b3c
Merge main
fdelavega Nov 6, 2025
8ce842d
Fix issues with routes and role config
fdelavega Nov 12, 2025
488cb34
Merge branch 'main' into feat/related-party
fdelavega Nov 13, 2025
0930ff0
Use ID when quering offers by related party
fdelavega Nov 17, 2025
af5c89c
Merge branch 'main' into feat/related-party
fdelavega Nov 17, 2025
44cbfd1
Merge branch 'main' into feat/related-party
fdelavega Nov 24, 2025
3073031
Fix bug with wrong organization ID in the shopping cart
fdelavega Nov 24, 2025
76e619a
Fix bug reading the party when adding to the cart
fdelavega Nov 24, 2025
bb3e214
Merge branch 'main' into feat/related-party
fdelavega Dec 3, 2025
26b6814
Remove unused env import
fdelavega Dec 3, 2025
b1d2a78
Add link to the Profile section for accessing the payment system
fdelavega Dec 3, 2025
0175e78
ADD adhoc offer's form first approach (#150)
laraminones Dec 4, 2025
200ae66
Merge main
fdelavega Dec 10, 2025
c26de41
Merge main
fdelavega Dec 11, 2025
6bd8099
Add button for downloading invoices
fdelavega Dec 11, 2025
ee1e29c
Allow to update the billNo in the CustomerBill
fdelavega Dec 11, 2025
c9a7c41
Merge main
fdelavega Dec 12, 2025
fb5edf8
Remove hardcoding in orgAdmin roles
fdelavega Dec 12, 2025
6da1530
Merge branch 'main' into feat/related-party
fdelavega Dec 16, 2025
b5bc19a
Merge main
fdelavega Dec 19, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions cypress/e2e/catalog.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ describe('/my-offerings',{
const status = 'Active'
const newCatalog = { id: 'test', href: 'test',name: name, description: description, lifecycleStatus: status, relatedParty: {
id: local_items.partyId,
role: 'Owner',
role: 'Seller',
'@referredType': ''
}}
let calls = 0
Expand Down Expand Up @@ -52,12 +52,12 @@ describe('/my-offerings',{
const status = 'Active'
const newCatalog = { id: 'test', href: 'test',name: name, description: description, lifecycleStatus: status, relatedParty: {
id: local_items.partyId,
role: 'Owner',
role: 'Seller',
'@referredType': ''
}}
const getCatalog = { id: 'test', href: 'test',name: check, description: description, lifecycleStatus: status, relatedParty: {
id: local_items.partyId,
role: 'Owner',
role: 'Seller',
'@referredType': ''
}}
let calls = 0
Expand Down
10 changes: 5 additions & 5 deletions cypress/e2e/offering.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ describe('/my-offerings',{

const newCatalog = { id: 'test', href: 'test',name: 'catalogTest', description: '', lifecycleStatus: 'Launched', relatedParty: [{
id: local_items.partyId,
role: 'Owner',
role: 'Seller',
'@referredType': ''
}]}

Expand Down Expand Up @@ -75,7 +75,7 @@ describe('/my-offerings',{

const newCatalog = { id: 'catalogId', href: 'catalogId',name: 'catalogTest', description: '', lifecycleStatus: 'Launched', relatedParty: [{
id: local_items.partyId,
role: 'Owner',
role: 'Seller',
'@referredType': ''
}]}

Expand Down Expand Up @@ -154,7 +154,7 @@ describe('/my-offerings',{

const newCatalog = { id: 'catalogId', href: 'catalogId',name: 'catalogTest', description: '', lifecycleStatus: 'Launched', relatedParty: [{
id: local_items.partyId,
role: 'Owner',
role: 'Seller',
'@referredType': ''
}]}

Expand All @@ -168,7 +168,7 @@ describe('/my-offerings',{
{
"id": "mock:organization",
"href": "mock:organization",
"role": "owner",
"role": "Seller",
"@referredType": null
}
],
Expand Down Expand Up @@ -262,7 +262,7 @@ describe('/my-offerings',{

const newCatalog = { id: 'catalogId', href: 'catalogId',name: 'catalogTest', description: '', lifecycleStatus: 'Launched', relatedParty: [{
id: local_items.partyId,
role: 'Owner',
role: 'Seller',
'@referredType': ''
}]}

Expand Down
6 changes: 3 additions & 3 deletions cypress/support/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ export const catalog_launched = [
{
"id": "urn:ngsi-ld:individual:b73dd8ce-b63f-4c5b-be07-ca7ea10ad78e",
"href": "urn:ngsi-ld:individual:b73dd8ce-b63f-4c5b-be07-ca7ea10ad78e",
"role": "Owner",
"role": "Seller",
"@referredType": ""
}
],
Expand Down Expand Up @@ -313,7 +313,7 @@ export const productOffering = {
{
id: "urn:ngsi-ld:individual:56c77de4-f136-4167-95f0-92a36983ee0f",
href: "urn:ngsi-ld:individual:56c77de4-f136-4167-95f0-92a36983ee0f",
role: "Owner",
role: "Seller",
"@referredType": ""
}
]
Expand All @@ -331,7 +331,7 @@ export const productSpec = {
{
id: "urn:ngsi-ld:individual:56c77de4-f136-4167-95f0-92a36983ee0f",
href: "urn:ngsi-ld:individual:56c77de4-f136-4167-95f0-92a36983ee0f",
role: "Owner",
role: "Seller",
"@referredType": ""
}
],
Expand Down
2 changes: 1 addition & 1 deletion src/app/app-routing.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import { UsageSpecsComponent } from "src/app/pages/usage-specs/usage-specs.compo
import { DomeBlogComponent } from "src/app/pages/dome-blog/dome-blog.component"
import { BlogEntryDetailComponent } from "src/app/pages/dome-blog/blog-entry-detail/blog-entry-detail.component"
import { EntryFormComponent } from "src/app/pages/dome-blog/entry-form/entry-form.component"
import { environment } from '../environments/environment';



const routes: Routes = [
Expand Down
2 changes: 2 additions & 0 deletions src/app/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ import { MultipleSelectComponent } from './shared/multiple-select/multiple-selec
import {CharacteristicComponent} from "./shared/characteristic/characteristic.component";
import {PricePlanDrawerComponent} from "./shared/price-plan-drawer/price-plan-drawer.component";
import {OfferComponent} from "./shared/forms/offer/offer.component";
import {CustomOfferComponent} from "./shared/forms/offer/custom-offer/custom-offer.component"
import { ThemeService } from './services/theme.service';
import { ThemeAwareTranslateLoader } from './services/theme-aware-translate.loader';
import { RevenueReportComponent } from './shared/revenue-report/revenue-report.component'
Expand Down Expand Up @@ -196,6 +197,7 @@ import { OperatorRevenueSharingComponent } from "src/app/pages/admin/operator-re
PricePlanDrawerComponent,
RevenueReportComponent,
OfferComponent,
CustomOfferComponent,
AboutDomeComponent,
MarkdownTextareaComponent,
ProviderRevenueSharingComponent,
Expand Down
6 changes: 3 additions & 3 deletions src/app/chatbot-widget/chatbot-widget.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,14 +62,14 @@ export class ChatbotWidgetComponent {

// Build the message depending on the user role
let name = "guest"
let role = "Customer" // FIXME: Default role must be guest when supported
let role = environment.BUYER_ROLE; // FIXME: Default role must be guest when supported

const userInfo = this.localStorage.getObject('login_items') as LoginInfo;

// The user is logged in
if (userInfo.id) {
let roles = []
role = "Customer"
role = environment.BUYER_ROLE;
name = userInfo.username

if (userInfo.logged_as !== userInfo.id) {
Expand All @@ -83,7 +83,7 @@ export class ChatbotWidgetComponent {
})
}

if (roles.includes("seller")) {
if (roles.includes(environment.SELLER_ROLE)) {
role = "Provider"
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/app/features/quotes/services/quote.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -172,9 +172,9 @@ export class QuoteService {
getQuotesByUserAndRole(userId: string, role: 'customer' | 'seller'): Observable<Quote[]> {
let params = new HttpParams();
// API expects 'Customer' or 'Seller' (capitalized)
const apiRole = role === 'customer' ? 'Customer' : 'Seller';
const apiRole = role === 'customer' ? environment.BUYER_ROLE : environment.SELLER_ROLE;
params = params.set('role', apiRole);

const encodedUserId = encodeURIComponent(userId);
console.log('Getting quotes by user with URL:', `${this.apiUrl}/quoteByUser/${encodedUserId}`);
return this.http.get<Quote[]>(`${this.apiUrl}/quoteByUser/${encodedUserId}`, { params, ...this.httpOptions });
Expand Down
29 changes: 19 additions & 10 deletions src/app/guard/auth.guard.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import {LocalStorageService} from "../services/local-storage.service";
import { Observable } from 'rxjs';
import { LoginInfo } from '../models/interfaces';
import * as moment from 'moment';
import { environment } from 'src/environments/environment';

@Injectable({
providedIn: 'root',
Expand All @@ -18,21 +19,27 @@ export class AuthGuard implements CanActivate {
): Observable<boolean> | Promise<boolean> | boolean {
let aux = this.localStorage.getObject('login_items') as LoginInfo;
const requiredRoles = route.data['roles'] as Array<string>;
let userRoles: string | any[] = [];
let userRoles: string[] = [];

const roleMapper:any = {
'admin': environment.ADMIN_ROLE.toLowerCase(),
'seller': environment.SELLER_ROLE.toLowerCase(),
'buyer': environment.BUYER_ROLE.toLowerCase(),
'orgAdmin': environment.ORG_ADMIN_ROLE.toLowerCase(),
'certifier': environment.CERTIFIER_ROLE.toLowerCase(),
'individual': 'individual'
}

if(JSON.stringify(aux) != '{}' && (((aux.expire - moment().unix())-4) > 0)) {
if(aux.logged_as == aux.id){
userRoles.push('individual')
for(let i=0; i < aux.roles.length; i++){
userRoles.push(aux.roles[i].name)
}
aux.roles.forEach((role: any) => userRoles.push(role.name.toLowerCase()))
} else {
let loggedOrg = aux.organizations.find((element: { id: any; }) => element.id == aux.logged_as)
for(let i=0;i<loggedOrg.roles.length;i++){
userRoles.push(loggedOrg.roles[i].name)
}
if(aux.roles.some(role => role.name === 'admin')){
userRoles.push('admin')
loggedOrg.roles.forEach((role: any) => userRoles.push(role.name.toLowerCase()))

if(aux.roles.some(role => role.name.toLowerCase() === environment.ADMIN_ROLE.toLowerCase())){
userRoles.push(environment.ADMIN_ROLE.toLowerCase())
}
}
} else {
Expand All @@ -41,7 +48,9 @@ export class AuthGuard implements CanActivate {
}

if (requiredRoles.length != 0) {
const hasRequiredRoles = requiredRoles.some(role => userRoles.includes(role));
const hasRequiredRoles = requiredRoles.some((role: any) => {
return userRoles.includes(roleMapper[role]);
});

if (!hasRequiredRoles) {
this.router.navigate(['/dashboard']); // Navigate to an access denied page or login page
Expand Down
11 changes: 8 additions & 3 deletions src/app/pages/checkout/checkout.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@ export class CheckoutComponent implements OnInit, OnDestroy {
{
id: this.relatedParty,
href: this.relatedParty,
role: 'Customer'
role: environment.BUYER_ROLE
}
],
priority: '4',
Expand Down Expand Up @@ -422,7 +422,7 @@ export class CheckoutComponent implements OnInit, OnDestroy {

groupItemsByOwner(ownerId: any) {
const itemsForOwner = this.items.filter((item: any) => {
const owner = item.relatedParty?.find((rp: any) => rp.role === 'Owner')?.id;
const owner = item.relatedParty?.find((rp: any) => rp.role === environment.SELLER_ROLE)?.id;
return owner === ownerId;
});

Expand Down Expand Up @@ -507,15 +507,20 @@ export class CheckoutComponent implements OnInit, OnDestroy {
ba.selected = false;
}
this.selectedBillingAddress = baddr;
console.log('billing addr selected....')
console.log(this.selectedBillingAddress)
const updatedItems = JSON.parse(JSON.stringify(this.items)); // we need a deep clone isntead of shallow clone

for (const cartItem of updatedItems){
console.log('---- cart item ----')
console.log(cartItem)
const response = await lastValueFrom( this.priceService.calculatePrice({
"productOrder":{
"id": uuidv4(),
"productOrderItem":[{
action: "add",
id: cartItem.id, // product offering id
itemTotalPrice:[{
itemTotalPrice: cartItem.options.pricing.length == 0 ? [] : [{
productOfferingPrice:{
id: cartItem.options.pricing[0].id, //product offering price parent id
href: cartItem.options.pricing[0].id,
Expand Down
4 changes: 2 additions & 2 deletions src/app/pages/product-details/product-details.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -861,10 +861,10 @@ async deleteProduct(product: Product | undefined){
let parties = this.prodSpec?.relatedParty;
if(parties)
for(let i=0; i<parties.length;i++){
if(parties[i].role=='Owner'){
if(parties[i].role == environment.SELLER_ROLE){
if(parties[i].id.includes('organization')){
this.accService.getOrgInfo(parties[i].id).then(org => {
this.orgInfo=org;
this.orgInfo = org;
console.log(this.orgInfo)
})
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,35 +85,7 @@ <h6 class="mb-3 text-sm font-medium text-gray-900 dark:text-white">

</ul>
</div>
</div>


<!--<div class="p-8 w-full">
<div class="flex flex-row mb-1">
<fa-icon [icon]="faIdCard" class="fa-base text-primary-100 align-middle mr-2"></fa-icon>
<h2 class="text-base font-bold">{{ 'OFFERINGS._filter_role' | translate }}</h2>
</div>
<select id="countries" class="shadow bg-white border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5">
<option selected>{{ 'OFFERINGS._filter_role' | translate }}</option>
<option value="all">{{ 'OFFERINGS._all' | translate }}</option>
<option value="seller">{{ 'OFFERINGS._seller' | translate }}</option>
<option value="owner">{{ 'OFFERINGS._owner' | translate }}</option>
</select>
</div>

<div class="p-8 w-full">
<div class="flex flex-row mb-1">
<fa-icon [icon]="faSort" class="fa-base text-primary-100 align-middle mr-2"></fa-icon>
<h2 class="text-base font-bold">{{ 'OFFERINGS._order_by' | translate }}</h2>
</div>
<select id="countries" class="shadow bg-white border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5">
<option selected>{{ 'OFFERINGS._order_by' | translate }}</option>
<option value="update">{{ 'OFFERINGS._last_update' | translate }}</option>
<option value="name">{{ 'OFFERINGS._name' | translate }}</option>
</select>
</div>-->


</div>
</div>
@if(loading){
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,38 +82,9 @@ <h6 class="mb-3 text-sm font-medium text-gray-900 dark:text-white">
{{ 'PRODUCT_INVENTORY._terminated' | translate }}
</label>
</li>

</ul>
</div>
</div>


<!--<div class="p-8 w-full">
<div class="flex flex-row mb-1">
<fa-icon [icon]="faIdCard" class="fa-base text-primary-100 align-middle mr-2"></fa-icon>
<h2 class="text-base font-bold">{{ 'OFFERINGS._filter_role' | translate }}</h2>
</div>
<select id="countries" class="shadow bg-white border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5">
<option selected>{{ 'OFFERINGS._filter_role' | translate }}</option>
<option value="all">{{ 'OFFERINGS._all' | translate }}</option>
<option value="seller">{{ 'OFFERINGS._seller' | translate }}</option>
<option value="owner">{{ 'OFFERINGS._owner' | translate }}</option>
</select>
</div>

<div class="p-8 w-full">
<div class="flex flex-row mb-1">
<fa-icon [icon]="faSort" class="fa-base text-primary-100 align-middle mr-2"></fa-icon>
<h2 class="text-base font-bold">{{ 'OFFERINGS._order_by' | translate }}</h2>
</div>
<select id="countries" class="shadow bg-white border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5">
<option selected>{{ 'OFFERINGS._order_by' | translate }}</option>
<option value="update">{{ 'OFFERINGS._last_update' | translate }}</option>
<option value="name">{{ 'OFFERINGS._name' | translate }}</option>
</select>
</div>-->


</div>
</div>
@if(loading){
Expand Down
10 changes: 5 additions & 5 deletions src/app/pages/product-orders/product-orders.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ export class ProductOrdersComponent implements OnInit, OnDestroy {
filters: any[]=[];
check_custom:boolean=false;
isSeller:boolean=false;
role:any='Customer'
role:any=environment.BUYER_ROLE

show_orders: boolean = true;
show_invoices: boolean = false;
Expand Down Expand Up @@ -117,17 +117,17 @@ export class ProductOrdersComponent implements OnInit, OnDestroy {
let userRoles = aux.roles.map((elem: any) => {
return elem.name
})
if (userRoles.includes("seller")) {
this.isSeller=true;
if (userRoles.includes(environment.SELLER_ROLE)) {
this.isSeller = true;
}
} else {
let loggedOrg = aux.organizations.find((element: { id: any; }) => element.id == aux.logged_as);
this.partyId = loggedOrg.partyId;
let orgRoles = loggedOrg.roles.map((elem: any) => {
return elem.name
})
if (orgRoles.includes("seller")) {
this.isSeller=true;
if (orgRoles.includes(environment.SELLER_ROLE)) {
this.isSeller = true;
}
}
//this.partyId = aux.partyId;
Expand Down
Loading
Loading