Merge pull request #1497 from openMF/fix-auditing-module-date-formatting
Search and Create Journal entry page is broken + Add filter by submitted on date
This commit is contained in:
@@ -35,11 +35,11 @@ export class CreateClosureComponent implements OnInit {
|
||||
* @param {Router} router Router for navigation.
|
||||
*/
|
||||
constructor(private formBuilder: FormBuilder,
|
||||
private accountingService: AccountingService,
|
||||
private settingsService: SettingsService,
|
||||
private dateUtils: Dates,
|
||||
private route: ActivatedRoute,
|
||||
private router: Router) {
|
||||
private accountingService: AccountingService,
|
||||
private settingsService: SettingsService,
|
||||
private dateUtils: Dates,
|
||||
private route: ActivatedRoute,
|
||||
private router: Router) {
|
||||
this.route.data.subscribe((data: { offices: any }) => {
|
||||
this.officeData = data.offices;
|
||||
});
|
||||
@@ -74,7 +74,7 @@ export class CreateClosureComponent implements OnInit {
|
||||
accountingClosure.locale = this.settingsService.language.code;
|
||||
accountingClosure.dateFormat = this.settingsService.dateFormat;
|
||||
if (accountingClosure.closingDate) {
|
||||
accountingClosure.closingDate = this.dateUtils.getDate(accountingClosure.closingDate);
|
||||
accountingClosure.closingDate = this.dateUtils.formatDate(accountingClosure.closingDate, this.settingsService.dateFormat);
|
||||
}
|
||||
this.accountingService.createAccountingClosure(accountingClosure).subscribe((response: any) => {
|
||||
this.router.navigate(['../view', response.resourceId], { relativeTo: this.route });
|
||||
|
||||
@@ -41,22 +41,22 @@ export class CreateJournalEntryComponent implements OnInit {
|
||||
* @param {Router} router Router for navigation.
|
||||
*/
|
||||
constructor(private formBuilder: FormBuilder,
|
||||
private accountingService: AccountingService,
|
||||
private settingsService: SettingsService,
|
||||
private dateUtils: Dates,
|
||||
private route: ActivatedRoute,
|
||||
private router: Router) {
|
||||
private accountingService: AccountingService,
|
||||
private settingsService: SettingsService,
|
||||
private dateUtils: Dates,
|
||||
private route: ActivatedRoute,
|
||||
private router: Router) {
|
||||
this.route.data.subscribe((data: {
|
||||
offices: any,
|
||||
currencies: any,
|
||||
paymentTypes: any,
|
||||
glAccounts: any
|
||||
}) => {
|
||||
this.officeData = data.offices;
|
||||
this.currencyData = data.currencies.selectedCurrencyOptions;
|
||||
this.paymentTypeData = data.paymentTypes;
|
||||
this.glAccountData = data.glAccounts;
|
||||
});
|
||||
offices: any,
|
||||
currencies: any,
|
||||
paymentTypes: any,
|
||||
glAccounts: any
|
||||
}) => {
|
||||
this.officeData = data.offices;
|
||||
this.currencyData = data.currencies.selectedCurrencyOptions;
|
||||
this.paymentTypeData = data.paymentTypes;
|
||||
this.glAccountData = data.glAccounts;
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -142,7 +142,7 @@ export class CreateJournalEntryComponent implements OnInit {
|
||||
journalEntry.locale = this.settingsService.language.code;
|
||||
journalEntry.dateFormat = this.settingsService.dateFormat;
|
||||
if (journalEntry.transactionDate) {
|
||||
journalEntry.transactionDate = this.dateUtils.getDate(journalEntry.transactionDate);
|
||||
journalEntry.transactionDate = this.dateUtils.formatDate(journalEntry.transactionDate, this.settingsService.dateFormat);
|
||||
}
|
||||
this.accountingService.createJournalEntry(journalEntry).subscribe(response => {
|
||||
this.router.navigate(['../transactions/view', response.transactionId], { relativeTo: this.route });
|
||||
|
||||
@@ -173,7 +173,7 @@ export class FrequentPostingsComponent implements OnInit {
|
||||
journalEntry.locale = this.settingsService.language.code;
|
||||
journalEntry.dateFormat = this.settingsService.dateFormat;
|
||||
if (journalEntry.transactionDate instanceof Date) {
|
||||
journalEntry.transactionDate = this.dateUtils.getDate(journalEntry.transactionDate);
|
||||
journalEntry.transactionDate = this.dateUtils.formatDate(journalEntry.transactionDate, this.settingsService.dateFormat);
|
||||
}
|
||||
this.accountingService.createJournalEntry(journalEntry).subscribe(response => {
|
||||
this.router.navigate(['../transactions/view', response.transactionId], { relativeTo: this.route });
|
||||
|
||||
@@ -46,18 +46,18 @@ export class MigrateOpeningBalancesComponent implements OnInit {
|
||||
* @param {Router} router Router for navigation.
|
||||
*/
|
||||
constructor(private formBuilder: FormBuilder,
|
||||
private accountingService: AccountingService,
|
||||
private settingsService: SettingsService,
|
||||
private dateUtils: Dates,
|
||||
private route: ActivatedRoute,
|
||||
private router: Router) {
|
||||
private accountingService: AccountingService,
|
||||
private settingsService: SettingsService,
|
||||
private dateUtils: Dates,
|
||||
private route: ActivatedRoute,
|
||||
private router: Router) {
|
||||
this.route.data.subscribe((data: {
|
||||
offices: any,
|
||||
currencies: any
|
||||
}) => {
|
||||
this.officeData = data.offices;
|
||||
this.currencyData = data.currencies.selectedCurrencyOptions;
|
||||
});
|
||||
offices: any,
|
||||
currencies: any
|
||||
}) => {
|
||||
this.officeData = data.offices;
|
||||
this.currencyData = data.currencies.selectedCurrencyOptions;
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -111,13 +111,13 @@ export class MigrateOpeningBalancesComponent implements OnInit {
|
||||
|
||||
openingBalancesData.glAccounts = openingBalancesData.assetAccountOpeningBalances
|
||||
.concat(openingBalancesData.liabityAccountOpeningBalances,
|
||||
openingBalancesData.equityAccountOpeningBalances,
|
||||
openingBalancesData.incomeAccountOpeningBalances,
|
||||
openingBalancesData.expenseAccountOpeningBalances);
|
||||
openingBalancesData.equityAccountOpeningBalances,
|
||||
openingBalancesData.incomeAccountOpeningBalances,
|
||||
openingBalancesData.expenseAccountOpeningBalances);
|
||||
|
||||
openingBalancesData.glAccounts.forEach((glAccount: any) => {
|
||||
entry.push(this.createGLAccountEntryForm(glAccount));
|
||||
});
|
||||
entry.push(this.createGLAccountEntryForm(glAccount));
|
||||
});
|
||||
|
||||
this.openingBalancesData = openingBalancesData;
|
||||
|
||||
@@ -142,7 +142,7 @@ export class MigrateOpeningBalancesComponent implements OnInit {
|
||||
openingBalances.locale = this.settingsService.language.code;
|
||||
openingBalances.dateFormat = this.settingsService.dateFormat;
|
||||
if (openingBalances.transactionDate instanceof Date) {
|
||||
openingBalances.transactionDate = this.dateUtils.getDate(openingBalances.transactionDate);
|
||||
openingBalances.transactionDate = this.dateUtils.formatDate(openingBalances.transactionDate, this.settingsService.dateFormat);
|
||||
}
|
||||
openingBalances.debits = [];
|
||||
openingBalances.credits = [];
|
||||
|
||||
@@ -32,11 +32,11 @@ export class PeriodicAccrualsComponent implements OnInit {
|
||||
* @param {Router} router Router for navigation.
|
||||
*/
|
||||
constructor(private formBuilder: FormBuilder,
|
||||
private accountingService: AccountingService,
|
||||
private settingsService: SettingsService,
|
||||
private dateUtils: Dates,
|
||||
private route: ActivatedRoute,
|
||||
private router: Router) { }
|
||||
private accountingService: AccountingService,
|
||||
private settingsService: SettingsService,
|
||||
private dateUtils: Dates,
|
||||
private route: ActivatedRoute,
|
||||
private router: Router) { }
|
||||
|
||||
/**
|
||||
* Creates periodic accruals form.
|
||||
@@ -65,7 +65,7 @@ export class PeriodicAccrualsComponent implements OnInit {
|
||||
periodicAccruals.locale = this.settingsService.language.code;
|
||||
periodicAccruals.dateFormat = this.settingsService.dateFormat;
|
||||
if (periodicAccruals.tillDate instanceof Date) {
|
||||
periodicAccruals.tillDate = this.dateUtils.getDate(periodicAccruals.tillDate);
|
||||
periodicAccruals.tillDate = this.dateUtils.formatDate(periodicAccruals.tillDate, this.settingsService.dateFormat);
|
||||
}
|
||||
this.accountingService.executePeriodicAccruals(periodicAccruals).subscribe(() => {
|
||||
this.router.navigate(['../'], { relativeTo: this.route });
|
||||
|
||||
+6
-6
@@ -32,11 +32,11 @@ export class CreateProvisioningEntryComponent implements OnInit {
|
||||
* @param {Router} router Router for navigation.
|
||||
*/
|
||||
constructor(private formBuilder: FormBuilder,
|
||||
private accountingService: AccountingService,
|
||||
private settingsService: SettingsService,
|
||||
private dateUtils: Dates,
|
||||
private route: ActivatedRoute,
|
||||
private router: Router) { }
|
||||
private accountingService: AccountingService,
|
||||
private settingsService: SettingsService,
|
||||
private dateUtils: Dates,
|
||||
private route: ActivatedRoute,
|
||||
private router: Router) { }
|
||||
|
||||
/**
|
||||
* Creates the provisioning entry form.
|
||||
@@ -66,7 +66,7 @@ export class CreateProvisioningEntryComponent implements OnInit {
|
||||
provisioningEntry.locale = this.settingsService.language.code;
|
||||
provisioningEntry.dateFormat = this.settingsService.dateFormat;
|
||||
if (provisioningEntry.date instanceof Date) {
|
||||
provisioningEntry.date = this.dateUtils.getDate(provisioningEntry.date);
|
||||
provisioningEntry.date = this.dateUtils.formatDate(provisioningEntry.date, this.settingsService.dateFormat);
|
||||
}
|
||||
this.accountingService.createProvisioningEntry(provisioningEntry)
|
||||
.subscribe((response: any) => {
|
||||
|
||||
@@ -38,6 +38,20 @@
|
||||
<input matInput [formControl]="transactionId">
|
||||
</mat-form-field>
|
||||
|
||||
<mat-form-field fxFlex="31%" (click)="submittedOnDateFromPicker.open()">
|
||||
<mat-label>Submitted on Date From</mat-label>
|
||||
<input matInput [max]="submittedOnDateTo.value" [matDatepicker]="submittedOnDateFromPicker" [formControl]="submittedOnDateFrom">
|
||||
<mat-datepicker-toggle matSuffix [for]="submittedOnDateFromPicker"></mat-datepicker-toggle>
|
||||
<mat-datepicker #submittedOnDateFromPicker></mat-datepicker>
|
||||
</mat-form-field>
|
||||
|
||||
<mat-form-field fxFlex="31%" (click)="submittedOnDateToPicker.open()">
|
||||
<mat-label>Submitted on Date To</mat-label>
|
||||
<input matInput [min]="submittedOnDateFrom.value" [matDatepicker]="submittedOnDateToPicker" [formControl]="submittedOnDateTo">
|
||||
<mat-datepicker-toggle matSuffix [for]="submittedOnDateToPicker"></mat-datepicker-toggle>
|
||||
<mat-datepicker #submittedOnDateToPicker></mat-datepicker>
|
||||
</mat-form-field>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
@@ -89,6 +103,11 @@
|
||||
<td mat-cell *matCellDef="let journalEntry"> {{ journalEntry.createdByUserName }} </td>
|
||||
</ng-container>
|
||||
|
||||
<ng-container matColumnDef="submittedOnDate">
|
||||
<th mat-header-cell *matHeaderCellDef> Submitted on date </th>
|
||||
<td mat-cell *matCellDef="let journalEntry"> {{ journalEntry.submittedOnDate }} </td>
|
||||
</ng-container>
|
||||
|
||||
<ng-container matColumnDef="glAccountCode">
|
||||
<th mat-header-cell *matHeaderCellDef mat-sort-header> Account Code </th>
|
||||
<td mat-cell *matCellDef="let journalEntry"> {{ journalEntry.glAccountCode }} </td>
|
||||
|
||||
@@ -3,7 +3,7 @@ import { Component, OnInit, ViewChild, AfterViewInit } from '@angular/core';
|
||||
import { MatPaginator } from '@angular/material/paginator';
|
||||
import { MatSort } from '@angular/material/sort';
|
||||
import { FormControl } from '@angular/forms';
|
||||
import { Router, ActivatedRoute } from '@angular/router';
|
||||
import { ActivatedRoute } from '@angular/router';
|
||||
|
||||
/** rxjs Imports */
|
||||
import { merge } from 'rxjs';
|
||||
@@ -65,8 +65,12 @@ export class SearchJournalEntryComponent implements OnInit, AfterViewInit {
|
||||
transactionDateTo = new FormControl(new Date());
|
||||
/** Transaction ID form control. */
|
||||
transactionId = new FormControl();
|
||||
/** Submitted on date from form control. */
|
||||
submittedOnDateFrom = new FormControl();
|
||||
/** Submitted on date to form control. */
|
||||
submittedOnDateTo = new FormControl();
|
||||
/** Columns to be displayed in journal entries table. */
|
||||
displayedColumns: string[] = ['id', 'officeName', 'transactionId', 'transactionDate', 'glAccountType', 'createdByUserName', 'glAccountCode', 'glAccountName', 'debit', 'credit'];
|
||||
displayedColumns: string[] = ['id', 'officeName', 'transactionId', 'transactionDate', 'glAccountType', 'createdByUserName', 'submittedOnDate', 'glAccountCode', 'glAccountName', 'debit', 'credit'];
|
||||
/** Data source for journal entries table. */
|
||||
dataSource: JournalEntriesDataSource;
|
||||
/** Journal entries filter. */
|
||||
@@ -89,11 +93,19 @@ export class SearchJournalEntryComponent implements OnInit, AfterViewInit {
|
||||
},
|
||||
{
|
||||
type: 'fromDate',
|
||||
value: this.dateUtils.getDate(new Date(new Date().setMonth(new Date().getMonth() - 1)))
|
||||
value: this.dateUtils.formatDate(new Date(new Date().setMonth(new Date().getMonth() - 1)), this.settingsService.dateFormat)
|
||||
},
|
||||
{
|
||||
type: 'toDate',
|
||||
value: this.dateUtils.getDate(new Date())
|
||||
value: this.dateUtils.formatDate(new Date(), this.settingsService.dateFormat)
|
||||
},
|
||||
{
|
||||
type: 'submittedOnDateFrom',
|
||||
value: ''
|
||||
},
|
||||
{
|
||||
type: 'submittedOnDateTo',
|
||||
value: ''
|
||||
},
|
||||
{
|
||||
type: 'dateFormat',
|
||||
@@ -182,7 +194,7 @@ export class SearchJournalEntryComponent implements OnInit, AfterViewInit {
|
||||
debounceTime(500),
|
||||
distinctUntilChanged(),
|
||||
tap((filterValue) => {
|
||||
this.applyFilter(this.dateUtils.getDate(filterValue), 'fromDate');
|
||||
this.applyFilter(this.dateUtils.formatDate(filterValue, this.settingsService.dateFormat), 'fromDate');
|
||||
})
|
||||
)
|
||||
.subscribe();
|
||||
@@ -192,7 +204,27 @@ export class SearchJournalEntryComponent implements OnInit, AfterViewInit {
|
||||
debounceTime(500),
|
||||
distinctUntilChanged(),
|
||||
tap((filterValue) => {
|
||||
this.applyFilter(this.dateUtils.getDate(filterValue), 'toDate');
|
||||
this.applyFilter(this.dateUtils.formatDate(filterValue, this.settingsService.dateFormat), 'toDate');
|
||||
})
|
||||
)
|
||||
.subscribe();
|
||||
|
||||
this.submittedOnDateFrom.valueChanges
|
||||
.pipe(
|
||||
debounceTime(500),
|
||||
distinctUntilChanged(),
|
||||
tap((filterValue) => {
|
||||
this.applyFilter(this.dateUtils.formatDate(filterValue, this.settingsService.dateFormat), 'submittedOnDateFrom');
|
||||
})
|
||||
)
|
||||
.subscribe();
|
||||
|
||||
this.submittedOnDateTo.valueChanges
|
||||
.pipe(
|
||||
debounceTime(500),
|
||||
distinctUntilChanged(),
|
||||
tap((filterValue) => {
|
||||
this.applyFilter(this.dateUtils.formatDate(filterValue, this.settingsService.dateFormat), 'submittedOnDateTo');
|
||||
})
|
||||
)
|
||||
.subscribe();
|
||||
|
||||
@@ -99,8 +99,8 @@
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<th>Created on</th>
|
||||
<td>{{ data.journalEntry.createdDate }}</td>
|
||||
<th>Submitted on</th>
|
||||
<td>{{ data.journalEntry.submittedOnDate }}</td>
|
||||
</tr>
|
||||
|
||||
</table>
|
||||
|
||||
@@ -41,11 +41,11 @@
|
||||
</div>
|
||||
|
||||
<div fxFlex="25%" fxFlex.lt-md="50%" class="header">
|
||||
Created On
|
||||
Submitted on
|
||||
</div>
|
||||
|
||||
<div fxFlex="25%" fxFlex.lt-md="50%">
|
||||
{{ dataSource.data[0].createdDate }}
|
||||
{{ dataSource.data[0].submittedOnDate }}
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user