Browse Source

Guardado fondos de inversion, archivo de hoja de liquidacion, campos no requeridos para familia de bonos, filtro en combo box

Oscar José Nuñez Chávez 5 years ago
parent
commit
e47b652e55
25 changed files with 609 additions and 264 deletions
  1. 48 19
      package-lock.json
  2. 1 0
      package.json
  3. 2 0
      src/app/app.module.ts
  4. 9 36
      src/app/components/instruments/bonos/bonos.component.ts
  5. 9 36
      src/app/components/instruments/certificados/certificados.component.ts
  6. 9 36
      src/app/components/instruments/eurobonos/eurobonos.component.ts
  7. 20 8
      src/app/components/instruments/pbur/pbur.component.html
  8. 9 36
      src/app/components/instruments/titulos/titulos.component.ts
  9. 20 8
      src/app/components/instruments/vcn/vcn.component.html
  10. 4 12
      src/app/components/investment-proposals/complement-info/complement-info.component.html
  11. 28 9
      src/app/components/investment-proposals/complement-info/complement-info.component.ts
  12. 10 24
      src/app/components/investment-proposals/general-info/general-info.component.html
  13. 46 10
      src/app/components/investment-proposals/general-info/general-info.component.ts
  14. 13 0
      src/app/components/investment-proposals/investment-proposals.component.html
  15. 1 1
      src/app/components/investment-proposals/investment-proposals.component.scss
  16. 28 0
      src/app/components/investment-proposals/investment-proposals.component.ts
  17. 5 1
      src/app/components/investment-proposals/proposal-detail/proposal-detail.component.ts
  18. 1 0
      src/app/components/investment-proposals/result/result.component.ts
  19. 130 0
      src/app/components/investment-proposals/upload-liquidation/upload-liquidation.component.html
  20. 34 0
      src/app/components/investment-proposals/upload-liquidation/upload-liquidation.component.scss
  21. 144 0
      src/app/components/investment-proposals/upload-liquidation/upload-liquidation.component.ts
  22. 6 28
      src/app/layouts/admin/admin.module.ts
  23. 5 0
      src/app/layouts/admin/admin.routing.ts
  24. 11 0
      src/app/services/investments.service.ts
  25. 16 0
      src/assets/scss/material-dashboard.scss

+ 48 - 19
package-lock.json

@@ -2337,6 +2337,11 @@
       "integrity": "sha1-SlKCrBZHKek2Gbz9OtFR+BfOkfU=",
       "integrity": "sha1-SlKCrBZHKek2Gbz9OtFR+BfOkfU=",
       "dev": true
       "dev": true
     },
     },
+    "angular": {
+      "version": "1.8.0",
+      "resolved": "https://registry.npmjs.org/angular/-/angular-1.8.0.tgz",
+      "integrity": "sha512-VdaMx+Qk0Skla7B5gw77a8hzlcOakwF8mjlW13DpIWIDlfqwAbSSLfd8N/qZnzEmQF4jC4iofInd3gE7vL8ZZg=="
+    },
     "angular-archwizard": {
     "angular-archwizard": {
       "version": "5.0.0",
       "version": "5.0.0",
       "resolved": "https://registry.npmjs.org/angular-archwizard/-/angular-archwizard-5.0.0.tgz",
       "resolved": "https://registry.npmjs.org/angular-archwizard/-/angular-archwizard-5.0.0.tgz",
@@ -2353,6 +2358,16 @@
         "tslib": "^1.9.0"
         "tslib": "^1.9.0"
       }
       }
     },
     },
+    "angular-chosen-localytics": {
+      "version": "1.9.3",
+      "resolved": "https://registry.npmjs.org/angular-chosen-localytics/-/angular-chosen-localytics-1.9.3.tgz",
+      "integrity": "sha512-ruvcI8gxgeHXbycZ5rW/tkPeCy0uQfsEuGts9ectmV6Bob/bIMthWbx3tf4DUMKF0Ed7hUf2ipwGrS/ZphXB3Q==",
+      "requires": {
+        "angular": "^1.5.7",
+        "chosen-js": "^1.6.1",
+        "jquery": "^3.0.0"
+      }
+    },
     "angular-datatables": {
     "angular-datatables": {
       "version": "8.0.0",
       "version": "8.0.0",
       "resolved": "https://registry.npmjs.org/angular-datatables/-/angular-datatables-8.0.0.tgz",
       "resolved": "https://registry.npmjs.org/angular-datatables/-/angular-datatables-8.0.0.tgz",
@@ -3450,6 +3465,11 @@
         }
         }
       }
       }
     },
     },
+    "chosen-js": {
+      "version": "1.8.7",
+      "resolved": "https://registry.npmjs.org/chosen-js/-/chosen-js-1.8.7.tgz",
+      "integrity": "sha512-eVdrZJ2U5ISdObkgsi0od5vIJdLwq1P1Xa/Vj/mgxkMZf14DlgobfB6nrlFi3kW4kkvKLsKk4NDqZj1MU1DCpw=="
+    },
     "chownr": {
     "chownr": {
       "version": "1.1.3",
       "version": "1.1.3",
       "resolved": "https://registry.npmjs.org/chownr/-/chownr-1.1.3.tgz",
       "resolved": "https://registry.npmjs.org/chownr/-/chownr-1.1.3.tgz",
@@ -6978,8 +6998,7 @@
             "code-point-at": {
             "code-point-at": {
               "version": "1.1.0",
               "version": "1.1.0",
               "bundled": true,
               "bundled": true,
-              "dev": true,
-              "optional": true
+              "dev": true
             },
             },
             "concat-map": {
             "concat-map": {
               "version": "0.0.1",
               "version": "0.0.1",
@@ -6990,8 +7009,7 @@
             "console-control-strings": {
             "console-control-strings": {
               "version": "1.1.0",
               "version": "1.1.0",
               "bundled": true,
               "bundled": true,
-              "dev": true,
-              "optional": true
+              "dev": true
             },
             },
             "core-util-is": {
             "core-util-is": {
               "version": "1.0.2",
               "version": "1.0.2",
@@ -7108,8 +7126,7 @@
             "inherits": {
             "inherits": {
               "version": "2.0.4",
               "version": "2.0.4",
               "bundled": true,
               "bundled": true,
-              "dev": true,
-              "optional": true
+              "dev": true
             },
             },
             "ini": {
             "ini": {
               "version": "1.3.5",
               "version": "1.3.5",
@@ -7121,7 +7138,6 @@
               "version": "1.0.0",
               "version": "1.0.0",
               "bundled": true,
               "bundled": true,
               "dev": true,
               "dev": true,
-              "optional": true,
               "requires": {
               "requires": {
                 "number-is-nan": "^1.0.0"
                 "number-is-nan": "^1.0.0"
               }
               }
@@ -7151,7 +7167,6 @@
               "version": "2.9.0",
               "version": "2.9.0",
               "bundled": true,
               "bundled": true,
               "dev": true,
               "dev": true,
-              "optional": true,
               "requires": {
               "requires": {
                 "safe-buffer": "^5.1.2",
                 "safe-buffer": "^5.1.2",
                 "yallist": "^3.0.0"
                 "yallist": "^3.0.0"
@@ -7170,7 +7185,6 @@
               "version": "0.5.1",
               "version": "0.5.1",
               "bundled": true,
               "bundled": true,
               "dev": true,
               "dev": true,
-              "optional": true,
               "requires": {
               "requires": {
                 "minimist": "0.0.8"
                 "minimist": "0.0.8"
               }
               }
@@ -7260,8 +7274,7 @@
             "number-is-nan": {
             "number-is-nan": {
               "version": "1.0.1",
               "version": "1.0.1",
               "bundled": true,
               "bundled": true,
-              "dev": true,
-              "optional": true
+              "dev": true
             },
             },
             "object-assign": {
             "object-assign": {
               "version": "4.1.1",
               "version": "4.1.1",
@@ -7273,7 +7286,6 @@
               "version": "1.4.0",
               "version": "1.4.0",
               "bundled": true,
               "bundled": true,
               "dev": true,
               "dev": true,
-              "optional": true,
               "requires": {
               "requires": {
                 "wrappy": "1"
                 "wrappy": "1"
               }
               }
@@ -7395,7 +7407,6 @@
               "version": "1.0.2",
               "version": "1.0.2",
               "bundled": true,
               "bundled": true,
               "dev": true,
               "dev": true,
-              "optional": true,
               "requires": {
               "requires": {
                 "code-point-at": "^1.0.0",
                 "code-point-at": "^1.0.0",
                 "is-fullwidth-code-point": "^1.0.0",
                 "is-fullwidth-code-point": "^1.0.0",
@@ -8195,6 +8206,14 @@
       "integrity": "sha512-iyam8fBuCUpWeKPGpaNMetEocMt364qkCsfL9JuhjXX6dRnguRVOfk2GZaDpPjcOKiiXCPINZC1GczQ7iTq3Zw==",
       "integrity": "sha512-iyam8fBuCUpWeKPGpaNMetEocMt364qkCsfL9JuhjXX6dRnguRVOfk2GZaDpPjcOKiiXCPINZC1GczQ7iTq3Zw==",
       "dev": true
       "dev": true
     },
     },
+    "ng-select": {
+      "version": "1.0.2",
+      "resolved": "https://registry.npmjs.org/ng-select/-/ng-select-1.0.2.tgz",
+      "integrity": "sha512-QMh5NqnYrsK18J8vmRBjpcv4o9euGd5Grs+4sutNNWWDX65rJlLh+S6oUq3uvo35S2v/ZMcMMR/e5f0gMlwxlA==",
+      "requires": {
+        "tslib": "^1.9.0"
+      }
+    },
     "ng2-file-upload": {
     "ng2-file-upload": {
       "version": "1.4.0",
       "version": "1.4.0",
       "resolved": "https://registry.npmjs.org/ng2-file-upload/-/ng2-file-upload-1.4.0.tgz",
       "resolved": "https://registry.npmjs.org/ng2-file-upload/-/ng2-file-upload-1.4.0.tgz",
@@ -8359,7 +8378,8 @@
             },
             },
             "ansi-regex": {
             "ansi-regex": {
               "version": "2.1.1",
               "version": "2.1.1",
-              "bundled": true
+              "bundled": true,
+              "optional": true
             },
             },
             "aproba": {
             "aproba": {
               "version": "1.2.0",
               "version": "1.2.0",
@@ -8396,7 +8416,8 @@
             },
             },
             "code-point-at": {
             "code-point-at": {
               "version": "1.1.0",
               "version": "1.1.0",
-              "bundled": true
+              "bundled": true,
+              "optional": true
             },
             },
             "concat-map": {
             "concat-map": {
               "version": "0.0.1",
               "version": "0.0.1",
@@ -8405,7 +8426,8 @@
             },
             },
             "console-control-strings": {
             "console-control-strings": {
               "version": "1.1.0",
               "version": "1.1.0",
-              "bundled": true
+              "bundled": true,
+              "optional": true
             },
             },
             "core-util-is": {
             "core-util-is": {
               "version": "1.0.2",
               "version": "1.0.2",
@@ -8508,7 +8530,8 @@
             },
             },
             "inherits": {
             "inherits": {
               "version": "2.0.4",
               "version": "2.0.4",
-              "bundled": true
+              "bundled": true,
+              "optional": true
             },
             },
             "ini": {
             "ini": {
               "version": "1.3.5",
               "version": "1.3.5",
@@ -8518,6 +8541,7 @@
             "is-fullwidth-code-point": {
             "is-fullwidth-code-point": {
               "version": "1.0.0",
               "version": "1.0.0",
               "bundled": true,
               "bundled": true,
+              "optional": true,
               "requires": {
               "requires": {
                 "number-is-nan": "^1.0.0"
                 "number-is-nan": "^1.0.0"
               }
               }
@@ -8639,7 +8663,8 @@
             },
             },
             "number-is-nan": {
             "number-is-nan": {
               "version": "1.0.1",
               "version": "1.0.1",
-              "bundled": true
+              "bundled": true,
+              "optional": true
             },
             },
             "object-assign": {
             "object-assign": {
               "version": "4.1.1",
               "version": "4.1.1",
@@ -8649,6 +8674,7 @@
             "once": {
             "once": {
               "version": "1.4.0",
               "version": "1.4.0",
               "bundled": true,
               "bundled": true,
+              "optional": true,
               "requires": {
               "requires": {
                 "wrappy": "1"
                 "wrappy": "1"
               }
               }
@@ -8754,6 +8780,7 @@
             "string-width": {
             "string-width": {
               "version": "1.0.2",
               "version": "1.0.2",
               "bundled": true,
               "bundled": true,
+              "optional": true,
               "requires": {
               "requires": {
                 "code-point-at": "^1.0.0",
                 "code-point-at": "^1.0.0",
                 "is-fullwidth-code-point": "^1.0.0",
                 "is-fullwidth-code-point": "^1.0.0",
@@ -8771,6 +8798,7 @@
             "strip-ansi": {
             "strip-ansi": {
               "version": "3.0.1",
               "version": "3.0.1",
               "bundled": true,
               "bundled": true,
+              "optional": true,
               "requires": {
               "requires": {
                 "ansi-regex": "^2.0.0"
                 "ansi-regex": "^2.0.0"
               }
               }
@@ -8809,7 +8837,8 @@
             },
             },
             "wrappy": {
             "wrappy": {
               "version": "1.0.2",
               "version": "1.0.2",
-              "bundled": true
+              "bundled": true,
+              "optional": true
             },
             },
             "yallist": {
             "yallist": {
               "version": "3.1.1",
               "version": "3.1.1",

+ 1 - 0
package.json

@@ -43,6 +43,7 @@
     "jquery": "^3.4.1",
     "jquery": "^3.4.1",
     "mat-table-exporter": "^1.2.2",
     "mat-table-exporter": "^1.2.2",
     "moment": "^2.24.0",
     "moment": "^2.24.0",
+    "ng-select": "^1.0.2",
     "ng2-file-upload": "^1.4.0",
     "ng2-file-upload": "^1.4.0",
     "ngx-animating-datepicker": "^1.2.1",
     "ngx-animating-datepicker": "^1.2.1",
     "ngx-bootstrap": "^5.1.1",
     "ngx-bootstrap": "^5.1.1",

+ 2 - 0
src/app/app.module.ts

@@ -8,6 +8,7 @@ import { HttpClientModule, HTTP_INTERCEPTORS } from "@angular/common/http";
 import { registerLocaleData, DatePipe } from "@angular/common";
 import { registerLocaleData, DatePipe } from "@angular/common";
 import { RouterModule } from "@angular/router";
 import { RouterModule } from "@angular/router";
 import { FontAwesomeModule } from "@fortawesome/angular-fontawesome";
 import { FontAwesomeModule } from "@fortawesome/angular-fontawesome";
+import { SelectModule } from "ng-select";
 
 
 // Internationalization i18n
 // Internationalization i18n
 import localeEs from "@angular/common/locales/es";
 import localeEs from "@angular/common/locales/es";
@@ -43,6 +44,7 @@ import { MatPasswordStrengthModule } from "@angular-material-extensions/password
     PluginsModule,
     PluginsModule,
     AngularMyDatePickerModule,
     AngularMyDatePickerModule,
     FontAwesomeModule,
     FontAwesomeModule,
+    SelectModule,
     MatPasswordStrengthModule.forRoot()
     MatPasswordStrengthModule.forRoot()
   ],
   ],
   providers: [
   providers: [

+ 9 - 36
src/app/components/instruments/bonos/bonos.component.ts

@@ -239,58 +239,34 @@ export class BONO implements InstrumentComponent {
       ],
       ],
 
 
       precio_venta: [
       precio_venta: [
-        this.instrument_exists ? "" : this.instrument_work.precio_venta,
-        [
-          Validators.required,
-          Validators.pattern(/^[+]?([0-9]+(?:[\.][0-9]*)?|\.[0-9]+)$/)
-        ]
+        this.instrument_exists ? "" : this.instrument_work.precio_venta
       ],
       ],
 
 
       valor_nominal_venta: [
       valor_nominal_venta: [
-        this.instrument_exists ? "" : this.instrument_work.valor_nominal_venta,
-        [
-          Validators.required,
-          Validators.pattern(/^[+]?([0-9]+(?:[\.][0-9]*)?|\.[0-9]+)$/)
-        ]
+        this.instrument_exists ? "" : this.instrument_work.valor_nominal_venta
       ],
       ],
 
 
       precio_vencimiento_venta: [
       precio_vencimiento_venta: [
         this.instrument_exists
         this.instrument_exists
           ? ""
           ? ""
-          : this.instrument_work.precio_vencimiento_venta,
-        [
-          Validators.required,
-          Validators.pattern(/^[+]?([0-9]+(?:[\.][0-9]*)?|\.[0-9]+)$/)
-        ]
+          : this.instrument_work.precio_vencimiento_venta
       ],
       ],
 
 
       cupon_porcentaje_venta: [
       cupon_porcentaje_venta: [
         this.instrument_exists
         this.instrument_exists
           ? ""
           ? ""
-          : this.instrument_work.cupon_porcentaje_venta,
-        [
-          Validators.required,
-          Validators.pattern(/^[+]?([0-9]+(?:[\.][0-9]*)?|\.[0-9]+)$/)
-        ]
+          : this.instrument_work.cupon_porcentaje_venta
       ],
       ],
 
 
       comision_casa_porcentaje_venta: [
       comision_casa_porcentaje_venta: [
         this.instrument_exists
         this.instrument_exists
           ? ""
           ? ""
-          : this.instrument_work.comision_casa_porcentaje_venta,
-        [
-          Validators.required,
-          Validators.pattern(/^[+]?([0-9]+(?:[\.][0-9]*)?|\.[0-9]+)$/)
-        ]
+          : this.instrument_work.comision_casa_porcentaje_venta
       ],
       ],
       comision_bolsa_porcentaje_venta: [
       comision_bolsa_porcentaje_venta: [
         this.instrument_exists
         this.instrument_exists
           ? ""
           ? ""
-          : this.instrument_work.comision_bolsa_porcentaje_venta,
-        [
-          Validators.required,
-          Validators.pattern(/^[+]?([0-9]+(?:[\.][0-9]*)?|\.[0-9]+)$/)
-        ]
+          : this.instrument_work.comision_bolsa_porcentaje_venta
       ],
       ],
 
 
       fecha_ultima_cupon_compra: [
       fecha_ultima_cupon_compra: [
@@ -354,8 +330,7 @@ export class BONO implements InstrumentComponent {
                 ),
                 ),
                 formatted: this.instrument_work.fecha_ultima_cupon_venta
                 formatted: this.instrument_work.fecha_ultima_cupon_venta
               }
               }
-            },
-        Validators.required
+            }
       ],
       ],
       fecha_liquidacion_venta: [
       fecha_liquidacion_venta: [
         this.instrument_exists
         this.instrument_exists
@@ -370,8 +345,7 @@ export class BONO implements InstrumentComponent {
                 ),
                 ),
                 formatted: this.instrument_work.fecha_liquidacion_venta
                 formatted: this.instrument_work.fecha_liquidacion_venta
               }
               }
-            },
-        Validators.required
+            }
       ],
       ],
       fecha_vencimiento_venta: [
       fecha_vencimiento_venta: [
         this.instrument_exists
         this.instrument_exists
@@ -386,8 +360,7 @@ export class BONO implements InstrumentComponent {
                 ),
                 ),
                 formatted: this.instrument_work.fecha_vencimiento_venta
                 formatted: this.instrument_work.fecha_vencimiento_venta
               }
               }
-            },
-        Validators.required
+            }
       ]
       ]
     });
     });
   }
   }

+ 9 - 36
src/app/components/instruments/certificados/certificados.component.ts

@@ -239,58 +239,34 @@ export class CINV implements InstrumentComponent {
       ],
       ],
 
 
       precio_venta: [
       precio_venta: [
-        this.instrument_exists ? "" : this.instrument_work.precio_venta,
-        [
-          Validators.required,
-          Validators.pattern(/^[+]?([0-9]+(?:[\.][0-9]*)?|\.[0-9]+)$/)
-        ]
+        this.instrument_exists ? "" : this.instrument_work.precio_venta
       ],
       ],
 
 
       valor_nominal_venta: [
       valor_nominal_venta: [
-        this.instrument_exists ? "" : this.instrument_work.valor_nominal_venta,
-        [
-          Validators.required,
-          Validators.pattern(/^[+]?([0-9]+(?:[\.][0-9]*)?|\.[0-9]+)$/)
-        ]
+        this.instrument_exists ? "" : this.instrument_work.valor_nominal_venta
       ],
       ],
 
 
       precio_vencimiento_venta: [
       precio_vencimiento_venta: [
         this.instrument_exists
         this.instrument_exists
           ? ""
           ? ""
-          : this.instrument_work.precio_vencimiento_venta,
-        [
-          Validators.required,
-          Validators.pattern(/^[+]?([0-9]+(?:[\.][0-9]*)?|\.[0-9]+)$/)
-        ]
+          : this.instrument_work.precio_vencimiento_venta
       ],
       ],
 
 
       cupon_porcentaje_venta: [
       cupon_porcentaje_venta: [
         this.instrument_exists
         this.instrument_exists
           ? ""
           ? ""
-          : this.instrument_work.cupon_porcentaje_venta,
-        [
-          Validators.required,
-          Validators.pattern(/^[+]?([0-9]+(?:[\.][0-9]*)?|\.[0-9]+)$/)
-        ]
+          : this.instrument_work.cupon_porcentaje_venta
       ],
       ],
 
 
       comision_casa_porcentaje_venta: [
       comision_casa_porcentaje_venta: [
         this.instrument_exists
         this.instrument_exists
           ? ""
           ? ""
-          : this.instrument_work.comision_casa_porcentaje_venta,
-        [
-          Validators.required,
-          Validators.pattern(/^[+]?([0-9]+(?:[\.][0-9]*)?|\.[0-9]+)$/)
-        ]
+          : this.instrument_work.comision_casa_porcentaje_venta
       ],
       ],
       comision_bolsa_porcentaje_venta: [
       comision_bolsa_porcentaje_venta: [
         this.instrument_exists
         this.instrument_exists
           ? ""
           ? ""
-          : this.instrument_work.comision_bolsa_porcentaje_venta,
-        [
-          Validators.required,
-          Validators.pattern(/^[+]?([0-9]+(?:[\.][0-9]*)?|\.[0-9]+)$/)
-        ]
+          : this.instrument_work.comision_bolsa_porcentaje_venta
       ],
       ],
 
 
       fecha_ultima_cupon_compra: [
       fecha_ultima_cupon_compra: [
@@ -354,8 +330,7 @@ export class CINV implements InstrumentComponent {
                 ),
                 ),
                 formatted: this.instrument_work.fecha_ultima_cupon_venta
                 formatted: this.instrument_work.fecha_ultima_cupon_venta
               }
               }
-            },
-        Validators.required
+            }
       ],
       ],
       fecha_liquidacion_venta: [
       fecha_liquidacion_venta: [
         this.instrument_exists
         this.instrument_exists
@@ -370,8 +345,7 @@ export class CINV implements InstrumentComponent {
                 ),
                 ),
                 formatted: this.instrument_work.fecha_liquidacion_venta
                 formatted: this.instrument_work.fecha_liquidacion_venta
               }
               }
-            },
-        Validators.required
+            }
       ],
       ],
       fecha_vencimiento_venta: [
       fecha_vencimiento_venta: [
         this.instrument_exists
         this.instrument_exists
@@ -386,8 +360,7 @@ export class CINV implements InstrumentComponent {
                 ),
                 ),
                 formatted: this.instrument_work.fecha_vencimiento_venta
                 formatted: this.instrument_work.fecha_vencimiento_venta
               }
               }
-            },
-        Validators.required
+            }
       ]
       ]
     });
     });
   }
   }

+ 9 - 36
src/app/components/instruments/eurobonos/eurobonos.component.ts

@@ -239,58 +239,34 @@ export class EURB implements InstrumentComponent {
       ],
       ],
 
 
       precio_venta: [
       precio_venta: [
-        this.instrument_exists ? "" : this.instrument_work.precio_venta,
-        [
-          Validators.required,
-          Validators.pattern(/^[+]?([0-9]+(?:[\.][0-9]*)?|\.[0-9]+)$/)
-        ]
+        this.instrument_exists ? "" : this.instrument_work.precio_venta
       ],
       ],
 
 
       valor_nominal_venta: [
       valor_nominal_venta: [
-        this.instrument_exists ? "" : this.instrument_work.valor_nominal_venta,
-        [
-          Validators.required,
-          Validators.pattern(/^[+]?([0-9]+(?:[\.][0-9]*)?|\.[0-9]+)$/)
-        ]
+        this.instrument_exists ? "" : this.instrument_work.valor_nominal_venta
       ],
       ],
 
 
       precio_vencimiento_venta: [
       precio_vencimiento_venta: [
         this.instrument_exists
         this.instrument_exists
           ? ""
           ? ""
-          : this.instrument_work.precio_vencimiento_venta,
-        [
-          Validators.required,
-          Validators.pattern(/^[+]?([0-9]+(?:[\.][0-9]*)?|\.[0-9]+)$/)
-        ]
+          : this.instrument_work.precio_vencimiento_venta
       ],
       ],
 
 
       cupon_porcentaje_venta: [
       cupon_porcentaje_venta: [
         this.instrument_exists
         this.instrument_exists
           ? ""
           ? ""
-          : this.instrument_work.cupon_porcentaje_venta,
-        [
-          Validators.required,
-          Validators.pattern(/^[+]?([0-9]+(?:[\.][0-9]*)?|\.[0-9]+)$/)
-        ]
+          : this.instrument_work.cupon_porcentaje_venta
       ],
       ],
 
 
       comision_casa_porcentaje_venta: [
       comision_casa_porcentaje_venta: [
         this.instrument_exists
         this.instrument_exists
           ? ""
           ? ""
-          : this.instrument_work.comision_casa_porcentaje_venta,
-        [
-          Validators.required,
-          Validators.pattern(/^[+]?([0-9]+(?:[\.][0-9]*)?|\.[0-9]+)$/)
-        ]
+          : this.instrument_work.comision_casa_porcentaje_venta
       ],
       ],
       comision_bolsa_porcentaje_venta: [
       comision_bolsa_porcentaje_venta: [
         this.instrument_exists
         this.instrument_exists
           ? ""
           ? ""
-          : this.instrument_work.comision_bolsa_porcentaje_venta,
-        [
-          Validators.required,
-          Validators.pattern(/^[+]?([0-9]+(?:[\.][0-9]*)?|\.[0-9]+)$/)
-        ]
+          : this.instrument_work.comision_bolsa_porcentaje_venta
       ],
       ],
 
 
       fecha_ultima_cupon_compra: [
       fecha_ultima_cupon_compra: [
@@ -354,8 +330,7 @@ export class EURB implements InstrumentComponent {
                 ),
                 ),
                 formatted: this.instrument_work.fecha_ultima_cupon_venta
                 formatted: this.instrument_work.fecha_ultima_cupon_venta
               }
               }
-            },
-        Validators.required
+            }
       ],
       ],
       fecha_liquidacion_venta: [
       fecha_liquidacion_venta: [
         this.instrument_exists
         this.instrument_exists
@@ -370,8 +345,7 @@ export class EURB implements InstrumentComponent {
                 ),
                 ),
                 formatted: this.instrument_work.fecha_liquidacion_venta
                 formatted: this.instrument_work.fecha_liquidacion_venta
               }
               }
-            },
-        Validators.required
+            }
       ],
       ],
       fecha_vencimiento_venta: [
       fecha_vencimiento_venta: [
         this.instrument_exists
         this.instrument_exists
@@ -386,8 +360,7 @@ export class EURB implements InstrumentComponent {
                 ),
                 ),
                 formatted: this.instrument_work.fecha_vencimiento_venta
                 formatted: this.instrument_work.fecha_vencimiento_venta
               }
               }
-            },
-        Validators.required
+            }
       ]
       ]
     });
     });
   }
   }

+ 20 - 8
src/app/components/instruments/pbur/pbur.component.html

@@ -9,14 +9,26 @@
     <div class="row">
     <div class="row">
       <div class="col-lg-6 col-sm-12 pr-xl-3">
       <div class="col-lg-6 col-sm-12 pr-xl-3">
         <div class="form-group form-check">
         <div class="form-group form-check">
-          <input
-            type="checkbox"
-            class="form-check-input"
-            id="valor_par"
-            formControlName="valor_par"
-            [checked]="f.valor_par.value"
-          />
-          <label class="form-check-label" for="valor_par">Valor par</label>
+          <ng-container *ngIf="investmentID == undefined; else elseTemplate">
+            <input
+              type="checkbox"
+              class="form-check-input"
+              id="valor_par"
+              formControlName="valor_par"
+              [checked]="f.valor_par.value"
+            />
+            <label class="form-check-label" for="valor_par">Valor par</label>
+          </ng-container>
+          <ng-template #elseTemplate>
+            <input
+              type="hidden"
+              formControlName="valor_par"
+              [value]="f.valor_par.value"
+            />
+            <label
+              >Valor par: {{ f.valor_par.value == true ? "Si" : "No" }}</label
+            >
+          </ng-template>
         </div>
         </div>
       </div>
       </div>
 
 

+ 9 - 36
src/app/components/instruments/titulos/titulos.component.ts

@@ -243,58 +243,34 @@ export class TIT implements InstrumentComponent {
       ],
       ],
 
 
       precio_venta: [
       precio_venta: [
-        this.instrument_exists ? "" : this.instrument_work.precio_venta,
-        [
-          Validators.required,
-          Validators.pattern(/^[+]?([0-9]+(?:[\.][0-9]*)?|\.[0-9]+)$/)
-        ]
+        this.instrument_exists ? "" : this.instrument_work.precio_venta
       ],
       ],
 
 
       valor_nominal_venta: [
       valor_nominal_venta: [
-        this.instrument_exists ? "" : this.instrument_work.valor_nominal_venta,
-        [
-          Validators.required,
-          Validators.pattern(/^[+]?([0-9]+(?:[\.][0-9]*)?|\.[0-9]+)$/)
-        ]
+        this.instrument_exists ? "" : this.instrument_work.valor_nominal_venta
       ],
       ],
 
 
       precio_vencimiento_venta: [
       precio_vencimiento_venta: [
         this.instrument_exists
         this.instrument_exists
           ? ""
           ? ""
-          : this.instrument_work.precio_vencimiento_venta,
-        [
-          Validators.required,
-          Validators.pattern(/^[+]?([0-9]+(?:[\.][0-9]*)?|\.[0-9]+)$/)
-        ]
+          : this.instrument_work.precio_vencimiento_venta
       ],
       ],
 
 
       cupon_porcentaje_venta: [
       cupon_porcentaje_venta: [
         this.instrument_exists
         this.instrument_exists
           ? ""
           ? ""
-          : this.instrument_work.cupon_porcentaje_venta,
-        [
-          Validators.required,
-          Validators.pattern(/^[+]?([0-9]+(?:[\.][0-9]*)?|\.[0-9]+)$/)
-        ]
+          : this.instrument_work.cupon_porcentaje_venta
       ],
       ],
 
 
       comision_casa_porcentaje_venta: [
       comision_casa_porcentaje_venta: [
         this.instrument_exists
         this.instrument_exists
           ? ""
           ? ""
-          : this.instrument_work.comision_casa_porcentaje_venta,
-        [
-          Validators.required,
-          Validators.pattern(/^[+]?([0-9]+(?:[\.][0-9]*)?|\.[0-9]+)$/)
-        ]
+          : this.instrument_work.comision_casa_porcentaje_venta
       ],
       ],
       comision_bolsa_porcentaje_venta: [
       comision_bolsa_porcentaje_venta: [
         this.instrument_exists
         this.instrument_exists
           ? ""
           ? ""
-          : this.instrument_work.comision_bolsa_porcentaje_venta,
-        [
-          Validators.required,
-          Validators.pattern(/^[+]?([0-9]+(?:[\.][0-9]*)?|\.[0-9]+)$/)
-        ]
+          : this.instrument_work.comision_bolsa_porcentaje_venta
       ],
       ],
 
 
       fecha_ultima_cupon_compra: [
       fecha_ultima_cupon_compra: [
@@ -358,8 +334,7 @@ export class TIT implements InstrumentComponent {
                 ),
                 ),
                 formatted: this.instrument_work.fecha_ultima_cupon_venta
                 formatted: this.instrument_work.fecha_ultima_cupon_venta
               }
               }
-            },
-        Validators.required
+            }
       ],
       ],
       fecha_liquidacion_venta: [
       fecha_liquidacion_venta: [
         this.instrument_exists
         this.instrument_exists
@@ -374,8 +349,7 @@ export class TIT implements InstrumentComponent {
                 ),
                 ),
                 formatted: this.instrument_work.fecha_liquidacion_venta
                 formatted: this.instrument_work.fecha_liquidacion_venta
               }
               }
-            },
-        Validators.required
+            }
       ],
       ],
       fecha_vencimiento_venta: [
       fecha_vencimiento_venta: [
         this.instrument_exists
         this.instrument_exists
@@ -390,8 +364,7 @@ export class TIT implements InstrumentComponent {
                 ),
                 ),
                 formatted: this.instrument_work.fecha_vencimiento_venta
                 formatted: this.instrument_work.fecha_vencimiento_venta
               }
               }
-            },
-        Validators.required
+            }
       ],
       ],
       fecha_emision: [
       fecha_emision: [
         this.instrument_exists
         this.instrument_exists

+ 20 - 8
src/app/components/instruments/vcn/vcn.component.html

@@ -9,14 +9,26 @@
     <div class="row">
     <div class="row">
       <div class="col-lg-6 col-sm-12 pr-xl-3">
       <div class="col-lg-6 col-sm-12 pr-xl-3">
         <div class="form-group form-check">
         <div class="form-group form-check">
-          <input
-            type="checkbox"
-            class="form-check-input"
-            id="valor_par"
-            formControlName="valor_par"
-            [checked]="f.valor_par.value"
-          />
-          <label class="form-check-label" for="valor_par">Valor par</label>
+          <ng-container *ngIf="investmentID == undefined; else elseTemplate">
+            <input
+              type="checkbox"
+              class="form-check-input"
+              id="valor_par"
+              formControlName="valor_par"
+              [checked]="f.valor_par.value"
+            />
+            <label class="form-check-label" for="valor_par">Valor par</label>
+          </ng-container>
+          <ng-template #elseTemplate>
+            <input
+              type="hidden"
+              formControlName="valor_par"
+              [value]="f.valor_par.value"
+            />
+            <label
+              >Valor par: {{ f.valor_par.value == true ? "Si" : "No" }}</label
+            >
+          </ng-template>
         </div>
         </div>
       </div>
       </div>
 
 

+ 4 - 12
src/app/components/investment-proposals/complement-info/complement-info.component.html

@@ -80,23 +80,15 @@
                       <div class="form-group">
                       <div class="form-group">
                         <label for="emisores">Emisores: </label>
                         <label for="emisores">Emisores: </label>
 
 
-                        <select
-                          class="custom-select"
+                        <ng-select
+                          #emisorSelect
+                          [options]="emitters"
                           formControlName="emisores"
                           formControlName="emisores"
                           [ngClass]="{
                           [ngClass]="{
                             'is-invalid': submitted && f.emisores.errors
                             'is-invalid': submitted && f.emisores.errors
                           }"
                           }"
                         >
                         >
-                          <option
-                            *ngFor="let item of emitters"
-                            [value]="item.id_tipo_emisor"
-                            [selected]="
-                              item.id_tipo_emisor == complementInfo.emisores
-                            "
-                          >
-                            {{ item.nombre }}</option
-                          >
-                        </select>
+                        </ng-select>
                         <div
                         <div
                           *ngIf="submitted && f.emisores.errors"
                           *ngIf="submitted && f.emisores.errors"
                           class="invalid-feedback"
                           class="invalid-feedback"

+ 28 - 9
src/app/components/investment-proposals/complement-info/complement-info.component.ts

@@ -1,4 +1,4 @@
-import { Component, OnInit } from "@angular/core";
+import { Component, OnInit, ViewChild } from "@angular/core";
 import { Router, ActivatedRoute } from "@angular/router";
 import { Router, ActivatedRoute } from "@angular/router";
 
 
 import { ComplementInfo } from "@app/models/investment-proposal-form";
 import { ComplementInfo } from "@app/models/investment-proposal-form";
@@ -8,6 +8,7 @@ import { CatalogsService } from "@app/services/catalogs.service";
 import { IAngularMyDpOptions, IMyDateModel } from "angular-mydatepicker";
 import { IAngularMyDpOptions, IMyDateModel } from "angular-mydatepicker";
 import { formatDate, DatePipe } from "@angular/common";
 import { formatDate, DatePipe } from "@angular/common";
 import { parse } from "date-fns";
 import { parse } from "date-fns";
