63 lines
1.8 KiB
TypeScript
63 lines
1.8 KiB
TypeScript
import { Component, inject, Inject } from '@angular/core';
|
|
import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog';
|
|
import { CommonModule } from '@angular/common';
|
|
import { ReactiveFormsModule } from '@angular/forms';
|
|
import { AngularMaterialModule } from '../shared/module/angular-material.module';
|
|
import { UserService } from '../core/services/common/user.service';
|
|
|
|
@Component({
|
|
selector: 'app-bor-dialog',
|
|
imports: [AngularMaterialModule, CommonModule, ReactiveFormsModule],
|
|
template: `
|
|
<h2 mat-dialog-title>{{title}}</h2>
|
|
<mat-dialog-content>
|
|
This is NOT your carnet. Did you send BOR document to {{spName}}?
|
|
</mat-dialog-content>
|
|
<mat-dialog-actions>
|
|
<button mat-raised-button color="primary"
|
|
(click)="onSubmit()">
|
|
Yes
|
|
</button>
|
|
<button mat-button (click)="onCancel()">No</button>
|
|
</mat-dialog-actions>
|
|
`,
|
|
styles: [`
|
|
`]
|
|
})
|
|
export class BorDialogComponent {
|
|
carnetAction: any | null = null;
|
|
title: string = '';
|
|
spName: string = '';
|
|
|
|
private userService = inject(UserService);
|
|
|
|
constructor(
|
|
public dialogRef: MatDialogRef<BorDialogComponent>,
|
|
@Inject(MAT_DIALOG_DATA) public data: { carnetAction: string },
|
|
) {
|
|
this.carnetAction = data.carnetAction;
|
|
this.spName = this.userService.getUserDetails()?.userDetails?.serviceProviderName || '';
|
|
}
|
|
|
|
ngOnInit(): void {
|
|
this.setTitle();
|
|
}
|
|
|
|
setTitle(): void {
|
|
if (this.carnetAction === 'duplicate') {
|
|
this.title = 'Duplicate Carnet';
|
|
} else if (this.carnetAction === 'extend') {
|
|
this.title = 'Extend Carnet';
|
|
} else if (this.carnetAction === 'additional') {
|
|
this.title = 'Additional Sets';
|
|
}
|
|
}
|
|
|
|
onSubmit(): void {
|
|
this.dialogRef.close(this.carnetAction);
|
|
}
|
|
|
|
onCancel(): void {
|
|
this.dialogRef.close('delete');
|
|
}
|
|
} |