Chore: Reformatted everthing
Fix: Product ledger was not totalling. This is because for some reason, pydantic was sending the data as string when the field was nullable
This commit is contained in:
@@ -13,8 +13,7 @@ const employeeEmployeeAttendanceRoutes: Routes = [
|
||||
path: '',
|
||||
component: EmployeeAttendanceComponent,
|
||||
canActivate: [
|
||||
(route: ActivatedRouteSnapshot, state: RouterStateSnapshot) =>
|
||||
inject(AuthGuard).canActivate(route, state),
|
||||
(route: ActivatedRouteSnapshot, state: RouterStateSnapshot) => inject(AuthGuard).canActivate(route, state),
|
||||
],
|
||||
data: {
|
||||
permission: 'Attendance',
|
||||
@@ -29,8 +28,7 @@ const employeeEmployeeAttendanceRoutes: Routes = [
|
||||
path: ':id',
|
||||
component: EmployeeAttendanceComponent,
|
||||
canActivate: [
|
||||
(route: ActivatedRouteSnapshot, state: RouterStateSnapshot) =>
|
||||
inject(AuthGuard).canActivate(route, state),
|
||||
(route: ActivatedRouteSnapshot, state: RouterStateSnapshot) => inject(AuthGuard).canActivate(route, state),
|
||||
],
|
||||
data: {
|
||||
permission: 'Attendance',
|
||||
|
||||
@@ -47,14 +47,10 @@
|
||||
[displayWith]="displayFn"
|
||||
(optionSelected)="selected($event)"
|
||||
>
|
||||
<mat-option *ngFor="let employee of employees | async" [value]="employee">{{
|
||||
employee.name
|
||||
}}</mat-option>
|
||||
<mat-option *ngFor="let employee of employees | async" [value]="employee">{{ employee.name }}</mat-option>
|
||||
</mat-autocomplete>
|
||||
</mat-form-field>
|
||||
<button mat-raised-button class="flex-auto basis-1/5" color="primary" (click)="show()">
|
||||
Show
|
||||
</button>
|
||||
<button mat-raised-button class="flex-auto basis-1/5" color="primary" (click)="show()">Show</button>
|
||||
</div>
|
||||
<mat-table #table [dataSource]="dataSource" formArrayName="attendances">
|
||||
<!-- Date Column -->
|
||||
@@ -80,9 +76,7 @@
|
||||
<mat-header-cell *matHeaderCellDef>Prints</mat-header-cell>
|
||||
<mat-cell *matCellDef="let row; let i = index" class="no-bg">
|
||||
{{ row.prints }}
|
||||
<mat-icon
|
||||
class="no-bg"
|
||||
*ngIf="!form.controls.attendances.controls[i].controls.attendanceType.pristine"
|
||||
<mat-icon class="no-bg" *ngIf="!form.controls.attendances.controls[i].controls.attendanceType.pristine"
|
||||
>new_releases</mat-icon
|
||||
>
|
||||
<mat-chip-set class="no-bg">
|
||||
@@ -100,16 +94,11 @@
|
||||
</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-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>
|
||||
<button mat-raised-button color="primary" (click)="save()" [disabled]="form.pristine">Save</button>
|
||||
</mat-card-actions>
|
||||
</mat-card>
|
||||
|
||||
@@ -26,9 +26,7 @@ import { EmployeeAttendanceService } from './employee-attendance.service';
|
||||
export class EmployeeAttendanceComponent implements OnInit, AfterViewInit {
|
||||
@ViewChild('employeeElement', { static: true }) employeeElement?: ElementRef;
|
||||
public employeeAttendanceObservable = new BehaviorSubject<EmployeeAttendanceItem[]>([]);
|
||||
dataSource: EmployeeAttendanceDataSource = new EmployeeAttendanceDataSource(
|
||||
this.employeeAttendanceObservable,
|
||||
);
|
||||
dataSource: EmployeeAttendanceDataSource = new EmployeeAttendanceDataSource(this.employeeAttendanceObservable);
|
||||
|
||||
form: FormGroup<{
|
||||
startDate: FormControl<Date>;
|
||||
|
||||
@@ -8,12 +8,7 @@ import { MatButtonModule } from '@angular/material/button';
|
||||
import { MatCardModule } from '@angular/material/card';
|
||||
import { MatCheckboxModule } from '@angular/material/checkbox';
|
||||
import { MatChipsModule } from '@angular/material/chips';
|
||||
import {
|
||||
DateAdapter,
|
||||
MAT_DATE_FORMATS,
|
||||
MAT_DATE_LOCALE,
|
||||
MatNativeDateModule,
|
||||
} from '@angular/material/core';
|
||||
import { DateAdapter, MAT_DATE_FORMATS, MAT_DATE_LOCALE, MatNativeDateModule } from '@angular/material/core';
|
||||
import { MatDatepickerModule } from '@angular/material/datepicker';
|
||||
import { MatDialogModule } from '@angular/material/dialog';
|
||||
import { MatFormFieldModule } from '@angular/material/form-field';
|
||||
|
||||
@@ -17,11 +17,7 @@ export class EmployeeAttendanceService {
|
||||
private log: ErrorLoggerService,
|
||||
) {}
|
||||
|
||||
get(
|
||||
id: string | null,
|
||||
startDate: string | null,
|
||||
finishDate: string | null,
|
||||
): Observable<EmployeeAttendance> {
|
||||
get(id: string | null, startDate: string | null, finishDate: string | null): Observable<EmployeeAttendance> {
|
||||
const getUrl: string = id === null ? url : `${url}/${id}`;
|
||||
const options = { params: new HttpParams() };
|
||||
if (startDate !== null) {
|
||||
@@ -32,9 +28,7 @@ export class EmployeeAttendanceService {
|
||||
}
|
||||
return this.http
|
||||
.get<EmployeeAttendance>(getUrl, options)
|
||||
.pipe(
|
||||
catchError(this.log.handleError(serviceName, `get id=${id}`)),
|
||||
) as Observable<EmployeeAttendance>;
|
||||
.pipe(catchError(this.log.handleError(serviceName, `get id=${id}`))) as Observable<EmployeeAttendance>;
|
||||
}
|
||||
|
||||
save(employeeAttendance: EmployeeAttendance): Observable<EmployeeAttendance> {
|
||||
@@ -44,8 +38,6 @@ export class EmployeeAttendanceService {
|
||||
const { id } = employeeAttendance.employee;
|
||||
return this.http
|
||||
.post<EmployeeAttendance>(`${url}/${id}`, employeeAttendance)
|
||||
.pipe(
|
||||
catchError(this.log.handleError(serviceName, 'save')),
|
||||
) as Observable<EmployeeAttendance>;
|
||||
.pipe(catchError(this.log.handleError(serviceName, 'save'))) as Observable<EmployeeAttendance>;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user