+import { IOption } from "ng-select";
 
 
 @Component({
 @Component({
   selector: "app-complement-info",
   selector: "app-complement-info",
@@ -54,7 +55,7 @@ export class ComplementInfoComponent implements OnInit {
   submitted: boolean = false;
   submitted: boolean = false;
   role_number: any;
   role_number: any;
   markets: any;
   markets: any;
-  emitters: any;
+  emitters: Array<IOption>;
   periodicities: any;
   periodicities: any;
   rate_agencies: any;
   rate_agencies: any;
   scores: any;
   scores: any;
@@ -68,6 +69,9 @@ export class ComplementInfoComponent implements OnInit {
   complementInfoDontExists: boolean;
   complementInfoDontExists: boolean;
   companyValue: any;
   companyValue: any;
   instrumentInfo: any;
   instrumentInfo: any;
+  @ViewChild("emisorSelect", { static: false })
+  public emisorSelect: any;
+
   constructor(
   constructor(
     private router: Router,
     private router: Router,
     private route: ActivatedRoute,
     private route: ActivatedRoute,
@@ -87,8 +91,8 @@ export class ComplementInfoComponent implements OnInit {
     this.complementInfoDontExists = this.complementInfo == undefined;
     this.complementInfoDontExists = this.complementInfo == undefined;
 
 
     this.instrumentInfo = this.formDataService.getGeneralInfo().instrumentos;
     this.instrumentInfo = this.formDataService.getGeneralInfo().instrumentos;
-    console.log("instrumento");
     console.log(this.instrumentInfo);
     console.log(this.instrumentInfo);
+    console.log(this.complementInfo);
 
 
     this.catalogService.getCatalogInfo("empresas").subscribe(res => {
     this.catalogService.getCatalogInfo("empresas").subscribe(res => {
       this.companies = res;
       this.companies = res;
@@ -110,7 +114,17 @@ export class ComplementInfoComponent implements OnInit {
       this.markets = res;
       this.markets = res;
     });
     });
     this.catalogService.getCatalogInfo("tipos-emisores").subscribe(res => {
     this.catalogService.getCatalogInfo("tipos-emisores").subscribe(res => {
-      this.emitters = res;
+      this.emitters = [];
+      for (let property in res) {
+        this.emitters.push({
+          label: res[property]["nombre"],
+          value: res[property]["id_tipo_emisor"].toString()
+        });
+      }
+
+      if (this.complementInfo.emisores.toString() != "") {
+        this.emisorSelect.select(this.complementInfo.emisores.toString());
+      }
     });
     });
 
 
     this.catalogService.getRateAgencies().subscribe(res => {
     this.catalogService.getRateAgencies().subscribe(res => {
@@ -136,7 +150,9 @@ export class ComplementInfoComponent implements OnInit {
       ],
       ],
 
 
       emisores: [
       emisores: [
-        this.complementInfoDontExists ? "" : this.complementInfo.emisores,
+        this.complementInfoDontExists
+          ? ""
+          : this.complementInfo.emisores.toString(),
         [Validators.required]
         [Validators.required]
       ],
       ],
       empresa: [
       empresa: [
@@ -167,17 +183,20 @@ export class ComplementInfoComponent implements OnInit {
     });
     });
 
 
     // Set default values depending of the instrument
     // Set default values depending of the instrument
-    if (this.complementInfoDontExists == true) {
+    if (
+      this.complementInfoDontExists == true ||
+      Object.values(this.complementInfo).every(x => x === null || x === "")
+    ) {
       switch (this.instrumentInfo) {
       switch (this.instrumentInfo) {
         case "LETE":
         case "LETE":
           this.investmentProposalForm.patchValue({
           this.investmentProposalForm.patchValue({
-            emisores: this.investmentProposalForm.value.emisores = 985,
+            emisores: this.investmentProposalForm.value.emisores = "985",
             pais: this.investmentProposalForm.value.pais = 210
             pais: this.investmentProposalForm.value.pais = 210
           });
           });
-
+          break;
         case "CETE":
         case "CETE":
           this.investmentProposalForm.patchValue({
           this.investmentProposalForm.patchValue({
-            emisores: this.investmentProposalForm.value.emisores = 985,
+            emisores: this.investmentProposalForm.value.emisores = "985",
             pais: this.investmentProposalForm.value.pais = 210,
             pais: this.investmentProposalForm.value.pais = 210,
             operaciones: this.investmentProposalForm.value.operaciones = 2
             operaciones: this.investmentProposalForm.value.operaciones = 2
           });
           });

+ 10 - 24
src/app/components/investment-proposals/general-info/general-info.component.html

@@ -138,22 +138,16 @@
                             else elseTemplate
                             else elseTemplate
                           "
                           "
                         >
                         >
-                          <select
-                            class="custom-select"
+                          <ng-select
+                            #instrumentType
+                            [options]="instrumentTypes"
                             formControlName="instrumentos"
                             formControlName="instrumentos"
                             [ngClass]="{
                             [ngClass]="{
                               'is-invalid': submitted && f.instrumentos.errors
                               'is-invalid': submitted && f.instrumentos.errors
                             }"
                             }"
-                            (change)="pre_filled_fields($event)"
+                            (selected)="pre_filled_fields($event)"
                           >
                           >
-                            <option
-                              *ngFor="let item of instrumentTypes"
-                              [selected]="item.codigo == general.instrumentos"
-                              [value]="item.codigo"
-                            >
-                              {{ item.nombre }}</option
-                            >
-                          </select>
+                          </ng-select>
                         </ng-container>
                         </ng-container>
                         <ng-template #elseTemplate>
                         <ng-template #elseTemplate>
                           <input
                           <input
@@ -308,24 +302,16 @@
                     <div class="col-lg-6 col-sm-12 pr-xl-3">
                     <div class="col-lg-6 col-sm-12 pr-xl-3">
                       <div class="form-group">
                       <div class="form-group">
                         <label for="casa">Casa: </label>
                         <label for="casa">Casa: </label>
-
-                        <select
-                          class="custom-select"
+                        <ng-select
+                          #casaSelect
+                          [options]="financials"
                           formControlName="casa"
                           formControlName="casa"
                           [ngClass]="{
                           [ngClass]="{
                             'is-invalid': submitted && f.casa.errors
                             'is-invalid': submitted && f.casa.errors
                           }"
                           }"
                         >
                         >
-                          <option
-                            *ngFor="let item of financials"
-                            [value]="item.id_entidad_financiera"
-                            [selected]="
-                              item.id_entidad_financiera == general.casa
-                            "
-                          >
-                            {{ item.nombre }}
-                          </option>
-                        </select>
+                        </ng-select>
+
                         <div
                         <div
                           *ngIf="submitted && f.casa.errors"
                           *ngIf="submitted && f.casa.errors"
                           class="invalid-feedback"
                           class="invalid-feedback"

+ 46 - 10
src/app/components/investment-proposals/general-info/general-info.component.ts

@@ -4,7 +4,8 @@ import {
   OnChanges,
   OnChanges,
   ViewChild,
   ViewChild,
   ComponentRef,
   ComponentRef,
-  Type
+  Type,
+  ElementRef
 } from "@angular/core";
 } from "@angular/core";
 import { FormBuilder, FormGroup, Validators } from "@angular/forms";
 import { FormBuilder, FormGroup, Validators } from "@angular/forms";
 import Swal from "sweetalert2";
 import Swal from "sweetalert2";
@@ -19,6 +20,7 @@ import { IAngularMyDpOptions, IMyDateModel } from "angular-mydatepicker";
 import { InvestmentsService } from "@app/services/investments.service";
 import { InvestmentsService } from "@app/services/investments.service";
 import { DatePipe } from "@angular/common";
 import { DatePipe } from "@angular/common";
 import { parse } from "date-fns";
 import { parse } from "date-fns";
+import { IOption } from "ng-select";
 
 
 @Component({
 @Component({
   selector: "app-new-investment-proposal",
   selector: "app-new-investment-proposal",
@@ -73,11 +75,11 @@ export class InvestmentProposalGeneralInfoComponent
   rates: any;
   rates: any;
   revenues: any;
   revenues: any;
   funds: any;
   funds: any;
-  instrumentTypes: any;
+  instrumentTypes: Array<IOption>;
   generalInfoDontExists: boolean;
   generalInfoDontExists: boolean;
   plazos: any;
   plazos: any;
   base_types: any;
   base_types: any;
-  financials: any;
+  financials: Array<IOption>;
   format_incomes: any;
   format_incomes: any;
 
 
   gInfo: any;
   gInfo: any;
@@ -86,6 +88,17 @@ export class InvestmentProposalGeneralInfoComponent
   datez: any;
   datez: any;
   instrumentName: any;
   instrumentName: any;
   instrumentValue: any;
   instrumentValue: any;
+
+  myOptions: Array<IOption> = [
+    { label: "Belgium", value: "BE" },
+    { label: "Luxembourg", value: "LU" },
+    { label: "Netherlands", value: "NL" }
+  ];
+
+  @ViewChild("instrumentType", { static: false })
+  public instrumentType: any;
+  @ViewChild("casaSelect", { static: false })
+  public casaSelect: any;
   constructor(
   constructor(
     private formBuilder: FormBuilder,
     private formBuilder: FormBuilder,
     private router: Router,
     private router: Router,
@@ -197,19 +210,21 @@ export class InvestmentProposalGeneralInfoComponent
               this.formDataService.setGeneralInfo(this.gInfo);
               this.formDataService.setGeneralInfo(this.gInfo);
               this.general = this.formDataService.getGeneralInfo();
               this.general = this.formDataService.getGeneralInfo();
               this.generalInfoDontExists = this.general == undefined;
               this.generalInfoDontExists = this.general == undefined;
-              this.investmentProposalForm.setValue({
+              this.investmentProposalForm.patchValue({
                 asunto: this.gInfo.asunto,
                 asunto: this.gInfo.asunto,
                 origenes_fondo: this.gInfo.origenes_fondo,
                 origenes_fondo: this.gInfo.origenes_fondo,
                 name: this.gInfo.name,
                 name: this.gInfo.name,
                 tipo_tasa: this.gInfo.tipo_tasa,
                 tipo_tasa: this.gInfo.tipo_tasa,
                 tipo_renta: this.gInfo.tipo_renta,
                 tipo_renta: this.gInfo.tipo_renta,
                 periodicidad: this.gInfo.periodicidad,
                 periodicidad: this.gInfo.periodicidad,
-
                 instrumentos: this.gInfo.instrumentos,
                 instrumentos: this.gInfo.instrumentos,
                 base_anual: this.gInfo.base_anual,
                 base_anual: this.gInfo.base_anual,
-                casa: this.gInfo.casa,
+                casa: this.gInfo.casa.toString(),
                 formato_ingreso: this.gInfo.formato_ingreso
                 formato_ingreso: this.gInfo.formato_ingreso
               });
               });
+              if (this.gInfo.casa != "") {
+                this.casaSelect.select(this.gInfo.casa.toString());
+              }
             }
             }
 
 
             this.instrument = this.formDataService.getWork();
             this.instrument = this.formDataService.getWork();
@@ -249,7 +264,13 @@ export class InvestmentProposalGeneralInfoComponent
     });
     });
 
 
     this.catalogService.getFinancialEntities().subscribe(res => {
     this.catalogService.getFinancialEntities().subscribe(res => {
-      this.financials = res;
+      this.financials = [];
+      for (let property in res) {
+        this.financials.push({
+          label: res[property]["nombre"],
+          value: res[property]["id_entidad_financiera"].toString()
+        });
+      }
     });
     });
 
 
     this.catalogService.getBaseTypes().subscribe(res => {
     this.catalogService.getBaseTypes().subscribe(res => {
@@ -269,8 +290,23 @@ export class InvestmentProposalGeneralInfoComponent
       this.funds = res;
       this.funds = res;
     });
     });
     this.catalogService.getInstrumentTypes().subscribe(res => {
     this.catalogService.getInstrumentTypes().subscribe(res => {
-      this.instrumentTypes = res;
+      res;
+      this.instrumentTypes = [];
+
+      for (let property in res) {
+        this.instrumentTypes.push({
+          label: res[property]["nombre"],
+          value: res[property]["codigo"]
+        });
+      }
       if (this.generalInfoDontExists == false) {
       if (this.generalInfoDontExists == false) {
+        if (
+          this.instrumentType != undefined &&
+          (this.general.instrumentos != "" ||
+            this.general.instrumentos != undefined)
+        ) {
+          this.instrumentType.select(this.general.instrumentos);
+        }
         this.instrumentName = res.find(
         this.instrumentName = res.find(
           e => e.codigo == this.general.instrumentos
           e => e.codigo == this.general.instrumentos
         );
         );
@@ -351,8 +387,8 @@ export class InvestmentProposalGeneralInfoComponent
     return this.investmentProposalForm.controls;
     return this.investmentProposalForm.controls;
   }
   }
 
 
-  pre_filled_fields(event: any) {
-    const selectedInstrument = (event.target as HTMLInputElement).value;
+  pre_filled_fields(event: IOption) {
+    const selectedInstrument = event.value;
     switch (selectedInstrument) {
     switch (selectedInstrument) {
       case "LETE":
       case "LETE":
         this.investmentProposalForm.patchValue({
         this.investmentProposalForm.patchValue({

+ 13 - 0
src/app/components/investment-proposals/investment-proposals.component.html

@@ -121,6 +121,19 @@
                       >
                       >
                         <i class="fas fa-info"></i>
                         <i class="fas fa-info"></i>
                       </a>
                       </a>
+                      <a
+                        *ngIf="
+                          can_upload_file(
+                            row.id_estado_inversion.codigo,
+                            row.hoja_liquidacion
+                          ) && userType(userRole, 'analistas')
+                        "
+                        title="Subir hoja de liquidación"
+                        class="btn btn-danger btn-custom-small"
+                        (click)="upload_liquidation_file(row.id_inversion)"
+                      >
+                        <i class="fas fa-file-upload"></i>
+                      </a>
                       <a
                       <a
                         *ngIf="
                         *ngIf="
                           can_modify(row.id_estado_inversion.codigo) &&
                           can_modify(row.id_estado_inversion.codigo) &&

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

@@ -6,5 +6,5 @@
 
 
 .btn-custom-small {
 .btn-custom-small {
   padding: 7px 12px 5px 13px;
   padding: 7px 12px 5px 13px;
-  margin: 0 4px;
+  margin: 5px 4px;
 }
 }

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

@@ -130,6 +130,19 @@ export class InvestmentProposalsComponent implements OnInit {
     }
     }
   }
   }
 
 
+  upload_liquidation_file(id: string) {
+    this.formInvestmentProposal.resetFormData();
+    Swal.fire({
+      allowOutsideClick: false,
+      icon: "info",
+      text: "Espere por favor..."
+    });
+    Swal.showLoading();
+    setTimeout(() => {
+      this.router.navigate([`/investment-proposal/${id}/upload-file`]);
+    }, 1000);
+  }
+
   view_investment_proposal(id: string) {
   view_investment_proposal(id: string) {
     this.formInvestmentProposal.resetFormData();
     this.formInvestmentProposal.resetFormData();
     Swal.fire({
     Swal.fire({
@@ -186,6 +199,21 @@ export class InvestmentProposalsComponent implements OnInit {
     }
     }
   }
   }
 
 
+  can_upload_file(status: string, file: string) {
+    if (
+      (status == "APROB" ||
+        status == "LIQUI" ||
+        status == "COMPR" ||
+        status == "PGAPR" ||
+        status == "LIQUI") &&
+      file == null
+    ) {
+      return true;
+    } else {
+      return false;
+    }
+  }
+
   // Verifica permisos para mostrar boton de edicion y/o envio a revision,
   // Verifica permisos para mostrar boton de edicion y/o envio a revision,
   // segun los permisos del usuario y el estado de la propuesta
   // segun los permisos del usuario y el estado de la propuesta
   can_modify_or_send_to_review(status: string) {
   can_modify_or_send_to_review(status: string) {

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

@@ -16,6 +16,7 @@ import { InstrumentsService } from "@app/services/instruments.service";
 import Swal from "sweetalert2";
 import Swal from "sweetalert2";
 import { CatalogsService } from "@app/services/catalogs.service";
 import { CatalogsService } from "@app/services/catalogs.service";
 import { InvestmentsService } from "@app/services/investments.service";
 import { InvestmentsService } from "@app/services/investments.service";
+import { environment } from "@environments/environment";
 
 
 @Component({
 @Component({
   selector: "app-investment-proposal-detail",
   selector: "app-investment-proposal-detail",
@@ -74,6 +75,8 @@ export class InvestmentProposalDetailComponent implements OnInit {
   fecha_pago: any;
   fecha_pago: any;
   cuenta_bancaria_destino: any;
   cuenta_bancaria_destino: any;
   emitir_nombre: any;
   emitir_nombre: any;
+  liquidation_file: any;
+  fileDownload: string;
 
 
   constructor(
   constructor(
     private router: Router,
     private router: Router,
@@ -103,7 +106,9 @@ export class InvestmentProposalDetailComponent implements OnInit {
         .getProposalInvestment(this.investmentProposalID)
         .getProposalInvestment(this.investmentProposalID)
         .subscribe(res => {
         .subscribe(res => {
           this.state = res["result"]["id_estado_inversion"]["codigo"];
           this.state = res["result"]["id_estado_inversion"]["codigo"];
+          this.fileDownload = environment.productionMediaUrl;
 
 
+          this.liquidation_file = res["result"]["hoja_liquidacion"];
           this.gInfo = {
           this.gInfo = {
             asunto: res["result"]["asunto"],
             asunto: res["result"]["asunto"],
             origenes_fondo:
             origenes_fondo:
@@ -202,7 +207,6 @@ export class InvestmentProposalDetailComponent implements OnInit {
             this.investmentName = this.general.name;
             this.investmentName = this.general.name;
             this.comment = this.complement.comentarios;
             this.comment = this.complement.comentarios;
             this.justification = this.complement.justificacion;
             this.justification = this.complement.justificacion;
-
             this.catalogService.getFinancialEntities().subscribe(res => {
             this.catalogService.getFinancialEntities().subscribe(res => {
               this.financials = res.find(
               this.financials = res.find(
                 e => e.id_entidad_financiera == this.general.casa
                 e => e.id_entidad_financiera == this.general.casa

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

@@ -249,6 +249,7 @@ export class ResultComponent implements OnInit {
         this.inversion["codigo_instrumento"] == "TIT" ||
         this.inversion["codigo_instrumento"] == "TIT" ||
         this.inversion["codigo_instrumento"] == "EURB" ||
         this.inversion["codigo_instrumento"] == "EURB" ||
         this.inversion["codigo_instrumento"] == "CINV" ||
         this.inversion["codigo_instrumento"] == "CINV" ||
+        this.inversion["codigo_instrumento"] == "FINV" ||
         this.inversion["codigo_instrumento"] == "PBUR") &&
         this.inversion["codigo_instrumento"] == "PBUR") &&
       (this.instrument["proyecciones"] != undefined ||
       (this.instrument["proyecciones"] != undefined ||
         this.instrument["proyecciones"] != "")
         this.instrument["proyecciones"] != "")

+ 130 - 0
src/app/components/investment-proposals/upload-liquidation/upload-liquidation.component.html

@@ -0,0 +1,130 @@
+<h2 class="floating-title">{{ title }}</h2>
+
+<div class="main-content">
+  <div class="container-fluid">
+    <div class="row">
+      <div class="col-12 align-right">
+        <div class="align-container">
+          <nav aria-label="breadcrumb">
+            <ol class="breadcrumb">
+              <li class="breadcrumb-item">
+                <a [routerLink]="['/']">Dashboard</a>
+              </li>
+              <li class="breadcrumb-item">
+                <a [routerLink]="['/investment-proposals']">
+                  Propuestas de inversión
+                </a>
+              </li>
+              <li class="breadcrumb-item">Hoja de liquidación</li>
+            </ol>
+          </nav>
+        </div>
+      </div>
+
+      <br />
+    </div>
+    <br />
+    <div class="row justify-content-center">
+      <div class="col-12">
+        <div class="align-container">
+          <div class="card borderless">
+            <div class="card-header card-header-icon card-header-rose">
+              <h4 class="card-title">
+                Subir archivo de hoja de liquidación
+              </h4>
+            </div>
+            <div class="card-body">
+              <div class="align-container">
+                <div class="instrument-calcs">
+                  <div class="row">
+                    <div class="col-12">
+                      <span class="badge badge-success badge-custom"
+                        >Información básica de la inversión</span
+                      >
+                    </div>
+                    <div class="col-sm-12">
+                      <h4>Estado de la propuesta de inversión:</h4>
+                      <div class="field">{{ estado }}</div>
+                    </div>
+                    <div class="col-sm-6">
+                      <h4>Código de la propuesta de inversión:</h4>
+                      <div class="field">{{ codigo_inversion }}</div>
+                    </div>
+                    <div class="col-sm-6">
+                      <h4>Instrumento:</h4>
+                      <div class="field">{{ instrumento }}</div>
+                    </div>
+                    <div class="col-sm-6">
+                      <h4>Emisor:</h4>
+                      <div class="field">{{ emisor }}</div>
+                    </div>
+                    <div class="col-sm-6">
+                      <h4>Empresa:</h4>
+                      <div class="field">{{ empresa }}</div>
+                    </div>
+                  </div>
+                </div>
+
+                <br />
+
+                <form
+                  class="form-auth-small ng-untouched ng-pristine ng-valid"
+                  [formGroup]="investmentProposalForm"
+                >
+                  <div class="row">
+                    <div class="col-lg-6 col-sm-12 pr-xl-6">
+                      <div class="form-group">
+                        <label for="hoja_liquidacion">Archivo: </label>
+
+                        <input
+                          type="file"
+                          name="hoja_liquidacion"
+                          (change)="fileProgress($event)"
+                          [ngClass]="{
+                            'is-invalid': submitted && fileData == null
+                          }"
+                        />
+                        <div
+                          *ngIf="submitted && fileData == null"
+                          class="invalid-feedback"
+                        >
+                          Campo requerido
+                        </div>
+                      </div>
+                      <br />
+                      <div *ngIf="fileUploadProgress">
+                        Progreso: {{ fileUploadProgress }}
+                      </div>
+                      <div class="image-preview mb-3" *ngIf="previewUrl">
+                        <img [src]="previewUrl" height="300" />
+                      </div>
+
+                      <div class="mb-3" *ngIf="uploadedFilePath">
+                        {{ uploadedFilePath }}
+                      </div>
+                    </div>
+                  </div>
+                  <br />
+                  <div class="row">
+                    <div class="col-lg-12 col-sm-12 align-right">
+                      <div class="form-group">
+                        <button
+                          class="btn btn-primary"
+                          (click)="onSubmit(investmentProposalForm)"
+                          type="submit"
+                        >
+                          Subir archivo
+                        </button>
+                      </div>
+                    </div>
+                  </div>
+                  <br />
+                </form>
+              </div>
+            </div>
+          </div>
+        </div>
+      </div>
+    </div>
+  </div>
+</div>

+ 34 - 0
src/app/components/investment-proposals/upload-liquidation/upload-liquidation.component.scss

@@ -0,0 +1,34 @@
+.area {
+  width: 77%;
+  padding: 15px;
+  margin: 15px;
+  border: 1px solid #333;
+  background: rgba(0, 0, 0, 0.7);
+}
+
+#dropZone {
+  border: 2px dashed #bbb;
+  -webkit-border-radius: 5px;
+  border-radius: 5px;
+  padding: 50px;
+  text-align: center;
+  font: 21pt bold arial;
+  color: #bbb;
+}
+
+.drop-file-over {
+  background: #333;
+}
+
+.form-group input[type="file"] {
+  opacity: 1;
+  z-index: 1;
+  position: relative;
+}
+
+.invalid-feedback {
+  background-color: #f44336;
+  color: #fff;
+  border: 1px solid #f20221;
+  padding: 2px;
+}

+ 144 - 0
src/app/components/investment-proposals/upload-liquidation/upload-liquidation.component.ts

@@ -0,0 +1,144 @@
+import { Component, OnInit, ComponentFactoryResolver } from "@angular/core";
+import { FileUploader, FileLikeObject } from "ng2-file-upload";
+import { concat } from "rxjs";
+import { FormBuilder, FormGroup, Validators } from "@angular/forms";
+import { HttpClient, HttpEventType } from "@angular/common/http";
+import { FormInvestmentProposalService } from "@app/services/form-investment-proposal.service";
+import { InvestmentProposalWorkflowService } from "@app/services/investment-proposal-workflow.service";
+import { InstrumentsService } from "@app/services/instruments.service";
+import { CatalogsService } from "@app/services/catalogs.service";
+import { ActivatedRoute } from "@angular/router";
+import { InvestmentsService } from "@app/services/investments.service";
+import Swal from "sweetalert2";
+import { IAngularMyDpOptions } from "angular-mydatepicker";
+
+@Component({
+  selector: "app-upload-liquidation",
+  templateUrl: "./upload-liquidation.component.html",
+  styleUrls: ["./upload-liquidation.component.scss"]
+})
+export class UploadLiquidationComponent implements OnInit {
+  title: string = "Subir hoja de liquidación";
+  // For daterange
+
+  form: FormGroup;
+  fileData: File = null;
+  previewUrl: any = null;
+  fileUploadProgress: string = null;
+  uploadedFilePath: string = null;
+  interval: any;
+  indexDynamicComponent: number;
+  investmentProposalID: string;
+  investmentExists;
+  codigo_inversion: string = "";
+  empresa: string = "";
+  estado: string = "";
+  emisor: string = "";
+  instrumento: string = "";
+
+  investmentProposalForm: FormGroup;
+  submitted: boolean = false;
+  paymentObject: Object;
+
+  constructor(
+    private http: HttpClient,
+
+    private formDataService: FormInvestmentProposalService,
+    private componentFactoryResolver: ComponentFactoryResolver,
+    private instrumentService: InvestmentProposalWorkflowService,
+    private loadInstrumentsService: InstrumentsService,
+    private catalogService: CatalogsService,
+    private route: ActivatedRoute,
+    private investmentService: InvestmentsService,
+    private formBuilder: FormBuilder,
+
+    private investmentsService: InvestmentsService
+  ) {}
+
+  ngOnInit() {
+    //this.formDataService
+    //this.ads = this.loadInstrumentsService.getInstruments();
+    this.route.params.subscribe(params => {
+      this.investmentProposalID = params["id"];
+    });
+    if (this.investmentProposalID == undefined)
+      this.investmentProposalID = this.route.snapshot.queryParamMap.get("id");
+
+    this.investmentService
+      .getProposalInvestment(this.investmentProposalID)
+      .subscribe(resp => {
+        this.codigo_inversion = resp["result"]["codigo_inversion"];
+        this.estado = resp["result"]["id_estado_inversion"]["nombre"];
+        this.instrumento =
+          resp["result"]["id_inversion_instrumento"]["id_tipo_instrumento"][
+            "nombre"
+          ];
+        this.emisor = resp["result"]["id_tipo_emisor"]["nombre"];
+
+        this.empresa = resp["result"]["id_empresa"]["nombre"];
+        Swal.close();
+      });
+
+    this.investmentProposalForm = this.formBuilder.group({
+      id_inversion: [this.investmentProposalID]
+    });
+  }
+
+  fileProgress(fileInput: any) {
+    this.fileData = <File>fileInput.target.files[0];
+    this.preview();
+  }
+
+  preview() {
+    // Show preview
+    var mimeType = this.fileData.type;
+    if (mimeType.match(/image\/*/) == null) {
+      return;
+    }
+
+    var reader = new FileReader();
+    reader.readAsDataURL(this.fileData);
+    reader.onload = _event => {
+      this.previewUrl = reader.result;
+    };
+  }
+
+  get f() {
+    return this.investmentProposalForm.controls;
+  }
+
+  onSubmit(form: any) {
+    this.submitted = true;
+    if (this.fileData == null) {
+      return false;
+    }
+
+    const formData = new FormData();
+    formData.append("id_inversion", this.investmentProposalID);
+    formData.append("hoja_liquidacion", this.fileData);
+
+    this.investmentService.sendLiquidationFile(formData).subscribe(
+      success => {
+        if (success) {
+          Swal.fire({
+            allowOutsideClick: false,
+            icon: "success",
+            showCancelButton: false,
+            title: "Exito",
+            confirmButtonText: "Se ha subido la hoja de liquidación"
+          }).then(result => {
+            Swal.close();
+            window.location.href = "#/investment-proposals";
+          });
+        }
+      },
+      err => {
+        Swal.fire({
+          icon: "error",
+          title: "Error en el servidor",
+          text: err.message
+        });
+      }
+    );
+  }
+}

+ 6 - 28
src/app/layouts/admin/admin.module.ts

@@ -13,8 +13,6 @@ import { ProfileComponent } from "../../components/profile/profile.component";
 import { PluginsModule } from "../../components/plugins/plugins.module";
 import { PluginsModule } from "../../components/plugins/plugins.module";
 
 
 import { MatDialogModule, MatPaginatorIntl } from "@angular/material";
 import { MatDialogModule, MatPaginatorIntl } from "@angular/material";
-import { BrowserModule } from "@angular/platform-browser";
-import { NoopAnimationsModule } from "@angular/platform-browser/animations";
 
 
 import { MatTableExporterModule } from "mat-table-exporter";
 import { MatTableExporterModule } from "mat-table-exporter";
 import {
 import {
@@ -31,12 +29,6 @@ import {
 } from "@angular/material";
 } from "@angular/material";
 
 
 import { MatPasswordStrengthModule } from "@angular-material-extensions/password-strength";
 import { MatPasswordStrengthModule } from "@angular-material-extensions/password-strength";
-import {
-  BreadcrumbModule,
-  IconsModule,
-  WavesModule
-} from "angular-bootstrap-md";
-
 import { TermsComponent } from "@app/components/terms/terms.component";
 import { TermsComponent } from "@app/components/terms/terms.component";
 import { InvestmentProposalsComponent } from "@app/components/investment-proposals/investment-proposals.component";
 import { InvestmentProposalsComponent } from "@app/components/investment-proposals/investment-proposals.component";
 import { InvestmentProposalGeneralInfoComponent } from "@app/components/investment-proposals/general-info/general-info.component";
 import { InvestmentProposalGeneralInfoComponent } from "@app/components/investment-proposals/general-info/general-info.component";
@@ -59,8 +51,6 @@ import { PBUR } from "@app/components/instruments/pbur/pbur.component";
 
 
 import { BONO } from "@app/components/instruments/bonos/bonos.component";
 import { BONO } from "@app/components/instruments/bonos/bonos.component";
 import { DAP } from "@app/components/instruments/dap/dap.component";
 import { DAP } from "@app/components/instruments/dap/dap.component";
-import { ANCComponent } from "@app/components/instruments/anc/anc.component";
-import { APNComponent } from "@app/components/instruments/apn/apn.component";
 
 
 import { InstrumentDirective } from "@app/components/investment-proposals/instrument/instrument.directive";
 import { InstrumentDirective } from "@app/components/investment-proposals/instrument/instrument.directive";
 import { WorkflowGuard } from "@app/services/investment-proposal-workflow.guard";
 import { WorkflowGuard } from "@app/services/investment-proposal-workflow.guard";
@@ -82,6 +72,8 @@ import { EURB } from "@app/components/instruments/eurobonos/eurobonos.component"
 import { CINV } from "@app/components/instruments/certificados/certificados.component";
 import { CINV } from "@app/components/instruments/certificados/certificados.component";
 import { MatPaginatorIntlSpa } from "@app/models/i18n-paginator";
 import { MatPaginatorIntlSpa } from "@app/models/i18n-paginator";
 import { FINV } from "@app/components/instruments/fondos/fondos.component";
 import { FINV } from "@app/components/instruments/fondos/fondos.component";
+import { UploadLiquidationComponent } from "@app/components/investment-proposals/upload-liquidation/upload-liquidation.component";
+import { SelectModule } from "ng-select";
 
 
 // This array defines which "componentId" maps to which lazy-loaded module.
 // This array defines which "componentId" maps to which lazy-loaded module.
 
 
@@ -107,7 +99,7 @@ import { FINV } from "@app/components/instruments/fondos/fondos.component";
     AngularMyDatePickerModule,
     AngularMyDatePickerModule,
     MatPasswordStrengthModule,
     MatPasswordStrengthModule,
     HttpClientModule,
     HttpClientModule,
-    WavesModule
+    SelectModule
   ],
   ],
   providers: [
   providers: [
     { provide: MatPaginatorIntl, useClass: MatPaginatorIntlSpa },
     { provide: MatPaginatorIntl, useClass: MatPaginatorIntlSpa },
@@ -148,8 +140,6 @@ import { FINV } from "@app/components/instruments/fondos/fondos.component";
     EURB,
     EURB,
     CINV,
     CINV,
     FINV,
     FINV,
-    ANCComponent,
-    APNComponent,
     InstrumentDirective,
     InstrumentDirective,
     PaymentInfoComponent,
     PaymentInfoComponent,
     PaymentRequirementComponent,
     PaymentRequirementComponent,
@@ -159,21 +149,9 @@ import { FINV } from "@app/components/instruments/fondos/fondos.component";
     PBURCostsComponent,
     PBURCostsComponent,
     IncomesComponent,
     IncomesComponent,
     GeneralIncomeFormComponent,
     GeneralIncomeFormComponent,
-    PaymentApprovalComponent
+    PaymentApprovalComponent,
+    UploadLiquidationComponent
   ],
   ],
-  entryComponents: [
-    LETE,
-    CETE,
-    VCN,
-    PBUR,
-    BONO,
-    DAP,
-    TIT,
-    EURB,
-    CINV,
-    FINV,
-    ANCComponent,
-    APNComponent
-  ]
+  entryComponents: [LETE, CETE, VCN, PBUR, BONO, DAP, TIT, EURB, CINV, FINV]
 })
 })
 export class AdminModule {}
 export class AdminModule {}

+ 5 - 0
src/app/layouts/admin/admin.routing.ts

@@ -31,6 +31,7 @@ import { PBURCostsComponent } from "@app/components/investments/costs/pbur/pbur.
 import { IncomesComponent } from "@app/components/incomes/incomes.component";
 import { IncomesComponent } from "@app/components/incomes/incomes.component";
 import { GeneralIncomeFormComponent } from "@app/components/incomes/general-form/general-form.component";
 import { GeneralIncomeFormComponent } from "@app/components/incomes/general-form/general-form.component";
 import { PaymentApprovalComponent } from "@app/components/investment-proposals/payment-approval/payment-approval.component";
 import { PaymentApprovalComponent } from "@app/components/investment-proposals/payment-approval/payment-approval.component";
+import { UploadLiquidationComponent } from "@app/components/investment-proposals/upload-liquidation/upload-liquidation.component";
 
 
 export const AdminLayoutRoutes: Routes = [
 export const AdminLayoutRoutes: Routes = [
   {
   {
@@ -196,6 +197,10 @@ export const AdminLayoutRoutes: Routes = [
     path: "investment-proposal/:id/payment",
     path: "investment-proposal/:id/payment",
     component: PaymentRequirementComponent
     component: PaymentRequirementComponent
   },
   },
+  {
+    path: "investment-proposal/:id/upload-file",
+    component: UploadLiquidationComponent
+  },
   {
   {
     path: "investment-proposal/:id",
     path: "investment-proposal/:id",
     component: InvestmentProposalDetailComponent
     component: InvestmentProposalDetailComponent

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

@@ -95,6 +95,17 @@ export class InvestmentsService {
       );
       );
   }
   }
 
 
+  sendLiquidationFile(inversion: Object): Observable<boolean> {
+    return this.http
+      .post<any>(`${environment.productionApiUrl}/hoja-liquidacion`, inversion)
+      .pipe(
+        map(response => {
+          return response;
+        }),
+        catchError(this.errorHandl)
+      );
+  }
+
   sendPaymentInfoProposalInvestment(
   sendPaymentInfoProposalInvestment(
     id: string,
     id: string,
     inversion: Object
     inversion: Object

+ 16 - 0
src/assets/scss/material-dashboard.scss

@@ -209,3 +209,19 @@ input.form-control.is-invalid {
   color: black;
   color: black;
   z-index: 1;
   z-index: 1;
 }
 }
+
+ng-select {
+  font-size: 14px;
+}
+
+ng-select > div {
+  border: 1px solid #ddd;
+  border-radius: 4px;
+}
+
+ng-select > div > div.single > div.toggle {
+  color: #aaa;
+  line-height: 30px;
+  text-align: center;
+  width: 45px !important;
+}