Skip to content
Snippets Groups Projects
Verified Commit 123b8fd7 authored by Alex ORLUC's avatar Alex ORLUC
Browse files

FEAT #11771 TIME 1 fix select filter css + fix current date css input + fix load indexing model

parent e139187d
No related branches found
No related tags found
No related merge requests found
...@@ -55,29 +55,20 @@ ...@@ -55,29 +55,20 @@
</mat-form-field> </mat-form-field>
</ng-container> </ng-container>
<ng-container *ngIf="field.type === 'select'"> <ng-container *ngIf="field.type === 'select'">
<plugin-select-search [placeholderLabel]="field.system ? lang[field.type + 'Input'] : lang.defaultValue" [formControlSelect]="arrFormControl[field.identifier]" [datas]="field.values" style="width:100%;"></plugin-select-search> <plugin-select-search [showResetOption]="adminMode"
<!--<mat-form-field class="input-form" floatLabel="never"> [placeholderLabel]="field.system ? lang[field.type + 'Input'] : lang.defaultValue"
<mat-select [formControl]="arrFormControl[field.identifier]" [formControlSelect]="arrFormControl[field.identifier]" [datas]="field.values"
[placeholder]="field.system ? lang[field.type + 'Input'] : lang.defaultValue"> style="width:100%;"></plugin-select-search>
<plugin-select-search></plugin-select-search>
<mat-option *ngIf="adminMode"></mat-option>
<mat-option *ngFor="let value of field.values" [value]="value.id"
[title]="value.title !== undefined ? value.title : value.label"
[disabled]="value.disabled" [class.opt-group]="value.isTitle"
[style.color]="value.color" [innerHTML]="value.label">
</mat-option>
</mat-select>
</mat-form-field>-->
</ng-container> </ng-container>
<ng-container *ngIf="field.type === 'date'"> <ng-container *ngIf="field.type === 'date'">
<button mat-button color="primary" *ngIf="adminMode" matPrefix mat-icon-button
(click)="$event.stopPropagation();toggleTodayDate(field);"
matTooltip="Jour d'aujourd'hui" style="position: absolute;left: -40px;">
<mat-icon color="primary"
class="{{field.today ? 'far fa-bell-slash' : 'far fa-bell'}}">
</mat-icon>
</button>
<mat-form-field class="input-form" floatLabel="never" (click)="picker.open()"> <mat-form-field class="input-form" floatLabel="never" (click)="picker.open()">
<button mat-button color="primary" *ngIf="adminMode" matPrefix mat-icon-button
(click)="$event.stopPropagation();toggleTodayDate(field);"
matTooltip="Jour d'aujourd'hui">
<mat-icon color="primary"
class="{{field.today ? 'fas fa-circle' : 'far fa-circle'}}">
</mat-icon>
</button>
<input [formControl]="arrFormControl[field.identifier]" matInput <input [formControl]="arrFormControl[field.identifier]" matInput
[matDatepicker]="picker" [matDatepicker]="picker"
[placeholder]="field.system ? lang[field.type + 'Input'] : lang.defaultValue" [placeholder]="field.system ? lang[field.type + 'Input'] : lang.defaultValue"
......
...@@ -67,6 +67,10 @@ ...@@ -67,6 +67,10 @@
} }
} }
.fieldInput {
position: relative;
}
.fieldLabel, .fieldLabel,
.fieldInput { .fieldInput {
font-size: 13px; font-size: 13px;
......
...@@ -149,8 +149,10 @@ export class IndexingFormComponent implements OnInit { ...@@ -149,8 +149,10 @@ export class IndexingFormComponent implements OnInit {
values: [] values: []
} }
]; ];
availableFieldsClone: any[] = [];
availableCustomFields: any[] = [] availableCustomFields: any[] = [];
availableCustomFieldsClone: any[] = []
indexingFormGroup: FormGroup; indexingFormGroup: FormGroup;
...@@ -169,6 +171,8 @@ export class IndexingFormComponent implements OnInit { ...@@ -169,6 +171,8 @@ export class IndexingFormComponent implements OnInit {
ngOnInit(): void { ngOnInit(): void {
this.adminMode === undefined ? this.adminMode = false : this.adminMode = true; this.adminMode === undefined ? this.adminMode = false : this.adminMode = true;
this.availableFieldsClone = JSON.parse(JSON.stringify(this.availableFields));
this.fieldCategories.forEach(category => { this.fieldCategories.forEach(category => {
this['indexingModels_' + category] = []; this['indexingModels_' + category] = [];
}); });
...@@ -188,7 +192,7 @@ export class IndexingFormComponent implements OnInit { ...@@ -188,7 +192,7 @@ export class IndexingFormComponent implements OnInit {
}); });
}); });
}), }),
finalize(() => this.loading = false), //finalize(() => this.loading = false),
catchError((err: any) => { catchError((err: any) => {
this.notify.handleErrors(err); this.notify.handleErrors(err);
return of(false); return of(false);
...@@ -284,6 +288,13 @@ export class IndexingFormComponent implements OnInit { ...@@ -284,6 +288,13 @@ export class IndexingFormComponent implements OnInit {
} }
initElemForm() { initElemForm() {
this.loading = true;
// FAKE LOADER : MERGE ROUTES FOR REAL LOADER
setTimeout(() => {
this.loading = false;
}, 800);
this.fieldCategories.forEach(element => { this.fieldCategories.forEach(element => {
this['indexingModels_' + element].forEach((elem: any) => { this['indexingModels_' + element].forEach((elem: any) => {
...@@ -310,7 +321,7 @@ export class IndexingFormComponent implements OnInit { ...@@ -310,7 +321,7 @@ export class IndexingFormComponent implements OnInit {
} }
}); });
}), }),
finalize(() => this.loading = false), //finalize(() => this.loading = false),
catchError((err: any) => { catchError((err: any) => {
this.notify.handleErrors(err); this.notify.handleErrors(err);
return of(false); return of(false);
...@@ -339,7 +350,7 @@ export class IndexingFormComponent implements OnInit { ...@@ -339,7 +350,7 @@ export class IndexingFormComponent implements OnInit {
} }
}); });
}), }),
finalize(() => this.loading = false), //finalize(() => this.loading = false),
catchError((err: any) => { catchError((err: any) => {
this.notify.handleErrors(err); this.notify.handleErrors(err);
return of(false); return of(false);
...@@ -356,7 +367,7 @@ export class IndexingFormComponent implements OnInit { ...@@ -356,7 +367,7 @@ export class IndexingFormComponent implements OnInit {
tap((data: any) => { tap((data: any) => {
elem.values = data.categories; elem.values = data.categories;
}), }),
finalize(() => this.loading = false), //finalize(() => this.loading = false),
catchError((err: any) => { catchError((err: any) => {
this.notify.handleErrors(err); this.notify.handleErrors(err);
return of(false); return of(false);
...@@ -368,7 +379,7 @@ export class IndexingFormComponent implements OnInit { ...@@ -368,7 +379,7 @@ export class IndexingFormComponent implements OnInit {
tap((data: any) => { tap((data: any) => {
elem.values = data.priorities; elem.values = data.priorities;
}), }),
finalize(() => this.loading = false), //finalize(() => this.loading = false),
catchError((err: any) => { catchError((err: any) => {
this.notify.handleErrors(err); this.notify.handleErrors(err);
return of(false); return of(false);
...@@ -380,7 +391,7 @@ export class IndexingFormComponent implements OnInit { ...@@ -380,7 +391,7 @@ export class IndexingFormComponent implements OnInit {
tap((data: any) => { tap((data: any) => {
elem.values = data.categories; elem.values = data.categories;
}), }),
finalize(() => this.loading = false), //finalize(() => this.loading = false),
catchError((err: any) => { catchError((err: any) => {
this.notify.handleErrors(err); this.notify.handleErrors(err);
return of(false); return of(false);
...@@ -403,7 +414,7 @@ export class IndexingFormComponent implements OnInit { ...@@ -403,7 +414,7 @@ export class IndexingFormComponent implements OnInit {
} else if (doctype['description'] === undefined) { } else if (doctype['description'] === undefined) {
arrValues.push({ arrValues.push({
id: doctype.doctypes_second_level_id, id: doctype.doctypes_second_level_id,
label: doctype.doctypes_second_level_label, label: '&nbsp;&nbsp;&nbsp;&nbsp;' + doctype.doctypes_second_level_label,
disabled: true, disabled: true,
isTitle: true, isTitle: true,
color: doctype.css_style color: doctype.css_style
...@@ -412,7 +423,7 @@ export class IndexingFormComponent implements OnInit { ...@@ -412,7 +423,7 @@ export class IndexingFormComponent implements OnInit {
arrValues = arrValues.concat(data.structure.filter((info: any) => info.doctypes_second_level_id === doctype.doctypes_second_level_id && info.description !== undefined).map((info: any) => { arrValues = arrValues.concat(data.structure.filter((info: any) => info.doctypes_second_level_id === doctype.doctypes_second_level_id && info.description !== undefined).map((info: any) => {
return { return {
id: info.type_id, id: info.type_id,
label: info.description, label: '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;' + info.description,
disabled: false, disabled: false,
isTitle: false, isTitle: false,
} }
...@@ -421,7 +432,7 @@ export class IndexingFormComponent implements OnInit { ...@@ -421,7 +432,7 @@ export class IndexingFormComponent implements OnInit {
}); });
elem.values = arrValues; elem.values = arrValues;
}), }),
finalize(() => this.loading = false), //finalize(() => this.loading = false),
catchError((err: any) => { catchError((err: any) => {
this.notify.handleErrors(err); this.notify.handleErrors(err);
return of(false); return of(false);
...@@ -439,6 +450,8 @@ export class IndexingFormComponent implements OnInit { ...@@ -439,6 +450,8 @@ export class IndexingFormComponent implements OnInit {
loadForm(indexModelId: number) { loadForm(indexModelId: number) {
this.loading = true; this.loading = true;
this.availableFields = JSON.parse(JSON.stringify(this.availableFieldsClone));
this.fieldCategories.forEach(category => { this.fieldCategories.forEach(category => {
this['indexingModels_' + category] = []; this['indexingModels_' + category] = [];
}); });
...@@ -508,7 +521,7 @@ export class IndexingFormComponent implements OnInit { ...@@ -508,7 +521,7 @@ export class IndexingFormComponent implements OnInit {
this.initElemForm(); this.initElemForm();
this.createForm(); this.createForm();
}), }),
finalize(() => this.loading = false), //finalize(() => this.loading = false),
catchError((err: any) => { catchError((err: any) => {
this.notify.handleErrors(err); this.notify.handleErrors(err);
return of(false); return of(false);
......
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
<div *ngIf="noEntriesFoundLabel && value && _options?.length === 0 && datas.length > 5" class="mat-select-search-no-entries-found"> <div *ngIf="noEntriesFoundLabel && value && _options?.length === 0 && datas.length > 5" class="mat-select-search-no-entries-found">
{{lang.noResult}} {{lang.noResult}}
</div> </div>
<mat-option *ngIf="adminMode"></mat-option> <mat-option *ngIf="showResetOption"></mat-option>
<mat-option *ngFor="let value of filteredDatas | async" [value]="value.id" <mat-option *ngFor="let value of filteredDatas | async" [value]="value.id"
[title]="value.title !== undefined ? value.title : value.label" [disabled]="value.disabled" [title]="value.title !== undefined ? value.title : value.label" [disabled]="value.disabled"
[class.opt-group]="value.isTitle" [style.color]="value.color" [innerHTML]="value.label"> [class.opt-group]="value.isTitle" [style.color]="value.color" [innerHTML]="value.label">
......
...@@ -25,7 +25,8 @@ $multiple-check-width: 33px; ...@@ -25,7 +25,8 @@ $multiple-check-width: 33px;
::ng-deep.mat-select-search-panel { ::ng-deep.mat-select-search-panel {
/* allow absolute positioning relative to outer options container */ /* allow absolute positioning relative to outer options container */
transform: none !important; transform: none !important;
max-height: 350px; max-height: 350px !important;
max-width: inherit !important;
} }
.mat-select-search-input { .mat-select-search-input {
......
...@@ -4,7 +4,7 @@ import { ...@@ -4,7 +4,7 @@ import {
ViewChild, ViewChild,
Renderer2 Renderer2
} from '@angular/core'; } from '@angular/core';
import { ControlValueAccessor, NG_VALUE_ACCESSOR, FormControl } from '@angular/forms'; import { ControlValueAccessor, FormControl } from '@angular/forms';
import { MatOption, MatSelect } from '@angular/material'; import { MatOption, MatSelect } from '@angular/material';
import { take, takeUntil, startWith, map } from 'rxjs/operators'; import { take, takeUntil, startWith, map } from 'rxjs/operators';
import { Subject, ReplaySubject, Observable } from 'rxjs'; import { Subject, ReplaySubject, Observable } from 'rxjs';
...@@ -21,13 +21,11 @@ export class PluginSelectSearchComponent implements OnInit, OnDestroy, AfterView ...@@ -21,13 +21,11 @@ export class PluginSelectSearchComponent implements OnInit, OnDestroy, AfterView
/** Label of the search placeholder */ /** Label of the search placeholder */
@Input() placeholderLabel = this.lang.chooseValue; @Input() placeholderLabel = this.lang.chooseValue;
/** Label to be shown when no entries are found. Set to null if no message should be shown. */
@Input() noEntriesFoundLabel = 'Aucun résultat';
@Input('formControlSelect') formControlSelect: FormControl; @Input('formControlSelect') formControlSelect: FormControl;
@Input('datas') datas: any; @Input('datas') datas: any;
@Input('showResetOption') showResetOption: boolean;
/** Reference to the search input field */ /** Reference to the search input field */
@ViewChild('searchSelectInput', { read: ElementRef, static: true }) searchSelectInput: ElementRef; @ViewChild('searchSelectInput', { read: ElementRef, static: true }) searchSelectInput: ElementRef;
...@@ -118,42 +116,19 @@ export class PluginSelectSearchComponent implements OnInit, OnDestroy, AfterView ...@@ -118,42 +116,19 @@ export class PluginSelectSearchComponent implements OnInit, OnDestroy, AfterView
}); });
}); });
// detect changes when the input changes
/*this.change
.pipe(takeUntil(this._onDestroy))
.subscribe(() => {
this.changeDetectorRef.detectChanges();
});*/
setTimeout(() => { /*setTimeout(() => {
this.filteredDatas = this.formControlSearch.valueChanges
.pipe( }, 800);*/
startWith(''), this.filteredDatas = this.formControlSearch.valueChanges
map(value => this._filter(value)) .pipe(
); startWith(''),
}, 800); map(value => this._filter(value))
);
// this.initMultipleHandling(); // this.initMultipleHandling();
// load the initial bank list
//this.filteredDatas.next(this.datas.slice());
//this.filteredDatasMulti.next(this.datas.slice());
// listen for search field value changes
/*this.formControlSelect.valueChanges
.pipe(takeUntil(this._onDestroy))
.subscribe(() => {
this.filterDatas();
});*/
/*this.formControlSelect.valueChanges
.pipe(takeUntil(this._onDestroy))
.subscribe(() => {
this.filterDatasMulti();
});*/
} }
ngOnDestroy() { ngOnDestroy() {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment