feat: create, view, edit, delete for reports

- Add manage-reports
- Add view-report
- Add create-report
- Add edit-report

#174
This commit is contained in:
Chirag
2019-11-28 18:13:35 +05:30
committed by Jivjyot Singh
parent a7affa17cd
commit bab75357b4
27 changed files with 1405 additions and 3 deletions
@@ -0,0 +1,36 @@
<h1 mat-dialog-title>{{ data.parameterName ? "Edit" : "Add" }} Report Parameter</h1>
<mat-dialog-content>
<form [formGroup]="reportParameterForm">
<div fxLayout="column">
<mat-form-field>
<mat-label>Select allowed parameter</mat-label>
<mat-select required formControlName="parameterName">
<mat-option *ngFor="let allowedParameter of data.allowedParameters" [value]="allowedParameter.id">
{{ allowedParameter.parameterName }}
</mat-option>
</mat-select>
<mat-error *ngIf="reportParameterForm.controls.parameterName.hasError('required')">
Report Parameter is <strong>required</strong>
</mat-error>
</mat-form-field>
<mat-form-field>
<mat-label>Parameter name passed to Pentaho</mat-label>
<input matInput formControlName="reportParameterName">
</mat-form-field>
</div>
</form>
</mat-dialog-content>
<mat-dialog-actions align="end">
<button mat-button mat-dialog-close>Cancel</button>
<button mat-raised-button color="primary"
[disabled]="!reportParameterForm.valid || reportParameterForm.pristine" (click)="submit()">Submit</button>
</mat-dialog-actions>
@@ -0,0 +1,25 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { ReportParameterDialogComponent } from './report-parameter-dialog.component';
describe('AddReportParameterDialogComponent', () => {
let component: ReportParameterDialogComponent;
let fixture: ComponentFixture<ReportParameterDialogComponent>;
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ ReportParameterDialogComponent ]
})
.compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(ReportParameterDialogComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});
@@ -0,0 +1,46 @@
/** Angular Imports */
import { Component, OnInit, Inject } from '@angular/core';
import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material';
import { FormGroup, FormBuilder, Validators } from '@angular/forms';
/**
* Report Parameter Dialog Component.
*/
@Component({
selector: 'mifosx-add-report-parameter-dialog',
templateUrl: './report-parameter-dialog.component.html',
styleUrls: ['./report-parameter-dialog.component.scss']
})
export class ReportParameterDialogComponent implements OnInit {
/** Report Parameter Form. */
reportParameterForm: FormGroup;
/**
* @param {MatDialogRef} dialogRef Component reference to dialog.
* @param {FormBuilder} formBuilder Form Builder.
* @param {any} data Provides the allowed parameters and values for the form (if available).
*/
constructor(public dialogRef: MatDialogRef<ReportParameterDialogComponent>,
public formBuilder: FormBuilder,
@Inject(MAT_DIALOG_DATA) public data: any) {
}
/**
* Creates the add report parameter form.
*/
ngOnInit() {
this.reportParameterForm = this.formBuilder.group({
'parameterName': [this.data.parameterName, Validators.required],
'reportParameterName': [this.data.reportParameterName]
});
}
/**
* Closes the dialog and returns value of the form.
*/
submit() {
this.dialogRef.close(this.reportParameterForm.value);
}
}