@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
@@ -1,32 +1,57 @@
|
|
1
1
|
<div class="uk-text-center uk-margin-small-top">
|
2
2
|
{{#if (can "create inquiry of distribution")}}
|
3
|
-
<
|
4
|
-
@title={{t "caluma.distribution.new.title"}}
|
5
|
-
@icon="plus"
|
3
|
+
<LinkTo
|
6
4
|
@route="new"
|
7
|
-
|
5
|
+
class="uk-icon-button"
|
6
|
+
{{uk-tooltip (t "caluma.distribution.new.title")}}
|
7
|
+
data-test-new-inquiry
|
8
|
+
>
|
9
|
+
<UkIcon @icon="plus" />
|
10
|
+
</LinkTo>
|
8
11
|
{{/if}}
|
9
12
|
{{#if (can "send inquiries of distribution")}}
|
10
|
-
<
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
@gutterTop={{4}}
|
15
|
-
@gutterRight={{6}}
|
16
|
-
@gutterLeft={{4}}
|
17
|
-
@gutterBottom={{4}}
|
18
|
-
@onClick={{perform this.sendInquiries}}
|
19
|
-
@loading={{this.sendInquiries.isRunning}}
|
13
|
+
<button
|
14
|
+
type="button"
|
15
|
+
class="uk-icon-button"
|
16
|
+
{{uk-tooltip (t "caluma.distribution.send")}}
|
20
17
|
data-test-send-pending-inquiries
|
21
|
-
|
18
|
+
{{on "click" (perform this.sendInquiries)}}
|
19
|
+
>
|
20
|
+
{{#if this.sendInquiries.isRunning}}
|
21
|
+
<UkSpinner @ratio={{0.6}} />
|
22
|
+
{{else}}
|
23
|
+
<UkIcon @icon="comment" />
|
24
|
+
{{/if}}
|
25
|
+
</button>
|
22
26
|
{{/if}}
|
23
27
|
{{#if (can "complete distribution")}}
|
24
|
-
<
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
@loading={{this.completeDistribution.isRunning}}
|
28
|
+
<button
|
29
|
+
type="button"
|
30
|
+
class="uk-icon-button"
|
31
|
+
{{uk-tooltip (t "caluma.distribution.complete")}}
|
29
32
|
data-test-complete-distribution
|
30
|
-
|
33
|
+
{{on "click" (perform this.completeDistribution)}}
|
34
|
+
>
|
35
|
+
{{#if this.completeDistribution.isRunning}}
|
36
|
+
<UkSpinner @ratio={{0.6}} />
|
37
|
+
{{else}}
|
38
|
+
<UkIcon @icon="lock" />
|
39
|
+
{{/if}}
|
40
|
+
</button>
|
41
|
+
{{/if}}
|
42
|
+
{{#if (can "reopen distribution")}}
|
43
|
+
<button
|
44
|
+
type="button"
|
45
|
+
class="uk-icon-button"
|
46
|
+
{{uk-tooltip (t "caluma.distribution.reopen")}}
|
47
|
+
data-test-reopen-distribution
|
48
|
+
{{on "click" (perform this.reopenDistribution)}}
|
49
|
+
>
|
50
|
+
{{#if this.reopenDistribution.isRunning}}
|
51
|
+
<UkSpinner @ratio={{0.6}} />
|
52
|
+
{{else}}
|
53
|
+
<UkIcon @icon="refresh" />
|
54
|
+
{{/if}}
|
55
|
+
</button>
|
31
56
|
{{/if}}
|
32
57
|
</div>
|
@@ -8,6 +8,7 @@ import { gql } from "graphql-tag";
|
|
8
8
|
import { decodeId } from "@projectcaluma/ember-core/helpers/decode-id";
|
9
9
|
import config from "@projectcaluma/ember-distribution/config";
|
10
10
|
import completeWorkItemMutation from "@projectcaluma/ember-distribution/gql/mutations/complete-work-item.graphql";
|
11
|
+
import redoWorkItemMutation from "@projectcaluma/ember-distribution/gql/mutations/redo-work-item.graphql";
|
11
12
|
import incompleteInquiriesQuery from "@projectcaluma/ember-distribution/gql/queries/incomplete-inquiries.graphql";
|
12
13
|
|
13
14
|
export default class CdNavigationControlsComponent extends Component {
|
@@ -26,21 +27,21 @@ export default class CdNavigationControlsComponent extends Component {
|
|
26
27
|
{
|
27
28
|
query: incompleteInquiriesQuery,
|
28
29
|
variables: {
|
29
|
-
caseId: this.
|
30
|
+
caseId: this.distribution.caseId,
|
30
31
|
task: this.config.inquiry.task,
|
31
32
|
},
|
32
33
|
},
|
33
34
|
"allWorkItems.totalCount"
|
34
35
|
);
|
35
36
|
|
36
|
-
|
37
|
-
incompleteInquiries
|
38
|
-
|
39
|
-
this.intl.t("caluma.distribution.complete-confirm", {
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
) {
|
37
|
+
const confirmText =
|
38
|
+
incompleteInquiries === 0
|
39
|
+
? this.intl.t("caluma.distribution.complete-confirm-empty")
|
40
|
+
: this.intl.t("caluma.distribution.complete-confirm", {
|
41
|
+
count: incompleteInquiries,
|
42
|
+
});
|
43
|
+
|
44
|
+
if (!(yield confirm(confirmText))) {
|
44
45
|
return;
|
45
46
|
}
|
46
47
|
|
@@ -63,6 +64,30 @@ export default class CdNavigationControlsComponent extends Component {
|
|
63
64
|
}
|
64
65
|
}
|
65
66
|
|
67
|
+
@dropTask
|
68
|
+
*reopenDistribution() {
|
69
|
+
try {
|
70
|
+
if (!(yield confirm(this.intl.t("caluma.distribution.reopen-confirm")))) {
|
71
|
+
return;
|
72
|
+
}
|
73
|
+
|
74
|
+
const distributionWorkItemId = decodeId(
|
75
|
+
this.distribution.controls.value?.case.edges[0]?.node.parentWorkItem.id
|
76
|
+
);
|
77
|
+
|
78
|
+
yield this.apollo.mutate({
|
79
|
+
mutation: redoWorkItemMutation,
|
80
|
+
variables: {
|
81
|
+
workItem: distributionWorkItemId,
|
82
|
+
},
|
83
|
+
});
|
84
|
+
|
85
|
+
yield this.distribution.refetchControls();
|
86
|
+
} catch (e) {
|
87
|
+
this.notification.danger(this.intl.t("caluma.distribution.reopen-error"));
|
88
|
+
}
|
89
|
+
}
|
90
|
+
|
66
91
|
@dropTask
|
67
92
|
*sendInquiries() {
|
68
93
|
if (!(yield confirm(this.intl.t("caluma.distribution.send-confirm")))) {
|
@@ -1,15 +1,18 @@
|
|
1
|
-
<li class={{if this.isActive
|
1
|
+
<li class="uk-width-auto {{if this.isActive 'uk-active'}}">
|
2
2
|
<LinkTo @route="inquiry" @model={{this.model}}>
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
3
|
+
{{#let
|
4
|
+
(if
|
5
|
+
(eq @type "addressed")
|
6
|
+
@inquiry.controllingGroupName
|
7
|
+
@inquiry.addressedGroupName
|
8
|
+
)
|
9
|
+
as |name|
|
10
|
+
}}
|
11
|
+
<span class="uk-width-expand uk-text-truncate" title={{name}}>
|
12
|
+
{{name}}
|
13
|
+
</span>
|
14
|
+
{{/let}}
|
11
15
|
|
12
|
-
|
13
|
-
</div>
|
16
|
+
<CdNavigation::StatusIndicator @inquiry={{@inquiry}} @type={{@type}} />
|
14
17
|
</LinkTo>
|
15
18
|
</li>
|
@@ -1,5 +1,5 @@
|
|
1
|
-
<li class="uk-margin-small-bottom">
|
2
|
-
<a href=""
|
1
|
+
<li class="uk-margin-small-bottom uk-width-auto">
|
2
|
+
<a href="" {{on "click" this.toggle}}>
|
3
3
|
<span class="uk-width-expand">
|
4
4
|
{{t (concat "caluma.distribution.types." @type)}}
|
5
5
|
</span>
|
@@ -12,7 +12,7 @@
|
|
12
12
|
|
13
13
|
{{#if this.expanded}}
|
14
14
|
{{#if @inquiries.length}}
|
15
|
-
<ul class="uk-tab uk-tab-left uk-margin-left">
|
15
|
+
<ul class="uk-tab uk-tab-left uk-margin-left uk-width-auto">
|
16
16
|
{{#each this.inquiries as |inquiry|}}
|
17
17
|
<CdNavigation::Item @inquiry={{inquiry}} @type={{@type}} />
|
18
18
|
{{/each}}
|
@@ -20,7 +20,7 @@
|
|
20
20
|
{{/if}}
|
21
21
|
|
22
22
|
{{#if (eq @type "controlling")}}
|
23
|
-
<CdNavigation::Controls
|
23
|
+
<CdNavigation::Controls />
|
24
24
|
{{/if}}
|
25
25
|
{{/if}}
|
26
26
|
</li>
|
@@ -1,18 +1,13 @@
|
|
1
1
|
{{#if this.showDeadlineIndicator}}
|
2
|
-
<
|
3
|
-
|
4
|
-
|
5
|
-
{{
|
6
|
-
|
7
|
-
height=16
|
8
|
-
width=16
|
9
|
-
title=(format-date this.deadline.value)
|
10
|
-
}}
|
11
|
-
</div>
|
2
|
+
<UkIcon
|
3
|
+
@icon="clock"
|
4
|
+
class="uk-margin-small-right uk-text-{{this.deadline.color}}"
|
5
|
+
{{uk-tooltip (format-date this.deadline.value)}}
|
6
|
+
/>
|
12
7
|
{{/if}}
|
13
8
|
|
14
|
-
<
|
15
|
-
|
16
|
-
|
17
|
-
{{
|
18
|
-
|
9
|
+
<UkIcon
|
10
|
+
@icon={{this.status.icon}}
|
11
|
+
class="uk-text-{{this.status.color}}"
|
12
|
+
{{uk-tooltip this.status.label}}
|
13
|
+
/>
|
@@ -1,14 +1,11 @@
|
|
1
|
-
<
|
2
|
-
<
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
<CdNavigation::Section @type="more" @inquiries={{this.inquiries.more}} />
|
13
|
-
</ul>
|
14
|
-
</aside>
|
1
|
+
<ul class="uk-tab uk-tab-left uk-margin-remove-bottom uk-width-auto">
|
2
|
+
<CdNavigation::Section
|
3
|
+
@type="controlling"
|
4
|
+
@inquiries={{this.inquiries.controlling}}
|
5
|
+
/>
|
6
|
+
<CdNavigation::Section
|
7
|
+
@type="addressed"
|
8
|
+
@inquiries={{this.inquiries.addressed}}
|
9
|
+
/>
|
10
|
+
<CdNavigation::Section @type="more" @inquiries={{this.inquiries.more}} />
|
11
|
+
</ul>
|
package/addon/config.js
CHANGED
@@ -4,6 +4,7 @@ import { cached } from "tracked-toolbox";
|
|
4
4
|
|
5
5
|
export const INQUIRY_STATUS = {
|
6
6
|
DRAFT: "draft",
|
7
|
+
SKIPPED: "skipped",
|
7
8
|
SENT: "sent",
|
8
9
|
POSITIVE: "positive",
|
9
10
|
NEGATIVE: "negative",
|
@@ -15,7 +16,7 @@ export default function config(target, property) {
|
|
15
16
|
get() {
|
16
17
|
return merge(
|
17
18
|
{
|
18
|
-
ui: { stack: false, small: false },
|
19
|
+
ui: { stack: false, small: false, readonly: false },
|
19
20
|
controls: {
|
20
21
|
createTask: "create-inquiry",
|
21
22
|
completeTask: "complete-distribution",
|
@@ -37,20 +38,22 @@ export default function config(target, property) {
|
|
37
38
|
buttons: {
|
38
39
|
"compose-inquiry-answer": {
|
39
40
|
color: "primary",
|
40
|
-
label: "caluma.distribution.answer.
|
41
|
+
label: "caluma.distribution.answer.buttons.compose.label",
|
42
|
+
status: "caluma.distribution.answer.buttons.compose.status",
|
41
43
|
},
|
42
44
|
"confirm-inquiry-answer": {
|
43
45
|
color: "primary",
|
44
|
-
label: "caluma.distribution.answer.confirm",
|
46
|
+
label: "caluma.distribution.answer.buttons.confirm.label",
|
47
|
+
status: "caluma.distribution.answer.buttons.confirm.status",
|
45
48
|
},
|
46
49
|
"revise-inquiry-answer": {
|
47
50
|
color: "default",
|
48
|
-
label: "caluma.distribution.answer.revise",
|
51
|
+
label: "caluma.distribution.answer.buttons.revise.label",
|
49
52
|
},
|
50
53
|
"adjust-inquiry-answer": {
|
51
54
|
color: "primary",
|
52
|
-
label:
|
53
|
-
|
55
|
+
label: "caluma.distribution.answer.buttons.adjust.label",
|
56
|
+
status: "caluma.distribution.answer.buttons.adjust.status",
|
54
57
|
},
|
55
58
|
},
|
56
59
|
},
|
@@ -60,11 +63,12 @@ export default function config(target, property) {
|
|
60
63
|
types: {
|
61
64
|
suggestions: {
|
62
65
|
label: "caluma.distribution.new.suggestions",
|
63
|
-
icon: "
|
66
|
+
icon: "star",
|
64
67
|
iconColor: "warning",
|
65
68
|
},
|
66
69
|
},
|
67
70
|
},
|
71
|
+
permissions: {},
|
68
72
|
},
|
69
73
|
getOwner(this).lookup("service:calumaOptions")?.distribution ?? {}
|
70
74
|
);
|
package/addon/engine.js
CHANGED
@@ -16,7 +16,9 @@ export default class DistributionEngine extends Engine {
|
|
16
16
|
"notification",
|
17
17
|
"intl",
|
18
18
|
"caluma-options",
|
19
|
-
|
19
|
+
// this is just in case that a custom form widget uses the store or fetch service
|
20
|
+
"store",
|
21
|
+
"fetch",
|
20
22
|
],
|
21
23
|
};
|
22
24
|
}
|
@@ -1,6 +1,21 @@
|
|
1
|
+
fragment InquiryAnswerButtons on Case {
|
2
|
+
workItems(filter: [{ tasks: $buttonTasks }, { status: READY }]) {
|
3
|
+
edges {
|
4
|
+
node {
|
5
|
+
id
|
6
|
+
status
|
7
|
+
task {
|
8
|
+
id
|
9
|
+
slug
|
10
|
+
}
|
11
|
+
}
|
12
|
+
}
|
13
|
+
}
|
14
|
+
}
|
15
|
+
|
1
16
|
fragment InquiryDeadlineDocument on Document {
|
2
17
|
id
|
3
|
-
deadline: answers(question: $deadlineQuestion) {
|
18
|
+
deadline: answers(filter: [{ question: $deadlineQuestion }]) {
|
4
19
|
edges {
|
5
20
|
node {
|
6
21
|
id
|
@@ -14,7 +29,7 @@ fragment InquiryDeadlineDocument on Document {
|
|
14
29
|
|
15
30
|
fragment InquiryStatusDocument on Document {
|
16
31
|
id
|
17
|
-
status: answers(question: $statusQuestion) {
|
32
|
+
status: answers(filter: [{ question: $statusQuestion }]) {
|
18
33
|
edges {
|
19
34
|
node {
|
20
35
|
id
|
@@ -33,7 +48,7 @@ fragment InquiryStatusDocument on Document {
|
|
33
48
|
fragment InquiryRequest on Document {
|
34
49
|
id
|
35
50
|
...InquiryDeadlineDocument
|
36
|
-
info: answers(question: $infoQuestion) {
|
51
|
+
info: answers(filter: [{ question: $infoQuestion }]) {
|
37
52
|
edges {
|
38
53
|
node {
|
39
54
|
id
|
@@ -61,15 +76,17 @@ fragment InquiryDialog on WorkItem {
|
|
61
76
|
}
|
62
77
|
childCase {
|
63
78
|
id
|
79
|
+
...InquiryAnswerButtons
|
64
80
|
document {
|
65
81
|
...InquiryStatusDocument
|
66
|
-
info: answers(questions: $answerInfoQuestions) {
|
82
|
+
info: answers(filter: [{ questions: $answerInfoQuestions }]) {
|
67
83
|
edges {
|
68
84
|
node {
|
69
85
|
id
|
70
86
|
question {
|
71
87
|
id
|
72
88
|
label
|
89
|
+
slug
|
73
90
|
}
|
74
91
|
... on StringAnswer {
|
75
92
|
value
|
@@ -1,4 +1,4 @@
|
|
1
|
-
#import InquiryDeadlineDocument, InquiryRequest from '../fragments/inquiry.graphql'
|
1
|
+
#import InquiryAnswerButtons, InquiryDeadlineDocument, InquiryRequest from '../fragments/inquiry.graphql'
|
2
2
|
|
3
3
|
query InquiryAnswer(
|
4
4
|
$inquiry: ID!
|
@@ -14,6 +14,7 @@ query InquiryAnswer(
|
|
14
14
|
addressedGroups
|
15
15
|
controllingGroups
|
16
16
|
createdAt
|
17
|
+
closedAt
|
17
18
|
task {
|
18
19
|
id
|
19
20
|
slug
|
@@ -29,17 +30,7 @@ query InquiryAnswer(
|
|
29
30
|
modifiedContentAt
|
30
31
|
modifiedContentByUser
|
31
32
|
}
|
32
|
-
|
33
|
-
edges {
|
34
|
-
node {
|
35
|
-
id
|
36
|
-
task {
|
37
|
-
id
|
38
|
-
slug
|
39
|
-
}
|
40
|
-
}
|
41
|
-
}
|
42
|
-
}
|
33
|
+
...InquiryAnswerButtons
|
43
34
|
}
|
44
35
|
}
|
45
36
|
}
|
@@ -1,7 +1,8 @@
|
|
1
|
-
#import InquiryDialog, InquiryDeadlineDocument, InquiryStatusDocument, InquiryRequest from '../fragments/inquiry.graphql'
|
1
|
+
#import InquiryAnswerButtons, InquiryDialog, InquiryDeadlineDocument, InquiryStatusDocument, InquiryRequest from '../fragments/inquiry.graphql'
|
2
2
|
|
3
3
|
query InquiryDialog(
|
4
4
|
$task: ID!
|
5
|
+
$buttonTasks: [String]!
|
5
6
|
$statusQuestion: ID!
|
6
7
|
$deadlineQuestion: ID!
|
7
8
|
$infoQuestion: ID!
|
@@ -29,10 +29,18 @@ export default class DistributionService extends Service {
|
|
29
29
|
navigation = trackedTask(this, this.fetchNavigation, () => [this.caseId]);
|
30
30
|
|
31
31
|
async refetch() {
|
32
|
-
await
|
32
|
+
await this.refetchControls();
|
33
|
+
await this.refetchNavigation();
|
34
|
+
}
|
35
|
+
|
36
|
+
async refetchNavigation() {
|
33
37
|
await getObservable(this.navigation.value)?.refetch();
|
34
38
|
}
|
35
39
|
|
40
|
+
async refetchControls() {
|
41
|
+
await getObservable(this.controls.value)?.refetch();
|
42
|
+
}
|
43
|
+
|
36
44
|
@dropTask
|
37
45
|
*fetchControls(caseId) {
|
38
46
|
return yield this.apollo.watchQuery({
|
@@ -11,6 +11,7 @@
|
|
11
11
|
<div class={{if this.config.ui.stack "uk-width-1-1" "uk-width-1-3"}}>
|
12
12
|
<CdNavigation @caseId={{@model}} />
|
13
13
|
</div>
|
14
|
+
{{#if this.config.ui.stack}}<div class="uk-width-1-1"><hr /></div>{{/if}}
|
14
15
|
<div class={{if this.config.ui.stack "uk-width-1-1" "uk-width-2-3"}}>
|
15
16
|
{{outlet}}
|
16
17
|
</div>
|
@@ -0,0 +1,34 @@
|
|
1
|
+
import { assert } from "@ember/debug";
|
2
|
+
import { get } from "@ember/object";
|
3
|
+
|
4
|
+
import { createDecorator } from "@projectcaluma/ember-distribution/-private/decorator";
|
5
|
+
|
6
|
+
function decorator(
|
7
|
+
target,
|
8
|
+
key,
|
9
|
+
desc,
|
10
|
+
{ inquiryProperty = "args.inquiry" } = {}
|
11
|
+
) {
|
12
|
+
assert(
|
13
|
+
`The @projectcaluma/ember-distribution config must be injected in order to use @inquiryAnswerStatus: \`@config config\``,
|
14
|
+
Object.prototype.hasOwnProperty.call(target, "config")
|
15
|
+
);
|
16
|
+
|
17
|
+
return {
|
18
|
+
get() {
|
19
|
+
const inquiry = get(this, inquiryProperty);
|
20
|
+
const readyWorkItems =
|
21
|
+
inquiry.childCase?.workItems.edges
|
22
|
+
.filter((edge) => edge.node.status === "READY")
|
23
|
+
.map((edge) => edge.node.task.slug) ?? [];
|
24
|
+
|
25
|
+
const buttonConfig = Object.entries(
|
26
|
+
this.config.inquiry.answer.buttons
|
27
|
+
).find(([task]) => readyWorkItems.includes(task))?.[1];
|
28
|
+
|
29
|
+
return buttonConfig?.status ? this.intl.t(buttonConfig.status) : null;
|
30
|
+
},
|
31
|
+
};
|
32
|
+
}
|
33
|
+
|
34
|
+
export default createDecorator(decorator);
|
@@ -19,18 +19,18 @@ function decorator(
|
|
19
19
|
get() {
|
20
20
|
const inquiry = get(this, inquiryProperty);
|
21
21
|
const value = inquiry.document?.deadline.edges[0]?.node.value;
|
22
|
-
const
|
22
|
+
const isDone = ["COMPLETED", "SKIPPED"].includes(inquiry.status);
|
23
23
|
|
24
24
|
const { days: diff } = DateTime.fromISO(value).diffNow("days").toObject();
|
25
25
|
|
26
|
-
const isOverdue = !
|
27
|
-
const isWarning = !
|
26
|
+
const isOverdue = !isDone && diff <= 0;
|
27
|
+
const isWarning = !isDone && diff <= this.config.warningPeriod;
|
28
28
|
|
29
29
|
return {
|
30
30
|
value,
|
31
31
|
isOverdue,
|
32
32
|
isWarning,
|
33
|
-
color:
|
33
|
+
color: isDone
|
34
34
|
? "muted"
|
35
35
|
: isOverdue
|
36
36
|
? "danger"
|
@@ -5,15 +5,17 @@ import { createDecorator } from "@projectcaluma/ember-distribution/-private/deco
|
|
5
5
|
import { INQUIRY_STATUS } from "@projectcaluma/ember-distribution/config";
|
6
6
|
|
7
7
|
export const ICON_MAP = {
|
8
|
-
[INQUIRY_STATUS.DRAFT]: "
|
9
|
-
[INQUIRY_STATUS.
|
10
|
-
[INQUIRY_STATUS.
|
11
|
-
[INQUIRY_STATUS.
|
12
|
-
[INQUIRY_STATUS.
|
8
|
+
[INQUIRY_STATUS.DRAFT]: "commenting",
|
9
|
+
[INQUIRY_STATUS.SKIPPED]: "lock",
|
10
|
+
[INQUIRY_STATUS.SENT]: "comment",
|
11
|
+
[INQUIRY_STATUS.POSITIVE]: "check",
|
12
|
+
[INQUIRY_STATUS.NEGATIVE]: "close",
|
13
|
+
[INQUIRY_STATUS.NEEDS_INTERACTION]: "file-text",
|
13
14
|
};
|
14
15
|
|
15
16
|
export const COLOR_MAP = {
|
16
17
|
[INQUIRY_STATUS.DRAFT]: "muted",
|
18
|
+
[INQUIRY_STATUS.SKIPPED]: "muted",
|
17
19
|
[INQUIRY_STATUS.SENT]: "emphasis",
|
18
20
|
[INQUIRY_STATUS.POSITIVE]: "success",
|
19
21
|
[INQUIRY_STATUS.NEGATIVE]: "danger",
|
@@ -44,9 +46,12 @@ function decorator(
|
|
44
46
|
? inquiry.status === "READY"
|
45
47
|
: inquiry.status === "SUSPENDED";
|
46
48
|
const isSent = !isAddressed && inquiry.status === "READY";
|
49
|
+
const isSkipped = inquiry.status === "SKIPPED";
|
47
50
|
|
48
51
|
const answer = inquiry.childCase?.document.status.edges[0]?.node;
|
49
|
-
const slug =
|
52
|
+
const slug = isSkipped
|
53
|
+
? INQUIRY_STATUS.SKIPPED
|
54
|
+
: isDraft
|
50
55
|
? INQUIRY_STATUS.DRAFT
|
51
56
|
: isSent
|
52
57
|
? INQUIRY_STATUS.SENT
|
@@ -55,7 +60,7 @@ function decorator(
|
|
55
60
|
return {
|
56
61
|
slug,
|
57
62
|
label:
|
58
|
-
!isDraft && !isSent
|
63
|
+
!isSkipped && !isDraft && !isSent
|
59
64
|
? answer?.selectedOption.label
|
60
65
|
: this.intl.t(`caluma.distribution.status.${slug}`),
|
61
66
|
color: COLOR_MAP[slug],
|
@@ -0,0 +1 @@
|
|
1
|
+
export { default } from "@projectcaluma/ember-distribution/utils/inquiry-answer-status";
|
package/index.js
CHANGED
@@ -5,11 +5,6 @@ const { buildEngine } = require("ember-engines/lib/engine-addon");
|
|
5
5
|
|
6
6
|
const name = require("./package").name;
|
7
7
|
|
8
|
-
const ioniconAssets = [
|
9
|
-
...require.resolve("ionicons").split("/").slice(0, -1),
|
10
|
-
"svg",
|
11
|
-
].join("/");
|
12
|
-
|
13
8
|
const publicAssets = [
|
14
9
|
...require.resolve(name).split("/").slice(0, -1),
|
15
10
|
"public",
|
@@ -19,5 +14,5 @@ const publicAssets = [
|
|
19
14
|
module.exports = buildEngine({
|
20
15
|
name,
|
21
16
|
lazyLoading: { enabled: false },
|
22
|
-
svgJar: { sourceDirs: [
|
17
|
+
svgJar: { sourceDirs: [publicAssets] },
|
23
18
|
});
|