<div class="content-grid mdl-grid content-layout login-content"
    [style.background-image]="'url(' + (backgroundImageUrl || baseComponentPath + '/../assets/images/background.svg') + ')'">
    <div class="login-card-wide mdl-card mdl-shadow--4dp">
        <form [formGroup]="form" (submit)="onSubmit(form.value, $event)">
            <div class="mdl-card__title alfresco-logo">
                <img class="center" [src]="logoImageUrl || baseComponentPath + '/../assets/images/alfresco-logo.svg'" alt="{{'LOGIN.LOGO' | translate }}">
            </div>
            <div class="mdl-card__supporting-text">
                <div>
                    <div *ngIf="error" id="login-error" data-automation-id="login-error"
                         class="error mdl-card__supporting-text">{{errorMsg | translate }}</div>
                    <div *ngIf="success" id="login-success" data-automation-id="login-success" class="mdl-card__supporting-text" style="color: blue;">{{'LOGIN.MESSAGES.LOGIN-SUCCESS' | translate }}</div>
                </div>
                <div [ngClass]="{'is-invalid': isErrorStyle(form.controls.username)}"
                     class="center mdl-textfield mdl-js-textfield mdl-textfield--floating-label ">
                    <label for="username" class="mdl-textfield__label">{{'LOGIN.LABEL.USERNAME' | translate }}</label>
                    <input
                        type="text"
                        class="mdl-textfield__input"
                        id="username"
                        data-automation-id="username"
                        [formControl]="form.controls['username']"
                        tabindex="1"
                        autocapitalize="none"/>
                    <span class="mdl-tooltip--validation" for="username" *ngIf="formError.username">
                            <span id="username-error" class="mdl-textfield__error" style="visibility: visible" data-automation-id="username-error">{{formError.username | translate }}</span>
                    </span>
                </div>
                <div class="center mdl-textfield mdl-js-textfield mdl-textfield--floating-label alfresco-login__password">
                    <i [ngClass]="{hide: isPasswordShow}" [ngClass]="{show: !isPasswordShow}" (click)="toggleShowPassword()" data-automation-id="show_password"
                       class="icon-inline">
                        <svg style="width:24px;height:24px;float: right;" viewBox="0 0 24 24">
                            <path fill="#000000" d="M12,9A3,3 0 0,0 9,12A3,3 0 0,0 12,15A3,3 0 0,0 15,12A3,3 0 0,0 12,9M12,17A5,5 0 0,1 7,12A5,5 0 0,1 12,7A5,5 0 0,1 17,12A5,5 0 0,1 12,17M12,4.5C7,4.5 2.73,7.61 1,12C2.73,16.39 7,19.5 12,19.5C17,19.5 21.27,16.39 23,12C21.27,7.61 17,4.5 12,4.5Z" />
                        </svg>
                    </i>
                    <i [ngClass]="{hide: !isPasswordShow}" [ngClass]="{show: isPasswordShow}" (click)="toggleShowPassword()" data-automation-id="hide_password"
                       class="icon-inline">
                        <svg style="width:24px;height:24px;float: right;" viewBox="0 0 24 24">
                            <path fill="#000000" d="M11.83,9L15,12.16C15,12.11 15,12.05 15,12A3,3 0 0,0 12,9C11.94,9 11.89,9 11.83,9M7.53,9.8L9.08,11.35C9.03,11.56 9,11.77 9,12A3,3 0 0,0 12,15C12.22,15 12.44,14.97 12.65,14.92L14.2,16.47C13.53,16.8 12.79,17 12,17A5,5 0 0,1 7,12C7,11.21 7.2,10.47 7.53,9.8M2,4.27L4.28,6.55L4.73,7C3.08,8.3 1.78,10 1,12C2.73,16.39 7,19.5 12,19.5C13.55,19.5 15.03,19.2 16.38,18.66L16.81,19.08L19.73,22L21,20.73L3.27,3M12,7A5,5 0 0,1 17,12C17,12.64 16.87,13.26 16.64,13.82L19.57,16.75C21.07,15.5 22.27,13.86 23,12C21.27,7.61 17,4.5 12,4.5C10.6,4.5 9.26,4.75 8,5.2L10.17,7.35C10.74,7.13 11.35,7 12,7Z" />
                        </svg>
                    </i>
                    <label for="password" class="mdl-textfield__label">{{'LOGIN.LABEL.PASSWORD' | translate }}</label>
                    <input type="password" class="mdl-textfield__input" id="password" data-automation-id="password" [formControl]="form.controls['password']" tabindex="2" />
                    <span class="mdl-tooltip--validation" for="password" *ngIf="formError.password">
                            <span id="password-required" class="mdl-textfield__error" style="visibility: visible" data-automation-id="password-required">{{formError.password | translate }}</span>
                    </span>
                </div>
                <br>
                <button type="submit" id="login-button" tabindex="3"
                        class="center mdl-button mdl-js-button mdl-button--raised mdl-js-ripple-effect mdl-button--colored"
                        data-automation-id="login-button" [disabled]="!form.valid">{{'LOGIN.BUTTON.LOGIN' | translate }}</button>
                <br>
                <div class="center">
                    <label class=" mdl-checkbox mdl-js-checkbox mdl-js-ripple-effect" for="remember">
                        <input type="checkbox" id="remember" class="center mdl-checkbox__input">
                        <span id="login-remember" class="mdl-checkbox__label">{{'LOGIN.LABEL.REMEMBER' | translate }}</span>
                    </label>
                </div>
            </div>
            <div class="mdl-card__actions mdl-card--border mdl-card__link">
                <div class="login-action">
                    <div id="login-action-help" class="login-action-left"> <a href="">{{'LOGIN.ACTION.HELP' | translate }}</a> </div>
                    <div id="login-action-register" class="login-action-right"> <a href="">{{'LOGIN.ACTION.REGISTER' | translate }}</a>
                    </div>
                </div>
            </div>
            <div class="mdl-card__menu">
                <div class="mdl-spinner mdl-js-spinner"></div>
            </div>
        </form>
    </div>
</div>
