@projectcaluma/ember-distribution 11.0.0-beta.30 → 11.0.0-beta.31

Sign up to get free protection for your applications and to get access to all the features.
Files changed (41) hide show
  1. package/addon/components/cd-document-header.hbs +3 -12
  2. package/addon/components/cd-inquiry-answer-form.hbs +136 -76
  3. package/addon/components/cd-inquiry-answer-form.js +20 -2
  4. package/addon/components/cd-inquiry-dialog/inquiry-deadline.hbs +5 -10
  5. package/addon/components/cd-inquiry-dialog/inquiry-deadline.js +14 -0
  6. package/addon/components/cd-inquiry-dialog/inquiry-part.hbs +116 -89
  7. package/addon/components/cd-inquiry-dialog.js +11 -15
  8. package/addon/components/cd-inquiry-edit-form.hbs +0 -3
  9. package/addon/components/cd-inquiry-edit-form.js +2 -2
  10. package/addon/components/cd-inquiry-new-form/bulk-edit.js +9 -6
  11. package/addon/components/cd-navigation/section.hbs +1 -1
  12. package/addon/components/cd-navigation/section.js +5 -13
  13. package/addon/components/cd-navigation.hbs +3 -10
  14. package/addon/config.js +17 -0
  15. package/addon/gql/fragments/inquiry-answer.graphql +57 -0
  16. package/addon/gql/fragments/inquiry-request.graphql +26 -0
  17. package/addon/gql/mutations/complete-inquiry-work-item.graphql +24 -13
  18. package/addon/gql/mutations/reopen-inquiry.graphql +3 -13
  19. package/addon/gql/queries/{control-work-items.graphql → controls.graphql} +1 -1
  20. package/addon/gql/queries/incomplete-inquiries.graphql +1 -1
  21. package/addon/gql/queries/inquiry-answer.graphql +5 -1
  22. package/addon/gql/queries/inquiry-dialog.graphql +31 -2
  23. package/addon/gql/queries/inquiry-form.graphql +1 -1
  24. package/addon/gql/queries/{inquiry-navigation.graphql → navigation.graphql} +24 -6
  25. package/addon/routes/application.js +7 -0
  26. package/addon/routes/index.js +15 -28
  27. package/addon/routes/inquiry/index.js +1 -4
  28. package/addon/routes/new.js +1 -5
  29. package/addon/services/distribution.js +71 -9
  30. package/addon/templates/application.hbs +1 -1
  31. package/addon/templates/inquiry/index.hbs +1 -5
  32. package/addon/templates/new.hbs +0 -1
  33. package/addon/utils/inquiry-deadline.js +3 -1
  34. package/app/styles/_answer-form.scss +4 -0
  35. package/package.json +10 -10
  36. package/translations/de.yaml +10 -1
  37. package/translations/en.yaml +11 -2
  38. package/translations/fr.yaml +10 -1
  39. package/addon/components/cd-navigation.js +0 -53
  40. package/addon/gql/fragments/inquiry.graphql +0 -117
  41. package/addon/modifiers/pikaday.js +0 -2
@@ -97,17 +97,20 @@ export default class CdInquiryNewFormBulkEditComponent extends Component {
97
97
  answers: this.answers,
98
98
  });
99
99
 
100
- const lastControlling =
101
- this.distribution.navigation.value.controlling.edges[0].node;
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 last added inquiry
106
+ // transition to inquiry addressed to the first selected group
104
107
  this.router.transitionTo(
105
108
  "inquiry.detail.index",
106
109
  {
107
- from: lastControlling.controllingGroups[0],
108
- to: lastControlling.addressedGroups[0],
110
+ from: firstCreated.controllingGroups[0],
111
+ to: firstCreated.addressedGroups[0],
109
112
  },
110
- decodeId(lastControlling.id)
113
+ decodeId(firstCreated.id)
111
114
  );
112
115
  }
113
116
  }
