Moved to Angular 6.0
---- Pending * Table width for the points column in incentive * Linting * keyboard navigation where it was used earlier * can remove the unused totals calculated serverside in productledger * spinner and loading bars * Activate Guard for Employee Function tabs * Progress for Fingerprint uploads * deleted reconcile and receipe features as they were not being used * focus the right control on component load
This commit is contained in:
13
overlord/src/app/core/core.module.spec.ts
Normal file
13
overlord/src/app/core/core.module.spec.ts
Normal file
@ -0,0 +1,13 @@
|
||||
import {CoreModule} from './core.module';
|
||||
|
||||
describe('CoreModule', () => {
|
||||
let coreModule: CoreModule;
|
||||
|
||||
beforeEach(() => {
|
||||
coreModule = new CoreModule();
|
||||
});
|
||||
|
||||
it('should create an instance', () => {
|
||||
expect(coreModule).toBeTruthy();
|
||||
});
|
||||
});
|
||||
24
overlord/src/app/core/core.module.ts
Normal file
24
overlord/src/app/core/core.module.ts
Normal file
@ -0,0 +1,24 @@
|
||||
import {NgModule} from '@angular/core';
|
||||
import {CommonModule} from '@angular/common';
|
||||
import {NavBarComponent} from './nav-bar/nav-bar.component';
|
||||
import {MatButtonModule, MatIconModule, MatMenuModule, MatToolbarModule} from '@angular/material';
|
||||
import {RouterModule} from '@angular/router';
|
||||
|
||||
@NgModule({
|
||||
imports: [
|
||||
CommonModule,
|
||||
MatButtonModule,
|
||||
MatIconModule,
|
||||
MatMenuModule,
|
||||
MatToolbarModule,
|
||||
RouterModule
|
||||
],
|
||||
declarations: [
|
||||
NavBarComponent
|
||||
],
|
||||
exports: [
|
||||
NavBarComponent
|
||||
]
|
||||
})
|
||||
export class CoreModule {
|
||||
}
|
||||
15
overlord/src/app/core/error-logger.service.spec.ts
Normal file
15
overlord/src/app/core/error-logger.service.spec.ts
Normal file
@ -0,0 +1,15 @@
|
||||
import {inject, TestBed} from '@angular/core/testing';
|
||||
|
||||
import {ErrorLoggerService} from './error-logger.service';
|
||||
|
||||
describe('ErrorLoggerService', () => {
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({
|
||||
providers: [ErrorLoggerService]
|
||||
});
|
||||
});
|
||||
|
||||
it('should be created', inject([ErrorLoggerService], (service: ErrorLoggerService) => {
|
||||
expect(service).toBeTruthy();
|
||||
}));
|
||||
});
|
||||
36
overlord/src/app/core/error-logger.service.ts
Normal file
36
overlord/src/app/core/error-logger.service.ts
Normal file
@ -0,0 +1,36 @@
|
||||
import {Injectable} from '@angular/core';
|
||||
import {Observable} from 'rxjs/internal/Observable';
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
})
|
||||
export class ErrorLoggerService {
|
||||
constructor() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle Http operation that failed.
|
||||
* Let the app continue.
|
||||
* @param operation - name of the operation that failed
|
||||
* @param result - optional value to return as the observable result
|
||||
*/
|
||||
public handleError<T>(serviceName = 'error-logger', operation = 'operation', result?: T) {
|
||||
return (error: any): Observable<T> => {
|
||||
|
||||
// TODO: send the error to remote logging infrastructure
|
||||
console.error(error); // log to console instead
|
||||
|
||||
// TODO: better job of transforming error for user consumption
|
||||
this.log(serviceName, `${operation} failed: ${error.message}`);
|
||||
|
||||
// // Let the app keep running by returning an empty result.
|
||||
// return of(result as T);
|
||||
return Observable.create(subscriber => subscriber.error(error));
|
||||
};
|
||||
}
|
||||
|
||||
public log(serviceName = 'error-logger', message: string) {
|
||||
console.log(serviceName + 'Service: ' + message);
|
||||
}
|
||||
|
||||
}
|
||||
14
overlord/src/app/core/nav-bar/nav-bar.component.css
Normal file
14
overlord/src/app/core/nav-bar/nav-bar.component.css
Normal file
@ -0,0 +1,14 @@
|
||||
.sidenav-container {
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.sidenav {
|
||||
width: 200px;
|
||||
box-shadow: 3px 0 6px rgba(0, 0, 0, .24);
|
||||
}
|
||||
|
||||
.fill-remaining-space {
|
||||
/* This fills the remaining space, by using flexbox.
|
||||
Every toolbar row uses a flexbox row layout. */
|
||||
flex: 1 1 auto;
|
||||
}
|
||||
89
overlord/src/app/core/nav-bar/nav-bar.component.html
Normal file
89
overlord/src/app/core/nav-bar/nav-bar.component.html
Normal file
@ -0,0 +1,89 @@
|
||||
<mat-toolbar>
|
||||
<button
|
||||
type="button"
|
||||
aria-label="Toggle sidenav"
|
||||
mat-icon-button
|
||||
(click)="drawer.toggle()"
|
||||
*ngIf="(isHandset | async)!.matches">
|
||||
<mat-icon aria-label="Side nav toggle icon">menu</mat-icon>
|
||||
</button>
|
||||
<span><a routerLink="/">HnG / TGB</a></span>
|
||||
<mat-menu #voucherMenu="matMenu">
|
||||
<a mat-menu-item routerLink="/Journal">Journal</a>
|
||||
<a mat-menu-item routerLink="/Purchase">Purchase</a>
|
||||
<a mat-menu-item routerLink="/Return">Purchase Return</a>
|
||||
<a mat-menu-item routerLink="/Payment">Payment</a>
|
||||
<a mat-menu-item routerLink="/Receipt">Receipt</a>
|
||||
<a mat-menu-item routerLink="/Issue">Issue</a>
|
||||
</mat-menu>
|
||||
<button mat-button [matMenuTriggerFor]="voucherMenu">
|
||||
Voucher Entry
|
||||
</button>
|
||||
|
||||
<mat-menu #reportMenu="matMenu">
|
||||
<a mat-menu-item routerLink="/Ledger">Display Ledger</a>
|
||||
<a mat-menu-item href="/Reconcile">Ledger Reconcilliation</a>
|
||||
<a mat-menu-item routerLink="/CashFlow">Cash Flow</a>
|
||||
<a mat-menu-item routerLink="/Daybook">Day Book</a>
|
||||
<a mat-menu-item routerLink="/TrialBalance">Trial Balance</a>
|
||||
<a mat-menu-item routerLink="/ProfitLoss">Profit and Loss</a>
|
||||
<a mat-menu-item routerLink="/BalanceSheet">Balance Sheet</a>
|
||||
<a mat-menu-item routerLink="/NetTransactions">Net Transactions</a>
|
||||
<a mat-menu-item routerLink="/Unposted">UnPosted Entries</a>
|
||||
</mat-menu>
|
||||
<button mat-button [matMenuTriggerFor]="reportMenu">
|
||||
Reports
|
||||
</button>
|
||||
|
||||
<mat-menu #productReportMenu="matMenu">
|
||||
<a mat-menu-item routerLink="/ProductLedger">Product Ledger</a>
|
||||
<a mat-menu-item routerLink="/RawMaterialCost">Raw Material Cost</a>
|
||||
<a mat-menu-item routerLink="/PurchaseEntries">Purchase Entries</a>
|
||||
<a mat-menu-item routerLink="/Purchases">Purchases</a>
|
||||
<a mat-menu-item routerLink="/ClosingStock">Closing Stock</a>
|
||||
<a mat-menu-item routerLink="/StockMovement">Stock Movement</a>
|
||||
</mat-menu>
|
||||
<button mat-button [matMenuTriggerFor]="productReportMenu">
|
||||
Product Reports
|
||||
</button>
|
||||
|
||||
<mat-menu #employeeMenu="matMenu">
|
||||
<a mat-menu-item routerLink="/Employees">Employees</a>
|
||||
<a mat-menu-item routerLink="/Attendance">Attendance</a>
|
||||
<a mat-menu-item routerLink="/EmployeeAttendance">Employee Attendance</a>
|
||||
<a mat-menu-item routerLink="/EmployeeFunctions">Employee Functions</a>
|
||||
<a mat-menu-item routerLink="/EmployeeBenefits">Employee Benefits (Esi / Pf)</a>
|
||||
<a mat-menu-item routerLink="/Incentive">Incentive</a>
|
||||
</mat-menu>
|
||||
<button mat-button [matMenuTriggerFor]="employeeMenu">
|
||||
Employees
|
||||
</button>
|
||||
|
||||
<mat-menu #masterMenu="matMenu">
|
||||
<a mat-menu-item routerLink="/Accounts">Accounts</a>
|
||||
<a mat-menu-item routerLink="/CostCentres">Cost Centres</a>
|
||||
<a mat-menu-item routerLink="/Products">Products</a>
|
||||
<a mat-menu-item routerLink="/ProductGroups">Product Groups</a>
|
||||
</mat-menu>
|
||||
<button mat-button [matMenuTriggerFor]="masterMenu">
|
||||
Masters
|
||||
</button>
|
||||
|
||||
<span class="fill-remaining-space"></span>
|
||||
|
||||
<mat-menu #userMenu="matMenu">
|
||||
<a mat-menu-item routerLink="/logout">Logout {{nameObject | async}}</a>
|
||||
<a mat-menu-item routerLink="/User/{{nameObject | async}}">Change Password</a>
|
||||
<a mat-menu-item routerLink="/Users">Users</a>
|
||||
<a mat-menu-item routerLink="/Groups">Groups</a>
|
||||
<a mat-menu-item routerLink="/Clients">Clients</a>
|
||||
<a mat-menu-item routerLink="/Settings">Settings</a>
|
||||
</mat-menu>
|
||||
<button mat-button [matMenuTriggerFor]="userMenu" *ngIf="nameObject | async as name">
|
||||
<mat-icon>account_box</mat-icon>
|
||||
{{name}}
|
||||
</button>
|
||||
<a mat-button routerLink="/login" *ngIf="!(nameObject | async)">
|
||||
<mat-icon>account_box</mat-icon>
|
||||
Login</a>
|
||||
</mat-toolbar>
|
||||
23
overlord/src/app/core/nav-bar/nav-bar.component.spec.ts
Normal file
23
overlord/src/app/core/nav-bar/nav-bar.component.spec.ts
Normal file
@ -0,0 +1,23 @@
|
||||
import {ComponentFixture, fakeAsync, TestBed} from '@angular/core/testing';
|
||||
|
||||
import {NavBarComponent} from './nav-bar.component';
|
||||
|
||||
describe('NavBarComponent', () => {
|
||||
let component: NavBarComponent;
|
||||
let fixture: ComponentFixture<NavBarComponent>;
|
||||
|
||||
beforeEach(fakeAsync(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [NavBarComponent]
|
||||
})
|
||||
.compileComponents();
|
||||
|
||||
fixture = TestBed.createComponent(NavBarComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
}));
|
||||
|
||||
it('should compile', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
||||
28
overlord/src/app/core/nav-bar/nav-bar.component.ts
Normal file
28
overlord/src/app/core/nav-bar/nav-bar.component.ts
Normal file
@ -0,0 +1,28 @@
|
||||
import {Component, OnInit} from '@angular/core';
|
||||
import {BreakpointObserver, Breakpoints, BreakpointState} from '@angular/cdk/layout';
|
||||
import {Observable} from 'rxjs';
|
||||
import {AuthService} from '../../auth/auth.service';
|
||||
import {Subject} from 'rxjs/internal/Subject';
|
||||
|
||||
@Component({
|
||||
selector: 'app-nav-bar',
|
||||
templateUrl: './nav-bar.component.html',
|
||||
styleUrls: ['./nav-bar.component.css']
|
||||
})
|
||||
export class NavBarComponent implements OnInit {
|
||||
isHandset: Observable<BreakpointState> = this.breakpointObserver.observe(Breakpoints.Handset);
|
||||
public nameObject = new Subject<string>();
|
||||
|
||||
constructor(private breakpointObserver: BreakpointObserver, private auth: AuthService) {
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
this.auth.userObservable.subscribe((user) => {
|
||||
if (user.isAuthenticated) {
|
||||
this.nameObject.next(user.name);
|
||||
} else {
|
||||
this.nameObject.next(null);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
15
overlord/src/app/core/toaster.service.spec.ts
Normal file
15
overlord/src/app/core/toaster.service.spec.ts
Normal file
@ -0,0 +1,15 @@
|
||||
import {inject, TestBed} from '@angular/core/testing';
|
||||
|
||||
import {ToasterService} from './toaster.service';
|
||||
|
||||
describe('ToasterService', () => {
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({
|
||||
providers: [ToasterService]
|
||||
});
|
||||
});
|
||||
|
||||
it('should be created', inject([ToasterService], (service: ToasterService) => {
|
||||
expect(service).toBeTruthy();
|
||||
}));
|
||||
});
|
||||
17
overlord/src/app/core/toaster.service.ts
Normal file
17
overlord/src/app/core/toaster.service.ts
Normal file
@ -0,0 +1,17 @@
|
||||
import {Injectable} from '@angular/core';
|
||||
import {MatSnackBar} from '@angular/material';
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
})
|
||||
export class ToasterService {
|
||||
|
||||
constructor(private snackBar: MatSnackBar) {
|
||||
}
|
||||
|
||||
show(type: string, msg: string) {
|
||||
this.snackBar.open(msg, type, {
|
||||
duration: 3000,
|
||||
});
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user