@projectcaluma/ember-distribution 11.0.0-beta.30 → 11.0.0-beta.32
Sign up to get free protection for your applications and to get access to all the features.
- package/addon/abilities/inquiry.js +18 -2
- package/addon/components/cd-document-header.hbs +3 -12
- package/addon/components/cd-inquiry-answer-form.hbs +136 -76
- package/addon/components/cd-inquiry-answer-form.js +20 -2
- package/addon/components/cd-inquiry-dialog/inquiry-deadline.hbs +5 -10
- package/addon/components/cd-inquiry-dialog/inquiry-deadline.js +14 -0
- package/addon/components/cd-inquiry-dialog/inquiry-part.hbs +118 -89
- package/addon/components/cd-inquiry-dialog.js +11 -15
- package/addon/components/cd-inquiry-edit-form.hbs +0 -3
- package/addon/components/cd-inquiry-edit-form.js +2 -2
- package/addon/components/cd-inquiry-new-form/bulk-edit.js +9 -6
- package/addon/components/cd-navigation/section.hbs +1 -1
- package/addon/components/cd-navigation/section.js +5 -13
- package/addon/components/cd-navigation.hbs +3 -10
- package/addon/config.js +17 -0
- package/addon/gql/fragments/inquiry-answer.graphql +57 -0
- package/addon/gql/fragments/inquiry-request.graphql +26 -0
- package/addon/gql/mutations/complete-inquiry-work-item.graphql +24 -13
- package/addon/gql/mutations/reopen-inquiry.graphql +3 -13
- package/addon/gql/queries/{control-work-items.graphql → controls.graphql} +1 -1
- package/addon/gql/queries/incomplete-inquiries.graphql +1 -1
- package/addon/gql/queries/inquiry-answer.graphql +5 -1
- package/addon/gql/queries/inquiry-dialog.graphql +31 -2
- package/addon/gql/queries/inquiry-form.graphql +1 -1
- package/addon/gql/queries/{inquiry-navigation.graphql → navigation.graphql} +24 -6
- package/addon/routes/application.js +7 -0
- package/addon/routes/index.js +15 -28
- package/addon/routes/inquiry/index.js +1 -4
- package/addon/routes/new.js +1 -5
- package/addon/services/distribution.js +71 -9
- package/addon/templates/application.hbs +1 -1
- package/addon/templates/inquiry/index.hbs +1 -5
- package/addon/templates/new.hbs +0 -1
- package/addon/utils/inquiry-deadline.js +3 -1
- package/app/styles/_answer-form.scss +4 -0
- package/package.json +10 -10
- package/translations/de.yaml +10 -1
- package/translations/en.yaml +11 -2
- package/translations/fr.yaml +10 -1
- package/addon/components/cd-navigation.js +0 -53
- package/addon/gql/fragments/inquiry.graphql +0 -117
- package/addon/modifiers/pikaday.js +0 -2
@@ -11,11 +11,8 @@
|
|
11
11
|
(eq this.inquiry.status "SUSPENDED")
|
12
12
|
(t "caluma.distribution.status.draft")
|
13
13
|
}}
|
14
|
-
@modifiedAt={{this.inquiry.document.modifiedContentAt}}
|
15
|
-
@modifiedBy={{this.inquiry.document.modifiedContentByUser}}
|
16
14
|
/>
|
17
15
|
|
18
|
-
<hr />
|
19
16
|
{{#if
|
20
17
|
(and
|
21
18
|
(cannot "send inquiry" this.inquiry)
|
@@ -24,11 +24,11 @@ export default class CdInquiryEditFormComponent extends Component {
|
|
24
24
|
}
|
25
25
|
|
26
26
|
@dropTask
|
27
|
-
*fetchInquiry() {
|
27
|
+
*fetchInquiry(inquiry) {
|
28
28
|
return yield this.apollo.watchQuery(
|
29
29
|
{
|
30
30
|
query: inquiryEditQuery,
|
31
|
-
variables: { inquiry
|
31
|
+
variables: { inquiry },
|
32
32
|
},
|
33
33
|
"allWorkItems.edges"
|
34
34
|
);
|
@@ -97,17 +97,20 @@ export default class CdInquiryNewFormBulkEditComponent extends Component {
|
|
97
97
|
answers: this.answers,
|
98
98
|
});
|
99
99
|
|
100
|
-
const
|
101
|
-
|
100
|
+
const firstCreated = this.distribution.navigation.value.controlling.edges
|
101
|
+
.map((edge) => edge.node)
|
102
|
+
.find((node) =>
|
103
|
+
node.addressedGroups.includes(String(this.args.selectedGroups[0]))
|
104
|
+
);
|
102
105
|
|
103
|
-
// transition to
|
106
|
+
// transition to inquiry addressed to the first selected group
|
104
107
|
this.router.transitionTo(
|
105
108
|
"inquiry.detail.index",
|
106
109
|
{
|
107
|
-
from:
|
108
|
-
to:
|
110
|
+
from: firstCreated.controllingGroups[0],
|
111
|
+
to: firstCreated.addressedGroups[0],
|
109
112
|
},
|
110
|
-
decodeId(
|
113
|
+
decodeId(firstCreated.id)
|
111
114
|
);
|
112
115
|
}
|
113
116
|
}
|
@@ -4,6 +4,7 @@ import Component from "@glimmer/component";
|
|
4
4
|
import { tracked } from "@glimmer/tracking";
|
5
5
|
|
6
6
|
export default class CdNavigationSectionComponent extends Component {
|
7
|
+
@service distribution;
|
7
8
|
@service router;
|
8
9
|
|
9
10
|
@tracked expanded = true;
|
@@ -19,23 +20,14 @@ export default class CdNavigationSectionComponent extends Component {
|
|
19
20
|
);
|
20
21
|
}
|
21
22
|
|
23
|
+
get inquiries() {
|
24
|
+
return this.distribution.inquiries?.[this.args.type] ?? [];
|
25
|
+
}
|
26
|
+
|
22
27
|
@action
|
23
28
|
toggle(e) {
|
24
29
|
e.preventDefault();
|
25
30
|
|
26
31
|
this.expanded = !this.expanded;
|
27
32
|
}
|
28
|
-
|
29
|
-
get inquiries() {
|
30
|
-
const sortProperty =
|
31
|
-
this.args.type === "addressed"
|
32
|
-
? "controllingGroupName"
|
33
|
-
: "addressedGroupName";
|
34
|
-
|
35
|
-
return (
|
36
|
-
this.args.inquiries?.sort((a, b) =>
|
37
|
-
a[sortProperty].localeCompare(b[sortProperty])
|
38
|
-
) ?? []
|
39
|
-
);
|
40
|
-
}
|
41
33
|
}
|
@@ -1,13 +1,6 @@
|
|
1
1
|
<ul class="uk-tab uk-tab-left uk-margin-remove-bottom uk-width-auto">
|
2
2
|
<CdNavigation::Controls />
|
3
|
-
|
4
|
-
<CdNavigation::Section
|
5
|
-
|
6
|
-
@inquiries={{this.inquiries.addressed}}
|
7
|
-
/>
|
8
|
-
<CdNavigation::Section
|
9
|
-
@type="controlling"
|
10
|
-
@inquiries={{this.inquiries.controlling}}
|
11
|
-
/>
|
12
|
-
<CdNavigation::Section @type="more" @inquiries={{this.inquiries.more}} />
|
3
|
+
<CdNavigation::Section @type="addressed" />
|
4
|
+
<CdNavigation::Section @type="controlling" />
|
5
|
+
<CdNavigation::Section @type="more" />
|
13
6
|
</ul>
|
package/addon/config.js
CHANGED
@@ -57,6 +57,23 @@ export default function config(target, property) {
|
|
57
57
|
status: "caluma.distribution.answer.buttons.adjust.status",
|
58
58
|
},
|
59
59
|
},
|
60
|
+
details: (inquiry) => [
|
61
|
+
{
|
62
|
+
label: "caluma.distribution.inquiry.created-at",
|
63
|
+
value: inquiry.createdAt,
|
64
|
+
type: "date",
|
65
|
+
},
|
66
|
+
{
|
67
|
+
label: "caluma.distribution.inquiry.assigned-user",
|
68
|
+
value: inquiry.assignedUsers,
|
69
|
+
type: "user",
|
70
|
+
},
|
71
|
+
{
|
72
|
+
label: "caluma.distribution.inquiry.closed-at",
|
73
|
+
value: inquiry.closedAt,
|
74
|
+
type: "date",
|
75
|
+
},
|
76
|
+
],
|
60
77
|
},
|
61
78
|
},
|
62
79
|
new: {
|
@@ -0,0 +1,57 @@
|
|
1
|
+
fragment InquiryAnswerStatus on Document {
|
2
|
+
status: answers(filter: [{ question: $statusQuestion }]) {
|
3
|
+
edges {
|
4
|
+
node {
|
5
|
+
id
|
6
|
+
... on StringAnswer {
|
7
|
+
value
|
8
|
+
selectedOption {
|
9
|
+
slug
|
10
|
+
label
|
11
|
+
}
|
12
|
+
}
|
13
|
+
}
|
14
|
+
}
|
15
|
+
}
|
16
|
+
}
|
17
|
+
|
18
|
+
fragment InquiryAnswerButtons on Case {
|
19
|
+
workItems(
|
20
|
+
filter: [
|
21
|
+
{ tasks: $buttonTasks }
|
22
|
+
{ status: CANCELED, invert: true }
|
23
|
+
{ status: SKIPPED, invert: true }
|
24
|
+
]
|
25
|
+
) {
|
26
|
+
edges {
|
27
|
+
node {
|
28
|
+
id
|
29
|
+
status
|
30
|
+
closedAt
|
31
|
+
task {
|
32
|
+
id
|
33
|
+
slug
|
34
|
+
}
|
35
|
+
}
|
36
|
+
}
|
37
|
+
}
|
38
|
+
}
|
39
|
+
|
40
|
+
fragment InquiryAnswer on Document {
|
41
|
+
...InquiryAnswerStatus
|
42
|
+
info: answers(filter: [{ questions: $answerInfoQuestions }]) {
|
43
|
+
edges {
|
44
|
+
node {
|
45
|
+
id
|
46
|
+
question {
|
47
|
+
id
|
48
|
+
label
|
49
|
+
slug
|
50
|
+
}
|
51
|
+
... on StringAnswer {
|
52
|
+
value
|
53
|
+
}
|
54
|
+
}
|
55
|
+
}
|
56
|
+
}
|
57
|
+
}
|
@@ -0,0 +1,26 @@
|
|
1
|
+
fragment InquiryRequestDeadline on Document {
|
2
|
+
deadline: answers(filter: [{ question: $deadlineQuestion }]) {
|
3
|
+
edges {
|
4
|
+
node {
|
5
|
+
id
|
6
|
+
... on DateAnswer {
|
7
|
+
value
|
8
|
+
}
|
9
|
+
}
|
10
|
+
}
|
11
|
+
}
|
12
|
+
}
|
13
|
+
|
14
|
+
fragment InquiryRequest on Document {
|
15
|
+
...InquiryRequestDeadline
|
16
|
+
info: answers(filter: [{ question: $infoQuestion }]) {
|
17
|
+
edges {
|
18
|
+
node {
|
19
|
+
id
|
20
|
+
... on StringAnswer {
|
21
|
+
value
|
22
|
+
}
|
23
|
+
}
|
24
|
+
}
|
25
|
+
}
|
26
|
+
}
|
@@ -1,9 +1,12 @@
|
|
1
|
-
#import
|
1
|
+
# import InquiryAnswer, InquiryAnswerButtons, InquiryAnswerStatus from '../fragments/inquiry-answer.graphql'
|
2
2
|
|
3
3
|
mutation CompleteInquiryWorkItem(
|
4
4
|
$workItem: ID!
|
5
5
|
$statusQuestion: ID!
|
6
6
|
$buttonTasks: [String]!
|
7
|
+
$checkTask: ID!
|
8
|
+
$currentGroup: String!
|
9
|
+
$answerInfoQuestions: [ID]!
|
7
10
|
) {
|
8
11
|
completeWorkItem(input: { id: $workItem }) {
|
9
12
|
workItem {
|
@@ -13,23 +16,31 @@ mutation CompleteInquiryWorkItem(
|
|
13
16
|
id
|
14
17
|
document {
|
15
18
|
id
|
16
|
-
...
|
17
|
-
}
|
18
|
-
workItems(filter: [{ tasks: $buttonTasks }, { status: READY }]) {
|
19
|
-
edges {
|
20
|
-
node {
|
21
|
-
id
|
22
|
-
task {
|
23
|
-
id
|
24
|
-
slug
|
25
|
-
}
|
26
|
-
}
|
27
|
-
}
|
19
|
+
...InquiryAnswer
|
28
20
|
}
|
21
|
+
...InquiryAnswerButtons
|
29
22
|
parentWorkItem {
|
30
23
|
id
|
31
24
|
status
|
32
25
|
isRedoable
|
26
|
+
# This is needed to remove the check inquiries button if that work
|
27
|
+
# item is closed automatically after completing an inquiry.
|
28
|
+
case {
|
29
|
+
id
|
30
|
+
workItems(
|
31
|
+
filter: [
|
32
|
+
{ task: $checkTask }
|
33
|
+
{ addressedGroups: [$currentGroup] }
|
34
|
+
]
|
35
|
+
) {
|
36
|
+
edges {
|
37
|
+
node {
|
38
|
+
id
|
39
|
+
status
|
40
|
+
}
|
41
|
+
}
|
42
|
+
}
|
43
|
+
}
|
33
44
|
}
|
34
45
|
}
|
35
46
|
}
|
@@ -1,4 +1,4 @@
|
|
1
|
-
#import
|
1
|
+
# import InquiryAnswerButtons, InquiryAnswerStatus from '../fragments/inquiry-answer.graphql'
|
2
2
|
|
3
3
|
mutation ReopenInquiry(
|
4
4
|
$workItem: ID!
|
@@ -14,19 +14,9 @@ mutation ReopenInquiry(
|
|
14
14
|
id
|
15
15
|
document {
|
16
16
|
id
|
17
|
-
...
|
18
|
-
}
|
19
|
-
workItems(filter: [{ tasks: $buttonTasks }, { status: READY }]) {
|
20
|
-
edges {
|
21
|
-
node {
|
22
|
-
id
|
23
|
-
task {
|
24
|
-
id
|
25
|
-
slug
|
26
|
-
}
|
27
|
-
}
|
28
|
-
}
|
17
|
+
...InquiryAnswerStatus
|
29
18
|
}
|
19
|
+
...InquiryAnswerButtons
|
30
20
|
}
|
31
21
|
}
|
32
22
|
}
|
@@ -1,4 +1,5 @@
|
|
1
|
-
#import InquiryAnswerButtons
|
1
|
+
# import InquiryAnswerButtons from '../fragments/inquiry-answer.graphql'
|
2
|
+
# import InquiryRequest, InquiryRequestDeadline from '../fragments/inquiry-request.graphql'
|
2
3
|
|
3
4
|
query InquiryAnswer(
|
4
5
|
$inquiry: ID!
|
@@ -13,6 +14,8 @@ query InquiryAnswer(
|
|
13
14
|
status
|
14
15
|
addressedGroups
|
15
16
|
controllingGroups
|
17
|
+
assignedUsers
|
18
|
+
closedByUser
|
16
19
|
createdAt
|
17
20
|
closedAt
|
18
21
|
task {
|
@@ -20,6 +23,7 @@ query InquiryAnswer(
|
|
20
23
|
slug
|
21
24
|
}
|
22
25
|
document {
|
26
|
+
id
|
23
27
|
...InquiryRequest
|
24
28
|
}
|
25
29
|
childCase {
|
@@ -1,4 +1,33 @@
|
|
1
|
-
#import
|
1
|
+
# import InquiryAnswer, InquiryAnswerButtons, InquiryAnswerStatus from '../fragments/inquiry-answer.graphql'
|
2
|
+
# import InquiryRequest, InquiryRequestDeadline from '../fragments/inquiry-request.graphql'
|
3
|
+
|
4
|
+
fragment DialogInquiry on WorkItem {
|
5
|
+
id
|
6
|
+
addressedGroups
|
7
|
+
controllingGroups
|
8
|
+
assignedUsers
|
9
|
+
createdAt
|
10
|
+
closedAt
|
11
|
+
status
|
12
|
+
isRedoable
|
13
|
+
task {
|
14
|
+
id
|
15
|
+
slug
|
16
|
+
}
|
17
|
+
meta
|
18
|
+
document {
|
19
|
+
id
|
20
|
+
...InquiryRequest
|
21
|
+
}
|
22
|
+
childCase {
|
23
|
+
id
|
24
|
+
...InquiryAnswerButtons
|
25
|
+
document {
|
26
|
+
id
|
27
|
+
...InquiryAnswer
|
28
|
+
}
|
29
|
+
}
|
30
|
+
}
|
2
31
|
|
3
32
|
query InquiryDialog(
|
4
33
|
$task: ID!
|
@@ -22,7 +51,7 @@ query InquiryDialog(
|
|
22
51
|
) {
|
23
52
|
edges {
|
24
53
|
node {
|
25
|
-
...
|
54
|
+
...DialogInquiry
|
26
55
|
}
|
27
56
|
}
|
28
57
|
}
|
@@ -1,4 +1,4 @@
|
|
1
|
-
#import FieldQuestion, FieldTableQuestion, SimpleQuestion from '@projectcaluma/ember-form/gql/fragments/field.graphql'
|
1
|
+
# import FieldQuestion, FieldTableQuestion, SimpleQuestion from '@projectcaluma/ember-form/gql/fragments/field.graphql'
|
2
2
|
|
3
3
|
query InquiryForm($inquiryTask: String!) {
|
4
4
|
allTasks(filter: [{ slug: $inquiryTask }], first: 1) {
|
@@ -1,12 +1,30 @@
|
|
1
|
-
#import
|
1
|
+
# import InquiryAnswerStatus from '../fragments/inquiry-answer.graphql'
|
2
|
+
# import InquiryRequestDeadline from '../fragments/inquiry-request.graphql'
|
2
3
|
|
3
|
-
|
4
|
+
fragment NavigationInquiry on WorkItem {
|
5
|
+
id
|
6
|
+
status
|
7
|
+
addressedGroups
|
8
|
+
controllingGroups
|
9
|
+
document {
|
10
|
+
id
|
11
|
+
...InquiryRequestDeadline
|
12
|
+
}
|
13
|
+
childCase {
|
14
|
+
id
|
15
|
+
document {
|
16
|
+
id
|
17
|
+
...InquiryAnswerStatus
|
18
|
+
}
|
19
|
+
}
|
20
|
+
}
|
21
|
+
|
22
|
+
query Navigation(
|
4
23
|
$task: ID!
|
5
24
|
$statusQuestion: ID
|
6
25
|
$deadlineQuestion: ID
|
7
26
|
$currentGroup: String!
|
8
27
|
$caseId: ID!
|
9
|
-
$includeNavigationData: Boolean!
|
10
28
|
) {
|
11
29
|
controlling: allWorkItems(
|
12
30
|
filter: [
|
@@ -19,7 +37,7 @@ query InquiryNavigation(
|
|
19
37
|
) {
|
20
38
|
edges {
|
21
39
|
node {
|
22
|
-
...
|
40
|
+
...NavigationInquiry
|
23
41
|
}
|
24
42
|
}
|
25
43
|
}
|
@@ -35,7 +53,7 @@ query InquiryNavigation(
|
|
35
53
|
) {
|
36
54
|
edges {
|
37
55
|
node {
|
38
|
-
...
|
56
|
+
...NavigationInquiry
|
39
57
|
}
|
40
58
|
}
|
41
59
|
}
|
@@ -52,7 +70,7 @@ query InquiryNavigation(
|
|
52
70
|
) {
|
53
71
|
edges {
|
54
72
|
node {
|
55
|
-
...
|
73
|
+
...NavigationInquiry
|
56
74
|
}
|
57
75
|
}
|
58
76
|
}
|
@@ -1,7 +1,14 @@
|
|
1
1
|
import Route from "@ember/routing/route";
|
2
|
+
import { inject as service } from "@ember/service";
|
2
3
|
|
3
4
|
export default class ApplicationRoute extends Route {
|
5
|
+
@service distribution;
|
6
|
+
|
4
7
|
model(params) {
|
5
8
|
return params.case;
|
6
9
|
}
|
10
|
+
|
11
|
+
afterModel(model) {
|
12
|
+
this.distribution.caseId = model;
|
13
|
+
}
|
7
14
|
}
|
package/addon/routes/index.js
CHANGED
@@ -1,41 +1,28 @@
|
|
1
1
|
import Route from "@ember/routing/route";
|
2
2
|
import { inject as service } from "@ember/service";
|
3
|
-
import { queryManager } from "ember-apollo-client";
|
4
|
-
|
5
|
-
import config from "@projectcaluma/ember-distribution/config";
|
6
|
-
import inquiryNavigationQuery from "@projectcaluma/ember-distribution/gql/queries/inquiry-navigation.graphql";
|
7
|
-
import uniqueByGroups from "@projectcaluma/ember-distribution/utils/unique-by-groups";
|
8
3
|
|
9
4
|
export default class IndexRoute extends Route {
|
5
|
+
@service("-scheduler") scheduler;
|
6
|
+
@service distribution;
|
10
7
|
@service router;
|
11
|
-
@service calumaOptions;
|
12
8
|
|
13
|
-
|
9
|
+
async redirect() {
|
10
|
+
// trigger resource
|
11
|
+
this.distribution.navigation.value;
|
14
12
|
|
15
|
-
|
13
|
+
// wait for navigation request and group resolver
|
14
|
+
await this.distribution.fetchNavigation.last;
|
15
|
+
await this.scheduler.resolveGroup.last;
|
16
16
|
|
17
|
-
|
18
|
-
const response = await this.apollo.query({
|
19
|
-
query: inquiryNavigationQuery,
|
20
|
-
variables: {
|
21
|
-
caseId: model,
|
22
|
-
task: this.config.inquiry.task,
|
23
|
-
currentGroup: String(this.calumaOptions.currentGroupId),
|
24
|
-
includeNavigationData: false,
|
25
|
-
},
|
26
|
-
});
|
17
|
+
const inquiries = this.distribution.inquiries;
|
27
18
|
|
28
|
-
const
|
29
|
-
return uniqueByGroups(objects.edges.map((edge) => edge.node)).map(
|
30
|
-
(inquiry) => ({
|
31
|
-
from: inquiry.controllingGroups[0],
|
32
|
-
to: inquiry.addressedGroups[0],
|
33
|
-
})
|
34
|
-
);
|
35
|
-
}, {});
|
19
|
+
const firstInquiry = inquiries.addressed[0] ?? inquiries.controlling[0];
|
36
20
|
|
37
|
-
if (
|
38
|
-
return this.router.replaceWith("inquiry",
|
21
|
+
if (firstInquiry) {
|
22
|
+
return this.router.replaceWith("inquiry", {
|
23
|
+
from: firstInquiry.controllingGroups[0],
|
24
|
+
to: firstInquiry.addressedGroups[0],
|
25
|
+
});
|
39
26
|
}
|
40
27
|
}
|
41
28
|
}
|