diff --git a/src/app/pages/welcome/welcome.html b/src/app/pages/welcome/welcome.html
index f416acc..090c54f 100644
--- a/src/app/pages/welcome/welcome.html
+++ b/src/app/pages/welcome/welcome.html
@@ -1,5 +1,5 @@
-
+
diff --git a/src/app/pages/welcome/welcome.ts b/src/app/pages/welcome/welcome.ts
index 6632ec5..cb312b0 100644
--- a/src/app/pages/welcome/welcome.ts
+++ b/src/app/pages/welcome/welcome.ts
@@ -2,7 +2,7 @@ import {Component, inject, OnInit, signal} from '@angular/core';
import {InfoCard} from "../../components/info-card/info-card";
import {DeliveryValidator} from "../../components/delivery-validator/delivery-validator";
import {InfoTable} from "../../components/info-table/info-table";
-import {DeliverersService, SuppliersService} from "../../services/api";
+import {DeliverersService, ProductsService, SuppliersService} from "../../services/api";
import {firstValueFrom} from "rxjs";
import {NzNotificationService} from "ng-zorro-antd/notification";
@@ -18,12 +18,14 @@ import {NzNotificationService} from "ng-zorro-antd/notification";
})
export class Welcome implements OnInit {
+ private productsService = inject(ProductsService);
private deliverersService = inject(DeliverersService);
private suppliersService = inject(SuppliersService);
private notificationsService = inject(NzNotificationService);
deliversCount = signal
(0);
suppliersCount = signal(0);
+ productsUnderLimitCount = signal(0);
async getDeliverers() {
try{
@@ -48,8 +50,22 @@ export class Welcome implements OnInit {
)
}
}
+
+ async getProductsUnderLimit(){
+ try{
+ const products = await firstValueFrom(this.productsService.getAllProductsUnderLimitEndpoint());
+ this.productsUnderLimitCount.set(products.length);
+ }catch(e){
+ this.notificationsService.error(
+ 'Error',
+ 'Error while getting products.',
+ )
+ }
+ }
+
async ngOnInit() {
await this.getDeliverers();
await this.getSuppliers();
+ await this.getProductsUnderLimit();
}
}
diff --git a/src/app/services/api/api/products.service.ts b/src/app/services/api/api/products.service.ts
index 65263c5..a1e6451 100644
--- a/src/app/services/api/api/products.service.ts
+++ b/src/app/services/api/api/products.service.ts
@@ -142,6 +142,56 @@ export class ProductsService extends BaseService {
);
}
+ /**
+ * @endpoint get /API/products/underLimit
+ * @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
+ * @param reportProgress flag to report request and response progress.
+ */
+ public getAllProductsUnderLimitEndpoint(observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>;
+ public getAllProductsUnderLimitEndpoint(observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>>;
+ public getAllProductsUnderLimitEndpoint(observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>>;
+ public getAllProductsUnderLimitEndpoint(observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable {
+
+ let localVarHeaders = this.defaultHeaders;
+
+ const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
+ 'application/json'
+ ]);
+ if (localVarHttpHeaderAcceptSelected !== undefined) {
+ localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
+ }
+
+ const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
+
+ const localVarTransferCache: boolean = options?.transferCache ?? true;
+
+
+ let responseType_: 'text' | 'json' | 'blob' = 'json';
+ if (localVarHttpHeaderAcceptSelected) {
+ if (localVarHttpHeaderAcceptSelected.startsWith('text')) {
+ responseType_ = 'text';
+ } else if (this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)) {
+ responseType_ = 'json';
+ } else {
+ responseType_ = 'blob';
+ }
+ }
+
+ let localVarPath = `/API/products/underLimit`;
+ const { basePath, withCredentials } = this.configuration;
+ return this.httpClient.request>('get', `${basePath}${localVarPath}`,
+ {
+ context: localVarHttpContext,
+ responseType: responseType_,
+ ...(withCredentials ? { withCredentials } : {}),
+ headers: localVarHeaders,
+ observe: observe,
+ ...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}),
+ reportProgress: reportProgress
+ }
+ );
+ }
+
/**
* @endpoint get /API/products/{id}
* @param id