|
|
@@ -29,7 +29,7 @@ import { GetModules, ResponseDataGetModule } from 'src/app/interfaces/forms-mana
|
|
|
})
|
|
|
export class FormDynManagementFormComponent implements OnInit {
|
|
|
public step = 0;
|
|
|
-
|
|
|
+
|
|
|
public opciones: Array<string> = ['input', 'select', 'checkbox', 'radio', 'textarea'];
|
|
|
private auxiliar: Array<string> = ['input', 'select', 'checkbox', 'radio', 'textarea'];
|
|
|
|
|
|
@@ -46,8 +46,8 @@ export class FormDynManagementFormComponent implements OnInit {
|
|
|
public arr_menu: MenuResponse[] = [];
|
|
|
|
|
|
public arrTables: Array<GetTables> = [];
|
|
|
- public arr_relationship: Array<any> = [];
|
|
|
- public arr_columns: Array<InformationTable> = [];
|
|
|
+ public arrRelationship: Array<any> = [];
|
|
|
+ public arrColumns: Array<InformationTable> = [];
|
|
|
|
|
|
public data_table: Array<any> = [];
|
|
|
public model: Array<any> = [];
|
|
|
@@ -167,8 +167,8 @@ export class FormDynManagementFormComponent implements OnInit {
|
|
|
await this._encService.decrypt(table_relationship).then((data: string) => (table_relationship = data));
|
|
|
|
|
|
let arrOtherTables: Array<GetTables> = this.arrTables.filter((element: GetTables) => element.NOMBRE_TABLA !== this.formGroupTableDB.controls['MAIN_TABLE'].value);
|
|
|
- this.arr_relationship = arrOtherTables;
|
|
|
- this.arr_relationship.length === 0 ? this.formGroupTableDB.controls['RELATION_TABLE'].disable() : this.formGroupTableDB.controls['RELATION_TABLE'].enable();
|
|
|
+ this.arrRelationship = arrOtherTables;
|
|
|
+ this.arrRelationship.length === 0 ? this.formGroupTableDB.controls['RELATION_TABLE'].disable() : this.formGroupTableDB.controls['RELATION_TABLE'].enable();
|
|
|
|
|
|
table_relationship = JSON.parse(table_relationship);
|
|
|
|
|
|
@@ -203,8 +203,8 @@ export class FormDynManagementFormComponent implements OnInit {
|
|
|
public setColumns() {
|
|
|
let arrOtherTables: Array<GetTables> = this.arrTables.filter((element:GetTables) => element.NOMBRE_TABLA !== this.formGroupTableDB.controls['MAIN_TABLE'].value);
|
|
|
|
|
|
- this.arr_relationship = arrOtherTables;
|
|
|
- this.arr_relationship.length === 0 ? this.formGroupTableDB.controls['RELATION_TABLE'].disable() : this.formGroupTableDB.controls['RELATION_TABLE'].enable();
|
|
|
+ this.arrRelationship = arrOtherTables;
|
|
|
+ this.arrRelationship.length === 0 ? this.formGroupTableDB.controls['RELATION_TABLE'].disable() : this.formGroupTableDB.controls['RELATION_TABLE'].enable();
|
|
|
this.dataColumns();
|
|
|
|
|
|
this.formGroupTableDB.controls['COLUMNS'].enable();
|
|
|
@@ -236,13 +236,12 @@ export class FormDynManagementFormComponent implements OnInit {
|
|
|
(data: any) => {
|
|
|
console.log(data);
|
|
|
if (!data.error) {
|
|
|
- this.arr_columns = data.response;
|
|
|
+ this.arrColumns = data.response;
|
|
|
|
|
|
- if (this.arr_columns.length > 0) {
|
|
|
+ if (this.arrColumns.length > 0) {
|
|
|
|
|
|
- // Se deshabilitan las opciones seleccionadas
|
|
|
let new_cols: any = []
|
|
|
- this.arr_columns.map((data_columns: any) => {
|
|
|
+ this.arrColumns.map((data_columns: any) => {
|
|
|
let new_columns: any = [];
|
|
|
data_columns.columns.map((column: any) => {
|
|
|
let obj = { column: column, disable: true };
|
|
|
@@ -253,7 +252,7 @@ export class FormDynManagementFormComponent implements OnInit {
|
|
|
data_columns.columns = new_columns;
|
|
|
new_cols.push(data_columns);
|
|
|
});
|
|
|
- this.arr_columns = new_cols;
|
|
|
+ this.arrColumns = new_cols;
|
|
|
data.response.length > 0 ? this.formGroupTableDB.controls['COLUMNS'].enable() : this.formGroupTableDB.controls['COLUMNS'].disable();
|
|
|
}
|
|
|
|
|
|
@@ -286,7 +285,7 @@ export class FormDynManagementFormComponent implements OnInit {
|
|
|
});
|
|
|
responseData.response.columns = dataColumns;
|
|
|
let arrColumnExtra = responseData.response;
|
|
|
- this.arr_columns.push(arrColumnExtra);
|
|
|
+ this.arrColumns.push(arrColumnExtra);
|
|
|
}
|
|
|
}, (error:HttpErrorResponse) => this._resourceService.checkErrors(error)
|
|
|
);
|
|
|
@@ -297,7 +296,7 @@ export class FormDynManagementFormComponent implements OnInit {
|
|
|
|
|
|
this.model = [];
|
|
|
this.formGroupTableDB.controls['COLUMNS'].value.map((colum: string) => {
|
|
|
- this.arr_columns.map((data: any) => {
|
|
|
+ this.arrColumns.map((data: any) => {
|
|
|
if (data !== 'Acciones') {
|
|
|
data.columns.map((item: string) => {
|
|
|
if (colum !== 'Acciones' && item === colum)
|
|
|
@@ -350,14 +349,14 @@ export class FormDynManagementFormComponent implements OnInit {
|
|
|
});
|
|
|
break;
|
|
|
case 'select':
|
|
|
- let filter_columns = this.arr_columns.filter((element: any) => element.table !== this.formGroupUbication.controls['MAIN_TABLE'].value && element !== 'Acciones');
|
|
|
+ let filter_columns = this.arrColumns.filter((element: any) => element.table !== this.formGroupUbication.controls['MAIN_TABLE'].value && element !== 'Acciones');
|
|
|
dialogRef = this.dialog.open(ConfigureSelectComponent, {
|
|
|
disableClose: true,
|
|
|
data: {
|
|
|
num_cols: this.fields[findIndexField].num_cols,
|
|
|
column: this.aux_columns,
|
|
|
table_main: this.formGroupUbication.controls['MAIN_TABLE'].value,
|
|
|
- tables_rel: this.arr_relationship,
|
|
|
+ tables_rel: this.arrRelationship,
|
|
|
columns: filter_columns,
|
|
|
},
|
|
|
width: '1000px',
|
|
|
@@ -472,7 +471,7 @@ export class FormDynManagementFormComponent implements OnInit {
|
|
|
|
|
|
let data_table = itmForm.data_table;
|
|
|
|
|
|
- this.arr_columns.map((itmColumns: any) => {
|
|
|
+ this.arrColumns.map((itmColumns: any) => {
|
|
|
if (itmColumns.columns.some((item: any) => item.column == itmForm.column)) {
|
|
|
|
|
|
if (itmForm.tag == 'select' && itmForm.columnMMtoMain != null && itmForm.columnMMtoMain != undefined) {
|
|
|
@@ -710,17 +709,17 @@ export class FormDynManagementFormComponent implements OnInit {
|
|
|
// Se eliminan elementos duplicados
|
|
|
let arrData: any = [];
|
|
|
let arrDataElement: any = [];
|
|
|
- this.arr_columns.map((element: any) => {
|
|
|
+ this.arrColumns.map((element: any) => {
|
|
|
if (!arrData.includes(element.table)) {
|
|
|
arrData.push(element.table);
|
|
|
arrDataElement.push(element);
|
|
|
}
|
|
|
});
|
|
|
- this.arr_columns = arrDataElement;
|
|
|
+ this.arrColumns = arrDataElement;
|
|
|
|
|
|
let dialogRef = this.dialog.open(SelectedUsersAndDates, {
|
|
|
disableClose: true,
|
|
|
- data: { data_table: this.arr_columns },
|
|
|
+ data: { data_table: this.arrColumns },
|
|
|
width: '400px',
|
|
|
});
|
|
|
|
|
|
@@ -760,7 +759,7 @@ export class FormDynManagementFormComponent implements OnInit {
|
|
|
let codeTable: string = this.formGroupTableDB.controls['MAIN_TABLE'].value.substring(8, this.formGroupTableDB.controls['MAIN_TABLE'].value.length).toUpperCase() + '_';
|
|
|
|
|
|
let isAddedColumnTable:boolean = false;
|
|
|
- this.arr_columns.map((element:InformationTable) => {
|
|
|
+ this.arrColumns.map((element:InformationTable) => {
|
|
|
element.columns.map((column:DataColumn) => {
|
|
|
if (column.column.includes(codeTable + this.newInput)) {
|
|
|
isAddedColumnTable = true;
|
|
|
@@ -774,7 +773,7 @@ export class FormDynManagementFormComponent implements OnInit {
|
|
|
|
|
|
this.arrNewColumns.push(codeTable + this.newInput.toUpperCase());
|
|
|
if (this.arrNewColumns.length > 1) {
|
|
|
- this.arr_columns = this.arr_columns.map((element:InformationTable) => {
|
|
|
+ this.arrColumns = this.arrColumns.map((element:InformationTable) => {
|
|
|
if (element.table === 'NA' && element.type === 'JSON') {
|
|
|
element.columns.push({
|
|
|
column: codeTable + this.newInput.toUpperCase(),
|
|
|
@@ -785,7 +784,7 @@ export class FormDynManagementFormComponent implements OnInit {
|
|
|
})
|
|
|
}else{
|
|
|
|
|
|
- this.arr_columns.push({
|
|
|
+ this.arrColumns.push({
|
|
|
table: 'NA',
|
|
|
type: 'JSON',
|
|
|
columns: [{
|
|
|
@@ -820,14 +819,14 @@ export class FormDynManagementFormComponent implements OnInit {
|
|
|
return fields;
|
|
|
});
|
|
|
|
|
|
- this.arr_columns = this.arr_columns.map((element:InformationTable) => {
|
|
|
+ this.arrColumns = this.arrColumns.map((element:InformationTable) => {
|
|
|
if (element.table === 'NA' && element.type === 'JSON') {
|
|
|
element.columns = element.columns.filter((columns:DataColumn) => columns.column !== column.toUpperCase());
|
|
|
}
|
|
|
return element;
|
|
|
});
|
|
|
|
|
|
- this.arr_columns = this.arr_columns.filter((element:InformationTable) => element.columns.length !== 0);
|
|
|
+ this.arrColumns = this.arrColumns.filter((element:InformationTable) => element.columns.length !== 0);
|
|
|
}
|
|
|
|
|
|
// Formulario 1
|