feat: add new standalone components for system and organization management modules
This commit is contained in:
@@ -39,6 +39,7 @@ import { CdkTextareaAutosize } from '@angular/cdk/text-field';
|
||||
import { MatButton, MatIconButton } from '@angular/material/button';
|
||||
import { FaIconComponent } from '@fortawesome/angular-fontawesome';
|
||||
import { STANDALONE_SHARED_IMPORTS } from 'app/standalone-shared.module';
|
||||
import { AlertService } from 'app/core/alert/alert.service';
|
||||
|
||||
/**
|
||||
* Create Report Component.
|
||||
@@ -75,6 +76,7 @@ export class CreateReportComponent implements OnInit {
|
||||
private router = inject(Router);
|
||||
private dialog = inject(MatDialog);
|
||||
private translateServices = inject(TranslateService);
|
||||
private alertService = inject(AlertService);
|
||||
|
||||
/** Report Form. */
|
||||
reportForm: UntypedFormGroup;
|
||||
@@ -267,7 +269,14 @@ export class CreateReportComponent implements OnInit {
|
||||
return reportParameter;
|
||||
});
|
||||
this.systemService.createReport(this.reportForm.value).subscribe((response: any) => {
|
||||
// TODO: Implement Maker Checker Component.
|
||||
if (response?.rollbackTransaction) {
|
||||
this.alertService.alert({
|
||||
type: 'Success',
|
||||
message: 'Report creation has been submitted for approval.'
|
||||
});
|
||||
this.router.navigate(['../'], { relativeTo: this.route });
|
||||
return;
|
||||
}
|
||||
this.router.navigate(
|
||||
[
|
||||
'../',
|
||||
|
||||
@@ -38,6 +38,7 @@ import { CdkTextareaAutosize } from '@angular/cdk/text-field';
|
||||
import { MatButton, MatIconButton } from '@angular/material/button';
|
||||
import { FaIconComponent } from '@fortawesome/angular-fontawesome';
|
||||
import { STANDALONE_SHARED_IMPORTS } from 'app/standalone-shared.module';
|
||||
import { AlertService } from 'app/core/alert/alert.service';
|
||||
|
||||
/**
|
||||
* Edit Report Component.
|
||||
@@ -73,6 +74,7 @@ export class EditReportComponent implements OnInit {
|
||||
private router = inject(Router);
|
||||
private systemService = inject(SystemService);
|
||||
private dialog = inject(MatDialog);
|
||||
private alertService = inject(AlertService);
|
||||
|
||||
/** Report Data. */
|
||||
reportData: any;
|
||||
@@ -292,7 +294,13 @@ export class EditReportComponent implements OnInit {
|
||||
return reportParameter;
|
||||
});
|
||||
}
|
||||
this.systemService.updateReport(this.reportData.id, this.reportForm.value).subscribe(() => {
|
||||
this.systemService.updateReport(this.reportData.id, this.reportForm.value).subscribe((response: any) => {
|
||||
if (response?.rollbackTransaction) {
|
||||
this.alertService.alert({
|
||||
type: 'Success',
|
||||
message: 'Report update has been submitted for approval.'
|
||||
});
|
||||
}
|
||||
this.router.navigate(['../'], { relativeTo: this.route });
|
||||
});
|
||||
}
|
||||
|
||||
@@ -20,6 +20,7 @@ import { FaIconComponent } from '@fortawesome/angular-fontawesome';
|
||||
import { MatCard, MatCardTitle, MatCardContent } from '@angular/material/card';
|
||||
import { YesnoPipe } from '../../../pipes/yesno.pipe';
|
||||
import { STANDALONE_SHARED_IMPORTS } from 'app/standalone-shared.module';
|
||||
import { AlertService } from 'app/core/alert/alert.service';
|
||||
|
||||
/**
|
||||
* View Report Component.
|
||||
@@ -40,6 +41,7 @@ export class ViewReportComponent {
|
||||
private systemService = inject(SystemService);
|
||||
private dialog = inject(MatDialog);
|
||||
private router = inject(Router);
|
||||
private alertService = inject(AlertService);
|
||||
|
||||
/** Report Data. */
|
||||
reportData: any;
|
||||
@@ -66,7 +68,13 @@ export class ViewReportComponent {
|
||||
});
|
||||
deleteReportDialogRef.afterClosed().subscribe((response: any) => {
|
||||
if (response.delete) {
|
||||
this.systemService.deleteReport(this.reportData.id).subscribe(() => {
|
||||
this.systemService.deleteReport(this.reportData.id).subscribe((deleteResponse: any) => {
|
||||
if (deleteResponse?.rollbackTransaction) {
|
||||
this.alertService.alert({
|
||||
type: 'Success',
|
||||
message: 'Report deletion has been submitted for approval.'
|
||||
});
|
||||
}
|
||||
this.router.navigate(['/system/reports']);
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user