build: Use prettier for typescript
Stop ignoring .ts files in prettier and fix existing issues.
This commit is contained in:
+73
-46
@@ -33,7 +33,6 @@ import { DatatableColumn } from '../datatable-column.model';
|
||||
styleUrls: ['./create-data-table.component.scss']
|
||||
})
|
||||
export class CreateDataTableComponent implements OnInit, AfterViewInit {
|
||||
|
||||
/** Data Table Form */
|
||||
dataTableForm: UntypedFormGroup;
|
||||
/** Application Table Data */
|
||||
@@ -46,18 +45,27 @@ export class CreateDataTableComponent implements OnInit, AfterViewInit {
|
||||
columnData: DatatableColumn[] = [];
|
||||
/** Data passed to dialog. */
|
||||
dataForDialog: DatatableColumn = {
|
||||
columnName: undefined,
|
||||
columnDisplayType: undefined,
|
||||
isColumnNullable: undefined,
|
||||
columnLength: undefined,
|
||||
columnCode: undefined,
|
||||
columnCodes: undefined,
|
||||
type: undefined,
|
||||
isColumnUnique: undefined,
|
||||
isColumnIndexed: undefined
|
||||
};
|
||||
columnName: undefined,
|
||||
columnDisplayType: undefined,
|
||||
isColumnNullable: undefined,
|
||||
columnLength: undefined,
|
||||
columnCode: undefined,
|
||||
columnCodes: undefined,
|
||||
type: undefined,
|
||||
isColumnUnique: undefined,
|
||||
isColumnIndexed: undefined
|
||||
};
|
||||
/** Columns to be displayed in columns table. */
|
||||
displayedColumns: string[] = ['name', 'type', 'length', 'code', 'mandatory', 'unique', 'indexed', 'actions'];
|
||||
displayedColumns: string[] = [
|
||||
'name',
|
||||
'type',
|
||||
'length',
|
||||
'code',
|
||||
'mandatory',
|
||||
'unique',
|
||||
'indexed',
|
||||
'actions'
|
||||
];
|
||||
/** Data source for columns table. */
|
||||
dataSource: MatTableDataSource<any>;
|
||||
/** Paginator for columns table. */
|
||||
@@ -81,14 +89,16 @@ export class CreateDataTableComponent implements OnInit, AfterViewInit {
|
||||
* @param {PopoverService} popoverService PopoverService.
|
||||
* @param {TranslateService} translateService Translate Service.
|
||||
*/
|
||||
constructor(private formBuilder: UntypedFormBuilder,
|
||||
private systemService: SystemService,
|
||||
private route: ActivatedRoute,
|
||||
private router: Router,
|
||||
private dialog: MatDialog,
|
||||
private configurationWizardService: ConfigurationWizardService,
|
||||
private popoverService: PopoverService,
|
||||
private translateService: TranslateService) {
|
||||
constructor(
|
||||
private formBuilder: UntypedFormBuilder,
|
||||
private systemService: SystemService,
|
||||
private route: ActivatedRoute,
|
||||
private router: Router,
|
||||
private dialog: MatDialog,
|
||||
private configurationWizardService: ConfigurationWizardService,
|
||||
private popoverService: PopoverService,
|
||||
private translateService: TranslateService
|
||||
) {
|
||||
this.route.data.subscribe((data: { columnCodes: any }) => {
|
||||
this.dataForDialog.columnCodes = data.columnCodes;
|
||||
});
|
||||
@@ -101,8 +111,8 @@ export class CreateDataTableComponent implements OnInit, AfterViewInit {
|
||||
this.createDataTableForm();
|
||||
this.setColumns();
|
||||
this.dataTableForm.controls.apptableName.valueChanges.subscribe((value: any) => {
|
||||
this.showEntitySubType = (value === 'm_client');
|
||||
this.showSavingsSubType = (value === 'm_savings_product');
|
||||
this.showEntitySubType = value === 'm_client';
|
||||
this.showSavingsSubType = value === 'm_savings_product';
|
||||
});
|
||||
}
|
||||
|
||||
@@ -120,10 +130,16 @@ export class CreateDataTableComponent implements OnInit, AfterViewInit {
|
||||
*/
|
||||
createDataTableForm() {
|
||||
this.dataTableForm = this.formBuilder.group({
|
||||
'datatableName': ['', Validators.required],
|
||||
'apptableName': ['', Validators.required],
|
||||
'multiRow': [false],
|
||||
'entitySubType': ['']
|
||||
datatableName: [
|
||||
'',
|
||||
Validators.required
|
||||
],
|
||||
apptableName: [
|
||||
'',
|
||||
Validators.required
|
||||
],
|
||||
multiRow: [false],
|
||||
entitySubType: ['']
|
||||
});
|
||||
}
|
||||
|
||||
@@ -181,7 +197,7 @@ export class CreateDataTableComponent implements OnInit, AfterViewInit {
|
||||
});
|
||||
editColumnDialogRef.afterClosed().subscribe((response: any) => {
|
||||
if (response !== '') {
|
||||
this.columnData[this.columnData.findIndex(newColumn => newColumn.columnName === column.name)] = {
|
||||
this.columnData[this.columnData.findIndex((newColumn) => newColumn.columnName === column.name)] = {
|
||||
columnName: response.name,
|
||||
columnDisplayType: response.type,
|
||||
isColumnNullable: !response.mandatory,
|
||||
@@ -202,7 +218,7 @@ export class CreateDataTableComponent implements OnInit, AfterViewInit {
|
||||
*/
|
||||
deleteColumn(column: any) {
|
||||
const deleteColumnDialogRef = this.dialog.open(DeleteDialogComponent, {
|
||||
data: { deleteContext: this.translateService.instant('labels.inputs.Column') + ' ' + column.name}
|
||||
data: { deleteContext: this.translateService.instant('labels.inputs.Column') + ' ' + column.name }
|
||||
});
|
||||
deleteColumnDialogRef.afterClosed().subscribe((response: any) => {
|
||||
if (response.delete) {
|
||||
@@ -236,10 +252,16 @@ export class CreateDataTableComponent implements OnInit, AfterViewInit {
|
||||
}
|
||||
this.systemService.createDataTable(payload).subscribe((response: any) => {
|
||||
if (this.configurationWizardService.showDatatablesForm === true) {
|
||||
this.configurationWizardService.showDatatablesForm = false;
|
||||
this.openDialog();
|
||||
this.configurationWizardService.showDatatablesForm = false;
|
||||
this.openDialog();
|
||||
} else {
|
||||
this.router.navigate(['../', response.resourceIdentifier], { relativeTo: this.route });
|
||||
this.router.navigate(
|
||||
[
|
||||
'../',
|
||||
response.resourceIdentifier
|
||||
],
|
||||
{ relativeTo: this.route }
|
||||
);
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -251,7 +273,12 @@ export class CreateDataTableComponent implements OnInit, AfterViewInit {
|
||||
* @param position String.
|
||||
* @param backdrop Boolean.
|
||||
*/
|
||||
showPopover(template: TemplateRef<any>, target: HTMLElement | ElementRef<any>, position: string, backdrop: boolean): void {
|
||||
showPopover(
|
||||
template: TemplateRef<any>,
|
||||
target: HTMLElement | ElementRef<any>,
|
||||
position: string,
|
||||
backdrop: boolean
|
||||
): void {
|
||||
setTimeout(() => this.popoverService.open(template, target, position, backdrop, {}), 200);
|
||||
}
|
||||
|
||||
@@ -261,7 +288,7 @@ export class CreateDataTableComponent implements OnInit, AfterViewInit {
|
||||
ngAfterViewInit() {
|
||||
if (this.configurationWizardService.showDatatablesForm === true) {
|
||||
setTimeout(() => {
|
||||
this.showPopover(this.templateDataTableFormRef, this.dataTableFormRef.nativeElement, 'bottom', true);
|
||||
this.showPopover(this.templateDataTableFormRef, this.dataTableFormRef.nativeElement, 'bottom', true);
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -291,22 +318,22 @@ export class CreateDataTableComponent implements OnInit, AfterViewInit {
|
||||
const continueSetupDialogRef = this.dialog.open(ContinueSetupDialogComponent, {
|
||||
data: {
|
||||
stepName: 'data table'
|
||||
},
|
||||
}
|
||||
});
|
||||
continueSetupDialogRef.afterClosed().subscribe((response: { step: number }) => {
|
||||
if (response.step === 1) {
|
||||
this.configurationWizardService.showDatatablesForm = false;
|
||||
this.router.navigate(['../'], { relativeTo: this.route });
|
||||
} else if (response.step === 2) {
|
||||
this.configurationWizardService.showDatatablesForm = true;
|
||||
this.router.routeReuseStrategy.shouldReuseRoute = () => false;
|
||||
this.router.onSameUrlNavigation = 'reload';
|
||||
this.router.navigate(['/organization/data-tables/create']);
|
||||
} else if (response.step === 3) {
|
||||
this.configurationWizardService.showDatatablesForm = false;
|
||||
this.configurationWizardService.showSystemCodes = true;
|
||||
this.router.navigate(['/system']);
|
||||
}
|
||||
this.configurationWizardService.showDatatablesForm = false;
|
||||
this.router.navigate(['../'], { relativeTo: this.route });
|
||||
} else if (response.step === 2) {
|
||||
this.configurationWizardService.showDatatablesForm = true;
|
||||
this.router.routeReuseStrategy.shouldReuseRoute = () => false;
|
||||
this.router.onSameUrlNavigation = 'reload';
|
||||
this.router.navigate(['/organization/data-tables/create']);
|
||||
} else if (response.step === 3) {
|
||||
this.configurationWizardService.showDatatablesForm = false;
|
||||
this.configurationWizardService.showSystemCodes = true;
|
||||
this.router.navigate(['/system']);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user