
<div id="layout-wrapper">
    <div class="inner-pg-sp">
        <div class="container-fluid">
            
            <div *ngIf="isFirstLogin && firstTimeLoginForm" class="auth-page d-flex align-items-center">
                <div class="container">
                    <div class="row justify-content-center">
                        <div class="col-md-6 col-lg-5 col-xl-4">
                            <div class="bg-primary bg-soft text-center py-3 mt-2">
                                <img src="assets/images/logo.png" class="img-fluid mb-2" height="120" width="150" alt="Logo">
                            </div>
                                    <div class="card">
                                        <div class="card-header bg-primary bg-soft text-center py-3">
                                            <h5 class="mb-0 text-dark">{{'changePassword' | translate}}</h5>
                                        </div>
                                        <div class="card-body">
                                            <form [formGroup]="firstTimeLoginForm">
                                                <label for="newPassword" class="form-label">
                                                        {{"oldPassword" | translate}}<span class="mandatory">*</span>
                                                    </label>
                                                <div class="mb-3 w-100">
                                                    <div class="password-wrapper">
                                                        <input id="oldPassword" class="form-control" formControlName="oldPassword" type="{{passwordType}}"
                                                            placeholder="{{ 'oldPassword' | translate }}" appNoWhitespaces />
                                                        <app-password-hide-show #psh class="password-eye align-items-stretch" [showPassword]="true"
                                                            (onEyeClick)="togglePasswordType()"></app-password-hide-show>
                                                    </div>
                                                
                                                    <div class="text-danger"
                                                        *ngIf="firstTimeLoginForm.get('oldPassword')?.touched && firstTimeLoginForm.get('oldPassword')?.invalid">
                                                        {{ 'fieldRequired' | translate }}
                                                    </div>
                                                </div>
                                                <!-- New Password -->
                                                <div class="mb-3">
                                                    <label for="newPassword" class="form-label">
                                                        {{"newPasswordStatic" | translate}}<span class="mandatory">*</span>
                                                    </label>
                                                    <div class="w-100">
                                                        <div class="password-wrapper">
                                                        <input type="{{passwordType1}}" class="form-control" formControlName="newPassword" id="newPassword"
                                                            placeholder="{{'enterNewPassword' | translate}}" appNoWhitespaces>
                                                        <app-password-hide-show #psh1 [showPassword]="true" class="password-eye align-items-stretch"
                                                            (onEyeClick)="togglePasswordType1()">
                                                        </app-password-hide-show>
                                                        
                                                        </div>
                                                        <div class="text-danger" *ngIf="firstTimeLoginForm.get('newPassword')?.touched ">
                                                            <div *ngIf="firstTimeLoginForm.get('newPassword')?.hasError('required')">
                                                                {{ 'fieldRequired' | translate }}
                                                            </div>
                                                            <div *ngIf="firstTimeLoginForm.get('newPassword')?.hasError('pattern')">
                                                                {{ 'passwordPattern' | translate }}
                                                            </div>
                                                            <div *ngIf="firstTimeLoginForm.hasError('oldAndNewPasswordSame')">
                                                                {{'oldAndNewPass' | translate}}
                                                            </div>

                                                        </div>
                                                    </div>
                                                </div>
            
                                                <!-- Confirm Password -->
                                                <div class="mb-3">
                                                    <label for="confirmPassword" class="form-label">
                                                        {{"confirmPassword" | translate}}<span class="mandatory">*</span>
                                                    </label>
                                                    <div class="w-100">
                                                        <div class="password-wrapper">
                                                        <input type="{{passwordType2}}" class="form-control" formControlName="confirmPassword" id="confirmPassword"
                                                            placeholder="{{'confirmPassword' | translate}}" appNoWhitespaces>
                                                        <app-password-hide-show #psh2 [showPassword]="true" class="password-eye align-items-stretch"
                                                            (onEyeClick)="togglePasswordType2()">
                                                        </app-password-hide-show>
                                                        </div>
                                                        <div class="text-danger" *ngIf="firstTimeLoginForm.get('confirmPassword')?.touched ">
                                                            <div *ngIf="firstTimeLoginForm.get('confirmPassword')?.hasError('required')">
                                                                {{ 'fieldRequired' | translate }}
                                                            </div>

                                                            <div *ngIf="firstTimeLoginForm.hasError('passwordMismatch')">
                                                                {{ 'passwordsDoNotMatch' | translate }}
                                                            </div>
                                                        </div>
                                                    </div>
                                                </div>
            
                                                <!-- Submit Button -->
                                                <div class="mt-3 d-grid">
                                                    <button class="btn btn-primary waves-effect waves-light" (click)="onSubmit()" type="button">
                                                        {{'save' | translate}}
                                                    </button>
                                                </div>
                                            </form>
                                        </div>
                                    </div>
                                </div>
                            
                    </div>
                </div>
            </div>
            
            <div *ngIf="!isFirstLogin && changePasswordForm" class="full-width-page">
               <div class="row">
                    <div class="col-12">
                        <div class="d-sm-flex align-items-center justify-content-between navbar-header p-0">
    
                        </div>
                    </div>
                </div>
            
            
            <div class="container-fluid">
                <div class="col-xl-12 mt-4">
                    <div class="card border">

                         
                        <div class="card-body">
                            
                            <div class="table-section">
                                <div class="row">
                                    <div class="col-lg-12">
                                        <div class="card-body mt-2 p-0">
                                            <div class="card mb-0 mt-2">
                                                <div
                                                    class="card-header font-edit-13-child d-flex justify-content-between align-items-center">
                                                    {{'changePassword' | translate}}
                                                </div>
                                                <div class="card-body">
                                                    
                                                    <form [formGroup]="changePasswordForm">
                                                         <div class="row g-3 mb-3">
                                                            <div class="col-md-6">
                                                                <div class="d-flex align-items-center gap-2">
                                                                    <label for="oldPassword" class="text-nowrap">
                                                                        {{ 'oldPassword' | translate }}<span
                                                                            class="mandatory">*</span>
                                                                    </label>
                                                                    <div class="w-100">
                                                                        <div class="password-wrapper">
                                                                        <input type="text" id="oldPassword"
                                                                            class="form-control"
                                                                            formControlName="oldPassword"
                                                                            type="{{passwordType}}"
                                                                            placeholder="{{ 'oldPassword' | translate }}" appNoWhitespaces
                                                                            />
                                                                             <app-password-hide-show #psh class="password-eye align-items-stretch" [showPassword]="true" (onEyeClick)="togglePasswordType()"></app-password-hide-show>
                                                                             </div>
                                                                      
                                                                        <div class="text-danger" *ngIf="changePasswordForm.get('oldPassword')?.touched ">
                                                                            <div *ngIf="changePasswordForm.get('oldPassword')?.hasError('required')">
                                                                                {{ 'fieldRequired' | translate }}
                                                                            </div>
                                                                        
                                                                            <div *ngIf="changePasswordForm.get('oldPassword')?.hasError('pattern')">
                                                                                {{ 'passwordPattern' | translate }}
                                                                            </div>
                                                                        </div>
                                                                    </div>
                                                                </div>
                                                            </div>
                                                            <div class="col-md-6">
                                                                <div class="d-flex align-items-start gap-2">
                                                                    <label for="newPassword"
                                                                        class="text-nowrap mt-2">
                                                                        {{ 'enterNewPassword' | translate }}<span
                                                                            class="mandatory">*</span>
                                                                    </label>
                                                                    <div class="w-100">
                                                                        <div class="password-wrapper">
                                                                        <input id="newPassword" class="form-control" formControlName="newPassword" type="{{passwordType1}}" maxlength="500"
                                                                            placeholder="{{ 'enterNewPassword' | translate }}" appNoWhitespaces rows="3" />
                                                                        <app-password-hide-show #psh1 class="password-eye align-items-stretch" [showPassword]="true"
                                                                            (onEyeClick)="togglePasswordType1()"></app-password-hide-show>
                                                                            </div>
                                                                    
                                                                       <div class="text-danger" *ngIf="changePasswordForm.get('newPassword')?.touched ">
                                                                            <div *ngIf="changePasswordForm.get('newPassword')?.hasError('required')">
                                                                                {{ 'fieldRequired' | translate }}
                                                                            </div>
                                                                        
                                                                            <div *ngIf="changePasswordForm.get('newPassword')?.hasError('pattern')">
                                                                                {{ 'passwordPattern' | translate }}
                                                                            </div>
                                                                            <div *ngIf="changePasswordForm.hasError('oldAndNewPasswordSame')">
                                                                                {{'oldAndNewPass' | translate}}
                                                                            </div>


                                                                            </div>
                                                                        
                                                                    </div>
                                                                </div>
                                                            </div>

                                                        </div>
                                                         <div class="row g-3 mb-3">
                                                             <div class="col-md-6">
                                                                <div class="d-flex align-items-center gap-2">
                                                                    <label for="confirmPassword" class="text-nowrap">
                                                                        {{ 'confirmPassword' | translate }}<span
                                                                            class="mandatory">*</span>
                                                                    </label>
                                                                    <div class="w-100">
                                                                        <div class="password-wrapper">
                                                                        <input id="confirmPassword" class="form-control" formControlName="confirmPassword" type="{{passwordType2}}"
                                                                            maxlength="500" placeholder="{{ 'confirmPassword' | translate }}" appNoWhitespaces rows="3" />
                                                                        <app-password-hide-show #psh2 class="password-eye align-items-stretch" [showPassword]="true"
                                                                            (onEyeClick)="togglePasswordType2()"></app-password-hide-show>
                                                                            </div>
                                                                    
                                                                        <div class="text-danger" *ngIf="changePasswordForm.get('confirmPassword')?.touched ">
                                                                            <div *ngIf="changePasswordForm.get('confirmPassword')?.hasError('required')">
                                                                                {{ 'fieldRequired' | translate }}
                                                                            </div>
                                                                        
                                                                            <div *ngIf="changePasswordForm.get('confirmPassword')?.hasError('pattern')">
                                                                                {{ 'passwordPattern' | translate }}
                                                                            </div>

                                                                            <div *ngIf="changePasswordForm.hasError('passwordMismatch')">
                                                                                 {{ 'passwordsDoNotMatch' | translate }}
                                                                            </div>
                                                                        </div>
                                                                    </div>
                                                                    
                                                                </div>
                                                            </div>
                                                            <div class="col-md-6">
                                                                
                                                            </div>
                                                        </div>
                                                         <div class="row g-3 mb-3">
                                                            <div class="col-md-6 ms-auto text-end">
                                                                <button
                                                                    class="btn btn-primary waves-effect waves-light"
                                                                    (click)="onSubmit()"
                                                                    [disabled]="changePasswordForm.invalid"
                                                                    >{{'save' | translate}}</button>
                                                               
                                                               
                                                            </div>
                                                        </div>

                                                      
                                                    </form>
                                                </div>
                                                
                                            </div>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
            </div>
        </div>
    </div>
</div>
