refactor (df/locale): accounting module (#1294)
This commit is contained in:
@@ -5,7 +5,7 @@ import { Router, ActivatedRoute } from '@angular/router';
|
||||
|
||||
/** Custom Services */
|
||||
import { AccountingService } from '../../accounting.service';
|
||||
|
||||
import { SettingsService } from 'app/settings/settings.service';
|
||||
/**
|
||||
* Create closure component.
|
||||
*/
|
||||
@@ -29,11 +29,13 @@ export class CreateClosureComponent implements OnInit {
|
||||
* Retrieves the offices data from `resolve`.
|
||||
* @param {FormBuilder} formBuilder Form Builder.
|
||||
* @param {AccountingService} accountingService Accounting Service.
|
||||
* @param {SettingsService} settingsService Settings Service.
|
||||
* @param {ActivatedRoute} route Activated Route.
|
||||
* @param {Router} router Router for navigation.
|
||||
*/
|
||||
constructor(private formBuilder: FormBuilder,
|
||||
private accountingService: AccountingService,
|
||||
private settingsService: SettingsService,
|
||||
private route: ActivatedRoute,
|
||||
private router: Router) {
|
||||
this.route.data.subscribe((data: { offices: any }) => {
|
||||
@@ -66,8 +68,8 @@ export class CreateClosureComponent implements OnInit {
|
||||
submit() {
|
||||
const accountingClosure = this.accountingClosureForm.value;
|
||||
// TODO: Update once language and date settings are setup
|
||||
accountingClosure.locale = 'en';
|
||||
accountingClosure.dateFormat = 'yyyy-MM-dd';
|
||||
accountingClosure.locale = this.settingsService.language.code;
|
||||
accountingClosure.dateFormat = this.settingsService.dateFormat;
|
||||
if (accountingClosure.closingDate instanceof Date) {
|
||||
let day = accountingClosure.closingDate.getDate();
|
||||
let month = accountingClosure.closingDate.getMonth() + 1;
|
||||
|
||||
@@ -5,7 +5,7 @@ import { Router, ActivatedRoute } from '@angular/router';
|
||||
|
||||
/** Custom Services */
|
||||
import { AccountingService } from '../accounting.service';
|
||||
|
||||
import { SettingsService } from 'app/settings/settings.service';
|
||||
/**
|
||||
* Create Journal Entry component.
|
||||
*/
|
||||
@@ -35,11 +35,13 @@ export class CreateJournalEntryComponent implements OnInit {
|
||||
* Retrieves the offices, currencies, payment types and gl accounts data from `resolve`.
|
||||
* @param {FormBuilder} formBuilder Form Builder.
|
||||
* @param {AccountingService} accountingService Accounting Service.
|
||||
* @param {SettingsService} settingsService Settings Service.
|
||||
* @param {ActivatedRoute} route Activated Route.
|
||||
* @param {Router} router Router for navigation.
|
||||
*/
|
||||
constructor(private formBuilder: FormBuilder,
|
||||
private accountingService: AccountingService,
|
||||
private settingsService: SettingsService,
|
||||
private route: ActivatedRoute,
|
||||
private router: Router) {
|
||||
this.route.data.subscribe((data: {
|
||||
@@ -134,8 +136,8 @@ export class CreateJournalEntryComponent implements OnInit {
|
||||
submit() {
|
||||
const journalEntry = this.journalEntryForm.value;
|
||||
// TODO: Update once language and date settings are setup
|
||||
journalEntry.locale = 'en';
|
||||
journalEntry.dateFormat = 'yyyy-MM-dd';
|
||||
journalEntry.locale = this.settingsService.language.code;
|
||||
journalEntry.dateFormat = this.settingsService.dateFormat;
|
||||
if (journalEntry.transactionDate instanceof Date) {
|
||||
let day = journalEntry.transactionDate.getDate();
|
||||
let month = journalEntry.transactionDate.getMonth() + 1;
|
||||
|
||||
@@ -5,7 +5,7 @@ import { Router, ActivatedRoute } from '@angular/router';
|
||||
|
||||
/** Custom Services */
|
||||
import { AccountingService } from '../accounting.service';
|
||||
|
||||
import { SettingsService } from 'app/settings/settings.service';
|
||||
/**
|
||||
* Frequent Postings component.
|
||||
*/
|
||||
@@ -43,11 +43,13 @@ export class FrequentPostingsComponent implements OnInit {
|
||||
* Retrieves the offices, accounting rules, currencies and payment types data from `resolve`.
|
||||
* @param {FormBuilder} formBuilder Form Builder.
|
||||
* @param {AccountingService} accountingService Accounting Service.
|
||||
* @param {SettingsService} settingsService Settings Service.
|
||||
* @param {ActivatedRoute} route Activated Route.
|
||||
* @param {Router} router Router for navigation.
|
||||
*/
|
||||
constructor(private formBuilder: FormBuilder,
|
||||
private accountingService: AccountingService,
|
||||
private settingsService: SettingsService,
|
||||
private route: ActivatedRoute,
|
||||
private router: Router) {
|
||||
this.route.data.subscribe((data: {
|
||||
@@ -165,8 +167,8 @@ export class FrequentPostingsComponent implements OnInit {
|
||||
const journalEntry = this.frequentPostingsForm.value;
|
||||
journalEntry.accountingRule = journalEntry.accountingRule.id;
|
||||
// TODO: Update once language and date settings are setup
|
||||
journalEntry.locale = 'en';
|
||||
journalEntry.dateFormat = 'yyyy-MM-dd';
|
||||
journalEntry.locale = this.settingsService.language.code;
|
||||
journalEntry.dateFormat = this.settingsService.dateFormat;
|
||||
if (journalEntry.transactionDate instanceof Date) {
|
||||
let day = journalEntry.transactionDate.getDate();
|
||||
let month = journalEntry.transactionDate.getMonth() + 1;
|
||||
|
||||
@@ -5,7 +5,7 @@ import { ActivatedRoute, Router } from '@angular/router';
|
||||
|
||||
/** Custom Services */
|
||||
import { AccountingService } from '../accounting.service';
|
||||
|
||||
import { SettingsService } from 'app/settings/settings.service';
|
||||
/** Custom Validators */
|
||||
import { onlyOneOfTheFieldsIsRequiredValidator } from './only-one-of-the-fields-is-required.validator';
|
||||
|
||||
@@ -40,11 +40,13 @@ export class MigrateOpeningBalancesComponent implements OnInit {
|
||||
* Retrieves the offices and currencies from `resolve`.
|
||||
* @param {FormBuilder} formBuilder Form Builder.
|
||||
* @param {AccountingService} accountingService Accounting Service.
|
||||
* @param {SettingsService} settingsService Settings Service.
|
||||
* @param {ActivatedRoute} route Activated Route.
|
||||
* @param {Router} router Router for navigation.
|
||||
*/
|
||||
constructor(private formBuilder: FormBuilder,
|
||||
private accountingService: AccountingService,
|
||||
private settingsService: SettingsService,
|
||||
private route: ActivatedRoute,
|
||||
private router: Router) {
|
||||
this.route.data.subscribe((data: {
|
||||
@@ -134,8 +136,8 @@ export class MigrateOpeningBalancesComponent implements OnInit {
|
||||
submit() {
|
||||
const openingBalances = this.openingBalancesForm.value;
|
||||
// TODO: Update once language and date settings are setup
|
||||
openingBalances.locale = 'en';
|
||||
openingBalances.dateFormat = 'yyyy-MM-dd';
|
||||
openingBalances.locale = this.settingsService.language.code;
|
||||
openingBalances.dateFormat = this.settingsService.dateFormat;
|
||||
if (openingBalances.transactionDate instanceof Date) {
|
||||
let day = openingBalances.transactionDate.getDate();
|
||||
let month = openingBalances.transactionDate.getMonth() + 1;
|
||||
|
||||
@@ -5,7 +5,7 @@ import { Router, ActivatedRoute } from '@angular/router';
|
||||
|
||||
/** Custom Services */
|
||||
import { AccountingService } from '../accounting.service';
|
||||
|
||||
import { SettingsService } from 'app/settings/settings.service';
|
||||
/**
|
||||
* Periodic accruals component.
|
||||
*/
|
||||
@@ -26,11 +26,13 @@ export class PeriodicAccrualsComponent implements OnInit {
|
||||
/**
|
||||
* @param {FormBuilder} formBuilder Form Builder.
|
||||
* @param {AccountingService} accountingService Accounting Service.
|
||||
* @param {SettingsService} settingsService Settings Service.
|
||||
* @param {ActivatedRoute} route Activated Route.
|
||||
* @param {Router} router Router for navigation.
|
||||
*/
|
||||
constructor(private formBuilder: FormBuilder,
|
||||
private accountingService: AccountingService,
|
||||
private settingsService: SettingsService,
|
||||
private route: ActivatedRoute,
|
||||
private router: Router) { }
|
||||
|
||||
@@ -57,8 +59,8 @@ export class PeriodicAccrualsComponent implements OnInit {
|
||||
submit() {
|
||||
const periodicAccruals = this.periodicAccrualsForm.value;
|
||||
// TODO: Update once language and date settings are setup
|
||||
periodicAccruals.locale = 'en';
|
||||
periodicAccruals.dateFormat = 'yyyy-MM-dd';
|
||||
periodicAccruals.locale = this.settingsService.language.code;
|
||||
periodicAccruals.dateFormat = this.settingsService.dateFormat;
|
||||
if (periodicAccruals.tillDate instanceof Date) {
|
||||
let day = periodicAccruals.tillDate.getDate();
|
||||
let month = periodicAccruals.tillDate.getMonth() + 1;
|
||||
|
||||
+5
-3
@@ -5,7 +5,7 @@ import { ActivatedRoute, Router } from '@angular/router';
|
||||
|
||||
/** Custom Services */
|
||||
import { AccountingService } from '../../accounting.service';
|
||||
|
||||
import { SettingsService } from 'app/settings/settings.service';
|
||||
/**
|
||||
* Create provisioning entry component.
|
||||
*/
|
||||
@@ -26,11 +26,13 @@ export class CreateProvisioningEntryComponent implements OnInit {
|
||||
/**
|
||||
* @param {FormBuilder} formBuilder Form Builder.
|
||||
* @param {AccountingService} accountingService Accounting Service.
|
||||
* @param {SettingsService} settingsService Settings Service.
|
||||
* @param {ActivatedRoute} route Activated Route.
|
||||
* @param {Router} router Router for navigation.
|
||||
*/
|
||||
constructor(private formBuilder: FormBuilder,
|
||||
private accountingService: AccountingService,
|
||||
private settingsService: SettingsService,
|
||||
private route: ActivatedRoute,
|
||||
private router: Router) { }
|
||||
|
||||
@@ -58,8 +60,8 @@ export class CreateProvisioningEntryComponent implements OnInit {
|
||||
submit() {
|
||||
const provisioningEntry = this.provisioningEntryForm.value;
|
||||
// TODO: Update once language and date settings are setup
|
||||
provisioningEntry.locale = 'en';
|
||||
provisioningEntry.dateFormat = 'yyyy-MM-dd';
|
||||
provisioningEntry.locale = this.settingsService.language.code;
|
||||
provisioningEntry.dateFormat = this.settingsService.dateFormat;
|
||||
if (provisioningEntry.date instanceof Date) {
|
||||
let day = provisioningEntry.date.getDate();
|
||||
let month = provisioningEntry.date.getMonth() + 1;
|
||||
|
||||
@@ -11,7 +11,7 @@ import { tap, startWith, map, distinctUntilChanged, debounceTime} from 'rxjs/ope
|
||||
|
||||
/** Custom Services */
|
||||
import { AccountingService } from '../accounting.service';
|
||||
|
||||
import { SettingsService } from 'app/settings/settings.service';
|
||||
/** Custom Data Source */
|
||||
import { JournalEntriesDataSource } from './journal-entry.datasource';
|
||||
|
||||
@@ -96,11 +96,11 @@ export class SearchJournalEntryComponent implements OnInit, AfterViewInit {
|
||||
},
|
||||
{
|
||||
type: 'dateFormat',
|
||||
value: 'yyyy-MM-dd'
|
||||
value: this.settingsService.dateFormat
|
||||
},
|
||||
{
|
||||
type: 'locale',
|
||||
value: 'en'
|
||||
value: this.settingsService.language.code
|
||||
}
|
||||
];
|
||||
|
||||
@@ -113,8 +113,10 @@ export class SearchJournalEntryComponent implements OnInit, AfterViewInit {
|
||||
* Retrieves the offices and gl accounts data from `resolve`.
|
||||
* @param {AccountingService} accountingService Accounting Service.
|
||||
* @param {ActivatedRoute} route Activated Route.
|
||||
* @param {SettingsService} settingsService Settings Service.
|
||||
*/
|
||||
constructor(private accountingService: AccountingService,
|
||||
private settingsService: SettingsService,
|
||||
private route: ActivatedRoute) {
|
||||
this.route.data.subscribe((data: {
|
||||
offices: any,
|
||||
|
||||
Reference in New Issue
Block a user