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:51:01 +05:30
parent b6bb3dbcfd
commit 4571b31fc0
309 changed files with 3897 additions and 5222 deletions

View File

@ -1,9 +1,37 @@
import { COMMA, ENTER } from '@angular/cdk/keycodes';
import { AsyncPipe, DecimalPipe, PercentPipe, 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, MatHint, MatPrefix } from '@angular/material/form-field';
import { MatIcon } from '@angular/material/icon';
import { MatInput } from '@angular/material/input';
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';
@ -27,9 +55,11 @@ import { User } from '../core/user';
import { Voucher } from '../core/voucher';
import { VoucherService } from '../core/voucher.service';
import { ProductService } from '../product/product.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 { PurchaseDataSource } from './purchase-datasource';
@ -39,6 +69,52 @@ import { PurchaseDialogComponent } from './purchase-dialog.component';
selector: 'app-purchase',
templateUrl: './purchase.component.html',
styleUrls: ['./purchase.component.css'],
standalone: true,
imports: [
MatCard,
MatCardHeader,
MatCardTitleGroup,
MatCardTitle,
MatIcon,
MatSuffix,
MatCardContent,
ReactiveFormsModule,
MatFormField,
MatLabel,
MatInput,
MatDatepickerInput,
MatDatepickerToggle,
MatDatepicker,
MatAutocompleteTrigger,
MatHint,
MatAutocomplete,
MatOption,
MatPrefix,
MatButton,
MatTable,
MatSort,
MatColumnDef,
MatHeaderCellDef,
MatHeaderCell,
MatCellDef,
MatCell,
MatIconButton,
MatHeaderRowDef,
MatHeaderRow,
MatRowDef,
MatRow,
MatChipGrid,
MatChipRow,
MatChipRemove,
MatChipInput,
MatCardActions,
AsyncPipe,
DecimalPipe,
PercentPipe,
CurrencyPipe,
AccountingPipe,
LocalTimePipe,
],
})
export class PurchaseComponent implements OnInit, AfterViewInit, OnDestroy {
@ViewChild('accountElement', { static: true }) accountElement?: ElementRef;
@ -308,21 +384,21 @@ export class PurchaseComponent 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);
@ -330,10 +406,10 @@ export class PurchaseComponent implements OnInit, AfterViewInit, OnDestroy {
this.router.navigate(['/purchase', result.id]);
}
},
(error) => {
error: (error) => {
this.toaster.show('Danger', error);
},
);
});
}
getVoucher(): Voucher {
@ -347,15 +423,15 @@ export class PurchaseComponent 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(['/purchase'], { replaceUrl: true });
},
(error) => {
error: (error) => {
this.toaster.show('Danger', error);
},
);
});
}
confirmDelete(): void {