@projectcaluma/ember-distribution 1.0.0-beta.1 → 1.0.0-beta.12
Sign up to get free protection for your applications and to get access to all the features.
- package/CHANGELOG.md +130 -0
- package/addon/abilities/distribution.js +41 -0
- package/addon/abilities/inquiry.js +20 -0
- package/addon/components/cd-document-header.hbs +17 -0
- package/addon/components/cd-inquiry-answer-form.hbs +78 -0
- package/addon/components/{inquiry-answer-form.js → cd-inquiry-answer-form.js} +32 -14
- package/addon/components/cd-inquiry-dialog/inquiry-deadline.hbs +27 -0
- package/addon/components/{inquiry-dialog → cd-inquiry-dialog}/inquiry-deadline.js +5 -1
- package/addon/components/cd-inquiry-dialog/inquiry-divider.hbs +8 -0
- package/addon/components/{inquiry-dialog → cd-inquiry-dialog}/inquiry-divider.js +1 -1
- package/addon/components/cd-inquiry-dialog/inquiry-part.hbs +109 -0
- package/addon/components/cd-inquiry-dialog/inquiry-part.js +69 -0
- package/addon/components/cd-inquiry-dialog/inquiry.hbs +16 -0
- package/addon/components/cd-inquiry-dialog/inquiry.js +11 -0
- package/addon/components/cd-inquiry-dialog.hbs +30 -0
- package/addon/components/cd-inquiry-dialog.js +94 -0
- package/addon/components/cd-inquiry-edit-form.hbs +44 -0
- package/addon/components/{inquiry-edit-form.js → cd-inquiry-edit-form.js} +5 -4
- package/addon/components/cd-inquiry-new-form.hbs +125 -0
- package/addon/components/cd-inquiry-new-form.js +114 -0
- package/addon/components/cd-navigation/controls.hbs +41 -0
- package/addon/components/cd-navigation/controls.js +95 -0
- package/addon/components/cd-navigation/item.hbs +18 -0
- package/addon/components/{distribution-navigation → cd-navigation}/item.js +2 -2
- package/addon/components/cd-navigation/section.hbs +26 -0
- package/addon/components/{distribution-navigation → cd-navigation}/section.js +1 -1
- package/addon/components/cd-navigation/status-indicator.hbs +13 -0
- package/addon/components/{distribution-navigation → cd-navigation}/status-indicator.js +1 -1
- package/addon/components/cd-navigation.hbs +11 -0
- package/addon/components/cd-navigation.js +53 -0
- package/addon/components/cd-notfound.hbs +12 -0
- package/addon/components/cd-truncated.hbs +8 -0
- package/addon/components/cd-truncated.js +32 -0
- package/addon/config.js +12 -7
- package/addon/controllers/application.js +10 -0
- package/addon/controllers/{distribution/new.js → new.js} +2 -2
- package/addon/engine.js +7 -1
- package/addon/gql/fragments/inquiry.graphql +37 -12
- package/addon/gql/mutations/complete-work-item.graphql +8 -0
- package/addon/gql/mutations/withdraw-inquiry.graphql +8 -0
- package/addon/gql/queries/control-work-items.graphql +18 -2
- package/addon/gql/queries/incomplete-inquiries.graphql +13 -0
- package/addon/gql/queries/inquiry-answer.graphql +17 -12
- package/addon/gql/queries/inquiry-dialog.graphql +3 -2
- package/addon/gql/queries/inquiry-edit.graphql +2 -0
- package/addon/gql/queries/inquiry-navigation.graphql +4 -1
- package/addon/modifiers/pikaday.js +2 -0
- package/addon/routes/{distribution.js → application.js} +1 -1
- package/addon/routes/{distribution/index.js → index.js} +2 -2
- package/addon/routes/inquiry/detail/answer.js +7 -0
- package/addon/routes/inquiry/detail/index.js +7 -0
- package/addon/routes/{distribution/inquiry → inquiry}/detail.js +1 -1
- package/addon/routes/inquiry/index.js +10 -0
- package/addon/routes/{distribution/inquiry.js → inquiry.js} +1 -1
- package/addon/routes/new.js +7 -0
- package/addon/routes/notfound.js +3 -0
- package/addon/routes.js +5 -6
- package/addon/services/distribution.js +112 -0
- package/addon/templates/application.hbs +18 -0
- package/addon/templates/index.hbs +11 -0
- package/addon/templates/inquiry/detail/answer.hbs +1 -0
- package/addon/templates/inquiry/detail/index.hbs +1 -0
- package/addon/templates/{distribution/inquiry → inquiry}/detail.hbs +0 -0
- package/addon/templates/{distribution/inquiry → inquiry}/index.hbs +1 -1
- package/addon/templates/{distribution/inquiry.hbs → inquiry.hbs} +0 -0
- package/addon/templates/{distribution/new.hbs → new.hbs} +1 -1
- package/addon/templates/notfound.hbs +1 -0
- package/addon/utils/inquiry-answer-status.js +34 -0
- package/addon/utils/inquiry-deadline.js +6 -9
- package/addon/utils/inquiry-status.js +12 -7
- package/addon/utils/unique-by-groups.js +1 -0
- package/app/abilities/distribution.js +1 -0
- package/app/components/cd-document-header.js +1 -0
- package/app/components/{inquiry-dialog/inquiry.js → cd-inquiry-answer-form.js} +1 -1
- package/app/components/{inquiry-dialog → cd-inquiry-dialog}/inquiry-deadline.js +1 -1
- package/app/components/{inquiry-dialog → cd-inquiry-dialog}/inquiry-divider.js +1 -1
- package/app/components/{inquiry-dialog → cd-inquiry-dialog}/inquiry-part.js +1 -1
- package/app/components/{distribution-navigation.js → cd-inquiry-dialog/inquiry.js} +1 -1
- package/app/components/{inquiry-edit-form.js → cd-inquiry-dialog.js} +1 -1
- package/app/components/cd-inquiry-edit-form.js +1 -0
- package/app/components/{inquiry-answer-form.js → cd-inquiry-new-form.js} +1 -1
- package/app/components/cd-navigation/controls.js +1 -0
- package/app/components/cd-navigation/item.js +1 -0
- package/app/components/cd-navigation/section.js +1 -0
- package/app/components/{distribution-navigation/item.js → cd-navigation/status-indicator.js} +1 -1
- package/app/components/{inquiry-dialog.js → cd-navigation.js} +1 -1
- package/app/components/{icon-button.js → cd-notfound.js} +1 -1
- package/app/components/{inquiry-new-form.js → cd-truncated.js} +1 -1
- package/app/services/distribution.js +1 -0
- package/app/styles/@projectcaluma/ember-distribution.scss +3 -2
- package/app/styles/_answer-form.scss +4 -0
- package/app/styles/_group-list.scss +7 -0
- package/app/styles/_inquiry-divider.scss +22 -0
- package/app/styles/_truncated.scss +3 -0
- package/app/utils/inquiry-answer-status.js +1 -0
- package/index.js +10 -14
- package/package.json +31 -27
- package/public/assets/distribution.svg +1 -0
- package/translations/de.yaml +49 -8
- package/translations/en.yaml +50 -8
- package/translations/fr.yaml +49 -8
- package/addon/components/distribution-navigation/controls.hbs +0 -21
- package/addon/components/distribution-navigation/controls.js +0 -45
- package/addon/components/distribution-navigation/item.hbs +0 -18
- package/addon/components/distribution-navigation/section.hbs +0 -24
- package/addon/components/distribution-navigation/status-indicator.hbs +0 -17
- package/addon/components/distribution-navigation.hbs +0 -17
- package/addon/components/distribution-navigation.js +0 -81
- package/addon/components/icon-button.hbs +0 -20
- package/addon/components/icon-button.js +0 -22
- package/addon/components/inquiry-answer-form.hbs +0 -46
- package/addon/components/inquiry-dialog/inquiry-deadline.hbs +0 -6
- package/addon/components/inquiry-dialog/inquiry-divider.hbs +0 -7
- package/addon/components/inquiry-dialog/inquiry-part.hbs +0 -40
- package/addon/components/inquiry-dialog/inquiry-part.js +0 -20
- package/addon/components/inquiry-dialog/inquiry.hbs +0 -13
- package/addon/components/inquiry-dialog/inquiry.js +0 -7
- package/addon/components/inquiry-dialog.hbs +0 -9
- package/addon/components/inquiry-dialog.js +0 -42
- package/addon/components/inquiry-edit-form.hbs +0 -27
- package/addon/components/inquiry-new-form.hbs +0 -110
- package/addon/components/inquiry-new-form.js +0 -154
- package/addon/routes/distribution/inquiry/detail/answer.js +0 -7
- package/addon/routes/distribution/inquiry/detail/index.js +0 -7
- package/addon/routes/distribution/inquiry/index.js +0 -10
- package/addon/routes/distribution/new.js +0 -7
- package/addon/templates/distribution/inquiry/detail/answer.hbs +0 -1
- package/addon/templates/distribution/inquiry/detail/index.hbs +0 -1
- package/addon/templates/distribution.hbs +0 -8
- package/app/components/distribution-navigation/controls.js +0 -1
- package/app/components/distribution-navigation/section.js +0 -1
- package/app/components/distribution-navigation/status-indicator.js +0 -1
- package/app/styles/_icon-button.scss +0 -13
- package/app/styles/_status-indicator.scss +0 -31
package/CHANGELOG.md
CHANGED
@@ -1,3 +1,133 @@
|
|
1
|
+
# [@projectcaluma/ember-distribution-v1.0.0-beta.12](https://github.com/projectcaluma/ember-caluma/compare/@projectcaluma/ember-distribution-v1.0.0-beta.11...@projectcaluma/ember-distribution-v1.0.0-beta.12) (2022-06-09)
|
2
|
+
|
3
|
+
|
4
|
+
### Bug Fixes
|
5
|
+
|
6
|
+
* **distribution:** fix selection of groups with the checkbox ([9f028dc](https://github.com/projectcaluma/ember-caluma/commit/9f028dc6ec16214249f43e519280397131006e7c))
|
7
|
+
* **distribution:** refetch inquiry answer after work-item completion ([60cfaca](https://github.com/projectcaluma/ember-caluma/commit/60cfaca04d94a44efc4950eeb1aecee767b4eeb5))
|
8
|
+
|
9
|
+
|
10
|
+
### Features
|
11
|
+
|
12
|
+
* **distribution:** add configurable status for unanswered inquiries ([e08247f](https://github.com/projectcaluma/ember-caluma/commit/e08247f6e2b73f859011f4eac7ffff71f101f546))
|
13
|
+
|
14
|
+
# [@projectcaluma/ember-distribution-v1.0.0-beta.11](https://github.com/projectcaluma/ember-caluma/compare/@projectcaluma/ember-distribution-v1.0.0-beta.10...@projectcaluma/ember-distribution-v1.0.0-beta.11) (2022-05-13)
|
15
|
+
|
16
|
+
|
17
|
+
### Features
|
18
|
+
|
19
|
+
* **distribution:** add status for skipped inquiries ([1f93c92](https://github.com/projectcaluma/ember-caluma/commit/1f93c92d76b697954ec54aefa12348c84cd0abf9))
|
20
|
+
|
21
|
+
# [@projectcaluma/ember-distribution-v1.0.0-beta.10](https://github.com/projectcaluma/ember-caluma/compare/@projectcaluma/ember-distribution-v1.0.0-beta.9...@projectcaluma/ember-distribution-v1.0.0-beta.10) (2022-05-11)
|
22
|
+
|
23
|
+
|
24
|
+
### Features
|
25
|
+
|
26
|
+
* **distribution:** add readonly mode ([2f45c98](https://github.com/projectcaluma/ember-caluma/commit/2f45c985a2fa387c79ca39c49c1e50dc37926352))
|
27
|
+
* **distribution:** allow custom permissions from the host app ([8a997bf](https://github.com/projectcaluma/ember-caluma/commit/8a997bf4d921ff738a6cca956a4dd9cbabe8f7c5))
|
28
|
+
|
29
|
+
# [@projectcaluma/ember-distribution-v1.0.0-beta.9](https://github.com/projectcaluma/ember-caluma/compare/@projectcaluma/ember-distribution-v1.0.0-beta.8...@projectcaluma/ember-distribution-v1.0.0-beta.9) (2022-05-09)
|
30
|
+
|
31
|
+
|
32
|
+
### Bug Fixes
|
33
|
+
|
34
|
+
* **deps:** update ember-engines ([5aa5300](https://github.com/projectcaluma/ember-caluma/commit/5aa530074ea7dc08267d8ccc411eb1538537a1b5))
|
35
|
+
* **distribution:** filter out empty types in new inquiry controller ([ad7e072](https://github.com/projectcaluma/ember-caluma/commit/ad7e072bd8d339964d1f7f6437bde6b4ff5824b5))
|
36
|
+
* **distribution:** hide suspended and canceled inquiries in more section ([a377c0c](https://github.com/projectcaluma/ember-caluma/commit/a377c0c599ab479a61c0f2f7d6051ce79817d998))
|
37
|
+
* **distribution:** improve padding of request in answer form ([de06459](https://github.com/projectcaluma/ember-caluma/commit/de06459a75e3fad30a008c738781a29a03640c96))
|
38
|
+
* **resources:** fix deprecations of ember-resources ([7a84c5c](https://github.com/projectcaluma/ember-caluma/commit/7a84c5c78d5b28f7b5393c64722907728dd5f42b))
|
39
|
+
|
40
|
+
|
41
|
+
### Features
|
42
|
+
|
43
|
+
* **distribution:** add button to create new inquiry in dialog ([a2ab800](https://github.com/projectcaluma/ember-caluma/commit/a2ab800d8d8a9b10be1d22c7a03f34299cb87a93))
|
44
|
+
* **distribution:** allow displaying more information in the answer ([9de7f01](https://github.com/projectcaluma/ember-caluma/commit/9de7f0149406a0a326ba59ca0abe27860a64f2a1))
|
45
|
+
* **distribution:** improve edit and answer inquiry UI and UX ([6cd2dee](https://github.com/projectcaluma/ember-caluma/commit/6cd2dee45dde245064a0ac013160093bc783789c))
|
46
|
+
|
47
|
+
# [@projectcaluma/ember-distribution-v1.0.0-beta.8](https://github.com/projectcaluma/ember-caluma/compare/@projectcaluma/ember-distribution-v1.0.0-beta.7...@projectcaluma/ember-distribution-v1.0.0-beta.8) (2022-04-11)
|
48
|
+
|
49
|
+
|
50
|
+
### Bug Fixes
|
51
|
+
|
52
|
+
* **distribution:** inject store into distribution engine ([2e00d7f](https://github.com/projectcaluma/ember-caluma/commit/2e00d7f0707b7a36e6955d91baa340ce2af7e413))
|
53
|
+
|
54
|
+
# [@projectcaluma/ember-distribution-v1.0.0-beta.7](https://github.com/projectcaluma/ember-caluma/compare/@projectcaluma/ember-distribution-v1.0.0-beta.6...@projectcaluma/ember-distribution-v1.0.0-beta.7) (2022-04-07)
|
55
|
+
|
56
|
+
|
57
|
+
### Bug Fixes
|
58
|
+
|
59
|
+
* **distribution:** fix status indicator and deadline styling for firefox ([358acb1](https://github.com/projectcaluma/ember-caluma/commit/358acb1f8e23b425bd6e223dc5873e516710ef12))
|
60
|
+
* **distribution:** make sure distribution components are prefixed ([d7d98ec](https://github.com/projectcaluma/ember-caluma/commit/d7d98ec291f937f384e2521d4d89c363d8e34f02))
|
61
|
+
|
62
|
+
|
63
|
+
### Features
|
64
|
+
|
65
|
+
* **distribution:** enable completing the distribution ([beabe61](https://github.com/projectcaluma/ember-caluma/commit/beabe61bd34025c4785c1e1ba60c59babb3eb6ab))
|
66
|
+
|
67
|
+
# [@projectcaluma/ember-distribution-v1.0.0-beta.6](https://github.com/projectcaluma/ember-caluma/compare/@projectcaluma/ember-distribution-v1.0.0-beta.5...@projectcaluma/ember-distribution-v1.0.0-beta.6) (2022-03-24)
|
68
|
+
|
69
|
+
|
70
|
+
### Bug Fixes
|
71
|
+
|
72
|
+
* **embroider:** add missing dependency on @ember/string ([3a6e6bb](https://github.com/projectcaluma/ember-caluma/commit/3a6e6bb39a8c1a40a2ae00b3d4ea00606a755e25))
|
73
|
+
|
74
|
+
|
75
|
+
### Features
|
76
|
+
|
77
|
+
* **distribution:** add functionality to send all pending inquiries ([d769953](https://github.com/projectcaluma/ember-caluma/commit/d769953d5a0ea196943426c8499ba87b77a42e61))
|
78
|
+
* **distribution:** add functionality to withdraw an inquiry ([c278895](https://github.com/projectcaluma/ember-caluma/commit/c2788957c0fb228c167ca9236fda4850717f5817))
|
79
|
+
|
80
|
+
# [@projectcaluma/ember-distribution-v1.0.0-beta.5](https://github.com/projectcaluma/ember-caluma/compare/@projectcaluma/ember-distribution-v1.0.0-beta.4...@projectcaluma/ember-distribution-v1.0.0-beta.5) (2022-03-11)
|
81
|
+
|
82
|
+
|
83
|
+
### Bug Fixes
|
84
|
+
|
85
|
+
* **distribution:** fix sorting after group names in navigation ([2299d3b](https://github.com/projectcaluma/ember-caluma/commit/2299d3b0e265204ab6747dbdc6a8b64fc22f247f))
|
86
|
+
* **distribution:** redirect to edit form after inquiry creation ([0a2c404](https://github.com/projectcaluma/ember-caluma/commit/0a2c40404fdb1258fb8d51a2809a03b335c7c78a))
|
87
|
+
|
88
|
+
# [@projectcaluma/ember-distribution-v1.0.0-beta.4](https://github.com/projectcaluma/ember-caluma/compare/@projectcaluma/ember-distribution-v1.0.0-beta.3...@projectcaluma/ember-distribution-v1.0.0-beta.4) (2022-02-16)
|
89
|
+
|
90
|
+
|
91
|
+
### Bug Fixes
|
92
|
+
|
93
|
+
* **distribution:** show controls if no inquiries exist yet ([5c73b6d](https://github.com/projectcaluma/ember-caluma/commit/5c73b6d0a870fd0e34d96af3fa34095733fe9fd9))
|
94
|
+
* **pikaday:** add pikaday modifier reexport in engines ([c13d302](https://github.com/projectcaluma/ember-caluma/commit/c13d3021bb8fe82e1245a60182af01287c507697))
|
95
|
+
|
96
|
+
|
97
|
+
### Features
|
98
|
+
|
99
|
+
* **distribution:** add config variable to stack the UI ([2ad285a](https://github.com/projectcaluma/ember-caluma/commit/2ad285a24bf5fb45d15fe237e3f420dd1f1d94f2))
|
100
|
+
* **distribution:** add index page when no inquiries exist ([689089c](https://github.com/projectcaluma/ember-caluma/commit/689089c8f28146a33346f382fe69e7ca1b588d97))
|
101
|
+
* **distribution:** add proper 404 handling ([73e62e6](https://github.com/projectcaluma/ember-caluma/commit/73e62e671a9425fc549d7057dd653d1dc59883aa))
|
102
|
+
* **distribution:** remove distribution top level route ([6f396da](https://github.com/projectcaluma/ember-caluma/commit/6f396daf2881f07cdddaac6c7ca784db2b8777d3))
|
103
|
+
|
104
|
+
# [@projectcaluma/ember-distribution-v1.0.0-beta.3](https://github.com/projectcaluma/ember-caluma/compare/@projectcaluma/ember-distribution-v1.0.0-beta.2...@projectcaluma/ember-distribution-v1.0.0-beta.3) (2022-02-07)
|
105
|
+
|
106
|
+
|
107
|
+
### Bug Fixes
|
108
|
+
|
109
|
+
* **deps:** remove moment altogether and update ember-pikday ([b2f7fa2](https://github.com/projectcaluma/ember-caluma/commit/b2f7fa28fa076897addd36e5964c926c671508ff))
|
110
|
+
* **distribution:** replace moment with luxon ([80f6b9a](https://github.com/projectcaluma/ember-caluma/commit/80f6b9a984113a5870a1a9ffbcc8e1700cb33190))
|
111
|
+
|
112
|
+
|
113
|
+
### BREAKING CHANGES
|
114
|
+
|
115
|
+
* **deps:** The host app now needs to opt-in to use the default
|
116
|
+
pikaday styles: https://github.com/adopted-ember-addons/ember-pikaday#styles
|
117
|
+
|
118
|
+
# [@projectcaluma/ember-distribution-v1.0.0-beta.2](https://github.com/projectcaluma/ember-caluma/compare/@projectcaluma/ember-distribution-v1.0.0-beta.1...@projectcaluma/ember-distribution-v1.0.0-beta.2) (2022-02-01)
|
119
|
+
|
120
|
+
|
121
|
+
### chore
|
122
|
+
|
123
|
+
* **deps:** update ember-uikit to v5 beta ([6568d39](https://github.com/projectcaluma/ember-caluma/commit/6568d398216d33b44da5b659830ca3c200dd7012))
|
124
|
+
|
125
|
+
|
126
|
+
### BREAKING CHANGES
|
127
|
+
|
128
|
+
* **deps:** All `@projectcaluma/ember-*` packages now require
|
129
|
+
`ember-uikit` v5+.
|
130
|
+
|
1
131
|
# @projectcaluma/ember-distribution-v1.0.0-beta.1 (2022-01-18)
|
2
132
|
|
3
133
|
|
@@ -0,0 +1,41 @@
|
|
1
|
+
import { inject as service } from "@ember/service";
|
2
|
+
import { Ability } from "ember-can";
|
3
|
+
|
4
|
+
import config from "@projectcaluma/ember-distribution/config";
|
5
|
+
|
6
|
+
const hasStatus = (status) => (edge) => edge.node.status === status;
|
7
|
+
|
8
|
+
export default class DistributionAbility extends Ability {
|
9
|
+
@service distribution;
|
10
|
+
|
11
|
+
@config config;
|
12
|
+
|
13
|
+
get canSendInquiries() {
|
14
|
+
return (
|
15
|
+
!this.config.ui.readonly &&
|
16
|
+
(this.config.permissions.sendInquiry?.(null) ?? true) &&
|
17
|
+
this.distribution.controls.value?.send.edges.filter(
|
18
|
+
hasStatus("SUSPENDED")
|
19
|
+
).length > 0
|
20
|
+
);
|
21
|
+
}
|
22
|
+
|
23
|
+
get canCreateInquiry() {
|
24
|
+
return (
|
25
|
+
!this.config.ui.readonly &&
|
26
|
+
(this.config.permissions.createInquiry?.() ?? true) &&
|
27
|
+
this.distribution.controls.value?.create.edges.filter(hasStatus("READY"))
|
28
|
+
.length > 0
|
29
|
+
);
|
30
|
+
}
|
31
|
+
|
32
|
+
get canComplete() {
|
33
|
+
return (
|
34
|
+
!this.config.ui.readonly &&
|
35
|
+
(this.config.permissions.completeDistribution?.() ?? true) &&
|
36
|
+
this.distribution.controls.value?.complete.edges.filter(
|
37
|
+
hasStatus("READY")
|
38
|
+
).length > 0
|
39
|
+
);
|
40
|
+
}
|
41
|
+
}
|
@@ -10,6 +10,7 @@ export default class InquiryAbility extends Ability {
|
|
10
10
|
|
11
11
|
get canEdit() {
|
12
12
|
return (
|
13
|
+
!this.config.ui.readonly &&
|
13
14
|
this.model?.task.slug === this.config.inquiry.task &&
|
14
15
|
this.model?.status === "SUSPENDED" &&
|
15
16
|
this.model?.controllingGroups
|
@@ -18,8 +19,17 @@ export default class InquiryAbility extends Ability {
|
|
18
19
|
);
|
19
20
|
}
|
20
21
|
|
22
|
+
get canSend() {
|
23
|
+
return this.config.permissions.sendInquiry?.(this.model) ?? true;
|
24
|
+
}
|
25
|
+
|
26
|
+
get canWithdraw() {
|
27
|
+
return this.config.permissions.withdrawInquiry?.(this.model) ?? true;
|
28
|
+
}
|
29
|
+
|
21
30
|
get canAnswer() {
|
22
31
|
return (
|
32
|
+
!this.config.ui.readonly &&
|
23
33
|
this.model?.task.slug === this.config.inquiry.task &&
|
24
34
|
this.model?.status === "READY" &&
|
25
35
|
this.model?.addressedGroups
|
@@ -30,10 +40,20 @@ export default class InquiryAbility extends Ability {
|
|
30
40
|
|
31
41
|
get canEditAnswerForm() {
|
32
42
|
return (
|
43
|
+
!this.config.ui.readonly &&
|
33
44
|
this.canAnswer &&
|
34
45
|
this.model?.childCase.workItems.edges.some(
|
35
46
|
(edge) => edge.node.task.__typename === "CompleteWorkflowFormTask"
|
36
47
|
)
|
37
48
|
);
|
38
49
|
}
|
50
|
+
|
51
|
+
get canCompleteChildWorkItem() {
|
52
|
+
return (
|
53
|
+
this.config.permissions.completeInquiryChildWorkItem?.(
|
54
|
+
this.model,
|
55
|
+
this.task
|
56
|
+
) ?? true
|
57
|
+
);
|
58
|
+
}
|
39
59
|
}
|
@@ -0,0 +1,17 @@
|
|
1
|
+
<p class="uk-text-large uk-margin-remove">
|
2
|
+
{{@name}}
|
3
|
+
{{#if @status}}
|
4
|
+
<UkLabel @label={{@status}} class="uk-margin-left" />
|
5
|
+
{{/if}}
|
6
|
+
</p>
|
7
|
+
|
8
|
+
{{#if (and @modifiedBy @modifiedAt)}}
|
9
|
+
<p class="uk-text-meta uk-margin-remove-bottom uk-margin-small-top">
|
10
|
+
{{t
|
11
|
+
"caluma.distribution.last-modified"
|
12
|
+
user=(user-name @modifiedBy)
|
13
|
+
date=(format-date @modifiedAt)
|
14
|
+
time=(format-time @modifiedAt hour="2-digit" minute="2-digit")
|
15
|
+
}}
|
16
|
+
</p>
|
17
|
+
{{/if}}
|
@@ -0,0 +1,78 @@
|
|
1
|
+
<CfContent
|
2
|
+
@documentId={{decode-id this.inquiry.childCase.document.id}}
|
3
|
+
@disabled={{cannot "edit answer form of inquiry" this.inquiry}}
|
4
|
+
@loading={{this._inquiry.isRunning}}
|
5
|
+
>
|
6
|
+
<:default as |content|>
|
7
|
+
|
8
|
+
<div class="uk-position-relative">
|
9
|
+
<CdDocumentHeader
|
10
|
+
@name={{content.document.rootForm.raw.name}}
|
11
|
+
@status={{if (eq this.inquiry.status "READY") this.answerStatus}}
|
12
|
+
@modifiedAt={{this.inquiry.childCase.document.modifiedContentAt}}
|
13
|
+
@modifiedBy={{this.inquiry.childCase.document.modifiedContentByUser}}
|
14
|
+
/>
|
15
|
+
|
16
|
+
<CdInquiryDialog::InquiryDeadline
|
17
|
+
@inquiry={{this.inquiry}}
|
18
|
+
class="uk-margin-remove uk-position-center-right"
|
19
|
+
/>
|
20
|
+
</div>
|
21
|
+
|
22
|
+
<hr />
|
23
|
+
|
24
|
+
<div class="uk-margin uk-text-italic inquiry-answer-form__request">
|
25
|
+
<CdInquiryDialog::InquiryPart
|
26
|
+
@inquiry={{this.inquiry}}
|
27
|
+
@type="request"
|
28
|
+
@disabled={{true}}
|
29
|
+
/>
|
30
|
+
</div>
|
31
|
+
|
32
|
+
{{#if
|
33
|
+
(and
|
34
|
+
(not this.buttons.length)
|
35
|
+
(can "edit answer form of inquiry" this.inquiry)
|
36
|
+
)
|
37
|
+
}}
|
38
|
+
<div class="uk-alert uk-alert-warning uk-flex uk-flex-middle">
|
39
|
+
<UkIcon @icon="warning" class="uk-margin-small-right" />
|
40
|
+
{{t "caluma.distribution.answer.complete-not-allowed"}}
|
41
|
+
{{t "caluma.distribution.not-allowed-hint"}}
|
42
|
+
</div>
|
43
|
+
{{/if}}
|
44
|
+
|
45
|
+
<content.form />
|
46
|
+
|
47
|
+
{{#each this.buttons as |buttonConfig|}}
|
48
|
+
{{#if buttonConfig.isFormButton}}
|
49
|
+
<DocumentValidity @document={{content.document}} as |isValid validate|>
|
50
|
+
<UkButton
|
51
|
+
@type="submit"
|
52
|
+
@color={{buttonConfig.color}}
|
53
|
+
@disabled={{or (not isValid) this.completeWorkItem.isRunning}}
|
54
|
+
@loading={{this.completeWorkItem.isRunning}}
|
55
|
+
@onClick={{fn
|
56
|
+
(perform this.completeWorkItem)
|
57
|
+
buttonConfig.workItemId
|
58
|
+
validate
|
59
|
+
}}
|
60
|
+
>{{buttonConfig.label}}</UkButton>
|
61
|
+
</DocumentValidity>
|
62
|
+
{{else}}
|
63
|
+
<UkButton
|
64
|
+
@type="button"
|
65
|
+
@color={{buttonConfig.color}}
|
66
|
+
@disabled={{this.completeWorkItem.isRunning}}
|
67
|
+
@loading={{this.completeWorkItem.isRunning}}
|
68
|
+
@onClick={{fn
|
69
|
+
(perform this.completeWorkItem)
|
70
|
+
buttonConfig.workItemId
|
71
|
+
null
|
72
|
+
}}
|
73
|
+
>{{buttonConfig.label}}</UkButton>
|
74
|
+
{{/if}}
|
75
|
+
{{/each}}
|
76
|
+
</:default>
|
77
|
+
<:notfound><CdNotfound /></:notfound>
|
78
|
+
</CfContent>
|
@@ -1,40 +1,55 @@
|
|
1
1
|
import { inject as service } from "@ember/service";
|
2
2
|
import Component from "@glimmer/component";
|
3
|
-
import { queryManager } from "ember-apollo-client";
|
3
|
+
import { queryManager, getObservable } from "ember-apollo-client";
|
4
4
|
import { dropTask } from "ember-concurrency";
|
5
|
-
import {
|
5
|
+
import { trackedTask } from "ember-resources/util/ember-concurrency";
|
6
6
|
|
7
7
|
import { decodeId } from "@projectcaluma/ember-core/helpers/decode-id";
|
8
8
|
import config from "@projectcaluma/ember-distribution/config";
|
9
9
|
import completeInquiryWorkItemMutation from "@projectcaluma/ember-distribution/gql/mutations/complete-inquiry-work-item.graphql";
|
10
10
|
import inquiryAnswerQuery from "@projectcaluma/ember-distribution/gql/queries/inquiry-answer.graphql";
|
11
|
+
import inquiryAnswerStatus from "@projectcaluma/ember-distribution/utils/inquiry-answer-status";
|
11
12
|
|
12
|
-
export default class
|
13
|
+
export default class CdInquiryAnswerFormComponent extends Component {
|
13
14
|
@service intl;
|
14
15
|
@service router;
|
16
|
+
@service abilities;
|
15
17
|
@service notification;
|
16
18
|
|
17
19
|
@config config;
|
18
20
|
|
19
21
|
@queryManager apollo;
|
20
22
|
|
21
|
-
|
23
|
+
@inquiryAnswerStatus({ inquiryProperty: "inquiry" }) answerStatus;
|
24
|
+
|
25
|
+
_inquiry = trackedTask(this, this.fetchInquiryAnswer, () => [
|
26
|
+
this.args.inquiry,
|
27
|
+
]);
|
22
28
|
|
23
29
|
get inquiry() {
|
24
30
|
return this._inquiry.value?.[0]?.node;
|
25
31
|
}
|
26
32
|
|
27
33
|
get buttons() {
|
28
|
-
return this.inquiry?.childCase.workItems.edges
|
29
|
-
|
34
|
+
return this.inquiry?.childCase.workItems.edges
|
35
|
+
.map((edge) => {
|
36
|
+
const config = this.config.inquiry.answer.buttons[edge.node.task.slug];
|
30
37
|
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
+
return this.abilities.can(
|
39
|
+
"complete child work item of inquiry",
|
40
|
+
this.inquiry,
|
41
|
+
{ task: edge.node.task.slug }
|
42
|
+
)
|
43
|
+
? {
|
44
|
+
workItemId: decodeId(edge.node.id),
|
45
|
+
color: config.color,
|
46
|
+
isFormButton:
|
47
|
+
edge.node.task.__typename === "CompleteWorkflowFormTask",
|
48
|
+
label: this.intl.t(config.label),
|
49
|
+
}
|
50
|
+
: null;
|
51
|
+
})
|
52
|
+
.filter(Boolean);
|
38
53
|
}
|
39
54
|
|
40
55
|
@dropTask
|
@@ -45,6 +60,8 @@ export default class InquiryAnswerFormComponent extends Component {
|
|
45
60
|
variables: {
|
46
61
|
inquiry: this.args.inquiry,
|
47
62
|
buttonTasks: Object.keys(this.config.inquiry.answer.buttons),
|
63
|
+
infoQuestion: this.config.inquiry.infoQuestion,
|
64
|
+
deadlineQuestion: this.config.inquiry.deadlineQuestion,
|
48
65
|
},
|
49
66
|
},
|
50
67
|
"allWorkItems.edges"
|
@@ -65,7 +82,8 @@ export default class InquiryAnswerFormComponent extends Component {
|
|
65
82
|
},
|
66
83
|
});
|
67
84
|
|
68
|
-
yield this.
|
85
|
+
yield getObservable(this._inquiry.value)?.refetch();
|
86
|
+
yield this.router.transitionTo("inquiry.index");
|
69
87
|
} catch (error) {
|
70
88
|
this.notification.danger(
|
71
89
|
this.intl.t("caluma.distribution.answer.complete-error")
|
@@ -0,0 +1,27 @@
|
|
1
|
+
{{#if this.deadline.value}}
|
2
|
+
<div
|
3
|
+
class="uk-position-top-right
|
4
|
+
{{if
|
5
|
+
this.config.ui.small
|
6
|
+
'uk-margin-top uk-margin-right'
|
7
|
+
'uk-margin-medium-top uk-margin-medium-right'
|
8
|
+
}}
|
9
|
+
{{if
|
10
|
+
this.isWithdrawn
|
11
|
+
'uk-text-muted'
|
12
|
+
(concat 'uk-text-' this.deadline.color)
|
13
|
+
}}
|
14
|
+
uk-flex-inline uk-flex-middle"
|
15
|
+
...attributes
|
16
|
+
>
|
17
|
+
<UkIcon
|
18
|
+
@icon={{if this.isWithdrawn "ban" "clock"}}
|
19
|
+
class="uk-margin-small-right"
|
20
|
+
/>
|
21
|
+
{{#if this.isWithdrawn}}
|
22
|
+
{{t "caluma.distribution.withdraw.status"}}
|
23
|
+
{{else}}
|
24
|
+
{{format-date this.deadline.value}}
|
25
|
+
{{/if}}
|
26
|
+
</div>
|
27
|
+
{{/if}}
|
@@ -3,8 +3,12 @@ import Component from "@glimmer/component";
|
|
3
3
|
import config from "@projectcaluma/ember-distribution/config";
|
4
4
|
import inquiryDeadline from "@projectcaluma/ember-distribution/utils/inquiry-deadline";
|
5
5
|
|
6
|
-
export default class
|
6
|
+
export default class CdInquiryDialogInquiryDeadlineComponent extends Component {
|
7
7
|
@config config;
|
8
8
|
|
9
9
|
@inquiryDeadline deadline;
|
10
|
+
|
11
|
+
get isWithdrawn() {
|
12
|
+
return this.args.inquiry.status === "CANCELED";
|
13
|
+
}
|
10
14
|
}
|
@@ -0,0 +1,8 @@
|
|
1
|
+
<div
|
2
|
+
class="inquiry-divider uk-flex uk-flex-center uk-flex-middle uk-flex-between uk-text-{{this.status.color}}
|
3
|
+
{{if this.config.ui.small 'inquiry-divider--small' 'uk-margin'}}"
|
4
|
+
>
|
5
|
+
<div class="inquiry-divider__icon uk-flex uk-flex-center uk-flex-middle">
|
6
|
+
<UkIcon @icon={{this.status.icon}} title={{this.status.label}} />
|
7
|
+
</div>
|
8
|
+
</div>
|
@@ -4,7 +4,7 @@ import Component from "@glimmer/component";
|
|
4
4
|
import config from "@projectcaluma/ember-distribution/config";
|
5
5
|
import inquiryStatus from "@projectcaluma/ember-distribution/utils/inquiry-status";
|
6
6
|
|
7
|
-
export default class
|
7
|
+
export default class CdInquiryDialogInquiryDividerComponent extends Component {
|
8
8
|
@service intl;
|
9
9
|
|
10
10
|
@config config;
|
@@ -0,0 +1,109 @@
|
|
1
|
+
<div class="uk-margin-remove-last-child">
|
2
|
+
<p
|
3
|
+
class="uk-flex uk-flex-middle uk-text-large uk-margin-remove"
|
4
|
+
data-test-title
|
5
|
+
>
|
6
|
+
{{#if (eq @type "request")}}
|
7
|
+
<UkIcon @icon="forward" class="uk-margin-small-right" />
|
8
|
+
{{group-name @inquiry.controllingGroups}}
|
9
|
+
{{#if
|
10
|
+
(and (can "answer inquiry" @inquiry) (not @disabled) this.answerStatus)
|
11
|
+
}}
|
12
|
+
<UkLabel @label={{this.answerStatus}} class="uk-margin-left" />
|
13
|
+
{{/if}}
|
14
|
+
{{else if (eq @type "answer")}}
|
15
|
+
<UkIcon @icon="reply" class="uk-margin-small-right" />
|
16
|
+
{{group-name @inquiry.addressedGroups}}
|
17
|
+
{{/if}}
|
18
|
+
</p>
|
19
|
+
|
20
|
+
<ul
|
21
|
+
class="uk-subnav uk-subnav-divider
|
22
|
+
{{if
|
23
|
+
this.config.ui.small
|
24
|
+
'uk-margin-remove-top uk-margin-small-bottom'
|
25
|
+
'uk-margin-small-top'
|
26
|
+
}}"
|
27
|
+
>
|
28
|
+
<li>
|
29
|
+
<span>
|
30
|
+
{{format-date this.date}}
|
31
|
+
{{format-time this.date hour="2-digit" minute="2-digit"}}
|
32
|
+
</span>
|
33
|
+
</li>
|
34
|
+
{{#unless @disabled}}
|
35
|
+
{{#if (or (eq @type "answer") (cannot "edit inquiry" @inquiry))}}
|
36
|
+
<li>
|
37
|
+
<LinkTo
|
38
|
+
data-test-details
|
39
|
+
@route="inquiry.detail.{{if (eq @type 'answer') 'answer' 'index'}}"
|
40
|
+
@model={{decode-id @inquiry.id}}
|
41
|
+
>
|
42
|
+
{{t "caluma.distribution.details"}}
|
43
|
+
</LinkTo>
|
44
|
+
</li>
|
45
|
+
{{/if}}
|
46
|
+
{{#if (can "edit inquiry" @inquiry)}}
|
47
|
+
<li>
|
48
|
+
<LinkTo
|
49
|
+
data-test-edit
|
50
|
+
@route="inquiry.detail.index"
|
51
|
+
@model={{decode-id @inquiry.id}}
|
52
|
+
>
|
53
|
+
{{t "caluma.distribution.edit.link"}}
|
54
|
+
</LinkTo>
|
55
|
+
</li>
|
56
|
+
{{#if (can "withdraw inquiry" @inquiry)}}
|
57
|
+
<li>
|
58
|
+
<a
|
59
|
+
href=""
|
60
|
+
{{on "click" (perform this.withdraw)}}
|
61
|
+
data-test-withdraw
|
62
|
+
>
|
63
|
+
{{t "caluma.distribution.withdraw.link"}}
|
64
|
+
</a>
|
65
|
+
</li>
|
66
|
+
{{/if}}
|
67
|
+
{{else if (can "answer inquiry" @inquiry)}}
|
68
|
+
<li>
|
69
|
+
<LinkTo
|
70
|
+
data-test-answer
|
71
|
+
@route="inquiry.detail.answer"
|
72
|
+
@model={{decode-id @inquiry.id}}
|
73
|
+
>
|
74
|
+
{{t "caluma.distribution.answer.link"}}
|
75
|
+
</LinkTo>
|
76
|
+
</li>
|
77
|
+
{{/if}}
|
78
|
+
{{/unless}}
|
79
|
+
</ul>
|
80
|
+
|
81
|
+
{{#if this.requestInfo}}
|
82
|
+
<CdTruncated
|
83
|
+
data-test-inquiry-request
|
84
|
+
@text={{this.requestInfo}}
|
85
|
+
@length={{500}}
|
86
|
+
/>
|
87
|
+
{{else if this.answerInfo}}
|
88
|
+
{{#each this.answerInfo as |info|}}
|
89
|
+
<div class="uk-margin">
|
90
|
+
<p
|
91
|
+
class="uk-text-bolder
|
92
|
+
{{if
|
93
|
+
this.config.ui.small
|
94
|
+
'uk-margin-remove'
|
95
|
+
'uk-margin-small-bottom'
|
96
|
+
}}"
|
97
|
+
>
|
98
|
+
{{info.question}}
|
99
|
+
</p>
|
100
|
+
<CdTruncated
|
101
|
+
data-test-inquiry-answer
|
102
|
+
class="uk-margin-remove"
|
103
|
+
@text={{info.value}}
|
104
|
+
@length={{200}}
|
105
|
+
/>
|
106
|
+
</div>
|
107
|
+
{{/each}}
|
108
|
+
{{/if}}
|
109
|
+
</div>
|
@@ -0,0 +1,69 @@
|
|
1
|
+
import { inject as service } from "@ember/service";
|
2
|
+
import { isEmpty } from "@ember/utils";
|
3
|
+
import Component from "@glimmer/component";
|
4
|
+
import { queryManager } from "ember-apollo-client";
|
5
|
+
import { dropTask } from "ember-concurrency";
|
6
|
+
import { confirm } from "ember-uikit";
|
7
|
+
|
8
|
+
import { decodeId } from "@projectcaluma/ember-core/helpers/decode-id";
|
9
|
+
import config from "@projectcaluma/ember-distribution/config";
|
10
|
+
import withdrawInquiryMutation from "@projectcaluma/ember-distribution/gql/mutations/withdraw-inquiry.graphql";
|
11
|
+
import inquiryAnswerStatus from "@projectcaluma/ember-distribution/utils/inquiry-answer-status";
|
12
|
+
|
13
|
+
export default class CdInquiryDialogInquiryPartComponent extends Component {
|
14
|
+
@service notification;
|
15
|
+
@service router;
|
16
|
+
@service intl;
|
17
|
+
|
18
|
+
@queryManager apollo;
|
19
|
+
|
20
|
+
@config config;
|
21
|
+
|
22
|
+
@inquiryAnswerStatus answerStatus;
|
23
|
+
|
24
|
+
get date() {
|
25
|
+
const key = this.args.type === "request" ? "createdAt" : "closedAt";
|
26
|
+
|
27
|
+
return this.args.inquiry[key];
|
28
|
+
}
|
29
|
+
|
30
|
+
get requestInfo() {
|
31
|
+
return this.args.type === "request"
|
32
|
+
? this.args.inquiry.document.info.edges[0]?.node.value
|
33
|
+
: null;
|
34
|
+
}
|
35
|
+
|
36
|
+
get answerInfo() {
|
37
|
+
return this.args.type === "answer"
|
38
|
+
? this.args.inquiry.childCase.document.info.edges
|
39
|
+
.filter((edge) => !isEmpty(edge.node.value))
|
40
|
+
.map((edge) => ({
|
41
|
+
question: edge.node.question.label,
|
42
|
+
value: edge.node.value,
|
43
|
+
}))
|
44
|
+
: null;
|
45
|
+
}
|
46
|
+
|
47
|
+
@dropTask
|
48
|
+
*withdraw(e) {
|
49
|
+
e.preventDefault();
|
50
|
+
|
51
|
+
/* istanbul ignore next */
|
52
|
+
if (!(yield confirm(this.intl.t("caluma.distribution.withdraw.confirm")))) {
|
53
|
+
return;
|
54
|
+
}
|
55
|
+
|
56
|
+
try {
|
57
|
+
yield this.apollo.mutate({
|
58
|
+
mutation: withdrawInquiryMutation,
|
59
|
+
variables: {
|
60
|
+
workItem: decodeId(this.args.inquiry.id),
|
61
|
+
},
|
62
|
+
});
|
63
|
+
} catch (error) {
|
64
|
+
this.notification.danger(
|
65
|
+
this.intl.t("caluma.distribution.withdraw.error")
|
66
|
+
);
|
67
|
+
}
|
68
|
+
}
|
69
|
+
}
|
@@ -0,0 +1,16 @@
|
|
1
|
+
<article
|
2
|
+
class="uk-card uk-card-default uk-margin
|
3
|
+
{{if this.config.ui.small 'uk-card-small'}}"
|
4
|
+
>
|
5
|
+
<div class="uk-card-body">
|
6
|
+
<CdInquiryDialog::InquiryDeadline @inquiry={{@inquiry}} />
|
7
|
+
|
8
|
+
{{#if this.hasAnswer}}
|
9
|
+
<CdInquiryDialog::InquiryPart @inquiry={{@inquiry}} @type="answer" />
|
10
|
+
|
11
|
+
<CdInquiryDialog::InquiryDivider @inquiry={{@inquiry}} />
|
12
|
+
{{/if}}
|
13
|
+
|
14
|
+
<CdInquiryDialog::InquiryPart @inquiry={{@inquiry}} @type="request" />
|
15
|
+
</div>
|
16
|
+
</article>
|