ソースを参照

filtro para listar propuestas o portafolio

Francisco huezo 5 年 前
コミット
b887a053a7

+ 1 - 1
src/app/components/investment-proposals/investment-proposals.component.ts

@@ -80,7 +80,7 @@ export class InvestmentProposalsComponent implements OnInit {
   }
 
   ngOnInit() {
-    this.investmentsService.getProposalInvestmentsList().subscribe(
+    this.investmentsService.getProposalInvestmentsList("propuestas").subscribe(
       ans => {
         this.listProposals = ans.result;
         /*

+ 1 - 8
src/app/components/investments/investments.component.ts

@@ -75,16 +75,9 @@ export class InvestmentsComponent implements OnInit {
   }
 
   ngOnInit() {
-    this.investmentsService.getProposalInvestmentsList().subscribe(
+    this.investmentsService.getProposalInvestmentsList("portafolio").subscribe(
       ans => {
         this.listProposals = ans.result;
-
-        this.listProposals = this.listProposals.filter(
-          proposals =>
-            proposals["id_estado_inversion"] != null &&
-            proposals["id_estado_inversion"]["codigo"] == "FINAL"
-        );
-
         this.dataSource.data = this.listProposals;
         this.dataSource.paginator = this.paginator;
         this.dataSource.sortingDataAccessor = (item, property) => {

+ 11 - 1
src/app/services/investments.service.ts

@@ -15,7 +15,17 @@ export class InvestmentsService {
   constructor(private http: HttpClient) {}
 
   // Obtener listado de propuestas de inversiones
-  getProposalInvestmentsList() {
+  getProposalInvestmentsList(type: string = "") {
+    if (type != ""){
+      return this.http
+      .get<any>(`${environment.productionApiUrl}/inversiones?tipo=`+type, {})
+      .pipe(
+        map(response => {
+          return response;
+        }),
+        catchError(this.errorHandl)
+      );  
+    }
     return this.http
       .get<any>(`${environment.productionApiUrl}/inversiones`, {})
       .pipe(