Enhacement to management funds (#1735)

Co-authored-by: Jose Alberto Hernandez <alberto@MacBook-Pro.local>
This commit is contained in:
José Alberto Hernández
2023-04-07 20:35:27 -06:00
committed by GitHub
co-authored by Jose Alberto Hernandez
parent 452a1adc17
commit bf700cc100
28 changed files with 530 additions and 270 deletions
@@ -0,0 +1,53 @@
import { Component, OnInit } from '@angular/core';
import { FormBuilder, FormGroup, Validators } from '@angular/forms';
import { ActivatedRoute, Router } from '@angular/router';
import { OrganizationService } from 'app/organization/organization.service';
@Component({
selector: 'mifosx-create-fund',
templateUrl: './create-fund.component.html',
styleUrls: ['./create-fund.component.scss']
})
export class CreateFundComponent implements OnInit {
/** Charge form. */
fundForm: FormGroup;
/**
* Retrieves the charge data from `resolve`.
* @param {ProductsService} productsService Products Service.
* @param {FormBuilder} formBuilder Form Builder.
* @param {ActivatedRoute} route Activated Route.
* @param {Router} router Router for navigation.
*/
constructor(private organizationService: OrganizationService,
private formBuilder: FormBuilder,
private router: Router,
private route: ActivatedRoute) {
}
ngOnInit() {
this.createFundForm();
}
/**
* Edit Fund form.
*/
createFundForm() {
this.fundForm = this.formBuilder.group({
'name': ['', Validators.required],
'externalId': ['']
});
}
submit() {
const payload = this.fundForm.getRawValue();
this.organizationService.createFund(payload)
.subscribe((response: any) => {
this.router.navigate(['../'], { relativeTo: this.route });
});
}
}