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

FEAT #14944 TIME 0:30 add note confirm in process

parent 9fa912d5
No related branches found
No related tags found
No related merge requests found
...@@ -44,7 +44,7 @@ import { AlertComponent } from '../plugins/modal/alert.component'; ...@@ -44,7 +44,7 @@ import { AlertComponent } from '../plugins/modal/alert.component';
import { ConfirmComponent } from '../plugins/modal/confirm.component'; import { ConfirmComponent } from '../plugins/modal/confirm.component';
/*PLUGIN COMPONENT*/ /*PLUGIN COMPONENT*/
import { NotesListComponent } from './notes/notes.component'; import { NotesListComponent } from './notes/notes-list.component';
import { NoteEditorComponent } from './notes/note-editor.component'; import { NoteEditorComponent } from './notes/note-editor.component';
import { PluginAutocomplete } from '../plugins/autocomplete/autocomplete.component'; import { PluginAutocomplete } from '../plugins/autocomplete/autocomplete.component';
......
...@@ -3,7 +3,7 @@ import { TranslateService } from '@ngx-translate/core'; ...@@ -3,7 +3,7 @@ import { TranslateService } from '@ngx-translate/core';
import { DiffusionsListComponent } from '../../diffusions/diffusions-list.component'; import { DiffusionsListComponent } from '../../diffusions/diffusions-list.component';
import { VisaWorkflowComponent } from '../../visa/visa-workflow.component'; import { VisaWorkflowComponent } from '../../visa/visa-workflow.component';
import { AvisWorkflowComponent } from '../../avis/avis-workflow.component'; import { AvisWorkflowComponent } from '../../avis/avis-workflow.component';
import { NotesListComponent } from '../../notes/notes.component'; import { NotesListComponent } from '../../notes/notes-list.component';
import { AttachmentsListComponent } from '../../attachments/attachments-list.component'; import { AttachmentsListComponent } from '../../attachments/attachments-list.component';
declare var $: any; declare var $: any;
...@@ -15,8 +15,6 @@ declare var $: any; ...@@ -15,8 +15,6 @@ declare var $: any;
}) })
export class PanelListComponent implements OnInit { export class PanelListComponent implements OnInit {
loading: boolean = false; loading: boolean = false;
selectedDiffusionTab: number = 0; selectedDiffusionTab: number = 0;
......
...@@ -16,7 +16,6 @@ import { LatinisePipe } from 'ngx-pipes'; ...@@ -16,7 +16,6 @@ import { LatinisePipe } from 'ngx-pipes';
}) })
export class NoteEditorComponent implements OnInit { export class NoteEditorComponent implements OnInit {
notes: any; notes: any;
loading: boolean = false; loading: boolean = false;
templatesNote: any = []; templatesNote: any = [];
...@@ -24,17 +23,17 @@ export class NoteEditorComponent implements OnInit { ...@@ -24,17 +23,17 @@ export class NoteEditorComponent implements OnInit {
entitiesRestriction: string[] = []; entitiesRestriction: string[] = [];
@Input('title') title: string = this.translate.instant('lang.addNote'); @Input() title: string = this.translate.instant('lang.addNote');
@Input('content') content: string = ''; @Input() content: string = '';
@Input('resIds') resIds: any[]; @Input() resIds: any[];
@Input('addMode') addMode: boolean; @Input() addMode: boolean;
@Input('upMode') upMode: boolean; @Input() upMode: boolean;
@Input('noteContent') noteContent: string; @Input() noteContent: string;
@Input('entitiesNoteRestriction') entitiesNoteRestriction: string[]; @Input() entitiesNoteRestriction: string[];
@Input('noteId') noteId: number; @Input() noteId: number;
@Input('defaultRestriction') defaultRestriction: boolean; @Input() defaultRestriction: boolean;
@Input('disableRestriction') disableRestriction: boolean = false; @Input() disableRestriction: boolean = false;
@Output('refreshNotes') refreshNotes = new EventEmitter<string>(); @Output() refreshNotes = new EventEmitter<string>();
searchTerm: FormControl = new FormControl(); searchTerm: FormControl = new FormControl();
entitiesList: any[] = []; entitiesList: any[] = [];
...@@ -108,7 +107,7 @@ export class NoteEditorComponent implements OnInit { ...@@ -108,7 +107,7 @@ export class NoteEditorComponent implements OnInit {
addNote() { addNote() {
this.loading = true; this.loading = true;
this.http.post("../rest/notes", { value: this.content, resId: this.resIds[0], entities: this.entitiesRestriction }) this.http.post('../rest/notes', { value: this.content, resId: this.resIds[0], entities: this.entitiesRestriction })
.subscribe((data: any) => { .subscribe((data: any) => {
this.refreshNotes.emit(this.resIds[0]); this.refreshNotes.emit(this.resIds[0]);
this.loading = false; this.loading = false;
...@@ -117,7 +116,7 @@ export class NoteEditorComponent implements OnInit { ...@@ -117,7 +116,7 @@ export class NoteEditorComponent implements OnInit {
updateNote() { updateNote() {
this.loading = true; this.loading = true;
this.http.put("../rest/notes/" + this.noteId, { value: this.content, resId: this.resIds[0], entities: this.entitiesRestriction }) this.http.put('../rest/notes/' + this.noteId, { value: this.content, resId: this.resIds[0], entities: this.entitiesRestriction })
.subscribe((data: any) => { .subscribe((data: any) => {
this.refreshNotes.emit(this.resIds[0]); this.refreshNotes.emit(this.resIds[0]);
this.loading = false; this.loading = false;
...@@ -156,7 +155,7 @@ export class NoteEditorComponent implements OnInit { ...@@ -156,7 +155,7 @@ export class NoteEditorComponent implements OnInit {
if (!this.functions.empty(this.resIds) && this.resIds.length == 1) { if (!this.functions.empty(this.resIds) && this.resIds.length == 1) {
params['resId'] = this.resIds[0]; params['resId'] = this.resIds[0];
} }
this.http.get("../rest/notesTemplates", { params: params }) this.http.get('../rest/notesTemplates', { params: params })
.subscribe((data: any) => { .subscribe((data: any) => {
this.templatesNote = data['templates']; this.templatesNote = data['templates'];
}); });
...@@ -171,7 +170,7 @@ export class NoteEditorComponent implements OnInit { ...@@ -171,7 +170,7 @@ export class NoteEditorComponent implements OnInit {
if (!this.functions.empty(this.resIds) && this.resIds.length == 1) { if (!this.functions.empty(this.resIds) && this.resIds.length == 1) {
params['resId'] = this.resIds[0]; params['resId'] = this.resIds[0];
} }
this.http.get("../rest/entities").pipe( this.http.get('../rest/entities').pipe(
tap((data: any) => { tap((data: any) => {
this.entities = data['entities']; this.entities = data['entities'];
resolve(true); resolve(true);
...@@ -191,4 +190,8 @@ export class NoteEditorComponent implements OnInit { ...@@ -191,4 +190,8 @@ export class NoteEditorComponent implements OnInit {
this.entities[realIndex].selected = false; this.entities[realIndex].selected = false;
this.entitiesRestriction.splice(index, 1); this.entitiesRestriction.splice(index, 1);
} }
isWritingNote() {
return this.content !== '';
}
} }
import { NgModule } from '@angular/core'; import { NgModule } from '@angular/core';
import { SharedModule } from '../app-common.module'; import { SharedModule } from '../app-common.module';
import { NotesListComponent } from '../notes/notes.component'; import { NotesListComponent } from './notes-list.component';
import { NoteEditorComponent } from '../notes/note-editor.component'; import { NoteEditorComponent } from '../notes/note-editor.component';
@NgModule({ @NgModule({
......
import { Component, Input, OnInit, EventEmitter, Output } from '@angular/core'; import { Component, Input, OnInit, EventEmitter, Output, ViewChild } from '@angular/core';
import { HttpClient } from '@angular/common/http'; import { HttpClient } from '@angular/common/http';
import { TranslateService } from '@ngx-translate/core'; import { TranslateService } from '@ngx-translate/core';
import { NotificationService } from '@service/notification/notification.service'; import { NotificationService } from '@service/notification/notification.service';
...@@ -8,6 +8,7 @@ import { HeaderService } from '@service/header.service'; ...@@ -8,6 +8,7 @@ import { HeaderService } from '@service/header.service';
import { ConfirmComponent } from '../../plugins/modal/confirm.component'; import { ConfirmComponent } from '../../plugins/modal/confirm.component';
import { MatDialogRef, MatDialog } from '@angular/material/dialog'; import { MatDialogRef, MatDialog } from '@angular/material/dialog';
import { FunctionsService } from '@service/functions.service'; import { FunctionsService } from '@service/functions.service';
import { NoteEditorComponent } from './note-editor.component';
@Component({ @Component({
selector: 'app-notes-list', selector: 'app-notes-list',
...@@ -16,17 +17,18 @@ import { FunctionsService } from '@service/functions.service'; ...@@ -16,17 +17,18 @@ import { FunctionsService } from '@service/functions.service';
}) })
export class NotesListComponent implements OnInit { export class NotesListComponent implements OnInit {
notes: any[] = []; notes: any[] = [];
loading: boolean = true; loading: boolean = true;
resIds: number[] = []; resIds: number[] = [];
@Input('injectDatas') injectDatas: any; @Input() injectDatas: any;
@Input('resId') resId: number = null; @Input() resId: number = null;
@Input('editMode') editMode: boolean = false; @Input() editMode: boolean = false;
@Output('reloadBadgeNotes') reloadBadgeNotes = new EventEmitter<string>(); @Output() reloadBadgeNotes = new EventEmitter<string>();
@ViewChild('noteEditor', { static: false }) noteEditor: NoteEditorComponent;
dialogRef: MatDialogRef<any>; dialogRef: MatDialogRef<any>;
...@@ -58,7 +60,7 @@ export class NotesListComponent implements OnInit { ...@@ -58,7 +60,7 @@ export class NotesListComponent implements OnInit {
loadNotes(resId: number) { loadNotes(resId: number) {
this.resIds[0] = resId; this.resIds[0] = resId;
this.loading = true; this.loading = true;
this.http.get("../rest/resources/" + this.resIds[0] + "/notes") this.http.get('../rest/resources/' + this.resIds[0] + '/notes')
.subscribe((data: any) => { .subscribe((data: any) => {
this.notes = data['notes']; this.notes = data['notes'];
this.reloadBadgeNotes.emit(`${this.notes.length}`); this.reloadBadgeNotes.emit(`${this.notes.length}`);
...@@ -80,7 +82,7 @@ export class NotesListComponent implements OnInit { ...@@ -80,7 +82,7 @@ export class NotesListComponent implements OnInit {
filter((data: string) => data === 'ok'), filter((data: string) => data === 'ok'),
exhaustMap(() => this.http.request('DELETE', '../rest/notes/' + note.id)), exhaustMap(() => this.http.request('DELETE', '../rest/notes/' + note.id)),
tap(() => { tap(() => {
var index = this.notes.findIndex(elem => elem.id == note.id) const index = this.notes.findIndex(elem => elem.id == note.id);
if (index > -1) { if (index > -1) {
this.notes.splice(index, 1); this.notes.splice(index, 1);
} }
...@@ -97,4 +99,12 @@ export class NotesListComponent implements OnInit { ...@@ -97,4 +99,12 @@ export class NotesListComponent implements OnInit {
note.edit = false; note.edit = false;
} }
} }
isModified() {
return this.noteEditor === undefined || this.noteEditor.isWritingNote();
}
addNote() {
this.noteEditor.addNote();
}
} }
...@@ -27,6 +27,7 @@ import { FunctionsService } from '@service/functions.service'; ...@@ -27,6 +27,7 @@ import { FunctionsService } from '@service/functions.service';
import { PrintedFolderModalComponent } from '../printedFolder/printed-folder-modal.component'; import { PrintedFolderModalComponent } from '../printedFolder/printed-folder-modal.component';
import { of, Subscription } from 'rxjs'; import { of, Subscription } from 'rxjs';
import { TechnicalInformationComponent } from '@appRoot/indexation/technical-information/technical-information.component'; import { TechnicalInformationComponent } from '@appRoot/indexation/technical-information/technical-information.component';
import { NotesListComponent } from '@appRoot/notes/notes-list.component';
@Component({ @Component({
...@@ -150,6 +151,7 @@ export class ProcessComponent implements OnInit, OnDestroy { ...@@ -150,6 +151,7 @@ export class ProcessComponent implements OnInit, OnDestroy {
@ViewChild('appDiffusionsList', { static: false }) appDiffusionsList: DiffusionsListComponent; @ViewChild('appDiffusionsList', { static: false }) appDiffusionsList: DiffusionsListComponent;
@ViewChild('appVisaWorkflow', { static: false }) appVisaWorkflow: VisaWorkflowComponent; @ViewChild('appVisaWorkflow', { static: false }) appVisaWorkflow: VisaWorkflowComponent;
@ViewChild('appAvisWorkflow', { static: false }) appAvisWorkflow: AvisWorkflowComponent; @ViewChild('appAvisWorkflow', { static: false }) appAvisWorkflow: AvisWorkflowComponent;
@ViewChild('appNotesList', { static: false }) appNotesList: NotesListComponent;
senderLightInfo: any = { 'displayName': null, 'fillingRate': null }; senderLightInfo: any = { 'displayName': null, 'fillingRate': null };
hasContact: boolean = false; hasContact: boolean = false;
...@@ -767,6 +769,8 @@ export class ProcessComponent implements OnInit, OnDestroy { ...@@ -767,6 +769,8 @@ export class ProcessComponent implements OnInit, OnDestroy {
return true; return true;
} else if (this.currentTool === 'opinionCircuit' && this.appAvisWorkflow !== undefined && this.appAvisWorkflow.isModified()) { } else if (this.currentTool === 'opinionCircuit' && this.appAvisWorkflow !== undefined && this.appAvisWorkflow.isModified()) {
return true; return true;
} else if (this.currentTool === 'notes' && this.appNotesList !== undefined && this.appNotesList.isModified()) {
return true;
} else { } else {
return false; return false;
} }
...@@ -795,6 +799,8 @@ export class ProcessComponent implements OnInit, OnDestroy { ...@@ -795,6 +799,8 @@ export class ProcessComponent implements OnInit, OnDestroy {
} else if (this.currentTool === 'opinionCircuit' && this.appAvisWorkflow !== undefined) { } else if (this.currentTool === 'opinionCircuit' && this.appAvisWorkflow !== undefined) {
await this.appAvisWorkflow.saveAvisWorkflow(); await this.appAvisWorkflow.saveAvisWorkflow();
this.loadBadges(); this.loadBadges();
} else if (this.currentTool === 'notes' && this.appNotesList !== undefined) {
this.appNotesList.addNote();
} }
} }
......
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