@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,601 @@
1
+ (function (global, factory) {
2
+ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/common'), require('@angular/core'), require('@angular/forms'), require('@ngx-translate/core'), require('@valtimo/components'), require('@valtimo/config'), require('@valtimo/document'), require('@valtimo/process'), require('ngx-toastr'), require('@angular/router'), require('moment'), require('rxjs'), require('@valtimo/security'), require('@valtimo/contract'), require('rxjs/operators'), require('@ng-bootstrap/ng-bootstrap')) :
3
+ typeof define === 'function' && define.amd ? define('@valtimo/dossier-management', ['exports', '@angular/common', '@angular/core', '@angular/forms', '@ngx-translate/core', '@valtimo/components', '@valtimo/config', '@valtimo/document', '@valtimo/process', 'ngx-toastr', '@angular/router', 'moment', 'rxjs', '@valtimo/security', '@valtimo/contract', 'rxjs/operators', '@ng-bootstrap/ng-bootstrap'], factory) :
4
+ (global = global || self, factory((global.valtimo = global.valtimo || {}, global.valtimo['dossier-management'] = {}), global.ng.common, global.ng.core, global.ng.forms, global.core$1, global.components, global.config, global.document, global.process, global.ngxToastr, global.ng.router, global.moment, global.rxjs, global.security, global.contract, global.rxjs.operators, global.ngBootstrap));
5
+ }(this, (function (exports, common, core, forms, core$1, components, config, document$1, process, ngxToastr, router, moment_, rxjs, security, contract, operators, ngBootstrap) { 'use strict';
6
+
7
+ /*
8
+ * Copyright 2015-2020 Ritense BV, the Netherlands.
9
+ *
10
+ * Licensed under EUPL, Version 1.2 (the "License");
11
+ * you may not use this file except in compliance with the License.
12
+ * You may obtain a copy of the License at
13
+ *
14
+ * https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12
15
+ *
16
+ * Unless required by applicable law or agreed to in writing, software
17
+ * distributed under the License is distributed on an "AS IS" basis,
18
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19
+ * See the License for the specific language governing permissions and
20
+ * limitations under the License.
21
+ */
22
+ var DossierManagementConnectModalComponent = /** @class */ (function () {
23
+ function DossierManagementConnectModalComponent(processService, documentService, toasterService) {
24
+ this.processService = processService;
25
+ this.documentService = documentService;
26
+ this.toasterService = toasterService;
27
+ this.documentDefinition = null;
28
+ this.newDocumentProcessDefinition = null;
29
+ this.newDocumentProcessDefinitionInit = true;
30
+ this.newDocumentProcessDefinitionStartableByUser = false;
31
+ this.processDocumentDefinitionExists = {};
32
+ this.reloadProcessDocumentDefinitions = new core.EventEmitter();
33
+ }
34
+ DossierManagementConnectModalComponent.prototype.loadProcessDocumentDefinitions = function () {
35
+ var _this = this;
36
+ this.processDocumentDefinitionExists = {};
37
+ this.documentService.findProcessDocumentDefinitions(this.documentDefinition.id.name).subscribe(function (processDocumentDefinitions) {
38
+ processDocumentDefinitions.forEach(function (processDocumentDefinition) {
39
+ _this.processDocumentDefinitionExists[processDocumentDefinition.id.processDefinitionKey] = true;
40
+ });
41
+ });
42
+ };
43
+ DossierManagementConnectModalComponent.prototype.loadProcessDefinitions = function () {
44
+ var _this = this;
45
+ this.processService.getProcessDefinitions().subscribe(function (processDefinitions) {
46
+ _this.processDefinitions = processDefinitions;
47
+ });
48
+ };
49
+ DossierManagementConnectModalComponent.prototype.ngOnInit = function () {
50
+ this.loadProcessDefinitions();
51
+ };
52
+ DossierManagementConnectModalComponent.prototype.openModal = function (dossier) {
53
+ this.documentDefinition = dossier;
54
+ this.newDocumentProcessDefinition = null;
55
+ this.newDocumentProcessDefinitionInit = true;
56
+ this.newDocumentProcessDefinitionStartableByUser = false;
57
+ this.loadProcessDocumentDefinitions();
58
+ this.modal.show();
59
+ };
60
+ DossierManagementConnectModalComponent.prototype.submit = function () {
61
+ var _this = this;
62
+ var request = {
63
+ canInitializeDocument: this.newDocumentProcessDefinitionInit,
64
+ startableByUser: this.newDocumentProcessDefinitionStartableByUser,
65
+ documentDefinitionName: this.documentDefinition.id.name,
66
+ processDefinitionKey: this.newDocumentProcessDefinition.key
67
+ };
68
+ this.documentService.createProcessDocumentDefinition(request).subscribe(function () {
69
+ _this.toasterService.success('Successfully added new process document definition');
70
+ _this.reloadProcessDocumentDefinitions.emit();
71
+ }, function (err) {
72
+ _this.toasterService.error('Failed to add new process document definition');
73
+ });
74
+ };
75
+ return DossierManagementConnectModalComponent;
76
+ }());
77
+ DossierManagementConnectModalComponent.decorators = [
78
+ { type: core.Component, args: [{
79
+ selector: 'valtimo-dossier-management-connect-modal',
80
+ 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",
81
+ 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 */"]
82
+ },] }
83
+ ];
84
+ DossierManagementConnectModalComponent.ctorParameters = function () { return [
85
+ { type: process.ProcessService },
86
+ { type: document$1.DocumentService },
87
+ { type: ngxToastr.ToastrService }
88
+ ]; };
89
+ DossierManagementConnectModalComponent.propDecorators = {
90
+ reloadProcessDocumentDefinitions: [{ type: core.Output }],
91
+ modal: [{ type: core.ViewChild, args: ['dossierConnectModal',] }]
92
+ };
93
+
94
+ /*
95
+ * Copyright 2015-2020 Ritense BV, the Netherlands.
96
+ *
97
+ * Licensed under EUPL, Version 1.2 (the "License");
98
+ * you may not use this file except in compliance with the License.
99
+ * You may obtain a copy of the License at
100
+ *
101
+ * https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12
102
+ *
103
+ * Unless required by applicable law or agreed to in writing, software
104
+ * distributed under the License is distributed on an "AS IS" basis,
105
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
106
+ * See the License for the specific language governing permissions and
107
+ * limitations under the License.
108
+ */
109
+ var DossierManagementDetailComponent = /** @class */ (function () {
110
+ function DossierManagementDetailComponent(documentService, route, alertService) {
111
+ this.documentService = documentService;
112
+ this.route = route;
113
+ this.alertService = alertService;
114
+ this.documentDefinitionName = null;
115
+ this.documentDefinition = null;
116
+ this.processDocumentDefinitions = [];
117
+ this.documentDefinitionName = this.route.snapshot.paramMap.get('name');
118
+ }
119
+ DossierManagementDetailComponent.prototype.ngOnInit = function () {
120
+ this.loadDocumentDefinition();
121
+ this.loadProcessDocumentDefinitions();
122
+ };
123
+ DossierManagementDetailComponent.prototype.loadProcessDocumentDefinitions = function () {
124
+ var _this = this;
125
+ this.documentService
126
+ .findProcessDocumentDefinitions(this.documentDefinitionName)
127
+ .subscribe(function (processDocumentDefinitions) {
128
+ _this.processDocumentDefinitions = processDocumentDefinitions;
129
+ });
130
+ };
131
+ DossierManagementDetailComponent.prototype.loadDocumentDefinition = function () {
132
+ var _this = this;
133
+ this.documentService
134
+ .getDocumentDefinition(this.documentDefinitionName)
135
+ .subscribe(function (documentDefinition) {
136
+ _this.documentDefinition = documentDefinition;
137
+ });
138
+ };
139
+ DossierManagementDetailComponent.prototype.openDossierConnectModal = function () {
140
+ this.dossierConnectModal.openModal(this.documentDefinition);
141
+ };
142
+ DossierManagementDetailComponent.prototype.openDossierRemoveModal = function () {
143
+ this.dossierRemoveModal.openModal(this.documentDefinition);
144
+ };
145
+ DossierManagementDetailComponent.prototype.deleteProcessDocumentDefinition = function (processDocumentDefinition) {
146
+ var _this = this;
147
+ this.documentService
148
+ .deleteProcessDocumentDefinition({
149
+ documentDefinitionName: processDocumentDefinition.id.documentDefinitionId.name,
150
+ processDefinitionKey: processDocumentDefinition.id.processDefinitionKey,
151
+ canInitializeDocument: processDocumentDefinition.canInitializeDocument,
152
+ startableByUser: processDocumentDefinition.startableByUser
153
+ })
154
+ .subscribe(function () {
155
+ _this.alertService.success('Successfully deleted process document definition');
156
+ _this.loadProcessDocumentDefinitions();
157
+ }, function () {
158
+ _this.alertService.error('Failed to delete process document definition');
159
+ });
160
+ };
161
+ DossierManagementDetailComponent.prototype.downloadDefinition = function () {
162
+ var definition = this.documentDefinition;
163
+ var dataString = 'data:text/json;charset=utf-8,' + encodeURIComponent(JSON.stringify(definition.schema, null, 2));
164
+ var downloadAnchorElement = document.getElementById('downloadAnchorElement');
165
+ downloadAnchorElement.setAttribute('href', dataString);
166
+ downloadAnchorElement.setAttribute('download', definition.id.name + "-v" + definition.id.version + ".json");
167
+ downloadAnchorElement.click();
168
+ };
169
+ return DossierManagementDetailComponent;
170
+ }());
171
+ DossierManagementDetailComponent.decorators = [
172
+ { type: core.Component, args: [{
173
+ selector: 'valtimo-dossier-management-detail',
174
+ 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",
175
+ 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}"]
176
+ },] }
177
+ ];
178
+ DossierManagementDetailComponent.ctorParameters = function () { return [
179
+ { type: document$1.DocumentService },
180
+ { type: router.ActivatedRoute },
181
+ { type: components.AlertService }
182
+ ]; };
183
+ DossierManagementDetailComponent.propDecorators = {
184
+ dossierConnectModal: [{ type: core.ViewChild, args: ['dossierConnectModal',] }],
185
+ dossierRemoveModal: [{ type: core.ViewChild, args: ['dossierRemoveModal',] }]
186
+ };
187
+
188
+ /*
189
+ * Copyright 2015-2020 Ritense BV, the Netherlands.
190
+ *
191
+ * Licensed under EUPL, Version 1.2 (the "License");
192
+ * you may not use this file except in compliance with the License.
193
+ * You may obtain a copy of the License at
194
+ *
195
+ * https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12
196
+ *
197
+ * Unless required by applicable law or agreed to in writing, software
198
+ * distributed under the License is distributed on an "AS IS" basis,
199
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ * See the License for the specific language governing permissions and
201
+ * limitations under the License.
202
+ */
203
+ var moment = moment_;
204
+ moment.locale(localStorage.getItem('langKey') || '');
205
+ var DossierManagementListComponent = /** @class */ (function () {
206
+ function DossierManagementListComponent(documentService, router) {
207
+ this.documentService = documentService;
208
+ this.router = router;
209
+ this.dossiers = [];
210
+ this.pagination = {
211
+ collectionSize: 0,
212
+ page: 1,
213
+ size: 10,
214
+ maxPaginationItemSize: 5
215
+ };
216
+ this.pageParam = 0;
217
+ this.dossierFields = [
218
+ { key: 'schema.title', label: 'Title' },
219
+ { key: 'createdOn', label: 'Created On' },
220
+ { key: 'readOnly', label: 'Read-only' }
221
+ ];
222
+ this.showModal$ = new rxjs.BehaviorSubject(false);
223
+ }
224
+ DossierManagementListComponent.prototype.paginationClicked = function (page) {
225
+ this.pageParam = page - 1;
226
+ this.getDocumentDefinitions();
227
+ };
228
+ DossierManagementListComponent.prototype.paginationSet = function () {
229
+ this.getDocumentDefinitions();
230
+ };
231
+ DossierManagementListComponent.prototype.redirectToDetails = function (documentDefinition) {
232
+ this.router.navigate(['/dossier-management/dossier', documentDefinition.id.name]);
233
+ };
234
+ DossierManagementListComponent.prototype.getDocumentDefinitions = function () {
235
+ var _this = this;
236
+ this.documentService
237
+ .queryDefinitions({ page: this.pageParam, size: this.pagination.size })
238
+ .subscribe(function (documentDefinitionPage) {
239
+ _this.pagination.collectionSize = documentDefinitionPage.totalElements;
240
+ _this.dossiers = documentDefinitionPage.content;
241
+ _this.dossiers.map(function (dossier) {
242
+ dossier.createdOn = moment(dossier.createdOn).format('DD MMM YYYY HH:mm');
243
+ });
244
+ });
245
+ };
246
+ DossierManagementListComponent.prototype.showModal = function () {
247
+ this.showModal$.next(true);
248
+ };
249
+ return DossierManagementListComponent;
250
+ }());
251
+ DossierManagementListComponent.decorators = [
252
+ { type: core.Component, args: [{
253
+ selector: 'valtimo-dossier-management-list',
254
+ 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",
255
+ 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 */"]
256
+ },] }
257
+ ];
258
+ DossierManagementListComponent.ctorParameters = function () { return [
259
+ { type: document$1.DocumentService },
260
+ { type: router.Router }
261
+ ]; };
262
+
263
+ /*
264
+ * Copyright 2015-2020 Ritense BV, the Netherlands.
265
+ *
266
+ * Licensed under EUPL, Version 1.2 (the "License");
267
+ * you may not use this file except in compliance with the License.
268
+ * You may obtain a copy of the License at
269
+ *
270
+ * https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12
271
+ *
272
+ * Unless required by applicable law or agreed to in writing, software
273
+ * distributed under the License is distributed on an "AS IS" basis,
274
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
275
+ * See the License for the specific language governing permissions and
276
+ * limitations under the License.
277
+ */
278
+ var ɵ0 = { title: 'Dossiers', roles: [contract.ROLE_ADMIN] }, ɵ1 = { title: 'Dossier details', roles: [contract.ROLE_ADMIN] };
279
+ var routes = [
280
+ {
281
+ path: 'dossier-management',
282
+ component: DossierManagementListComponent,
283
+ canActivate: [security.AuthGuardService],
284
+ data: ɵ0
285
+ },
286
+ {
287
+ path: 'dossier-management/dossier/:name',
288
+ component: DossierManagementDetailComponent,
289
+ canActivate: [security.AuthGuardService],
290
+ data: ɵ1
291
+ }
292
+ ];
293
+ var DossierManagementRoutingModule = /** @class */ (function () {
294
+ function DossierManagementRoutingModule() {
295
+ }
296
+ return DossierManagementRoutingModule;
297
+ }());
298
+ DossierManagementRoutingModule.decorators = [
299
+ { type: core.NgModule, args: [{
300
+ imports: [
301
+ router.RouterModule.forRoot(routes)
302
+ ],
303
+ exports: [
304
+ router.RouterModule
305
+ ],
306
+ declarations: []
307
+ },] }
308
+ ];
309
+
310
+ /*
311
+ * Copyright 2015-2020 Ritense BV, the Netherlands.
312
+ *
313
+ * Licensed under EUPL, Version 1.2 (the "License");
314
+ * you may not use this file except in compliance with the License.
315
+ * You may obtain a copy of the License at
316
+ *
317
+ * https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12
318
+ *
319
+ * Unless required by applicable law or agreed to in writing, software
320
+ * distributed under the License is distributed on an "AS IS" basis,
321
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
322
+ * See the License for the specific language governing permissions and
323
+ * limitations under the License.
324
+ */
325
+ var DossierManagementUploadComponent = /** @class */ (function () {
326
+ function DossierManagementUploadComponent(documentService, translateService, menuService) {
327
+ this.documentService = documentService;
328
+ this.translateService = translateService;
329
+ this.menuService = menuService;
330
+ this.definitionUploaded = new core.EventEmitter();
331
+ this.clear$ = new rxjs.Subject();
332
+ this.jsonString$ = new rxjs.BehaviorSubject('');
333
+ this.error$ = new rxjs.BehaviorSubject('');
334
+ this.disabled$ = new rxjs.BehaviorSubject(false);
335
+ this.file$ = new rxjs.BehaviorSubject(undefined);
336
+ }
337
+ DossierManagementUploadComponent.prototype.ngAfterViewInit = function () {
338
+ this.openShowSubscription();
339
+ this.openFileSubscription();
340
+ };
341
+ DossierManagementUploadComponent.prototype.ngOnDestroy = function () {
342
+ this.showSubscription.unsubscribe();
343
+ this.fileSubscription.unsubscribe();
344
+ this.closeErrorSubscription();
345
+ };
346
+ DossierManagementUploadComponent.prototype.setFile = function (file) {
347
+ this.clearError();
348
+ this.file$.next(file);
349
+ };
350
+ DossierManagementUploadComponent.prototype.uploadDefinition = function () {
351
+ var _this = this;
352
+ this.disable();
353
+ this.jsonString$
354
+ .pipe(operators.switchMap(function (jsonString) { return _this.documentService.createDocumentDefinition(new contract.DocumentDefinitionCreateRequest(jsonString)).pipe(operators.tap(
355
+ // success
356
+ function () {
357
+ _this.closeErrorSubscription();
358
+ _this.clearError();
359
+ _this.enable();
360
+ _this.hideModal();
361
+ _this.menuService.reload();
362
+ _this.definitionUploaded.emit();
363
+ },
364
+ // error
365
+ function () {
366
+ _this.openErrorSubscription('dropzone.error.invalidDocDef');
367
+ _this.enable();
368
+ })); }), operators.take(1))
369
+ .subscribe();
370
+ };
371
+ DossierManagementUploadComponent.prototype.openErrorSubscription = function (errorCode) {
372
+ var _this = this;
373
+ this.closeErrorSubscription();
374
+ this.errorSubscription = this.translateService.stream(errorCode).subscribe(function (error) {
375
+ _this.error$.next(error);
376
+ });
377
+ };
378
+ DossierManagementUploadComponent.prototype.closeErrorSubscription = function () {
379
+ if (this.errorSubscription) {
380
+ this.errorSubscription.unsubscribe();
381
+ }
382
+ };
383
+ DossierManagementUploadComponent.prototype.clearError = function () {
384
+ this.error$.next('');
385
+ };
386
+ DossierManagementUploadComponent.prototype.openFileSubscription = function () {
387
+ var _this = this;
388
+ this.fileSubscription = this.file$.subscribe(function (file) {
389
+ if (file) {
390
+ var reader_1 = new FileReader();
391
+ reader_1.onloadend = function () {
392
+ var result = reader_1.result.toString();
393
+ if (_this.stringIsValidJson(result)) {
394
+ _this.jsonString$.next(result);
395
+ }
396
+ };
397
+ reader_1.readAsText(file);
398
+ }
399
+ else {
400
+ _this.clearJsonString();
401
+ }
402
+ });
403
+ };
404
+ DossierManagementUploadComponent.prototype.openShowSubscription = function () {
405
+ var _this = this;
406
+ this.showSubscription = this.show$.subscribe(function (show) {
407
+ if (show) {
408
+ _this.showModal();
409
+ }
410
+ else {
411
+ _this.hideModal();
412
+ }
413
+ _this.clearJsonString();
414
+ _this.clearError();
415
+ _this.clearDropzone();
416
+ });
417
+ };
418
+ DossierManagementUploadComponent.prototype.clearJsonString = function () {
419
+ this.jsonString$.next('');
420
+ };
421
+ DossierManagementUploadComponent.prototype.clearDropzone = function () {
422
+ this.clear$.next();
423
+ };
424
+ DossierManagementUploadComponent.prototype.showModal = function () {
425
+ this.modal.show();
426
+ };
427
+ DossierManagementUploadComponent.prototype.hideModal = function () {
428
+ this.modal.hide();
429
+ };
430
+ DossierManagementUploadComponent.prototype.stringIsValidJson = function (string) {
431
+ try {
432
+ JSON.parse(string);
433
+ }
434
+ catch (e) {
435
+ return false;
436
+ }
437
+ return true;
438
+ };
439
+ DossierManagementUploadComponent.prototype.disable = function () {
440
+ this.disabled$.next(true);
441
+ };
442
+ DossierManagementUploadComponent.prototype.enable = function () {
443
+ this.disabled$.next(false);
444
+ };
445
+ return DossierManagementUploadComponent;
446
+ }());
447
+ DossierManagementUploadComponent.decorators = [
448
+ { type: core.Component, args: [{
449
+ selector: 'valtimo-dossier-management-upload',
450
+ 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",
451
+ styles: [""]
452
+ },] }
453
+ ];
454
+ DossierManagementUploadComponent.ctorParameters = function () { return [
455
+ { type: document$1.DocumentService },
456
+ { type: core$1.TranslateService },
457
+ { type: components.MenuService }
458
+ ]; };
459
+ DossierManagementUploadComponent.propDecorators = {
460
+ show$: [{ type: core.Input }],
461
+ definitionUploaded: [{ type: core.Output }],
462
+ modal: [{ type: core.ViewChild, args: ['uploadDefinitionModal',] }]
463
+ };
464
+
465
+ /*
466
+ * Copyright 2015-2020 Ritense BV, the Netherlands.
467
+ *
468
+ * Licensed under EUPL, Version 1.2 (the "License");
469
+ * you may not use this file except in compliance with the License.
470
+ * You may obtain a copy of the License at
471
+ *
472
+ * https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12
473
+ *
474
+ * Unless required by applicable law or agreed to in writing, software
475
+ * distributed under the License is distributed on an "AS IS" basis,
476
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
477
+ * See the License for the specific language governing permissions and
478
+ * limitations under the License.
479
+ */
480
+ var DossierManagementRemoveModalComponent = /** @class */ (function () {
481
+ function DossierManagementRemoveModalComponent(documentService, toasterService, router, translateService, menuService) {
482
+ this.documentService = documentService;
483
+ this.toasterService = toasterService;
484
+ this.router = router;
485
+ this.translateService = translateService;
486
+ this.menuService = menuService;
487
+ this.documentDefinition = null;
488
+ this.errors = [];
489
+ }
490
+ DossierManagementRemoveModalComponent.prototype.openModal = function (documentDefinition) {
491
+ this.documentDefinition = documentDefinition;
492
+ this.modal.show();
493
+ };
494
+ DossierManagementRemoveModalComponent.prototype.removeDocumentDefinition = function () {
495
+ var _this = this;
496
+ this.documentService.removeDocumentDefinition(this.documentDefinition.id.name).subscribe(function () {
497
+ _this.menuService.reload();
498
+ _this.router.navigate(['/dossier-management']);
499
+ _this.toasterService.success(_this.translateService.instant('remove-document-definition-success'));
500
+ }, function (result) {
501
+ _this.errors = result.errors;
502
+ });
503
+ };
504
+ return DossierManagementRemoveModalComponent;
505
+ }());
506
+ DossierManagementRemoveModalComponent.decorators = [
507
+ { type: core.Component, args: [{
508
+ selector: 'valtimo-dossier-management-remove-modal',
509
+ 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",
510
+ 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 */"]
511
+ },] }
512
+ ];
513
+ DossierManagementRemoveModalComponent.ctorParameters = function () { return [
514
+ { type: document$1.DocumentService },
515
+ { type: ngxToastr.ToastrService },
516
+ { type: router.Router },
517
+ { type: core$1.TranslateService },
518
+ { type: components.MenuService }
519
+ ]; };
520
+ DossierManagementRemoveModalComponent.propDecorators = {
521
+ modal: [{ type: core.ViewChild, args: ['documentDefinitionRemoveModal',] }]
522
+ };
523
+
524
+ /*
525
+ * Copyright 2015-2020 Ritense BV, the Netherlands.
526
+ *
527
+ * Licensed under EUPL, Version 1.2 (the "License");
528
+ * you may not use this file except in compliance with the License.
529
+ * You may obtain a copy of the License at
530
+ *
531
+ * https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12
532
+ *
533
+ * Unless required by applicable law or agreed to in writing, software
534
+ * distributed under the License is distributed on an "AS IS" basis,
535
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
536
+ * See the License for the specific language governing permissions and
537
+ * limitations under the License.
538
+ */
539
+ var DossierManagementModule = /** @class */ (function () {
540
+ function DossierManagementModule() {
541
+ }
542
+ return DossierManagementModule;
543
+ }());
544
+ DossierManagementModule.decorators = [
545
+ { type: core.NgModule, args: [{
546
+ declarations: [
547
+ DossierManagementListComponent,
548
+ DossierManagementDetailComponent,
549
+ DossierManagementConnectModalComponent,
550
+ DossierManagementRemoveModalComponent,
551
+ DossierManagementUploadComponent
552
+ ],
553
+ imports: [
554
+ common.CommonModule,
555
+ components.WidgetModule,
556
+ components.DropzoneModule,
557
+ components.ListModule,
558
+ DossierManagementRoutingModule,
559
+ forms.FormsModule,
560
+ core$1.TranslateModule,
561
+ components.ModalModule,
562
+ config.ConfigModule,
563
+ ngBootstrap.NgbTooltipModule
564
+ ],
565
+ exports: [],
566
+ entryComponents: [config.ExtensionComponent]
567
+ },] }
568
+ ];
569
+
570
+ /*
571
+ * Copyright 2015-2020 Ritense BV, the Netherlands.
572
+ *
573
+ * Licensed under EUPL, Version 1.2 (the "License");
574
+ * you may not use this file except in compliance with the License.
575
+ * You may obtain a copy of the License at
576
+ *
577
+ * https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12
578
+ *
579
+ * Unless required by applicable law or agreed to in writing, software
580
+ * distributed under the License is distributed on an "AS IS" basis,
581
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
582
+ * See the License for the specific language governing permissions and
583
+ * limitations under the License.
584
+ */
585
+
586
+ /**
587
+ * Generated bundle index. Do not edit.
588
+ */
589
+
590
+ exports.DossierManagementListComponent = DossierManagementListComponent;
591
+ exports.DossierManagementModule = DossierManagementModule;
592
+ exports.ɵa = DossierManagementDetailComponent;
593
+ exports.ɵb = DossierManagementConnectModalComponent;
594
+ exports.ɵc = DossierManagementRemoveModalComponent;
595
+ exports.ɵd = DossierManagementUploadComponent;
596
+ exports.ɵe = DossierManagementRoutingModule;
597
+
598
+ Object.defineProperty(exports, '__esModule', { value: true });
599
+
600
+ })));
601
+ //# sourceMappingURL=valtimo-dossier-management.umd.js.map