Skip to content
Snippets Groups Projects
indexing-form.component.html 15.2 KiB
Newer Older
  • Learn to ignore specific revisions
  • <div *ngIf="loading" style="display:flex;height:100%;">
        <mat-spinner style="margin:auto;"></mat-spinner>
    </div>
    <ng-container *ngIf="!loading">
    
        <div *ngIf="!adminMode"
            style="display: flex;align-items: center;justify-content: flex-end;margin-top: 10px;margin-bottom: -20px;">
    
            <button mat-button class="categoryLabel" (click)="toggleMailTracking()"
    
                [title]="arrFormControl['mail­tracking'].value ? lang.untrackThisMail : lang.trackThisMail">
    
                {{arrFormControl['mail­tracking'].value ? lang.untrackThisMail : lang.trackThisMail}}
    
                <mat-icon color="primary" class="{{this.arrFormControl['mail­tracking'].value ? 'fas':'far'}} fa-star"
                    style="font-size: 20px;"></mat-icon>
    
        <ng-container *ngFor="let category of fieldCategories">
    
            <div *ngIf="this['indexingModels_'+category].length > 0 || adminMode" class="banner"
                [style.borderColor]="currentPriorityColor">
                <div class="title" [style.color]="currentPriorityColor">
    
                    {{lang[category] | uppercase}} <small *ngIf="category === 'mail'"
                        [title]="lang.category_id">{{lang['indexing_' + currentCategory] | titlecase}}</small>
    
                    <div class="title-divider"></div>
                </div>
                <div class="content">
                    <div cdkDropList id="indexingModelsCustomFieldsList_{{category}}"
    
    Alex ORLUC's avatar
    Alex ORLUC committed
                        [cdkDropListConnectedTo]="['indexingModelsCustomFieldsList_mail','indexingModelsCustomFieldsList_contact','indexingModelsCustomFieldsList_process','indexingModelsCustomFieldsList_classifying','customFieldsList','fieldsList']"
    
                        [cdkDropListData]="this['indexingModels_'+category]" [cdkDropListDisabled]="!adminMode"
                        (cdkDropListDropped)="drop($event)" class="indexingModelsCustomFieldsList"
                        style="min-height: 50px;">
                        <ng-container *ngFor="let field of this['indexingModels_'+category];let i=index">
                            <div class="fieldRow" *ngIf="field.unit === category" cdkDrag cdkDragLockAxis="y"
                                [cdkDragData]="field">
    
                                <div class="fieldLabel" *ngIf="(!adminMode && !appService.getViewMode()) || adminMode">
    
                                    <i *ngIf="adminMode" [title]="lang.move" class="fas fa-bars fa-2x" color="primary"
                                        style="cursor: move" cdkDragHandle></i>&nbsp;
    
                                    {{field.label}}
                                    <button *ngIf="adminMode && !field.system" mat-icon-button
                                        [matMenuTriggerFor]="fieldActions">
                                        <mat-icon class="fa fa-ellipsis-v" color="secondary"></mat-icon>
    
                                    <mat-menu #fieldActions="matMenu">
                                        <button mat-menu-item (click)="field.mandatory = !field.mandatory">
                                            <span *ngIf="!field.mandatory">{{lang.mandatoryField}}</span>
                                            <span *ngIf="field.mandatory">{{lang.optionalField}}</span>
                                        </button>
                                        <mat-divider></mat-divider>
                                        <button mat-menu-item (click)="removeItem('indexingModels_'+category,field,i)">
                                            <mat-icon class="fa fa-trash" color="warn"></mat-icon>
                                            <span>{{lang.delete}}</span>
                                        </button>
                                    </mat-menu>
                                </div>
                                <div class="fieldInput" [class.checkboxInput]="field.type === 'checkbox'">
                                    <ng-container *ngIf="field.type === 'string'">
    
                                        <mat-form-field class="input-form"
                                            [floatLabel]="appService.getViewMode() ? '' : 'never'">
    
                                            <mat-label *ngIf="appService.getViewMode()">{{field.label}}</mat-label>
    
                                            <textarea matInput [formControl]="arrFormControl[field.identifier]"
                                                [placeholder]="!adminMode ? lang.typeValue : lang.defaultValue"
                                                matTextareaAutosize matAutosizeMinRows="1"
                                                cdkAutosizeMaxRows="6"></textarea>
                                        </mat-form-field>
                                    </ng-container>
                                    <ng-container *ngIf="field.type === 'integer'">
    
                                        <mat-form-field class="input-form"
                                            [floatLabel]="appService.getViewMode() ? '' : 'never'">
    
                                            <mat-label *ngIf="appService.getViewMode()">{{field.label}}</mat-label>
    
                                            <input type="number" matInput [formControl]="arrFormControl[field.identifier]"
    
                                                [placeholder]="!adminMode ? lang.typeValue : lang.defaultValue" min="0"
                                                step="0.1">
    
                                        </mat-form-field>
                                    </ng-container>
                                    <ng-container *ngIf="field.type === 'select'">
    
                                        <plugin-select-search [showResetOption]="adminMode" [label]="field.label"
    
                                            [placeholderLabel]="!adminMode ? lang.chooseValue : lang.defaultValue"
    
                                            [formControlSelect]="arrFormControl[field.identifier]" [datas]="field.values"
                                            (afterSelected)="launchEvent($event, field)" style="width:100%;">
                                        </plugin-select-search>
    
                                    </ng-container>
                                    <ng-container *ngIf="field.type === 'date'">
                                        <button mat-button color="primary" *ngIf="adminMode" matPrefix mat-icon-button
                                            (click)="$event.stopPropagation();toggleTodayDate(field);"
    
    Alex ORLUC's avatar
    Alex ORLUC committed
                                            [matTooltip]="lang.todayDate" 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]="appService.getViewMode() ? '' : 'never'" (click)="picker.open()"
                                            style="cursor:pointer;">
    
                                            <mat-label *ngIf="appService.getViewMode()">{{field.label}}</mat-label>
    
                                            <input [formControl]="arrFormControl[field.identifier]" matInput
                                                [matDatepicker]="picker"
                                                [placeholder]="!adminMode ? lang.chooseDate : lang.defaultValue"
    
                                                [min]="getMinDate(field.startDate)" [max]="getMaxDate(field.endDate)"
    
                                                readonly style="cursor:pointer;" (dateChange)="launchEvent($event, field)">
    
                                            <mat-datepicker-toggle matSuffix [for]="picker"
                                                *ngIf="!arrFormControl[field.identifier].value">
    
                                            <mat-datepicker [touchUi]="appService.getViewMode()" #picker></mat-datepicker>
    
                                            <button mat-button color="warn" matSuffix mat-icon-button
                                                *ngIf="arrFormControl[field.identifier].value && !arrFormControl[field.identifier].disabled"
                                                (click)="$event.stopPropagation();arrFormControl[field.identifier].reset();"
    
    Alex ORLUC's avatar
    Alex ORLUC committed
                                                [title]="lang.eraseValue">
    
                                                <mat-icon color="warn" class="fa fa-calendar-times">
    
                                                </mat-icon>
                                            </button>
    
                                        </mat-form-field>
                                    </ng-container>
                                    <ng-container *ngIf="field.type === 'radio'">
    
                                        <mat-form-field class="input-form input-radio"
                                            [floatLabel]="appService.getViewMode() ? '' : 'never'">
                                            <mat-label *ngIf="appService.getViewMode()">{{field.label}}</mat-label>
                                            <input matInput style="display: none;">
                                            <mat-radio-group class="radio-form" color="primary"
                                                [formControl]="arrFormControl[field.identifier]">
                                                <mat-radio-button *ngFor="let value of field.values" [value]="value">
                                                    {{value}}
                                                </mat-radio-button>
                                            </mat-radio-group>
                                        </mat-form-field>
    
                                    </ng-container>
                                    <ng-container *ngIf="field.type === 'checkbox'">
                                        <div class="input-form checkbox-form">
                                            <mat-selection-list #shoes class="div-list"
                                                [formControl]="arrFormControl[field.identifier]">
                                                <mat-list-option *ngFor="let value of field.values" [value]="value"
                                                    checkboxPosition="before">
                                                    {{value}}
                                                </mat-list-option>
                                            </mat-selection-list>
                                        </div>
                                        <mat-chip-list class="checkbox-selected-list"
                                            [disabled]="field.system && adminMode">
                                            <mat-chip *ngFor="let chip of shoes.selectedOptions.selected" selected>
                                                {{chip.value}}
                                            </mat-chip>
                                        </mat-chip-list>
                                    </ng-container>
    
                                    <!--<ng-container *ngIf="field.type === 'autocomplete'">
    
                                        <plugin-autocomplete [labelPlaceholder]="lang.searchValue"
                                            [routeDatas]="[field.values[0]]" [targetSearchKey]="'idToDisplay'"
                                            [size]="'small'" [control]="arrFormControl[field.identifier]"
    
                                            [manageDatas]="!adminMode ? field.values[1] : undefined" style="width:100%;">
                                        </plugin-autocomplete>
    
    Alex ORLUC's avatar
    Alex ORLUC committed
                                    <ng-container *ngIf="field.identifier === 'folders'">
    
                                        <app-folder-input [control]="arrFormControl[field.identifier]" style="width:100%;">
                                        </app-folder-input>
    
                                    <ng-container *ngIf="field.identifier === 'tags'">
                                        <app-tag-input [control]="arrFormControl[field.identifier]" style="width:100%;">
                                        </app-tag-input>
                                    </ng-container>
    
                                </div>
                                <div class="fieldState">
                                    <i class="fas fa-asterisk"
                                        *ngIf="adminMode || (arrFormControl[field.identifier].hasError('required') && arrFormControl[field.identifier].untouched)"
                                        [class.noMandatory]="!field.mandatory"></i>
                                    <i class="fas fa-times" style="color:red;font-size:15px;"
                                        *ngIf="!adminMode && arrFormControl[field.identifier].touched && arrFormControl[field.identifier].hasError('required')"></i>
                                    <i class="fas fa-check" style="color:green;font-size:15px;"
    
                                        *ngIf="!adminMode && arrFormControl[field.identifier].valid && !isEmptyField(field)"></i>
    
                            <div *ngIf="field.identifier === 'destination' && !adminMode && arrFormControl['destination'].value > 0">
    
                                <mat-divider></mat-divider>
                                <div style="padding: 10px;font-size: 16px;color: #135F7F;letter-spacing: 2px;font-weight: bold;display: flex;
                                    align-items: center;">
                                    <div style="display: flex;flex: 1;align-items: center;">
    
                                        {{lang.diffusionList}} <button mat-icon-button  *ngIf="appDiffusionsList.canUpdateRoles()" color="primary"
    
                                                (click)="appDiffusionsList.switchMode()" [title]="lang.modifyDiffusionList">
    
                                                <mat-icon class="fa fa-edit"></mat-icon>
                                            </button>
                                    </div>
                                    <div class="fieldState" style="width: 20px;padding: 0px;">
                                        <i class="fas fa-asterisk"
                                            *ngIf="adminMode || (arrFormControl['diffusionList'].hasError('required') && arrFormControl['diffusionList'].untouched)"
                                            [class.noMandatory]="!field.mandatory"></i>
                                        <i class="fas fa-times" style="color:red;font-size:15px;"
                                            *ngIf="!adminMode && arrFormControl['diffusionList'].touched && arrFormControl['diffusionList'].hasError('required')"></i>
                                        <i class="fas fa-check" style="color:green;font-size:15px;"
                                            *ngIf="!adminMode && arrFormControl['diffusionList'].valid && !isEmptyField(field)"></i>
                                    </div>
                                </div>
    
                                <app-diffusions-list #appDiffusionsList [entityId]="arrFormControl[field.identifier].value" [diffFormControl]="arrFormControl['diffusionList']" [allowedEntities]="field.allowedEntities" [target]="'indexation'" (triggerEvent)="changeDestination($event,field.allowedEntities)">
    
                                </app-diffusions-list>
                                <mat-divider></mat-divider>
                            </div>
    
    </ng-container>