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:
@@ -1,6 +1,32 @@
|
||||
import { DecimalPipe, CurrencyPipe } from '@angular/common';
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
import { FormArray, FormControl, FormGroup } from '@angular/forms';
|
||||
import { FormArray, FormControl, FormGroup, ReactiveFormsModule } from '@angular/forms';
|
||||
import { MatIconButton, MatButton } from '@angular/material/button';
|
||||
import {
|
||||
MatCard,
|
||||
MatCardHeader,
|
||||
MatCardTitle,
|
||||
MatCardContent,
|
||||
MatCardActions,
|
||||
MatCardSubtitle,
|
||||
} from '@angular/material/card';
|
||||
import { MatDatepickerInput, MatDatepickerToggle, MatDatepicker } from '@angular/material/datepicker';
|
||||
import { MatDialog } from '@angular/material/dialog';
|
||||
import { MatFormField, MatLabel, MatSuffix, MatPrefix } from '@angular/material/form-field';
|
||||
import { MatIcon } from '@angular/material/icon';
|
||||
import { MatInput } from '@angular/material/input';
|
||||
import {
|
||||
MatTable,
|
||||
MatColumnDef,
|
||||
MatHeaderCellDef,
|
||||
MatHeaderCell,
|
||||
MatCellDef,
|
||||
MatCell,
|
||||
MatHeaderRowDef,
|
||||
MatHeaderRow,
|
||||
MatRowDef,
|
||||
MatRow,
|
||||
} from '@angular/material/table';
|
||||
import { ActivatedRoute, Router } from '@angular/router';
|
||||
import moment from 'moment';
|
||||
import { BehaviorSubject } from 'rxjs';
|
||||
@@ -15,6 +41,7 @@ import { User } from '../core/user';
|
||||
import { Voucher } from '../core/voucher';
|
||||
import { VoucherService } from '../core/voucher.service';
|
||||
import { ConfirmDialogComponent } from '../shared/confirm-dialog/confirm-dialog.component';
|
||||
import { LocalTimePipe } from '../shared/local-time.pipe';
|
||||
|
||||
import { IncentiveDataSource } from './incentive-datasource';
|
||||
|
||||
@@ -22,6 +49,40 @@ import { IncentiveDataSource } from './incentive-datasource';
|
||||
selector: 'app-incentive',
|
||||
templateUrl: './incentive.component.html',
|
||||
styleUrls: ['./incentive.component.css'],
|
||||
standalone: true,
|
||||
imports: [
|
||||
MatCard,
|
||||
MatCardHeader,
|
||||
MatCardTitle,
|
||||
MatCardContent,
|
||||
ReactiveFormsModule,
|
||||
MatFormField,
|
||||
MatLabel,
|
||||
MatInput,
|
||||
MatDatepickerInput,
|
||||
MatDatepickerToggle,
|
||||
MatSuffix,
|
||||
MatDatepicker,
|
||||
MatTable,
|
||||
MatColumnDef,
|
||||
MatHeaderCellDef,
|
||||
MatHeaderCell,
|
||||
MatCellDef,
|
||||
MatCell,
|
||||
MatIconButton,
|
||||
MatPrefix,
|
||||
MatIcon,
|
||||
MatHeaderRowDef,
|
||||
MatHeaderRow,
|
||||
MatRowDef,
|
||||
MatRow,
|
||||
MatCardActions,
|
||||
MatButton,
|
||||
MatCardSubtitle,
|
||||
DecimalPipe,
|
||||
CurrencyPipe,
|
||||
LocalTimePipe,
|
||||
],
|
||||
})
|
||||
export class IncentiveComponent implements OnInit {
|
||||
public incentiveObservable = new BehaviorSubject<Incentive[]>([]);
|
||||
@@ -129,31 +190,31 @@ export class IncentiveComponent implements OnInit {
|
||||
}
|
||||
|
||||
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) => {
|
||||
if (voucher.id === result.id) {
|
||||
this.loadVoucher(result);
|
||||
} else {
|
||||
this.router.navigate(['/incentive', result.id]);
|
||||
}
|
||||
},
|
||||
(error) => {
|
||||
error: (error) => {
|
||||
this.toaster.show('Danger', error);
|
||||
},
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
getVoucher(): Voucher {
|
||||
@@ -168,15 +229,15 @@ export class IncentiveComponent implements OnInit {
|
||||
}
|
||||
|
||||
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(['/incentive'], { replaceUrl: true });
|
||||
},
|
||||
(error) => {
|
||||
error: (error) => {
|
||||
this.toaster.show('Danger', error);
|
||||
},
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
confirmDelete(): void {
|
||||
|
||||
Reference in New Issue
Block a user