Skip to content
Snippets Groups Projects
profile.component.html 16.2 KiB
Newer Older
Alex ORLUC's avatar
Alex ORLUC committed
<div class="panel-container" *ngIf="this.signaturesService.sideNavRigtDatas.mode == 'profile'">
Alex ORLUC's avatar
Alex ORLUC committed
    <div *ngIf="loading"
        style="position: absolute;z-index: 2;display: flex;background: #fffc;width: 100%;height: 100%;justify-content: center;align-items: center;">
        <mat-spinner></mat-spinner>
    </div>
    <div class="panel-header">
        <div class="user">
            {{'lang.myProfil' | translate}}
        </div>
        <div #avatarProfile class="avatarProfile"
            [ngStyle]="{'background': 'url(' + this.avatarInfo.picture + ') no-repeat scroll center center / cover'}"
            (tap)="uploadFile.click();">
        </div>
        <input #uploadFile type="file" style="display:none;" (change)="handleFileInput($event.target.files)">
    </div>
    <div class="panel-content">
        <form (ngSubmit)="submitProfile()" #profileForm="ngForm">
Alex ORLUC's avatar
Alex ORLUC committed
            <mat-tab-group #tabProfile (selectedTabChange)="initProfileTab($event);"
                (swipeleft)="switchToleft(tabProfile)" (swiperight)="switchToRight(tabProfile)">
                <mat-tab label="{{'lang.informations' | translate}}">
                    <div class="profile-content">
                        <mat-form-field class="input-row">
                            <input name="login" matInput placeholder="{{'lang.login' | translate}}" type="text"
                                [(ngModel)]="profileInfo.login" (keyup)="newLogin.login=newLogin.login.toLowerCase()"
Alex ORLUC's avatar
Alex ORLUC committed
                                disabled required>
                        </mat-form-field>
                        <mat-form-field class="input-row">
                            <input name="email" matInput placeholder="{{'lang.email' | translate}}" type="mail"
                                [(ngModel)]="profileInfo.email"
                                pattern="(^[a-zA-Z0-9_.+-]+@[a-zA-Z0-9-]+\.[a-zA-Z0-9-.]+$)" required>
                        <mat-form-field class="input-row">
                            <input name="firstname" matInput placeholder="{{'lang.firstname' | translate}}"
                                [(ngModel)]="profileInfo.firstname" required>
                        </mat-form-field>
                        <mat-form-field class="input-row">
                            <input name="nom" matInput placeholder="{{'lang.lastname' | translate}}"
                                [(ngModel)]="profileInfo.lastname" required>
                        </mat-form-field>
                        <mat-accordion *ngIf="authService.authMode === 'default'">
                            <mat-expansion-panel (closed)="showPassword=false" (opened)="changePasswd()"
                                #passwordContent>
                                <mat-expansion-panel-header>
                                    <mat-panel-title>
                                        {{'lang.updatePassword' | translate}}
                                    </mat-panel-title>
                                    <mat-panel-description>
                                    </mat-panel-description>
                                </mat-expansion-panel-header>
                                <ng-container *ngIf="showPassword">
                                    <mat-form-field class="input-row">
                                        <input name="currentPassword" matInput [(ngModel)]="password.currentPassword"
                                            placeholder="{{'lang.currentPassword' | translate}}"
Alex ORLUC's avatar
Alex ORLUC committed
                                            [type]="hideCurrentPassword ? 'password' : 'text'">
                                        <mat-icon matSuffix (click)="hideCurrentPassword = !hideCurrentPassword"
                                            class="fa fa-2x"
                                            [ngClass]="[hideCurrentPassword ? 'fa-eye-slash' : 'fa-eye']"></mat-icon>
                                    </mat-form-field>
                                    <mat-form-field class="input-row">
                                        <input name="newPassword" matInput [(ngModel)]="password.newPassword"
                                            placeholder="{{'lang.newPassword' | translate}}"
Alex ORLUC's avatar
Alex ORLUC committed
                                            [type]="hideNewPassword ? 'password' : 'text'"
                                            (keyup)="checkPasswordValidity(password.newPassword)">
Alex ORLUC's avatar
Alex ORLUC committed
                                        <mat-icon matSuffix (click)="hideNewPassword = !hideNewPassword"
                                            class="fa fa-2x" [ngClass]="[hideNewPassword ? 'fa-eye-slash' : 'fa-eye']">
                                        </mat-icon>
                                        <mat-hint style="color:red;">{{handlePassword.errorMsg | translate}}</mat-hint>
                                    </mat-form-field>
                                    <mat-form-field class="input-row">
