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:
18
overlord/src/app/attendance/attendance-datasource.ts
Normal file
18
overlord/src/app/attendance/attendance-datasource.ts
Normal file
@ -0,0 +1,18 @@
|
||||
import {DataSource} from '@angular/cdk/collections';
|
||||
import {Observable} from 'rxjs';
|
||||
import {AttendanceItem} from './attendance';
|
||||
|
||||
|
||||
export class AttendanceDataSource extends DataSource<AttendanceItem> {
|
||||
|
||||
constructor(private data: Observable<AttendanceItem[]>) {
|
||||
super();
|
||||
}
|
||||
|
||||
connect(): Observable<AttendanceItem[]> {
|
||||
return this.data;
|
||||
}
|
||||
|
||||
disconnect() {
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,15 @@
|
||||
import {inject, TestBed} from '@angular/core/testing';
|
||||
|
||||
import {AttendanceResolver} from './attendance-resolver.service';
|
||||
|
||||
describe('AttendanceResolver', () => {
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({
|
||||
providers: [AttendanceResolver]
|
||||
});
|
||||
});
|
||||
|
||||
it('should be created', inject([AttendanceResolver], (service: AttendanceResolver) => {
|
||||
expect(service).toBeTruthy();
|
||||
}));
|
||||
});
|
||||
19
overlord/src/app/attendance/attendance-resolver.service.ts
Normal file
19
overlord/src/app/attendance/attendance-resolver.service.ts
Normal file
@ -0,0 +1,19 @@
|
||||
import {Injectable} from '@angular/core';
|
||||
import {ActivatedRouteSnapshot, Resolve, RouterStateSnapshot} from '@angular/router';
|
||||
import {Observable} from 'rxjs/internal/Observable';
|
||||
import {AttendanceService} from './attendance.service';
|
||||
import {Attendance} from './attendance';
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
})
|
||||
export class AttendanceResolver implements Resolve<Attendance> {
|
||||
|
||||
constructor(private ser: AttendanceService) {
|
||||
}
|
||||
|
||||
resolve(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): Observable<Attendance> {
|
||||
const date = route.paramMap.get('date');
|
||||
return this.ser.get(date);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,13 @@
|
||||
import {AttendanceRoutingModule} from './attendance-routing.module';
|
||||
|
||||
describe('AttendanceRoutingModule', () => {
|
||||
let attendanceRoutingModule: AttendanceRoutingModule;
|
||||
|
||||
beforeEach(() => {
|
||||
attendanceRoutingModule = new AttendanceRoutingModule();
|
||||
});
|
||||
|
||||
it('should create an instance', () => {
|
||||
expect(attendanceRoutingModule).toBeTruthy();
|
||||
});
|
||||
});
|
||||
52
overlord/src/app/attendance/attendance-routing.module.ts
Normal file
52
overlord/src/app/attendance/attendance-routing.module.ts
Normal file
@ -0,0 +1,52 @@
|
||||
import {NgModule} from '@angular/core';
|
||||
import {CommonModule} from '@angular/common';
|
||||
import {RouterModule, Routes} from '@angular/router';
|
||||
import {AttendanceResolver} from './attendance-resolver.service';
|
||||
import {AuthGuard} from '../auth/auth-guard.service';
|
||||
import {AttendanceComponent} from './attendance.component';
|
||||
import {AttendanceTypeResolver} from './attendance-type-resolver.service';
|
||||
|
||||
const attendanceRoutes: Routes = [
|
||||
{
|
||||
path: 'Attendance',
|
||||
component: AttendanceComponent,
|
||||
canActivate: [AuthGuard],
|
||||
data: {
|
||||
permission: 'Attendance'
|
||||
},
|
||||
resolve: {
|
||||
info: AttendanceResolver,
|
||||
attendanceTypes: AttendanceTypeResolver
|
||||
},
|
||||
runGuardsAndResolvers: 'always'
|
||||
},
|
||||
{
|
||||
path: 'Attendance/:date',
|
||||
component: AttendanceComponent,
|
||||
canActivate: [AuthGuard],
|
||||
data: {
|
||||
permission: 'Attendance'
|
||||
},
|
||||
resolve: {
|
||||
info: AttendanceResolver,
|
||||
attendanceTypes: AttendanceTypeResolver
|
||||
},
|
||||
runGuardsAndResolvers: 'always'
|
||||
}
|
||||
];
|
||||
|
||||
@NgModule({
|
||||
imports: [
|
||||
CommonModule,
|
||||
RouterModule.forChild(attendanceRoutes)
|
||||
|
||||
],
|
||||
exports: [
|
||||
RouterModule
|
||||
],
|
||||
providers: [
|
||||
AttendanceResolver
|
||||
]
|
||||
})
|
||||
export class AttendanceRoutingModule {
|
||||
}
|
||||
@ -0,0 +1,18 @@
|
||||
import {Injectable} from '@angular/core';
|
||||
import {ActivatedRouteSnapshot, Resolve, RouterStateSnapshot} from '@angular/router';
|
||||
import {Observable} from 'rxjs/internal/Observable';
|
||||
import {AttendanceType} from './attendance-type';
|
||||
import {AttendanceTypeService} from './attendance-type.service';
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
})
|
||||
export class AttendanceTypeResolver implements Resolve<AttendanceType[]> {
|
||||
|
||||
constructor(private ser: AttendanceTypeService) {
|
||||
}
|
||||
|
||||
resolve(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): Observable<AttendanceType[]> {
|
||||
return this.ser.list();
|
||||
}
|
||||
}
|
||||
23
overlord/src/app/attendance/attendance-type.service.ts
Normal file
23
overlord/src/app/attendance/attendance-type.service.ts
Normal file
@ -0,0 +1,23 @@
|
||||
import {Injectable} from '@angular/core';
|
||||
import {Observable} from 'rxjs/internal/Observable';
|
||||
import {catchError} from 'rxjs/operators';
|
||||
import {HttpClient} from '@angular/common/http';
|
||||
import {ErrorLoggerService} from '../core/error-logger.service';
|
||||
import {AttendanceType} from './attendance-type';
|
||||
|
||||
const url = '/api/AttendanceTypes';
|
||||
const serviceName = 'AttendanceTypeService';
|
||||
|
||||
@Injectable({providedIn: 'root'})
|
||||
export class AttendanceTypeService {
|
||||
|
||||
constructor(private http: HttpClient, private log: ErrorLoggerService) {
|
||||
}
|
||||
|
||||
list(): Observable<AttendanceType[]> {
|
||||
return <Observable<AttendanceType[]>>this.http.get<AttendanceType[]>(url)
|
||||
.pipe(
|
||||
catchError(this.log.handleError(serviceName, 'list'))
|
||||
);
|
||||
}
|
||||
}
|
||||
9
overlord/src/app/attendance/attendance-type.ts
Normal file
9
overlord/src/app/attendance/attendance-type.ts
Normal file
@ -0,0 +1,9 @@
|
||||
export class AttendanceType {
|
||||
id: number;
|
||||
name: string;
|
||||
value: number;
|
||||
|
||||
public constructor(init?: Partial<AttendanceType>) {
|
||||
Object.assign(this, init);
|
||||
}
|
||||
}
|
||||
53
overlord/src/app/attendance/attendance.component.css
Normal file
53
overlord/src/app/attendance/attendance.component.css
Normal file
@ -0,0 +1,53 @@
|
||||
.right {
|
||||
display: flex;
|
||||
justify-content: flex-end;
|
||||
}
|
||||
|
||||
.center {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.present {
|
||||
background-color: #228B22;
|
||||
}
|
||||
|
||||
.off-day {
|
||||
background-color: #87CEFA;
|
||||
}
|
||||
|
||||
.on-leave {
|
||||
background-color: #CD5C5C;
|
||||
}
|
||||
|
||||
.absent {
|
||||
background-color: #CD0000;
|
||||
}
|
||||
|
||||
.half-day {
|
||||
background-color: #98FB98;
|
||||
}
|
||||
|
||||
.double-duty {
|
||||
background-color: #006400;
|
||||
}
|
||||
|
||||
.paid-leave-availed {
|
||||
background-color: #EEEE00;
|
||||
}
|
||||
|
||||
.casual-leave-availed {
|
||||
background-color: #800080;
|
||||
}
|
||||
|
||||
.compensatory-off {
|
||||
background-color: #F5DEB3;
|
||||
}
|
||||
|
||||
.half-day-pl {
|
||||
background-color: #FFF68F;
|
||||
}
|
||||
|
||||
.half-day-cl {
|
||||
background-color: #FF00FF;
|
||||
}
|
||||
71
overlord/src/app/attendance/attendance.component.html
Normal file
71
overlord/src/app/attendance/attendance.component.html
Normal file
@ -0,0 +1,71 @@
|
||||
<mat-card>
|
||||
<mat-card-title-group>
|
||||
<mat-card-title>Attendance</mat-card-title>
|
||||
</mat-card-title-group>
|
||||
<mat-card-content>
|
||||
<form [formGroup]="form" fxLayout="column">
|
||||
<div fxLayout="row" fxLayout.lt-md="column" fxLayoutGap="20px" fxLayoutGap.lt-md="0px">
|
||||
<mat-form-field fxFlex="80">
|
||||
<input matInput [matDatepicker]="date" (focus)="date.open()" placeholder="Date" formControlName="date"
|
||||
autocomplete="off">
|
||||
<mat-datepicker-toggle matSuffix [for]="date"></mat-datepicker-toggle>
|
||||
<mat-datepicker #date></mat-datepicker>
|
||||
</mat-form-field>
|
||||
<button mat-raised-button color="primary" (click)="show()" fxFlex="20">Show</button>
|
||||
</div>
|
||||
<mat-table #table [dataSource]="dataSource" formArrayName="attendances">
|
||||
|
||||
<!-- Code Column -->
|
||||
<ng-container matColumnDef="code">
|
||||
<mat-header-cell *matHeaderCellDef class="right">Code</mat-header-cell>
|
||||
<mat-cell *matCellDef="let row" class="right">{{row.code}}</mat-cell>
|
||||
</ng-container>
|
||||
|
||||
<!-- Name Column -->
|
||||
<ng-container matColumnDef="name">
|
||||
<mat-header-cell *matHeaderCellDef>Name</mat-header-cell>
|
||||
<mat-cell *matCellDef="let row">{{row.name}}</mat-cell>
|
||||
</ng-container>
|
||||
|
||||
<!-- Designation Column -->
|
||||
<ng-container matColumnDef="designation">
|
||||
<mat-header-cell *matHeaderCellDef>Designation</mat-header-cell>
|
||||
<mat-cell *matCellDef="let row">{{row.designation}}</mat-cell>
|
||||
</ng-container>
|
||||
|
||||
<!-- Department Column -->
|
||||
<ng-container matColumnDef="department">
|
||||
<mat-header-cell *matHeaderCellDef>Department</mat-header-cell>
|
||||
<mat-cell *matCellDef="let row">{{row.department}}</mat-cell>
|
||||
</ng-container>
|
||||
|
||||
<!-- Status Column -->
|
||||
<ng-container matColumnDef="status">
|
||||
<mat-header-cell *matHeaderCellDef>Status</mat-header-cell>
|
||||
<mat-cell *matCellDef="let row; let i = index" [formGroupName]="i" fxFlex>
|
||||
<mat-select formControlName="attendanceType" name="attendanceType">
|
||||
<mat-option *ngFor="let at of attendanceTypes" [value]="at.id">
|
||||
{{ at.name }}
|
||||
</mat-option>
|
||||
</mat-select>
|
||||
</mat-cell>
|
||||
</ng-container>
|
||||
|
||||
<!-- Prints Column -->
|
||||
<ng-container matColumnDef="prints">
|
||||
<mat-header-cell *matHeaderCellDef>Prints</mat-header-cell>
|
||||
<mat-cell *matCellDef="let row; let i = index">
|
||||
{{row.prints}}
|
||||
<mat-icon *ngIf="!form.controls.attendances.controls[i].pristine">new_releases</mat-icon>
|
||||
</mat-cell>
|
||||
</ng-container>
|
||||
|
||||
<mat-header-row *matHeaderRowDef="displayedColumns"></mat-header-row>
|
||||
<mat-row *matRowDef="let row; let i = index; columns: displayedColumns;" [class]="getClass(i)"></mat-row>
|
||||
</mat-table>
|
||||
</form>
|
||||
</mat-card-content>
|
||||
<mat-card-actions>
|
||||
<button mat-raised-button color="primary" (click)="save()" [disabled]="form.pristine">Save</button>
|
||||
</mat-card-actions>
|
||||
</mat-card>
|
||||
25
overlord/src/app/attendance/attendance.component.spec.ts
Normal file
25
overlord/src/app/attendance/attendance.component.spec.ts
Normal file
@ -0,0 +1,25 @@
|
||||
import {async, ComponentFixture, TestBed} from '@angular/core/testing';
|
||||
|
||||
import {AttendanceComponent} from './attendance.component';
|
||||
|
||||
describe('AttendanceComponent', () => {
|
||||
let component: AttendanceComponent;
|
||||
let fixture: ComponentFixture<AttendanceComponent>;
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [AttendanceComponent]
|
||||
})
|
||||
.compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(AttendanceComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
||||
99
overlord/src/app/attendance/attendance.component.ts
Normal file
99
overlord/src/app/attendance/attendance.component.ts
Normal file
@ -0,0 +1,99 @@
|
||||
import {Component, OnInit} from '@angular/core';
|
||||
import {FormArray, FormBuilder, FormGroup} from '@angular/forms';
|
||||
import {MatDialog} from '@angular/material';
|
||||
import {ActivatedRoute, Router} from '@angular/router';
|
||||
import {BehaviorSubject} from 'rxjs';
|
||||
import {AttendanceDataSource} from './attendance-datasource';
|
||||
import * as moment from 'moment';
|
||||
import {AuthService} from '../auth/auth.service';
|
||||
import {ToasterService} from '../core/toaster.service';
|
||||
import {AttendanceService} from './attendance.service';
|
||||
import {AttendanceType} from './attendance-type';
|
||||
import {Attendance, AttendanceItem} from './attendance';
|
||||
|
||||
@Component({
|
||||
selector: 'app-attendance',
|
||||
templateUrl: './attendance.component.html',
|
||||
styleUrls: ['./attendance.component.css']
|
||||
})
|
||||
export class AttendanceComponent implements OnInit {
|
||||
public attendanceObservable = new BehaviorSubject<AttendanceItem[]>([]);
|
||||
dataSource: AttendanceDataSource;
|
||||
form: FormGroup;
|
||||
|
||||
info: Attendance;
|
||||
attendanceTypes: AttendanceType[];
|
||||
|
||||
displayedColumns = ['code', 'name', 'designation', 'department', 'status', 'prints'];
|
||||
|
||||
constructor(
|
||||
private route: ActivatedRoute,
|
||||
private router: Router,
|
||||
private fb: FormBuilder,
|
||||
private dialog: MatDialog,
|
||||
private toaster: ToasterService,
|
||||
private auth: AuthService,
|
||||
private ser: AttendanceService
|
||||
) {
|
||||
this.createForm();
|
||||
}
|
||||
|
||||
createForm() {
|
||||
this.form = this.fb.group({
|
||||
date: '',
|
||||
attendances: this.fb.array([])
|
||||
});
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
this.route.data
|
||||
.subscribe((data: { info: Attendance, attendanceTypes: AttendanceType[] }) => {
|
||||
this.info = data.info;
|
||||
this.attendanceTypes = data.attendanceTypes;
|
||||
this.form.get('date').setValue(moment(this.info.date, 'DD-MMM-YYYY').toDate());
|
||||
this.form.setControl('attendances', this.fb.array(
|
||||
this.info.body.map(
|
||||
x => this.fb.group({
|
||||
attendanceType: x.attendanceType.id
|
||||
})
|
||||
)
|
||||
));
|
||||
this.dataSource = new AttendanceDataSource(this.attendanceObservable);
|
||||
this.attendanceObservable.next(this.info.body);
|
||||
});
|
||||
}
|
||||
|
||||
getClass(index: number) {
|
||||
const array = this.form.get('attendances') as FormArray;
|
||||
const id = array.controls[index].value.attendanceType;
|
||||
const name: string = this.attendanceTypes.filter(x => x.id === id)[0].name;
|
||||
return name.toLowerCase().replace(/(\s+\+\s+)|(\s+)/g, '-');
|
||||
}
|
||||
|
||||
show() {
|
||||
const date = moment(this.form.value.date).format('DD-MMM-YYYY');
|
||||
this.router.navigate(['/Attendance', date]);
|
||||
}
|
||||
|
||||
save() {
|
||||
this.ser.save(this.getAttendance())
|
||||
.subscribe(
|
||||
(result) => {
|
||||
this.toaster.show('Success', '');
|
||||
},
|
||||
(error) => {
|
||||
this.toaster.show('Danger', error.error);
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
getAttendance(): Attendance {
|
||||
const formModel = this.form.value;
|
||||
this.info.date = moment(formModel.date).format('DD-MMM-YYYY');
|
||||
const array = this.form.get('attendances') as FormArray;
|
||||
this.info.body.forEach((item, index) => {
|
||||
item.attendanceType.id = array.controls[index].value.attendanceType;
|
||||
});
|
||||
return this.info;
|
||||
}
|
||||
}
|
||||
13
overlord/src/app/attendance/attendance.module.spec.ts
Normal file
13
overlord/src/app/attendance/attendance.module.spec.ts
Normal file
@ -0,0 +1,13 @@
|
||||
import {AttendanceModule} from './attendance.module';
|
||||
|
||||
describe('AttendanceModule', () => {
|
||||
let attendanceModule: AttendanceModule;
|
||||
|
||||
beforeEach(() => {
|
||||
attendanceModule = new AttendanceModule();
|
||||
});
|
||||
|
||||
it('should create an instance', () => {
|
||||
expect(attendanceModule).toBeTruthy();
|
||||
});
|
||||
});
|
||||
79
overlord/src/app/attendance/attendance.module.ts
Normal file
79
overlord/src/app/attendance/attendance.module.ts
Normal file
@ -0,0 +1,79 @@
|
||||
import {NgModule} from '@angular/core';
|
||||
import {CommonModule} from '@angular/common';
|
||||
import {
|
||||
DateAdapter,
|
||||
MAT_DATE_FORMATS,
|
||||
MAT_DATE_LOCALE,
|
||||
MatAutocompleteModule,
|
||||
MatButtonModule,
|
||||
MatCardModule,
|
||||
MatCheckboxModule,
|
||||
MatDatepickerModule,
|
||||
MatDialogModule,
|
||||
MatFormFieldModule,
|
||||
MatIconModule,
|
||||
MatInputModule,
|
||||
MatNativeDateModule,
|
||||
MatPaginatorModule,
|
||||
MatProgressSpinnerModule,
|
||||
MatSelectModule,
|
||||
MatSortModule,
|
||||
MatTableModule
|
||||
} from '@angular/material';
|
||||
import {SharedModule} from '../shared/shared.module';
|
||||
import {ReactiveFormsModule} from '@angular/forms';
|
||||
import {CdkTableModule} from '@angular/cdk/table';
|
||||
import {AttendanceRoutingModule} from './attendance-routing.module';
|
||||
import {AttendanceComponent} from './attendance.component';
|
||||
import {MomentDateAdapter} from '@angular/material-moment-adapter';
|
||||
import {A11yModule} from '@angular/cdk/a11y';
|
||||
import {FlexLayoutModule, FlexModule} from '@angular/flex-layout';
|
||||
|
||||
export const MY_FORMATS = {
|
||||
parse: {
|
||||
dateInput: 'DD-MMM-YYYY',
|
||||
},
|
||||
display: {
|
||||
dateInput: 'DD-MMM-YYYY',
|
||||
monthYearLabel: 'MMM YYYY',
|
||||
dateA11yLabel: 'DD-MMM-YYYY',
|
||||
monthYearA11yLabel: 'MMM YYYY',
|
||||
},
|
||||
};
|
||||
|
||||
@NgModule({
|
||||
imports: [
|
||||
A11yModule,
|
||||
CommonModule,
|
||||
CdkTableModule,
|
||||
FlexModule,
|
||||
FlexLayoutModule,
|
||||
MatAutocompleteModule,
|
||||
MatButtonModule,
|
||||
MatCardModule,
|
||||
MatCheckboxModule,
|
||||
MatDatepickerModule,
|
||||
MatDialogModule,
|
||||
MatFormFieldModule,
|
||||
MatIconModule,
|
||||
MatInputModule,
|
||||
MatNativeDateModule,
|
||||
MatPaginatorModule,
|
||||
MatProgressSpinnerModule,
|
||||
MatSelectModule,
|
||||
MatSortModule,
|
||||
MatTableModule,
|
||||
ReactiveFormsModule,
|
||||
SharedModule,
|
||||
AttendanceRoutingModule
|
||||
],
|
||||
declarations: [
|
||||
AttendanceComponent
|
||||
],
|
||||
providers: [
|
||||
{provide: DateAdapter, useClass: MomentDateAdapter, deps: [MAT_DATE_LOCALE]},
|
||||
{provide: MAT_DATE_FORMATS, useValue: MY_FORMATS},
|
||||
]
|
||||
})
|
||||
export class AttendanceModule {
|
||||
}
|
||||
15
overlord/src/app/attendance/attendance.service.spec.ts
Normal file
15
overlord/src/app/attendance/attendance.service.spec.ts
Normal file
@ -0,0 +1,15 @@
|
||||
import {inject, TestBed} from '@angular/core/testing';
|
||||
|
||||
import {VoucherService} from './attendance.service';
|
||||
|
||||
describe('AttendanceService', () => {
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({
|
||||
providers: [VoucherService]
|
||||
});
|
||||
});
|
||||
|
||||
it('should be created', inject([VoucherService], (service: VoucherService) => {
|
||||
expect(service).toBeTruthy();
|
||||
}));
|
||||
});
|
||||
35
overlord/src/app/attendance/attendance.service.ts
Normal file
35
overlord/src/app/attendance/attendance.service.ts
Normal file
@ -0,0 +1,35 @@
|
||||
import {Injectable} from '@angular/core';
|
||||
import {Observable} from 'rxjs/internal/Observable';
|
||||
import {catchError} from 'rxjs/operators';
|
||||
import {HttpClient, HttpHeaders, HttpParams} from '@angular/common/http';
|
||||
import {Attendance} from './attendance';
|
||||
import {ErrorLoggerService} from '../core/error-logger.service';
|
||||
|
||||
const httpOptions = {
|
||||
headers: new HttpHeaders({'Content-Type': 'application/json'})
|
||||
};
|
||||
|
||||
const url = '/api/Attendance';
|
||||
const serviceName = 'AttendanceService';
|
||||
|
||||
@Injectable({providedIn: 'root'})
|
||||
export class AttendanceService {
|
||||
|
||||
constructor(private http: HttpClient, private log: ErrorLoggerService) {
|
||||
}
|
||||
|
||||
get(date: string): Observable<Attendance> {
|
||||
const getUrl: string = (date === null) ? url : `${url}/${date}`;
|
||||
return <Observable<Attendance>>this.http.get<Attendance>(getUrl)
|
||||
.pipe(
|
||||
catchError(this.log.handleError(serviceName, `get date=${date}`))
|
||||
);
|
||||
}
|
||||
|
||||
save(attendance: Attendance): Observable<Attendance> {
|
||||
return <Observable<Attendance>>this.http.post<Attendance>(`${url}/${attendance.date}`, attendance, httpOptions)
|
||||
.pipe(
|
||||
catchError(this.log.handleError(serviceName, 'save'))
|
||||
);
|
||||
}
|
||||
}
|
||||
26
overlord/src/app/attendance/attendance.ts
Normal file
26
overlord/src/app/attendance/attendance.ts
Normal file
@ -0,0 +1,26 @@
|
||||
import {AttendanceType} from './attendance-type';
|
||||
|
||||
export class Attendance {
|
||||
date: string;
|
||||
body: AttendanceItem[];
|
||||
|
||||
public constructor(init?: Partial<Attendance>) {
|
||||
Object.assign(this, init);
|
||||
}
|
||||
}
|
||||
|
||||
export class AttendanceItem {
|
||||
id: string;
|
||||
code: number;
|
||||
name: string;
|
||||
designation: string;
|
||||
department: string;
|
||||
attendanceType: AttendanceType;
|
||||
prints: string;
|
||||
hours: string;
|
||||
worked: string;
|
||||
|
||||
public constructor(init?: Partial<AttendanceItem>) {
|
||||
Object.assign(this, init);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user