| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889 |
- import { Component, OnInit, Input } from "@angular/core";
- import { InstrumentComponent } from "@app/components/investment-proposals/instrument/instrument.component";
- import { FormBuilder, FormGroup, Validators } from "@angular/forms";
- import { IAngularMyDpOptions, IMyDateModel } from "angular-mydatepicker";
- import { formatDate, DatePipe } from "@angular/common";
- import { Router } from "@angular/router";
- import { FormInvestmentProposalService } from "@app/services/form-investment-proposal.service";
- @Component({
- selector: "app-bonos",
- templateUrl: "./bonos.component.html"
- })
- export class BonosComponent implements InstrumentComponent {
- title: string = "Bonos";
- @Input() data: any;
- form: any;
- // For daterange
- daysLabels: any = {
- su: "Dom",
- mo: "Lun",
- tu: "Mar",
- we: "Mie",
- th: "Jue",
- fr: "Vie",
- sa: "Sab"
- };
- monthsLabels: any = {
- 1: "Ene",
- 2: "Feb",
- 3: "Mar",
- 4: "Abr",
- 5: "May",
- 6: "Jun",
- 7: "Jul",
- 8: "Ago",
- 9: "Sep",
- 10: "Oct",
- 11: "Nov",
- 12: "Dic"
- };
- investmentProposalForm: FormGroup;
- myDpOptions: IAngularMyDpOptions = {
- dateRange: false,
- dateFormat: "dd/mm/yyyy",
- dayLabels: this.daysLabels,
- monthLabels: this.monthsLabels
- };
- myDateInit: boolean = true;
- model: IMyDateModel = null;
- constructor(
- private formBuilder: FormBuilder,
- private router: Router,
- private formDataService: FormInvestmentProposalService
- ) {
- console.log("init");
- this.investmentProposalForm = this.formBuilder.group({
- valor_nominal: ["", Validators.required],
- ytm_vencimiento: ["", Validators.required],
- precio_c_v: ["", Validators.required],
- precio_vencimiento: ["", Validators.required],
- fecha_liquidacion: ["", Validators.required],
- fecha_cupon: ["", Validators.required],
- fecha_vencimiento: ["", Validators.required],
- comision_casa: ["", Validators.required],
- comision_bolsa: ["", Validators.required],
- cupon: ["", Validators.required],
- costos_transferencia: ["", Validators.required]
- });
- }
- save(form: any): boolean {
- /*if (!form.valid) {
- return false;
- }*/
- this.formDataService.setWork(this.investmentProposalForm.value);
- return true;
- }
- goToNext(form: any) {
- if (this.save(form)) {
- console.log("all good");
- // Navigate to the work page
- this.router.navigate(["/address"]);
- }
- }
- }
|