Newer
Older
<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['mailtracking'].value ? lang.untrackThisMail : lang.trackThisMail">
{{arrFormControl['mailtracking'].value ? lang.untrackThisMail : lang.trackThisMail}}
<mat-icon color="primary" class="{{this.arrFormControl['mailtracking'].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'" style="font-size: 50%;padding-right: 10px;" [title]="lang.category_id">{{lang['indexing_' + currentCategory]}}</small>
<div class="title-divider"></div>
</div>
<div class="content">
<div cdkDropList id="indexingModelsCustomFieldsList_{{category}}"
[cdkDropListConnectedTo]="['indexingModelsCustomFieldsList_mail','indexingModelsCustomFieldsList_contact','indexingModelsCustomFieldsList_process','indexingModelsCustomFieldsList_classement','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>
{{field.label}}
<button *ngIf="adminMode && !field.system" mat-icon-button
[matMenuTriggerFor]="fieldActions">
<mat-icon class="fa fa-ellipsis-v" color="secondary"></mat-icon>

Alex ORLUC
committed
</button>
<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);"
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]="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;">
<mat-datepicker-toggle matSuffix [for]="picker"
*ngIf="!arrFormControl[field.identifier].value">
</mat-datepicker-toggle>
<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();"
<mat-icon color="warn" class="fa fa-calendar-times">
</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>
</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 && (arrFormControl[field.identifier].value!==null && arrFormControl[field.identifier].value!=='')"></i>
</div>
</ng-container>
</div>

Alex ORLUC
committed
</div>
</ng-container>