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,6 +1,6 @@
|
||||
import {DataSource} from '@angular/cdk/collections';
|
||||
import {Observable} from 'rxjs';
|
||||
import {Inventory, Journal} from '../journal/voucher';
|
||||
import {Inventory, Journal} from '../core/voucher';
|
||||
|
||||
|
||||
export class PurchaseDataSource extends DataSource<Inventory> {
|
||||
|
||||
@ -4,7 +4,7 @@ import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog';
|
||||
import {debounceTime, distinctUntilChanged, map, startWith, switchMap} from 'rxjs/operators';
|
||||
import {FormBuilder, FormGroup} from '@angular/forms';
|
||||
import {Observable, of as observableOf} from 'rxjs';
|
||||
import {Product} from '../product/product';
|
||||
import {Product} from '../core/product';
|
||||
import {ProductService} from '../product/product.service';
|
||||
|
||||
@Component({
|
||||
|
||||
@ -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'
|
||||
|
||||
@ -7,7 +7,7 @@ import {PurchaseComponent} from './purchase.component';
|
||||
|
||||
const purchaseRoutes: Routes = [
|
||||
{
|
||||
path: 'Purchase',
|
||||
path: '',
|
||||
component: PurchaseComponent,
|
||||
canActivate: [AuthGuard],
|
||||
data: {
|
||||
@ -19,7 +19,7 @@ const purchaseRoutes: Routes = [
|
||||
runGuardsAndResolvers: 'always'
|
||||
},
|
||||
{
|
||||
path: 'Purchase/:id',
|
||||
path: ':id',
|
||||
component: PurchaseComponent,
|
||||
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 {PurchaseDataSource} from './purchase-datasource';
|
||||
import {Account} from '../account/account';
|
||||
import {VoucherService} from '../journal/voucher.service';
|
||||
import {AccountService} from '../account/account.service';
|
||||
import {DbFile, Inventory, Journal, Voucher} from '../journal/voucher';
|
||||
import {Account} from '../core/account';
|
||||
import {VoucherService} from '../core/voucher.service';
|
||||
import {AccountService} from '../core/account.service';
|
||||
import {DbFile, Inventory, Journal, Voucher} from '../core/voucher';
|
||||
import * as moment from 'moment';
|
||||
import {AuthService} from '../auth/auth.service';
|
||||
import {ConfirmDialogComponent} from '../shared/confirm-dialog/confirm-dialog.component';
|
||||
@ -17,7 +17,7 @@ import {debounceTime, distinctUntilChanged, map, startWith, switchMap} from 'rxj
|
||||
import {PurchaseDialogComponent} from './purchase-dialog.component';
|
||||
import {ImageDialogComponent} from '../shared/image-dialog/image-dialog.component';
|
||||
import {ProductService} from '../product/product.service';
|
||||
import {Product} from '../product/product';
|
||||
import {Product} from '../core/product';
|
||||
import {Hotkey, HotkeysService} from "angular2-hotkeys";
|
||||
|
||||
@Component({
|
||||
@ -235,7 +235,7 @@ export class PurchaseComponent implements OnInit, AfterViewInit, OnDestroy {
|
||||
(result) => {
|
||||
this.loadVoucher(result);
|
||||
this.toaster.show('Success', '');
|
||||
this.router.navigate(['/Purchase', result.id]);
|
||||
this.router.navigate(['/purchase', result.id]);
|
||||
},
|
||||
(error) => {
|
||||
this.toaster.show('Danger', error.error);
|
||||
@ -256,7 +256,7 @@ export class PurchaseComponent implements OnInit, AfterViewInit, OnDestroy {
|
||||
.subscribe(
|
||||
(result) => {
|
||||
this.toaster.show('Success', '');
|
||||
this.router.navigate(['/Purchase'], {replaceUrl: true});
|
||||
this.router.navigate(['/purchase'], {replaceUrl: true});
|
||||
},
|
||||
(error) => {
|
||||
this.toaster.show('Danger', error.error);
|
||||
|
||||
Reference in New Issue
Block a user