@valtimo/dossier-management 4.15.2-next-main.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (26) hide show
  1. package/bundles/valtimo-dossier-management.umd.js +601 -0
  2. package/bundles/valtimo-dossier-management.umd.js.map +1 -0
  3. package/bundles/valtimo-dossier-management.umd.min.js +2 -0
  4. package/bundles/valtimo-dossier-management.umd.min.js.map +1 -0
  5. package/esm2015/lib/dossier-management-connect-modal/dossier-management-connect-modal.component.js +88 -0
  6. package/esm2015/lib/dossier-management-detail/dossier-management-detail.component.js +96 -0
  7. package/esm2015/lib/dossier-management-list/dossier-management-list.component.js +78 -0
  8. package/esm2015/lib/dossier-management-remove-modal/dossier-management-remove-modal.component.js +63 -0
  9. package/esm2015/lib/dossier-management-routing.module.js +51 -0
  10. package/esm2015/lib/dossier-management-upload/dossier-management-upload.component.js +157 -0
  11. package/esm2015/lib/dossier-management.module.js +56 -0
  12. package/esm2015/public-api.js +21 -0
  13. package/esm2015/valtimo-dossier-management.js +10 -0
  14. package/fesm2015/valtimo-dossier-management.js +579 -0
  15. package/fesm2015/valtimo-dossier-management.js.map +1 -0
  16. package/lib/dossier-management-connect-modal/dossier-management-connect-modal.component.d.ts +25 -0
  17. package/lib/dossier-management-detail/dossier-management-detail.component.d.ts +25 -0
  18. package/lib/dossier-management-list/dossier-management-list.component.d.ts +27 -0
  19. package/lib/dossier-management-remove-modal/dossier-management-remove-modal.component.d.ts +19 -0
  20. package/lib/dossier-management-routing.module.d.ts +2 -0
  21. package/lib/dossier-management-upload/dossier-management-upload.component.d.ts +38 -0
  22. package/lib/dossier-management.module.d.ts +2 -0
  23. package/package.json +19 -0
  24. package/public-api.d.ts +2 -0
  25. package/valtimo-dossier-management.d.ts +9 -0
  26. package/valtimo-dossier-management.metadata.json +1 -0
