argos/dmp-frontend/src/app/ui/annotations/annotation-dialog-component/annotation-dialog.component...

185 lines
8.7 KiB
HTML
Raw Normal View History

2024-03-29 17:09:26 +01:00
<div class="container-fluid">
2024-03-29 15:26:48 +01:00
<div class="row d-flex justify-content-between align-items-center">
<div class="col-auto ml-auto" (click)="close()">
2024-03-13 09:45:22 +01:00
<mat-icon class="close-icon">close</mat-icon>
</div>
</div>
2024-03-29 17:08:43 +01:00
</div>
<mat-dialog-content>
2024-03-29 15:26:48 +01:00
<div class="row">
2024-02-28 14:41:36 +01:00
<!-- Create New Thread -->
<div class="col-12">
2024-03-29 15:26:48 +01:00
<form [formGroup]="threadFormGroup">
<div class="row mt-2 mb-3">
<div class="col-12 col-md mb-2">
<mat-form-field appearance="outline" class="w-100">
<mat-label>{{'ANNOTATION-DIALOG.THREADS.NEW-THREAD' | translate}}</mat-label>
<input matInput formControlName="text" required>
<!-- <mat-icon matSuffix class="material-symbols-outlined">
add_reaction
</mat-icon> -->
<mat-error *ngIf="threadFormGroup.get('text').hasError('backendError')">{{threadFormGroup.get('text').getError('backendError')?.message}}</mat-error>
<mat-error *ngIf="threadFormGroup.get('text').hasError('required')">{{'COMMONS.VALIDATION.REQUIRED' | translate}}</mat-error>
</mat-form-field>
</div>
<div class="col-12 col-md-auto">
<mat-form-field class="w-100 protection-input">
<mat-label>{{'ANNOTATION-DIALOG.THREADS.PROTECTION.TITLE' | translate}}</mat-label>
<mat-select name="thread-protectionType" formControlName="protectionType" required>
<mat-option *ngFor="let enumValue of annotationProtectionTypeEnumValues" [value]="enumValue">{{enumUtils.toAnnotationProtectionTypeString(enumValue)}}</mat-option>
</mat-select>
<mat-error *ngIf="threadFormGroup.get('protectionType').hasError('backendError')">{{threadFormGroup.get('protectionType').getError('backendError')?.message}}</mat-error>
<mat-error *ngIf="threadFormGroup.get('protectionType').hasError('required')">{{'COMMONS.VALIDATION.REQUIRED' | translate}}</mat-error>
</mat-form-field>
</div>
<div class="col-12 send-msg mt-1">
<div class="row">
<div class="col-auto pr-1">
<button type="button" class="normal-btn-sm" (click)="createThread()">{{ 'ANNOTATION-DIALOG.THREADS.SEND' | translate }} <i class="fa fa-paper-plane ml-2"></i></button>
</div>
<div class="col-auto pl-1">
<button type="button" class="normal-btn-light-sm" (click)="close()">{{ 'ANNOTATION-DIALOG.THREADS.CANCEL' | translate }}</button>
</div>
2024-03-26 15:54:49 +01:00
</div>
</div>
2024-03-29 15:26:48 +01:00
</div>
2024-02-28 14:41:36 +01:00
</form>
</div>
<div class="col-12 pt-2 gr-color" *ngIf="threads?.size > 0">
<div class="row">
<div class="col-auto">
<span>{{'ANNOTATION-DIALOG.TITLE' | translate}}</span>
<span class="comments-count">{{ annotationsCount }}</span>
</div>
</div>
</div>
2024-02-28 14:41:36 +01:00
<div class="col-12">
2024-03-26 16:46:13 +01:00
<ng-container *ngFor="let thread of threads">
2024-03-29 15:26:48 +01:00
<div class="row" *ngIf="getParentAnnotation(thread).protectionType === annotationProtectionTypeEnum.Private">
2024-03-26 16:46:13 +01:00
<div class="col-auto ml-auto">
2024-03-29 15:26:48 +01:00
<div class="d-flex align-items-center" matTooltip="{{'ANNOTATION-DIALOG.PROTECTION.PRIVATE' | translate}}">
2024-03-28 16:00:58 +01:00
<img src="/assets/images/annotations/eye-hide.png">
<div class="ml-1 mt-1">
{{getAnnotationProtectionType(thread)}}
</div>
</div>
2024-03-26 16:46:13 +01:00
</div>
</div>
2024-03-29 15:26:48 +01:00
<div class="row ml-auto" *ngIf="getParentAnnotation(thread).protectionType === annotationProtectionTypeEnum.EntityAccessors">
2024-03-26 16:46:13 +01:00
<div class="col-auto ml-auto">
2024-03-29 15:26:48 +01:00
<div class="d-flex aling-items center" matTooltip="{{'ANNOTATION-DIALOG.PROTECTION.ENTITY-ACCESSORS' | translate}}">
2024-03-28 16:00:58 +01:00
<img src="/assets/images/annotations/globe.png" alt="globe">
<!-- <i class="material-icons protection-icon icon-{{getAnnotationProtectionType(thread)}}"></i> -->
<span class="ml-1">
{{getAnnotationProtectionType(thread)}}
</span>
</div>
2024-03-26 16:46:13 +01:00
</div>
</div>
2024-03-29 15:26:48 +01:00
<div class="row mt-2 mb-2">
2024-03-26 16:46:13 +01:00
<!-- Parent Thread -->
<div class="col-12">
2024-03-29 15:26:48 +01:00
<div class="container">
<div class="row comment-wrapper pt-1 pb-2 h-100">
<div class="col-12 pt-1">
2024-03-28 16:00:58 +01:00
<div class="row">
<div class="col-12">
<div class="row h-100">
<div class="col-auto pr-0 account-icon-wrapper">
<mat-icon class="account-icon">account_circle</mat-icon>
2024-03-26 16:46:13 +01:00
</div>
2024-03-28 16:00:58 +01:00
<div class="col">
<div class="row">
2024-03-29 15:26:48 +01:00
<span class="col user">{{getParentAnnotation(thread).author.name}}</span>
<div class="col-auto annotation-time">{{getParentAnnotation(thread).timeStamp | date: "d MMMM, y 'at' h:mm a"}}</div>
</div>
<div class="row pt-1">
<div class="col-12 annotation-full-text">{{getParentAnnotation(thread).payload}}</div>
</div>
<div class="row"> <!--pb-2-->
<div class="col-12">
<button mat-button (click)="enableReply(thread)" class="action-button" [ngClass]="this.replyEnabledPerThread[thread] ? 'active-action' : ''" [disabled]="this.replyEnabledPerThread[thread]">{{ 'ANNOTATION-DIALOG.THREADS.REPLY' | translate}}</button>
</div>
</div>
<div class="row">
<div class="col-12">
<ng-container *ngIf="annotationsPerThread[thread].length === 1 && !this.showRepliesPerThread[thread]">
<button mat-button (click)="showReplies(thread)">
<img src="/assets/images/annotations/reply.png" alt="reply"> 1 {{ 'ANNOTATION-DIALOG.THREADS.REPLY' | translate}}
</button>
</ng-container>
<ng-container *ngIf="annotationsPerThread[thread].length > 1 && !this.showRepliesPerThread[thread]">
<button mat-button (click)="showReplies(thread)">
<img src="/assets/images/annotations/reply.png" alt="reply"> {{ annotationsPerThread[thread].length }} {{ 'ANNOTATION-DIALOG.THREADS.REPLIES' | translate}}
</button>
</ng-container>
</div>
2024-03-28 16:00:58 +01:00
</div>
2024-03-29 15:26:48 +01:00
<!-- Previous Replies -->
<div *ngIf="this.showRepliesPerThread[thread]" class="row">
<div *ngFor="let annotation of annotationsPerThread[thread]; let i = index;" class="col-12">
<div class="row m-0 h-100">
<div class="col-auto pr-0 pl-0">
<div class="side-color"></div>
</div>
<div class="col pt-1">
<div class="row">
<div class="col-12">
<div class="row h-100">
<div class="col-auto p-0 account-icon-wrapper">
<mat-icon class="account-icon">account_circle</mat-icon>
2024-03-29 15:26:48 +01:00
</div>
<div class="col">
<div class="row">
<span class="col user">{{annotation.author.name}}</span>
<div class="col-auto annotation-time">{{annotation.timeStamp | date:"d MMMM, y 'at' h:mm a"}}</div>
<!-- <div class="col annotation-time">{{annotation.timeStamp | date:'EEEE, MMMM d, y, h:mm a'}}</div> -->
</div>
<div class="row pt-1 pb-1">
<div class="col-12 annotation-full-text">{{annotation.payload}}</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
2024-03-28 16:00:58 +01:00
</div>
2024-03-29 15:26:48 +01:00
<!-- Type reply in thread -->
<div *ngIf="this.replyEnabledPerThread[thread]" class="row">
<div class="col-12 mt-2">
<div class="row new-reply mr-0">
<div class="col">
<mat-form-field appearance="outline" class="w-100">
<mat-label>{{'ANNOTATION-DIALOG.THREADS.REPLY' | translate}}</mat-label>
<input matInput [formControl]="this.threadReplyTextsFG[thread.toString()].get('replyText')" required>
<!-- <mat-icon matSuffix class="material-symbols-outlined">
add_reaction
</mat-icon> -->
</mat-form-field>
</div>
<div class="col-auto p-0 send-msg">
<button class="form-field-margin" mat-icon-button color="black" (click)="replyThread(thread)" matTooltip="{{'ANNOTATION-DIALOG.THREADS.REPLY' | translate}}">
<img class="paper-plane" src="/assets/images/annotations/paper-plane.png" alt="paper-plane">
</button>
</div>
</div>
</div>
</div>
2024-03-26 16:46:13 +01:00
</div>
2024-03-26 15:54:49 +01:00
</div>
2024-02-28 14:41:36 +01:00
</div>
</div>
</div>
</div>
</div>
2024-03-29 15:26:48 +01:00
</div>
2024-02-28 14:41:36 +01:00
</div>
2024-03-26 16:46:13 +01:00
</ng-container>
2024-02-28 14:41:36 +01:00
</div>
</div>
2024-03-29 17:08:43 +01:00
</mat-dialog-content>