added turkish and german languages

This commit is contained in:
Diamantis Tziotzios 2020-07-22 13:51:10 +03:00
parent 8d7d9c5a8b
commit cd554dc1d1
7 changed files with 2495 additions and 271 deletions

View File

@ -1,72 +0,0 @@
<div class="form-container">
<form *ngIf="formGroup" [formGroup]="formGroup" class="m-0">
<div class="row d-flex justify-content-end m-0" (click)="closeDialog()">
<mat-icon class="close-icon">close</mat-icon>
</div>
<div class="row m-0">
<h1 mat-dialog-title class="title">{{'DMP-LISTING.ACTIONS.INVITE-AUTHORS' | translate}}</h1>
</div>
<div mat-dialog-content class="row content">
<mat-form-field class="col pt-0 pb-2 mb-4" appearance="standard">
<app-multiple-auto-complete [formControl]="formGroup.get('users')"
placeholder="{{'INVITATION-EDITOR.AUTOCOMPLETE-USER-EMAIL' | translate}}"
[configuration]="usersAutoCompleteConfiguration">
</app-multiple-auto-complete>
</mat-form-field>
<div class="col-12 d-flex justify-content-end align-items-center row m-0 pr-0">
<mat-form-field class="select-role" floatLabel="never">
<mat-label>{{'DMP-LISTING.MEMBER' | translate}}</mat-label>
<mat-select [formControl]="formGroup.get('role')">
<mat-option *ngFor="let roleName of roleNames | keyvalue" selected [value]="roles[roleName.value]">
{{ roleName.value }}
</mat-option>
</mat-select>
</mat-form-field>
<button mat-raised-button (click)="send()" type="button"
class="invite-btn">{{'DMP-LISTING.ACTIONS.INVITE-SHORT' | translate}}</button>
</div>
</div>
</form>
</div>
<!-- <form *ngIf="formGroup" [formGroup]="formGroup">
<h1 mat-dialog-title>{{'INVITATION-EDITOR.TITLE' | translate}} {{data.dmpName}}</h1>
<div mat-dialog-content> -->
<!-- User -->
<!-- <mat-form-field class="col">
<app-multiple-auto-complete [formControl]="formGroup.get('users')"
placeholder="{{'INVITATION-EDITOR.AUTOCOMPLETE-USER' | translate}}"
[configuration]="usersAutoCompleteConfiguration">
</app-multiple-auto-complete>
</mat-form-field> -->
<!-- Email -->
<!-- <mat-form-field class="example-chip-list col">
<mat-chip-list #chipList>
<mat-chip *ngFor="let email of emails" [selectable]="selectable" [removable]="removable"
(removed)="remove(email)">
{{email}}
<mat-icon matChipRemove *ngIf="removable">cancel</mat-icon>
</mat-chip>
<input placeholder="{{'INVITATION-EDITOR.AUTOCOMPLETE-EMAIL' | translate}}" [matChipInputFor]="chipList"
[matChipInputSeparatorKeyCodes]="separatorKeysCodes" [matChipInputAddOnBlur]="addOnBlur"
(matChipInputTokenEnd)="add($event)">
</mat-chip-list>
</mat-form-field> -->
<!-- <mat-form-field class="col">
<app-multiple-auto-complete required='false' [formControl]="formGroup.get('users').get('email')"
placeholder="{{'INVITATION-EDITOR.AUTOCOMPLETE-EMAIL' | translate}}"
[configuration]="emailAutoCompleteConfiguration" ()>
</app-multiple-auto-complete>
<mat-error *ngIf="formGroup.get('users').hasError('required')">{{'GENERAL.VALIDATION.REQUIRED' | translate}}
</mat-error>
</mat-form-field> -->
<!-- <div class="col-12 d-flex">
<button mat-raised-button color="primary" (click)="send()" type="button" class="ml-auto">{{'INVITATION-EDITOR.ACTIONS.SEND-INVITATION' | translate}}</button>
</div>
</div>
</form> -->

View File

@ -1,71 +0,0 @@
.form-container {
width: 33em;
min-height: 14em;
padding: 0.28em 0.34em 0.875em 1.125em;
}
.close-icon {
cursor: pointer;
}
.title {
font-size: 2.375em;
font-weight: lighter;
color: #000000;
opacity: 0.8;
margin-bottom: 0.842em;
}
.content {
width: 31em;
margin: 0px;
padding: 0px;
}
.mat-form-field {
background: #FAFAFA;
border: 1px solid #D1D1D1;
border-radius: 4px;
}
::ng-deep .mat-dialog-container {
border-radius: 8px;
}
::ng-deep .mat-form-field-underline {
display: none;
}
::ng-deep .mat-form-field-wrapper {
padding: 0em !important;
}
::ng-deep .mat-form-field-infix {
border: none;
}
::ng-deep .align-arrow-right {
display: none;
}
.invite-btn {
width: 6.64em;
height: 2.93em;
background: #FFFFFF;
border: 1px solid #B5B5B5;
border-radius: 30px;
font-weight: bold;
letter-spacing: -0.35px;
color: #B5B5B5;
margin-bottom: 0.25em;
}
.select-role {
width: 16% !important;
font-size: 14px;
color: #848484;
height: min-content;
margin-right: 2.5rem;
border: none;
background-color: transparent;
}

View File