@@ -0,0 +1,579 @@
1
+ import { CommonModule } from '@angular/common';
2
+ import { EventEmitter, Component, Output, ViewChild, NgModule, Input } from '@angular/core';
3
+ import { FormsModule } from '@angular/forms';
4
+ import { TranslateService, TranslateModule } from '@ngx-translate/core';
5
+ import { MenuService, AlertService, WidgetModule, DropzoneModule, ListModule, ModalModule } from '@valtimo/components';
6
+ import { ConfigModule, ExtensionComponent } from '@valtimo/config';
7
+ import { DocumentService } from '@valtimo/document';
8
+ import { ProcessService } from '@valtimo/process';
9
+ import { ToastrService } from 'ngx-toastr';
10
+ import { Router, ActivatedRoute, RouterModule } from '@angular/router';
11
+ import * as moment_ from 'moment';
12
+ import { BehaviorSubject, Subject } from 'rxjs';
13
+ import { AuthGuardService } from '@valtimo/security';
14
+ import { ROLE_ADMIN, DocumentDefinitionCreateRequest } from '@valtimo/contract';
15
+ import { switchMap, tap, take } from 'rxjs/operators';
16
+ import { NgbTooltipModule } from '@ng-bootstrap/ng-bootstrap';
17
+
18
+ /*
19
+ * Copyright 2015-2020 Ritense BV, the Netherlands.
20
+ *
21
+ * Licensed under EUPL, Version 1.2 (the "License");
22
+ * you may not use this file except in compliance with the License.
23
+ * You may obtain a copy of the License at
24
+ *
25
+ * https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12
26
+ *
27
+ * Unless required by applicable law or agreed to in writing, software
28
+ * distributed under the License is distributed on an "AS IS" basis,
29
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
30
+ * See the License for the specific language governing permissions and
31
+ * limitations under the License.
32
+ */
33
+ class DossierManagementConnectModalComponent {
34
+ constructor(processService, documentService, toasterService) {
35
+ this.processService = processService;
36
+ this.documentService = documentService;
37
+ this.toasterService = toasterService;
38
+ this.documentDefinition = null;
39
+ this.newDocumentProcessDefinition = null;
40
+ this.newDocumentProcessDefinitionInit = true;
41
+ this.newDocumentProcessDefinitionStartableByUser = false;
42
+ this.processDocumentDefinitionExists = {};
43
+ this.reloadProcessDocumentDefinitions = new EventEmitter();
44
+ }
45
+ loadProcessDocumentDefinitions() {
46
+ this.processDocumentDefinitionExists = {};
47
+ this.documentService.findProcessDocumentDefinitions(this.documentDefinition.id.name).subscribe((processDocumentDefinitions) => {
48
+ processDocumentDefinitions.forEach((processDocumentDefinition) => {
49
+ this.processDocumentDefinitionExists[processDocumentDefinition.id.processDefinitionKey] = true;
50
+ });
51
+ });
52
+ }
53
+ loadProcessDefinitions() {
54
+ this.processService.getProcessDefinitions().subscribe((processDefinitions) => {
55
+ this.processDefinitions = processDefinitions;
56
+ });
57
+ }
58
+ ngOnInit() {
59
+ this.loadProcessDefinitions();
60
+ }
61
+ openModal(dossier) {
62
+ this.documentDefinition = dossier;
63
+ this.newDocumentProcessDefinition = null;
64
+ this.newDocumentProcessDefinitionInit = true;
65
+ this.newDocumentProcessDefinitionStartableByUser = false;
66
+ this.loadProcessDocumentDefinitions();
67
+ this.modal.show();
68
+ }
69
+ submit() {
70
+ const request = {
71
+ canInitializeDocument: this.newDocumentProcessDefinitionInit,
72
+ startableByUser: this.newDocumentProcessDefinitionStartableByUser,
73
+ documentDefinitionName: this.documentDefinition.id.name,
74
+ processDefinitionKey: this.newDocumentProcessDefinition.key
75
+ };
76
+ this.documentService.createProcessDocumentDefinition(request).subscribe(() => {
77
+ this.toasterService.success('Successfully added new process document definition');
78
+ this.reloadProcessDocumentDefinitions.emit();
79
+ }, err => {
80
+ this.toasterService.error('Failed to add new process document definition');
81
+ });
82
+ }
83
+ }
84
+ DossierManagementConnectModalComponent.decorators = [
85
+ { type: Component, args: [{
86
+ selector: 'valtimo-dossier-management-connect-modal',
87
+ template: "<!--\n ~ Copyright 2015-2020 Ritense BV, the Netherlands.\n ~\n ~ Licensed under EUPL, Version 1.2 (the \"License\");\n ~ you may not use this file except in compliance with the License.\n ~ You may obtain a copy of the License at\n ~\n ~ https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12\n ~\n ~ Unless required by applicable law or agreed to in writing, software\n ~ distributed under the License is distributed on an \"AS IS\" basis,\n ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n ~ See the License for the specific language governing permissions and\n ~ limitations under the License.\n -->\n\n<valtimo-modal\n #dossierConnectModal\n elementId=\"dossierConnectModal\"\n [title]=\"documentDefinition ? documentDefinition.schema.title : 'Document definition'\"\n subtitle=\"Connect document definition to process definition\"\n showFooter=\"true\"\n>\n <div body *ngIf=\"documentDefinition\">\n <p>\n {{ 'Select process definition for document definition' | translate }} <strong>{{documentDefinition.id.name}} *</strong>\n </p>\n <div class=\"input-group mb-3 align-items-center\">\n <select class=\"form-control\" [(ngModel)]=\"newDocumentProcessDefinition\">\n <option [ngValue]=\"null\">Select process definition</option>\n <option *ngFor=\"let processDefinition of processDefinitions\"\n [disabled]=\"processDocumentDefinitionExists[processDefinition.key]\"\n [ngValue]=\"processDefinition\">{{processDefinition.name}} ({{processDefinition.key}})\n </option>\n </select>\n </div>\n <p>\n {{ 'Select options for the selected process' | translate }}\n </p>\n <div class=\"input-group mb-3 align-items-center\">\n <label class=\"custom-control custom-checkbox custom-control-inline pl-6 mb-0\">\n <input class=\"custom-control-input\" type=\"checkbox\" [(ngModel)]=\"newDocumentProcessDefinitionInit\"><span\n class=\"custom-control-label custom-control-color\">Init document?</span>\n </label>\n <label class=\"custom-control custom-checkbox custom-control-inline ml-2 pl-6 mb-0\" placement=\"right\"\n ngbTooltip=\"{{ 'Startable by user tooltip' | translate }}\">\n <input class=\"custom-control-input\" type=\"checkbox\" [(ngModel)]=\"newDocumentProcessDefinitionStartableByUser\"><span\n class=\"custom-control-label custom-control-color\">{{ 'Startable by user' | translate }}?</span>\n </label>\n </div>\n </div>\n <div footer>\n <button (click)=\"submit()\" class=\"btn btn-primary\" data-dismiss=\"modal\"\n [disabled]=\"!newDocumentProcessDefinition\"> {{ 'Save' | translate }}\n </button>\n </div>\n</valtimo-modal>\n",
88
+ styles: ["/*!\n * Copyright 2015-2020 Ritense BV, the Netherlands.\n *\n * Licensed under EUPL, Version 1.2 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" basis,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */"]
89
+ },] }
90
+ ];
91
+ DossierManagementConnectModalComponent.ctorParameters = () => [
92
+ { type: ProcessService },
93
+ { type: DocumentService },
94
+ { type: ToastrService }
95
+ ];
96
+ DossierManagementConnectModalComponent.propDecorators = {
97
+ reloadProcessDocumentDefinitions: [{ type: Output }],
98
+ modal: [{ type: ViewChild, args: ['dossierConnectModal',] }]
99
+ };
100
+
101
+ /*
102
+ * Copyright 2015-2020 Ritense BV, the Netherlands.
103
+ *
104
+ * Licensed under EUPL, Version 1.2 (the "License");
105
+ * you may not use this file except in compliance with the License.
106
+ * You may obtain a copy of the License at
107
+ *
108
+ * https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12
109
+ *
110
+ * Unless required by applicable law or agreed to in writing, software
111
+ * distributed under the License is distributed on an "AS IS" basis,
112
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
113
+ * See the License for the specific language governing permissions and
114
+ * limitations under the License.
115
+ */
116
+ class DossierManagementRemoveModalComponent {
117
+ constructor(documentService, toasterService, router, translateService, menuService) {
118
+ this.documentService = documentService;
119
+ this.toasterService = toasterService;
120
+ this.router = router;
121
+ this.translateService = translateService;
122
+ this.menuService = menuService;
123
+ this.documentDefinition = null;
124
+ this.errors = [];
125
+ }
126
+ openModal(documentDefinition) {
127
+ this.documentDefinition = documentDefinition;
128
+ this.modal.show();
129
+ }
130
+ removeDocumentDefinition() {
131
+ this.documentService.removeDocumentDefinition(this.documentDefinition.id.name).subscribe(() => {
132
+ this.menuService.reload();
133
+ this.router.navigate(['/dossier-management']);
134
+ this.toasterService.success(this.translateService.instant('remove-document-definition-success'));
135
+ }, (result) => {
136
+ this.errors = result.errors;
137
+ });
138
+ }
139
+ }
140
+ DossierManagementRemoveModalComponent.decorators = [
141
+ { type: Component, args: [{
142
+ selector: 'valtimo-dossier-management-remove-modal',
143
+ template: "<!--\n ~ Copyright 2015-2020 Ritense BV, the Netherlands.\n ~\n ~ Licensed under EUPL, Version 1.2 (the \"License\");\n ~ you may not use this file except in compliance with the License.\n ~ You may obtain a copy of the License at\n ~\n ~ https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12\n ~\n ~ Unless required by applicable law or agreed to in writing, software\n ~ distributed under the License is distributed on an \"AS IS\" basis,\n ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n ~ See the License for the specific language governing permissions and\n ~ limitations under the License.\n -->\n\n<valtimo-modal\n #documentDefinitionRemoveModal\n elementId=\"documentDefinitionRemoveModal\"\n [title]=\"documentDefinition ? documentDefinition.schema.title : 'Document definition'\"\n subtitle=\"{{ 'Remove document definition' | translate }}\"\n showFooter=\"true\"\n>\n <div body *ngIf=\"documentDefinition\">\n\n <div class=\"alert alert-contrast alert-danger mt-2\" role=\"alert\">\n <div class=\"icon\"><span class=\"mdi mdi-alert-triangle\"></span></div>\n <div class=\"message\" [innerHTML]=\"'remove-document-definition-confirmation' | translate\">\n </div>\n </div>\n <div *ngIf=\"errors.length > 0\" class=\"alert alert-danger pt-5 pb-5 mb-2\">\n <ol>\n <li *ngFor=\"let error of errors\">\n {{error}}\n </li>\n </ol>\n </div>\n </div>\n <div footer>\n <button (click)=\"removeDocumentDefinition()\" class=\"btn btn-primary\" data-dismiss=\"modal\">\n {{ 'remove-document-definition-confirmation-button' | translate }}\n </button>\n </div>\n</valtimo-modal>\n",
144
+ styles: ["/*!\n * Copyright 2015-2020 Ritense BV, the Netherlands.\n *\n * Licensed under EUPL, Version 1.2 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" basis,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */"]
145
+ },] }
146
+ ];
147
+ DossierManagementRemoveModalComponent.ctorParameters = () => [
148
+ { type: DocumentService },
149
+ { type: ToastrService },
150
+ { type: Router },
151
+ { type: TranslateService },
152
+ { type: MenuService }
153
+ ];
154
+ DossierManagementRemoveModalComponent.propDecorators = {
155
+ modal: [{ type: ViewChild, args: ['documentDefinitionRemoveModal',] }]
156
+ };
157
+
158
+ /*
159
+ * Copyright 2015-2020 Ritense BV, the Netherlands.
160
+ *
161
+ * Licensed under EUPL, Version 1.2 (the "License");
162
+ * you may not use this file except in compliance with the License.
163
+ * You may obtain a copy of the License at
164
+ *
165
+ * https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12
166
+ *
167
+ * Unless required by applicable law or agreed to in writing, software
168
+ * distributed under the License is distributed on an "AS IS" basis,
169
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
170
+ * See the License for the specific language governing permissions and
171
+ * limitations under the License.
172
+ */
173
+ class DossierManagementDetailComponent {
174
+ constructor(documentService, route, alertService) {
175
+ this.documentService = documentService;
176
+ this.route = route;
177
+ this.alertService = alertService;
178
+ this.documentDefinitionName = null;
179
+ this.documentDefinition = null;
180
+ this.processDocumentDefinitions = [];
181
+ this.documentDefinitionName = this.route.snapshot.paramMap.get('name');
182
+ }
183
+ ngOnInit() {
184
+ this.loadDocumentDefinition();
185
+ this.loadProcessDocumentDefinitions();
186
+ }
187
+ loadProcessDocumentDefinitions() {
188
+ this.documentService
189
+ .findProcessDocumentDefinitions(this.documentDefinitionName)
190
+ .subscribe((processDocumentDefinitions) => {
191
+ this.processDocumentDefinitions = processDocumentDefinitions;
192
+ });
193
+ }
194
+ loadDocumentDefinition() {
195
+ this.documentService
196
+ .getDocumentDefinition(this.documentDefinitionName)
197
+ .subscribe((documentDefinition) => {
198
+ this.documentDefinition = documentDefinition;
199
+ });
200
+ }
201
+ openDossierConnectModal() {
202
+ this.dossierConnectModal.openModal(this.documentDefinition);
203
+ }
204
+ openDossierRemoveModal() {
205
+ this.dossierRemoveModal.openModal(this.documentDefinition);
206
+ }
207
+ deleteProcessDocumentDefinition(processDocumentDefinition) {
208
+ this.documentService
209
+ .deleteProcessDocumentDefinition({
210
+ documentDefinitionName: processDocumentDefinition.id.documentDefinitionId.name,
211
+ processDefinitionKey: processDocumentDefinition.id.processDefinitionKey,
212
+ canInitializeDocument: processDocumentDefinition.canInitializeDocument,
213
+ startableByUser: processDocumentDefinition.startableByUser
214
+ })
215
+ .subscribe(() => {
216
+ this.alertService.success('Successfully deleted process document definition');
217
+ this.loadProcessDocumentDefinitions();
218
+ }, () => {
219
+ this.alertService.error('Failed to delete process document definition');
220
+ });
221
+ }
222
+ downloadDefinition() {
223
+ const definition = this.documentDefinition;
224
+ const dataString = 'data:text/json;charset=utf-8,' + encodeURIComponent(JSON.stringify(definition.schema, null, 2));
225
+ const downloadAnchorElement = document.getElementById('downloadAnchorElement');
226
+ downloadAnchorElement.setAttribute('href', dataString);
227
+ downloadAnchorElement.setAttribute('download', `${definition.id.name}-v${definition.id.version}.json`);
228
+ downloadAnchorElement.click();
229
+ }
230
+ }
231
+ DossierManagementDetailComponent.decorators = [
232
+ { type: Component, args: [{
233
+ selector: 'valtimo-dossier-management-detail',
234
+ template: "<!--\n ~ Copyright 2015-2020 Ritense BV, the Netherlands.\n ~\n ~ Licensed under EUPL, Version 1.2 (the \"License\");\n ~ you may not use this file except in compliance with the License.\n ~ You may obtain a copy of the License at\n ~\n ~ https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12\n ~\n ~ Unless required by applicable law or agreed to in writing, software\n ~ distributed under the License is distributed on an \"AS IS\" basis,\n ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n ~ See the License for the specific language governing permissions and\n ~ limitations under the License.\n -->\n\n<div class=\"main-content pt-0\">\n <div class=\"container-fluid\">\n <div *ngIf=\"documentDefinition\" class=\"btn-group mt-m3px mb-3 float-right\">\n <button class=\"btn btn-primary btn-space\" (click)=\"downloadDefinition()\">\n <i class=\"icon mdi mdi-download\"></i>&nbsp;\n {{ 'Download document definition' | translate }}\n </button>\n <a id=\"downloadAnchorElement\" style=\"display: none\"></a>\n <button *ngIf=\"!this.documentDefinition.readOnly\" class=\"btn btn-secondary btn-space mr-0\"\n (click)=\"openDossierRemoveModal()\">\n <i class=\"icon mdi mdi-delete\"></i>&nbsp;\n {{ 'Remove document definition' | translate }}\n </button>\n </div>\n <div class=\"clearfix\"></div>\n <valtimo-widget *ngIf=\"documentDefinition\">\n <div class=\"bg-light dossier-header\">\n <h3 class=\"dossier-title\">{{ documentDefinition.schema.title }}\n <div *ngIf=\"documentDefinition.readOnly\" class=\"pull-right\">\n <span class=\"badge badge-pill badge-info increase-size\">Read-only</span>\n </div>\n </h3>\n </div>\n <div class=\"row bg-white mt-5 mb-2 pl-2 pr-2\">\n <div class=\"col-5\">\n <h2>{{ 'document definition' | translate }}</h2>\n </div>\n <div class=\"col-5 offset-2\">\n <h2>Connected processes</h2>\n </div>\n </div>\n <div class=\"row bg-white mb-5 pb-4 pl-2 pr-2\">\n <div class=\"col-5 bg-red\">\n <textarea class=\"w-100 dossier-schema\" rows=\"25\" disabled>{{ documentDefinition | json }}\n </textarea>\n </div>\n <div class=\"col-5 offset-2 bg-blue\">\n <div class=\"input-group mb-5\"\n *ngFor=\"let processDocumentDefinition of processDocumentDefinitions\">\n <div class=\"input-group-prepend w-75\">\n <button class=\"btn btn-danger\" (click)=\"deleteProcessDocumentDefinition(processDocumentDefinition)\"\n data-toggle=\"tooltip\" data-placement=\"left\" title=\"Delete this connected process\">\n <i class=\"fa fa-trash\"></i>\n </button>\n <input class=\"form-control\"\n [value]=\"processDocumentDefinition.processName ? processDocumentDefinition.processName\n : '' + ' (' + processDocumentDefinition.id.processDefinitionKey + ')'\"\n type=\"text\"\n disabled\n />\n </div>\n <div class=\"row mb-2 mt-2\">\n <label class=\"custom-control custom-checkbox custom-control-inline pl-6 mr-5\">\n <input\n class=\"custom-control-input\"\n type=\"checkbox\"\n [checked]=\"processDocumentDefinition.canInitializeDocument\"\n disabled\n /><span class=\"custom-control-label custom-control-color\">Init document?</span>\n </label>\n <label class=\"custom-control custom-checkbox custom-control-inline pl-6\">\n <input\n class=\"custom-control-input\"\n type=\"checkbox\"\n [checked]=\"processDocumentDefinition.startableByUser\"\n disabled\n /><span class=\"custom-control-label custom-control-color\">{{ 'Startable by user' | translate }}?</span>\n </label>\n </div>\n </div>\n <div class=\"text-right mt-5 mb-5\">\n <button class=\"btn btn-primary\" (click)=\"openDossierConnectModal()\">\n <i class=\"icon mdi mdi-plus\"></i> &nbsp; Connect process\n </button>\n </div>\n <valtimo-extension\n module=\"dossier-management\"\n page=\"dossier\"\n section=\"openzaak-zaaktype-link\"\n ></valtimo-extension>\n <valtimo-extension\n module=\"dossier-management\"\n page=\"dossier\"\n section=\"connector-link\"\n ></valtimo-extension>\n </div>\n </div>\n </valtimo-widget>\n\n <valtimo-dossier-management-connect-modal\n #dossierConnectModal\n (reloadProcessDocumentDefinitions)=\"loadProcessDocumentDefinitions()\"\n ></valtimo-dossier-management-connect-modal>\n <valtimo-dossier-management-remove-modal #dossierRemoveModal></valtimo-dossier-management-remove-modal>\n </div>\n\n</div>\n",
235
+ styles: ["/*!\n * Copyright 2015-2020 Ritense BV, the Netherlands.\n *\n * Licensed under EUPL, Version 1.2 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" basis,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */.dossier-header{border-bottom:1px solid #dee2e6;height:80px;padding-left:18px;padding-right:18px;padding-top:21px}.dossier-title{margin-bottom:7px;margin-top:0}.row{margin:0}.dossier-schema{resize:none}"]
236
+ },] }
237
+ ];
238
+ DossierManagementDetailComponent.ctorParameters = () => [
239
+ { type: DocumentService },
240
+ { type: ActivatedRoute },
241
+ { type: AlertService }
242
+ ];
243
+ DossierManagementDetailComponent.propDecorators = {
244
+ dossierConnectModal: [{ type: ViewChild, args: ['dossierConnectModal',] }],
245
+ dossierRemoveModal: [{ type: ViewChild, args: ['dossierRemoveModal',] }]
246
+ };
247
+
248
+ /*
249
+ * Copyright 2015-2020 Ritense BV, the Netherlands.
250
+ *
251
+ * Licensed under EUPL, Version 1.2 (the "License");
252
+ * you may not use this file except in compliance with the License.
253
+ * You may obtain a copy of the License at
254
+ *
255
+ * https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12
256
+ *
257
+ * Unless required by applicable law or agreed to in writing, software
258
+ * distributed under the License is distributed on an "AS IS" basis,
259
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
260
+ * See the License for the specific language governing permissions and
261
+ * limitations under the License.
262
+ */
263
+ const moment = moment_;
264
+ moment.locale(localStorage.getItem('langKey') || '');
265
+ class DossierManagementListComponent {
266
+ constructor(documentService, router) {
267
+ this.documentService = documentService;
268
+ this.router = router;
269
+ this.dossiers = [];
270
+ this.pagination = {
271
+ collectionSize: 0,
272
+ page: 1,
273
+ size: 10,
274
+ maxPaginationItemSize: 5
275
+ };
276
+ this.pageParam = 0;
277
+ this.dossierFields = [
278
+ { key: 'schema.title', label: 'Title' },
279
+ { key: 'createdOn', label: 'Created On' },
280
+ { key: 'readOnly', label: 'Read-only' }
281
+ ];
282
+ this.showModal$ = new BehaviorSubject(false);
283
+ }
284
+ paginationClicked(page) {
285
+ this.pageParam = page - 1;
286
+ this.getDocumentDefinitions();
287
+ }
288
+ paginationSet() {
289
+ this.getDocumentDefinitions();
290
+ }
291
+ redirectToDetails(documentDefinition) {
292
+ this.router.navigate(['/dossier-management/dossier', documentDefinition.id.name]);
293
+ }
294
+ getDocumentDefinitions() {
295
+ this.documentService
296
+ .queryDefinitions({ page: this.pageParam, size: this.pagination.size })
297
+ .subscribe((documentDefinitionPage) => {
298
+ this.pagination.collectionSize = documentDefinitionPage.totalElements;
299
+ this.dossiers = documentDefinitionPage.content;
300
+ this.dossiers.map((dossier) => {
301
+ dossier.createdOn = moment(dossier.createdOn).format('DD MMM YYYY HH:mm');
302
+ });
303
+ });
304
+ }
305
+ showModal() {
306
+ this.showModal$.next(true);
307
+ }
308
+ }
309
+ DossierManagementListComponent.decorators = [
310
+ { type: Component, args: [{
311
+ selector: 'valtimo-dossier-management-list',
312
+ template: "<!--\n ~ Copyright 2015-2020 Ritense BV, the Netherlands.\n ~\n ~ Licensed under EUPL, Version 1.2 (the \"License\");\n ~ you may not use this file except in compliance with the License.\n ~ You may obtain a copy of the License at\n ~\n ~ https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12\n ~\n ~ Unless required by applicable law or agreed to in writing, software\n ~ distributed under the License is distributed on an \"AS IS\" basis,\n ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n ~ See the License for the specific language governing permissions and\n ~ limitations under the License.\n -->\n\n<div class=\"main-content pt-0\">\n <div class=\"container-fluid\">\n <div class=\"btn-group mt-m3px mb-3 float-right\">\n <button class=\"btn btn-secondary btn-space mr-0\" (click)=\"showModal()\">\n <i class=\"icon mdi mdi-upload\"></i>&nbsp;\n {{ 'Upload document definition' | translate }}\n </button>\n </div>\n <div class=\"clearfix\"></div>\n <valtimo-widget>\n <valtimo-list\n [items]=\"dossiers\"\n [fields]=\"dossierFields\"\n [header]=\"true\"\n [viewMode]=\"true\"\n [isSearchable]=\"true\"\n [pagination]=\"pagination\"\n paginationIdentifier=\"dossierManagementList\"\n (paginationClicked)=\"paginationClicked($event)\"\n (paginationSet)=\"paginationSet()\"\n (rowClicked)=\"redirectToDetails($event)\"\n >\n <div header>\n <h3 class=\"list-header-title\">{{ 'Dossiers' | translate }}</h3>\n <h5 class=\"list-header-description\">{{ 'Overview of all Dossiers' | translate }}</h5>\n </div>\n </valtimo-list>\n </valtimo-widget>\n </div>\n</div>\n\n<valtimo-dossier-management-upload\n [show$]=\"showModal$\"\n (definitionUploaded)=\"paginationSet()\"\n></valtimo-dossier-management-upload>\n",
313
+ styles: ["/*!\n * Copyright 2015-2020 Ritense BV, the Netherlands.\n *\n * Licensed under EUPL, Version 1.2 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" basis,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */"]
314
+ },] }
315
+ ];
316
+ DossierManagementListComponent.ctorParameters = () => [
317
+ { type: DocumentService },
318
+ { type: Router }
319
+ ];
320
+
321
+ /*
322
+ * Copyright 2015-2020 Ritense BV, the Netherlands.
323
+ *
324
+ * Licensed under EUPL, Version 1.2 (the "License");
325
+ * you may not use this file except in compliance with the License.
326
+ * You may obtain a copy of the License at
327
+ *
328
+ * https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12
329
+ *
330
+ * Unless required by applicable law or agreed to in writing, software
331
+ * distributed under the License is distributed on an "AS IS" basis,
332
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
333
+ * See the License for the specific language governing permissions and
334
+ * limitations under the License.
335
+ */
336
+ const ɵ0 = { title: 'Dossiers', roles: [ROLE_ADMIN] }, ɵ1 = { title: 'Dossier details', roles: [ROLE_ADMIN] };
337
+ const routes = [
338
+ {
339
+ path: 'dossier-management',
340
+ component: DossierManagementListComponent,
341
+ canActivate: [AuthGuardService],
342
+ data: ɵ0
343
+ },
344
+ {
345
+ path: 'dossier-management/dossier/:name',
346
+ component: DossierManagementDetailComponent,
347
+ canActivate: [AuthGuardService],
348
+ data: ɵ1
349
+ }
350
+ ];
351
+ class DossierManagementRoutingModule {
352
+ }
353
+ DossierManagementRoutingModule.decorators = [
354
+ { type: NgModule, args: [{
355
+ imports: [
356
+ RouterModule.forRoot(routes)
357
+ ],
358
+ exports: [
359
+ RouterModule
360
+ ],
361
+ declarations: []
362
+ },] }
363
+ ];
364
+
365
+ /*
366
+ * Copyright 2015-2020 Ritense BV, the Netherlands.
367
+ *
368
+ * Licensed under EUPL, Version 1.2 (the "License");
369
+ * you may not use this file except in compliance with the License.
370
+ * You may obtain a copy of the License at
371
+ *
372
+ * https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12
373
+ *
374
+ * Unless required by applicable law or agreed to in writing, software
375
+ * distributed under the License is distributed on an "AS IS" basis,
376
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
377
+ * See the License for the specific language governing permissions and
378
+ * limitations under the License.
379
+ */
380
+ class DossierManagementUploadComponent {
381
+ constructor(documentService, translateService, menuService) {
382
+ this.documentService = documentService;
383
+ this.translateService = translateService;
384
+ this.menuService = menuService;
385
+ this.definitionUploaded = new EventEmitter();
386
+ this.clear$ = new Subject();
387
+ this.jsonString$ = new BehaviorSubject('');
388
+ this.error$ = new BehaviorSubject('');
389
+ this.disabled$ = new BehaviorSubject(false);
390
+ this.file$ = new BehaviorSubject(undefined);
391
+ }
392
+ ngAfterViewInit() {
393
+ this.openShowSubscription();
394
+ this.openFileSubscription();
395
+ }
396
+ ngOnDestroy() {
397
+ this.showSubscription.unsubscribe();
398
+ this.fileSubscription.unsubscribe();
399
+ this.closeErrorSubscription();
400
+ }
401
+ setFile(file) {
402
+ this.clearError();
403
+ this.file$.next(file);
404
+ }
405
+ uploadDefinition() {
406
+ this.disable();
407
+ this.jsonString$
408
+ .pipe(switchMap(jsonString => this.documentService.createDocumentDefinition(new DocumentDefinitionCreateRequest(jsonString)).pipe(tap(
409
+ // success
410
+ () => {
411
+ this.closeErrorSubscription();
412
+ this.clearError();
413
+ this.enable();
414
+ this.hideModal();
415
+ this.menuService.reload();
416
+ this.definitionUploaded.emit();
417
+ },
418
+ // error
419
+ () => {
420
+ this.openErrorSubscription('dropzone.error.invalidDocDef');
421
+ this.enable();
422
+ }))), take(1))
423
+ .subscribe();
424
+ }
425
+ openErrorSubscription(errorCode) {
426
+ this.closeErrorSubscription();
427
+ this.errorSubscription = this.translateService.stream(errorCode).subscribe(error => {
428
+ this.error$.next(error);
429
+ });
430
+ }
431
+ closeErrorSubscription() {
432
+ if (this.errorSubscription) {
433
+ this.errorSubscription.unsubscribe();
434
+ }
435
+ }
436
+ clearError() {
437
+ this.error$.next('');
438
+ }
439
+ openFileSubscription() {
440
+ this.fileSubscription = this.file$.subscribe(file => {
441
+ if (file) {
442
+ const reader = new FileReader();
443
+ reader.onloadend = () => {
444
+ const result = reader.result.toString();
445
+ if (this.stringIsValidJson(result)) {
446
+ this.jsonString$.next(result);
447
+ }
448
+ };
449
+ reader.readAsText(file);
450
+ }
451
+ else {
452
+ this.clearJsonString();
453
+ }
454
+ });
455
+ }
456
+ openShowSubscription() {
457
+ this.showSubscription = this.show$.subscribe(show => {
458
+ if (show) {
459
+ this.showModal();
460
+ }
461
+ else {
462
+ this.hideModal();
463
+ }
464
+ this.clearJsonString();
465
+ this.clearError();
466
+ this.clearDropzone();
467
+ });
468
+ }
469
+ clearJsonString() {
470
+ this.jsonString$.next('');
471
+ }
472
+ clearDropzone() {
473
+ this.clear$.next();
474
+ }
475
+ showModal() {
476
+ this.modal.show();
477
+ }
478
+ hideModal() {
479
+ this.modal.hide();
480
+ }
481
+ stringIsValidJson(string) {
482
+ try {
483
+ JSON.parse(string);
484
+ }
485
+ catch (e) {
486
+ return false;
487
+ }
488
+ return true;
489
+ }
490
+ disable() {
491
+ this.disabled$.next(true);
492
+ }
493
+ enable() {
494
+ this.disabled$.next(false);
495
+ }
496
+ }
497
+ DossierManagementUploadComponent.decorators = [
498
+ { type: Component, args: [{
499
+ selector: 'valtimo-dossier-management-upload',
500
+ template: "<valtimo-modal #uploadDefinitionModal [title]=\"'Upload document definition' | translate\" showFooter=\"true\">\n <div class=\"mt-2\" body>\n <valtimo-dropzone\n [clear$]=\"clear$\"\n (fileSelected)=\"setFile($event)\"\n [disabled]=\"disabled$ | async\"\n [subtitle]=\"'dropzone.jsonDocDef' | translate\"\n [externalError$]=\"error$\"\n ></valtimo-dropzone>\n </div>\n <div footer>\n <ng-container *ngIf=\"(jsonString$ | async) && !(error$ | async); else pleaseSelect\">\n <button [disabled]=\"disabled$ | async\" class=\"btn btn-primary\" (click)=\"uploadDefinition()\">\n {{ 'Upload' | translate }}\n </button>\n </ng-container>\n </div>\n</valtimo-modal>\n\n<ng-template #pleaseSelect>\n <button class=\"btn btn-primary\" [disabled]=\"true\">\n {{ 'Select a document definition' | translate }}\n </button>\n</ng-template>\n",
501
+ styles: [""]
502
+ },] }
503
+ ];
504
+ DossierManagementUploadComponent.ctorParameters = () => [
505
+ { type: DocumentService },
506
+ { type: TranslateService },
507
+ { type: MenuService }
508
+ ];
509
+ DossierManagementUploadComponent.propDecorators = {
510
+ show$: [{ type: Input }],
511
+ definitionUploaded: [{ type: Output }],
512
+ modal: [{ type: ViewChild, args: ['uploadDefinitionModal',] }]
513
+ };
514
+
515
+ /*
516
+ * Copyright 2015-2020 Ritense BV, the Netherlands.
517
+ *
518
+ * Licensed under EUPL, Version 1.2 (the "License");
519
+ * you may not use this file except in compliance with the License.
520
+ * You may obtain a copy of the License at
521
+ *
522
+ * https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12
523
+ *
524
+ * Unless required by applicable law or agreed to in writing, software
525
+ * distributed under the License is distributed on an "AS IS" basis,
526
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
527
+ * See the License for the specific language governing permissions and
528
+ * limitations under the License.
529
+ */
530
+ class DossierManagementModule {
531
+ }
532
+ DossierManagementModule.decorators = [
533
+ { type: NgModule, args: [{
534
+ declarations: [
535
+ DossierManagementListComponent,
536
+ DossierManagementDetailComponent,
537
+ DossierManagementConnectModalComponent,
538
+ DossierManagementRemoveModalComponent,
539
+ DossierManagementUploadComponent
540
+ ],
541
+ imports: [
542
+ CommonModule,
543
+ WidgetModule,
544
+ DropzoneModule,
545
+ ListModule,
546
+ DossierManagementRoutingModule,
547
+ FormsModule,
548
+ TranslateModule,
549
+ ModalModule,
550
+ ConfigModule,
551
+ NgbTooltipModule
552
+ ],
553
+ exports: [],
554
+ entryComponents: [ExtensionComponent]
555
+ },] }
556
+ ];
557
+
558
+ /*
559
+ * Copyright 2015-2020 Ritense BV, the Netherlands.
560
+ *
561
+ * Licensed under EUPL, Version 1.2 (the "License");
562
+ * you may not use this file except in compliance with the License.
563
+ * You may obtain a copy of the License at
564
+ *
565
+ * https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12
566
+ *
567
+ * Unless required by applicable law or agreed to in writing, software
568
+ * distributed under the License is distributed on an "AS IS" basis,
569
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
570
+ * See the License for the specific language governing permissions and
571
+ * limitations under the License.
572
+ */
573
+
574
+ /**
575
+ * Generated bundle index. Do not edit.
576
+ */
577
+
578
+ export { DossierManagementListComponent, DossierManagementModule, DossierManagementDetailComponent as ɵa, DossierManagementConnectModalComponent as ɵb, DossierManagementRemoveModalComponent as ɵc, DossierManagementUploadComponent as ɵd, DossierManagementRoutingModule as ɵe };
579
+ //# sourceMappingURL=valtimo-dossier-management.js.map