Explorar el Código

Merge branch 'development' into feature-general_fixes

Francisco huezo hace 5 años
padre
commit
19968dd223
Se han modificado 63 ficheros con 1141 adiciones y 1290 borrados
  1. 18 0
      Dockerfile
  2. 1 1
      angular.json
  3. 49 0
      nginx/nginx.conf
  4. 0 21
      src/app/components/catalogs/companies/companies.component.html
  5. 0 0
      src/app/components/catalogs/companies/companies.component.scss
  6. 0 14
      src/app/components/catalogs/companies/companies.component.ts
  7. 0 100
      src/app/components/catalogs/companies/new-company/new-company.component.html
  8. 0 0
      src/app/components/catalogs/companies/new-company/new-company.component.scss
  9. 0 40
      src/app/components/catalogs/companies/new-company/new-company.component.ts
  10. 0 21
      src/app/components/catalogs/countries/countries.component.html
  11. 0 0
      src/app/components/catalogs/countries/countries.component.scss
  12. 0 37
      src/app/components/catalogs/countries/countries.component.spec.ts
  13. 0 15
      src/app/components/catalogs/countries/countries.component.ts
  14. 0 100
      src/app/components/catalogs/countries/new-country/new-country.component.html
  15. 0 37
      src/app/components/catalogs/countries/new-country/new-country.component.spec.ts
  16. 0 36
      src/app/components/catalogs/countries/new-country/new-country.component.ts
  17. 0 21
      src/app/components/catalogs/emitters/emitters.component.html
  18. 0 37
      src/app/components/catalogs/emitters/emitters.component.spec.ts
  19. 0 12
      src/app/components/catalogs/emitters/emitters.component.ts
  20. 0 100
      src/app/components/catalogs/emitters/new-emitter/new-emitter.component.html
  21. 0 0
      src/app/components/catalogs/emitters/new-emitter/new-emitter.component.scss
  22. 0 37
      src/app/components/catalogs/emitters/new-emitter/new-emitter.component.spec.ts
  23. 0 40
      src/app/components/catalogs/emitters/new-emitter/new-emitter.component.ts
  24. 3 6
      src/app/components/instruments/anc/anc.component.html
  25. 3 6
      src/app/components/instruments/apn/apn.component.html
  26. 2 7
      src/app/components/instruments/bonos/bonos.component.html
  27. 6 34
      src/app/components/instruments/cete/cete.component.html
  28. 51 38
      src/app/components/instruments/cete/cete.component.ts
  29. 11 46
      src/app/components/instruments/dap/dap.component.html
  30. 43 34
      src/app/components/instruments/dap/dap.component.ts
  31. 10 3
      src/app/components/instruments/lete/lete.component.html
  32. 57 45
      src/app/components/instruments/lete/lete.component.ts
  33. 10 3
      src/app/components/instruments/pbur/pbur.component.html
  34. 67 55
      src/app/components/instruments/pbur/pbur.component.ts
  35. 10 3
      src/app/components/instruments/vcn/vcn.component.html
  36. 64 52
      src/app/components/instruments/vcn/vcn.component.ts
  37. 5 3
      src/app/components/investment-proposals/complement-info/complement-info.component.html
  38. 1 1
      src/app/components/investment-proposals/complement-info/complement-info.component.ts
  39. 1 0
      src/app/components/investment-proposals/general-info/general-info.component.html
  40. 3 1
      src/app/components/investment-proposals/general-info/general-info.component.ts
  41. 28 6
      src/app/components/investment-proposals/investment-proposals.component.html
  42. 1 1
      src/app/components/investment-proposals/investment-proposals.component.scss
  43. 23 0
      src/app/components/investment-proposals/investment-proposals.component.ts
  44. 10 13
      src/app/components/investment-proposals/payment-info/payment-info.component.html
  45. 4 3
      src/app/components/investment-proposals/payment-info/payment-info.component.ts
  46. 50 21
      src/app/components/investment-proposals/payment-requirement/payment-requirement.component.html
  47. 6 0
      src/app/components/investment-proposals/payment-requirement/payment-requirement.component.scss
  48. 29 23
      src/app/components/investment-proposals/payment-requirement/payment-requirement.component.ts
  49. 172 0
      src/app/components/investment-proposals/proposal-detail/proposal-detail.component.html
  50. 6 0
      src/app/components/investment-proposals/proposal-detail/proposal-detail.component.scss
  51. 326 0
      src/app/components/investment-proposals/proposal-detail/proposal-detail.component.ts
  52. 10 6
      src/app/components/investment-proposals/result/result.component.html
  53. 28 12
      src/app/components/investment-proposals/result/result.component.ts
  54. 10 2
      src/app/components/investment-proposals/review/review.component.html
  55. 1 1
      src/app/components/investment-proposals/review/review.component.ts
  56. 1 1
      src/app/components/login/login.component.scss
  57. 0 180
      src/app/components/plugins/input-directives/numbers-only.directive.ts
  58. 3 7
      src/app/layouts/admin/admin.module.ts
  59. 6 0
      src/app/layouts/admin/admin.routing.ts
  60. 2 1
      src/app/services/form-investment-proposal.service.ts
  61. 4 4
      src/app/services/instrument-calculations.service.ts
  62. 1 1
      src/environments/environment.prod.ts
  63. 5 2
      src/polyfills.ts

+ 18 - 0
Dockerfile

@@ -0,0 +1,18 @@
+# Step 1: Build the app in image "builder"
+FROM node:lts-alpine AS builder
+
+COPY package.json package-lock.json ./
+RUN npm i && mkdir /app && mv ./node_modules ./app
+WORKDIR /app
+COPY . .
+RUN node --max-old-space-size=4096 ./node_modules/@angular/cli/bin/ng build --prod
+
+# Step 2: Use build output from 'builder'
+
+FROM nginx:stable-alpine
+LABEL version="1.0"
+
+COPY ./nginx/nginx.conf /etc/nginx/nginx.conf
+
+WORKDIR /usr/share/nginx/html
+COPY --from=builder /app/dist/frontend-inversiones/ .

+ 1 - 1
angular.json

@@ -58,7 +58,7 @@
               "aot": true,
               "extractLicenses": true,
               "vendorChunk": false,
-              "buildOptimizer": true,
+              "buildOptimizer": false,
               "budgets": [
                 {
                   "type": "initial",

+ 49 - 0
nginx/nginx.conf

@@ -0,0 +1,49 @@
+worker_processes  1;
+
+events {
+    worker_connections  1024;
+}
+
+http {
+    upstream api {
+        server backend:8000;
+    }
+    server {
+        listen 80;
+        server_name  localhost;
+
+        root   /usr/share/nginx/html;
+        index  index.html index.htm;
+        include /etc/nginx/mime.types;
+
+        location /api/ {
+            proxy_pass http://api;
+            proxy_http_version 1.1;
+            proxy_set_header Upgrade $http_upgrade;
+            proxy_set_header Connection 'upgrade';
+            proxy_set_header Host $host;
+            proxy_set_header X-Real-IP $remote_addr;
+            proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
+            proxy_set_header X-NginX-Proxy true;
+            proxy_cache_bypass $http_upgrade;
+        }
+
+        location /assets/ {
+            access_log off;
+            expires 1d;
+        }
+        location ~ \.(css|js|svg|ico)$ {
+            access_log off;
+            expires 1d;
+        }
+        
+        gzip on;
+        gzip_min_length 1000;
+        gzip_proxied expired no-cache no-store private auth;
+        gzip_types text/plain text/css application/json application/javascript application/x-javascript text/xml application/xml application/xml+rss text/javascript;
+
+        location / {
+            try_files $uri $uri/ /index.html;
+        }
+    }
+}

+ 0 - 21
src/app/components/catalogs/companies/companies.component.html

@@ -1,21 +0,0 @@
-<h2 class="floating-title">{{ title }}</h2>
-
-<div class="main-content">
-  <div class="container-fluid">
-    <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">Empresas</li>
-          </ol>
-        </nav>
-        <a class="btn btn-primary" [routerLink]="['/companies/new']">
-          Nuevo registro
-        </a>
-      </div>
-    </div>
-  </div>
-</div>

+ 0 - 0
src/app/components/catalogs/companies/companies.component.scss


+ 0 - 14
src/app/components/catalogs/companies/companies.component.ts

@@ -1,14 +0,0 @@
-import { Component, OnInit } from "@angular/core";
-
-@Component({
-  selector: "app-companies",
-  templateUrl: "./companies.component.html",
-  styleUrls: ["./companies.component.scss"]
-})
-export class CompaniesComponent implements OnInit {
-  title: string = "Empresas";
-
-  constructor() {}
-
-  ngOnInit() {}
-}

+ 0 - 100
src/app/components/catalogs/companies/new-company/new-company.component.html

@@ -1,100 +0,0 @@
-<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]="['/companies']">
-                  Empresas
-                </a>
-              </li>
-              <li class="breadcrumb-item">Nuevo</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">
-            <div class="card-header card-header-icon card-header-rose">
-              <div class="card-icon"><i class="material-icons">map</i></div>
-              <h4 class="card-title">
-                Nueva Empresa
-                <small class="category">- Complete la información</small>
-              </h4>
-            </div>
-            <div class="card-body">
-              <div class="align-container">
-                <form
-                  class="form-auth-small ng-untouched ng-pristine ng-valid"
-                  [formGroup]="companyForm"
-                  (ngSubmit)="createCompany()"
-                >
-                  <div class="row">
-                    <div class=" col-sm-12">
-                      <div class="form-group">
-                        <label for="name">Nombre: </label>
-                        <input
-                          type="text"
-                          formControlName="name"
-                          class="form-control"
-                          [ngClass]="{
-                            'is-invalid': submitted && f.name.errors
-                          }"
-                        />
-                        <div
-                          *ngIf="submitted && f.name.errors"
-                          class="invalid-feedback"
-                        >
-                          <div *ngIf="f.name.errors.required">
-                            Campo requerido
-                          </div>
-                        </div>
-                      </div>
-
-                      <div class="form-group">
-                        <label for="description">Descripcion: </label>
-                        <input
-                          type="text"
-                          formControlName="description"
-                          class="form-control"
-                          [ngClass]="{
-                            'is-invalid': submitted && f.description.errors
-                          }"
-                        />
-                        <div
-                          *ngIf="submitted && f.description.errors"
-                          class="invalid-feedback"
-                        >
-                          <div *ngIf="f.description.errors.required">
-                            Campo requerido
-                          </div>
-                        </div>
-                      </div>
-                    </div>
-                  </div>
-                  <br />
-                  <button class="btn btn-primary">
-                    Guardar
-                  </button>
-                  <!--<div *ngIf="error" class="alert alert-danger mt-3 mb-0">{{error}}</div>-->
-                </form>
-              </div>
-            </div>
-          </div>
-        </div>
-      </div>
-    </div>
-  </div>
-</div>

+ 0 - 0
src/app/components/catalogs/companies/new-company/new-company.component.scss


+ 0 - 40
src/app/components/catalogs/companies/new-company/new-company.component.ts

@@ -1,40 +0,0 @@
-import { Component, OnInit } from '@angular/core';
-import { FormBuilder, FormGroup, Validators } from "@angular/forms";
-
-@Component({
-  selector: 'app-new-company',
-  templateUrl: './new-company.component.html',
-  styleUrls: ['./new-company.component.scss']
-})
-export class NewCompanyComponent implements OnInit {
-
-
-  title: string = "Nueva empresa";
-  companyForm: FormGroup;
-  submitted: boolean = false;
-  role_number: any;
-
-  constructor(private formBuilder: FormBuilder) {}
-
-
-  ngOnInit() {
-    this.companyForm = this.formBuilder.group({
-      name: ["", Validators.required],
-      description: ["", Validators.required],
-    });
-  }
-
-  get f() {
-    return this.companyForm.controls;
-  }
-
-  createCompany(){
-    this.submitted = true;
-
-    // stop here if form is invalid
-    if (this.companyForm.invalid) {
-      return;
-    }
-    console.log("compania");
-  }
-}

+ 0 - 21
src/app/components/catalogs/countries/countries.component.html

@@ -1,21 +0,0 @@
-<h2 class="floating-title">{{ title }}</h2>
-
-<div class="main-content">
-  <div class="container-fluid">
-    <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">Paises</li>
-          </ol>
-        </nav>
-        <a class="btn btn-primary" [routerLink]="['/countries/new']">
-          Nuevo registro
-        </a>
-      </div>
-    </div>
-  </div>
-</div>

+ 0 - 0
src/app/components/catalogs/countries/countries.component.scss


+ 0 - 37
src/app/components/catalogs/countries/countries.component.spec.ts

@@ -1,37 +0,0 @@
-import { async, ComponentFixture, TestBed } from "@angular/core/testing";
-import { CountriesComponent } from "./countries.component";
-import { RouterTestingModule } from "@angular/router/testing";
-import { AuthService } from "@app/services/auth2.service";
-import { By } from "@angular/platform-browser";
-import { RouterLinkWithHref, Router } from "@angular/router";
-import { HttpClientModule } from "@angular/common/http";
-import { ReactiveFormsModule, FormsModule } from "@angular/forms";
-
-describe("CountriesComponent", () => {
-  let component: CountriesComponent;
-  let fixture: ComponentFixture<CountriesComponent>;
-
-  beforeEach(async(() => {
-    TestBed.configureTestingModule({
-      declarations: [CountriesComponent],
-      imports: [
-        RouterTestingModule,
-        HttpClientModule,
-        ReactiveFormsModule,
-        FormsModule
-      ],
-      providers: [AuthService]
-    }).compileComponents();
-  }));
-
-  beforeEach(() => {
-    fixture = TestBed.createComponent(CountriesComponent);
-    component = fixture.componentInstance;
-    fixture.detectChanges();
-    component.ngOnInit();
-  });
-
-  it("should create", () => {
-    expect(component).toBeTruthy();
-  });
-});

+ 0 - 15
src/app/components/catalogs/countries/countries.component.ts

@@ -1,15 +0,0 @@
-import { Component, OnInit } from '@angular/core';
-
-@Component({
-  selector: 'app-countries',
-  templateUrl: './countries.component.html',
-  styleUrls: ['./countries.component.scss']
-})
-export class CountriesComponent implements OnInit {
-  title: string = "Paises";
-  constructor() { }
-
-  ngOnInit() {
-  }
-
-}

+ 0 - 100
src/app/components/catalogs/countries/new-country/new-country.component.html

