styling changes

*invite user dialog
This commit is contained in:
Sofia Papacharalampous 2024-03-14 18:15:25 +02:00
parent 025933ee61
commit 5b23cc0aa6
5 changed files with 81 additions and 57 deletions

View File

@ -21,7 +21,7 @@
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
width: 260px; width: 270px;
background: #ffffff 0% 0% no-repeat padding-box; background: #ffffff 0% 0% no-repeat padding-box;
box-shadow: 0px 0px 16px 2px #00000029; box-shadow: 0px 0px 16px 2px #00000029;
border-right-width: 0px; border-right-width: 0px;

View File

@ -7,9 +7,9 @@
<mat-icon class="close-icon">close</mat-icon> <mat-icon class="close-icon">close</mat-icon>
</div> </div>
</div> </div>
<div mat-dialog-content class="row content"> <div mat-dialog-content class="row">
<div> <div>
<app-user-field-component [form]="formGroup" [validationErrorModel]="editorModel.validationErrorModel" [sections]="selectedBlueprint.definition.sections"></app-user-field-component> <app-user-field-component [form]="formGroup" [validationErrorModel]="editorModel.validationErrorModel" [sections]="selectedBlueprint.definition.sections" [initializeUsers]="'true'" [enableSorting]="'false'"></app-user-field-component>
</div> </div>
<div class="col mt-2"> <div class="col mt-2">
<button mat-raised-button *ngIf="hasValue()" (click)="send()" type="button" class="invite-btn">{{'DMP-USER-INVITATION-DIALOG.ACTIONS.INVITE' | translate}}</button> <button mat-raised-button *ngIf="hasValue()" (click)="send()" type="button" class="invite-btn">{{'DMP-USER-INVITATION-DIALOG.ACTIONS.INVITE' | translate}}</button>

View File

