feat(provisioning-entries): create entries
Add create provisioning entries component.
This commit is contained in:
+36
@@ -0,0 +1,36 @@
|
||||
<div class="container">
|
||||
|
||||
<mat-card>
|
||||
|
||||
<form [formGroup]="provisioningEntriesForm" (ngSubmit)="submit()">
|
||||
|
||||
<mat-card-content>
|
||||
|
||||
<div fxLayout="column">
|
||||
|
||||
<mat-form-field fxFlex>
|
||||
<input matInput [min]="minDate" [max]="maxDate" [matDatepicker]="datePicker" placeholder="Date" required formControlName="date">
|
||||
<mat-datepicker-toggle matSuffix [for]="datePicker"></mat-datepicker-toggle>
|
||||
<mat-datepicker #datePicker></mat-datepicker>
|
||||
</mat-form-field>
|
||||
|
||||
<div fxFlex>
|
||||
<mat-checkbox labelPosition="before" formControlName="createjournalentries">
|
||||
Create Journal Entries
|
||||
</mat-checkbox>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</mat-card-content>
|
||||
|
||||
<mat-card-actions fxLayout="row" fxLayout.xs="column" fxLayoutAlign="center" fxLayoutGap="5px">
|
||||
<button type="button" mat-raised-button [routerLink]="['/accounting/provisioning-entries']">Cancel</button>
|
||||
<button mat-raised-button color="primary">Submit</button>
|
||||
</mat-card-actions>
|
||||
|
||||
</form>
|
||||
|
||||
</mat-card>
|
||||
|
||||
</div>
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
.container {
|
||||
max-width: 37rem;
|
||||
}
|
||||
+25
@@ -0,0 +1,25 @@
|
||||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { CreateProvisioningEntryComponent } from './create-provisioning-entry.component';
|
||||
|
||||
describe('CreateProvisioningEntryComponent', () => {
|
||||
let component: CreateProvisioningEntryComponent;
|
||||
let fixture: ComponentFixture<CreateProvisioningEntryComponent>;
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ CreateProvisioningEntryComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(CreateProvisioningEntryComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
||||
+43
@@ -0,0 +1,43 @@
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
import { FormGroup, FormBuilder, Validators } from '@angular/forms';
|
||||
|
||||
import { AccountingService } from '../../accounting.service';
|
||||
|
||||
@Component({
|
||||
selector: 'mifosx-create-provisioning-entry',
|
||||
templateUrl: './create-provisioning-entry.component.html',
|
||||
styleUrls: ['./create-provisioning-entry.component.scss']
|
||||
})
|
||||
export class CreateProvisioningEntryComponent implements OnInit {
|
||||
|
||||
minDate = new Date(2000, 0, 1);
|
||||
maxDate = new Date();
|
||||
provisioningEntriesForm: FormGroup;
|
||||
|
||||
constructor(private formBuilder: FormBuilder,
|
||||
private accountingService: AccountingService) { }
|
||||
|
||||
ngOnInit() {
|
||||
this.createProvisioningEntriesForm();
|
||||
}
|
||||
|
||||
createProvisioningEntriesForm() {
|
||||
this.provisioningEntriesForm = this.formBuilder.group({
|
||||
'date': ['', Validators.required],
|
||||
'createjournalentries': [false]
|
||||
});
|
||||
}
|
||||
|
||||
submit() {
|
||||
const provisioningEntry = this.provisioningEntriesForm.value;
|
||||
// TODO: Update once language and date settings are setup
|
||||
provisioningEntry.locale = 'en';
|
||||
provisioningEntry.dateFormat = 'dd MMMM yyyy';
|
||||
provisioningEntry.date = '06 August 2018';
|
||||
this.accountingService.createProvisioningEntry(provisioningEntry)
|
||||
.subscribe((response: any) => {
|
||||
console.log(response);
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
@@ -24,10 +24,14 @@ export class ProvisioningEntriesComponent implements OnInit {
|
||||
|
||||
getProvisioningEntries() {
|
||||
this.accountingService.getProvisioningEntries().subscribe((provisioningEntryData: any) => {
|
||||
this.dataSource = new MatTableDataSource(provisioningEntryData);
|
||||
this.dataSource = new MatTableDataSource(provisioningEntryData.pageItems);
|
||||
this.dataSource.paginator = this.paginator;
|
||||
this.dataSource.sort = this.sort;
|
||||
});
|
||||
}
|
||||
|
||||
applyFilter(filterValue: string) {
|
||||
this.dataSource.filter = filterValue.trim().toLowerCase();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user