@@ -1,100 +0,0 @@
-<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]="['/countries']">
-                  Paises
-                </a>
-              </li>
-              <li class="breadcrumb-item">Nuevo</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">
-            <div class="card-header card-header-icon card-header-rose">
-              <div class="card-icon"><i class="material-icons">map</i></div>
-              <h4 class="card-title">
-                Nuevo País
-                <small class="category">- Complete la información</small>
-              </h4>
-            </div>
-            <div class="card-body">
-              <div class="align-container">
-                <form
-                  class="form-auth-small ng-untouched ng-pristine ng-valid"
-                  [formGroup]="countryForm"
-                  (ngSubmit)="createCountry()"
-                >
-                  <div class="row">
-                    <div class=" col-sm-12">
-                      <div class="form-group">
-                        <label for="name">Nombre: </label>
-                        <input
-                          type="text"
-                          formControlName="name"
-                          class="form-control"
-                          [ngClass]="{
-                            'is-invalid': submitted && f.name.errors
-                          }"
-                        />
-                        <div
-                          *ngIf="submitted && f.name.errors"
-                          class="invalid-feedback"
-                        >
-                          <div *ngIf="f.name.errors.required">
-                            Campo requerido
-                          </div>
-                        </div>
-                      </div>
-
-                      <div class="form-group">
-                        <label for="description">Descripcion: </label>
-                        <input
-                          type="text"
-                          formControlName="description"
-                          class="form-control"
-                          [ngClass]="{
-                            'is-invalid': submitted && f.description.errors
-                          }"
-                        />
-                        <div
-                          *ngIf="submitted && f.description.errors"
-                          class="invalid-feedback"
-                        >
-                          <div *ngIf="f.description.errors.required">
-                            Campo requerido
-                          </div>
-                        </div>
-                      </div>
-                    </div>
-                  </div>
-                  <br />
-                  <button class="btn btn-primary">
-                    Guardar
-                  </button>
-                  <!--<div *ngIf="error" class="alert alert-danger mt-3 mb-0">{{error}}</div>-->
-                </form>
-              </div>
-            </div>
-          </div>
-        </div>
-      </div>
-    </div>
-  </div>
-</div>

+ 0 - 37
src/app/components/catalogs/countries/new-country/new-country.component.spec.ts

@@ -1,37 +0,0 @@
-import { async, ComponentFixture, TestBed } from "@angular/core/testing";
-import { NewCountryComponent } from "./new-country.component";
-import { RouterTestingModule } from "@angular/router/testing";
-import { AuthService } from "@app/services/auth2.service";
-import { By } from "@angular/platform-browser";
-import { RouterLinkWithHref, Router } from "@angular/router";
-import { HttpClientModule } from "@angular/common/http";
-import { ReactiveFormsModule, FormsModule } from "@angular/forms";
-
-describe("NewEmitterComponent", () => {
-  let component: NewCountryComponent;
-  let fixture: ComponentFixture<NewCountryComponent>;
-
-  beforeEach(async(() => {
-    TestBed.configureTestingModule({
-      declarations: [NewCountryComponent],
-      imports: [
-        RouterTestingModule,
-        HttpClientModule,
-        ReactiveFormsModule,
-        FormsModule
-      ],
-      providers: [AuthService]
-    }).compileComponents();
-  }));
-
-  beforeEach(() => {
-    fixture = TestBed.createComponent(NewCountryComponent);
-    component = fixture.componentInstance;
-    fixture.detectChanges();
-    component.ngOnInit();
-  });
-
-  it("should create", () => {
-    expect(component).toBeTruthy();
-  });
-});

+ 0 - 36
src/app/components/catalogs/countries/new-country/new-country.component.ts

@@ -1,36 +0,0 @@
-import { Component, OnInit } from "@angular/core";
-import { FormBuilder, FormGroup, Validators } from "@angular/forms";
-
-@Component({
-  selector: "app-new-country",
-  templateUrl: "./new-country.component.html"
-})
-export class NewCountryComponent implements OnInit {
-  title: string = "Nuevo país";
-  countryForm: FormGroup;
-  submitted: boolean = false;
-  role_number: any;
-
-  constructor(private formBuilder: FormBuilder) {}
-
-  ngOnInit() {
-    this.countryForm = this.formBuilder.group({
-      name: ["", Validators.required],
-      description: ["", Validators.required]
-    });
-  }
-
-  get f() {
-    return this.countryForm.controls;
-  }
-
-  createCountry() {
-    this.submitted = true;
-
-    // stop here if form is invalid
-    if (this.countryForm.invalid) {
-      return;
-    }
-    console.log("país");
-  }
-}

+ 0 - 21
src/app/components/catalogs/emitters/emitters.component.html

@@ -1,21 +0,0 @@
-<h2 class="floating-title">{{ title }}</h2>
-
-<div class="main-content">
-  <div class="container-fluid">
-    <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">Emisores</li>
-          </ol>
-        </nav>
-        <a class="btn btn-primary" [routerLink]="['/emitters/new']">
-          Nuevo registro
-        </a>
-      </div>
-    </div>
-  </div>
-</div>

+ 0 - 37
src/app/components/catalogs/emitters/emitters.component.spec.ts

@@ -1,37 +0,0 @@
-import { async, ComponentFixture, TestBed } from "@angular/core/testing";
-import { EmittersComponent } from "./emitters.component";
-import { RouterTestingModule } from "@angular/router/testing";
-import { AuthService } from "@app/services/auth2.service";
-import { By } from "@angular/platform-browser";
-import { RouterLinkWithHref, Router } from "@angular/router";
-import { HttpClientModule } from "@angular/common/http";
-import { ReactiveFormsModule, FormsModule } from "@angular/forms";
-
-describe("EmittersComponent", () => {
-  let component: EmittersComponent;
-  let fixture: ComponentFixture<EmittersComponent>;
-
-  beforeEach(async(() => {
-    TestBed.configureTestingModule({
-      declarations: [EmittersComponent],
-      imports: [
-        RouterTestingModule,
-        HttpClientModule,
-        ReactiveFormsModule,
-        FormsModule
-      ],
-      providers: [AuthService]
-    }).compileComponents();
-  }));
-
-  beforeEach(() => {
-    fixture = TestBed.createComponent(EmittersComponent);
-    component = fixture.componentInstance;
-    fixture.detectChanges();
-    component.ngOnInit();
-  });
-
-  it("should create", () => {
-    expect(component).toBeTruthy();
-  });
-});

+ 0 - 12
src/app/components/catalogs/emitters/emitters.component.ts

@@ -1,12 +0,0 @@
-import { Component, OnInit } from "@angular/core";
-
-@Component({
-  selector: "app-emitters",
-  templateUrl: "./emitters.component.html"
-})
-export class EmittersComponent implements OnInit {
-  title: string = "Emisores";
-  constructor() {}
-
-  ngOnInit() {}
-}

+ 0 - 100
src/app/components/catalogs/emitters/new-emitter/new-emitter.component.html

@@ -1,100 +0,0 @@
-<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]="['/emitters']">
-                  Emisores
-                </a>
-              </li>
-              <li class="breadcrumb-item">Nuevo</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">
-            <div class="card-header card-header-icon card-header-rose">
-              <div class="card-icon"><i class="material-icons">map</i></div>
-              <h4 class="card-title">
-                Nuevo Emisor
-                <small class="category">- Complete la información</small>
-              </h4>
-            </div>
-            <div class="card-body">
-              <div class="align-container">
-                <form
-                  class="form-auth-small ng-untouched ng-pristine ng-valid"
-                  [formGroup]="emitterForm"
-                  (ngSubmit)="createEmitter()"
-                >
-                  <div class="row">
-                    <div class=" col-sm-12">
-                      <div class="form-group">
-                        <label for="name">Nombre: </label>
-                        <input
-                          type="text"
-                          formControlName="name"
-                          class="form-control"
-                          [ngClass]="{
-                            'is-invalid': submitted && f.name.errors
-                          }"
-                        />
-                        <div
-                          *ngIf="submitted && f.name.errors"
-                          class="invalid-feedback"
-                        >
-                          <div *ngIf="f.name.errors.required">
-                            Campo requerido
-                          </div>
-                        </div>
-                      </div>
-
-                      <div class="form-group">
-                        <label for="description">Descripcion: </label>
-                        <input
-                          type="text"
-                          formControlName="description"
-                          class="form-control"
-                          [ngClass]="{
-                            'is-invalid': submitted && f.description.errors
-                          }"
-                        />
-                        <div
-                          *ngIf="submitted && f.description.errors"
-                          class="invalid-feedback"
-                        >
-                          <div *ngIf="f.description.errors.required">
-                            Campo requerido
-                          </div>
-                        </div>
-                      </div>
-                    </div>
-                  </div>
-                  <br />
-                  <button class="btn btn-primary">
-                    Guardar
-                  </button>
-                  <!--<div *ngIf="error" class="alert alert-danger mt-3 mb-0">{{error}}</div>-->
-                </form>
-              </div>
-            </div>
-          </div>
-        </div>
-      </div>
-    </div>
-  </div>
-</div>

+ 0 - 0
src/app/components/catalogs/emitters/new-emitter/new-emitter.component.scss


+ 0 - 37
src/app/components/catalogs/emitters/new-emitter/new-emitter.component.spec.ts

@@ -1,37 +0,0 @@
-import { async, ComponentFixture, TestBed } from "@angular/core/testing";
-import { NewEmitterComponent } from "./new-emitter.component";
-import { RouterTestingModule } from "@angular/router/testing";
-import { AuthService } from "@app/services/auth2.service";
-import { By } from "@angular/platform-browser";
-import { RouterLinkWithHref, Router } from "@angular/router";
-import { HttpClientModule } from "@angular/common/http";
-import { ReactiveFormsModule, FormsModule } from "@angular/forms";
-
-describe("NewEmitterComponent", () => {
-  let component: NewEmitterComponent;
-  let fixture: ComponentFixture<NewEmitterComponent>;
-
-  beforeEach(async(() => {
-    TestBed.configureTestingModule({
-      declarations: [NewEmitterComponent],
-      imports: [
-        RouterTestingModule,
-        HttpClientModule,
-        ReactiveFormsModule,
-        FormsModule
-      ],
-      providers: [AuthService]
-    }).compileComponents();
-  }));
-
-  beforeEach(() => {
-    fixture = TestBed.createComponent(NewEmitterComponent);
-    component = fixture.componentInstance;
-    fixture.detectChanges();
-    component.ngOnInit();
-  });
-
-  it("should create", () => {
-    expect(component).toBeTruthy();
-  });
-});

+ 0 - 40
src/app/components/catalogs/emitters/new-emitter/new-emitter.component.ts

@@ -1,40 +0,0 @@
-import { Component, OnInit } from '@angular/core';
-import { FormBuilder, FormGroup, Validators } from "@angular/forms";
-
-@Component({
-  selector: 'app-new-emitter',
-  templateUrl: './new-emitter.component.html',
-  styleUrls: ['./new-emitter.component.scss']
-})
-export class NewEmitterComponent implements OnInit {
-
-  title: string = "Nuevo emisor";
-  emitterForm: FormGroup;
-  submitted: boolean = false;
-  role_number: any;
-
-  constructor(private formBuilder: FormBuilder) {}
-
-
-  ngOnInit() {
-    this.emitterForm = this.formBuilder.group({
-      name: ["", Validators.required],
-      description: ["", Validators.required],
-    });
-  }
-
-  get f() {
-    return this.emitterForm.controls;
-  }
-
-  createEmitter(){
-    this.submitted = true;
-
-    // stop here if form is invalid
-    if (this.emitterForm.invalid) {
-      return;
-    }
-    console.log("emisor");
-  }
-
-}

+ 3 - 6
src/app/components/instruments/anc/anc.component.html

@@ -1,6 +1,7 @@
 <h4 class="card-title">
   ACCIONES NACIONALES
 </h4>
+<!--
 <form
   class="form-auth-small ng-untouched ng-pristine ng-valid"
   [formGroup]="investmentProposalForm"
@@ -158,10 +159,6 @@
     </div>
   </div>
 
-  <!---->
-
-  <!---->
-
   <br />
   <div class="form-group text-center space-20">
     <button
@@ -172,6 +169,6 @@
     </button>
   </div>
 
-  <!-- [disabled]="!investmentProposalForm.valid"
-                        <div *ngIf="error" class="alert alert-danger mt-3 mb-0">{{error}}</div>-->
+
 </form>
+-->

+ 3 - 6
src/app/components/instruments/apn/apn.component.html

@@ -1,6 +1,8 @@
 <h4 class="card-title">
   ACCIONES PREFERENTES NACIONALES
 </h4>
+
+<!--
 <form
   class="form-auth-small ng-untouched ng-pristine ng-valid"
   [formGroup]="investmentProposalForm"
@@ -158,10 +160,6 @@
     </div>
   </div>
 
-  <!---->
-
-  <!---->
-
   <br />
   <div class="form-group text-center space-20">
     <button
@@ -172,6 +170,5 @@
     </button>
   </div>
 
-  <!-- [disabled]="!investmentProposalForm.valid"
-                          <div *ngIf="error" class="alert alert-danger mt-3 mb-0">{{error}}</div>-->
 </form>
+-->

+ 2 - 7
src/app/components/instruments/bonos/bonos.component.html

@@ -2,6 +2,7 @@ BONOS FORM
 <h4 class="card-title">
   BONO
 </h4>
+<!--
 <form
   class="form-auth-small ng-untouched ng-pristine ng-valid"
   [formGroup]="investmentProposalForm"
@@ -190,11 +191,6 @@ BONOS FORM
     </div>
   </div>
 
-  <!---->
-
-  <!---->
-
-  <br />
 
   <div class="row">
     <div class="col-lg-6 col-sm-12 pr-xl-5">
@@ -289,6 +285,5 @@ BONOS FORM
     </button>
   </div>
 
-  <!-- [disabled]="!investmentProposalForm.valid"
-                        <div *ngIf="error" class="alert alert-danger mt-3 mb-0">{{error}}</div>-->
 </form>
+-->

+ 6 - 34
src/app/components/instruments/cete/cete.component.html

@@ -156,41 +156,13 @@
         </div>
       </div>
 
-      <!-- Plazo -->
-      <div class="col-lg-6 col-sm-12 pr-xl-3">
-        <div class="form-group">
-          <label for="plazo">Plazo: </label>
-          <div class="input-box-container">
-            <p>
-              <i class="fas fa-percent" aria-hidden="true"></i>
-            </p>
-            <input
-              type="text"
-              formControlName="plazo"
-              class="form-control"
-              [ngClass]="{
-                'is-invalid': submitted && f.plazo.errors
-              }"
-            />
-            <div *ngIf="submitted && f.plazo.errors" class="invalid-feedback">
-              <div *ngIf="f.plazo.errors.required">
-                Campo requerido
-              </div>
-              <div *ngIf="f.plazo.errors.pattern">
-                Debe ingresar una cifra válida
-              </div>
-            </div>
-          </div>
-        </div>
-      </div>
-
       <!-- Otros Costos -->
       <div class="col-lg-6 col-sm-12 pr-xl-3">
         <div class="form-group">
           <label for="otros_costos">Otros costos: </label>
           <div class="input-box-container">
             <p>
-              <i class="fas fa-percent" aria-hidden="true"></i>
+              <i class="fas fa-dollar-sign"></i>
             </p>
             <input
               type="text"
@@ -360,8 +332,9 @@
         <div class="form-group text-right">
           <br />
           <button
+            type="button"
             class="btn btn-success center-component"
-            (click)="getCalculations(investmentProposalForm)"
+            (click)="getCalculations(investmentProposalForm, false)"
           >
             Realizar cálculos
           </button>
@@ -482,21 +455,20 @@
     <br />
     <div class="form-group text-center space-20">
       <button
+        type="button"
         class="btn btn-default center-component margin-right"
-        (click)="goToPrevious(workForm)"
+        (click)="goToPrevious()"
       >
         Anterior
       </button>
       <button
+        type="submit"
         class="btn btn-primary center-component margin-right"
         (click)="goToNext(investmentProposalForm)"
       >
         Siguiente
       </button>
     </div>
-
-    <!-- [disabled]="!investmentProposalForm.valid"
-                      <div *ngIf="error" class="alert alert-danger mt-3 mb-0">{{error}}</div>-->
   </form>
 </div>
 

