Ver código fonte

Se hicieron los siguientes fix:

- En el paso de resumen se agrego un boton para regresar
- Al ingresar otra inversion nueva no se limpiaban los campos
- En pantalla resumen boton "ir al listado" no funcionaba
Francisco huezo 5 anos atrás
pai
commit
4d3492b704

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

@@ -15,7 +15,7 @@
           </nav>
           <a
             class="btn btn-primary"
-            [routerLink]="['/investment-proposal/general-info']"
+            (click)="create_investment_proposal()"
           >
             Nuevo registro
           </a>

+ 14 - 0
src/app/components/investment-proposals/investment-proposals.component.ts

@@ -133,6 +133,20 @@ export class InvestmentProposalsComponent implements OnInit {
     }, 1000);
   }
 
+  create_investment_proposal() {
+    this.formInvestmentProposal.resetFormData();
+
+    Swal.fire({
+      allowOutsideClick: false,
+      icon: "info",
+      text: "Espere por favor..."
+    });
+    Swal.showLoading();
+    setTimeout(() => {
+      this.router.navigate(["/investment-proposal/general-info"], {});
+    }, 1000);
+  }
+
   // Verifica permisos para mostrar boton de edicion y/o envio a revision,
   // segun los permisos del usuario y el estado de la propuesta
   can_modify_or_send_to_review(status: string) {

+ 9 - 3
src/app/components/investment-proposals/result/result.component.html

@@ -193,12 +193,12 @@
                 </div>
 
                 <div *ngIf="investmentExists">
-                  <button
+                  <a
                     class="btn btn-default center-component margin-right float-left"
-                    href="['/investment-proposals']"
+                    href="#/investment-proposals"
                   >
                     Ir a listado
-                  </button>
+                </a>
 
                   <button
                     class="btn btn-primary center-component float-right"
@@ -212,6 +212,12 @@
                   >
                     Guardar propuesta
                   </button>
+                  <button
+                      class="btn btn-default center-component margin-right float-right"
+                      (click)="goToPrevious(workForm)"
+                    >
+                      Anterior
+                    </button>
                 </div>
               </div>
             </div>

+ 11 - 0
src/app/components/investment-proposals/result/result.component.ts

@@ -62,6 +62,7 @@ export class ResultComponent implements OnInit {
   reviewProposal: {};
   userRole: any;
   state: string = "";
+  submitted: boolean = false;
 
   constructor(
     private router: Router,
@@ -365,4 +366,14 @@ export class ResultComponent implements OnInit {
         }
       );
   }
+  goToPrevious(form: any) {
+    this.submitted = true;
+    if (this.investmentProposalID != undefined) {
+      this.router.navigate(["/investment-proposal/complement-info"], {
+        queryParams: { id: this.investmentProposalID }
+      });
+    } else {
+      this.router.navigate(["/investment-proposal/complement-info"]);
+    }
+  }
 }