@ -1,67 +1,12 @@
<div cdkDropList class="col-12" (cdkDropListDropped)="dropUsers($event)"> <div *ngIf="enableSorting==true; else sortingDisabled" class="col-12" cdkDropList (cdkDropListDropped)="dropUsers($event)">
<div *ngFor="let user of form.get('users').controls; let userIndex=index;" cdkDrag class="row align-items-center" [cdkDragDisabled]="form.disabled"> hello!
<div class="col-auto"> <ng-container *ngTemplateOutlet="userForm"></ng-container>
<span style="font-size: 15px;">{{userIndex + 1}}</span>
</div>
<div class="col-auto d-flex"><mat-icon [ngClass]="{'drag-handle-disabled': form.disabled}" cdkDragHandle class="drag-handle">drag_indicator</mat-icon></div>
<div class="col-auto">
<mat-button-toggle-group name="fontStyle" aria-label="Font Style" [formControl]="user.get('userType')">
<div *ngFor="let userType of dmpUserTypeEnumValues">
<mat-button-toggle class="lang-button" [value]="userType">{{enumUtils.toDmpUserTypeString(userType)}}</mat-button-toggle>
</div>
</mat-button-toggle-group>
</div>
<div class="col pt-4">
<div class="row">
<div class="col" *ngIf="user.get('userType').value == dmpUserTypeEnum.Internal">
<mat-form-field class="w-100">
<mat-label>{{'DMP-EDITOR.FIELDS1.USER' | translate}}*</mat-label>
<app-single-auto-complete [formControl]="user.get('user')" [hidePlaceholder]="true" [configuration]="userService.singleAutoCompleteDmpAssociatedUserConfiguration"></app-single-auto-complete>
<mat-error *ngIf="user.get('user').hasError('backendError')">{{user.get('user').getError('backendError').message}}</mat-error>
<mat-error *ngIf="user.get('user').hasError('required')">{{'GENERAL.VALIDATION.REQUIRED' | translate}}</mat-error>
</mat-form-field>
</div>
<div class="col" *ngIf="user.get('userType').value == dmpUserTypeEnum.External">
<mat-form-field class="w-100">
<mat-label>{{'DMP-EDITOR.FIELDS1.EMAIL' | translate}}*</mat-label>
<input matInput type="text" name="email" [formControl]="user.get('email')">
<mat-error *ngIf="user.get('email').hasError('backendError')">{{user.get('email').getError('backendError').message}}</mat-error>
<mat-error *ngIf="user.get('email').hasError('required')">{{'GENERAL.VALIDATION.REQUIRED' | translate}}</mat-error>
</mat-form-field>
</div>
<div class="col">
<mat-form-field class="w-100">
<mat-label>{{'DMP-EDITOR.FIELDS1.USER-ROLE' | translate}}</mat-label>
<mat-select [formControl]="user.get('role')">
<mat-option *ngFor="let userRole of dmpUserRoleEnumValues" [value]="userRole">{{enumUtils.toDmpUserRoleString(userRole)}}</mat-option>
</mat-select>
<mat-error *ngIf="user.get('role').hasError('backendError')">{{user.get('role').getError('backendError').message}}</mat-error>
<mat-error *ngIf="user.get('role').hasError('required')">{{'GENERAL.VALIDATION.REQUIRED' | translate}}</mat-error>
</mat-form-field>
</div>
<div class="col" *ngIf="sections">
<mat-form-field class="w-100">
<mat-label>{{'DMP-EDITOR.FIELDS1.SECTION' | translate}}</mat-label>
<mat-select [formControl]="user.get('sectionId')">
<mat-option *ngFor="let section of sections" [value]="section.id">
{{ section.label }}
</mat-option>
</mat-select>
<mat-error *ngIf="user.get('sectionId').hasError('backendError')">{{user.get('sectionId').getError('backendError').message}}</mat-error>
<mat-error *ngIf="user.get('sectionId').hasError('required')">{{'GENERAL.VALIDATION.REQUIRED' |translate}}</mat-error>
</mat-form-field>
</div>
</div>
</div>
<div class="col-auto">
<button mat-icon-button class="action-list-icon" matTooltip="{{'DMP-EDITOR.ACTIONS1.REMOVE-USER' | translate}}" (click)="removeUser(userIndex)" [disabled]="form.disabled">
<mat-icon>delete</mat-icon>
</button>
</div>
</div>
<mat-error *ngIf="form.get('users').dirty && form.get('users').hasError('required')">{{'DMP-EDITOR.USERS-REQUIRED' | translate}}</mat-error>
<mat-error *ngIf="form.get('users').hasError('backendError')">{{form.get('users').getError('backendError').message}}</mat-error>
</div> </div>
<ng-template class="col-12" #sortingDisabled>
<ng-container *ngTemplateOutlet="userForm"></ng-container>
</ng-template>
<div class="row"> <div class="row">
<div class="col"> <div class="col">
<button mat-icon-button (click)="addUser()" [disabled]="form.disabled"> <button mat-icon-button (click)="addUser()" [disabled]="form.disabled">
@ -69,3 +14,65 @@
</button> </button>
</div> </div>
</div> </div>
<ng-template #userForm>
<div *ngFor="let user of form.get('users').controls; let userIndex=index;" cdkDrag class="user-fields-wrapper" [cdkDragDisabled]="form.disabled">
<div class="">
<span style="font-size: 15px;">{{userIndex + 1}}</span>
</div>
<div *ngIf="enableSorting==true" class="col-auto d-flex"><mat-icon [ngClass]="{'drag-handle-disabled': form.disabled}" cdkDragHandle class="drag-handle">drag_indicator</mat-icon></div>
<div class="col-auto">
<mat-button-toggle-group name="fontStyle" aria-label="Font Style" [formControl]="user.get('userType')">
<div *ngFor="let userType of dmpUserTypeEnumValues">
<mat-button-toggle class="lang-button" [value]="userType">{{enumUtils.toDmpUserTypeString(userType)}}</mat-button-toggle>
</div>
</mat-button-toggle-group>
</div>
<div class="col-auto" *ngIf="user.get('userType').value == dmpUserTypeEnum.Internal">
<mat-form-field class="w-100">
<mat-label>{{'DMP-EDITOR.FIELDS1.USER' | translate}}*</mat-label>
<app-single-auto-complete [formControl]="user.get('user')" [hidePlaceholder]="true" [configuration]="userService.singleAutoCompleteDmpAssociatedUserConfiguration"></app-single-auto-complete>
<mat-error *ngIf="user.get('user').hasError('backendError')">{{user.get('user').getError('backendError').message}}</mat-error>
<mat-error *ngIf="user.get('user').hasError('required')">{{'GENERAL.VALIDATION.REQUIRED' | translate}}</mat-error>
</mat-form-field>
</div>
<div class="col-auto" *ngIf="user.get('userType').value == dmpUserTypeEnum.External">
<mat-form-field class="w-100">
<mat-label>{{'DMP-EDITOR.FIELDS1.EMAIL' | translate}}*</mat-label>
<input matInput type="text" name="email" [formControl]="user.get('email')">
<mat-error *ngIf="user.get('email').hasError('backendError')">{{user.get('email').getError('backendError').message}}</mat-error>
<mat-error *ngIf="user.get('email').hasError('required')">{{'GENERAL.VALIDATION.REQUIRED' | translate}}</mat-error>
</mat-form-field>
</div>
<div class="col-auto">
<mat-form-field class="w-100">
<mat-label>{{'DMP-EDITOR.FIELDS1.USER-ROLE' | translate}}</mat-label>
<mat-select [formControl]="user.get('role')">
<mat-option *ngFor="let userRole of dmpUserRoleEnumValues" [value]="userRole">{{enumUtils.toDmpUserRoleString(userRole)}}</mat-option>
</mat-select>
<mat-error *ngIf="user.get('role').hasError('backendError')">{{user.get('role').getError('backendError').message}}</mat-error>
<mat-error *ngIf="user.get('role').hasError('required')">{{'GENERAL.VALIDATION.REQUIRED' | translate}}</mat-error>
</mat-form-field>
</div>
<div class="col-auto" *ngIf="sections">
<mat-form-field class="w-100">
<mat-label>{{'DMP-EDITOR.FIELDS1.SECTION' | translate}}</mat-label>
<mat-select [formControl]="user.get('sectionId')">
<mat-option *ngFor="let section of sections" [value]="section.id">
{{ section.label }}
</mat-option>
</mat-select>
<mat-error *ngIf="user.get('sectionId').hasError('backendError')">{{user.get('sectionId').getError('backendError').message}}</mat-error>
<mat-error *ngIf="user.get('sectionId').hasError('required')">{{'GENERAL.VALIDATION.REQUIRED' |translate}}</mat-error>
</mat-form-field>
</div>
<div class="col-auto">
<button mat-icon-button class="action-list-icon" matTooltip="{{'DMP-EDITOR.ACTIONS1.REMOVE-USER' | translate}}" (click)="removeUser(userIndex)" [disabled]="form.disabled">
<mat-icon>delete</mat-icon>
</button>
</div>
</div>
<mat-error *ngIf="form.get('users').dirty && form.get('users').hasError('required')">{{'DMP-EDITOR.USERS-REQUIRED' | translate}}</mat-error>
<mat-error *ngIf="form.get('users').hasError('backendError')">{{form.get('users').getError('backendError').message}}</mat-error>
</ng-template>

