Skip to content

Commit 0d72fb3

Browse files
authored
Merge pull request #8 from in2workspace/feature/search
Feature/search
2 parents 3c710f8 + 636431a commit 0d72fb3

File tree

15 files changed

+41
-293
lines changed

15 files changed

+41
-293
lines changed

cypress/e2e/dashboard.cy.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ describe('/dashboard',{
2121
cy.getBySel('vServices').should('have.text', '1 verified services')
2222
cy.getBySel('rPublishers').should('exist')
2323
cy.getBySel('rPublishers').should('have.text', '1 registered providers')
24-
cy.getBySel('nameServices').should('have.length', init_stat.services.length)
24+
cy.getBySel('nameServices').should('have.length', init_stat.services?.length)
2525
cy.getBySel('nameOrgs').should('have.length', init_stat.organizations.length)
2626
2727
})*/

src/app/offerings/gallery/gallery.component.ts

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import { Component, OnInit, ChangeDetectorRef } from '@angular/core';
2-
import { CommonModule } from '@angular/common';
32
import {CardComponent} from "../../shared/card/card.component";
43
import {components} from "../../models/product-catalog";
54
type ProductOffering = components["schemas"]["ProductOffering"];
@@ -18,15 +17,14 @@ export class GalleryComponent implements OnInit {
1817
products: ProductOffering[]=[];
1918

2019
constructor(
21-
private api: ApiServiceService,
22-
private cdr: ChangeDetectorRef) {
20+
private readonly api: ApiServiceService,
21+
private readonly cdr: ChangeDetectorRef) {
2322
}
2423

2524
//Must be under environment.PRODUCT_LIMIT (i.e. 6 atm)
2625
gallery_limit=4;
2726

2827
ngOnInit() {
29-
console.log('API RESPONSE:')
3028
this.api.getProducts(0,undefined).then(data => {
3129
for(let i=0; i < this.gallery_limit && i < data.length; i++){
3230
let attachment: any[]= []
@@ -94,9 +92,6 @@ export class GalleryComponent implements OnInit {
9492
})
9593
}
9694
})
97-
98-
console.log('Productos...')
99-
console.log(this.products)
10095
}
10196

10297
}

src/app/pages/dashboard/dashboard.component.html

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -82,15 +82,7 @@ <h1 class="mb-4 text-left text-4xl font-extrabold tracking-tight md:text-5xl lg:
8282
</section>
8383
}
8484

85-
<!--<app-how-it-works></app-how-it-works>-->
86-
<!--<bae-off-featured></bae-off-featured>-->
8785
<bae-off-gallery></bae-off-gallery>
8886
<app-platform-benefits></app-platform-benefits>
89-
<!--<app-explore-dome></app-explore-dome>-->
90-
<!--<app-faq></app-faq>-->
91-
92-
<!-- @if(showContact){
93-
<contact-us [ngClass]="showContact ? 'backdrop-blur-sm': ''" class="flex justify-center overflow-y-auto overflow-x-hidden fixed top-0 right-0 left-0 z-50 justify-center items-center w-full md:inset-0 h-[calc(100%-1rem)] max-h-full shadow-2xl"></contact-us>
94-
} -->
9587

9688
</div>

src/app/pages/dashboard/dashboard.component.ts