Alex ORLUC's avatar
Alex ORLUC committed
                                        <input name="passwordConfirmation" matInput
                                            [(ngModel)]="password.passwordConfirmation"
                                            placeholder="{{'lang.passwordConfirmation' | translate}}"
Alex ORLUC's avatar
Alex ORLUC committed
                                            [type]="hideNewPasswordConfirm ? 'password' : 'text'">
                                        <mat-icon matSuffix (click)="hideNewPasswordConfirm = !hideNewPasswordConfirm"
Alex ORLUC's avatar
Alex ORLUC committed
                                            class="fa fa-2x"
                                            [ngClass]="[hideNewPasswordConfirm ? 'fa-eye-slash' : 'fa-eye']"></mat-icon>
                                        <mat-hint style="color:red;"
                                            *ngIf="password.passwordConfirmation !== password.newPassword">
                                            {{'lang.passwordNotMatch' | translate}}</mat-hint>
Alex ORLUC's avatar
Alex ORLUC committed
                                        <mat-hint style="color:green;"
                                            *ngIf="password.passwordConfirmation === password.newPassword && password.newPassword.length > 0 && password.passwordConfirmation.length> 0">
                                            {{'lang.samePassword' | translate}}</mat-hint>
                                    </mat-form-field>
                                </ng-container>
                            </mat-expansion-panel>
                        </mat-accordion>
                    </div>
                </mat-tab>
                <mat-tab label="{{'lang.preferences' | translate}}">
                    <div class="profile-content">
                        <div class="input-row">
Alex ORLUC's avatar
Alex ORLUC committed
                            <fieldset>
                                <legend align="left">{{'lang.notifications' | translate}}</legend>
Alex ORLUC's avatar
Alex ORLUC committed
                                <div class="form-container">
                                    <div class="form-2-col">
                                        <mat-slide-toggle [checked]="this.preferenceInfo.notifications"
                                            (change)="this.preferenceInfo.notifications=!this.preferenceInfo.notifications"
                                            color="primary">{{'lang.receiveNotif' | translate}}</mat-slide-toggle>
Alex ORLUC's avatar
Alex ORLUC committed
                                    </div>
                                    <div class="form-2-col" style="text-align: justify;font-size: 12px;">

                                    </div>
                                </div>
                            </fieldset>
                        </div>
                        <div class="input-row">
                            <fieldset>
                                <legend align="left">{{'lang.language' | translate}}</legend>
Alex ORLUC's avatar
Alex ORLUC committed
                                <div class="form-container">
                                    <div class="form-2-col">
                                        <mat-form-field>
                                            <mat-select #langSelect name="langUser"
                                                [(ngModel)]="this.preferenceInfo.lang">
                                                <mat-option *ngFor="let lang of this.profileInfo['availableLanguages']"
                                                    [value]="lang">{{'lang.'+lang | translate }}</mat-option>
Alex ORLUC's avatar
Alex ORLUC committed
                                            </mat-select>
                                        </mat-form-field>
                                    </div>
                                    <div class="form-2-col" style="text-align: justify;font-size: 12px;">

Alex ORLUC's avatar
Alex ORLUC committed
                                </div>
                            </fieldset>
                        </div>
                        <div class="input-row">
Alex ORLUC's avatar
Alex ORLUC committed
                            <fieldset>
                                <legend align="left">{{'lang.annotationMode' | translate}}</legend>
Alex ORLUC's avatar
Alex ORLUC committed
                                <div class="form-container">
                                    <div class="form-2-col">
                                        <mat-form-field>
Alex ORLUC's avatar
Alex ORLUC committed
                                            <mat-select name="writingMode"
                                                [(ngModel)]="this.preferenceInfo.writingMode">
                                                <mat-option value="direct">{{'lang.free' | translate}}</mat-option>
                                                <mat-option value="stylus">{{'lang.appleStylus' | translate}} <i
                                                        class="fab fa-apple"></i>
Alex ORLUC's avatar
Alex ORLUC committed
                                                </mat-option>
Alex ORLUC's avatar
Alex ORLUC committed
                                            </mat-select>
                                        </mat-form-field>
                                    </div>
                                    <div *ngIf="this.preferenceInfo.writingMode == 'stylus'" class="form-2-col"
                                        style="text-align: justify;font-size: 12px;"
                                        [innerHTML]="'lang.freeModeInfo' | translate">
Alex ORLUC's avatar
Alex ORLUC committed
                                    </div>
                                    <div *ngIf="this.preferenceInfo.writingMode == 'direct'" class="form-2-col"
                                        style="text-align: justify;font-size: 12px;"
                                        [innerHTML]="'lang.standardModeInfo' | translate">
Alex ORLUC's avatar
Alex ORLUC committed
                                    </div>
Alex ORLUC's avatar
Alex ORLUC committed

                            </fieldset>
                        </div>
                        <div class="input-row">
