Skip to content

Commit

Permalink
feat(SelfService): add translate update ui
Browse files Browse the repository at this point in the history
  • Loading branch information
huynvn97 committed Sep 30, 2024
1 parent 7fe0afa commit cae3731
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 25 deletions.
49 changes: 25 additions & 24 deletions src/app/components/self-service/self-service.component.html
Original file line number Diff line number Diff line change
@@ -1,33 +1,34 @@
<div *ngIf="app.user">
<div *ngIf="app.user" class="page-content-detail">
<h2 class="page-title mb-2" translate>Selfservice.Selfservice</h2>
<!--username-->
<app-inputfield type="string" name="Username" [value]="app.user['username']" [static]="true"></app-inputfield>
<app-inputfield type="string" name="{{'Common.Username' | translate}}" [value]="app.user['username']" [static]="true"></app-inputfield>

<!--Status-->
<app-inputfield type="string" name="Status" [value]="app.isExtern() ? 'extern: '+app.user.extern : 'intern'" [static]="true"></app-inputfield>
<app-inputfield class="mb-2" type="string" name="{{'Common.Status' | translate}}" [value]="app.isExtern() ? 'extern: '+app.user.extern : 'intern'" [static]="true"></app-inputfield>

<!--Password Change-->
<div *ngIf="!app.isExtern()">
<div *ngIf="!app.isExtern()" style="margin-top: 20px !important;">
<!--Password-->
<div class="card mb-3 ">
<div class="card mb-3 bg-surface">
<div class="card-header">
<h5>Change Password</h5>
<h5 translate>Selfservice.ChangePassword</h5>
</div>
<div class="card-body">
<label for="currentPassword">Enter current password</label>
<div class="input-group mb-3 col-lg-4 col-md-8">
<input type="password" class="form-control" placeholder="current password"
<label for="currentPassword" translate>Selfservice.EnterCurrentPassword</label>
<div class="input-group mb-3 mt-2 col-lg-4 col-md-8">
<input type="password" class="form-control" placeholder="{{'Selfservice.CurrentPassword' | translate}}"
name="currentPassword" [(ngModel)]="currentPassword">
</div>
<label for="newPassword">Enter new password</label>
<div class="input-group mb-3 col-lg-4 col-md-8">
<input type="password" class="form-control" placeholder="new password" name="newPassword"
<label for="newPassword" translate>Selfservice.EnterNewPassword</label>
<div class="input-group mb-3 mt-2 col-lg-4 col-md-8">
<input type="password" class="form-control" placeholder="{{'Selfservice.NewPassword' | translate}}" name="newPassword"
[(ngModel)]="newPassword">
</div>
<label for="newPasswordConfirm">Confirm new password</label>
<div class="input-group mb-3 col-lg-4 col-md-8">
<label for="newPasswordConfirm" translate>Selfservice.ConfirmNewPassword</label>
<div class="input-group mb-3 mt-2 col-lg-4 col-md-8">
<input type="password" class="form-control"
[class.input-success]="newPasswordConfirmed() && newPassword!=''"
[class.input-danger]="!newPasswordConfirmed() && newPassword!=''" placeholder="new password"
[class.input-danger]="!newPasswordConfirmed() && newPassword!=''" placeholder="{{'Selfservice.NewPassword' | translate}}"
name="newPassword" [(ngModel)]="newPasswordConfirm">
</div>
</div>
Expand All @@ -45,7 +46,7 @@ <h5>Change Password</h5>
<!--Attributes-->
<div class="card mb-3 px-2">
<div class="card-header mx-n2">
<h5>Attributes</h5>
<h5 translate>Common.Attributes </h5>
</div>
<div *ngFor="let attribute of app.user.attributes">
<div *ngIf="isArray(attribute.value) && attribute.key!=provider['mapping_key']">
Expand Down Expand Up @@ -99,7 +100,7 @@ <h5>Attributes</h5>

<div class="input-group my-2 col-xl-4 col-sm-12">
<input type="text" class="form-control" name="newAttributeValue"
placeholder="new Value"
placeholder="{{'Selfservice.NewValue' | translate}}"
[(ngModel)]="newAttributeValue [getIndex(attribute)]"
aria-describedby="basic-addon2">
<div class="input-group-append">
Expand Down Expand Up @@ -137,20 +138,20 @@ <h5>Attributes</h5>
(click)="addMappingKeyClaim()"><span class="fa fa-plus"></span></button>
</div>
</div>
<ngb-alert [dismissible]="false" [type]="'info'">
Do you want your new Attribute {{provider['mapping_key']}} to have one or multiple values?
<ngb-alert [dismissible]="false" [type]="'info'" translate>
{{ 'Selfservice.AskForNewAttributeWithMultiValues' | translate: { value: provider['mapping_key'] } }}
<div class="form-group" name="ValueNumber">
<div class="form-check">
<input class="form-check-input" type="radio" name="ValueNumber"
[(ngModel)]="simpleAttribute" id="oneValue" [value]="true" checked>
<label class="form-check-label" for="oneValue">
<label class="form-check-label" for="oneValue" translate>
One
</label>
</div>
<div class="form-check">
<input class="form-check-input" type="radio" name="ValueNumber"
[(ngModel)]="simpleAttribute" id="multipleValues" [value]="false">
<label class="form-check-label" for="multipleValues">
<label class="form-check-label" for="multipleValues" translate>
Multiple
</label>
</div>
Expand All @@ -164,10 +165,10 @@ <h5>Attributes</h5>
</div>

<!--Save Button-->
<div class="clearfix mt-5">
<button type="submit" class="btn btn-primary btn-save-and-cancel float-left me-5"
<div class="clearfix mt-5 d-flex justify-content-end pr-0">
<a href="./user" class="btn btn-outline-primary border-0 btn-save-and-cancel float-left btn-lg d-flex justify-content-center align-items-center">Cancel</a>
<button type="submit" class="btn btn-primary btn-save-and-cancel float-left btn-lg"
(click)="saveChanges()">Save</button>
<a href="./user" class="btn btn-primary btn-save-and-cancel float-left">Cancel</a>
</div>

<br />
Expand Down
17 changes: 16 additions & 1 deletion src/assets/i18n/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@
"EnterAttributeName": "Enter attribute's name",
"ShowAll": "Show all",
"ShowLess": "Show less",
"Add": "Add"
"Add": "Add",
"Username": "Username",
"Status": "Status"
},
"Langs": {
"en": "English",
Expand Down Expand Up @@ -37,5 +39,18 @@
"Username": "Username",
"Status": "Status"

},
"Selfservice": {
"Selfservice": "Selfservice",
"ChangePassword": "Change Password",
"EnterCurrentPassword": "Enter current password",
"CurrentPassword": "current password",
"EnterNewPassword": "Enter new password",
"NewPassword": "new password",
"ConfirmNewPassword": "Confirm new password",
"NewValue": "new Value",
"AskForNewAttributeWithMultiValues": "Do you want your new Attribute {{value}} to have one or multiple values?",
"One": "One",
"Multiple": "Multiple"
}
}

0 comments on commit cae3731

Please sign in to comment.