View File

@ -7,3 +7,14 @@
cursor: auto; cursor: auto;
color: rgba(0, 0, 0, 0.38);; color: rgba(0, 0, 0, 0.38);;
} }
.user-fields-wrapper {
display: flex;
flex-direction: row;
justify-content: space-around;
align-items: baseline;
@media (width <= 1350px) {
flex-direction: column;
}
}

View File

@ -24,6 +24,8 @@ export class UserFieldComponent extends BaseComponent implements OnInit {
@Input() required: boolean = false; @Input() required: boolean = false;
@Input() placeholder: string; @Input() placeholder: string;
@Input() sections: DmpBlueprintDefinitionSection[] = null; @Input() sections: DmpBlueprintDefinitionSection[] = null;
@Input() initializeUsers: boolean = false;
@Input() enableSorting: boolean = true;
dmpUserTypeEnum = DmpUserType; dmpUserTypeEnum = DmpUserType;
dmpUserTypeEnumValues = this.enumUtils.getEnumValues<DmpUserType>(DmpUserType); dmpUserTypeEnumValues = this.enumUtils.getEnumValues<DmpUserType>(DmpUserType);
@ -37,6 +39,10 @@ export class UserFieldComponent extends BaseComponent implements OnInit {
) { super(); } ) { super(); }
ngOnInit() { ngOnInit() {
console.log('sorting mode: ', this.enableSorting);
if(this.initializeUsers) {
this.addUser();
}
} }
addUser(): void { addUser(): void {