Commit 144db220 authored by Hamza HRAMCHI's avatar Hamza HRAMCHI
Browse files

FIX #18393 TIME 4:15 indexing template / Mail type selection: Multiple...

FIX #18393 TIME 4:15 indexing template / Mail type selection: Multiple selection / deselection by folder choice
parent 9f741f53
......@@ -15,6 +15,6 @@
<img src="assets/spinner.gif"/>
</div>
</app-root>
<script src="runtime-es2015.4ac42fef445445e6f3d0.js" type="module"></script><script src="runtime-es5.4ac42fef445445e6f3d0.js" nomodule defer></script><script src="polyfills-es5.8c2a86db22bc37211976.js" nomodule defer></script><script src="polyfills-es2015.f8f86766446f4344eec7.js" type="module"></script><script src="scripts.3f995a62571f9f668311.js" defer></script><script src="main-es2015.02358cbb72b0e882be43.js" type="module"></script><script src="main-es5.02358cbb72b0e882be43.js" nomodule defer></script></body>
<script src="runtime-es2015.4ac42fef445445e6f3d0.js" type="module"></script><script src="runtime-es5.4ac42fef445445e6f3d0.js" nomodule defer></script><script src="polyfills-es5.8c2a86db22bc37211976.js" nomodule defer></script><script src="polyfills-es2015.f8f86766446f4344eec7.js" type="module"></script><script src="scripts.3f995a62571f9f668311.js" defer></script><script src="main-es2015.18c45fdf199cedc1d85e.js" type="module"></script><script src="main-es5.18c45fdf199cedc1d85e.js" nomodule defer></script></body>
</html>
\ No newline at end of file
......@@ -5,22 +5,37 @@
<mat-checkbox [checked]="allChecked()"
color="primary"
[indeterminate]="!emptyChecked() && !allChecked()"
(change)="toggleAll($event.checked)"><i>{{'lang.selectAll' | translate}}</i></mat-checkbox>
<mat-list>
<mat-list-item *ngFor="let val of data.values">
<ng-container *ngIf="val.isTitle; else elseTemplate">
{{!functionsServce.empty(val.title) ? val.title : val.label}}
</ng-container>
<ng-template #elseTemplate>
<mat-checkbox [value]="val.disabled" [checked]="!val.disabled" color="primary" (change)="val.disabled=!val.disabled">{{!functionsServce.empty(val.title) ? val.title : val.label}}</mat-checkbox>
</ng-template>
</mat-list-item>
</mat-list>
(change)="toggleAll($event.checked)"><i>{{'lang.selectAll' | translate}}</i>
</mat-checkbox>
<div *ngFor="let firstLevel of values">
<ng-container *ngIf="firstLevel.firstLevelId === undefined && firstLevel.secondLevelId === undefined">
<span style="font-weight: bold;"> {{ firstLevel.title }}</span>
<mat-accordion [multi]="true">
<mat-expansion-panel [expanded]="true" style="margin: 3px;" *ngFor="let secondLevel of getSecondLevel(firstLevel.id)">
<mat-expansion-panel-header>
<mat-panel-title>
<mat-checkbox [checked]="allSecondLevel(secondLevel.id)" (click)="$event.stopPropagation()"
(change)="toggleSecondLevel(secondLevel.id, $event.checked)"
[indeterminate]="!emptyCheckedSecondLevel(secondLevel.id) && !allSecondLevel(secondLevel.id)"
color="primary" class="firstLevel">
{{!functionsServce.empty(secondLevel.title) ? secondLevel.title : secondLevel.label}}
</mat-checkbox>
</mat-panel-title>
</mat-expansion-panel-header>
<mat-list>
<mat-list-item *ngFor="let type of getTypes(secondLevel.id)">
<mat-checkbox [value]="type.disabled" [checked]="!type.disabled" color="primary" (change)="type.disabled=!type.disabled">{{type.title}}</mat-checkbox>
</mat-list-item>
</mat-list>
</mat-expansion-panel>
</mat-accordion>
</ng-container>
</div>
</div>
<span class="divider-modal"></span>
<div mat-dialog-actions>
<button class="actions" color="primary" mat-raised-button
(click)="onSubmit()">{{'lang.validate' | translate}}</button>
(click)="onSubmit()" [disabled]="emptyChecked()">{{'lang.validate' | translate}}</button>
<button class="actions" color="" mat-raised-button
(click)="this.dialogRef.close('');">{{'lang.cancel' | translate}}</button>
</div>
......
......@@ -11,6 +11,7 @@ import { FunctionsService } from '@service/functions.service';
export class IndexingModelValuesSelectorComponent implements OnInit {
loading: boolean = true;
values: any[] = [];
constructor(
public translate: TranslateService,
......@@ -21,24 +22,48 @@ export class IndexingModelValuesSelectorComponent implements OnInit {
) { }
ngOnInit() {
this.values = JSON.parse(JSON.stringify(this.data.values));
this.loading = false;
}
onSubmit() {
this.dialogRef.close(this.data.values);
this.dialogRef.close(this.values);
}
allChecked() {
return this.data.values.filter((val: any) => !val.isTitle && !val.disabled).length === this.data.values.filter((val: any) => !val.isTitle).length;
return this.values.filter((val: any) => !val.isTitle).every((el:any) => !el.disabled);
}
emptyChecked() {
return this.data.values.filter((val: any) => !val.isTitle && !val.disabled).length === 0;
return this.values.filter((val: any) => !val.isTitle && !val.disabled).length === 0;
}
toggleAll(state: boolean) {
this.data.values.filter((item: any) => !item.isTitle).forEach((item: any) => {
this.values.filter((item: any) => !item.isTitle).forEach((item: any) => {
item.disabled = !state;
});
}
getSecondLevel(firstLevelId: number) {
return this.values.filter((item: any) => item.isTitle && item.firstLevelId === firstLevelId);
}
getTypes(secondLevelId: number) {
return this.values.filter((item: any) => !item.isTitle && item.secondLevelId === secondLevelId);
}
allSecondLevel(secondLevelId: number) {
const secondLevel: any[] = this.values.filter((item: any) => !item.isTitle && item.secondLevelId === secondLevelId);
return this.values.filter((item: any) => !item.isTitle && item.secondLevelId === secondLevelId && !item.disabled).length === secondLevel.length;
}
emptyCheckedSecondLevel(secondLevelId: number) {
return this.values.filter((item: any) => !item.isTitle && item.secondLevelId === secondLevelId && !item.disabled).length === 0;
}
toggleSecondLevel(secondLevelId: number, state: boolean) {
this.values.filter((item: any) => !item.isTitle && item.secondLevelId === secondLevelId).forEach((element: any) => {
element.disabled = !state;
});
}
}
......@@ -284,7 +284,7 @@ export class IndexingFormComponent implements OnInit {
if (this.indexingFormId <= 0 || this.indexingFormId === undefined) {
await this.initFields();
await this.initCustomFields();
// await this.initCustomFields();
this.initElemForm();
} else {
......@@ -697,10 +697,12 @@ export class IndexingFormComponent implements OnInit {
title: secondDoctype.doctypes_second_level_label,
disabled: true,
isTitle: true,
color: secondDoctype.css_style
color: secondDoctype.css_style,
firstLevelId: doctype.doctypes_first_level_id
});
arrValues = arrValues.concat(data.structure.filter((infoDoctype: any) => infoDoctype.doctypes_second_level_id === secondDoctype.doctypes_second_level_id && infoDoctype.description !== undefined).map((infoType: any) => {
return {
secondLevelId: secondDoctype.doctypes_second_level_id,
id: infoType.type_id,
label: '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;' + infoType.description,
title: infoType.description,
......@@ -895,7 +897,7 @@ export class IndexingFormComponent implements OnInit {
});
if (this.availableCustomFieldsClone === null) {
await this.initCustomFields();
// await this.initCustomFields();
} else {
this.availableCustomFields = JSON.parse(JSON.stringify(this.availableCustomFieldsClone));
}
......@@ -1024,6 +1026,11 @@ export class IndexingFormComponent implements OnInit {
filter((data: any) => !this.functions.empty(data)),
tap((values: any) => {
field.values = values;
// WORK AROUND UPDATING DATA
field.type = null;
setTimeout(() => {
field.type = 'select';
}, 0);
}),
catchError((err: any) => {
this.notify.handleSoftErrors(err);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment