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:
tanshu committed 2023-08-04 21:00:26 +05:30
1 parent af27bf74ef
commit ac868257b7
194 files changed
+513 -1580

No files matched your search

@@ -15,8 +15,7 @@ const settingsRoutes: Routes = [
path: '',
component: SettingsComponent,
canActivate: [
(route: ActivatedRouteSnapshot, state: RouterStateSnapshot) =>
inject(AuthGuard).canActivate(route, state),
(route: ActivatedRouteSnapshot, state: RouterStateSnapshot) => inject(AuthGuard).canActivate(route, state),
],
data: {
permission: 'Maintenance', // 'Lock Date'
@@ -4,24 +4,13 @@
<mat-card-content>
<form [formGroup]="lockInfoForm" class="flex flex-col">
<div class="flex flex-row justify-around content-start items-start sm:max-lg:flex-col">
<mat-checkbox formControlName="lockOlder" class="flex-auto basis-1/5 mr-5"
>Lock Older</mat-checkbox
>
<mat-checkbox
formControlName="olderRolling"
*ngIf="lockOlder"
class="flex-auto basis-1/5 mr-5"
>
<mat-checkbox formControlName="lockOlder" class="flex-auto basis-1/5 mr-5">Lock Older</mat-checkbox>
<mat-checkbox formControlName="olderRolling" *ngIf="lockOlder" class="flex-auto basis-1/5 mr-5">
Is Rolling
</mat-checkbox>
<mat-form-field class="flex-auto basis-3/5" *ngIf="lockOlder && !olderRolling">
<mat-label>Date</mat-label>
<input
matInput
[matDatepicker]="olderDate"
formControlName="olderDate"
autocomplete="off"
/>
<input matInput [matDatepicker]="olderDate" formControlName="olderDate" autocomplete="off" />
<mat-datepicker-toggle matSuffix [for]="olderDate"></mat-datepicker-toggle>
<mat-datepicker #olderDate></mat-datepicker>
</mat-form-field>
@@ -31,14 +20,8 @@
</mat-form-field>
</div>
<div class="flex flex-row justify-around content-start items-start sm:max-lg:flex-col">
<mat-checkbox formControlName="lockNewer" class="flex-auto basis-1/5 mr-5"
>Lock Newer</mat-checkbox
>
<mat-checkbox
formControlName="newerRolling"
*ngIf="lockNewer"
class="flex-auto basis-1/5 mr-5"
>
<mat-checkbox formControlName="lockNewer" class="flex-auto basis-1/5 mr-5">Lock Newer</mat-checkbox>
<mat-checkbox formControlName="newerRolling" *ngIf="lockNewer" class="flex-auto basis-1/5 mr-5">
Is Rolling
</mat-checkbox>
<mat-form-field class="flex-auto basis-3/5" *ngIf="lockNewer && !newerRolling">
@@ -64,9 +47,7 @@
[formGroupName]="i"
class="flex flex-row justify-around content-start items-start"
>
<mat-checkbox formControlName="accountType" class="flex-auto">{{
at.name
}}</mat-checkbox>
<mat-checkbox formControlName="accountType" class="flex-auto">{{ at.name }}</mat-checkbox>
</div>
</div>
<div formArrayName="voucherTypes">
@@ -76,32 +57,20 @@
[formGroupName]="j"
class="flex flex-row justify-around content-start items-start"
>
<mat-checkbox formControlName="voucherType" class="flex-auto">{{
vt.name
}}</mat-checkbox>
<mat-checkbox formControlName="voucherType" class="flex-auto">{{ vt.name }}</mat-checkbox>
</div>
</div>
</div>
<div class="flex flex-row justify-around content-start items-start sm:max-lg:flex-col">
<mat-form-field class="flex-auto basis-3/10 mr-5">
<mat-label>Valid From</mat-label>
<input
matInput
[matDatepicker]="validFrom"
formControlName="validFrom"
autocomplete="off"
/>
<input matInput [matDatepicker]="validFrom" formControlName="validFrom" autocomplete="off" />
<mat-datepicker-toggle matSuffix [for]="validFrom"></mat-datepicker-toggle>
<mat-datepicker #validFrom></mat-datepicker>
</mat-form-field>
<mat-form-field class="flex-auto basis-3/10 mr-5">
<mat-label>Valid Till</mat-label>
<input
matInput
[matDatepicker]="validTill"
formControlName="validTill"
autocomplete="off"
/>
<input matInput [matDatepicker]="validTill" formControlName="validTill" autocomplete="off" />
<mat-datepicker-toggle matSuffix [for]="validTill"></mat-datepicker-toggle>
<mat-datepicker #validTill></mat-datepicker>
</mat-form-field>
@@ -109,14 +78,7 @@
<mat-label>Index</mat-label>
<input type="text" matInput formControlName="index" autocomplete="off" />
</mat-form-field>
<button
mat-raised-button
color="primary"
(click)="saveLock()"
class="flex-auto basis-1/5"
>
Add
</button>
<button mat-raised-button color="primary" (click)="saveLock()" class="flex-auto basis-1/5">Add</button>
</div>
<mat-table #table [dataSource]="dataSource" matSort aria-label="Elements">
<!-- Index Column -->
@@ -158,11 +120,9 @@
<ng-container matColumnDef="lock">
<mat-header-cell *matHeaderCellDef>Lock Dates</mat-header-cell>
<mat-cell *matCellDef="let row"
>{{ !!row.start.days ? row.start.days : ''
}}{{ !!row.start.date ? row.start.date : ''
>{{ !!row.start.days ? row.start.days : '' }}{{ !!row.start.date ? row.start.date : ''
}}{{ !row.start.days && !row.start.date ? '\u221E' : '' }} -
{{ !!row.finish.days ? row.finish.days : ''
}}{{ !!row.finish.date ? row.finish.date : ''
{{ !!row.finish.days ? row.finish.days : '' }}{{ !!row.finish.date ? row.finish.date : ''
}}{{ !row.finish.days && !row.finish.date ? '\u221E' : '' }}</mat-cell
>
</ng-container>
@@ -202,12 +162,7 @@
<mat-datepicker #rebaseDataDate></mat-datepicker>
</mat-form-field>
<button
mat-raised-button
color="primary"
(click)="confirmRebase()"
class="flex-auto basis-1/5"
>
<button mat-raised-button color="primary" (click)="confirmRebase()" class="flex-auto basis-1/5">
Rebase
</button>
</div>
@@ -219,8 +174,7 @@
<mat-card>
<mat-card-content>
<mat-card-subtitle *ngIf="maintenance.enabled">
Maintenance mode is <strong>ENABLED</strong> by user
<strong>{{ maintenance.user }}</strong
Maintenance mode is <strong>ENABLED</strong> by user <strong>{{ maintenance.user }}</strong
>.
</mat-card-subtitle>
<mat-card-subtitle *ngIf="!maintenance.enabled">
+1 -6
View File
@@ -7,12 +7,7 @@ import { MatAutocompleteModule } from '@angular/material/autocomplete';
import { MatButtonModule } from '@angular/material/button';
import { MatCardModule } from '@angular/material/card';
import { MatCheckboxModule } from '@angular/material/checkbox';
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';
+4 -12
View File
@@ -20,36 +20,28 @@ export class SettingsService {
const url = '/api/lock-information';
return this.http
.get<[LockInfo]>(url)
.pipe(catchError(this.log.handleError(serviceName, 'getLockInformation'))) as Observable<
[LockInfo]
>;
.pipe(catchError(this.log.handleError(serviceName, 'getLockInformation'))) as Observable<[LockInfo]>;
}
setLockInformation(lockInformation: LockInfo): Observable<LockInfo[]> {
const url = '/api/lock-information';
return this.http
.post<LockInfo[]>(url, lockInformation)
.pipe(catchError(this.log.handleError(serviceName, 'setLockInformation'))) as Observable<
LockInfo[]
>;
.pipe(catchError(this.log.handleError(serviceName, 'setLockInformation'))) as Observable<LockInfo[]>;
}
deleteLockInformation(id: string): Observable<LockInfo[]> {
const url = '/api/lock-information';
return this.http
.delete<LockInfo[]>(`${url}/${id}`)
.pipe(catchError(this.log.handleError(serviceName, 'deleteLockInformation'))) as Observable<
LockInfo[]
>;
.pipe(catchError(this.log.handleError(serviceName, 'deleteLockInformation'))) as Observable<LockInfo[]>;
}
rebaseDatabase(date: string): Observable<Record<string, never>> {
const url = '/api/rebase';
return this.http
.post<Record<string, never>>(`${url}/${date}`, {})
.pipe(catchError(this.log.handleError(serviceName, 'rebaseDatabase'))) as Observable<
Record<string, never>
>;
.pipe(catchError(this.log.handleError(serviceName, 'rebaseDatabase'))) as Observable<Record<string, never>>;
}
setMaintenance(enable: boolean): Observable<{ enabled: boolean; user: string }> {
@@ -19,8 +19,8 @@ export class VoucherTypeService {
) {}
list(): Observable<AccountType[]> {
return this.http
.get<AccountType[]>(url)
.pipe(catchError(this.log.handleError(serviceName, 'list'))) as Observable<AccountType[]>;
return this.http.get<AccountType[]>(url).pipe(catchError(this.log.handleError(serviceName, 'list'))) as Observable<
AccountType[]
>;
}
}