Skip to content
Snippets Groups Projects
Verified Commit cd68304c authored by Alex ORLUC's avatar Alex ORLUC
Browse files

FEAT #9685 add note component in actions

parent 3f1a48d5
No related branches found
No related tags found
No related merge requests found
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
<div class="alert-message alert-message-danger" role="alert" style="margin-top: 30px;" [innerHTML]="lang.updateClosingDate"></div> <div class="alert-message alert-message-danger" role="alert" style="margin-top: 30px;" [innerHTML]="lang.updateClosingDate"></div>
</div> </div>
<div class="col-md-12"> <div class="col-md-12">
<app-note-editor></app-note-editor> <app-note-editor #noteEditor></app-note-editor>
</div> </div>
</div> </div>
</div> </div>
......
import { Component, OnInit, Inject } from '@angular/core'; import { Component, OnInit, Inject, ViewChild } from '@angular/core';
import { LANG } from '../../translate.component'; import { LANG } from '../../translate.component';
import { NotificationService } from '../../notification.service'; import { NotificationService } from '../../notification.service';
import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material'; import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material';
import { HttpClient } from '@angular/common/http'; import { HttpClient } from '@angular/common/http';
import { NoteEditorComponent } from '../../notes/note-editor.component';
@Component({ @Component({
templateUrl: "close-mail-action.component.html", templateUrl: "close-mail-action.component.html",
...@@ -14,13 +15,15 @@ export class CloseMailActionComponent implements OnInit { ...@@ -14,13 +15,15 @@ export class CloseMailActionComponent implements OnInit {
lang: any = LANG; lang: any = LANG;
loading: boolean = false; loading: boolean = false;
@ViewChild('noteEditor') noteEditor: NoteEditorComponent;
constructor(public http: HttpClient, private notify: NotificationService, public dialogRef: MatDialogRef<CloseMailActionComponent>, @Inject(MAT_DIALOG_DATA) public data: any) { } constructor(public http: HttpClient, private notify: NotificationService, public dialogRef: MatDialogRef<CloseMailActionComponent>, @Inject(MAT_DIALOG_DATA) public data: any) { }
ngOnInit(): void { } ngOnInit(): void { }
onSubmit(): void { onSubmit(): void {
this.loading = true; this.loading = true;
this.http.put('../../rest/resourcesList/users/' + this.data.currentBasketInfo.ownerId + '/groups/' + this.data.currentBasketInfo.groupId + '/baskets/' + this.data.currentBasketInfo.basketId + '/actions/' + this.data.action.id, {resources : this.data.selectedRes}) this.http.put('../../rest/resourcesList/users/' + this.data.currentBasketInfo.ownerId + '/groups/' + this.data.currentBasketInfo.groupId + '/baskets/' + this.data.currentBasketInfo.basketId + '/actions/' + this.data.action.id, {resources : this.data.selectedRes, note : this.noteEditor.getNoteContent()})
.subscribe((data: any) => { .subscribe((data: any) => {
this.loading = false; this.loading = false;
this.dialogRef.close('success'); this.dialogRef.close('success');
......
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
<b *ngIf="!data.contextMode" color="primary" class="highlight">{{data.selectedRes.length}} {{lang.elements}}</b> ? <b *ngIf="!data.contextMode" color="primary" class="highlight">{{data.selectedRes.length}} {{lang.elements}}</b> ?
</div> </div>
<div class="col-md-12"> <div class="col-md-12">
<app-note-editor></app-note-editor> <app-note-editor #noteEditor></app-note-editor>
</div> </div>
</div> </div>
</div> </div>
......
import { Component, OnInit, Inject } from '@angular/core'; import { Component, OnInit, Inject, ViewChild } from '@angular/core';
import { LANG } from '../../translate.component'; import { LANG } from '../../translate.component';
import { NotificationService } from '../../notification.service'; import { NotificationService } from '../../notification.service';
import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material'; import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material';
import { HttpClient } from '@angular/common/http'; import { HttpClient } from '@angular/common/http';
import { NoteEditorComponent } from '../../notes/note-editor.component';
@Component({ @Component({
templateUrl: "confirm-action.component.html", templateUrl: "confirm-action.component.html",
...@@ -14,13 +15,15 @@ export class ConfirmActionComponent implements OnInit { ...@@ -14,13 +15,15 @@ export class ConfirmActionComponent implements OnInit {
lang: any = LANG; lang: any = LANG;
loading: boolean = false; loading: boolean = false;
@ViewChild('noteEditor') noteEditor: NoteEditorComponent;
constructor(public http: HttpClient, private notify: NotificationService, public dialogRef: MatDialogRef<ConfirmActionComponent>, @Inject(MAT_DIALOG_DATA) public data: any) { } constructor(public http: HttpClient, private notify: NotificationService, public dialogRef: MatDialogRef<ConfirmActionComponent>, @Inject(MAT_DIALOG_DATA) public data: any) { }
ngOnInit(): void { } ngOnInit(): void { }
onSubmit(): void { onSubmit(): void {
this.loading = true; this.loading = true;
this.http.put('../../rest/resourcesList/users/' + this.data.currentBasketInfo.ownerId + '/groups/' + this.data.currentBasketInfo.groupId + '/baskets/' + this.data.currentBasketInfo.basketId + '/actions/' + this.data.action.id, {resources : this.data.selectedRes}) this.http.put('../../rest/resourcesList/users/' + this.data.currentBasketInfo.ownerId + '/groups/' + this.data.currentBasketInfo.groupId + '/baskets/' + this.data.currentBasketInfo.basketId + '/actions/' + this.data.action.id, {resources : this.data.selectedRes, note : this.noteEditor.getNoteContent()})
.subscribe((data: any) => { .subscribe((data: any) => {
this.loading = false; this.loading = false;
this.dialogRef.close('success'); this.dialogRef.close('success');
......
<mat-form-field appearance="outline"> <mat-form-field appearance="outline">
<textarea matInput placeholder="{{lang.addNote}}"></textarea> <textarea matInput placeholder="{{lang.addNote}}" [(ngModel)]="content"></textarea>
<button matSuffix color="primary" mat-icon-button [matMenuTriggerFor]="menu"> <button matSuffix color="primary" mat-icon-button [matMenuTriggerFor]="menu">
<mat-icon fontSet="fas" fontIcon="fa-file-alt fa-2x"></mat-icon> <mat-icon fontSet="fas" fontIcon="fa-file-alt fa-2x"></mat-icon>
</button> </button>
......
import { Component, AfterViewInit } from '@angular/core'; import { Component, AfterViewInit, Input } from '@angular/core';
import { HttpClient } from '@angular/common/http'; import { HttpClient } from '@angular/common/http';
import { LANG } from '../translate.component'; import { LANG } from '../translate.component';
import { NotificationService } from '../notification.service'; import { NotificationService } from '../notification.service';
...@@ -15,6 +15,10 @@ export class NoteEditorComponent implements AfterViewInit { ...@@ -15,6 +15,10 @@ export class NoteEditorComponent implements AfterViewInit {
notes: any; notes: any;
loading: boolean = true; loading: boolean = true;
content: string = '';
@Input('mode') mode: any;
constructor(public http: HttpClient) { } constructor(public http: HttpClient) { }
ngAfterViewInit() { } ngAfterViewInit() { }
...@@ -26,4 +30,9 @@ export class NoteEditorComponent implements AfterViewInit { ...@@ -26,4 +30,9 @@ export class NoteEditorComponent implements AfterViewInit {
this.loading = false; this.loading = false;
});*/ });*/
} }
getNoteContent() {
return this.content;
}
} }
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment