Chore: Upgrade to Angular v18

Chore: Upgrade to Python 3.12
Chore: Upgrade to psycopg3
This commit is contained in:
2024-06-03 13:22:56 +05:30
parent 56c1be5e05
commit 010e9a84db
573 changed files with 5727 additions and 6528 deletions

View File

@ -1,43 +1,45 @@
<h2 mat-dialog-title>Receive Payment</h2>
<mat-dialog-content>
<form [formGroup]="form" class="flex flex-col">
<mat-table #table [dataSource]="dataSource" formArrayName="amounts" *ngIf="this.displayTable">
<!-- Name Column -->
<ng-container matColumnDef="name">
<mat-header-cell *matHeaderCellDef class="bold">Amount</mat-header-cell>
<mat-cell *matCellDef="let row; let i = index" (click)="maxAmount(row, i)">{{ row.name }}</mat-cell>
<mat-footer-cell *matFooterCellDef class="bold">Balance</mat-footer-cell>
</ng-container>
<!-- Discount Column -->
<ng-container matColumnDef="amount">
<mat-header-cell *matHeaderCellDef class="center bold" class="flex-auto">{{
amount | currency: 'INR'
}}</mat-header-cell>
<mat-cell *matCellDef="let row; let i = index" class="center" [formGroupName]="i" class="flex-auto">
<mat-form-field>
<input matInput type="number" formControlName="amount" autocomplete="off" />
</mat-form-field>
</mat-cell>
<mat-footer-cell *matFooterCellDef class="bold">{{ balance | currency: 'INR' }}</mat-footer-cell>
</ng-container>
<mat-header-row *matHeaderRowDef="displayedColumns"></mat-header-row>
<mat-row *matRowDef="let row; columns: displayedColumns"></mat-row>
<mat-footer-row *matFooterRowDef="displayedColumns"></mat-footer-row>
</mat-table>
<mat-form-field class="flex-auto" *ngIf="this.displayReason">
<mat-label>Reason</mat-label>
<input
type="text"
matInput
#son
formControlName="son"
autocomplete="off"
(focus)="select(son.value) && son.select()"
(input)="select(son.value)"
/>
</mat-form-field>
@if (this.displayTable) {
<mat-table #table [dataSource]="dataSource" formArrayName="amounts">
<!-- Name Column -->
<ng-container matColumnDef="name">
<mat-header-cell *matHeaderCellDef class="bold">Amount</mat-header-cell>
<mat-cell *matCellDef="let row; let i = index" (click)="maxAmount(row, i)">{{ row.name }}</mat-cell>
<mat-footer-cell *matFooterCellDef class="bold">Balance</mat-footer-cell>
</ng-container>
<!-- Discount Column -->
<ng-container matColumnDef="amount">
<mat-header-cell *matHeaderCellDef class="center bold" class="flex-auto">{{
amount | currency: 'INR'
}}</mat-header-cell>
<mat-cell *matCellDef="let row; let i = index" class="center" [formGroupName]="i" class="flex-auto">
<mat-form-field>
<input matInput type="number" formControlName="amount" autocomplete="off" />
</mat-form-field>
</mat-cell>
<mat-footer-cell *matFooterCellDef class="bold">{{ balance | currency: 'INR' }}</mat-footer-cell>
</ng-container>
<mat-header-row *matHeaderRowDef="displayedColumns"></mat-header-row>
<mat-row *matRowDef="let row; columns: displayedColumns"></mat-row>
<mat-footer-row *matFooterRowDef="displayedColumns"></mat-footer-row>
</mat-table>
}
@if (this.displayReason) {
<mat-form-field class="flex-auto">
<mat-label>Reason</mat-label>
<input
type="text"
matInput
#son
formControlName="son"
autocomplete="off"
(focus)="select(son.value) && son.select()"
(input)="select(son.value)"
/>
</mat-form-field>
}
</form>
</mat-dialog-content>
<mat-dialog-actions align="end">

View File

@ -8,7 +8,7 @@ describe('ReceivePaymentComponent', () => {
beforeEach(waitForAsync(() => {
TestBed.configureTestingModule({
declarations: [ReceivePaymentComponent],
imports: [ReceivePaymentComponent],
}).compileComponents();
}));

View File

@ -1,6 +1,34 @@
import { CdkScrollable } from '@angular/cdk/scrolling';
import { CurrencyPipe } from '@angular/common';
import { Component, ElementRef, Inject, ViewChild } from '@angular/core';
import { FormArray, FormControl, FormGroup } from '@angular/forms';
import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog';
import { FormArray, FormControl, FormGroup, ReactiveFormsModule } from '@angular/forms';
import { MatButton } from '@angular/material/button';
import {
MAT_DIALOG_DATA,
MatDialogRef,
MatDialogTitle,
MatDialogContent,
MatDialogActions,
MatDialogClose,
} from '@angular/material/dialog';
import { MatFormField, MatLabel } from '@angular/material/form-field';
import { MatInput } from '@angular/material/input';
import {
MatTable,
MatColumnDef,
MatHeaderCellDef,
MatHeaderCell,
MatCellDef,
MatCell,
MatFooterCellDef,
MatFooterCell,
MatHeaderRowDef,
MatHeaderRow,
MatRowDef,
MatRow,
MatFooterRowDef,
MatFooterRow,
} from '@angular/material/table';
import { distinctUntilChanged, map, tap } from 'rxjs/operators';
import { ReceivePaymentItem } from '../../core/receive-payment-item';
@ -14,6 +42,34 @@ import { ReceivePaymentDatasource } from './receive-payment-datasource';
selector: 'app-receive-payment',
templateUrl: './receive-payment.component.html',
styleUrls: ['./receive-payment.component.css'],
standalone: true,
imports: [
MatDialogTitle,
CdkScrollable,
MatDialogContent,
ReactiveFormsModule,
MatTable,
MatColumnDef,
MatHeaderCellDef,
MatHeaderCell,
MatCellDef,
MatCell,
MatFooterCellDef,
MatFooterCell,
MatFormField,
MatInput,
MatHeaderRowDef,
MatHeaderRow,
MatRowDef,
MatRow,
MatFooterRowDef,
MatFooterRow,
MatLabel,
MatDialogActions,
MatButton,
MatDialogClose,
CurrencyPipe,
],
})
export class ReceivePaymentComponent {
@ViewChild('son', { static: true }) son?: ElementRef;