Added loading bar
Fixed product, account and employee details for add new.
This commit is contained in:
@ -56,7 +56,7 @@ export class AccountDetailComponent implements OnInit, AfterViewInit {
|
||||
this.item = item;
|
||||
this.form.setValue({
|
||||
code: this.item.code || '(Auto)',
|
||||
name: this.item.name,
|
||||
name: this.item.name || '',
|
||||
type: this.item.type,
|
||||
isActive: this.item.isActive,
|
||||
isReconcilable: this.item.isReconcilable,
|
||||
|
||||
@ -1,3 +1,4 @@
|
||||
<ngx-loading-bar></ngx-loading-bar>
|
||||
<app-nav-bar></app-nav-bar>
|
||||
<div fxLayout="row" fxLayoutAlign="center none" class="mat-app-background basic-container">
|
||||
<router-outlet></router-outlet>
|
||||
|
||||
@ -3,10 +3,16 @@ 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';
|
||||
import {HTTP_INTERCEPTORS} from '@angular/common/http';
|
||||
import {HttpAuthInterceptor} from './http-auth-interceptor';
|
||||
import {LoadingBarHttpClientModule} from '@ngx-loading-bar/http-client';
|
||||
import {LoadingBarRouterModule} from '@ngx-loading-bar/router';
|
||||
|
||||
@NgModule({
|
||||
imports: [
|
||||
CommonModule,
|
||||
LoadingBarHttpClientModule,
|
||||
LoadingBarRouterModule,
|
||||
MatButtonModule,
|
||||
MatIconModule,
|
||||
MatMenuModule,
|
||||
@ -14,11 +20,18 @@ import {RouterModule} from '@angular/router';
|
||||
RouterModule
|
||||
],
|
||||
declarations: [
|
||||
NavBarComponent
|
||||
NavBarComponent,
|
||||
],
|
||||
exports: [
|
||||
NavBarComponent
|
||||
]
|
||||
NavBarComponent,
|
||||
LoadingBarHttpClientModule,
|
||||
LoadingBarRouterModule
|
||||
],
|
||||
providers: [[{
|
||||
provide: HTTP_INTERCEPTORS,
|
||||
useClass: HttpAuthInterceptor,
|
||||
multi: true
|
||||
}]]
|
||||
})
|
||||
export class CoreModule {
|
||||
}
|
||||
|
||||
31
overlord/src/app/core/http-auth-interceptor.ts
Normal file
31
overlord/src/app/core/http-auth-interceptor.ts
Normal file
@ -0,0 +1,31 @@
|
||||
import {Injectable} from '@angular/core';
|
||||
import {HttpEvent, HttpHandler, HttpInterceptor, HttpRequest} from '@angular/common/http';
|
||||
|
||||
import {Observable, ObservableInput, of as observableOf} from 'rxjs';
|
||||
import {catchError} from 'rxjs/operators';
|
||||
import {ToasterService} from './toaster.service';
|
||||
import {Router} from '@angular/router';
|
||||
import {ConfirmDialogComponent} from '../shared/confirm-dialog/confirm-dialog.component';
|
||||
import {MatDialog} from '@angular/material';
|
||||
|
||||
@Injectable()
|
||||
export class HttpAuthInterceptor implements HttpInterceptor {
|
||||
|
||||
constructor(private router: Router, private dialog: MatDialog, private toaster: ToasterService) {
|
||||
}
|
||||
|
||||
intercept(req: HttpRequest<any>, next: HttpHandler):
|
||||
Observable<HttpEvent<any>> {
|
||||
return next.handle(req)
|
||||
.pipe(
|
||||
catchError((err: any, caught: Observable<any>): ObservableInput<{}> => {
|
||||
if (err.status === 401) {
|
||||
this.router.navigate(['login']);
|
||||
this.toaster.show('Danger', 'User has been logged out');
|
||||
}
|
||||
return observableOf(caught);
|
||||
}
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -64,9 +64,9 @@ export class EmployeeDetailComponent implements OnInit, AfterViewInit {
|
||||
designation: this.item.designation || '',
|
||||
salary: this.item.salary || '',
|
||||
points: this.item.points || '',
|
||||
isActive: this.item.isActive || true,
|
||||
isActive: this.item.isActive,
|
||||
costCentre: this.item.costCentre.id,
|
||||
joiningDate: moment(this.item.joiningDate, 'DD-MMM-YYYY').toDate(),
|
||||
joiningDate: this.item.joiningDate ? moment(this.item.joiningDate, 'DD-MMM-YYYY').toDate() : '',
|
||||
leavingDate: this.item.isActive ? null : moment(this.item.leavingDate, 'DD-MMM-YYYY').toDate()
|
||||
});
|
||||
}
|
||||
|
||||
@ -57,19 +57,20 @@ export class ProductDetailComponent implements OnInit, AfterViewInit {
|
||||
|
||||
showItem(item: Product) {
|
||||
this.item = item;
|
||||
console.log(item);
|
||||
this.form.setValue({
|
||||
code: this.item.code || '(Auto)',
|
||||
name: this.item.name,
|
||||
units: this.item.units,
|
||||
fraction: this.item.fraction,
|
||||
fractionUnits: this.item.fractionUnits,
|
||||
productYield: this.item.productYield,
|
||||
price: this.item.price,
|
||||
salePrice: this.item.salePrice,
|
||||
name: this.item.name || '',
|
||||
units: this.item.units || '',
|
||||
fraction: this.item.fraction || '',
|
||||
fractionUnits: this.item.fractionUnits || '',
|
||||
productYield: this.item.productYield || '',
|
||||
price: this.item.price || '',
|
||||
salePrice: this.item.salePrice || '',
|
||||
isPurchased: this.item.isPurchased,
|
||||
isSold: this.item.isSold,
|
||||
isActive: this.item.isActive,
|
||||
productGroup: this.item.productGroup.id
|
||||
productGroup: this.item.productGroup.id ? this.item.productGroup.id : ''
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@ -44,7 +44,7 @@ export class TokenizerService {
|
||||
const isSort = (key === '' && value.length > 1 && '+-'.indexOf(value.charAt(0)) !== -1);
|
||||
return sorter !== null ? (isSort && value.substr(1) in sorter) : isSort;
|
||||
}
|
||||
// getFilters(input: string[]) {
|
||||
// input.
|
||||
// }
|
||||
getFilters(input: string[]) {
|
||||
// input.
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user