| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384 |
- 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-anc",
- templateUrl: "./anc.component.html"
- })
- export class ANCComponent implements InstrumentComponent {
- title: string = "Acciones nacionales comunes";
- @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({
- precio_limpio: ["", Validators.required],
- unidades: ["", Validators.required],
- comision_casa: ["", Validators.required],
- comision_bolsa: ["", Validators.required],
- fecha_operacion: ["", Validators.required],
- fecha_vencimiento: ["", 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"]);
- }
- }
- }
|