Alex ORLUC's avatar
Alex ORLUC committed
                            <fieldset>
                                <legend align="left">{{'lang.stylusWidh' | translate}}</legend>
Alex ORLUC's avatar
Alex ORLUC committed
                                <div class="form-container">
                                    <div class="form-2-col">
                                        <mat-form-field>
Alex ORLUC's avatar
Alex ORLUC committed
                                            <mat-select name="writingSize"
                                                [(ngModel)]="this.preferenceInfo.writingSize"
Alex ORLUC's avatar
Alex ORLUC committed
                                                (selectionChange)="drawSample();">
Alex ORLUC's avatar
Alex ORLUC committed
                                                <mat-option *ngFor='let in of counter(10) ;let i = index' [value]="i+1">
                                                    {{i+1}}</mat-option>
Alex ORLUC's avatar
Alex ORLUC committed
                                            </mat-select>
                                        </mat-form-field>
                                    </div>
                                    <div class="form-2-col">
                                        <canvas id="sampleNote" width="150" height="150"></canvas>
                                    </div>
                                </div>
                            </fieldset>
                        </div>
                        <div class="input-row">
Alex ORLUC's avatar
Alex ORLUC committed
                            <fieldset style="display:table;">
                                <legend align="left">{{'lang.defaultColor' | translate}}</legend>
Alex ORLUC's avatar
Alex ORLUC committed
                                <div class="form-container">
                                    <div class="form-2-col">
                                        <mat-form-field>
Alex ORLUC's avatar
Alex ORLUC committed
                                            <mat-select name="writingColor"
                                                [(ngModel)]="this.preferenceInfo.writingColor">
                                                <mat-option style="color:#000000" value="#000000">
                                                    {{'lang.black' | translate}}</mat-option>
                                                <mat-option style="color:#1a75ff" value="#1a75ff">
                                                    {{'lang.blue' | translate}}</mat-option>
                                                <mat-option style="color:#FF0000" value="#FF0000">
                                                    {{'lang.red' | translate}}</mat-option>
Alex ORLUC's avatar
Alex ORLUC committed
                                            </mat-select>
                                        </mat-form-field>
                                    </div>
                                    <div class="form-2-col">
Alex ORLUC's avatar
Alex ORLUC committed
                                        <div style="height:50px;width:100px;margin:auto;"
                                            [style.backgroundColor]="this.preferenceInfo.writingColor">
Alex ORLUC's avatar
Alex ORLUC committed
                                        </div>
                                    </div>
                                </div>
                            </fieldset>
                        </div>
                    </div>
                </mat-tab>
                <mat-tab label="{{'lang.substitution' | translate}}">
                    <div class="profile-content">
                        <div class="input-row">
                            <fieldset>
                                <legend align="left">{{'lang.substitution' | translate}}</legend>
                                <div class="form-container">
                                    <div class="form-2-col">
                                        {{'lang.substitute' | translate}}
                                    </div>
                                    <div class="form-2-col">
                                        <mat-form-field style="width:100%">
                                            <mat-select placeholder="{{'lang.chooseSubstitute' | translate}}" name="usersList"
                                                [(ngModel)]="profileInfo.substitute" (selectionChange)="selectSubstitute($event)" (openedChange)="refreshUserList($event)">
                                                <ng-container *ngFor="let userRest of usersList">
                                                    <mat-option *ngIf="userRest.id !== profileInfo.id && !userRest.substitute"
                                                        [value]="userRest.id">
                                                        {{userRest.firstname}}
                                                        {{userRest.lastname}}</mat-option>
                                                </ng-container>
                                            </mat-select>
                                            <button matSuffix *ngIf="profileInfo.substitute != null" mat-icon-button type="button"
                                                (tap)="deleteSubstitute()" color="warn" title="{{'lang.deleteSubstitution' | translate}}">
                                                <mat-icon fontSet="fas" fontIcon="fa-times fa-2x"></mat-icon>
                                            </button>
                                        </mat-form-field>
                                    </div>
                                </div>
                            </fieldset>
                        </div>
                    </div>
                </mat-tab>
            </mat-tab-group>
            <span class="actions">
Alex ORLUC's avatar
Alex ORLUC committed
                <button class="validate" mat-button color="primary" type="submit"
                    [disabled]="allowValidate() || !profileForm.form.valid">{{
                            msgButton | translate}}</button>
                <button *ngIf="signaturesService.mobileMode" class="cancel" mat-icon-button type="button"
                    (tap)="closeProfile();">
                    <mat-icon fontSet="fas" fontIcon="fa-arrow-left fa-2x"></mat-icon>
                </button>
            </span>
        </form>
    </div>