@projectcaluma/ember-distribution 1.0.0-beta.6 → 1.0.0-beta.9
Sign up to get free protection for your applications and to get access to all the features.
- package/CHANGELOG.md +38 -0
- package/addon/components/cd-document-header.hbs +20 -0
- package/addon/components/{icon-button.hbs → cd-icon-button.hbs} +0 -0
- package/addon/components/{icon-button.js → cd-icon-button.js} +1 -1
- package/addon/components/{inquiry-answer-form.hbs → cd-inquiry-answer-form.hbs} +27 -10
- package/addon/components/{inquiry-answer-form.js → cd-inquiry-answer-form.js} +7 -3
- package/addon/components/{inquiry-dialog → cd-inquiry-dialog}/inquiry-deadline.hbs +2 -0
- package/addon/components/{inquiry-dialog → cd-inquiry-dialog}/inquiry-deadline.js +1 -1
- package/addon/components/{inquiry-dialog → cd-inquiry-dialog}/inquiry-divider.hbs +0 -0
- package/addon/components/{inquiry-dialog → cd-inquiry-dialog}/inquiry-divider.js +1 -1
- package/addon/components/cd-inquiry-dialog/inquiry-part.hbs +95 -0
- package/addon/components/{inquiry-dialog → cd-inquiry-dialog}/inquiry-part.js +16 -9
- package/addon/components/cd-inquiry-dialog/inquiry.hbs +16 -0
- package/addon/components/{inquiry-dialog → cd-inquiry-dialog}/inquiry.js +1 -1
- package/addon/components/cd-inquiry-dialog.hbs +24 -0
- package/addon/components/{inquiry-dialog.js → cd-inquiry-dialog.js} +32 -4
- package/addon/components/cd-inquiry-edit-form.hbs +31 -0
- package/addon/components/{inquiry-edit-form.js → cd-inquiry-edit-form.js} +3 -3
- package/addon/components/{inquiry-new-form.hbs → cd-inquiry-new-form.hbs} +4 -2
- package/addon/components/{inquiry-new-form.js → cd-inquiry-new-form.js} +17 -43
- package/addon/components/{distribution-navigation → cd-navigation}/controls.hbs +10 -4
- package/addon/components/cd-navigation/controls.js +95 -0
- package/addon/components/{distribution-navigation → cd-navigation}/item.hbs +1 -4
- package/addon/components/{distribution-navigation → cd-navigation}/item.js +1 -1
- package/addon/components/{distribution-navigation → cd-navigation}/section.hbs +2 -2
- package/addon/components/{distribution-navigation → cd-navigation}/section.js +1 -1
- package/addon/components/{distribution-navigation → cd-navigation}/status-indicator.hbs +2 -1
- package/addon/components/{distribution-navigation → cd-navigation}/status-indicator.js +1 -1
- package/addon/components/{distribution-navigation.hbs → cd-navigation.hbs} +3 -6
- package/addon/components/{distribution-navigation.js → cd-navigation.js} +1 -1
- package/addon/components/{notfound.hbs → cd-notfound.hbs} +0 -0
- package/addon/components/cd-truncated.hbs +8 -0
- package/addon/components/cd-truncated.js +32 -0
- package/addon/config.js +1 -1
- package/addon/controllers/application.js +3 -0
- package/addon/controllers/new.js +1 -1
- package/addon/engine.js +7 -1
- package/addon/gql/fragments/inquiry.graphql +21 -12
- package/addon/gql/mutations/complete-work-item.graphql +8 -0
- package/addon/gql/queries/incomplete-inquiries.graphql +13 -0
- package/addon/gql/queries/inquiry-answer.graphql +15 -1
- package/addon/gql/queries/inquiry-dialog.graphql +2 -2
- package/addon/gql/queries/inquiry-edit.graphql +2 -0
- package/addon/gql/queries/inquiry-navigation.graphql +2 -1
- package/addon/services/distribution.js +33 -3
- package/addon/templates/application.hbs +16 -6
- package/addon/templates/inquiry/detail/answer.hbs +1 -1
- package/addon/templates/inquiry/detail/index.hbs +1 -1
- package/addon/templates/inquiry/index.hbs +1 -1
- package/addon/templates/new.hbs +1 -1
- package/addon/templates/notfound.hbs +1 -1
- package/addon/utils/inquiry-deadline.js +3 -5
- package/app/components/cd-document-header.js +1 -0
- package/app/components/{inquiry-dialog.js → cd-icon-button.js} +1 -1
- 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-new-form.js → cd-navigation.js} +1 -1
- package/app/components/{notfound.js → cd-notfound.js} +1 -1
- package/app/components/{icon-button.js → cd-truncated.js} +1 -1
- package/app/styles/@projectcaluma/ember-distribution.scss +2 -0
- package/app/styles/_answer-form.scss +4 -0
- package/app/styles/_truncated.scss +3 -0
- package/package.json +24 -24
- package/translations/de.yaml +11 -4
- package/translations/en.yaml +12 -4
- package/translations/fr.yaml +11 -4
- package/addon/components/distribution-navigation/controls.js +0 -51
- package/addon/components/inquiry-dialog/inquiry-part.hbs +0 -48
- package/addon/components/inquiry-dialog/inquiry.hbs +0 -16
- package/addon/components/inquiry-dialog.hbs +0 -11
- package/addon/components/inquiry-edit-form.hbs +0 -29
- 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
@@ -1,9 +1,13 @@
|
|
1
1
|
<div class="uk-text-center uk-margin-small-top">
|
2
2
|
{{#if (can "create inquiry of distribution")}}
|
3
|
-
<
|
3
|
+
<CdIconButton
|
4
|
+
@title={{t "caluma.distribution.new.title"}}
|
5
|
+
@icon="plus"
|
6
|
+
@route="new"
|
7
|
+
/>
|
4
8
|
{{/if}}
|
5
9
|
{{#if (can "send inquiries of distribution")}}
|
6
|
-
<
|
10
|
+
<CdIconButton
|
7
11
|
@title={{t "caluma.distribution.send"}}
|
8
12
|
@icon="paper-plane-outline"
|
9
13
|
@fromSvgJar={{true}}
|
@@ -17,10 +21,12 @@
|
|
17
21
|
/>
|
18
22
|
{{/if}}
|
19
23
|
{{#if (can "complete distribution")}}
|
20
|
-
<
|
24
|
+
<CdIconButton
|
21
25
|
@icon="lock-closed-outline"
|
22
26
|
@fromSvgJar={{true}}
|
23
|
-
@onClick={{this.
|
27
|
+
@onClick={{perform this.completeDistribution}}
|
28
|
+
@loading={{this.completeDistribution.isRunning}}
|
29
|
+
data-test-complete-distribution
|
24
30
|
/>
|
25
31
|
{{/if}}
|
26
32
|
</div>
|
@@ -0,0 +1,95 @@
|
|
1
|
+
import { inject as service } from "@ember/service";
|
2
|
+
import Component from "@glimmer/component";
|
3
|
+
import { queryManager } from "ember-apollo-client";
|
4
|
+
import { dropTask } from "ember-concurrency";
|
5
|
+
import { confirm } from "ember-uikit";
|
6
|
+
import { gql } from "graphql-tag";
|
7
|
+
|
8
|
+
import { decodeId } from "@projectcaluma/ember-core/helpers/decode-id";
|
9
|
+
import config from "@projectcaluma/ember-distribution/config";
|
10
|
+
import completeWorkItemMutation from "@projectcaluma/ember-distribution/gql/mutations/complete-work-item.graphql";
|
11
|
+
import incompleteInquiriesQuery from "@projectcaluma/ember-distribution/gql/queries/incomplete-inquiries.graphql";
|
12
|
+
|
13
|
+
export default class CdNavigationControlsComponent extends Component {
|
14
|
+
@service distribution;
|
15
|
+
@service intl;
|
16
|
+
@service notification;
|
17
|
+
@service router;
|
18
|
+
|
19
|
+
@queryManager apollo;
|
20
|
+
@config config;
|
21
|
+
|
22
|
+
@dropTask
|
23
|
+
*completeDistribution() {
|
24
|
+
try {
|
25
|
+
const incompleteInquiries = yield this.apollo.query(
|
26
|
+
{
|
27
|
+
query: incompleteInquiriesQuery,
|
28
|
+
variables: {
|
29
|
+
caseId: this.args.caseId,
|
30
|
+
task: this.config.inquiry.task,
|
31
|
+
},
|
32
|
+
},
|
33
|
+
"allWorkItems.totalCount"
|
34
|
+
);
|
35
|
+
|
36
|
+
if (
|
37
|
+
incompleteInquiries > 0 &&
|
38
|
+
!(yield confirm(
|
39
|
+
this.intl.t("caluma.distribution.complete-confirm", {
|
40
|
+
count: incompleteInquiries,
|
41
|
+
})
|
42
|
+
))
|
43
|
+
) {
|
44
|
+
return;
|
45
|
+
}
|
46
|
+
|
47
|
+
const completeDistributionWorkItem =
|
48
|
+
this.distribution.controls.value.complete.edges?.[0]?.node.id;
|
49
|
+
|
50
|
+
yield this.apollo.mutate({
|
51
|
+
mutation: completeWorkItemMutation,
|
52
|
+
variables: {
|
53
|
+
workItem: completeDistributionWorkItem,
|
54
|
+
},
|
55
|
+
});
|
56
|
+
|
57
|
+
yield this.distribution.refetch();
|
58
|
+
this.router.transitionTo("index");
|
59
|
+
} catch (e) {
|
60
|
+
this.notification.danger(
|
61
|
+
this.intl.t("caluma.distribution.complete-error")
|
62
|
+
);
|
63
|
+
}
|
64
|
+
}
|
65
|
+
|
66
|
+
@dropTask
|
67
|
+
*sendInquiries() {
|
68
|
+
if (!(yield confirm(this.intl.t("caluma.distribution.send-confirm")))) {
|
69
|
+
return;
|
70
|
+
}
|
71
|
+
|
72
|
+
try {
|
73
|
+
const ids = this.distribution.controls.value.send.edges.map((edge) =>
|
74
|
+
decodeId(edge.node.id)
|
75
|
+
);
|
76
|
+
|
77
|
+
const mutations = ids.map(
|
78
|
+
(id, index) => `
|
79
|
+
sendInquiry${index}: resumeWorkItem(input: { id: "${id}" }) {
|
80
|
+
workItem {
|
81
|
+
id
|
82
|
+
status
|
83
|
+
}
|
84
|
+
}
|
85
|
+
`
|
86
|
+
);
|
87
|
+
|
88
|
+
const mutation = gql`mutation SendInquiries {${mutations.join("\n")}}`;
|
89
|
+
|
90
|
+
yield this.apollo.mutate({ mutation });
|
91
|
+
} catch (e) {
|
92
|
+
this.notification.danger(this.intl.t("caluma.distribution.send-error"));
|
93
|
+
}
|
94
|
+
}
|
95
|
+
}
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import { inject as service } from "@ember/service";
|
2
2
|
import Component from "@glimmer/component";
|
3
3
|
|
4
|
-
export default class
|
4
|
+
export default class CdNavigationItemComponent extends Component {
|
5
5
|
@service router;
|
6
6
|
|
7
7
|
get model() {
|
@@ -14,13 +14,13 @@
|
|
14
14
|
{{#if @inquiries.length}}
|
15
15
|
<ul class="uk-tab uk-tab-left uk-margin-left">
|
16
16
|
{{#each this.inquiries as |inquiry|}}
|
17
|
-
<
|
17
|
+
<CdNavigation::Item @inquiry={{inquiry}} @type={{@type}} />
|
18
18
|
{{/each}}
|
19
19
|
</ul>
|
20
20
|
{{/if}}
|
21
21
|
|
22
22
|
{{#if (eq @type "controlling")}}
|
23
|
-
<
|
23
|
+
<CdNavigation::Controls @caseId={{@caseId}} />
|
24
24
|
{{/if}}
|
25
25
|
{{/if}}
|
26
26
|
</li>
|
@@ -2,7 +2,7 @@ import { action } from "@ember/object";
|
|
2
2
|
import Component from "@glimmer/component";
|
3
3
|
import { tracked } from "@glimmer/tracking";
|
4
4
|
|
5
|
-
export default class
|
5
|
+
export default class CdNavigationSectionComponent extends Component {
|
6
6
|
@tracked expanded = true;
|
7
7
|
|
8
8
|
@action
|
@@ -1,10 +1,11 @@
|
|
1
1
|
{{#if this.showDeadlineIndicator}}
|
2
2
|
<div
|
3
|
-
class="deadline-indicator uk-flex
|
3
|
+
class="deadline-indicator uk-flex uk-flex-middle uk-flex-center uk-margin-small-left uk-text-{{this.deadline.color}}"
|
4
4
|
>
|
5
5
|
{{svg-jar
|
6
6
|
"notifications-outline"
|
7
7
|
height=16
|
8
|
+
width=16
|
8
9
|
title=(format-date this.deadline.value)
|
9
10
|
}}
|
10
11
|
</div>
|
@@ -5,7 +5,7 @@ import config from "@projectcaluma/ember-distribution/config";
|
|
5
5
|
import inquiryDeadline from "@projectcaluma/ember-distribution/utils/inquiry-deadline";
|
6
6
|
import inquiryStatus from "@projectcaluma/ember-distribution/utils/inquiry-status";
|
7
7
|
|
8
|
-
export default class
|
8
|
+
export default class CdNavigationStatusIndicatorComponent extends Component {
|
9
9
|
@service intl;
|
10
10
|
|
11
11
|
@config config;
|
@@ -1,17 +1,14 @@
|
|
1
1
|
<aside>
|
2
2
|
<ul class="uk-tab uk-tab-left uk-margin-remove-bottom">
|
3
|
-
<
|
3
|
+
<CdNavigation::Section
|
4
4
|
@type="controlling"
|
5
5
|
@inquiries={{this.inquiries.controlling}}
|
6
6
|
@caseId={{@caseId}}
|
7
7
|
/>
|
8
|
-
<
|
8
|
+
<CdNavigation::Section
|
9
9
|
@type="addressed"
|
10
10
|
@inquiries={{this.inquiries.addressed}}
|
11
11
|
/>
|
12
|
-
<
|
13
|
-
@type="more"
|
14
|
-
@inquiries={{this.inquiries.more}}
|
15
|
-
/>
|
12
|
+
<CdNavigation::Section @type="more" @inquiries={{this.inquiries.more}} />
|
16
13
|
</ul>
|
17
14
|
</aside>
|
@@ -5,7 +5,7 @@ import { queryManager } from "ember-apollo-client";
|
|
5
5
|
import config from "@projectcaluma/ember-distribution/config";
|
6
6
|
import uniqueByGroups from "@projectcaluma/ember-distribution/utils/unique-by-groups";
|
7
7
|
|
8
|
-
export default class
|
8
|
+
export default class CdNavigationComponent extends Component {
|
9
9
|
@service("-scheduler") scheduler;
|
10
10
|
@service calumaOptions;
|
11
11
|
@service distribution;
|
File without changes
|
@@ -0,0 +1,32 @@
|
|
1
|
+
import { action } from "@ember/object";
|
2
|
+
import Component from "@glimmer/component";
|
3
|
+
import { tracked } from "@glimmer/tracking";
|
4
|
+
|
5
|
+
export default class CdTruncatedComponent extends Component {
|
6
|
+
@tracked expand = false;
|
7
|
+
|
8
|
+
get length() {
|
9
|
+
return parseInt(this.args.length);
|
10
|
+
}
|
11
|
+
|
12
|
+
get displayedText() {
|
13
|
+
if (this.truncate && !this.expand) {
|
14
|
+
// strip input string to the passed length minus 3 to make sure the output
|
15
|
+
// including the 3 dots doesn't exceed the expected length
|
16
|
+
return `${this.args.text.substring(0, this.length - 3).trim()}...`;
|
17
|
+
}
|
18
|
+
|
19
|
+
return this.args.text;
|
20
|
+
}
|
21
|
+
|
22
|
+
get truncate() {
|
23
|
+
return this.args.text.length > this.length;
|
24
|
+
}
|
25
|
+
|
26
|
+
@action
|
27
|
+
toggleExpand(e) {
|
28
|
+
e.preventDefault();
|
29
|
+
|
30
|
+
this.expand = !this.expand;
|
31
|
+
}
|
32
|
+
}
|
package/addon/config.js
CHANGED
@@ -27,7 +27,7 @@ export default function config(target, property) {
|
|
27
27
|
infoQuestion: "inquiry-remark",
|
28
28
|
answer: {
|
29
29
|
statusQuestion: "inquiry-answer-status",
|
30
|
-
|
30
|
+
infoQuestions: ["inquiry-answer-reason"],
|
31
31
|
statusMapping: {
|
32
32
|
"inquiry-answer-status-positive": INQUIRY_STATUS.POSITIVE,
|
33
33
|
"inquiry-answer-status-negative": INQUIRY_STATUS.NEGATIVE,
|
@@ -1,7 +1,10 @@
|
|
1
1
|
import Controller from "@ember/controller";
|
2
|
+
import { inject as service } from "@ember/service";
|
2
3
|
|
3
4
|
import config from "@projectcaluma/ember-distribution/config";
|
4
5
|
|
5
6
|
export default class ApplicationController extends Controller {
|
6
7
|
@config config;
|
8
|
+
|
9
|
+
@service distribution;
|
7
10
|
}
|
package/addon/controllers/new.js
CHANGED
package/addon/engine.js
CHANGED
@@ -11,7 +11,13 @@ export default class DistributionEngine extends Engine {
|
|
11
11
|
Resolver = Resolver;
|
12
12
|
|
13
13
|
dependencies = {
|
14
|
-
services: [
|
14
|
+
services: [
|
15
|
+
"apollo",
|
16
|
+
"notification",
|
17
|
+
"intl",
|
18
|
+
"caluma-options",
|
19
|
+
"store", // this is just in case that a custom form widget uses the store
|
20
|
+
],
|
15
21
|
};
|
16
22
|
}
|
17
23
|
|
@@ -30,6 +30,21 @@ fragment InquiryStatusDocument on Document {
|
|
30
30
|
}
|
31
31
|
}
|
32
32
|
|
33
|
+
fragment InquiryRequest on Document {
|
34
|
+
id
|
35
|
+
...InquiryDeadlineDocument
|
36
|
+
info: answers(question: $infoQuestion) {
|
37
|
+
edges {
|
38
|
+
node {
|
39
|
+
id
|
40
|
+
... on StringAnswer {
|
41
|
+
value
|
42
|
+
}
|
43
|
+
}
|
44
|
+
}
|
45
|
+
}
|
46
|
+
}
|
47
|
+
|
33
48
|
fragment InquiryDialog on WorkItem {
|
34
49
|
id
|
35
50
|
addressedGroups
|
@@ -42,26 +57,20 @@ fragment InquiryDialog on WorkItem {
|
|
42
57
|
slug
|
43
58
|
}
|
44
59
|
document {
|
45
|
-
...
|
46
|
-
info: answers(question: $infoQuestion) {
|
47
|
-
edges {
|
48
|
-
node {
|
49
|
-
id
|
50
|
-
... on StringAnswer {
|
51
|
-
value
|
52
|
-
}
|
53
|
-
}
|
54
|
-
}
|
55
|
-
}
|
60
|
+
...InquiryRequest
|
56
61
|
}
|
57
62
|
childCase {
|
58
63
|
id
|
59
64
|
document {
|
60
65
|
...InquiryStatusDocument
|
61
|
-
info: answers(
|
66
|
+
info: answers(questions: $answerInfoQuestions) {
|
62
67
|
edges {
|
63
68
|
node {
|
64
69
|
id
|
70
|
+
question {
|
71
|
+
id
|
72
|
+
label
|
73
|
+
}
|
65
74
|
... on StringAnswer {
|
66
75
|
value
|
67
76
|
}
|
@@ -0,0 +1,13 @@
|
|
1
|
+
query InquiryIncomplete($caseId: ID!, $task: ID!) {
|
2
|
+
allWorkItems(
|
3
|
+
filter: [
|
4
|
+
{ case: $caseId }
|
5
|
+
{ task: $task }
|
6
|
+
{ status: CANCELED, invert: true }
|
7
|
+
{ status: COMPLETED, invert: true }
|
8
|
+
{ status: SKIPPED, invert: true }
|
9
|
+
]
|
10
|
+
) {
|
11
|
+
totalCount
|
12
|
+
}
|
13
|
+
}
|
@@ -1,19 +1,33 @@
|
|
1
|
-
|
1
|
+
#import InquiryDeadlineDocument, InquiryRequest from '../fragments/inquiry.graphql'
|
2
|
+
|
3
|
+
query InquiryAnswer(
|
4
|
+
$inquiry: ID!
|
5
|
+
$buttonTasks: [String]!
|
6
|
+
$infoQuestion: ID!
|
7
|
+
$deadlineQuestion: ID!
|
8
|
+
) {
|
2
9
|
allWorkItems(filter: [{ id: $inquiry }]) {
|
3
10
|
edges {
|
4
11
|
node {
|
5
12
|
id
|
6
13
|
status
|
7
14
|
addressedGroups
|
15
|
+
controllingGroups
|
16
|
+
createdAt
|
8
17
|
task {
|
9
18
|
id
|
10
19
|
slug
|
11
20
|
}
|
21
|
+
document {
|
22
|
+
...InquiryRequest
|
23
|
+
}
|
12
24
|
childCase {
|
13
25
|
id
|
14
26
|
status
|
15
27
|
document {
|
16
28
|
id
|
29
|
+
modifiedContentAt
|
30
|
+
modifiedContentByUser
|
17
31
|
}
|
18
32
|
workItems(tasks: $buttonTasks, status: READY) {
|
19
33
|
edges {
|
@@ -1,11 +1,11 @@
|
|
1
|
-
#import InquiryDialog, InquiryDeadlineDocument, InquiryStatusDocument from '../fragments/inquiry.graphql'
|
1
|
+
#import InquiryDialog, InquiryDeadlineDocument, InquiryStatusDocument, InquiryRequest from '../fragments/inquiry.graphql'
|
2
2
|
|
3
3
|
query InquiryDialog(
|
4
4
|
$task: ID!
|
5
5
|
$statusQuestion: ID!
|
6
6
|
$deadlineQuestion: ID!
|
7
7
|
$infoQuestion: ID!
|
8
|
-
$
|
8
|
+
$answerInfoQuestions: [ID]!
|
9
9
|
$from: [String]!
|
10
10
|
$to: [String]!
|
11
11
|
$caseId: ID!
|
@@ -45,7 +45,8 @@ query InquiryNavigation(
|
|
45
45
|
{ task: $task }
|
46
46
|
{ controllingGroups: [$currentGroup], invert: true }
|
47
47
|
{ addressedGroups: [$currentGroup], invert: true }
|
48
|
-
{ status:
|
48
|
+
{ status: SUSPENDED, invert: true }
|
49
|
+
{ status: CANCELED, invert: true }
|
49
50
|
]
|
50
51
|
order: [{ attribute: CREATED_AT, direction: DESC }]
|
51
52
|
) {
|
@@ -2,9 +2,11 @@ import { getOwner } from "@ember/application";
|
|
2
2
|
import Service, { inject as service } from "@ember/service";
|
3
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
|
+
import { decodeId } from "@projectcaluma/ember-core/helpers/decode-id";
|
7
8
|
import config from "@projectcaluma/ember-distribution/config";
|
9
|
+
import createInquiryMutation from "@projectcaluma/ember-distribution/gql/mutations/create-inquiry.graphql";
|
8
10
|
import controlWorkItemsQuery from "@projectcaluma/ember-distribution/gql/queries/control-work-items.graphql";
|
9
11
|
import inquiryNavigationQuery from "@projectcaluma/ember-distribution/gql/queries/inquiry-navigation.graphql";
|
10
12
|
|
@@ -12,6 +14,8 @@ export default class DistributionService extends Service {
|
|
12
14
|
@service("-scheduler") scheduler;
|
13
15
|
@service calumaOptions;
|
14
16
|
@service router;
|
17
|
+
@service intl;
|
18
|
+
@service notification;
|
15
19
|
|
16
20
|
@queryManager apollo;
|
17
21
|
|
@@ -21,8 +25,8 @@ export default class DistributionService extends Service {
|
|
21
25
|
return getOwner(this).lookup("route:application").currentModel;
|
22
26
|
}
|
23
27
|
|
24
|
-
controls =
|
25
|
-
navigation =
|
28
|
+
controls = trackedTask(this, this.fetchControls, () => [this.caseId]);
|
29
|
+
navigation = trackedTask(this, this.fetchNavigation, () => [this.caseId]);
|
26
30
|
|
27
31
|
async refetch() {
|
28
32
|
await getObservable(this.controls.value)?.refetch();
|
@@ -79,4 +83,30 @@ export default class DistributionService extends Service {
|
|
79
83
|
|
80
84
|
return response;
|
81
85
|
}
|
86
|
+
|
87
|
+
@dropTask
|
88
|
+
*createInquiry(groups) {
|
89
|
+
try {
|
90
|
+
// get create inquiry work item to complete
|
91
|
+
const createId = decodeId(this.controls.value?.create.edges[0].node.id);
|
92
|
+
|
93
|
+
// create new inquiries
|
94
|
+
yield this.apollo.mutate({
|
95
|
+
mutation: createInquiryMutation,
|
96
|
+
variables: {
|
97
|
+
id: createId,
|
98
|
+
context: JSON.stringify({
|
99
|
+
addressed_groups: groups.map(String),
|
100
|
+
}),
|
101
|
+
},
|
102
|
+
});
|
103
|
+
|
104
|
+
// refetch navigation and controls data
|
105
|
+
yield this.refetch();
|
106
|
+
} catch (e) {
|
107
|
+
this.notification.danger(
|
108
|
+
this.intl.t("caluma.distribution.new.error", { count: groups.length })
|
109
|
+
);
|
110
|
+
}
|
111
|
+
}
|
82
112
|
}
|
@@ -1,8 +1,18 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
1
|
+
{{#if
|
2
|
+
(or
|
3
|
+
this.distribution.navigation.isRunning this.distribution.controls.isRunning
|
4
|
+
)
|
5
|
+
}}
|
6
|
+
<div class="uk-text-center">
|
7
|
+
<UkSpinner @ratio={{2}} />
|
4
8
|
</div>
|
5
|
-
|
6
|
-
|
9
|
+
{{else}}
|
10
|
+
<div uk-grid class={{if this.config.ui.stack "uk-grid-small"}}>
|
11
|
+
<div class={{if this.config.ui.stack "uk-width-1-1" "uk-width-1-3"}}>
|
12
|
+
<CdNavigation @caseId={{@model}} />
|
13
|
+
</div>
|
14
|
+
<div class={{if this.config.ui.stack "uk-width-1-1" "uk-width-2-3"}}>
|
15
|
+
{{outlet}}
|
16
|
+
</div>
|
7
17
|
</div>
|
8
|
-
|
18
|
+
{{/if}}
|
@@ -1 +1 @@
|
|
1
|
-
<
|
1
|
+
<CdInquiryAnswerForm @inquiry={{@model}} />
|
@@ -1 +1 @@
|
|
1
|
-
<
|
1
|
+
<CdInquiryEditForm @inquiry={{@model}} />
|
package/addon/templates/new.hbs
CHANGED
@@ -1 +1 @@
|
|
1
|
-
<
|
1
|
+
<CdNotfound />
|
@@ -21,12 +21,10 @@ function decorator(
|
|
21
21
|
const value = inquiry.document?.deadline.edges[0]?.node.value;
|
22
22
|
const isAnswered = inquiry.status === "COMPLETED";
|
23
23
|
|
24
|
-
const
|
25
|
-
const now = DateTime.now().startOf("day");
|
24
|
+
const { days: diff } = DateTime.fromISO(value).diffNow("days").toObject();
|
26
25
|
|
27
|
-
const isOverdue = !isAnswered &&
|
28
|
-
const isWarning =
|
29
|
-
!isAnswered && now.plus({ days: this.config.warningPeriod }) > deadline;
|
26
|
+
const isOverdue = !isAnswered && diff <= 0;
|
27
|
+
const isWarning = !isAnswered && diff <= this.config.warningPeriod;
|
30
28
|
|
31
29
|
return {
|
32
30
|
value,
|
@@ -0,0 +1 @@
|
|
1
|
+
export { default } from "@projectcaluma/ember-distribution/components/cd-document-header";
|
@@ -1 +1 @@
|
|
1
|
-
export { default } from "@projectcaluma/ember-distribution/components/
|
1
|
+
export { default } from "@projectcaluma/ember-distribution/components/cd-icon-button";
|
@@ -1 +1 @@
|
|
1
|
-
export { default } from "@projectcaluma/ember-distribution/components/inquiry-
|
1
|
+
export { default } from "@projectcaluma/ember-distribution/components/cd-inquiry-answer-form";
|
@@ -1 +1 @@
|
|
1
|
-
export { default } from "@projectcaluma/ember-distribution/components/inquiry-dialog/inquiry-deadline";
|
1
|
+
export { default } from "@projectcaluma/ember-distribution/components/cd-inquiry-dialog/inquiry-deadline";
|
@@ -1 +1 @@
|
|
1
|
-
export { default } from "@projectcaluma/ember-distribution/components/inquiry-dialog/inquiry-divider";
|
1
|
+
export { default } from "@projectcaluma/ember-distribution/components/cd-inquiry-dialog/inquiry-divider";
|
@@ -1 +1 @@
|
|
1
|
-
export { default } from "@projectcaluma/ember-distribution/components/inquiry-dialog/inquiry-part";
|
1
|
+
export { default } from "@projectcaluma/ember-distribution/components/cd-inquiry-dialog/inquiry-part";
|
@@ -1 +1 @@
|
|
1
|
-
export { default } from "@projectcaluma/ember-distribution/components/
|
1
|
+
export { default } from "@projectcaluma/ember-distribution/components/cd-inquiry-dialog/inquiry";
|
@@ -1 +1 @@
|
|
1
|
-
export { default } from "@projectcaluma/ember-distribution/components/inquiry-
|
1
|
+
export { default } from "@projectcaluma/ember-distribution/components/cd-inquiry-dialog";
|
@@ -0,0 +1 @@
|
|
1
|
+
export { default } from "@projectcaluma/ember-distribution/components/cd-inquiry-edit-form";
|
@@ -1 +1 @@
|
|
1
|
-
export { default } from "@projectcaluma/ember-distribution/components/inquiry-
|
1
|
+
export { default } from "@projectcaluma/ember-distribution/components/cd-inquiry-new-form";
|
@@ -0,0 +1 @@
|
|
1
|
+
export { default } from "@projectcaluma/ember-distribution/components/cd-navigation/controls";
|