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:
Amritanshu
2019-06-13 16:36:43 +05:30
parent fea48e1a3e
commit 72044476a8
184 changed files with 786 additions and 664 deletions
@@ -1,6 +1,6 @@
import {DataSource} from '@angular/cdk/collections';
import {Observable} from 'rxjs';
import {Incentive} from '../journal/voucher';
import {Incentive} from '../core/voucher';
export class IncentiveDataSource extends DataSource<Incentive> {
@@ -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';
import {tap} from 'rxjs/operators';
@Injectable({
@@ -7,7 +7,7 @@ import {IncentiveComponent} from './incentive.component';
const incentiveRoutes: Routes = [
{
path: 'Incentive',
path: '',
component: IncentiveComponent,
canActivate: [AuthGuard],
data: {
@@ -19,7 +19,7 @@ const incentiveRoutes: Routes = [
runGuardsAndResolvers: 'always'
},
{
path: 'Incentive/:id',
path: ':id',
component: IncentiveComponent,
canActivate: [AuthGuard],
data: {
@@ -4,9 +4,9 @@ import { MatDialog } from '@angular/material/dialog';
import {ActivatedRoute, Router} from '@angular/router';
import {BehaviorSubject, Observable} from 'rxjs';
import {IncentiveDataSource} from './incentive-datasource';
import {Account} from '../account/account';
import {VoucherService} from '../journal/voucher.service';
import {Incentive, Voucher} from '../journal/voucher';
import {Account} from '../core/account';
import {VoucherService} from '../core/voucher.service';
import {Incentive, Voucher} from '../core/voucher';
import * as moment from 'moment';
import {AuthService} from '../auth/auth.service';
import {ConfirmDialogComponent} from '../shared/confirm-dialog/confirm-dialog.component';
@@ -145,7 +145,7 @@ export class IncentiveComponent implements OnInit {
.subscribe(
(result) => {
this.toaster.show('Success', '');
this.router.navigate(['/Incentive', result.id]);
this.router.navigate(['/incentive', result.id]);
},
(error) => {
this.toaster.show('Danger', error.error);
@@ -169,7 +169,7 @@ export class IncentiveComponent implements OnInit {
.subscribe(
(result) => {
this.toaster.show('Success', '');
this.router.navigate(['/Incentive'], {replaceUrl: true});
this.router.navigate(['/incentive'], {replaceUrl: true});
},
(error) => {
this.toaster.show('Danger', error.error);