Newer
Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
import { Component, Input, OnInit } from '@angular/core';
import { HttpClient } from '@angular/common/http';
import { LANG } from '../translate.component';
import { NotificationService } from '../notification.service';
import { CdkDragDrop, moveItemInArray } from '@angular/cdk/drag-drop';
@Component({
selector: 'app-avis-workflow',
templateUrl: 'avis-workflow.component.html',
styleUrls: ['avis-workflow.component.scss'],
providers: [NotificationService]
})
export class AvisWorkflowComponent implements OnInit {
lang: any = LANG;
avisWorkflow: any = {
items : []
};
loading: boolean = true;
data: any;
@Input('injectDatas') injectDatas: any;
constructor(public http: HttpClient, private notify: NotificationService) { }
ngOnInit(): void { }
drop(event: CdkDragDrop<string[]>) {
if (event.previousContainer === event.container) {
moveItemInArray(event.container.data, event.previousIndex, event.currentIndex);
}
}
loadListModel(entityId: string) {
this.loading = true;
this.avisWorkflow.items = [];
// TO DO : ADD ROUTE
/*this.http.get("../../rest/???")
.subscribe((data: any) => {
this.loading = false;
});*/
this.avisWorkflow.items.push(
{
"listinstance_id": 20,
"sequence": 0,
"item_mode": "avis",
"item_id": "bbain",
"item_type": "user_id",
"item_firstname": "Barbara",
"item_lastname": "BAIN",
"item_entity": "P\u00f4le Jeunesse et Sport",
"viewed": 0,
"process_date": null,
"process_comment": "",
"signatory": false,
"requested_signature": false
});
this.avisWorkflow.items.push(
{
"listinstance_id": 21,
"sequence": 0,
"item_mode": "avis",
"item_id": "DSG",
"item_type": "entity_id",
"item_entity": "Secr\u00e9tariat G\u00e9n\u00e9ral",
"viewed": 0,
"process_date": null,
"process_comment": null,
"signatory": false,
"requested_signature": false
}
);
this.loading = false;
}
loadWorkflow(resId: number) {
this.loading = true;
this.avisWorkflow.items = [];
this.http.get("../../rest/res/" + resId + "/avisCircuit")
.subscribe((data: any) => {
data.forEach((element:any) => {
this.avisWorkflow.items.push(element);
});
this.loading = false;
}, (err: any) => {
this.notify.handleErrors(err);
});
}
deleteItem(index: number) {
this.avisWorkflow.items.splice(index, 1);
}
getAvisCount() {
return this.avisWorkflow.items.length;
}
}