@ -1,127 +0,0 @@
import { COMMA, ENTER } from '@angular/cdk/keycodes';
import { Component, Inject, OnInit, ViewChild } from '@angular/core';
import { FormGroup } from '@angular/forms';
import { MatChipInputEvent } from '@angular/material/chips';
import { MatDialogRef, MAT_DIALOG_DATA } from '@angular/material/dialog';
import { ActivatedRoute, Router } from '@angular/router';
import { DmpInvitation } from '@app/core/model/dmp/invitation/dmp-invitation';
import { DmpInvitationUser } from '@app/core/model/dmp/invitation/dmp-invitation-user';
import { DmpInvitationUserCriteria } from '@app/core/query/dmp/dmp-invitation-user-criteria';
import { RequestItem } from '@app/core/query/request-item';
import { DmpInvitationService } from '@app/core/services/dmp/dmp-invitation.service';
import { MultipleAutoCompleteConfiguration } from '@app/library/auto-complete/multiple/multiple-auto-complete-configuration';
import { BaseComponent } from '@common/base/base.component';
import { Observable } from 'rxjs';
import { map, takeUntil } from 'rxjs/operators';
import { Role } from '@app/core/common/enum/role';
@Component({
selector: 'app-invitation-component',
templateUrl: 'dmp-invitation.component.html',
styleUrls: ['./dmp-invitation.component.scss'],
})
export class DmpInvitationDialogComponent extends BaseComponent implements OnInit {
public formGroup: FormGroup;
public filteredUsersAsync = false;
public filteredUsers: DmpInvitationUser[];
public emails: string[] = [];
public roles = Role;
public roleNames: string[];
visible = true;
selectable = true;
removable = true;
addOnBlur = true;
readonly separatorKeysCodes: number[] = [ENTER, COMMA];
constructor(
public invitationService: DmpInvitationService,
public route: ActivatedRoute,
public router: Router,
public dialogRef: MatDialogRef<DmpInvitationDialogComponent>,
@Inject(MAT_DIALOG_DATA) public data: any
) {
super();
this.roleNames = Object.keys(this.roles).filter(key => key.length > 1);
}
ngOnInit(): void {
const invitation = new DmpInvitation();
invitation.dataManagementPlan = this.data.dmpId;
this.formGroup = invitation.buildForm();
}
usersAutoCompleteConfiguration: MultipleAutoCompleteConfiguration = {
filterFn: this.filterUsers.bind(this),
initialItems: (excludedItems: any[]) => this.filterUsers('').pipe(map(result => result.filter(resultItem => (excludedItems || []).map(x => x.id).indexOf(resultItem.id) === -1))),
displayFn: (item) => typeof(item) === 'string' ? item : item.name,
titleFn: (item) => typeof(item) === 'string' ? item : item.name,
valueAssign: (item) => {
const result = typeof(item) === 'string' ? item : item.email;
return result;
}
};
add(event: MatChipInputEvent): void {
const input = event.input;
const value = event.value;
if ((value || '').trim()) {
this.emails.push(value.trim());
}
if (input) {
input.value = '';
}
}
remove(email: string): void {
const index = this.emails.indexOf(email);
if (index >= 0) {
this.emails.splice(index, 1);
}
}
send(value: any) {
let invitationObject: any = {};
invitationObject.dataManagementPlan = this.data.dmpId;
invitationObject.role = this.formGroup.get('role').value;
invitationObject.users = [];
invitationObject.users.push(...(<any[]>this.formGroup.get('users').value).filter(user => typeof(user) === 'string').map(email => ({ email: email, name: email })));
invitationObject.users.push(...(<any[]>this.formGroup.get('users').value).filter(user => typeof(user) !== 'string'));
//invitationObject.users.push(...this.formGroup.get('users').value);
this.emails.forEach(email => {
invitationObject.users.push({ email: email, name: email });
});
this.invitationService.inviteDmpInvitationUsers(invitationObject)
.pipe(takeUntil(this._destroyed))
.subscribe(
null, null, () => this.dialogRef.close()
);
}
closeDialog(): void {
this.dialogRef.close();
}
filterUsers(value: string): Observable<DmpInvitationUser[]> {
this.filteredUsers = undefined;
this.filteredUsersAsync = true;
const request = new RequestItem<DmpInvitationUserCriteria>();
request.criteria = { like: value };
return this.invitationService.getDmpInvitationUsers(request)
.pipe(takeUntil(this._destroyed));
// .subscribe(items => {
// this.filteredUsers = new JsonSerializer<DmpInvitationUser>(DmpInvitationUser).fromJSONArray(items);
// if (!this.filteredUsers || this.filteredUsers.length === 0) {
// const user = new DmpInvitationUser();
// user.email = value;
// user.name = value;
// this.filteredUsers.push(user);
// }
// this.filteredUsersAsync = false;
// });
}
}

File diff suppressed because it is too large Load Diff

View File

@ -140,7 +140,9 @@
"LANGUAGES": {
"ENGLISH": "English",
"GREEK": "Greek",
"SPANISH": "Spanish"
"SPANISH": "Spanish",
"GERMAN": "German",
"TURKISH": "Turkish"
}
},
"COOKIE": {

File diff suppressed because it is too large Load Diff

View File

@ -10,5 +10,13 @@
{
"label": "GENERAL.LANGUAGES.SPANISH",
"value": "es"
},
{
"label": "GENERAL.LANGUAGES.GERMAN",
"value": "de"
},
{
"label": "GENERAL.LANGUAGES.TURKISH",
"value": "tr"
}
]