Lines changed: 5 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -68,27 +68,20 @@ export class DashboardComponent implements OnInit {
6868

6969
startTagTransition() {
7070
setInterval(() => {
71-
this.currentIndexServ = (this.currentIndexServ + 1) % this.services.length;
72-
this.currentIndexPub = (this.currentIndexPub + 1) % this.publishers.length;
71+
this.currentIndexServ = (this.currentIndexServ + 1) % this.services?.length;
72+
this.currentIndexPub = (this.currentIndexPub + 1) % this.publishers?.length;
7373
}, this.delay);
7474
}
7575

7676
async ngOnInit() {
7777
this.statsService.getStats().then(data=> {
78-
this.services=data?.services;
79-
this.publishers=data?.organizations;
78+
this.services=data?.services ?? [];
79+
this.publishers=data?.organizations ?? [];
8080
this.startTagTransition();
8181
})
8282
this.isFilterPanelShown = JSON.parse(this.localStorage.getItem('is_filter_panel_shown') as string);
83-
//this.route.snapshot.paramMap.get('id');
84-
console.log('--- route data')
85-
console.log(this.route.queryParams)
86-
console.log(this.route.snapshot.queryParamMap.get('token'))
8783
if(this.route.snapshot.queryParamMap.get('token') != null){
8884
this.loginService.getLogin(this.route.snapshot.queryParamMap.get('token')).then(data => {
89-
console.log('---- loginangular response ----')
90-
console.log(data)
91-
console.log(data.username)
9285
let info = {
9386
"id": data.id,
9487
"user": data.username,
@@ -107,25 +100,9 @@ export class DashboardComponent implements OnInit {
107100

108101
this.localStorage.addLoginInfo(info);
109102
this.eventMessage.emitLogin(info);
110-
console.log('----')
111-
//this.refreshApi.stopInterval();
112-
//this.refreshApi.startInterval(((data.expire - moment().unix())-4)*1000, data);
113-
//this.refreshApi.startInterval(3000, data);
114103
})
115104
this.router.navigate(['/dashboard'])
116-
} else {
117-
console.log('sin token')
118-
//this.localStorage.clear()
119-
let aux = this.localStorage.getObject('login_items') as LoginInfo;
120-
if (JSON.stringify(aux) != '{}') {
121-
console.log(aux)
122-
console.log('moment')
123-
console.log(aux['expire'])
124-
console.log(moment().unix())
125-
console.log(aux['expire'] - moment().unix())
126-
console.log(aux['expire'] - moment().unix() <= 5)
127-
}
128-
}
105+
}
129106
this.api.getLaunchedCategories().then(data => {
130107
for(let i=0; i < data.length; i++){
131108
if(data[i].isRoot==true){
@@ -139,7 +116,6 @@ export class DashboardComponent implements OnInit {
139116
this.showContact = true;
140117

141118
this.cdr.detectChanges();
142-
console.log('----')
143119
}
144120
filterSearch(event: any) {
145121
if(this.searchField.value!='' && this.searchField.value != null){

src/app/pages/product-details/product-details.component.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ <h5 class="md:text-3xl lg:text-4xl font-semibold tracking-tight text-primary-100
138138
</li>
139139
}
140140
</ul>
141-
@if(check_logged){
141+
@if(check_logged && !IS_ISBE){
142142
<button type="button" (click)="openDrawer()" [disabled]="!PURCHASE_ENABLED" [ngClass]="!PURCHASE_ENABLED ? 'opacity-50' : 'hover:bg-primary-50'" class="hidden md:flex w-fit m-2 text-white bg-purple-700 hover:bg-purple-800 focus:ring-4 focus:outline-none focus:ring-purple-300 font-medium rounded-lg text-sm px-5 py-2.5 text-center inline-flex items-center dark:bg-purple-600 dark:hover:bg-purple-700 dark:focus:ring-purple-800">
143143
<svg class="w-3.5 h-3.5 me-2" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" fill="currentColor" viewBox="0 0 18 21">
144144
<path d="M15 12a1 1 0 0 0 .962-.726l2-7A1 1 0 0 0 17 3H3.77L3.175.745A1 1 0 0 0 2.208 0H1a1 1 0 0 0 0 2h.438l.6 2.255v.019l2 7 .746 2.986A3 3 0 1 0 9 17a2.966 2.966 0 0 0-.184-1h2.368c-.118.32-.18.659-.184 1a3 3 0 1 0 3-3H6.78l-.5-2H15Z"/>
@@ -147,7 +147,7 @@ <h5 class="md:text-3xl lg:text-4xl font-semibold tracking-tight text-primary-100
147147
</button>
148148
}
149149
</div>
150-
@if(check_logged){
150+
@if(check_logged && !IS_ISBE){
151151
<button type="button" (click)="openDrawer()" [disabled]="!PURCHASE_ENABLED" [ngClass]="!PURCHASE_ENABLED ? 'opacity-50' : 'hover:bg-primary-50'" class="flex md:hidden justify-end w-fit m-2 text-white bg-purple-700 hover:bg-purple-800 focus:ring-4 focus:outline-none focus:ring-purple-300 font-medium rounded-lg text-sm px-5 py-2.5 text-center inline-flex items-center dark:bg-purple-600 dark:hover:bg-purple-700 dark:focus:ring-purple-800">
152152
<svg class="w-3.5 h-3.5 me-2" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" fill="currentColor" viewBox="0 0 18 21">
153153
<path d="M15 12a1 1 0 0 0 .962-.726l2-7A1 1 0 0 0 17 3H3.77L3.175.745A1 1 0 0 0 2.208 0H1a1 1 0 0 0 0 2h.438l.6 2.255v.019l2 7 .746 2.986A3 3 0 1 0 9 17a2.966 2.966 0 0 0-.184-1h2.368c-.118.32-.18.659-.184 1a3 3 0 1 0 3-3H6.78l-.5-2H15Z"/>

src/app/pages/product-inventory/product-inventory.component.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@ export class ProductInventoryComponent implements OnInit, AfterViewInit {
2323
openProdId:any=undefined;
2424

2525
constructor(
26-
private cdr: ChangeDetectorRef,
27-
private eventMessage: EventMessageService
26+
private readonly cdr: ChangeDetectorRef,
27+
private readonly eventMessage: EventMessageService
2828
) {
2929
this.eventMessage.messages$.subscribe(ev => {
3030
if(ev.type === 'OpenServiceDetails') {

src/app/services/pagination.service.ts

Lines changed: 2 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,6 @@ export class PaginationService {
2727

2828
async getItemsPaginated(page:number, pageSize:any, next:boolean, items:any[], nextItems:any[], options:any,
2929
handler: (...params: any[]) => Promise<any>): Promise<any> {
30-
31-
console.log('options')
32-
console.log(options)
33-
3430
try {
3531
let params: any[] = [page];
3632
if("keywords" in options){
@@ -68,8 +64,6 @@ export class PaginationService {
6864
page=0;
6965
params[0]=page;
7066

71-
console.log('------ Calling handler')
72-
console.log(params)
7367
let data = await handler(...params)
7468
items=data;
7569
page=page+pageSize;
@@ -86,7 +80,7 @@ export class PaginationService {
8680
page=page+pageSize;
8781

8882
} catch(err) {
89-
console.log(err)
83+
console.error(err)
9084
} finally {
9185
let page_check=true;
9286
if(nextItems.length>0){
@@ -246,7 +240,6 @@ export class PaginationService {
246240

247241
async getProducts(page: number, keywords: any, filters?: Category[]): Promise<ProductOffering[]> {
248242
try {
249-
console.log('-------------------------- getProducts ----------------------------');
250243
// Get data from API
251244
const productOfferings: ProductOffering[] = filters && filters.length > 0
252245
? await this.api.getProductsByCategory(filters, page, keywords)
@@ -313,7 +306,6 @@ export class PaginationService {
313306

314307
async getProductsByCatalog(page: number, keywords: any, filters?: Category[], id?: any): Promise<ProductOffering[]> {
315308
try {
316-
console.log('-------------------------- getProductsByCatalog ----------------------------');
317309
// Get data from API
318310
const productOfferings: ProductOffering[] = filters && filters.length > 0
319311
? await this.api.getProductsByCategoryAndCatalog(filters, id, page)
@@ -552,7 +544,6 @@ export class PaginationService {
552544
try {
553545
// Get Orders
554546
orders = await this.orderService.getProductOrders(seller, page, filters, selectedDate, role);
555-
console.log('getOrders', orders);
556547
// Obtener todas las cuentas de facturación en paralelo
557548
const billingAccounts = await Promise.all(orders.map(order => this.accountService.getBillingAccountById(order.billingAccount.id)));
558549

@@ -561,7 +552,6 @@ export class PaginationService {
561552
// Obtener detalles de los productos en paralelo
562553
const items = await Promise.all(order.productOrderItem.map(async (productOrderItem:any) => {
563554
try {
564-
console.log('Soy un productOrderItem???????: ', productOrderItem);
565555
const offer = await this.api.getProductById(productOrderItem.productOffering.id);
566556
const spec = await this.api.getProductSpecification(offer.productSpecification.id);
567557

@@ -613,7 +603,6 @@ export class PaginationService {
613603
};
614604
}));
615605

616-
console.log('Orders processed:', ordersWithDetails);
617606
return ordersWithDetails;
618607
} catch (error) {
619608
console.error('Error fetching orders:', error);
@@ -670,11 +659,8 @@ export class PaginationService {
670659

671660
async getInventory(page: number, keywords: any, filters: Category[], seller: any): Promise<any[]> {
672661
try {
673-
console.log('Fetching inventory...');
674-
675662
// Obtener inventario desde el servicio
676663
const data = await this.inventoryService.getInventory(page, seller, filters, keywords);
677-
console.log('Inventory received:', data);
678664

679665
// Obtener ofertas del inventario
680666
return await this.getOffers(data);
@@ -686,14 +672,11 @@ export class PaginationService {
686672
}
687673

688674
async getInvoices(page:number, filters:Category[], seller:any, selectedDate:any, role:any): Promise<any[]> {
689-
console.log("---getInvoices---")
675+
690676
let invoices = []
691677
try{
692678
invoices = await this.invoicesService.getInvoices(seller,page,filters,selectedDate,role)
693679
} finally {
694-
console.log("params:", seller,page,filters,selectedDate,role)
695-
console.log("---getInvoices result:---", invoices)
696-
console.log(invoices)
697680
return invoices
698681
}
699682
}

src/app/services/shopping-cart-service.service.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,6 @@ export class ShoppingCartServiceService {
2929
return cart;
3030
}
3131
async addItemShoppingCart(item:any){
32-
console.log('adding to cart')
33-
console.log(item)
3432
//POST - El item va en el body de la petición
3533
let url = `${ShoppingCartServiceService.BASE_URL}${ShoppingCartServiceService.API_CART}/item/`;
3634

@@ -44,8 +42,6 @@ export class ShoppingCartServiceService {
4442
let url = `${ShoppingCartServiceService.BASE_URL}${ShoppingCartServiceService.API_CART}/item/${id}`;
4543
await lastValueFrom(this.http.delete<any>(url));
4644
await this.refreshCart(); // Actualiza el carrito tras la operación
47-
48-
//return this.http.delete<any>(url);
4945
}
5046

5147
async emptyShoppingCart(){

src/app/shared/card/card.component.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ <h5 class="text-xl font-semibold line-clamp-2 tracking-tight text-primary-100 da
7474
</svg>
7575
{{ 'CARD._details' | translate }}
7676
</button>
77-
@if(check_logged){
77+
@if(check_logged && !IS_ISBE){
7878
<button id="add-to-cart" type="button" [disabled]="!PURCHASE_ENABLED || productAlreadyInCart"
7979
(click)="openDrawer()"
8080
[ngClass]="!PURCHASE_ENABLED || productAlreadyInCart ? 'opacity-50' : 'hover:bg-primary-50'"
@@ -217,7 +217,7 @@ <h5 class="font-semibold tracking-tight text-lg text-primary-100 dark:text-prima
217217
</div>
218218
<hr class="h-px bg-gray-200 border-0 dark:bg-gray-700">
219219
<div class="flex">
220-
@if(check_logged){
220+
@if(check_logged && !IS_ISBE){
221221
<button (click)="openDrawer()" [disabled]="!PURCHASE_ENABLED || productAlreadyInCart" [ngClass]="!PURCHASE_ENABLED || productAlreadyInCart ? 'opacity-50' : 'hover:bg-primary-50'" type="button" class="m-4 w-fit flex items-center justify-start text-white bg-purple-700 hover:bg-purple-800 focus:ring-4 focus:outline-none focus:ring-purple-300 font-medium rounded-lg text-sm px-5 py-2.5 text-center inline-flex items-center me-2 dark:bg-purple-600 dark:hover:bg-purple-700 dark:focus:ring-purple-800">
222222
<svg class="w-3.5 h-3.5 me-2" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" fill="currentColor" viewBox="0 0 18 21">
223223
<path d="M15 12a1 1 0 0 0 .962-.726l2-7A1 1 0 0 0 17 3H3.77L3.175.745A1 1 0 0 0 2.208 0H1a1 1 0 0 0 0 2h.438l.6 2.255v.019l2 7 .746 2.986A3 3 0 1 0 9 17a2.966 2.966 0 0 0-.184-1h2.368c-.118.32-.18.659-.184 1a3 3 0 1 0 3-3H6.78l-.5-2H15Z"/>

0 commit comments

Comments
 (0)