Chore: Check for deprecations using eslint plugin

Chore: environment file replacement stopped.
Chore: All components are now standalone and removed all modules
Chore: App routing is now in app.routes and similarly for all submodules
Chore: Http interceptors are now functional and split refresh interceptor into a separate one.
This commit is contained in:
2024-05-31 22:54:41 +05:30
parent b6bb3dbcfd
commit 4571b31fc0
309 changed files with 3897 additions and 5222 deletions
+91 -15
View File
@@ -1,9 +1,38 @@
import { COMMA, ENTER } from '@angular/cdk/keycodes';
import { AsyncPipe, CurrencyPipe } from '@angular/common';
import { AfterViewInit, Component, ElementRef, OnInit, OnDestroy, ViewChild } from '@angular/core';
import { FormControl, FormGroup } from '@angular/forms';
import { MatAutocompleteSelectedEvent } from '@angular/material/autocomplete';
import { MatChipInputEvent } from '@angular/material/chips';
import { FormControl, FormGroup, ReactiveFormsModule } from '@angular/forms';
import { MatAutocompleteSelectedEvent, MatAutocompleteTrigger, MatAutocomplete } from '@angular/material/autocomplete';
import { MatButton, MatIconButton } from '@angular/material/button';
import {
MatCard,
MatCardHeader,
MatCardTitleGroup,
MatCardTitle,
MatCardContent,
MatCardActions,
} from '@angular/material/card';
import { MatChipInputEvent, MatChipGrid, MatChipRow, MatChipRemove, MatChipInput } from '@angular/material/chips';
import { MatOption } from '@angular/material/core';
import { MatDatepickerInput, MatDatepickerToggle, MatDatepicker } from '@angular/material/datepicker';
import { MatDialog } from '@angular/material/dialog';
import { MatSuffix, MatFormField, MatLabel, MatPrefix, MatHint } from '@angular/material/form-field';
import { MatIcon } from '@angular/material/icon';
import { MatInput } from '@angular/material/input';
import { MatSelect } from '@angular/material/select';
import { MatSort } from '@angular/material/sort';
import {
MatTable,
MatColumnDef,
MatHeaderCellDef,
MatHeaderCell,
MatCellDef,
MatCell,
MatHeaderRowDef,
MatHeaderRow,
MatRowDef,
MatRow,
} from '@angular/material/table';
import { ActivatedRoute, Router } from '@angular/router';
import { Hotkey, HotkeysService } from 'angular2-hotkeys';
import { round } from 'mathjs';
@@ -23,9 +52,11 @@ import { ToasterService } from '../core/toaster.service';
import { User } from '../core/user';
import { Voucher } from '../core/voucher';
import { VoucherService } from '../core/voucher.service';
import { AccountingPipe } from '../shared/accounting.pipe';
import { ConfirmDialogComponent } from '../shared/confirm-dialog/confirm-dialog.component';
import { ImageDialogComponent } from '../shared/image-dialog/image-dialog.component';
import { ImageService } from '../shared/image.service';
import { LocalTimePipe } from '../shared/local-time.pipe';
import { MathService } from '../shared/math.service';
import { PaymentDataSource } from './payment-datasource';
@@ -35,6 +66,51 @@ import { PaymentDialogComponent } from './payment-dialog.component';
selector: 'app-payment',
templateUrl: './payment.component.html',
styleUrls: ['./payment.component.css'],
standalone: true,
imports: [
MatCard,
MatCardHeader,
MatCardTitleGroup,
MatCardTitle,
MatIcon,
MatSuffix,
MatCardContent,
ReactiveFormsModule,
MatFormField,
MatLabel,
MatInput,
MatDatepickerInput,
MatDatepickerToggle,
MatDatepicker,
MatSelect,
MatOption,
MatPrefix,
MatAutocompleteTrigger,
MatHint,
MatAutocomplete,
MatButton,
MatTable,
MatSort,
MatColumnDef,
MatHeaderCellDef,
MatHeaderCell,
MatCellDef,
MatCell,
MatIconButton,
MatHeaderRowDef,
MatHeaderRow,
MatRowDef,
MatRow,
MatChipGrid,
MatChipRow,
MatChipRemove,
MatChipInput,
MatCardActions,
AsyncPipe,
CurrencyPipe,
AccountingPipe,
LocalTimePipe,
],
})
export class PaymentComponent implements OnInit, AfterViewInit, OnDestroy {
@ViewChild('accountElement', { static: true }) accountElement?: ElementRef;
@@ -281,21 +357,21 @@ export class PaymentComponent implements OnInit, AfterViewInit, OnDestroy {
}
post() {
this.ser.post(this.voucher.id as string).subscribe(
(result) => {
this.ser.post(this.voucher.id as string).subscribe({
next: (result) => {
this.loadVoucher(result);
this.toaster.show('Success', 'Voucher Posted');
},
(error) => {
error: (error) => {
this.toaster.show('Danger', error);
},
);
});
}
save() {
const voucher: Voucher = this.getVoucher();
this.ser.saveOrUpdate(voucher).subscribe(
(result) => {
this.ser.saveOrUpdate(voucher).subscribe({
next: (result) => {
this.toaster.show('Success', '');
if (voucher.id === result.id) {
this.loadVoucher(result);
@@ -303,10 +379,10 @@ export class PaymentComponent implements OnInit, AfterViewInit, OnDestroy {
this.router.navigate(['/payment', result.id]);
}
},
(error) => {
error: (error) => {
this.toaster.show('Danger', error);
},
);
});
}
getVoucher(): Voucher {
@@ -318,15 +394,15 @@ export class PaymentComponent implements OnInit, AfterViewInit, OnDestroy {
}
delete() {
this.ser.delete(this.voucher.id as string).subscribe(
() => {
this.ser.delete(this.voucher.id as string).subscribe({
next: () => {
this.toaster.show('Success', '');
this.router.navigate(['/payment'], { replaceUrl: true });
},
(error) => {
error: (error) => {
this.toaster.show('Danger', error);
},
);
});
}
confirmDelete(): void {