|
|
@@ -62,7 +62,7 @@ export class PBUR implements InstrumentComponent {
|
|
|
11: "Nov",
|
|
|
12: "Dic"
|
|
|
};
|
|
|
- instrument_exists: boolean;
|
|
|
+ instrument_null: boolean;
|
|
|
instrument_work: any = [];
|
|
|
investmentProposalForm: FormGroup;
|
|
|
myDpOptions: IAngularMyDpOptions = {
|
|
|
@@ -104,7 +104,7 @@ export class PBUR implements InstrumentComponent {
|
|
|
public datepipe: DatePipe
|
|
|
) {
|
|
|
this.instrument_work = this.formDataService.getWork();
|
|
|
- this.instrument_exists = this.instrument_work == undefined;
|
|
|
+ this.instrument_null = this.instrument_work == undefined;
|
|
|
this.general = this.formDataService.getGeneralInfo();
|
|
|
|
|
|
if (
|
|
|
@@ -127,25 +127,32 @@ export class PBUR implements InstrumentComponent {
|
|
|
|
|
|
this.investmentProposalForm = this.formBuilder.group({
|
|
|
valor_par: [
|
|
|
- this.instrument_exists ? false : this.instrument_work.valor_par
|
|
|
+ this.instrument_null || this.instrument_work.valor_par == null
|
|
|
+ ? false
|
|
|
+ : this.instrument_work.valor_par
|
|
|
],
|
|
|
valor_nominal: [
|
|
|
- this.instrument_exists ? "" : this.instrument_work.valor_nominal,
|
|
|
+ this.instrument_null ? "" : this.instrument_work.valor_nominal,
|
|
|
[
|
|
|
Validators.required,
|
|
|
Validators.pattern(/^[+]?([0-9]+(?:[\.][0-9]*)?|\.[0-9]+)$/)
|
|
|
]
|
|
|
],
|
|
|
otros_costos: [
|
|
|
- this.instrument_exists ? 0 : this.instrument_work.otros_costos,
|
|
|
+ this.instrument_null || this.instrument_work.otros_costos == null
|
|
|
+ ? 0
|
|
|
+ : this.instrument_work.otros_costos,
|
|
|
[Validators.pattern(/^[+]?([0-9]+(?:[\.][0-9]*)?|\.[0-9]+)$/)]
|
|
|
],
|
|
|
+
|
|
|
renta_porcentaje: [
|
|
|
- this.instrument_exists ? 10 : this.instrument_work.renta_porcentaje,
|
|
|
+ this.instrument_null || this.instrument_work.renta_porcentaje == null
|
|
|
+ ? 10
|
|
|
+ : this.instrument_work.renta_porcentaje,
|
|
|
[Validators.required]
|
|
|
],
|
|
|
comision_casa_porcentaje: [
|
|
|
- this.instrument_exists
|
|
|
+ this.instrument_null
|
|
|
? ""
|
|
|
: this.instrument_work.comision_casa_porcentaje,
|
|
|
[
|
|
|
@@ -154,7 +161,7 @@ export class PBUR implements InstrumentComponent {
|
|
|
]
|
|
|
],
|
|
|
comision_bolsa_porcentaje: [
|
|
|
- this.instrument_exists
|
|
|
+ this.instrument_null
|
|
|
? ""
|
|
|
: this.instrument_work.comision_bolsa_porcentaje,
|
|
|
[
|
|
|
@@ -163,22 +170,22 @@ export class PBUR implements InstrumentComponent {
|
|
|
]
|
|
|
],
|
|
|
plazo: [
|
|
|
- this.instrument_exists ? "" : this.instrument_work.plazo,
|
|
|
+ this.instrument_null ? "" : this.instrument_work.plazo,
|
|
|
[Validators.required]
|
|
|
],
|
|
|
rendimiento_bruto: [
|
|
|
- this.instrument_exists ? "" : this.instrument_work.rendimiento_bruto,
|
|
|
+ this.instrument_null ? "" : this.instrument_work.rendimiento_bruto,
|
|
|
[
|
|
|
Validators.required,
|
|
|
Validators.pattern(/^[+]?([0-9]+(?:[\.][0-9]*)?|\.[0-9]+)$/)
|
|
|
]
|
|
|
],
|
|
|
/*formato_ingreso: [
|
|
|
- this.instrument_exists ? "" : this.instrument_work.formato_ingreso,
|
|
|
+ this.instrument_null ? "" : this.instrument_work.formato_ingreso,
|
|
|
[Validators.required]
|
|
|
],*/
|
|
|
fecha_liquidacion: [
|
|
|
- this.instrument_exists
|
|
|
+ this.instrument_null
|
|
|
? ""
|
|
|
: {
|
|
|
isRange: false,
|
|
|
@@ -194,7 +201,7 @@ export class PBUR implements InstrumentComponent {
|
|
|
Validators.required
|
|
|
],
|
|
|
fecha_vencimiento: [
|
|
|
- this.instrument_exists
|
|
|
+ this.instrument_null
|
|
|
? ""
|
|
|
: {
|
|
|
isRange: false,
|
|
|
@@ -210,7 +217,7 @@ export class PBUR implements InstrumentComponent {
|
|
|
Validators.required
|
|
|
],
|
|
|
fecha_operacion: [
|
|
|
- this.instrument_exists
|
|
|
+ this.instrument_null
|
|
|
? ""
|
|
|
: {
|
|
|
isRange: false,
|
|
|
@@ -226,7 +233,7 @@ export class PBUR implements InstrumentComponent {
|
|
|
Validators.required
|
|
|
],
|
|
|
fecha_ultima_cupon: [
|
|
|
- this.instrument_exists
|
|
|
+ this.instrument_null
|
|
|
? ""
|
|
|
: {
|
|
|
isRange: false,
|
|
|
@@ -257,6 +264,9 @@ export class PBUR implements InstrumentComponent {
|
|
|
|
|
|
getCalculations(form: any, saveForm: boolean) {
|
|
|
this.submitted = true;
|
|
|
+ console.log("formulario");
|
|
|
+ console.log(form);
|
|
|
+
|
|
|
if (!form.valid) {
|
|
|
return false;
|
|
|
}
|