Skip to content

Commit 7f7c603

Browse files
authored
Merge pull request #10 from in2workspace/feature/profile
fix in profile
2 parents 118ee02 + 6ed0dff commit 7f7c603

File tree

82 files changed

+1027
-1146
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

82 files changed

+1027
-1146
lines changed

docker-compose.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@ name: isbe-catalog-ui
22

33
services:
44
catalog-ui:
5-
image: in2workspace/bae-frontend:v0.0.0
5+
image: in2workspace/bae-frontend:v0.0.1
66
container_name: isbe-catalog-ui
77
restart: always

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "bae-frontend",
3-
"version": "0.0.0",
3+
"version": "0.0.1",
44
"scripts": {
55
"ng": "ng",
66
"start": "ng serve",

src/app/guard/login-info.mapper.ts

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import { environment } from "src/environments/environment";
2+
13
export interface LoginInfo {
24
id: string;
35
user: string;
@@ -6,6 +8,7 @@ export interface LoginInfo {
68
expire: number;
79
seller: string;
810
username: string;
11+
userId: string;
912
roles: Array<{ id: string; name: string }>;
1013
organizations: Array<{
1114
id: string;
@@ -46,9 +49,9 @@ function rolesFromPowers(vc: any): string[] {
4649
roleSet.add('individual');
4750
}
4851

49-
const orgName = (mandator?.organization || '').toLowerCase();
50-
if (orgName.includes('in2')) {
51-
//roleSet.add('admin'); //TODO: check
52+
const orgiId = (mandator?.organizationIdentifier || '').toLowerCase();
53+
if (orgiId.includes(environment.FOUNDATION_ID)) { //ISBE FOUNDATION ID
54+
roleSet.add('admin');
5255
}
5356

5457
return Array.from(roleSet);
@@ -87,6 +90,7 @@ export function claimsToLoginInfo(claims: any, token: string): LoginInfo {
8790

8891
return {
8992
id: vc?.id,
93+
userId: mandatee?.id || '',
9094
user: userLocalPart,
9195
email,
9296
token,
@@ -95,6 +99,6 @@ export function claimsToLoginInfo(claims: any, token: string): LoginInfo {
9599
username,
96100
roles: roleObjects,
97101
organizations,
98-
logged_as: orgId,
102+
logged_as: roleStrings.includes('orgAdmin') && orgId ? orgId : vc?.id,
99103
};
100104
}

src/app/models/country.const.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
export interface CountryDef {
2+
code: string;
3+
phone: string;
4+
}
5+
16
export const phoneNumbers = [
27
{ text: '🇺🇸 +1 United States', code: '+1', flag: '🇺🇸', country: 'US' },
38
{ text: '🇨🇦 +1 Canada', code: '+1', flag: '🇨🇦', country: 'CA' },

src/app/pages/admin/admin.component.ts

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Component, OnInit, ChangeDetectorRef } from '@angular/core';
1+
import { Component, ChangeDetectorRef } from '@angular/core';
22
import {components} from "src/app/models/product-catalog";
33
type Catalog = components["schemas"]["Catalog"];
44
import {LocalStorageService} from "src/app/services/local-storage.service";
@@ -19,7 +19,7 @@ import { NgClass } from '@angular/common';
1919
standalone: true,
2020
imports: [OperatorRevenueSharingComponent, VerificationComponent, UpdateCategoryComponent, CreateCategoryComponent,CategoriesComponent,TranslateModule, NgClass]
2121
})
22-
export class AdminComponent implements OnInit {
22+
export class AdminComponent {
2323
show_categories:boolean = true;
2424
show_create_categories:boolean = false;
2525
show_update_categories:boolean = false;
@@ -48,10 +48,6 @@ export class AdminComponent implements OnInit {
4848
})
4949
}
5050

51-
ngOnInit() {
52-
console.log('init')
53-
}
54-
5551
goToCategories(){
5652
this.selectCategories();
5753
this.show_categories = true;
@@ -143,17 +139,13 @@ export class AdminComponent implements OnInit {
143139
if(elem != null){
144140
if(elem.className.match(cls)){
145141
this.removeClass(elem,cls)
146-
} else {
147-
console.log('already unselected')
148142
}
149143
}
150144
}
151145

152146
selectMenu(elem:HTMLElement| null,cls:string){
153147
if(elem != null){
154-
if(elem.className.match(cls)){
155-
console.log('already selected')
156-
} else {
148+
if(!elem.className.match(cls)){
157149
this.addClass(elem,cls)
158150
}
159151
}

src/app/pages/admin/categories/categories.component.ts

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,10 @@
1-
import { Component, OnInit, ChangeDetectorRef } from '@angular/core';
2-
import { Router } from '@angular/router';
1+
import { Component, ChangeDetectorRef, LOCALE_ID } from '@angular/core';
32
import { FormControl } from '@angular/forms';
43
import {faIdCard, faSort, faSwatchbook} from "@fortawesome/pro-solid-svg-icons";
54
import {components} from "src/app/models/product-catalog";
65
type Category = components["schemas"]["Category"];
76
import { environment } from 'src/environments/environment';
87
import { ApiServiceService } from 'src/app/services/product-service.service';
9-
import {LocalStorageService} from "src/app/services/local-storage.service";
10-
import { LoginInfo } from 'src/app/models/interfaces';
118
import {EventMessageService} from "src/app/services/event-message.service";
129
import { initFlowbite } from 'flowbite';
1310
import { TranslateModule } from '@ngx-translate/core';
@@ -17,6 +14,7 @@ import { FaIconComponent } from '@fortawesome/angular-fontawesome';
1714
import { AuthService } from 'src/app/guard/auth.service';
1815
import { take } from 'rxjs';
1916

17+
2018
@Component({
2119
selector: 'admin-categories',
2220
templateUrl: './categories.component.html',
@@ -93,7 +91,6 @@ export class CategoriesComponent {
9391
})
9492
}
9593
})*/
96-
console.log('Getting categories...')
9794
this.api.getCategories(this.status).then(data => {
9895
for(let i=0; i < data.length; i++){
9996
this.findChildren(data[i],data);
@@ -171,17 +168,12 @@ export class CategoriesComponent {
171168
const index = this.status.findIndex(item => item === filter);
172169
if (index !== -1) {
173170
this.status.splice(index, 1);
174-
console.log('elimina filtro')
175-
console.log(this.status)
176171
} else {
177-
console.log('añade filtro')
178-
console.log(this.status)
179172
this.status.push(filter)
180173
}
181174
this.loading=true;
182175
this.categories=[];
183176
this.getCategories();
184-
console.log('filter')
185177
}
186178

187179
}

src/app/pages/admin/categories/create-category/create-category.component.ts

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,6 @@ export class CreateCategoryComponent implements OnInit {
9898
}
9999

100100
getCategories(){
101-
console.log('Getting categories...')
102101
this.api.getLaunchedCategories().then(data => {
103102
for(let i=0; i < data.length; i++){
104103
this.findChildren(data[i],data);
@@ -257,17 +256,13 @@ export class CreateCategoryComponent implements OnInit {
257256
if(elem != null){
258257
if(elem.className.match(cls)){
259258
this.removeClass(elem,cls)
260-
} else {
261-
console.log('already unselected')
262259
}
263260
}
264261
}
265262

266263
selectMenu(elem:HTMLElement| null,cls:string){
267264
if(elem != null){
268-
if(elem.className.match(cls)){
269-
console.log('already selected')
270-
} else {
265+
if(!elem.className.match(cls)){
271266
this.addClass(elem,cls)
272267
}
273268
}
@@ -364,7 +359,6 @@ export class CreateCategoryComponent implements OnInit {
364359
}
365360

366361
addEmoji(event:any){
367-
console.log(event)
368362
this.showEmoji=false;
369363
const currentText = this.generalForm.value.description;
370364
this.generalForm.patchValue({

src/app/pages/admin/categories/update-category/update-category.component.ts

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -303,17 +303,13 @@ export class UpdateCategoryComponent implements OnInit {
303303
if(elem != null){
304304
if(elem.className.match(cls)){
305305
this.removeClass(elem,cls)
306-
} else {
307-
console.log('already unselected')
308306
}
309307
}
310308
}
311309

312310
selectMenu(elem:HTMLElement| null,cls:string){
313311
if(elem != null){
314-
if(elem.className.match(cls)){
315-
console.log('already selected')
316-
} else {
312+
if(!elem.className.match(cls)){
317313
this.addClass(elem,cls)
318314
}
319315
}
@@ -410,7 +406,6 @@ export class UpdateCategoryComponent implements OnInit {
410406
}
411407

412408
addEmoji(event:any){
413-
console.log(event)
414409
this.showEmoji=false;
415410
const currentText = this.generalForm.value.description;
416411
this.generalForm.patchValue({

src/app/pages/admin/verification/verification.component.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ export class VerificationComponent {
4747
error: error => {
4848
console.error('There was an error while updating!', error);
4949
if(error.error.error){
50-
console.log(error)
50+
console.error(error)
5151
this.errorMessage = 'Error: ' + error.error.error;
5252
} else {
5353
this.errorMessage = '¡Hubo un error al cargar el producto!';

0 commit comments

Comments
 (0)