+ 51 - 38
src/app/components/instruments/cete/cete.component.ts

@@ -154,7 +154,7 @@ export class CETE implements InstrumentComponent {
               singleDate: {
                 jsDate: parse(
                   this.instrument_work.fecha_liquidacion,
-                  "dd/MM/yyyy HH:mm:ss",
+                  "dd/MM/yyyy",
                   new Date()
                 ),
                 formatted: this.instrument_work.fecha_liquidacion
@@ -170,7 +170,7 @@ export class CETE implements InstrumentComponent {
               singleDate: {
                 jsDate: parse(
                   this.instrument_work.fecha_vencimiento,
-                  "dd/MM/yyyy HH:mm:ss",
+                  "dd/MM/yyyy",
                   new Date()
                 ),
                 formatted: this.instrument_work.fecha_vencimiento
@@ -186,7 +186,7 @@ export class CETE implements InstrumentComponent {
               singleDate: {
                 jsDate: parse(
                   this.instrument_work.fecha_operacion,
-                  "dd/MM/yyyy HH:mm:ss",
+                  "dd/MM/yyyy",
                   new Date()
                 ),
                 formatted: this.instrument_work.fecha_operacion
@@ -202,7 +202,7 @@ export class CETE implements InstrumentComponent {
               singleDate: {
                 jsDate: parse(
                   this.instrument_work.fecha_ultima_cupon,
-                  "dd/MM/yyyy HH:mm:ss",
+                  "dd/MM/yyyy",
                   new Date()
                 ),
                 formatted: this.instrument_work.fecha_ultima_cupon
@@ -220,28 +220,12 @@ export class CETE implements InstrumentComponent {
     if (!form.valid) {
       return false;
     }
-    this.ceteObject = {
-      valor_nominal: this.investmentProposalForm.value.valor_nominal,
-      plazo: this.investmentProposalForm.value.plazo,
-      comision_casa_porcentaje: this.investmentProposalForm.value
-        .comision_casa_porcentaje,
-      comision_bolsa_porcentaje: this.investmentProposalForm.value
-        .comision_bolsa_porcentaje,
-      rendimiento_bruto: this.investmentProposalForm.value.rendimiento_bruto,
-      otros_costos: this.f.otros_costos.value,
-      //renta_porcentaje: this.f.renta_porcentaje.value,
-      //id_formato_ingreso: this.f.formato_ingreso.value,
-      fecha_operacion: this.f.fecha_operacion.value.singleDate.formatted,
-      fecha_liquidacion: this.f.fecha_liquidacion.value.singleDate.formatted,
-      fecha_ultima_cupon: this.f.fecha_ultima_cupon.value.singleDate.formatted,
-      fecha_vencimiento: this.f.fecha_vencimiento.value.singleDate.formatted
-    };
 
     this.formDataService.setWork(this.ceteObject);
     return true;
   }
 
-  getCalculations(form: any) {
+  getCalculations(form: any, saveForm: boolean) {
     this.submitted = true;
     if (!form.valid) {
       return false;
@@ -262,11 +246,10 @@ export class CETE implements InstrumentComponent {
         },
         {
           valor_nominal: +this.f.valor_nominal.value,
-          comision_casa_porcentaje: this.f.comision_casa_porcentaje.value / 100,
-          comision_bolsa_porcentaje:
-            this.f.comision_bolsa_porcentaje.value / 100,
+          comision_casa_porcentaje: this.f.comision_casa_porcentaje.value,
+          comision_bolsa_porcentaje: this.f.comision_bolsa_porcentaje.value,
           plazo: +this.f.plazo.value,
-          rendimiento_bruto: this.f.rendimiento_bruto.value / 100,
+          rendimiento_bruto: this.f.rendimiento_bruto.value,
           otros_costos: this.f.otros_costos.value,
           fecha_operacion: this.f.fecha_operacion.value.singleDate.formatted,
           fecha_liquidacion: this.f.fecha_liquidacion.value.singleDate
@@ -293,7 +276,47 @@ export class CETE implements InstrumentComponent {
           this.dataSource.paginator = this.paginator;
           this.dataSource.sort = this.sort;
 
+          this.ceteObject = {
+            valor_nominal: this.investmentProposalForm.value.valor_nominal,
+            plazo: this.investmentProposalForm.value.plazo,
+            comision_casa_porcentaje: this.investmentProposalForm.value
+              .comision_casa_porcentaje,
+            comision_bolsa_porcentaje: this.investmentProposalForm.value
+              .comision_bolsa_porcentaje,
+            rendimiento_bruto: this.investmentProposalForm.value
+              .rendimiento_bruto,
+            otros_costos: this.f.otros_costos.value,
+            //renta_porcentaje: this.f.renta_porcentaje.value,
+            //id_formato_ingreso: this.f.formato_ingreso.value,
+            fecha_operacion: this.f.fecha_operacion.value.singleDate.formatted,
+            fecha_liquidacion: this.f.fecha_liquidacion.value.singleDate
+              .formatted,
+            fecha_ultima_cupon: this.f.fecha_ultima_cupon.value.singleDate
+              .formatted,
+            fecha_vencimiento: this.f.fecha_vencimiento.value.singleDate
+              .formatted,
+            ingreso_bruto: this.ingreso_bruto,
+            ingreso_neto: this.ingreso_neto,
+            valor_transado: this.valor_transado,
+            precio_porcentaje: this.precio_porcentaje,
+            rendimiento_neto: this.rendimiento_neto,
+            total_pagar: this.total_pagar,
+            comision_bolsa: this.comision_bolsa,
+            comision_casa: this.comision_casa,
+            proyecciones: this.proyecciones
+          };
+
+          this.formDataService.setWork(this.ceteObject);
           Swal.close();
+          if (saveForm == true) {
+            if (this.investmentID != undefined) {
+              this.router.navigate(["/investment-proposal/complement-info"], {
+                queryParams: { id: this.investmentID }
+              });
+            } else {
+              this.router.navigate(["/investment-proposal/complement-info"]);
+            }
+          }
         },
         err => {
           Swal.fire({
@@ -301,11 +324,12 @@ export class CETE implements InstrumentComponent {
             title: "Error en el servidor",
             text: "No su pudo obtener la informacion"
           });
+          return false;
         }
       );
   }
 
-  goToPrevious(form: any) {
+  goToPrevious() {
     this.submitted = true;
     if (this.investmentID != undefined) {
       this.router.navigate(["/investment-proposal/general-info"], {
@@ -317,17 +341,6 @@ export class CETE implements InstrumentComponent {
   }
 
   goToNext(form: any) {
-    this.submitted = true;
-
-    if (this.save(form)) {
-      if (this.investmentID != undefined) {
-        console.log("paramsID");
-        this.router.navigate(["/investment-proposal/complement-info"], {
-          queryParams: { id: this.investmentID }
-        });
-      } else {
-        this.router.navigate(["/investment-proposal/complement-info"]);
-      }
-    }
+    this.getCalculations(form, true);
   }
 }

+ 11 - 46
src/app/components/instruments/dap/dap.component.html

@@ -125,37 +125,6 @@
         </div>
       </div>
 
-      <!-- Rendimiento bruto -->
-      <div class="col-lg-6 col-sm-12 pr-xl-3">
-        <div class="form-group">
-          <label for="rendimiento_bruto">Rendimiento bruto: </label>
-          <div class="input-box-container">
-            <p>
-              <i class="fas fa-percent" aria-hidden="true"></i>
-            </p>
-            <input
-              type="text"
-              formControlName="rendimiento_bruto"
-              class="form-control"
-              [ngClass]="{
-                'is-invalid': submitted && f.rendimiento_bruto.errors
-              }"
-            />
-            <div
-              *ngIf="submitted && f.rendimiento_bruto.errors"
-              class="invalid-feedback"
-            >
-              <div *ngIf="f.rendimiento_bruto.errors.required">
-                Campo requerido
-              </div>
-              <div *ngIf="f.rendimiento_bruto.errors.pattern">
-                Debe ingresar una cifra válida
-              </div>
-            </div>
-          </div>
-        </div>
-      </div>
-
       <!-- Fecha operación -->
       <div class="col-lg-6 col-sm-12 pr-xl-3">
         <div class="form-group">
@@ -229,8 +198,9 @@
         <div class="form-group text-right">
           <br />
           <button
+            type="button"
             class="btn btn-success center-component"
-            (click)="getCalculations(investmentProposalForm)"
+            (click)="getCalculations(investmentProposalForm, false)"
           >
             Realizar cálculos
           </button>
@@ -247,15 +217,7 @@
             >Cálculos del instrumento</span
           >
         </div>
-        <!--
-  monto_inversion
-ingreso_bruto
-ingreso_neto
-rendimiento_bruto
-rendimiento_neto
-plazo
-fecha_inicio_vigencia
--->
+
         <div class="col-sm-6">
           <h4>Monto inversión:</h4>
           <div class="field">$USD {{ monto_inversion | number: "1.2-4" }}</div>
@@ -283,7 +245,10 @@ fecha_inicio_vigencia
             {{ rendimiento_neto | number: "1.2-4" }}
           </div>
         </div>
-
+        <div class="col-sm-6">
+          <h4>Renta:</h4>
+          <div class="field">$USD {{ renta | number: "1.2-4" }}</div>
+        </div>
         <div class="col-sm-6">
           <h4>Fecha inicio de vigencia:</h4>
           <div class="field">{{ fecha_inicio_vigencia }}</div>
@@ -339,9 +304,7 @@ fecha_inicio_vigencia
               <th mat-header-cell *matHeaderCellDef>Renta</th>
               <td mat-cell *matCellDef="let row">
                 {{
-                  row.renta == "" || row.renta == undefined
-                    ? "-"
-                    : row.renta * 100
+                  row.renta == "" || row.renta == undefined ? "-" : row.renta
                 }}
               </td>
             </ng-container>
@@ -372,12 +335,14 @@ fecha_inicio_vigencia
     <br />
     <div class="form-group text-center space-20">
       <button
+        type="button"
         class="btn btn-default center-component margin-right"
-        (click)="goToPrevious(workForm)"
+        (click)="goToPrevious()"
       >
         Anterior
       </button>
       <button
+        type="submit"
         class="btn btn-primary center-component margin-right"
         (click)="goToNext(investmentProposalForm)"
       >

+ 43 - 34
src/app/components/instruments/dap/dap.component.ts

@@ -87,6 +87,7 @@ export class DAP implements InstrumentComponent {
   proyecciones: any;
   dataSource = new MatTableDataSource(this.proyecciones);
   dapObject: {};
+  renta: any;
 
   constructor(
     private formBuilder: FormBuilder,
@@ -139,7 +140,7 @@ export class DAP implements InstrumentComponent {
               singleDate: {
                 jsDate: parse(
                   this.instrument_work.fecha_vencimiento,
-                  "dd/MM/yyyy HH:mm:ss",
+                  "dd/MM/yyyy",
                   new Date()
                 ),
                 formatted: this.instrument_work.fecha_vencimiento
@@ -155,7 +156,7 @@ export class DAP implements InstrumentComponent {
               singleDate: {
                 jsDate: parse(
                   this.instrument_work.fecha_operacion,
-                  "dd/MM/yyyy HH:mm:ss",
+                  "dd/MM/yyyy",
                   new Date()
                 ),
                 formatted: this.instrument_work.fecha_operacion
@@ -174,26 +175,11 @@ export class DAP implements InstrumentComponent {
     if (!form.valid) {
       return false;
     }
-    this.dapObject = {
-      monto_inversion: this.investmentProposalForm.value.monto_inversion,
-      renta_porcentaje: this.investmentProposalForm.value.renta_porcentaje,
-      tasa_porcentaje: this.investmentProposalForm.value.tasa_porcentaje,
-      plazo: +this.investmentProposalForm.value.plazo,
 
-      fecha_operacion: this.investmentProposalForm.value.fecha_operacion
-        .singleDate.formatted,
-      fecha_vencimiento:
-        this.investmentProposalForm.value.fecha_vencimiento != undefined
-          ? this.investmentProposalForm.value.fecha_vencimiento.singleDate
-              .formatted
-          : ""
-    };
-
-    this.formDataService.setWork(this.dapObject);
     return true;
   }
 
-  getCalculations(form: any) {
+  getCalculations(form: any, saveForm: boolean) {
     this.submitted = true;
     if (!form.valid) {
       return false;
@@ -215,8 +201,8 @@ export class DAP implements InstrumentComponent {
         },
         {
           monto_inversion: +this.f.monto_inversion.value,
-          tasa_porcentaje: this.f.tasa_porcentaje.value / 100,
-          renta_porcentaje: this.f.renta_porcentaje.value / 100,
+          tasa_porcentaje: +this.f.tasa_porcentaje.value,
+          renta_porcentaje: +this.f.renta_porcentaje.value,
           plazo: +this.f.plazo.value,
           //id_formato_ingreso: this.f.formato_ingreso.value,
           fecha_operacion: this.f.fecha_operacion.value.singleDate.formatted,
@@ -232,13 +218,46 @@ export class DAP implements InstrumentComponent {
           this.rendimiento_neto = ans["result"]["rendimiento_neto"];
           this.plazo = ans["result"]["plazo"];
           this.fecha_inicio_vigencia = ans["result"]["fecha_inicio_vigencia"];
+          this.renta = ans["result"]["renta"];
           this.proyecciones = ans["result"]["proyecciones"];
 
           this.dataSource.data = this.proyecciones;
           this.dataSource.paginator = this.paginator;
           this.dataSource.sort = this.sort;
-          console.log(ans);
+
+          this.dapObject = {
+            monto_inversion: this.investmentProposalForm.value.monto_inversion,
+            renta_porcentaje: this.investmentProposalForm.value
+              .renta_porcentaje,
+            tasa_porcentaje: this.investmentProposalForm.value.tasa_porcentaje,
+            plazo: +this.investmentProposalForm.value.plazo,
+            ingreso_bruto: this.ingreso_bruto,
+            ingreso_neto: this.ingreso_neto,
+            rendimiento_bruto: this.rendimiento_bruto,
+            rendimiento_neto: this.rendimiento_neto,
+            fecha_inicio_vigencia: this.fecha_inicio_vigencia,
+            renta: this.renta,
+            proyecciones: this.proyecciones,
+
+            fecha_operacion: this.investmentProposalForm.value.fecha_operacion
+              .singleDate.formatted,
+            fecha_vencimiento:
+              this.investmentProposalForm.value.fecha_vencimiento != undefined
+                ? this.investmentProposalForm.value.fecha_vencimiento.singleDate
+                    .formatted
+                : ""
+          };
+          this.formDataService.setWork(this.dapObject);
           Swal.close();
+          if (saveForm == true) {
+            if (this.investmentID != undefined) {
+              this.router.navigate(["/investment-proposal/complement-info"], {
+                queryParams: { id: this.investmentID }
+              });
+            } else {
+              this.router.navigate(["/investment-proposal/complement-info"]);
+            }
+          }
         },
         err => {
           Swal.fire({
@@ -246,11 +265,12 @@ export class DAP implements InstrumentComponent {
             title: "Error en el servidor",
             text: "No su pudo obtener la informacion"
           });
+          return false;
         }
       );
   }
 
-  goToPrevious(form: any) {
+  goToPrevious() {
     this.submitted = true;
     if (this.investmentID != undefined) {
       this.router.navigate(["/investment-proposal/general-info"], {
@@ -262,17 +282,6 @@ export class DAP implements InstrumentComponent {
   }
 
   goToNext(form: any) {
-    this.submitted = true;
-
-    if (this.save(form)) {
-      if (this.investmentID != undefined) {
-        console.log("paramsID");
-        this.router.navigate(["/investment-proposal/complement-info"], {
-          queryParams: { id: this.investmentID }
-        });
-      } else {
-        this.router.navigate(["/investment-proposal/complement-info"]);
-      }
-    }
+    this.getCalculations(form, true);
   }
 }

+ 10 - 3
src/app/components/instruments/lete/lete.component.html

@@ -254,8 +254,9 @@
         <div class="form-group text-right">
           <br />
           <button
+            type="button"
             class="btn btn-success center-component"
-            (click)="getCalculations(investmentProposalForm)"
+            (click)="getCalculations(investmentProposalForm, false)"
           >
             Realizar cálculos
           </button>
@@ -290,7 +291,7 @@
         </div>
         <div class="col-sm-6">
           <h4>Rendimiento neto:</h4>
-          <div class="field">{{ rendimiento_neto * 100 }} %</div>
+          <div class="field">{{ rendimiento_neto | number: "1.2-4" }} %</div>
         </div>
         <div class="col-sm-6">
           <h4>Total a pagar:</h4>
@@ -304,18 +305,24 @@
           <h4>Comision casa:</h4>
           <div class="field">$USD {{ comision_casa | number: "1.2-4" }}</div>
         </div>
+        <div class="col-sm-6">
+          <h4>Fecha de vencimiento:</h4>
+          <div class="field">{{ fecha_vencimiento }}</div>
+        </div>
       </div>
     </div>
 
     <br />
     <div class="form-group text-center space-20">
       <button
+        type="button"
         class="btn btn-default center-component margin-right"
-        (click)="goToPrevious(workForm)"
+        (click)="goToPrevious()"
       >
         Anterior
       </button>
       <button
+        type="submit"
         class="btn btn-primary center-component margin-right"
         (click)="goToNext(investmentProposalForm)"
       >

+ 57 - 45
src/app/components/instruments/lete/lete.component.ts

@@ -76,6 +76,7 @@ export class LETE implements InstrumentComponent {
   comision_casa: number = 0.0;
 
   leteObject: {};
+  fecha_vencimiento: string = "-";
 
   constructor(
     private formBuilder: FormBuilder,
@@ -141,7 +142,7 @@ export class LETE implements InstrumentComponent {
               singleDate: {
                 jsDate: parse(
                   this.instrument_work.fecha_liquidacion,
-                  "dd/MM/yyyy HH:mm:ss",
+                  "dd/MM/yyyy",
                   new Date()
                 ),
                 formatted: this.instrument_work.fecha_liquidacion
@@ -157,7 +158,7 @@ export class LETE implements InstrumentComponent {
               singleDate: {
                 jsDate: parse(
                   this.instrument_work.fecha_operacion,
-                  "dd/MM/yyyy HH:mm:ss",
+                  "dd/MM/yyyy",
                   new Date()
                 ),
                 formatted: this.instrument_work.fecha_operacion
@@ -173,7 +174,7 @@ export class LETE implements InstrumentComponent {
               singleDate: {
                 jsDate: parse(
                   this.instrument_work.fecha_redencion,
-                  "dd/MM/yyyy HH:mm:ss",
+                  "dd/MM/yyyy",
                   new Date()
                 ),
                 formatted: this.instrument_work.fecha_redencion
@@ -191,35 +192,12 @@ export class LETE implements InstrumentComponent {
     if (!form.valid) {
       return false;
     }
-    this.leteObject = {
-      valor_nominal: this.investmentProposalForm.value.valor_nominal,
-      plazo: this.investmentProposalForm.value.plazo,
-      comision_casa_porcentaje: this.investmentProposalForm.value
-        .comision_casa_porcentaje,
-      comision_bolsa_porcentaje: this.investmentProposalForm.value
-        .comision_bolsa_porcentaje,
-      rendimiento_bruto: this.investmentProposalForm.value.rendimiento_bruto,
-      fecha_operacion: this.investmentProposalForm.value.fecha_operacion
-        .singleDate.formatted,
-      fecha_liquidacion:
-        this.investmentProposalForm.value.fecha_liquidacion.singleDate
-          .formatted || "",
-      fecha_redencion:
-        this.investmentProposalForm.value.fecha_redencion == undefined
-          ? this.investmentProposalForm.value.fecha_redencion.singleDate
-              .formatted
-          : ""
-      /*id_inversion_instrumento:
-        this.instrument_work.id_inversion_instrumento == undefined
-          ? ""
-          : this.instrument_work.id_inversion_instrumento*/
-    };
 
     this.formDataService.setWork(this.leteObject);
     return true;
   }
 
-  getCalculations(form: any) {
+  getCalculations(form: any, saveForm: boolean) {
     this.submitted = true;
     if (!form.valid) {
       return false;
@@ -238,17 +216,15 @@ export class LETE implements InstrumentComponent {
         {
           valor_nominal: +this.f.valor_nominal.value,
           plazo: +this.f.plazo.value,
-          comision_casa_porcentaje: this.f.comision_casa_porcentaje.value / 100,
-          comision_bolsa_porcentaje:
-            this.f.comision_bolsa_porcentaje.value / 100,
-          rendimiento_bruto: this.f.rendimiento_bruto.value / 100,
+          comision_casa_porcentaje: this.f.comision_casa_porcentaje.value,
+          comision_bolsa_porcentaje: this.f.comision_bolsa_porcentaje.value,
+          rendimiento_bruto: this.f.rendimiento_bruto.value,
           fecha_operacion: this.f.fecha_operacion.value.singleDate.formatted,
           fecha_liquidacion: this.f.fecha_liquidacion.value.singleDate.formatted
         }
       )
       .subscribe(
         ans => {
-          console.log(ans);
           this.ingreso_bruto = ans["result"]["ingreso_bruto"];
           this.ingreso_neto = ans["result"]["ingreso_neto"];
           this.valor_transado = ans["result"]["valor_transado"];
@@ -257,8 +233,54 @@ export class LETE implements InstrumentComponent {
           this.total_pagar = ans["result"]["total_pagar"];
           this.comision_bolsa = ans["result"]["comision_bolsa"];
           this.comision_casa = ans["result"]["comision_casa"];
+          this.fecha_vencimiento = ans["result"]["fecha_vencimiento"];
+          Swal.close();
+
+          this.leteObject = {
+            valor_nominal: this.investmentProposalForm.value.valor_nominal,
+            plazo: this.investmentProposalForm.value.plazo,
+            comision_casa_porcentaje: this.investmentProposalForm.value
+              .comision_casa_porcentaje,
+            comision_bolsa_porcentaje: this.investmentProposalForm.value
+              .comision_bolsa_porcentaje,
+            rendimiento_bruto: this.investmentProposalForm.value
+              .rendimiento_bruto,
+            ingreso_bruto: this.ingreso_bruto,
+            ingreso_neto: this.ingreso_neto,
+            valor_transado: this.valor_transado,
+            precio_porcentaje: this.precio_porcentaje,
+            rendimiento_neto: this.rendimiento_neto,
+            total_pagar: this.total_pagar,
+            comision_bolsa: this.comision_bolsa,
+            comision_casa: this.comision_casa,
+            fecha_vencimiento: this.fecha_vencimiento,
+            fecha_operacion: this.investmentProposalForm.value.fecha_operacion
+              .singleDate.formatted,
+            fecha_liquidacion:
+              this.investmentProposalForm.value.fecha_liquidacion.singleDate
+                .formatted || "",
+            fecha_redencion:
+              this.investmentProposalForm.value.fecha_redencion == undefined
+                ? this.investmentProposalForm.value.fecha_redencion.singleDate
+                    .formatted
+                : ""
+            /*id_inversion_instrumento:
+        this.instrument_work.id_inversion_instrumento == undefined
+          ? ""
+          : this.instrument_work.id_inversion_instrumento*/
+          };
 
+          this.formDataService.setWork(this.leteObject);
           Swal.close();
+          if (saveForm == true) {
+            if (this.investmentID != undefined) {
+              this.router.navigate(["/investment-proposal/complement-info"], {
+                queryParams: { id: this.investmentID }
+              });
+            } else {
+              this.router.navigate(["/investment-proposal/complement-info"]);
+            }
+          }
         },
         err => {
           Swal.fire({
@@ -266,11 +288,12 @@ export class LETE implements InstrumentComponent {
             title: "Error en el servidor",
             text: "No su pudo obtener la informacion"
           });
+          return false;
         }
       );
   }
 
-  goToPrevious(form: any) {
+  goToPrevious() {
     this.submitted = true;
     if (this.investmentID != undefined) {
       this.router.navigate(["/investment-proposal/general-info"], {
@@ -282,17 +305,6 @@ export class LETE implements InstrumentComponent {
   }
 
   goToNext(form: any) {
-    this.submitted = true;
-
-    if (this.save(form)) {
-      if (this.investmentID != undefined) {
-        console.log("paramsID");
-        this.router.navigate(["/investment-proposal/complement-info"], {
-          queryParams: { id: this.investmentID }
-        });
-      } else {
-        this.router.navigate(["/investment-proposal/complement-info"]);
-      }
-    }
+    this.getCalculations(form, true);
   }
 }

+ 10 - 3
src/app/components/instruments/pbur/pbur.component.html

@@ -344,8 +344,9 @@
         <div class="form-group text-right">
           <br />
           <button
+            type="button"
             class="btn btn-success center-component"
-            (click)="getCalculations(investmentProposalForm)"
+            (click)="getCalculations(investmentProposalForm, false)"
           >
             Realizar cálculos
           </button>
@@ -392,7 +393,7 @@
         </div>
         <div class="col-sm-6">
           <h4>Rendimiento neto:</h4>
-          <div class="field">{{ rendimiento_neto * 100 }} %</div>
+          <div class="field">{{ rendimiento_neto | number: "1.2-4" }} %</div>
         </div>
         <div class="col-sm-6">
           <h4>Total a pagar:</h4>
@@ -406,18 +407,24 @@
           <h4>Comision casa:</h4>
           <div class="field">$USD {{ comision_casa | number: "1.2-4" }}</div>
         </div>
+        <div class="col-sm-6">
+          <h4>Fecha de inicio de vigencia:</h4>
+          <div class="field">{{ fecha_inicio_vigencia }}</div>
+        </div>
       </div>
     </div>
 
     <br />
     <div class="form-group text-center space-20">
       <button
+        type="button"
         class="btn btn-default center-component margin-right"
-        (click)="goToPrevious(workForm)"
+        (click)="goToPrevious()"
       >
         Anterior
       </button>
       <button
+        type="submit"
         class="btn btn-primary center-component margin-right"
         (click)="goToNext(investmentProposalForm)"
       >

+ 67 - 55
src/app/components/instruments/pbur/pbur.component.ts

@@ -73,6 +73,7 @@ export class PBUR implements InstrumentComponent {
   plazo: number = 0;
   interes_acumulado: number = 0;
   fecha_inicio_vigencia: string;
+  instrumentSaved: boolean;
 
   constructor(
     private formBuilder: FormBuilder,
@@ -84,7 +85,9 @@ export class PBUR implements InstrumentComponent {
   ) {
     this.instrument_work = this.formDataService.getWork();
     this.instrument_exists = this.instrument_work == undefined;
-
+    console.log(this.instrument_work);
+    console.log("instrument exists");
+    console.log(this.instrument_exists);
     this.general = this.formDataService.getGeneralInfo();
 
     //getIncomeFormat
@@ -149,7 +152,7 @@ export class PBUR implements InstrumentComponent {
               singleDate: {
                 jsDate: parse(
                   this.instrument_work.fecha_liquidacion,
-                  "dd/MM/yyyy HH:mm:ss",
+                  "dd/MM/yyyy",
                   new Date()
                 ),
                 formatted: this.instrument_work.fecha_liquidacion
@@ -165,7 +168,7 @@ export class PBUR implements InstrumentComponent {
               singleDate: {
                 jsDate: parse(
                   this.instrument_work.fecha_vencimiento,
-                  "dd/MM/yyyy HH:mm:ss",
+                  "dd/MM/yyyy",
                   new Date()
                 ),
                 formatted: this.instrument_work.fecha_vencimiento
@@ -181,7 +184,7 @@ export class PBUR implements InstrumentComponent {
               singleDate: {
                 jsDate: parse(
                   this.instrument_work.fecha_operacion,
-                  "dd/MM/yyyy HH:mm:ss",
+                  "dd/MM/yyyy",
                   new Date()
                 ),
                 formatted: this.instrument_work.fecha_operacion
@@ -197,7 +200,7 @@ export class PBUR implements InstrumentComponent {
               singleDate: {
                 jsDate: parse(
                   this.instrument_work.fecha_ultima_cupon,
-                  "dd/MM/yyyy HH:mm:ss",
+                  "dd/MM/yyyy",
                   new Date()
                 ),
                 formatted: this.instrument_work.fecha_ultima_cupon
@@ -215,40 +218,10 @@ export class PBUR implements InstrumentComponent {
     if (!form.valid) {
       return false;
     }
-    this.pburObject = {
-      valor_nominal: this.investmentProposalForm.value.valor_nominal,
-      renta_porcentaje: this.investmentProposalForm.value.renta_porcentaje,
-      comision_casa_porcentaje: this.investmentProposalForm.value
-        .comision_casa_porcentaje,
-      comision_bolsa_porcentaje: this.investmentProposalForm.value
-        .comision_bolsa_porcentaje,
-      rendimiento_bruto: this.investmentProposalForm.value.rendimiento_bruto,
-      otros_costos: this.investmentProposalForm.value.otros_costos,
-      plazo: this.investmentProposalForm.value.plazo,
-      //id_formato_ingreso: this.investmentProposalForm.value.id_formato_ingreso,
-
-      fecha_operacion: this.investmentProposalForm.value.fecha_operacion
-        .singleDate.formatted,
-      fecha_liquidacion:
-        this.investmentProposalForm.value.fecha_liquidacion.singleDate
-          .formatted || "",
-      fecha_ultima_cupon:
-        this.investmentProposalForm.value.fecha_ultima_cupon != undefined
-          ? this.investmentProposalForm.value.fecha_ultima_cupon.singleDate
-              .formatted
-          : "",
-      fecha_vencimiento:
-        this.investmentProposalForm.value.fecha_vencimiento != undefined
-          ? this.investmentProposalForm.value.fecha_vencimiento.singleDate
-              .formatted
-          : ""
-    };
-
-    this.formDataService.setWork(this.pburObject);
     return true;
   }
 
-  getCalculations(form: any) {
+  getCalculations(form: any, saveForm: boolean) {
     this.submitted = true;
     if (!form.valid) {
       return false;
@@ -271,10 +244,9 @@ export class PBUR implements InstrumentComponent {
         {
           valor_par: false,
           valor_nominal: +this.f.valor_nominal.value,
-          comision_casa_porcentaje: this.f.comision_casa_porcentaje.value / 100,
-          comision_bolsa_porcentaje:
-            this.f.comision_bolsa_porcentaje.value / 100,
-          rendimiento_bruto: this.f.rendimiento_bruto.value / 100,
+          comision_casa_porcentaje: this.f.comision_casa_porcentaje.value,
+          comision_bolsa_porcentaje: this.f.comision_bolsa_porcentaje.value,
+          rendimiento_bruto: this.f.rendimiento_bruto.value,
           otros_costos: this.f.otros_costos.value,
           plazo: this.f.plazo.value,
           renta_porcentaje: this.f.renta_porcentaje.value,
@@ -289,7 +261,6 @@ export class PBUR implements InstrumentComponent {
       )
       .subscribe(
         ans => {
-          console.log(ans);
           this.ingreso_bruto = ans["result"]["ingreso_bruto"];
           this.ingreso_neto = ans["result"]["ingreso_neto"];
           this.valor_transado = ans["result"]["valor_transado"];
@@ -301,8 +272,59 @@ export class PBUR implements InstrumentComponent {
           this.plazo = ans["result"]["plazo"];
           this.interes_acumulado = ans["result"]["interes_acumulado"];
           this.fecha_inicio_vigencia = ans["result"]["fecha_inicio_vigencia"];
-          console.log(ans);
+
+          this.pburObject = {
+            valor_nominal: this.investmentProposalForm.value.valor_nominal,
+            renta_porcentaje: this.investmentProposalForm.value
+              .renta_porcentaje,
+            comision_casa_porcentaje: this.investmentProposalForm.value
+              .comision_casa_porcentaje,
+            comision_bolsa_porcentaje: this.investmentProposalForm.value
+              .comision_bolsa_porcentaje,
+            comision_casa: ans["result"]["comision_casa"],
+            comision_bolsa: ans["result"]["comision_bolsa"],
+            rendimiento_bruto: this.investmentProposalForm.value
+              .rendimiento_bruto,
+            otros_costos: this.investmentProposalForm.value.otros_costos,
+            ingreso_bruto: ans["result"]["ingreso_bruto"],
+            ingreso_neto: ans["result"]["ingreso_neto"],
+
+            valor_transado: ans["result"]["valor_transado"],
+            precio_porcentaje: ans["result"]["precio_porcentaje"],
+            rendimiento_neto: ans["result"]["rendimiento_neto"],
+            total_pagar: ans["result"]["total_pagar"],
+            interes_acumulado: ans["result"]["interes_acumulado"],
+            fecha_inicio_vigencia: ans["result"]["fecha_inicio_vigencia"],
+            plazo: this.investmentProposalForm.value.plazo,
+            //id_formato_ingreso: this.investmentProposalForm.value.id_formato_ingreso,
+
+            fecha_operacion: this.investmentProposalForm.value.fecha_operacion
+              .singleDate.formatted,
+            fecha_liquidacion:
+              this.investmentProposalForm.value.fecha_liquidacion.singleDate
+                .formatted || "",
+            fecha_ultima_cupon:
+              this.investmentProposalForm.value.fecha_ultima_cupon != undefined
+                ? this.investmentProposalForm.value.fecha_ultima_cupon
+                    .singleDate.formatted
+                : "",
+            fecha_vencimiento:
+              this.investmentProposalForm.value.fecha_vencimiento != undefined
+                ? this.investmentProposalForm.value.fecha_vencimiento.singleDate
+                    .formatted
+                : ""
+          };
+          this.formDataService.setWork(this.pburObject);
           Swal.close();
+          if (saveForm == true) {
+            if (this.investmentID != undefined) {
+              this.router.navigate(["/investment-proposal/complement-info"], {
+                queryParams: { id: this.investmentID }
+              });
+            } else {
+              this.router.navigate(["/investment-proposal/complement-info"]);
+            }
+          }
         },
         err => {
           Swal.fire({
@@ -310,11 +332,12 @@ export class PBUR implements InstrumentComponent {
             title: "Error en el servidor",
             text: "No su pudo obtener la informacion"
           });
+          return false;
         }
       );
   }
 
-  goToPrevious(form: any) {
+  goToPrevious() {
     this.submitted = true;
     if (this.investmentID != undefined) {
       this.router.navigate(["/investment-proposal/general-info"], {
@@ -326,17 +349,6 @@ export class PBUR implements InstrumentComponent {
   }
 
   goToNext(form: any) {
-    this.submitted = true;
-
-    if (this.save(form)) {
-      if (this.investmentID != undefined) {
-        console.log("paramsID");
-        this.router.navigate(["/investment-proposal/complement-info"], {
-          queryParams: { id: this.investmentID }
-        });
-      } else {
-        this.router.navigate(["/investment-proposal/complement-info"]);
-      }
-    }
+    this.getCalculations(form, true);
   }
 }

+ 10 - 3
src/app/components/instruments/vcn/vcn.component.html

@@ -344,8 +344,9 @@
         <div class="form-group text-right">
           <br />
           <button
+            type="button"
             class="btn btn-success center-component"
-            (click)="getCalculations(investmentProposalForm)"
+            (click)="getCalculations(investmentProposalForm, false)"
           >
             Realizar cálculos
           </button>
@@ -394,7 +395,7 @@
         </div>
         <div class="col-sm-6">
           <h4>Rendimiento neto:</h4>
-          <div class="field">{{ rendimiento_neto * 100 }} %</div>
+          <div class="field">{{ rendimiento_neto | number: "1.2-4" }} %</div>
         </div>
         <div class="col-sm-6">
           <h4>Total a pagar:</h4>
@@ -408,18 +409,24 @@
           <h4>Comision casa:</h4>
           <div class="field">$USD {{ comision_casa | number: "1.2-4" }}</div>
         </div>
+        <div class="col-sm-6">
+          <h4>Fecha de inicio de vigencia:</h4>
+          <div class="field">{{ fecha_inicio_vigencia }}</div>
+        </div>
       </div>
     </div>
 
     <br />
     <div class="form-group text-center space-20">
       <button
+        type="button"
         class="btn btn-default center-component margin-right"
-        (click)="goToPrevious(workForm)"
+        (click)="goToPrevious()"
       >
         Anterior
       </button>
       <button
+        type="submit"
         class="btn btn-primary center-component margin-right"
         (click)="goToNext(investmentProposalForm)"
       >

+ 64 - 52
src/app/components/instruments/vcn/vcn.component.ts

@@ -149,7 +149,7 @@ export class VCN implements InstrumentComponent {
               singleDate: {
                 jsDate: parse(
                   this.instrument_work.fecha_liquidacion,
-                  "dd/MM/yyyy HH:mm:ss",
+                  "dd/MM/yyyy",
                   new Date()
                 ),
                 formatted: this.instrument_work.fecha_liquidacion
@@ -165,7 +165,7 @@ export class VCN implements InstrumentComponent {
               singleDate: {
                 jsDate: parse(
                   this.instrument_work.fecha_vencimiento,
-                  "dd/MM/yyyy HH:mm:ss",
+                  "dd/MM/yyyy",
                   new Date()
                 ),
                 formatted: this.instrument_work.fecha_vencimiento
@@ -181,7 +181,7 @@ export class VCN implements InstrumentComponent {
               singleDate: {
                 jsDate: parse(
                   this.instrument_work.fecha_operacion,
-                  "dd/MM/yyyy HH:mm:ss",
+                  "dd/MM/yyyy",
                   new Date()
                 ),
                 formatted: this.instrument_work.fecha_operacion
@@ -197,7 +197,7 @@ export class VCN implements InstrumentComponent {
               singleDate: {
                 jsDate: parse(
                   this.instrument_work.fecha_ultima_cupon,
-                  "dd/MM/yyyy HH:mm:ss",
+                  "dd/MM/yyyy",
                   new Date()
                 ),
                 formatted: this.instrument_work.fecha_ultima_cupon
@@ -215,39 +215,12 @@ export class VCN implements InstrumentComponent {
     if (!form.valid) {
       return false;
     }
-    this.vcnObject = {
-      valor_nominal: this.investmentProposalForm.value.valor_nominal,
-      renta_porcentaje: this.investmentProposalForm.value.renta_porcentaje,
-      comision_casa_porcentaje: this.investmentProposalForm.value
-        .comision_casa_porcentaje,
-      comision_bolsa_porcentaje: this.investmentProposalForm.value
-        .comision_bolsa_porcentaje,
-      rendimiento_bruto: this.investmentProposalForm.value.rendimiento_bruto,
-      otros_costos: this.investmentProposalForm.value.otros_costos,
-      //id_formato_ingreso: this.investmentProposalForm.value.id_formato_ingreso,
-      plazo: this.investmentProposalForm.value.plazo,
-      fecha_operacion: this.investmentProposalForm.value.fecha_operacion
-        .singleDate.formatted,
-      fecha_liquidacion:
-        this.investmentProposalForm.value.fecha_liquidacion.singleDate
-          .formatted || "",
-      fecha_ultima_cupon:
-        this.investmentProposalForm.value.fecha_ultima_cupon != undefined
-          ? this.investmentProposalForm.value.fecha_ultima_cupon.singleDate
-              .formatted
-          : "",
-      fecha_vencimiento:
-        this.investmentProposalForm.value.fecha_vencimiento != undefined
-          ? this.investmentProposalForm.value.fecha_vencimiento.singleDate
-              .formatted
-          : ""
-    };
 
     this.formDataService.setWork(this.vcnObject);
     return true;
   }
 
-  getCalculations(form: any) {
+  getCalculations(form: any, saveForm: boolean) {
     this.submitted = true;
     if (!form.valid) {
       return false;
@@ -261,7 +234,7 @@ export class VCN implements InstrumentComponent {
 
     this.instrumentCalcService
       .vcnCalc(
-        "VCN", // Codigo del instrumento
+        "PBUR", // Codigo del instrumento
         {
           id_tipo_base: this.general.base_anual,
           id_periodicidad: this.general.periodicidad,
@@ -270,10 +243,9 @@ export class VCN implements InstrumentComponent {
         {
           valor_par: false,
           valor_nominal: +this.f.valor_nominal.value,
-          comision_casa_porcentaje: this.f.comision_casa_porcentaje.value / 100,
-          comision_bolsa_porcentaje:
-            this.f.comision_bolsa_porcentaje.value / 100,
-          rendimiento_bruto: this.f.rendimiento_bruto.value / 100,
+          comision_casa_porcentaje: this.f.comision_casa_porcentaje.value,
+          comision_bolsa_porcentaje: this.f.comision_bolsa_porcentaje.value,
+          rendimiento_bruto: this.f.rendimiento_bruto.value,
           otros_costos: this.f.otros_costos.value,
           plazo: this.f.plazo.value,
           renta_porcentaje: this.f.renta_porcentaje.value,
@@ -288,7 +260,6 @@ export class VCN implements InstrumentComponent {
       )
       .subscribe(
         ans => {
-          console.log(ans);
           this.ingreso_bruto = ans["result"]["ingreso_bruto"];
           this.ingreso_neto = ans["result"]["ingreso_neto"];
           this.valor_transado = ans["result"]["valor_transado"];
@@ -300,8 +271,59 @@ export class VCN implements InstrumentComponent {
           this.plazo = ans["result"]["plazo"];
           this.interes_acumulado = ans["result"]["interes_acumulado"];
           this.fecha_inicio_vigencia = ans["result"]["fecha_inicio_vigencia"];
-          console.log(ans);
+
+          this.vcnObject = {
+            valor_nominal: this.investmentProposalForm.value.valor_nominal,
+            renta_porcentaje: this.investmentProposalForm.value
+              .renta_porcentaje,
+            comision_casa_porcentaje: this.investmentProposalForm.value
+              .comision_casa_porcentaje,
+            comision_bolsa_porcentaje: this.investmentProposalForm.value
+              .comision_bolsa_porcentaje,
+            comision_casa: ans["result"]["comision_casa"],
+            comision_bolsa: ans["result"]["comision_bolsa"],
+            rendimiento_bruto: this.investmentProposalForm.value
+              .rendimiento_bruto,
+            otros_costos: this.investmentProposalForm.value.otros_costos,
+            ingreso_bruto: ans["result"]["ingreso_bruto"],
+            ingreso_neto: ans["result"]["ingreso_neto"],
+
+            valor_transado: ans["result"]["valor_transado"],
+            precio_porcentaje: ans["result"]["precio_porcentaje"],
+            rendimiento_neto: ans["result"]["rendimiento_neto"],
+            total_pagar: ans["result"]["total_pagar"],
+            interes_acumulado: ans["result"]["interes_acumulado"],
+            fecha_inicio_vigencia: ans["result"]["fecha_inicio_vigencia"],
+            plazo: this.investmentProposalForm.value.plazo,
+            //id_formato_ingreso: this.investmentProposalForm.value.id_formato_ingreso,
+
+            fecha_operacion: this.investmentProposalForm.value.fecha_operacion
+              .singleDate.formatted,
+            fecha_liquidacion:
+              this.investmentProposalForm.value.fecha_liquidacion.singleDate
+                .formatted || "",
+            fecha_ultima_cupon:
+              this.investmentProposalForm.value.fecha_ultima_cupon != undefined
+                ? this.investmentProposalForm.value.fecha_ultima_cupon
+                    .singleDate.formatted
+                : "",
+            fecha_vencimiento:
+              this.investmentProposalForm.value.fecha_vencimiento != undefined
+                ? this.investmentProposalForm.value.fecha_vencimiento.singleDate
+                    .formatted
+                : ""
+          };
+          this.formDataService.setWork(this.vcnObject);
           Swal.close();
+          if (saveForm == true) {
+            if (this.investmentID != undefined) {
+              this.router.navigate(["/investment-proposal/complement-info"], {
+                queryParams: { id: this.investmentID }
+              });
+            } else {
+              this.router.navigate(["/investment-proposal/complement-info"]);
+            }
+          }
         },
         err => {
           Swal.fire({
@@ -309,11 +331,12 @@ export class VCN implements InstrumentComponent {
             title: "Error en el servidor",
             text: "No su pudo obtener la informacion"
           });
+          return false;
         }
       );
   }
 
-  goToPrevious(form: any) {
+  goToPrevious() {
     this.submitted = true;
     if (this.investmentID != undefined) {
       this.router.navigate(["/investment-proposal/general-info"], {
@@ -325,17 +348,6 @@ export class VCN implements InstrumentComponent {
   }
 
   goToNext(form: any) {
-    this.submitted = true;
-
-    if (this.save(form)) {
-      if (this.investmentID != undefined) {
-        console.log("paramsID");
-        this.router.navigate(["/investment-proposal/complement-info"], {
-          queryParams: { id: this.investmentID }
-        });
-      } else {
-        this.router.navigate(["/investment-proposal/complement-info"]);
-      }
-    }
+    this.getCalculations(form, true);
   }
 }

+ 5 - 3
src/app/components/investment-proposals/complement-info/complement-info.component.html

@@ -213,9 +213,9 @@
                         >
                           <option
                             *ngFor="let item of operations"
-                            [value]="item.id_tipo_operaciones"
+                            [value]="item.id_tipo_operacion"
                             [selected]="
-                              item.id_tipo_operaciones ==
+                              item.id_tipo_operacion ==
                               complementInfo.operaciones
                             "
                           >
@@ -383,12 +383,14 @@
                   <br />
                   <div class="form-group text-center space-20">
                     <button
+                      type="button"
                       class="btn btn-default center-component margin-right"
-                      (click)="goToPrevious(workForm)"
+                      (click)="goToPrevious()"
                     >
                       Anterior
                     </button>
                     <button
+                      type="submit"
                       class="btn btn-primary center-component margin-right"
                       (click)="goToNext(investmentProposalForm)"
                     >

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

@@ -168,7 +168,7 @@ export class ComplementInfoComponent implements OnInit {
     return true;
   }
 
-  goToPrevious(form: any) {
+  goToPrevious() {
     this.submitted = true;
     if (this.investmentProposalID != undefined) {
       this.router.navigate(["/investment-proposal/instrument-work"], {

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

@@ -349,6 +349,7 @@
                   <br />
                   <div class="form-group text-center space-20">
                     <button
+                      type="submit"
                       class="btn btn-primary center-component margin-right"
                       (click)="goToNext(investmentProposalForm)"
                     >

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

@@ -111,7 +111,7 @@ export class InvestmentProposalGeneralInfoComponent
             console.log("results");
             console.log(res);
             console.log("-------");
-
+            console.log(this.formDataService.getFormData());
             this.gInfo = {
               asunto: res["result"]["asunto"],
               origenes_fondo:
@@ -213,6 +213,8 @@ export class InvestmentProposalGeneralInfoComponent
             }
 
             this.instrument = this.formDataService.getWork();
+            console.log("inicializar instrumento");
+            console.log(this.instrument);
             if (
               this.instrument == undefined ||
               Object.values(this.instrument).every(x => x === null || x === "")

+ 28 - 6
src/app/components/investment-proposals/investment-proposals.component.html

@@ -13,10 +13,7 @@
               <li class="breadcrumb-item">Propuestas de inversión</li>
             </ol>
           </nav>
-          <a
-            class="btn btn-primary"
-            (click)="create_investment_proposal()"
-          >
+          <a class="btn btn-primary" (click)="create_investment_proposal()">
             Nuevo registro
           </a>
         </div>
@@ -99,6 +96,13 @@
                   <th mat-header-cell *matHeaderCellDef>&nbsp;</th>
                   <td mat-cell *matCellDef="let row">
                     <div class="action-buttons">
+                      <a
+                        title="Detalle propuesta"
+                        class="btn btn-primary btn-custom-small"
+                        (click)="view_investment_proposal(row.id_inversion)"
+                      >
+                        <i class="fas fa-info"></i>
+                      </a>
                       <a
                         *ngIf="
                           can_modify_or_send_to_review(
@@ -138,7 +142,10 @@
                         <i class="fas fa-spell-check"></i>
                       </a>
                       <a
-                        title="Informacion de pago"
+                        *ngIf="
+                          can_write_payment_info(row.id_estado_inversion.codigo)
+                        "
+                        title="Información de pago"
                         class="btn btn-warning btn-custom-small"
                         [routerLink]="[
                           '/investment-proposal',
@@ -148,6 +155,21 @@
                       >
                         <i class="fas fa-money-check-alt"></i>
                       </a>
+                      <a
+                        *ngIf="
+                          can_write_payment_info(row.id_estado_inversion.codigo)
+                        "
+                        title="Requisición de pago"
+                        class="btn btn-success btn-custom-small"
+                        [routerLink]="[
+                          '/investment-proposal',
+                          row.id_inversion,
+                          'payment'
+                        ]"
+                      >
+                        <i class="fas fa-money-bill-wave"></i>
+                      </a>
+                      <!--
                       <a
                         title="Historico"
                         class="btn btn-link btn-custom-small"
@@ -158,7 +180,7 @@
                         ]"
                       >
                         <i class="fas fa-history"></i>
-                      </a>
+                      </a>-->
                     </div>
                   </td>
                 </ng-container>

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

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

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

@@ -117,6 +117,19 @@ export class InvestmentProposalsComponent implements OnInit {
     }
   }
 
+  view_investment_proposal(id: string) {
+    this.formInvestmentProposal.resetFormData();
+    Swal.fire({
+      allowOutsideClick: false,
+      icon: "info",
+      text: "Espere por favor..."
+    });
+    Swal.showLoading();
+    setTimeout(() => {
+      this.router.navigate([`/investment-proposal/${id}`]);
+    }, 1000);
+  }
+
   modify_investment_proposal(id: string) {
     this.formInvestmentProposal.resetFormData();
 
@@ -167,6 +180,15 @@ export class InvestmentProposalsComponent implements OnInit {
     }
   }
 
+  can_write_payment_info(status: string) {
+    if (status == "REVIS" && (this.userRole.length == 0 || this.userRole)) {
+      // TO DO ver que el codigo de los tipos de usuario
+      return true;
+    } else {
+      return false;
+    }
+  }
+
   sendToReview(investmentProposalID: number, investmentCode: string) {
     (async () => {
       const { value: comentario } = await Swal.fire({
@@ -203,6 +225,7 @@ export class InvestmentProposalsComponent implements OnInit {
                   confirmButtonText: "La propuesta ha sido enviada a revisión"
                 }).then(result => {
                   Swal.close();
+                  window.location.reload();
                 });
               }
             },

+ 10 - 13
src/app/components/investment-proposals/payment-info/payment-info.component.html

@@ -76,26 +76,23 @@
 
                     <select
                       class="custom-select"
-                      formControlName="payment_types"
+                      formControlName="tipo_pago"
                       [ngClass]="{
-                        'is-invalid': submitted && f.payment_types.errors
+                        'is-invalid': submitted && f.tipo_pago.errors
                       }"
                     >
                       <option
-                        *ngFor="let item of funds"
-                        [value]="item.id_payment_types"
-                        [selected]="
-                          item.id_payment_types == general.payment_types
-                        "
+                        *ngFor="let item of payment_types"
+                        [value]="item.id_tipo_pago"
                       >
                         {{ item.nombre }}</option
                       >
                     </select>
                     <div
-                      *ngIf="submitted && f.payment_types.errors"
+                      *ngIf="submitted && f.tipo_pago.errors"
                       class="invalid-feedback"
                     >
-                      <div *ngIf="f.payment_types.errors.required">
+                      <div *ngIf="f.tipo_pago.errors.required">
                         Campo requerido
                       </div>
                     </div>
@@ -116,9 +113,6 @@
                       <option
                         *ngFor="let item of funds"
                         [value]="item.id_cuenta_bancaria"
-                        [selected]="
-                          item.id_cuenta_bancaria == general.cuenta_bancaria
-                        "
                       >
                         {{ item.nombre }}</option
                       >
@@ -207,7 +201,10 @@
                 <div class="col-lg-12 col-sm-12 pr-xl-12">
                   <div class="form-group text-right">
                     <br />
-                    <button class="btn btn-primary center-component">
+                    <button
+                      class="btn btn-primary center-component"
+                      type="submit"
+                    >
                       Enviar información de pago
                     </button>
                   </div>

+ 4 - 3
src/app/components/investment-proposals/payment-info/payment-info.component.ts

@@ -59,7 +59,7 @@ export class PaymentInfoComponent implements OnInit {
   rate_agencies: any;
   scores: any;
   investmentProposalID: string;
-  countries: any;
+  funds: any;
   companies: any;
   format_incomes: any;
   operations: any;
@@ -103,9 +103,10 @@ export class PaymentInfoComponent implements OnInit {
 
     this.catalogService.getPaymentTypes().subscribe(res => {
       this.payment_types = res;
+      console.log(this.payment_types);
     });
     this.catalogService.getCountries().subscribe(res => {
-      this.countries = res;
+      this.funds = res;
     });
 
     this.investmentProposalForm = this.formBuilder.group({
@@ -116,7 +117,7 @@ export class PaymentInfoComponent implements OnInit {
           Validators.pattern(/^[+]?([0-9]+(?:[\.][0-9]*)?|\.[0-9]+)$/)
         ]
       ],
-      payment_types: ["", [Validators.required]],
+      tipo_pago: ["", [Validators.required]],
       cuenta_bancaria: [""],
       fecha_pago: ["", Validators.required],
       fecha_vencimiento: ["", Validators.required]

+ 50 - 21
src/app/components/investment-proposals/payment-requirement/payment-requirement.component.html

@@ -15,7 +15,7 @@
                   Propuestas de inversión
                 </a>
               </li>
-              <li class="breadcrumb-item">Revisar</li>
+              <li class="breadcrumb-item">Requisición</li>
             </ol>
           </nav>
         </div>
@@ -30,31 +30,60 @@
           <div class="card borderless">
             <div class="card-header card-header-icon card-header-rose">
               <h4 class="card-title">
-                Resumen de la propuesta
+                Requisición
               </h4>
             </div>
             <div class="card-body">
               <div class="align-container">
-                <form [formGroup]="form" (ngSubmit)="submitForm()">
-                  <div class="form-group">
-                    asdasd
-                    <input type="file" (change)="uploadFile($event)" />
-                  </div>
+                <form>
+                  <div class="row">
+                    <div class="col-lg-6 col-sm-12 pr-xl-6">
+                      <div class="form-group">
+                        <label for="comentario">Comentario: </label>
 
-                  <div class="form-group input-group-lg">
-                    <input
-                      class="form-control"
-                      placeholder="Name"
-                      formControlName="name"
-                    />
-                  </div>
-                  <div class="review-buttons">
-                    <button
-                      class="btn btn-success"
-                      (click)="approve_proposal()"
-                    >
-                      Guardar requisición de pago
-                    </button>
+                        <textarea
+                          rows="2"
+                          class="form-control"
+                          name="comentario"
+                        ></textarea>
+                      </div>
+                    </div>
+
+                    <div class="col-lg-6 col-sm-12 pr-xl-6">
+                      <div class="form-group">
+                        <label for="justificacion">Archivo: </label>
+
+                        <input
+                          type="file"
+                          name="evidencia"
+                          (change)="fileProgress($event)"
+                        />
+                      </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>
+
+                    <br />
+                    <div class="col-lg-6 col-sm-12 pr-xl-6">
+                      <div class="form-group">
+                        <button
+                          class="btn btn-primary"
+                          (click)="onSubmit()"
+                          type="submit"
+                        >
+                          Enviar requisición de pago
+                        </button>
+                      </div>
+                    </div>
                   </div>
                 </form>
               </div>

+ 6 - 0
src/app/components/investment-proposals/payment-requirement/payment-requirement.component.scss

@@ -19,3 +19,9 @@
 .drop-file-over {
   background: #333;
 }
+
+.form-group input[type="file"] {
+  opacity: 1;
+  z-index: 1;
+  position: relative;
+}

+ 29 - 23
src/app/components/investment-proposals/payment-requirement/payment-requirement.component.ts

@@ -2,7 +2,7 @@ import { Component, OnInit } from "@angular/core";
 import { FileUploader, FileLikeObject } from "ng2-file-upload";
 import { concat } from "rxjs";
 import { FormBuilder, FormGroup } from "@angular/forms";
-import { HttpClient } from "@angular/common/http";
+import { HttpClient, HttpEventType } from "@angular/common/http";
 
 @Component({
   selector: "app-payment-requirement",
@@ -13,34 +13,40 @@ export class PaymentRequirementComponent implements OnInit {
   title: string = "Formulario de requisición de pago";
 
   form: FormGroup;
-  public uploader: FileUploader = new FileUploader({});
-  public hasBaseDropZoneOver: boolean = false;
+  fileData: File = null;
+  previewUrl: any = null;
+  fileUploadProgress: string = null;
+  uploadedFilePath: string = null;
+  constructor(private http: HttpClient) {}
 
   ngOnInit() {}
 
-  constructor(public fb: FormBuilder, private http: HttpClient) {
-    this.form = this.fb.group({
-      name: [""],
-      avatar: [null]
-    });
+  fileProgress(fileInput: any) {
+    this.fileData = <File>fileInput.target.files[0];
+    this.preview();
   }
 
-  uploadFile(event) {
-    const file = (event.target as HTMLInputElement).files[0];
-    this.form.patchValue({
-      avatar: file
-    });
-    this.form.get("avatar").updateValueAndValidity();
-  }
+  preview() {
+    // Show preview
+    var mimeType = this.fileData.type;
+    if (mimeType.match(/image\/*/) == null) {
+      return;
+    }
 
-  submitForm() {
-    var formData: any = new FormData();
-    formData.append("name", this.form.get("name").value);
-    formData.append("avatar", this.form.get("avatar").value);
+    var reader = new FileReader();
+    reader.readAsDataURL(this.fileData);
+    reader.onload = _event => {
+      this.previewUrl = reader.result;
+    };
+  }
 
-    this.http.post("http://localhost:4000/api/create-user", formData).subscribe(
-      response => console.log(response),
-      error => console.log(error)
-    );
+  onSubmit() {
+    const formData = new FormData();
+    formData.append("file", this.fileData);
+    this.http.post("url/to/your/api", formData).subscribe(res => {
+      console.log(res);
+      //this.uploadedFilePath = res.data.filePath;
+      alert("SUCCESS !!");
+    });
   }
 }

+ 172 - 0
src/app/components/investment-proposals/proposal-detail/proposal-detail.component.html

@@ -0,0 +1,172 @@
+<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">Detalle propuesta</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">
+                Resumen de la propuesta
+              </h4>
+            </div>
+            <div class="card-body">
+              <div class="align-container">
+                <ul class="timeline timeline-simple">
+                  <li class="timeline-inverted">
+                    <div class="timeline-badge"></div>
+                    <div class="timeline-panel">
+                      <div class="timeline-heading">
+                        <span class="badge badge-success"
+                          >Información general</span
+                        >
+                      </div>
+                      <div class="timeline-body">
+                        <div class="row">
+                          <div class="col-lg-3 col-md-4 col-sm-6">
+                            <h4>Asunto:</h4>
+                            <div class="field">
+                              {{ subject }}
+                            </div>
+                          </div>
+                          <div class="col-lg-3 col-md-4 col-sm-6">
+                            <h4>Orígenes de fondo:</h4>
+                            <div class="field">
+                              {{ funds }}
+                            </div>
+                          </div>
+                          <div class="col-lg-3 col-md-4 col-sm-6">
+                            <h4>Nombre:</h4>
+                            <div class="field">
+                              {{ investmentName }}
+                            </div>
+                          </div>
+                          <div class="col-lg-3 col-md-4 col-sm-6">
+                            <h4>Tipo Tasa:</h4>
+                            <div class="field">
+                              {{ rates }}
+                            </div>
+                          </div>
+                          <div class="col-lg-3 col-md-4 col-sm-6">
+                            <h4>Tipo Renta:</h4>
+                            <div class="field">
+                              {{ revenues }}
+                            </div>
+                          </div>
+                          <div class="col-lg-3 col-md-4 col-sm-6">
+                            <h4>Periodicidad:</h4>
+                            <div class="field">
+                              {{ periodicities }}
+                            </div>
+                          </div>
+                          <div class="col-lg-3 col-md-4 col-sm-6">
+                            <h4>Instrumentos:</h4>
+                            <div class="field">
+                              {{ instrumentTypes }}
+                            </div>
+                          </div>
+                          <div class="col-lg-3 col-md-4 col-sm-6">
+                            <h4>Casa:</h4>
+                            <div class="field">
+                              {{ financials }}
+                            </div>
+                          </div>
+                          <div class="col-lg-3 col-md-4 col-sm-6">
+                            <h4>Base:</h4>
+                            <div class="field">
+                              {{ base_types }}
+                            </div>
+                          </div>
+                          <div class="col-lg-3 col-md-4 col-sm-6">
+                            <h4>Tipo de mercado:</h4>
+                            <div class="field">
+                              {{ markets }}
+                            </div>
+                          </div>
+                          <div class="col-lg-3 col-md-4 col-sm-6">
+                            <h4>Emisores:</h4>
+                            <div class="field">
+                              {{ emitters }}
+                            </div>
+                          </div>
+                          <div class="col-lg-3 col-md-4 col-sm-6">
+                            <h4>Empresa:</h4>
+                            <div class="field">
+                              {{ companies }}
+                            </div>
+                          </div>
+                          <div class="col-lg-3 col-md-4 col-sm-6">
+                            <h4>País:</h4>
+                            <div class="field">
+                              {{ countries }}
+                            </div>
+                          </div>
+                          <div class="col-lg-3 col-md-4 col-sm-6">
+                            <h4>Plazo:</h4>
+                            <div class="field">
+                              {{ payment_terms }}
+                            </div>
+                          </div>
+                          <div class="col-lg-3 col-md-4 col-sm-6">
+                            <h4>Tipos de operaciones:</h4>
+                            <div class="field">
+                              {{ operations }}
+                            </div>
+                          </div>
+                          <div class="col-lg-3 col-md-4 col-sm-6">
+                            <h4>Comentarios:</h4>
+                            <div class="field">
+                              {{ comment }}
+                            </div>
+                          </div>
+                          <div class="col-lg-3 col-md-4 col-sm-6">
+                            <h4>Justificación:</h4>
+                            <div class="field">
+                              {{ justification }}
+                            </div>
+                          </div>
+                        </div>
+                      </div>
+                    </div>
+                  </li>
+                  <li class="timeline-inverted">
+                    <div class="timeline-badge"></div>
+                    <div class="timeline-panel">
+                      <div class="timeline-heading">
+                        <span class="badge badge-warning">Instrumento</span>
+                        <ng-template instrument-host></ng-template>
+                      </div>
+                    </div>
+                  </li>
+                </ul>
+              </div>
+            </div>
+          </div>
+        </div>
+      </div>
+    </div>
+  </div>
+</div>

+ 6 - 0
src/app/components/investment-proposals/proposal-detail/proposal-detail.component.scss

@@ -0,0 +1,6 @@
+.review-buttons {
+  text-align: center;
+  button {
+    margin: 0 20px;
+  }
+}

+ 326 - 0
src/app/components/investment-proposals/proposal-detail/proposal-detail.component.ts

@@ -0,0 +1,326 @@
+import {
+  Component,
+  OnInit,
+  Input,
+  ViewChild,
+  ComponentFactoryResolver
+} from "@angular/core";
+import { Router, ActivatedRoute } from "@angular/router";
+import { InvestmentProposalForm } from "@app/models/investment-proposal-form";
+import { FormInvestmentProposalService } from "@app/services/form-investment-proposal.service";
+import { Instrument } from "@app/models/instrument";
+import { InvestmentProposalWorkflowService } from "@app/services/investment-proposal-workflow.service";
+import { InstrumentDirective } from "@app/components/investment-proposals/instrument/instrument.directive";
+import { InstrumentComponent } from "@app/components/investment-proposals/instrument/instrument.component";
+import { InstrumentsService } from "@app/services/instruments.service";
+import Swal from "sweetalert2";
+import { CatalogsService } from "@app/services/catalogs.service";
+import { InvestmentsService } from "@app/services/investments.service";
+
+@Component({
+  selector: "app-investment-proposal-detail",
+  templateUrl: "./proposal-detail.component.html",
+  styleUrls: ["./proposal-detail.component.scss"]
+})
+export class InvestmentProposalDetailComponent implements OnInit {
+  title = "Detalle de la propuesta de inversión";
+  @Input() ads: Instrument[];
+  @Input() formData: InvestmentProposalForm;
+  @ViewChild(InstrumentDirective, { static: true })
+  adHost: InstrumentDirective;
+  isFormValid: boolean = false;
+  general: any;
+  instrument: any;
+  complement: any;
+  final: any;
+  workType: string;
+  form: any;
+  currentAdIndex = -1;
+  interval: any;
+  indexDynamicComponent: number;
+  investmentProposalID: string;
+  investmentExists;
+  state;
+  financials;
+  base_types;
+  countries;
+  companies;
+  rates;
+  revenues;
+  funds;
+  instrumentTypes;
+  markets;
+  emitters;
+  periodicities;
+  format_incomes;
+  payment_terms;
+  operations;
+  gInfo: any;
+  gInstrument: any;
+  gComplement: any;
+  subject: any;
+  investmentName: any;
+  comment: any;
+  justification: any;
+
+  constructor(
+    private router: Router,
+
+    private formDataService: FormInvestmentProposalService,
+    private componentFactoryResolver: ComponentFactoryResolver,
+    private instrumentService: InvestmentProposalWorkflowService,
+    private loadInstrumentsService: InstrumentsService,
+    private catalogService: CatalogsService,
+    private route: ActivatedRoute,
+    private investmentService: 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");
+
+    if (this.investmentProposalID != undefined) {
+      this.investmentExists = true;
+      this.investmentService
+        .getProposalInvestment(this.investmentProposalID)
+        .subscribe(res => {
+          this.state = res["result"]["id_estado_inversion"]["codigo"];
+
+          this.gInfo = {
+            asunto: res["result"]["asunto"],
+            origenes_fondo:
+              res["result"]["id_origen_fondo"] == null
+                ? ""
+                : res["result"]["id_origen_fondo"]["id_origen_fondo"],
+            name: res["result"]["nombre_inversion"],
+            //date: "",
+            tipo_tasa: res["result"]["id_tipo_tasa"] || "",
+            tipo_renta:
+              res["result"]["id_tipo_renta"] == null
+                ? ""
+                : res["result"]["id_tipo_renta"]["id_tipo_renta"],
+            periodicidad:
+              res["result"]["id_periodicidad"] == null
+                ? ""
+                : res["result"]["id_periodicidad"]["id_periodicidad"],
+
+            instrumentos:
+              res["result"]["id_inversion_instrumento"]["id_tipo_instrumento"][
+                "codigo"
+              ],
+            base_anual:
+              res["result"]["id_tipo_base"] == null
+                ? ""
+                : res["result"]["id_tipo_base"]["id_tipo_base"],
+            casa:
+              res["result"]["id_entidad"] == null
+                ? ""
+                : res["result"]["id_entidad"]["id_entidad_financiera"],
+            formato_ingreso:
+              res["result"]["id_formato_ingreso"] == null
+                ? ""
+                : res["result"]["id_formato_ingreso"]["id_formato_ingreso"]
+          };
+
+          this.gInstrument =
+            res["result"]["id_inversion_instrumento"]["instrumento"];
+
+          this.gInstrument["id_inversion_instrumento"] =
+            res["result"]["id_inversion_instrumento"][
+              "id_inversion_instrumento"
+            ];
+
+          this.gComplement = {
+            tipo_mercado:
+              res["result"]["id_tipo_mercado"] == null
+                ? ""
+                : res["result"]["id_tipo_mercado"]["id_tipo_mercado"],
+            emisores:
+              res["result"]["id_tipo_emisor"] == null
+                ? ""
+                : res["result"]["id_tipo_emisor"]["id_tipo_emisor"],
+            empresa:
+              res["result"]["id_empresa"] == null
+                ? ""
+                : res["result"]["id_empresa"]["id_empresa"],
+            pais:
+              res["result"]["id_pais"] == null
+                ? ""
+                : res["result"]["id_pais"]["id_pais"],
+            plazo:
+              res["result"]["id_plazo"] == null
+                ? ""
+                : res["result"]["id_plazo"]["id_plazo"],
+            operaciones:
+              res["result"]["id_tipo_operacion"] == null
+                ? ""
+                : res["result"]["id_tipo_operacion"]["id_tipo_operacion"],
+            comentarios: res["result"]["comentario"],
+            justificacion: res["result"]["justificacion"]
+          };
+          this.formDataService.setGeneralInfo(this.gInfo);
+
+          this.formDataService.setWork(this.gInstrument);
+
+          this.formDataService.setComplementInfo(this.gComplement);
+
+          this.general = this.formDataService.getGeneralInfo();
+          this.instrument = this.formDataService.getWork();
+          this.complement = this.formDataService.getComplementInfo();
+          this.formData = this.formDataService.getFormData();
+
+          this.formData.instrumentos;
+
+          this.indexDynamicComponent = this.ads.findIndex(
+            x => x.component.name == this.formData.instrumentos
+          );
+          if (this.indexDynamicComponent >= 0) {
+            this.loadComponent();
+          } else {
+            console.log("No existe el componente");
+          }
+          if (this.general != undefined) {
+            this.subject = this.general.asunto;
+            this.investmentName = this.general.name;
+            this.comment = this.complement.comment;
+            this.justification = this.complement.comment;
+
+            this.catalogService.getFinancialEntities().subscribe(res => {
+              this.financials = res.find(
+                e => e.id_entidad_financiera == this.general.casa
+              );
+              this.financials =
+                this.financials != undefined ? this.financials.nombre : "-";
+            });
+
+            this.catalogService.getBaseTypes().subscribe(res => {
+              this.base_types = res.find(
+                e => e.id_tipo_base == this.general.base_anual
+              );
+              this.base_types =
+                this.base_types != undefined
+                  ? ` ${this.base_types.tipo_base} / ${this.base_types.tipo_base_dias}`
+                  : "-";
+            });
+
+            this.catalogService.getCountries().subscribe(res => {
+              this.countries = res.find(e => e.id_pais == this.complement.pais);
+              this.countries =
+                this.countries != undefined ? this.countries.nombre : "-";
+            });
+            this.catalogService.getCompanies().subscribe(res => {
+              this.companies = res.find(
+                e => e.id_empresa == this.complement.empresa
+              );
+              this.companies =
+                this.companies != undefined ? this.companies.nombre : "-";
+            });
+            this.catalogService.getRateTypes().subscribe(res => {
+              this.rates = res.find(
+                e => e.id_tipo_tasa == this.general.tipo_tasa
+              );
+              this.rates = this.rates != undefined ? this.rates.nombre : "-";
+            });
+            this.catalogService.getRevenueTypes().subscribe(res => {
+              this.revenues = res.find(
+                e => e.id_tipo_renta == this.general.tipo_renta
+              );
+              this.revenues =
+                this.revenues != undefined ? this.revenues.nombre : "-";
+            });
+
+            this.catalogService.getFundsOrigins().subscribe(res => {
+              this.funds = res.find(
+                e => e.id_origen_fondo == this.general.origenes_fondo
+              );
+              this.funds = this.funds != undefined ? this.funds.nombre : "-";
+            });
+            this.catalogService.getInstrumentTypes().subscribe(res => {
+              this.instrumentTypes = res.find(
+                e => e.codigo == this.general.instrumentos
+              );
+              this.instrumentTypes =
+                this.instrumentTypes != undefined
+                  ? this.instrumentTypes.nombre
+                  : "-";
+            });
+
+            this.catalogService.getMarketTypes().subscribe(res => {
+              this.markets = res.find(
+                e => e.id_tipo_mercado == this.complement.tipo_mercado
+              );
+              this.markets =
+                this.markets != undefined ? this.markets.nombre : "-";
+            });
+            this.catalogService.getEmitterTypes().subscribe(res => {
+              this.emitters = res.find(
+                e => e.id_tipo_emisor == this.complement.emisores
+              );
+              this.emitters =
+                this.emitters != undefined ? this.emitters.nombre : "-";
+            });
+            this.catalogService.getPeriodicities().subscribe(res => {
+              this.periodicities = res.find(
+                e => e.id_periodicidad == this.general.periodicidad
+              );
+              this.periodicities =
+                this.periodicities != undefined
+                  ? this.periodicities.nombre
+                  : "-";
+            });
+
+            this.catalogService.getPaymentTerms().subscribe(res => {
+              this.payment_terms = res.find(
+                e => e.codigo == this.complement.calificadora_riesgo
+              );
+              this.payment_terms =
+                this.payment_terms != undefined
+                  ? this.payment_terms.nombre
+                  : "-";
+            });
+            this.catalogService.getOperationTypes().subscribe(res => {
+              this.operations = res.find(
+                e => e.codigo == this.complement.operaciones
+              );
+              this.operations =
+                this.operations != undefined ? this.operations.nombre : "-";
+            });
+            //getIncomeFormat
+            this.catalogService.getIncomeFormat().subscribe(res => {
+              this.format_incomes = res.find(
+                e => e.id_formato_ingreso == this.general.formato_ingreso
+              );
+              this.format_incomes =
+                this.format_incomes != undefined
+                  ? this.format_incomes.nombre
+                  : "-";
+            });
+          }
+        });
+    } else {
+      this.investmentExists = false;
+    }
+    Swal.close();
+  }
+
+  loadComponent() {
+    this.currentAdIndex = this.indexDynamicComponent % this.ads.length;
+    const adItem = this.ads[this.currentAdIndex];
+    const componentFactory = this.componentFactoryResolver.resolveComponentFactory(
+      adItem.component
+    );
+
+    const viewContainerRef = this.adHost.viewContainerRef;
+    viewContainerRef.clear();
+
+    const componentRef = viewContainerRef.createComponent(componentFactory);
+    (<InstrumentComponent>componentRef.instance).data = adItem.data;
+    (<InstrumentComponent>componentRef.instance).summary = true;
+  }
+}

+ 10 - 6
src/app/components/investment-proposals/result/result.component.html

@@ -187,6 +187,7 @@
                     class="btn btn-success center-component"
                     [disabled]="!isFormValid"
                     (click)="submit()"
+                    type="button"
                   >
                     Guardar propuesta
                   </button>
@@ -198,26 +199,29 @@
                     href="#/investment-proposals"
                   >
                     Ir a listado
-                </a>
+                  </a>
 
                   <button
                     class="btn btn-primary center-component float-right"
+                    type="button"
                     (click)="sendToReview()"
                   >
                     Enviar a revision
                   </button>
                   <button
                     class="btn btn-success center-component margin-right float-right"
+                    type="button"
                     (click)="update_proposal()"
                   >
                     Guardar propuesta
                   </button>
                   <button
-                      class="btn btn-default center-component margin-right float-right"
-                      (click)="goToPrevious(workForm)"
-                    >
-                      Anterior
-                    </button>
+                    class="btn btn-default center-component margin-right float-right"
+                    type="button"
+                    (click)="goToPrevious()"
+                  >
+                    Anterior
+                  </button>
                 </div>
               </div>
             </div>

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

@@ -190,12 +190,14 @@ export class ResultComponent implements OnInit {
         this.periodicities != undefined ? this.periodicities.nombre : "-";
     });
     this.catalogService.getPaymentTerms().subscribe(res => {
-      this.payment_terms = res.find(e => e.codigo == this.complement.plazo);
+      this.payment_terms = res.find(e => e.id_plazo == this.complement.plazo);
       this.payment_terms =
         this.payment_terms != undefined ? this.payment_terms.nombre : "-";
     });
     this.catalogService.getOperationTypes().subscribe(res => {
-      this.operations = res.find(e => e.codigo == this.complement.operaciones);
+      this.operations = res.find(
+        e => e.id_tipo_operacion == this.complement.operaciones
+      );
       this.operations =
         this.operations != undefined ? this.operations.nombre : "-";
     });
@@ -212,24 +214,25 @@ export class ResultComponent implements OnInit {
     this.final = {};
 
     Object.assign(this.final, this.general, this.instrument, this.complement);
-
+    console.log("info instrument");
+    console.log(this.instrument);
     this.inversion = {
       codigo_instrumento: this.general.instrumentos,
       info_inversion: {
-        id_empresa: this.complement.empresa,
-        id_pais: this.complement.pais,
+        id_empresa: +this.complement.empresa,
+        id_pais: +this.complement.pais,
         id_entidad: +this.general.casa,
-        id_origen_fondo: this.general.origenes_fondo,
-        id_periodicidad: this.general.periodicidad,
+        id_origen_fondo: +this.general.origenes_fondo,
+        id_periodicidad: +this.general.periodicidad,
         id_plazo: +this.complement.plazo,
-        id_tipo_base: this.general.base_anual,
+        id_tipo_base: +this.general.base_anual,
         id_tipo_emisor: +this.complement.emisores,
         id_tipo_mercado: this.complement.tipo_mercado,
         id_tipo_operacion: +this.complement.operaciones,
         //id_tipo_pago: 1,
-        id_formato_ingreso: this.general.formato_ingreso,
-        id_tipo_renta: this.general.tipo_renta,
-        id_tipo_tasa: this.general.tipo_tasa,
+        id_formato_ingreso: +this.general.formato_ingreso,
+        id_tipo_renta: +this.general.tipo_renta,
+        id_tipo_tasa: +this.general.tipo_tasa,
         nombre_inversion: this.general.name,
         asunto: this.general.asunto,
         comentario: this.complement.comentarios,
@@ -237,6 +240,17 @@ export class ResultComponent implements OnInit {
       },
       info_instrumento: this.instrument
     };
+
+    if (
+      (this.inversion["codigo_instrumento"] == "CETE" ||
+        this.inversion["codigo_instrumento"] == "DAP") &&
+      (this.instrument["proyecciones"] != undefined ||
+        this.instrument["proyecciones"] != "")
+    ) {
+      console.log("is an required object");
+      this.inversion["proyecciones"] = this.instrument["proyecciones"];
+      console.log(this.inversion);
+    }
   }
 
   loadComponent() {
@@ -341,6 +355,8 @@ export class ResultComponent implements OnInit {
 
   // Actualizar la propuesta de inversion si se han realizado cambios
   update_proposal() {
+    console.log("update inversion");
+    console.log(this.inversion);
     this.investmentService
       .updateProposalInvestment(this.investmentProposalID, this.inversion)
       .subscribe(
@@ -366,7 +382,7 @@ export class ResultComponent implements OnInit {
         }
       );
   }
-  goToPrevious(form: any) {
+  goToPrevious() {
     this.submitted = true;
     if (this.investmentProposalID != undefined) {
       this.router.navigate(["/investment-proposal/complement-info"], {

+ 10 - 2
src/app/components/investment-proposals/review/review.component.html

@@ -163,11 +163,19 @@
                   </li>
                 </ul>
                 <div class="review-buttons">
-                  <button class="btn btn-danger " (click)="dismiss_proposal()">
+                  <button
+                    class="btn btn-danger "
+                    (click)="dismiss_proposal()"
+                    type="button"
+                  >
                     Rechazar propuesta
                   </button>
 
-                  <button class="btn btn-success " (click)="approve_proposal()">
+                  <button
+                    class="btn btn-success "
+                    (click)="approve_proposal()"
+                    type="button"
+                  >
                     Aprobar propuesta
                   </button>
                 </div>

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

@@ -394,7 +394,7 @@ export class InvestmentProposalReviewComponent implements OnInit {
       if (comentario) {
         this.reviewProposal = {
           id_inversion: this.investmentProposalID,
-          step: "next",
+          step: "previous",
           comentario: comentario
         };
 

+ 1 - 1
src/app/components/login/login.component.scss

@@ -79,7 +79,7 @@
 
   .auth-main:before {
     width: 100%;
-    background-image: url("/assets/img/login-bg.png");
+    //background-image: url("/assets/img/login-bg.png");
   }
 
   .top {

+ 0 - 180
src/app/components/plugins/input-directives/numbers-only.directive.ts

@@ -1,180 +0,0 @@
-import { Directive, ElementRef, HostListener, Input } from "@angular/core";
-
-@Directive({ selector: "[numbersOnly]" })
-export class NumbersOnly {
-  @Input() allowDecimals: boolean = true;
-  @Input() allowSign: boolean = false;
-  @Input() decimalSeparator: string = ".";
-
-  previousValue: string = "";
-
-  // --------------------------------------
-  //  Regular expressions
-  integerUnsigned: string = "^[0-9]*$";
-  integerSigned: string = "^-?[0-9]+$";
-  decimalUnsigned: string = "^[0-9]+(.[0-9]+)?$";
-  decimalSigned: string = "^-?[0-9]+(.[0-9]+)?$";
-
-  /**
-   * Class constructor
-   * @param hostElement
-   */
-  constructor(private hostElement: ElementRef) {}
-
-  /**
-   * Event handler for host's change event
-   * @param e
-   */
-  @HostListener("change", ["$event"]) onChange(e) {
-    this.validateValue(this.hostElement.nativeElement.value);
-  }
-
-  /**
-   * Event handler for host's paste event
-   * @param e
-   */
-  @HostListener("paste", ["$event"]) onPaste(e) {
-    // get and validate data from clipboard
-    let value = e.clipboardData.getData("text/plain");
-    this.validateValue(value);
-    e.preventDefault();
-  }
-
-  /**
-   * Event handler for host's keydown event
-   * @param event
-   */
-  @HostListener("keydown", ["$event"]) onKeyDown(e: KeyboardEvent) {
-    let cursorPosition: number = e.target["selectionStart"];
-    let originalValue: string = e.target["value"];
-    let key: string = this.getName(e);
-    let controlOrCommand = e.ctrlKey === true || e.metaKey === true;
-    let signExists = originalValue.includes("-");
-    let separatorExists = originalValue.includes(this.decimalSeparator);
-
-    // allowed keys apart from numeric characters
-    let allowedKeys = ["Backspace", "ArrowLeft", "ArrowRight", "Escape", "Tab"];
-
-    // when decimals are allowed, add
-    // decimal separator to allowed codes when
-    // its position is not close to the the sign (-. and .-)
-    let separatorIsCloseToSign = signExists && cursorPosition <= 1;
-    if (this.allowDecimals && !separatorIsCloseToSign && !separatorExists) {
-      if (this.decimalSeparator == ".") allowedKeys.push(".");
-      else allowedKeys.push(",");
-    }
-
-    // when minus sign is allowed, add its
-    // key to allowed key only when the
-    // cursor is in the first position, and
-    // first character is different from
-    // decimal separator
-    let firstCharacterIsSeparator =
-      originalValue.charAt(0) != this.decimalSeparator;
-    if (
-      this.allowSign &&
-      !signExists &&
-      firstCharacterIsSeparator &&
-      cursorPosition == 0
-    ) {
-      allowedKeys.push("-");
-    }
-
-    /*
-    // allow some non-numeric characters
-    if (
-      allowedKeys.indexOf(key) != -1 ||
-      // Allow: Ctrl+A and Command+A
-      (key == "a" && controlOrCommand) ||
-      // Allow: Ctrl+C and Command+C
-      (key == "c" && controlOrCommand) ||
-      // Allow: Ctrl+V and Command+V
-      (key == "v" && controlOrCommand) ||
-      // Allow: Ctrl+X and Command+X
-      (key == "x" && controlOrCommand)
-    ) {
-      // let it happen, don't do anything
-      return;
-    }*/
-
-    // save value before keydown event
-    this.previousValue = originalValue;
-
-    // allow number characters only
-    let isNumber = new RegExp(this.integerUnsigned).test(key);
-    if (isNumber) {
-      console.log(isNumber);
-      return;
-    } else {
-      console.log("WTF");
-      e.preventDefault();
-    }
-    this.validateValue(this.hostElement.nativeElement.value);
-  }
-
-  /**
-   * Test whether value is a valid number or not
-   * @param value
-   */
-  validateValue(value: string): void {
-    // choose the appropiate regular expression
-    let regex: string;
-    if (!this.allowDecimals && !this.allowSign) regex = this.integerUnsigned;
-    if (!this.allowDecimals && this.allowSign) regex = this.integerSigned;
-    if (this.allowDecimals && !this.allowSign) regex = this.decimalUnsigned;
-    if (this.allowDecimals && this.allowSign) regex = this.decimalSigned;
-
-    // when a numbers begins with a decimal separator,
-    // fix it adding a zero in the beginning
-    let firstCharacter = value.charAt(0);
-    if (firstCharacter == this.decimalSeparator) value = 0 + value;
-
-    // when a numbers ends with a decimal separator,
-    // fix it adding a zero in the end
-    let lastCharacter = value.charAt(value.length - 1);
-    if (lastCharacter == this.decimalSeparator) value = value + 0;
-
-    // test number with regular expression, when
-    // number is invalid, replace it with a zero
-    let valid: boolean = new RegExp(regex).test(value);
-    this.hostElement.nativeElement["value"] = valid ? value : 0;
-  }
-
-  /**
-   * Get key's name
-   * @param e
-   */
-  getName(e): string {
-    if (e.key) {
-      return e.key;
-    } else {
-      // for old browsers
-      if (e.keyCode && String.fromCharCode) {
-        switch (e.keyCode) {
-          case 8:
-            return "Backspace";
-          case 9:
-            return "Tab";
-          case 27:
-            return "Escape";
-          case 37:
-            return "ArrowLeft";
-          case 39:
-            return "ArrowRight";
-          case 188:
-            return ",";
-          case 190:
-            return ".";
-          case 109:
-            return "-"; // minus in numbpad
-          case 173:
-            return "-"; // minus in alphabet keyboard in firefox
-          case 189:
-            return "-"; // minus in alphabet keyboard in chrome
-          default:
-            return String.fromCharCode(e.keyCode);
-        }
-      }
-    }
-  }
-}

+ 3 - 7
src/app/layouts/admin/admin.module.ts

@@ -44,12 +44,6 @@ import { InvestmentProposalGeneralInfoComponent } from "@app/components/investme
 import { InvestmentsComponent } from "@app/components/investments/investments.component";
 import { ArbitrationsComponent } from "@app/components/arbitrations/arbitrations.component";
 import { PerformancesComponent } from "@app/components/performances/performances.component";
-
-/*
-import { CountriesComponent } from "@app/components/catalogs/countries/countries.component";
-import { CompaniesComponent } from "@app/components/catalogs/companies/companies.component";
-import { NewCompanyComponent } from "@app/components/catalogs/companies/new-company/new-company.component"; */
-/* Shared Service */
 import { FormInvestmentProposalService } from "@app/services/form-investment-proposal.service";
 import { InvestmentProposalWorkflowService } from "@app/services/investment-proposal-workflow.service";
 import { ComplementInfoComponent } from "@app/components/investment-proposals/complement-info/complement-info.component";
@@ -74,6 +68,7 @@ import { ChangeHistoryComponent } from "@app/components/investment-proposals/cha
 
 import { PaymentRequirementComponent } from "@app/components/investment-proposals/payment-requirement/payment-requirement.component";
 import { PaymentInfoComponent } from "@app/components/investment-proposals/payment-info/payment-info.component";
+import { InvestmentProposalDetailComponent } from "@app/components/investment-proposals/proposal-detail/proposal-detail.component";
 
 // This array defines which "componentId" maps to which lazy-loaded module.
 
@@ -137,7 +132,8 @@ import { PaymentInfoComponent } from "@app/components/investment-proposals/payme
     APNComponent,
     InstrumentDirective,
     PaymentInfoComponent,
-    PaymentRequirementComponent
+    PaymentRequirementComponent,
+    InvestmentProposalDetailComponent
   ],
   entryComponents: [
     LETE,

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

@@ -20,6 +20,8 @@ import { ChangeHistoryComponent } from "@app/components/investment-proposals/cha
 import { PaymentInfoComponent } from "@app/components/investment-proposals/payment-info/payment-info.component";
 
 import { PaymentRequirementComponent } from "@app/components/investment-proposals/payment-requirement/payment-requirement.component";
+import { InvestmentProposalDetailComponent } from "@app/components/investment-proposals/proposal-detail/proposal-detail.component";
+
 import { NgModule } from "@angular/core";
 import { from } from "rxjs";
 
@@ -178,5 +180,9 @@ export const AdminLayoutRoutes: Routes = [
   {
     path: "investment-proposal/:id/payment",
     component: PaymentRequirementComponent
+  },
+  {
+    path: "investment-proposal/:id",
+    component: InvestmentProposalDetailComponent
   }
 ];

+ 2 - 1
src/app/services/form-investment-proposal.service.ts

@@ -110,7 +110,8 @@ export class FormInvestmentProposalService {
     // Reset the workflow
     // Return the form data after all this.* members had been reset
     this.formData.clear();
-
+    this.instrumentData = undefined;
+    this.setWork(this.instrumentData);
     this.isGeneralInfoFormValid = this.isWorkFormValid = this.isComplementInfoFormValid = false;
     this.workflowService.resetSteps();
     return this.formData;

+ 4 - 4
src/app/services/instrument-calculations.service.ts

@@ -28,7 +28,7 @@ export class InstrumentCalculations {
     }
   ): Observable<boolean> {
     return this.http
-      .post<any>(`${environment.productionApiUrl}/autocomplete/lete`, {
+      .post<any>(`${environment.productionApiUrl}/autocomplete`, {
         codigo_instrumento,
         info_inversion,
         info_instrumento
@@ -62,7 +62,7 @@ export class InstrumentCalculations {
     }
   ): Observable<boolean> {
     return this.http
-      .post<any>(`${environment.productionApiUrl}/autocomplete/cete`, {
+      .post<any>(`${environment.productionApiUrl}/autocomplete`, {
         codigo_instrumento,
         info_inversion,
         info_instrumento
@@ -98,7 +98,7 @@ export class InstrumentCalculations {
     }
   ): Observable<boolean> {
     return this.http
-      .post<any>(`${environment.productionApiUrl}/autocomplete/vcn`, {
+      .post<any>(`${environment.productionApiUrl}/autocomplete`, {
         codigo_instrumento,
         info_inversion,
         info_instrumento
@@ -128,7 +128,7 @@ export class InstrumentCalculations {
     }
   ): Observable<boolean> {
     return this.http
-      .post<any>(`${environment.productionApiUrl}/autocomplete/dap`, {
+      .post<any>(`${environment.productionApiUrl}/autocomplete`, {
         codigo_instrumento,
         info_inversion,
         info_instrumento

+ 1 - 1
src/environments/environment.prod.ts

@@ -1,4 +1,4 @@
 export const environment = {
   production: true,
-  productionApiUrl: 'https://denmark.inverlec.solar/api/v1'
+  productionApiUrl: 'http://192.168.98.140:8000/api'
 };

+ 5 - 2
src/polyfills.ts

@@ -52,11 +52,14 @@
  *
  */
 
+// Posible fix for dynamic components loader
+
+import "core-js/es/reflect";
+
 /***************************************************************************************************
  * Zone JS is required by default for Angular itself.
  */
-import 'zone.js/dist/zone';  // Included with Angular CLI.
-
+import "zone.js/dist/zone"; // Included with Angular CLI.
 
 /***************************************************************************************************
  * APPLICATION IMPORTS