@@ -1,4 +1,4 @@
1
- {{#if @inquiries.length}}
1
+ {{#if this.inquiries.length}}
2
2
  <li class="uk-margin-small uk-width-auto {{if this.isActive 'uk-active'}}">
3
3
  <a href="" {{on "click" this.toggle}}>
4
4
  <span class="uk-width-expand">
@@ -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
- @type="addressed"
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 InquiryStatusDocument from '../fragments/inquiry.graphql'
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
- ...InquiryStatusDocument
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 InquiryStatusDocument from '../fragments/inquiry.graphql'
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
- ...InquiryStatusDocument
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,4 @@
1
- query ControlWorkItems(
1
+ query Controls(
2
2
  $createTask: ID!
3
3
  $completeTask: ID!
4
4
  $inquiryTask: ID!
@@ -1,4 +1,4 @@
1
- query InquiryIncomplete($caseId: ID!, $task: ID!) {
1
+ query IncompleteInquiries($caseId: ID!, $task: ID!) {
2
2
  allWorkItems(
3
3
  filter: [
4
4
  { case: $caseId }
@@ -1,4 +1,5 @@
1
- #import InquiryAnswerButtons, InquiryDeadlineDocument, InquiryRequest from '../fragments/inquiry.graphql'
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 InquiryAnswerButtons, InquiryDialog, InquiryDeadlineDocument, InquiryStatusDocument, InquiryRequest from '../fragments/inquiry.graphql'
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
- ...InquiryDialog
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 Inquiry, InquiryDeadlineDocument, InquiryStatusDocument from '../fragments/inquiry.graphql'
1
+ # import InquiryAnswerStatus from '../fragments/inquiry-answer.graphql'
2
+ # import InquiryRequestDeadline from '../fragments/inquiry-request.graphql'
2
3
 
3
- query InquiryNavigation(
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
- ...Inquiry
40
+ ...NavigationInquiry
23
41
  }
24
42
  }
25
43
  }
@@ -35,7 +53,7 @@ query InquiryNavigation(
35
53
  ) {
36
54
  edges {
37
55
  node {
38
- ...Inquiry
56
+ ...NavigationInquiry
39
57
  }
40
58
  }
41
59
  }
@@ -52,7 +70,7 @@ query InquiryNavigation(
52
70
  ) {
53
71
  edges {
54
72
  node {
55
- ...Inquiry
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
  }
@@ -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
- @config config;
9
+ async redirect() {
10
+ // trigger resource
11
+ this.distribution.navigation.value;
14
12
 
15
- @queryManager apollo;
13
+ // wait for navigation request and group resolver
14
+ await this.distribution.fetchNavigation.last;
15
+ await this.scheduler.resolveGroup.last;
16
16
 
17
- async redirect(model) {
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 models = Object.entries(response).flatMap(([, objects]) => {
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 (models.length) {
38
- return this.router.replaceWith("inquiry", models[0]);
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
  }
@@ -2,9 +2,6 @@ import Route from "@ember/routing/route";
2
2
 
3
3
  export default class InquiryIndexRoute extends Route {
4
4
  model() {
5
- return {
6
- ...this.modelFor("inquiry"),
7
- case: this.modelFor("application"),
8
- };
5
+ return this.modelFor("inquiry");
9
6
  }
10
7
  }
@@ -1,7 +1,3 @@
1
1
  import Route from "@ember/routing/route";
2
2
 
3
- export default class NewRoute extends Route {
4
- model() {
5
- return this.modelFor("application");
6
- }
7
- }
3
+ export default class NewRoute extends Route {}
@@ -1,14 +1,17 @@
1
- import { getOwner } from "@ember/application";
2
1
  import Service, { inject as service } from "@ember/service";
2
+ import { tracked } from "@glimmer/tracking";
3
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
+ import { cached } from "tracked-toolbox";
6
7
 
7
8
  import { decodeId } from "@projectcaluma/ember-core/helpers/decode-id";
8
9
  import config from "@projectcaluma/ember-distribution/config";
9
10
  import createInquiryMutation from "@projectcaluma/ember-distribution/gql/mutations/create-inquiry.graphql";
10
- import controlWorkItemsQuery from "@projectcaluma/ember-distribution/gql/queries/control-work-items.graphql";
11
- import inquiryNavigationQuery from "@projectcaluma/ember-distribution/gql/queries/inquiry-navigation.graphql";
11
+ import controlsQuery from "@projectcaluma/ember-distribution/gql/queries/controls.graphql";
12
+ import inquiryDialogQuery from "@projectcaluma/ember-distribution/gql/queries/inquiry-dialog.graphql";
13
+ import navigationQuery from "@projectcaluma/ember-distribution/gql/queries/navigation.graphql";
14
+ import uniqueByGroups from "@projectcaluma/ember-distribution/utils/unique-by-groups";
12
15
 
13
16
  export default class DistributionService extends Service {
14
17
  @service("-scheduler") scheduler;
@@ -21,9 +24,7 @@ export default class DistributionService extends Service {
21
24
 
22
25
  @config config;
23
26
 
24
- get caseId() {
25
- return getOwner(this).lookup("route:application").currentModel;
26
- }
27
+ @tracked caseId;
27
28
 
28
29
  get hasInquiries() {
29
30
  return (
@@ -52,7 +53,7 @@ export default class DistributionService extends Service {
52
53
  @dropTask
53
54
  *fetchControls(caseId) {
54
55
  return yield this.apollo.watchQuery({
55
- query: controlWorkItemsQuery,
56
+ query: controlsQuery,
56
57
  variables: {
57
58
  caseId,
58
59
  currentGroup: String(this.calumaOptions.currentGroupId),
@@ -67,14 +68,13 @@ export default class DistributionService extends Service {
67
68
  @dropTask
68
69
  *fetchNavigation(caseId) {
69
70
  const response = yield this.apollo.watchQuery({
70
- query: inquiryNavigationQuery,
71
+ query: navigationQuery,
71
72
  variables: {
72
73
  caseId,
73
74
  task: this.config.inquiry.task,
74
75
  currentGroup: String(this.calumaOptions.currentGroupId),
75
76
  statusQuestion: this.config.inquiry.answer.statusQuestion,
76
77
  deadlineQuestion: this.config.inquiry.deadlineQuestion,
77
- includeNavigationData: true,
78
78
  },
79
79
  });
80
80
 
@@ -107,6 +107,22 @@ export default class DistributionService extends Service {
107
107
  // get create inquiry work item to complete
108
108
  const createId = decodeId(this.controls.value?.create.edges[0].node.id);
109
109
 
110
+ // refetch dialog queries of the groups that will have a new inquiry
111
+ const refetchQueries = groups.map((group) => ({
112
+ query: inquiryDialogQuery,
113
+ variables: {
114
+ from: String(this.calumaOptions.currentGroupId),
115
+ to: String(group),
116
+ caseId: this.caseId,
117
+ task: this.config.inquiry.task,
118
+ infoQuestion: this.config.inquiry.infoQuestion,
119
+ deadlineQuestion: this.config.inquiry.deadlineQuestion,
120
+ statusQuestion: this.config.inquiry.answer.statusQuestion,
121
+ answerInfoQuestions: this.config.inquiry.answer.infoQuestions,
122
+ buttonTasks: Object.keys(this.config.inquiry.answer.buttons),
123
+ },
124
+ }));
125
+
110
126
  // create new inquiries
111
127
  yield this.apollo.mutate({
112
128
  mutation: createInquiryMutation,
@@ -117,6 +133,7 @@ export default class DistributionService extends Service {
117
133
  addressed_groups: groups.map(String),
118
134
  }),
119
135
  },
136
+ refetchQueries,
120
137
  });
121
138
 
122
139
  // refetch navigation and controls data
@@ -127,4 +144,49 @@ export default class DistributionService extends Service {
127
144
  );
128
145
  }
129
146
  }
147
+
148
+ @cached
149
+ get inquiries() {
150
+ const findGroupName = (identifiers) => {
151
+ const group = this.scheduler.groupCache.find((group) =>
152
+ identifiers
153
+ .map(String)
154
+ .includes(String(group[this.calumaOptions.groupIdentifierProperty]))
155
+ );
156
+
157
+ return group?.[this.calumaOptions.groupNameProperty] ?? "";
158
+ };
159
+
160
+ return Object.entries(this.navigation.value ?? {}).reduce(
161
+ (inquiries, [key, objects]) => {
162
+ return {
163
+ ...inquiries,
164
+ // Don't return any data until the internal scheduler has cached
165
+ // groups since we don't want to render empty navigation items
166
+ [key]: this.scheduler.groupCache.length
167
+ ? uniqueByGroups(
168
+ objects.edges.map((edge) => ({
169
+ ...edge.node,
170
+ // Populate the work item with the names of the involved
171
+ // groups so the <DistributionNavigation::Section /> component
172
+ // can sort by them
173
+ addressedGroupName: findGroupName(edge.node.addressedGroups),
174
+ controllingGroupName: findGroupName(
175
+ edge.node.controllingGroups
176
+ ),
177
+ }))
178
+ ).sort((a, b) => {
179
+ const sortProperty =
180
+ key === "addressed"
181
+ ? "controllingGroupName"
182
+ : "addressedGroupName";
183
+
184
+ return a[sortProperty].localeCompare(b[sortProperty]);
185
+ })
186
+ : [],
187
+ };
188
+ },
189
+ {}
190
+ );
191
+ }
130
192
  }
@@ -10,7 +10,7 @@
10
10
  <div uk-grid class={{if this.config.ui.stack "uk-grid-small"}}>
11
11
  {{#if this.distribution.hasInquiries}}
12
12
  <div class={{if this.config.ui.stack "uk-width-1-1" "uk-width-1-3"}}>
13
- <CdNavigation @caseId={{@model}} />
13
+ <CdNavigation />
14
14
  </div>
15
15
  {{#if this.config.ui.stack}}<div class="uk-width-1-1"><hr /></div>{{/if}}
16
16
  {{/if}}
@@ -1,5 +1 @@
1
- <CdInquiryDialog
2
- @from={{@model.from}}
3
- @to={{@model.to}}
4
- @caseId={{@model.case}}
5
- />
1
+ <CdInquiryDialog @from={{@model.from}} @to={{@model.to}} />