feat(provisioning-entries): create entries
Add create provisioning entries component.
This commit is contained in:
@@ -32,6 +32,7 @@ import { ViewAccountingRuleResolver } from './accounting-rules/view-rule/view-ru
|
|||||||
import { EditRuleComponent } from './accounting-rules/edit-rule/edit-rule.component';
|
import { EditRuleComponent } from './accounting-rules/edit-rule/edit-rule.component';
|
||||||
import { PeriodicAccrualsComponent } from './periodic-accruals/periodic-accruals.component';
|
import { PeriodicAccrualsComponent } from './periodic-accruals/periodic-accruals.component';
|
||||||
import { ProvisioningEntriesComponent } from './provisioning-entries/provisioning-entries.component';
|
import { ProvisioningEntriesComponent } from './provisioning-entries/provisioning-entries.component';
|
||||||
|
import { CreateProvisioningEntryComponent } from './provisioning-entries/create-provisioning-entry/create-provisioning-entry.component';
|
||||||
|
|
||||||
const routes: Routes = [
|
const routes: Routes = [
|
||||||
Route.withShell([
|
Route.withShell([
|
||||||
@@ -93,7 +94,7 @@ const routes: Routes = [
|
|||||||
{
|
{
|
||||||
path: 'edit',
|
path: 'edit',
|
||||||
component: EditFinancialActivityMappingComponent,
|
component: EditFinancialActivityMappingComponent,
|
||||||
data: { title: extract('Edit Financial Activity Mapping'), breadcrumb: 'Edit', routeParamBreadcrumb: false }
|
data: { title: extract('Edit Financial Activity Mapping'), breadcrumb: 'Edit', routeParamBreadcrumb: false }
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
@@ -163,7 +164,7 @@ const routes: Routes = [
|
|||||||
{
|
{
|
||||||
path: 'edit',
|
path: 'edit',
|
||||||
component: EditClosureComponent,
|
component: EditClosureComponent,
|
||||||
data: { title: extract('Edit Accounting Closure'), breadcrumb: 'Edit', routeParamBreadcrumb: false }
|
data: { title: extract('Edit Accounting Closure'), breadcrumb: 'Edit', routeParamBreadcrumb: false }
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
@@ -197,7 +198,7 @@ const routes: Routes = [
|
|||||||
{
|
{
|
||||||
path: 'edit',
|
path: 'edit',
|
||||||
component: EditRuleComponent,
|
component: EditRuleComponent,
|
||||||
data: { title: extract('Edit Accounting Rules'), breadcrumb: 'Edit', routeResolveBreadcrumb: false }
|
data: { title: extract('Edit Accounting Rules'), breadcrumb: 'Edit', routeResolveBreadcrumb: false }
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
@@ -206,12 +207,22 @@ const routes: Routes = [
|
|||||||
{
|
{
|
||||||
path: 'periodic-accruals',
|
path: 'periodic-accruals',
|
||||||
component: PeriodicAccrualsComponent,
|
component: PeriodicAccrualsComponent,
|
||||||
data: { title: extract('Periodic Accrual Accounting'), breadcrumb: 'Execute Periodic Accrual Accounting' }
|
data: { title: extract('Periodic Accrual Accounting'), breadcrumb: 'Execute Periodic Accrual Accounting' }
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: 'provisioning-entries',
|
path: 'provisioning-entries',
|
||||||
component: ProvisioningEntriesComponent,
|
data: { title: extract('Provisioning Entries'), breadcrumb: 'Provisioning Entries' },
|
||||||
data: { title: extract('Provisioning Entries'), breadcrumb: 'Provisioning Entries' }
|
children: [
|
||||||
|
{
|
||||||
|
path: '',
|
||||||
|
component: ProvisioningEntriesComponent
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: 'create',
|
||||||
|
component: CreateProvisioningEntryComponent,
|
||||||
|
data: { title: extract('Create Provisioning Entry'), breadcrumb: 'Create' }
|
||||||
|
}
|
||||||
|
]
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -30,6 +30,7 @@ import { ViewRuleComponent } from './accounting-rules/view-rule/view-rule.compon
|
|||||||
import { EditRuleComponent } from './accounting-rules/edit-rule/edit-rule.component';
|
import { EditRuleComponent } from './accounting-rules/edit-rule/edit-rule.component';
|
||||||
import { PeriodicAccrualsComponent } from './periodic-accruals/periodic-accruals.component';
|
import { PeriodicAccrualsComponent } from './periodic-accruals/periodic-accruals.component';
|
||||||
import { ProvisioningEntriesComponent } from './provisioning-entries/provisioning-entries.component';
|
import { ProvisioningEntriesComponent } from './provisioning-entries/provisioning-entries.component';
|
||||||
|
import { CreateProvisioningEntryComponent } from './provisioning-entries/create-provisioning-entry/create-provisioning-entry.component';
|
||||||
|
|
||||||
@NgModule({
|
@NgModule({
|
||||||
imports: [
|
imports: [
|
||||||
@@ -64,7 +65,8 @@ import { ProvisioningEntriesComponent } from './provisioning-entries/provisionin
|
|||||||
ViewRuleComponent,
|
ViewRuleComponent,
|
||||||
EditRuleComponent,
|
EditRuleComponent,
|
||||||
PeriodicAccrualsComponent,
|
PeriodicAccrualsComponent,
|
||||||
ProvisioningEntriesComponent
|
ProvisioningEntriesComponent,
|
||||||
|
CreateProvisioningEntryComponent
|
||||||
],
|
],
|
||||||
entryComponents: [
|
entryComponents: [
|
||||||
RevertTransactionComponent,
|
RevertTransactionComponent,
|
||||||
|
|||||||
@@ -173,4 +173,8 @@ export class AccountingService {
|
|||||||
return this.http.get('/provisioningentries');
|
return this.http.get('/provisioningentries');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
createProvisioningEntry(provisioningEntry: any) {
|
||||||
|
return this.http.post('/provisioningentries', provisioningEntry);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
+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() {
|
getProvisioningEntries() {
|
||||||
this.accountingService.getProvisioningEntries().subscribe((provisioningEntryData: any) => {
|
this.accountingService.getProvisioningEntries().subscribe((provisioningEntryData: any) => {
|
||||||
this.dataSource = new MatTableDataSource(provisioningEntryData);
|
this.dataSource = new MatTableDataSource(provisioningEntryData.pageItems);
|
||||||
this.dataSource.paginator = this.paginator;
|
this.dataSource.paginator = this.paginator;
|
||||||
this.dataSource.sort = this.sort;
|
this.dataSource.sort = this.sort;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
applyFilter(filterValue: string) {
|
||||||
|
this.dataSource.filter = filterValue.trim().toLowerCase();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user