@projectcaluma/ember-distribution 1.0.0-beta.9 → 11.0.0-beta.26
Sign up to get free protection for your applications and to get access to all the features.
- package/CHANGELOG.md +70 -0
- package/addon/abilities/distribution.js +19 -0
- package/addon/abilities/inquiry.js +20 -0
- package/addon/components/cd-document-header.hbs +8 -8
- package/addon/components/cd-inquiry-answer-form.hbs +21 -13
- package/addon/components/cd-inquiry-answer-form.js +24 -10
- package/addon/components/cd-inquiry-dialog/inquiry-deadline.hbs +6 -13
- package/addon/components/cd-inquiry-dialog/inquiry-divider.hbs +1 -1
- package/addon/components/cd-inquiry-dialog/inquiry-part.hbs +27 -11
- package/addon/components/cd-inquiry-dialog/inquiry-part.js +10 -0
- package/addon/components/cd-inquiry-dialog/inquiry.hbs +8 -4
- package/addon/components/cd-inquiry-dialog.hbs +12 -6
- package/addon/components/cd-inquiry-dialog.js +1 -0
- package/addon/components/cd-inquiry-edit-form.hbs +19 -2
- package/addon/components/cd-inquiry-new-form.hbs +32 -30
- package/addon/components/cd-inquiry-new-form.js +1 -3
- package/addon/components/cd-navigation/controls.hbs +46 -21
- package/addon/components/cd-navigation/controls.js +34 -9
- package/addon/components/cd-navigation/item.hbs +14 -11
- package/addon/components/cd-navigation/section.hbs +4 -4
- package/addon/components/cd-navigation/status-indicator.hbs +10 -15
- package/addon/components/cd-navigation.hbs +11 -14
- package/addon/config.js +11 -7
- package/addon/engine.js +3 -1
- package/addon/gql/fragments/inquiry.graphql +21 -4
- package/addon/gql/mutations/complete-inquiry-work-item.graphql +1 -1
- package/addon/gql/mutations/redo-work-item.graphql +8 -0
- package/addon/gql/queries/control-work-items.graphql +11 -0
- package/addon/gql/queries/inquiry-answer.graphql +3 -12
- package/addon/gql/queries/inquiry-dialog.graphql +2 -1
- package/addon/services/distribution.js +9 -1
- package/addon/templates/application.hbs +1 -0
- package/addon/utils/inquiry-answer-status.js +34 -0
- package/addon/utils/inquiry-deadline.js +4 -4
- package/addon/utils/inquiry-status.js +12 -7
- package/app/styles/@projectcaluma/ember-distribution.scss +1 -2
- package/app/styles/_group-list.scss +7 -0
- package/app/styles/_inquiry-divider.scss +1 -1
- package/app/utils/inquiry-answer-status.js +1 -0
- package/index.js +1 -6
- package/package.json +21 -22
- package/translations/de.yaml +24 -4
- package/translations/en.yaml +25 -5
- package/translations/fr.yaml +25 -5
- package/addon/components/cd-icon-button.hbs +0 -27
- package/addon/components/cd-icon-button.js +0 -22
- package/app/components/cd-icon-button.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,73 @@
|
|
1
|
+
# [@projectcaluma/ember-distribution-v1.0.0-beta.16](https://github.com/projectcaluma/ember-caluma/compare/@projectcaluma/ember-distribution-v1.0.0-beta.15...@projectcaluma/ember-distribution-v1.0.0-beta.16) (2022-08-15)
|
2
|
+
|
3
|
+
|
4
|
+
### Features
|
5
|
+
|
6
|
+
* **distribution:** always show confirmation dialog when completing ([507e062](https://github.com/projectcaluma/ember-caluma/commit/507e062afa32e7d4b8d64a2016a4c795a6e632cf))
|
7
|
+
|
8
|
+
# [@projectcaluma/ember-distribution-v1.0.0-beta.15](https://github.com/projectcaluma/ember-caluma/compare/@projectcaluma/ember-distribution-v1.0.0-beta.14...@projectcaluma/ember-distribution-v1.0.0-beta.15) (2022-07-18)
|
9
|
+
|
10
|
+
|
11
|
+
### Bug Fixes
|
12
|
+
|
13
|
+
* **distribution:** include fetch service dependency ([841c233](https://github.com/projectcaluma/ember-caluma/commit/841c23320f07968a8181bfc9273f592652049516))
|
14
|
+
* **distribution:** only show permission info for suspended inquiries ([bd594f8](https://github.com/projectcaluma/ember-caluma/commit/bd594f8ac026af8bf0579dc947862710363ac028))
|
15
|
+
|
16
|
+
# [@projectcaluma/ember-distribution-v1.0.0-beta.14](https://github.com/projectcaluma/ember-caluma/compare/@projectcaluma/ember-distribution-v1.0.0-beta.13...@projectcaluma/ember-distribution-v1.0.0-beta.14) (2022-07-06)
|
17
|
+
|
18
|
+
|
19
|
+
### Bug Fixes
|
20
|
+
|
21
|
+
* **distribution:** fix title and deadline alignment and icon size ([eb6f495](https://github.com/projectcaluma/ember-caluma/commit/eb6f495408decdf7d735ad2dbc702ee7e4e0ede5))
|
22
|
+
* **distribution:** fix title layout with status ([dc49b82](https://github.com/projectcaluma/ember-caluma/commit/dc49b82b3d2f3b9962e9373506e286b4b7ca7225))
|
23
|
+
* **distribution:** order answers by configured question order ([668383f](https://github.com/projectcaluma/ember-caluma/commit/668383f5526403187ee66b4ac85cc8ace4ad061a))
|
24
|
+
|
25
|
+
|
26
|
+
### Features
|
27
|
+
|
28
|
+
* **distribution:** change needs-interaction status icon to text file ([695c6db](https://github.com/projectcaluma/ember-caluma/commit/695c6db4b7d87af87e334da7aece7e0f4b17129e))
|
29
|
+
|
30
|
+
# [@projectcaluma/ember-distribution-v1.0.0-beta.13](https://github.com/projectcaluma/ember-caluma/compare/@projectcaluma/ember-distribution-v1.0.0-beta.12...@projectcaluma/ember-distribution-v1.0.0-beta.13) (2022-06-09)
|
31
|
+
|
32
|
+
|
33
|
+
### Features
|
34
|
+
|
35
|
+
* **caluma:** use new filter syntax of caluma ([7a00c03](https://github.com/projectcaluma/ember-caluma/commit/7a00c03a103933d9e48dd88adb7382441a298742))
|
36
|
+
|
37
|
+
|
38
|
+
### BREAKING CHANGES
|
39
|
+
|
40
|
+
* **caluma:** `ember-caluma` now requires Caluma version >=
|
41
|
+
8.0.0-beta.6
|
42
|
+
|
43
|
+
# [@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)
|
44
|
+
|
45
|
+
|
46
|
+
### Bug Fixes
|
47
|
+
|
48
|
+
* **distribution:** fix selection of groups with the checkbox ([9f028dc](https://github.com/projectcaluma/ember-caluma/commit/9f028dc6ec16214249f43e519280397131006e7c))
|
49
|
+
* **distribution:** refetch inquiry answer after work-item completion ([60cfaca](https://github.com/projectcaluma/ember-caluma/commit/60cfaca04d94a44efc4950eeb1aecee767b4eeb5))
|
50
|
+
|
51
|
+
|
52
|
+
### Features
|
53
|
+
|
54
|
+
* **distribution:** add configurable status for unanswered inquiries ([e08247f](https://github.com/projectcaluma/ember-caluma/commit/e08247f6e2b73f859011f4eac7ffff71f101f546))
|
55
|
+
|
56
|
+
# [@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)
|
57
|
+
|
58
|
+
|
59
|
+
### Features
|
60
|
+
|
61
|
+
* **distribution:** add status for skipped inquiries ([1f93c92](https://github.com/projectcaluma/ember-caluma/commit/1f93c92d76b697954ec54aefa12348c84cd0abf9))
|
62
|
+
|
63
|
+
# [@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)
|
64
|
+
|
65
|
+
|
66
|
+
### Features
|
67
|
+
|
68
|
+
* **distribution:** add readonly mode ([2f45c98](https://github.com/projectcaluma/ember-caluma/commit/2f45c985a2fa387c79ca39c49c1e50dc37926352))
|
69
|
+
* **distribution:** allow custom permissions from the host app ([8a997bf](https://github.com/projectcaluma/ember-caluma/commit/8a997bf4d921ff738a6cca956a4dd9cbabe8f7c5))
|
70
|
+
|
1
71
|
# [@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)
|
2
72
|
|
3
73
|
|
@@ -1,13 +1,19 @@
|
|
1
1
|
import { inject as service } from "@ember/service";
|
2
2
|
import { Ability } from "ember-can";
|
3
3
|
|
4
|
+
import config from "@projectcaluma/ember-distribution/config";
|
5
|
+
|
4
6
|
const hasStatus = (status) => (edge) => edge.node.status === status;
|
5
7
|
|
6
8
|
export default class DistributionAbility extends Ability {
|
7
9
|
@service distribution;
|
8
10
|
|
11
|
+
@config config;
|
12
|
+
|
9
13
|
get canSendInquiries() {
|
10
14
|
return (
|
15
|
+
!this.config.ui.readonly &&
|
16
|
+
(this.config.permissions.sendInquiry?.(null) ?? true) &&
|
11
17
|
this.distribution.controls.value?.send.edges.filter(
|
12
18
|
hasStatus("SUSPENDED")
|
13
19
|
).length > 0
|
@@ -16,6 +22,8 @@ export default class DistributionAbility extends Ability {
|
|
16
22
|
|
17
23
|
get canCreateInquiry() {
|
18
24
|
return (
|
25
|
+
!this.config.ui.readonly &&
|
26
|
+
(this.config.permissions.createInquiry?.() ?? true) &&
|
19
27
|
this.distribution.controls.value?.create.edges.filter(hasStatus("READY"))
|
20
28
|
.length > 0
|
21
29
|
);
|
@@ -23,9 +31,20 @@ export default class DistributionAbility extends Ability {
|
|
23
31
|
|
24
32
|
get canComplete() {
|
25
33
|
return (
|
34
|
+
!this.config.ui.readonly &&
|
35
|
+
(this.config.permissions.completeDistribution?.() ?? true) &&
|
26
36
|
this.distribution.controls.value?.complete.edges.filter(
|
27
37
|
hasStatus("READY")
|
28
38
|
).length > 0
|
29
39
|
);
|
30
40
|
}
|
41
|
+
|
42
|
+
get canReopen() {
|
43
|
+
return (
|
44
|
+
!this.config.ui.readonly &&
|
45
|
+
(this.config.permissions.reopenDistribution?.() ?? true) &&
|
46
|
+
this.distribution.controls.value?.case.edges[0]?.node.parentWorkItem
|
47
|
+
.isRedoable
|
48
|
+
);
|
49
|
+
}
|
31
50
|
}
|
@@ -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
|
}
|
@@ -1,11 +1,11 @@
|
|
1
|
-
<p class="uk-text-large uk-margin-remove">
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
@label={{
|
6
|
-
|
7
|
-
|
8
|
-
{{
|
1
|
+
<p class="uk-text-large uk-margin-remove uk-flex uk-flex-middle">
|
2
|
+
<div class="uk-width-expand">
|
3
|
+
{{@name}}
|
4
|
+
{{#if @status}}
|
5
|
+
<UkLabel @label={{@status}} class="uk-margin-left" />
|
6
|
+
{{/if}}
|
7
|
+
</div>
|
8
|
+
{{yield}}
|
9
9
|
</p>
|
10
10
|
|
11
11
|
{{#if (and @modifiedBy @modifiedAt)}}
|
@@ -5,19 +5,14 @@
|
|
5
5
|
>
|
6
6
|
<:default as |content|>
|
7
7
|
|
8
|
-
<
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
/>
|
15
|
-
|
16
|
-
<CdInquiryDialog::InquiryDeadline
|
17
|
-
@inquiry={{this.inquiry}}
|
18
|
-
class="uk-margin-remove uk-position-center-right"
|
19
|
-
/>
|
20
|
-
</div>
|
8
|
+
<CdDocumentHeader
|
9
|
+
@name={{content.document.rootForm.raw.name}}
|
10
|
+
@status={{if (eq this.inquiry.status "READY") this.answerStatus}}
|
11
|
+
@modifiedAt={{this.inquiry.childCase.document.modifiedContentAt}}
|
12
|
+
@modifiedBy={{this.inquiry.childCase.document.modifiedContentByUser}}
|
13
|
+
>
|
14
|
+
<CdInquiryDialog::InquiryDeadline @inquiry={{this.inquiry}} />
|
15
|
+
</CdDocumentHeader>
|
21
16
|
|
22
17
|
<hr />
|
23
18
|
|
@@ -29,6 +24,19 @@
|
|
29
24
|
/>
|
30
25
|
</div>
|
31
26
|
|
27
|
+
{{#if
|
28
|
+
(and
|
29
|
+
(not this.buttons.length)
|
30
|
+
(can "edit answer form of inquiry" this.inquiry)
|
31
|
+
)
|
32
|
+
}}
|
33
|
+
<div class="uk-alert uk-alert-warning uk-flex uk-flex-middle">
|
34
|
+
<UkIcon @icon="warning" class="uk-margin-small-right" />
|
35
|
+
{{t "caluma.distribution.answer.complete-not-allowed"}}
|
36
|
+
{{t "caluma.distribution.not-allowed-hint"}}
|
37
|
+
</div>
|
38
|
+
{{/if}}
|
39
|
+
|
32
40
|
<content.form />
|
33
41
|
|
34
42
|
{{#each this.buttons as |buttonConfig|}}
|
@@ -1,6 +1,6 @@
|
|
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
5
|
import { trackedTask } from "ember-resources/util/ember-concurrency";
|
6
6
|
|
@@ -8,16 +8,20 @@ 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
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
|
|
23
|
+
@inquiryAnswerStatus({ inquiryProperty: "inquiry" }) answerStatus;
|
24
|
+
|
21
25
|
_inquiry = trackedTask(this, this.fetchInquiryAnswer, () => [
|
22
26
|
this.args.inquiry,
|
23
27
|
]);
|
@@ -27,16 +31,25 @@ export default class CdInquiryAnswerFormComponent extends Component {
|
|
27
31
|
}
|
28
32
|
|
29
33
|
get buttons() {
|
30
|
-
return this.inquiry?.childCase.workItems.edges
|
31
|
-
|
34
|
+
return this.inquiry?.childCase.workItems.edges
|
35
|
+
.map((edge) => {
|
36
|
+
const config = this.config.inquiry.answer.buttons[edge.node.task.slug];
|
32
37
|
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
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);
|
40
53
|
}
|
41
54
|
|
42
55
|
@dropTask
|
@@ -69,6 +82,7 @@ export default class CdInquiryAnswerFormComponent extends Component {
|
|
69
82
|
},
|
70
83
|
});
|
71
84
|
|
85
|
+
yield getObservable(this._inquiry.value)?.refetch();
|
72
86
|
yield this.router.transitionTo("inquiry.index");
|
73
87
|
} catch (error) {
|
74
88
|
this.notification.danger(
|
@@ -1,25 +1,18 @@
|
|
1
1
|
{{#if this.deadline.value}}
|
2
2
|
<div
|
3
|
-
class="uk-
|
4
|
-
{{if
|
5
|
-
this.config.ui.small
|
6
|
-
'uk-margin-top uk-margin-right'
|
7
|
-
'uk-margin-medium-top uk-margin-medium-right'
|
8
|
-
}}
|
3
|
+
class="uk-flex-inline uk-flex-middle
|
9
4
|
{{if
|
10
5
|
this.isWithdrawn
|
11
6
|
'uk-text-muted'
|
12
7
|
(concat 'uk-text-' this.deadline.color)
|
13
|
-
}}
|
14
|
-
|
8
|
+
}}"
|
9
|
+
data-test-deadline
|
15
10
|
...attributes
|
16
11
|
>
|
17
|
-
|
18
|
-
|
19
|
-
height=26
|
20
|
-
width=26
|
12
|
+
<UkIcon
|
13
|
+
@icon={{if this.isWithdrawn "ban" "clock"}}
|
21
14
|
class="uk-margin-small-right"
|
22
|
-
|
15
|
+
/>
|
23
16
|
{{#if this.isWithdrawn}}
|
24
17
|
{{t "caluma.distribution.withdraw.status"}}
|
25
18
|
{{else}}
|
@@ -3,6 +3,6 @@
|
|
3
3
|
{{if this.config.ui.small 'inquiry-divider--small' 'uk-margin'}}"
|
4
4
|
>
|
5
5
|
<div class="inquiry-divider__icon uk-flex uk-flex-center uk-flex-middle">
|
6
|
-
{{
|
6
|
+
<UkIcon @icon={{this.status.icon}} {{uk-tooltip this.status.label}} />
|
7
7
|
</div>
|
8
8
|
</div>
|
@@ -1,13 +1,23 @@
|
|
1
1
|
<div class="uk-margin-remove-last-child">
|
2
|
-
<
|
2
|
+
<div class="uk-flex uk-flex-middle uk-text-large" data-test-title>
|
3
3
|
{{#if (eq @type "request")}}
|
4
|
-
|
5
|
-
|
4
|
+
<UkIcon @icon="forward" class="uk-margin-small-right" />
|
5
|
+
<div class="uk-width-expand uk-margin-small-right">
|
6
|
+
{{group-name @inquiry.controllingGroups}}
|
7
|
+
{{#if
|
8
|
+
(and
|
9
|
+
(can "answer inquiry" @inquiry) (not @disabled) this.answerStatus
|
10
|
+
)
|
11
|
+
}}
|
12
|
+
<UkLabel @label={{this.answerStatus}} class="uk-margin-left" />
|
13
|
+
{{/if}}
|
14
|
+
</div>
|
6
15
|
{{else if (eq @type "answer")}}
|
7
|
-
|
8
|
-
{{group-name @inquiry.addressedGroups}}
|
16
|
+
<UkIcon @icon="reply" class="uk-margin-small-right" />
|
17
|
+
<div class="uk-width-expand">{{group-name @inquiry.addressedGroups}}</div>
|
9
18
|
{{/if}}
|
10
|
-
|
19
|
+
{{yield}}
|
20
|
+
</div>
|
11
21
|
|
12
22
|
<ul
|
13
23
|
class="uk-subnav uk-subnav-divider
|
@@ -45,11 +55,17 @@
|
|
45
55
|
{{t "caluma.distribution.edit.link"}}
|
46
56
|
</LinkTo>
|
47
57
|
</li>
|
48
|
-
|
49
|
-
<
|
50
|
-
|
51
|
-
|
52
|
-
|
58
|
+
{{#if (can "withdraw inquiry" @inquiry)}}
|
59
|
+
<li>
|
60
|
+
<a
|
61
|
+
href=""
|
62
|
+
{{on "click" (perform this.withdraw)}}
|
63
|
+
data-test-withdraw
|
64
|
+
>
|
65
|
+
{{t "caluma.distribution.withdraw.link"}}
|
66
|
+
</a>
|
67
|
+
</li>
|
68
|
+
{{/if}}
|
53
69
|
{{else if (can "answer inquiry" @inquiry)}}
|
54
70
|
<li>
|
55
71
|
<LinkTo
|
@@ -8,6 +8,7 @@ import { confirm } from "ember-uikit";
|
|
8
8
|
import { decodeId } from "@projectcaluma/ember-core/helpers/decode-id";
|
9
9
|
import config from "@projectcaluma/ember-distribution/config";
|
10
10
|
import withdrawInquiryMutation from "@projectcaluma/ember-distribution/gql/mutations/withdraw-inquiry.graphql";
|
11
|
+
import inquiryAnswerStatus from "@projectcaluma/ember-distribution/utils/inquiry-answer-status";
|
11
12
|
|
12
13
|
export default class CdInquiryDialogInquiryPartComponent extends Component {
|
13
14
|
@service notification;
|
@@ -18,6 +19,8 @@ export default class CdInquiryDialogInquiryPartComponent extends Component {
|
|
18
19
|
|
19
20
|
@config config;
|
20
21
|
|
22
|
+
@inquiryAnswerStatus answerStatus;
|
23
|
+
|
21
24
|
get date() {
|
22
25
|
const key = this.args.type === "request" ? "createdAt" : "closedAt";
|
23
26
|
|
@@ -31,9 +34,16 @@ export default class CdInquiryDialogInquiryPartComponent extends Component {
|
|
31
34
|
}
|
32
35
|
|
33
36
|
get answerInfo() {
|
37
|
+
const questions = this.config.inquiry.answer.infoQuestions ?? [];
|
38
|
+
|
34
39
|
return this.args.type === "answer"
|
35
40
|
? this.args.inquiry.childCase.document.info.edges
|
36
41
|
.filter((edge) => !isEmpty(edge.node.value))
|
42
|
+
.sort(
|
43
|
+
(a, b) =>
|
44
|
+
questions.indexOf(a.node.question.slug) -
|
45
|
+
questions.indexOf(b.node.question.slug)
|
46
|
+
)
|
37
47
|
.map((edge) => ({
|
38
48
|
question: edge.node.question.label,
|
39
49
|
value: edge.node.value,
|
@@ -3,14 +3,18 @@
|
|
3
3
|
{{if this.config.ui.small 'uk-card-small'}}"
|
4
4
|
>
|
5
5
|
<div class="uk-card-body">
|
6
|
-
<CdInquiryDialog::InquiryDeadline @inquiry={{@inquiry}} />
|
7
|
-
|
8
6
|
{{#if this.hasAnswer}}
|
9
|
-
<CdInquiryDialog::InquiryPart @inquiry={{@inquiry}} @type="answer"
|
7
|
+
<CdInquiryDialog::InquiryPart @inquiry={{@inquiry}} @type="answer">
|
8
|
+
<CdInquiryDialog::InquiryDeadline @inquiry={{@inquiry}} />
|
9
|
+
</CdInquiryDialog::InquiryPart>
|
10
10
|
|
11
11
|
<CdInquiryDialog::InquiryDivider @inquiry={{@inquiry}} />
|
12
12
|
{{/if}}
|
13
13
|
|
14
|
-
<CdInquiryDialog::InquiryPart @inquiry={{@inquiry}} @type="request"
|
14
|
+
<CdInquiryDialog::InquiryPart @inquiry={{@inquiry}} @type="request">
|
15
|
+
{{#unless this.hasAnswer}}
|
16
|
+
<CdInquiryDialog::InquiryDeadline @inquiry={{@inquiry}} />
|
17
|
+
{{/unless}}
|
18
|
+
</CdInquiryDialog::InquiryPart>
|
15
19
|
</div>
|
16
20
|
</article>
|
@@ -5,13 +5,19 @@
|
|
5
5
|
(and (can "create inquiry of distribution") this.currentGroupIsCreator)
|
6
6
|
}}
|
7
7
|
<div class="uk-text-center uk-margin">
|
8
|
-
<
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
@onClick={{perform this.createInquiry}}
|
8
|
+
<button
|
9
|
+
type="button"
|
10
|
+
class="uk-icon-button"
|
11
|
+
{{uk-tooltip (t "caluma.distribution.new.title")}}
|
13
12
|
data-test-new-inquiry
|
14
|
-
|
13
|
+
{{on "click" (perform this.createInquiry)}}
|
14
|
+
>
|
15
|
+
{{#if this.createInquiry.isRunning}}
|
16
|
+
<UkSpinner @ratio={{0.6}} />
|
17
|
+
{{else}}
|
18
|
+
<UkIcon @icon="plus" />
|
19
|
+
{{/if}}
|
20
|
+
</button>
|
15
21
|
</div>
|
16
22
|
{{/if}}
|
17
23
|
<section>
|
@@ -47,6 +47,7 @@ export default class CdInquiryDialogComponent extends Component {
|
|
47
47
|
deadlineQuestion: this.config.inquiry.deadlineQuestion,
|
48
48
|
statusQuestion: this.config.inquiry.answer.statusQuestion,
|
49
49
|
answerInfoQuestions: this.config.inquiry.answer.infoQuestions,
|
50
|
+
buttonTasks: Object.keys(this.config.inquiry.answer.buttons),
|
50
51
|
includeNavigationData: true,
|
51
52
|
},
|
52
53
|
});
|
@@ -6,16 +6,33 @@
|
|
6
6
|
<:default as |content|>
|
7
7
|
<CdDocumentHeader
|
8
8
|
@name={{content.document.rootForm.raw.name}}
|
9
|
-
@
|
9
|
+
@status={{if
|
10
|
+
(eq this.inquiry.status "SUSPENDED")
|
11
|
+
(t "caluma.distribution.status.draft")
|
12
|
+
}}
|
10
13
|
@modifiedAt={{this.inquiry.document.modifiedContentAt}}
|
11
14
|
@modifiedBy={{this.inquiry.document.modifiedContentByUser}}
|
12
15
|
/>
|
13
16
|
|
14
17
|
<hr />
|
18
|
+
{{#if
|
19
|
+
(and
|
20
|
+
(cannot "send inquiry" this.inquiry)
|
21
|
+
(eq this.inquiry.status "SUSPENDED")
|
22
|
+
)
|
23
|
+
}}
|
24
|
+
<div class="uk-alert uk-alert-warning uk-flex uk-flex-middle">
|
25
|
+
<UkIcon @icon="warning" class="uk-margin-small-right" />
|
26
|
+
{{t "caluma.distribution.edit.send-not-allowed"}}
|
27
|
+
{{t "caluma.distribution.not-allowed-hint"}}
|
28
|
+
</div>
|
29
|
+
{{/if}}
|
15
30
|
|
16
31
|
<content.form />
|
17
32
|
|
18
|
-
{{#if
|
33
|
+
{{#if
|
34
|
+
(and (can "edit inquiry" this.inquiry) (can "send inquiry" this.inquiry))
|
35
|
+
}}
|
19
36
|
<DocumentValidity @document={{content.document}} as |isValid validate|>
|
20
37
|
<UkButton
|
21
38
|
@type="submit"
|
@@ -80,36 +80,38 @@
|
|
80
80
|
<UkSpinner @ratio={{2}} />
|
81
81
|
</div>
|
82
82
|
{{else if this.groups.value.length}}
|
83
|
-
<
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
<
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
group.config.icon
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
83
|
+
<table
|
84
|
+
class="uk-table uk-table-striped uk-table-hover uk-table-small uk-table-middle group-list"
|
85
|
+
>
|
86
|
+
<tbody>
|
87
|
+
{{#each this.groups.value as |group|}}
|
88
|
+
{{! template-lint-disable require-presentational-children }}
|
89
|
+
<tr
|
90
|
+
role="checkbox"
|
91
|
+
data-test-group={{group.identifier}}
|
92
|
+
{{on "click" (fn this.updateSelectedGroups group.identifier)}}
|
93
|
+
>
|
94
|
+
<td class="uk-padding-remove-right">
|
95
|
+
{{! template-lint-disable require-input-label no-nested-interactive }}
|
96
|
+
<input
|
97
|
+
type="checkbox"
|
98
|
+
class="uk-checkbox"
|
99
|
+
checked={{includes group.identifier this.selectedGroups}}
|
100
|
+
/>
|
101
|
+
</td>
|
102
|
+
<td class="uk-width-expand">{{group-name group.identifier}}</td>
|
103
|
+
<td class="uk-text-right">
|
104
|
+
{{#if group.config.icon}}
|
105
|
+
<UkIcon
|
106
|
+
@icon={{group.config.icon}}
|
107
|
+
class="uk-display-block uk-text-{{group.config.iconColor}}"
|
108
|
+
/>
|
109
|
+
{{/if}}
|
110
|
+
</td>
|
111
|
+
</tr>
|
112
|
+
{{/each}}
|
113
|
+
</tbody>
|
114
|
+
</table>
|
113
115
|
{{else}}
|
114
116
|
<div class="uk-text-center">
|
115
117
|
<UkIcon @icon="search" @ratio={{10}} class="uk-margin-top" />
|
@@ -44,9 +44,7 @@ export default class CdInquiryNewFormComponent extends Component {
|
|
44
44
|
}
|
45
45
|
|
46
46
|
@action
|
47
|
-
updateSelectedGroups(identifier
|
48
|
-
e.preventDefault();
|
49
|
-
|
47
|
+
updateSelectedGroups(identifier) {
|
50
48
|
this.selectedGroups = toggle(identifier, this.selectedGroups);
|
51
49
|
}
|
52
50
|
|