Feature: Lazy loading
Lazy loaded everything TODO: The cash flow module when clicking on sub-links, it reloads the whole page, it needs to be diagnosed and fixed, this problem also exists in the other modules TODO: Rename folders and modules such as account to accounts to match the url
This commit is contained in:
@ -1,8 +1,8 @@
|
||||
import {Injectable} from '@angular/core';
|
||||
import {ActivatedRouteSnapshot, Resolve, RouterStateSnapshot} from '@angular/router';
|
||||
import {Observable} from 'rxjs/internal/Observable';
|
||||
import {Account} from '../account/account';
|
||||
import {AccountService} from '../account/account.service';
|
||||
import {Account} from '../core/account';
|
||||
import {AccountService} from '../core/account.service';
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
import {DataSource} from '@angular/cdk/collections';
|
||||
import {Observable} from 'rxjs';
|
||||
import {Journal} from '../journal/voucher';
|
||||
import {Journal} from '../core/voucher';
|
||||
|
||||
|
||||
export class ReceiptDataSource extends DataSource<Journal> {
|
||||
|
||||
@ -2,8 +2,8 @@ import {Component, Inject, OnInit} from '@angular/core';
|
||||
import { MatAutocompleteSelectedEvent } from '@angular/material/autocomplete';
|
||||
import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog';
|
||||
import {debounceTime, distinctUntilChanged, map, startWith, switchMap} from 'rxjs/operators';
|
||||
import {Account} from '../account/account';
|
||||
import {AccountService} from '../account/account.service';
|
||||
import {Account} from '../core/account';
|
||||
import {AccountService} from '../core/account.service';
|
||||
import {FormBuilder, FormGroup} from '@angular/forms';
|
||||
import {Observable, of as observableOf} from 'rxjs';
|
||||
|
||||
|
||||
@ -1,8 +1,8 @@
|
||||
import {Injectable} from '@angular/core';
|
||||
import {ActivatedRouteSnapshot, Resolve, RouterStateSnapshot} from '@angular/router';
|
||||
import {Observable} from 'rxjs/internal/Observable';
|
||||
import {Voucher} from '../journal/voucher';
|
||||
import {VoucherService} from '../journal/voucher.service';
|
||||
import {Voucher} from '../core/voucher';
|
||||
import {VoucherService} from '../core/voucher.service';
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
|
||||
@ -8,7 +8,7 @@ import {ReceiptAccountsResolver} from './receipt-accounts-resolver.service';
|
||||
|
||||
const receiptRoutes: Routes = [
|
||||
{
|
||||
path: 'Receipt',
|
||||
path: '',
|
||||
component: ReceiptComponent,
|
||||
canActivate: [AuthGuard],
|
||||
data: {
|
||||
@ -21,7 +21,7 @@ const receiptRoutes: Routes = [
|
||||
runGuardsAndResolvers: 'paramsChange'
|
||||
},
|
||||
{
|
||||
path: 'Receipt/:id',
|
||||
path: ':id',
|
||||
component: ReceiptComponent,
|
||||
canActivate: [AuthGuard],
|
||||
data: {
|
||||
|
||||
@ -5,10 +5,10 @@ import { MatDialog } from '@angular/material/dialog';
|
||||
import {ActivatedRoute, Router} from '@angular/router';
|
||||
import {BehaviorSubject, fromEvent, Observable, of, of as observableOf, zip} from 'rxjs';
|
||||
import {ReceiptDataSource} from './receipt-datasource';
|
||||
import {Account} from '../account/account';
|
||||
import {VoucherService} from '../journal/voucher.service';
|
||||
import {AccountService} from '../account/account.service';
|
||||
import {DbFile, Journal, Voucher} from '../journal/voucher';
|
||||
import {Account} from '../core/account';
|
||||
import {VoucherService} from '../core/voucher.service';
|
||||
import {AccountService} from '../core/account.service';
|
||||
import {DbFile, Journal, Voucher} from '../core/voucher';
|
||||
import * as moment from 'moment';
|
||||
import * as math from 'mathjs';
|
||||
import {AuthService} from '../auth/auth.service';
|
||||
@ -232,7 +232,7 @@ export class ReceiptComponent implements OnInit, AfterViewInit, OnDestroy {
|
||||
(result) => {
|
||||
this.loadVoucher(result);
|
||||
this.toaster.show('Success', '');
|
||||
this.router.navigate(['/Receipt', result.id]);
|
||||
this.router.navigate(['/receipt', result.id]);
|
||||
},
|
||||
(error) => {
|
||||
this.toaster.show('Danger', error.error);
|
||||
@ -253,7 +253,7 @@ export class ReceiptComponent implements OnInit, AfterViewInit, OnDestroy {
|
||||
.subscribe(
|
||||
(result) => {
|
||||
this.toaster.show('Success', '');
|
||||
this.router.navigate(['/Receipt'], {replaceUrl: true});
|
||||
this.router.navigate(['/receipt'], {replaceUrl: true});
|
||||
},
|
||||
(error) => {
|
||||
this.toaster.show('Danger', error.error);
|
||||
|
||||
Reference in New Issue
Block a user