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:
@ -8,8 +8,7 @@ import { map } from 'rxjs/operators';
|
||||
import { LedgerItem } from './ledger-item';
|
||||
|
||||
/** Simple sort comparator for example ID/Name columns (for client-side sorting). */
|
||||
const compare = (a: string | number, b: string | number, isAsc: boolean) =>
|
||||
(a < b ? -1 : 1) * (isAsc ? 1 : -1);
|
||||
const compare = (a: string | number, b: string | number, isAsc: boolean) => (a < b ? -1 : 1) * (isAsc ? 1 : -1);
|
||||
export class LedgerDataSource extends DataSource<LedgerItem> {
|
||||
constructor(
|
||||
public data: LedgerItem[],
|
||||
|
||||
@ -12,8 +12,7 @@ const ledgerRoutes: Routes = [
|
||||
path: '',
|
||||
component: LedgerComponent,
|
||||
canActivate: [
|
||||
(route: ActivatedRouteSnapshot, state: RouterStateSnapshot) =>
|
||||
inject(AuthGuard).canActivate(route, state),
|
||||
(route: ActivatedRouteSnapshot, state: RouterStateSnapshot) => inject(AuthGuard).canActivate(route, state),
|
||||
],
|
||||
data: {
|
||||
permission: 'Ledger',
|
||||
@ -27,8 +26,7 @@ const ledgerRoutes: Routes = [
|
||||
path: ':id',
|
||||
component: LedgerComponent,
|
||||
canActivate: [
|
||||
(route: ActivatedRouteSnapshot, state: RouterStateSnapshot) =>
|
||||
inject(AuthGuard).canActivate(route, state),
|
||||
(route: ActivatedRouteSnapshot, state: RouterStateSnapshot) => inject(AuthGuard).canActivate(route, state),
|
||||
],
|
||||
data: {
|
||||
permission: 'Ledger',
|
||||
|
||||
@ -52,14 +52,10 @@
|
||||
[displayWith]="displayFn"
|
||||
(optionSelected)="selected($event)"
|
||||
>
|
||||
<mat-option *ngFor="let account of accounts | async" [value]="account">{{
|
||||
account.name
|
||||
}}</mat-option>
|
||||
<mat-option *ngFor="let account of accounts | async" [value]="account">{{ account.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>
|
||||
</form>
|
||||
<mat-table #table [dataSource]="dataSource" matSort aria-label="Elements">
|
||||
@ -96,34 +92,22 @@
|
||||
<!-- Debit Column -->
|
||||
<ng-container matColumnDef="debit">
|
||||
<mat-header-cell *matHeaderCellDef mat-sort-header class="right">Debit</mat-header-cell>
|
||||
<mat-cell *matCellDef="let row" class="right">{{
|
||||
row.debit | currency: 'INR' | clear
|
||||
}}</mat-cell>
|
||||
<mat-footer-cell *matFooterCellDef class="right">{{
|
||||
debit | currency: 'INR'
|
||||
}}</mat-footer-cell>
|
||||
<mat-cell *matCellDef="let row" class="right">{{ row.debit | currency: 'INR' | clear }}</mat-cell>
|
||||
<mat-footer-cell *matFooterCellDef class="right">{{ debit | currency: 'INR' }}</mat-footer-cell>
|
||||
</ng-container>
|
||||
|
||||
<!-- Credit Column -->
|
||||
<ng-container matColumnDef="credit">
|
||||
<mat-header-cell *matHeaderCellDef mat-sort-header class="right">Credit</mat-header-cell>
|
||||
<mat-cell *matCellDef="let row" class="right">{{
|
||||
row.credit | currency: 'INR' | clear
|
||||
}}</mat-cell>
|
||||
<mat-footer-cell *matFooterCellDef class="right">{{
|
||||
credit | currency: 'INR'
|
||||
}}</mat-footer-cell>
|
||||
<mat-cell *matCellDef="let row" class="right">{{ row.credit | currency: 'INR' | clear }}</mat-cell>
|
||||
<mat-footer-cell *matFooterCellDef class="right">{{ credit | currency: 'INR' }}</mat-footer-cell>
|
||||
</ng-container>
|
||||
|
||||
<!-- Running Column -->
|
||||
<ng-container matColumnDef="running">
|
||||
<mat-header-cell *matHeaderCellDef mat-sort-header class="right">Running</mat-header-cell>
|
||||
<mat-cell *matCellDef="let row" class="right">{{
|
||||
row.running | currency: 'INR' | accounting
|
||||
}}</mat-cell>
|
||||
<mat-footer-cell *matFooterCellDef class="right">{{
|
||||
running | currency: 'INR' | accounting
|
||||
}}</mat-footer-cell>
|
||||
<mat-cell *matCellDef="let row" class="right">{{ row.running | currency: 'INR' | accounting }}</mat-cell>
|
||||
<mat-footer-cell *matFooterCellDef class="right">{{ running | currency: 'INR' | accounting }}</mat-footer-cell>
|
||||
</ng-container>
|
||||
|
||||
<mat-header-row *matHeaderRowDef="displayedColumns"></mat-header-row>
|
||||
|
||||
@ -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 { MatFormFieldModule } from '@angular/material/form-field';
|
||||
import { MatIconModule } from '@angular/material/icon';
|
||||
|
||||
Reference in New Issue
Block a user