浏览代码

Merge branch 'feature-validacion_auditoria' of onunez/frontend-inversiones into development

validacion para no pasar de un estado a otro, si no es permitido
Francisco Huezo 5 年之前
父节点
当前提交
a9363a52f6

+ 34 - 10
src/app/components/investment-proposals/approve/approve.component.ts

@@ -427,11 +427,23 @@ export class InvestmentProposalApproveComponent implements OnInit {
               }
             },
             err => {
-              Swal.fire({
-                icon: "error",
-                title: "Error al guardar",
-                text: err.message
-              });
+              debugger
+              if(err.code==405){
+                Swal.fire({
+                  icon: "error",
+                  title: "Operacion no permitida",
+                  text: err.message
+                }).then(result => {
+                  Swal.close();
+                  window.location.href = "#/investment-proposals";
+                });  
+              }else{
+                Swal.fire({
+                  icon: "error",
+                  title: "Error al guardar",
+                  text: err.message
+                });
+              }             
             }
           );
       });
@@ -519,11 +531,23 @@ export class InvestmentProposalApproveComponent implements OnInit {
               }
             },
             err => {
-              Swal.fire({
-                icon: "error",
-                title: "Error al guardar",
-                text: err.message
-              });
+              if(err.code==405){
+                Swal.fire({
+                  icon: "error",
+                  title: "Operacion no permitida",
+                  text: err.message
+                }).then(result => {
+                  Swal.close();
+                  window.location.href = "#/investment-proposals";
+                });
+              }else{
+                Swal.fire({
+                  icon: "error",
+                  title: "Error al guardar",
+                  text: err.message
+                });
+              }
+              this.router.navigate(["/investment-proposals"]);              
             }
           );
       });

+ 33 - 10
src/app/components/investment-proposals/investment-proposals.component.ts

@@ -377,11 +377,22 @@ export class InvestmentProposalsComponent implements OnInit {
                 }
               },
               err => {
-                Swal.fire({
-                  icon: "error",
-                  title: "Error al guardar",
-                  text: err.message
-                });
+                if(err.code==405){
+                  Swal.fire({
+                    icon: "error",
+                    title: "Operacion no permitida",
+                    text: err.message
+                  }).then(result => {
+                    Swal.close();
+                    window.location.href = "#/investment-proposals";
+                  });
+                }else{
+                  Swal.fire({
+                    icon: "error",
+                    title: "Error al guardar",
+                    text: err.message
+                  });
+                }
               }
             );
         });
@@ -486,11 +497,23 @@ export class InvestmentProposalsComponent implements OnInit {
                 }
               },
               err => {
-                Swal.fire({
-                  icon: "error",
-                  title: "Error al guardar",
-                  text: err.message
-                });
+                if(err.code==405){
+                  Swal.fire({
+                    icon: "error",
+                    title: "Operacion no permitida",
+                    text: err.message
+                  }).then(result => {
+                    Swal.close();
+                    window.location.href = "#/investment-proposals";
+                  });
+                }else{
+                  Swal.fire({
+                    icon: "error",
+                    title: "Error al guardar",
+                    text: err.message
+                  });
+                }
+                this.router.navigate(["/investment-proposals"]);              
               }
             );
         });

+ 32 - 10
src/app/components/investment-proposals/payment-approval/payment-approval.component.ts

@@ -454,11 +454,22 @@ export class PaymentApprovalComponent implements OnInit {
               }
             },
             err => {
-              Swal.fire({
-                icon: "error",
-                title: "Error al guardar",
-                text: err.message
-              });
+              if(err.code==405){
+                Swal.fire({
+                  icon: "error",
+                  title: "Operacion no permitida",
+                  text: err.message
+                }).then(result => {
+                  Swal.close();
+                  window.location.href = "#/investment-proposals";
+                });  
+              }else{
+                Swal.fire({
+                  icon: "error",
+                  title: "Error al guardar",
+                  text: err.message
+                });
+              }              
             }
           );
       });
@@ -546,11 +557,22 @@ export class PaymentApprovalComponent implements OnInit {
               }
             },
             err => {
-              Swal.fire({
-                icon: "error",
-                title: "Error al guardar",
-                text: err.message
-              });
+              if(err.code==405){
+                Swal.fire({
+                  icon: "error",
+                  title: "Operacion no permitida",
+                  text: err.message
+                }).then(result => {
+                  Swal.close();
+                  window.location.href = "#/investment-proposals";
+                });
+              }else{
+                Swal.fire({
+                  icon: "error",
+                  title: "Error al guardar",
+                  text: err.message
+                });
+              }              
             }
           );
       });

+ 32 - 10
src/app/components/investment-proposals/result/result.component.ts

@@ -413,11 +413,22 @@ export class ResultComponent implements OnInit {
                 }
               },
               err => {
-                Swal.fire({
-                  icon: "error",
-                  title: "Error al guardar",
-                  text: err.message
-                });
+                if(err.code==405){
+                  Swal.fire({
+                    icon: "error",
+                    title: "Operacion no permitida",
+                    text: err.message
+                  }).then(result => {
+                    Swal.close();
+                    window.location.href = "#/investment-proposals";
+                  });
+                }else{
+                  Swal.fire({
+                    icon: "error",
+                    title: "Error al guardar",
+                    text: err.message
+                  });
+                }      
               }
             );
         });
@@ -568,11 +579,22 @@ export class ResultComponent implements OnInit {
                 }
               },
               err => {
-                Swal.fire({
-                  icon: "error",
-                  title: "Error al guardar",
-                  text: err.message
-                });
+                if(err.code==405){
+                  Swal.fire({
+                    icon: "error",
+                    title: "Operacion no permitida",
+                    text: err.message
+                  }).then(result => {
+                    Swal.close();
+                    window.location.href = "#/investment-proposals";
+                  });
+                }else{
+                  Swal.fire({
+                    icon: "error",
+                    title: "Error al guardar",
+                    text: err.message
+                  });
+                }              
               }
             );
         });

+ 32 - 10
src/app/components/investment-proposals/review/review.component.ts

@@ -429,11 +429,22 @@ export class InvestmentProposalReviewComponent implements OnInit {
               }
             },
             err => {
-              Swal.fire({
-                icon: "error",
-                title: "Error al guardar",
-                text: err.message
-              });
+              if(err.code==405){
+                Swal.fire({
+                  icon: "error",
+                  title: "Operacion no permitida",
+                  text: err.message
+                }).then(result => {
+                  Swal.close();
+                  window.location.href = "#/investment-proposals";
+                });
+              }else{
+                Swal.fire({
+                  icon: "error",
+                  title: "Error al guardar",
+                  text: err.message
+                });
+              }              
             }
           );
       });
@@ -521,11 +532,22 @@ export class InvestmentProposalReviewComponent implements OnInit {
               }
             },
             err => {
-              Swal.fire({
-                icon: "error",
-                title: "Error al guardar",
-                text: err.message
-              });
+              if(err.code==405){
+                Swal.fire({
+                  icon: "error",
+                  title: "Operacion no permitida",
+                  text: err.message
+                }).then(result => {
+                  Swal.close();
+                  window.location.href = "#/investment-proposals";
+                });  
+              }else{
+                Swal.fire({
+                  icon: "error",
+                  title: "Error al guardar",
+                  text: err.message
+                });
+              }              
             }
           );
       });