@projectcaluma/ember-distribution 1.0.0-beta.5 → 1.0.0-beta.8

Sign up to get free protection for your applications and to get access to all the features.
Files changed (78) hide show
  1. package/CHANGELOG.md +33 -0
  2. package/addon/abilities/distribution.js +8 -6
  3. package/addon/components/cd-icon-button.hbs +27 -0
  4. package/addon/components/{icon-button.js → cd-icon-button.js} +1 -1
  5. package/addon/components/{inquiry-answer-form.hbs → cd-inquiry-answer-form.hbs} +1 -1
  6. package/addon/components/{inquiry-answer-form.js → cd-inquiry-answer-form.js} +1 -1
  7. package/addon/components/cd-inquiry-dialog/inquiry-deadline.hbs +28 -0
  8. package/addon/components/{inquiry-dialog → cd-inquiry-dialog}/inquiry-deadline.js +5 -1
  9. package/addon/components/{inquiry-dialog → cd-inquiry-dialog}/inquiry-divider.hbs +0 -0
  10. package/addon/components/{inquiry-dialog → cd-inquiry-dialog}/inquiry-divider.js +1 -1
  11. package/addon/components/{inquiry-dialog → cd-inquiry-dialog}/inquiry-part.hbs +5 -0
  12. package/addon/components/cd-inquiry-dialog/inquiry-part.js +59 -0
  13. package/addon/components/cd-inquiry-dialog/inquiry.hbs +16 -0
  14. package/addon/components/{inquiry-dialog → cd-inquiry-dialog}/inquiry.js +1 -1
  15. package/addon/components/{inquiry-dialog.hbs → cd-inquiry-dialog.hbs} +2 -2
  16. package/addon/components/cd-inquiry-dialog.js +65 -0
  17. package/addon/components/{inquiry-edit-form.hbs → cd-inquiry-edit-form.hbs} +1 -1
  18. package/addon/components/{inquiry-edit-form.js → cd-inquiry-edit-form.js} +1 -1
  19. package/addon/components/{inquiry-new-form.hbs → cd-inquiry-new-form.hbs} +3 -3
  20. package/addon/components/{inquiry-new-form.js → cd-inquiry-new-form.js} +11 -23
  21. package/addon/components/{distribution-navigation → cd-navigation}/controls.hbs +10 -5
  22. package/addon/components/cd-navigation/controls.js +95 -0
  23. package/addon/components/{distribution-navigation → cd-navigation}/item.hbs +3 -6
  24. package/addon/components/{distribution-navigation → cd-navigation}/item.js +1 -1
  25. package/addon/components/{distribution-navigation → cd-navigation}/section.hbs +2 -2
  26. package/addon/components/{distribution-navigation → cd-navigation}/section.js +1 -1
  27. package/addon/components/{distribution-navigation → cd-navigation}/status-indicator.hbs +2 -1
  28. package/addon/components/{distribution-navigation → cd-navigation}/status-indicator.js +1 -1
  29. package/addon/components/{distribution-navigation.hbs → cd-navigation.hbs} +3 -6
  30. package/addon/components/cd-navigation.js +53 -0
  31. package/addon/components/{notfound.hbs → cd-notfound.hbs} +0 -0
  32. package/addon/engine.js +7 -1
  33. package/addon/gql/mutations/complete-work-item.graphql +8 -0
  34. package/addon/gql/mutations/withdraw-inquiry.graphql +8 -0
  35. package/addon/gql/queries/incomplete-inquiries.graphql +13 -0
  36. package/addon/gql/queries/inquiry-navigation.graphql +2 -0
  37. package/addon/services/distribution.js +82 -0
  38. package/addon/templates/application.hbs +1 -1
  39. package/addon/templates/index.hbs +7 -4
  40. package/addon/templates/inquiry/detail/answer.hbs +1 -1
  41. package/addon/templates/inquiry/detail/index.hbs +1 -1
  42. package/addon/templates/inquiry/index.hbs +1 -1
  43. package/addon/templates/new.hbs +1 -1
  44. package/addon/templates/notfound.hbs +1 -1
  45. package/addon/utils/unique-by-groups.js +1 -0
  46. package/app/components/{inquiry-dialog.js → cd-icon-button.js} +1 -1
  47. package/app/components/{inquiry-dialog/inquiry.js → cd-inquiry-answer-form.js} +1 -1
  48. package/app/components/{inquiry-dialog → cd-inquiry-dialog}/inquiry-deadline.js +1 -1
  49. package/app/components/{inquiry-dialog → cd-inquiry-dialog}/inquiry-divider.js +1 -1
  50. package/app/components/{inquiry-dialog → cd-inquiry-dialog}/inquiry-part.js +1 -1
  51. package/app/components/{distribution-navigation.js → cd-inquiry-dialog/inquiry.js} +1 -1
  52. package/app/components/{inquiry-edit-form.js → cd-inquiry-dialog.js} +1 -1
  53. package/app/components/cd-inquiry-edit-form.js +1 -0
  54. package/app/components/{inquiry-answer-form.js → cd-inquiry-new-form.js} +1 -1
  55. package/app/components/cd-navigation/controls.js +1 -0
  56. package/app/components/{inquiry-new-form.js → cd-navigation/item.js} +1 -1
  57. package/app/components/cd-navigation/section.js +1 -0
  58. package/app/components/{distribution-navigation/item.js → cd-navigation/status-indicator.js} +1 -1
  59. package/app/components/{icon-button.js → cd-navigation.js} +1 -1
  60. package/app/components/{notfound.js → cd-notfound.js} +1 -1
  61. package/app/services/{caluma-distribution-controls.js → distribution.js} +1 -1
  62. package/index.js +14 -13
  63. package/package.json +20 -18
  64. package/public/assets/distribution.svg +1 -0
  65. package/translations/de.yaml +16 -2
  66. package/translations/en.yaml +17 -2
  67. package/translations/fr.yaml +16 -2
  68. package/addon/components/distribution-navigation/controls.js +0 -9
  69. package/addon/components/distribution-navigation.js +0 -86
  70. package/addon/components/icon-button.hbs +0 -20
  71. package/addon/components/inquiry-dialog/inquiry-deadline.hbs +0 -14
  72. package/addon/components/inquiry-dialog/inquiry-part.js +0 -24
  73. package/addon/components/inquiry-dialog/inquiry.hbs +0 -16
  74. package/addon/components/inquiry-dialog.js +0 -42
  75. package/addon/services/caluma-distribution-controls.js +0 -37
  76. package/app/components/distribution-navigation/controls.js +0 -1
  77. package/app/components/distribution-navigation/section.js +0 -1
  78. package/app/components/distribution-navigation/status-indicator.js +0 -1
@@ -1,86 +0,0 @@
1
- import { inject as service } from "@ember/service";
2
- import Component from "@glimmer/component";
3
- import { tracked } from "@glimmer/tracking";
4
- import { queryManager } from "ember-apollo-client";
5
- import { restartableTask } from "ember-concurrency";
6
- import { useTask } from "ember-resources";
7
-
8
- import config from "@projectcaluma/ember-distribution/config";
9
- import inquiryNavigationQuery from "@projectcaluma/ember-distribution/gql/queries/inquiry-navigation.graphql";
10
- import uniqueByGroups from "@projectcaluma/ember-distribution/utils/unique-by-groups";
11
-
12
- export default class DistributionNavigationComponent extends Component {
13
- @service calumaOptions;
14
- @service("-scheduler") scheduler;
15
-
16
- @config config;
17
-
18
- @queryManager apollo;
19
-
20
- @tracked groups = [];
21
-
22
- get inquiries() {
23
- const findGroupName = (identifiers) => {
24
- const group = this.scheduler.groupCache.find((group) =>
25
- identifiers
26
- .map(String)
27
- .includes(String(group[this.calumaOptions.groupIdentifierProperty]))
28
- );
29
-
30
- return group?.[this.calumaOptions.groupNameProperty] ?? "";
31
- };
32
-
33
- return Object.entries(this._inquiries.value || []).reduce(
34
- (inquiries, [key, objects]) => {
35
- return {
36
- ...inquiries,
37
- [key]: uniqueByGroups(
38
- objects.edges.map((edge) => ({
39
- ...edge.node,
40
- addressedGroupName: findGroupName(edge.node.addressedGroups),
41
- controllingGroupName: findGroupName(edge.node.controllingGroups),
42
- }))
43
- ),
44
- };
45
- },
46
- {}
47
- );
48
- }
49
-
50
- _inquiries = useTask(this, this.fetchInquiries, () => [
51
- this.args.caseId,
52
- this.config,
53
- ]);
54
-
55
- @restartableTask
56
- *fetchInquiries() {
57
- const response = yield this.apollo.watchQuery({
58
- query: inquiryNavigationQuery,
59
- variables: {
60
- caseId: this.args.caseId,
61
- task: this.config.inquiry.task,
62
- currentGroup: String(this.calumaOptions.currentGroupId),
63
- statusQuestion: this.config.inquiry.answer.statusQuestion,
64
- deadlineQuestion: this.config.inquiry.deadlineQuestion,
65
- includeNavigationData: true,
66
- },
67
- });
68
-
69
- const groupIds = [
70
- ...new Set(
71
- Object.values(response)
72
- .map((inquiries) => {
73
- return inquiries.edges.map((edge) => [
74
- ...edge.node.addressedGroups,
75
- ...edge.node.controllingGroups,
76
- ]);
77
- })
78
- .flat(2)
79
- ),
80
- ];
81
-
82
- yield this.scheduler.resolve(groupIds, "group");
83
-
84
- return response;
85
- }
86
- }
@@ -1,20 +0,0 @@
1
- {{#if @route}}
2
- <LinkTo
3
- @route={{@route}}
4
- class={{this.class}}
5
- uk-icon={{unless @fromSvgJar @icon}}
6
- ...attributes
7
- >
8
- {{#if @fromSvgJar}}{{svg-jar @icon width="20" height="20"}}{{/if}}
9
- </LinkTo>
10
- {{else}}
11
- <button
12
- type="button"
13
- class={{this.class}}
14
- uk-icon={{unless @fromSvgJar @icon}}
15
- ...attributes
16
- {{on "click" @onClick}}
17
- >
18
- {{#if @fromSvgJar}}{{svg-jar @icon width="20" height="20"}}{{/if}}
19
- </button>
20
- {{/if}}
@@ -1,14 +0,0 @@
1
- {{#if this.deadline.value}}
2
- <div
3
- class="uk-position-top-right
4
- {{if
5
- this.config.ui.small
6
- 'uk-margin-top uk-margin-right'
7
- 'uk-margin-medium-top uk-margin-medium-right'
8
- }}
9
- uk-flex-inline uk-flex-middle uk-text-{{this.deadline.color}}"
10
- >
11
- {{svg-jar "alarm-outline" height=26 class="uk-margin-small-right"}}
12
- {{format-date this.deadline.value}}
13
- </div>
14
- {{/if}}
@@ -1,24 +0,0 @@
1
- import Component from "@glimmer/component";
2
-
3
- import config from "@projectcaluma/ember-distribution/config";
4
-
5
- export default class InquiryDialogInquiryPartComponent extends Component {
6
- @config config;
7
-
8
- get date() {
9
- const key = this.args.type === "request" ? "createdAt" : "closedAt";
10
-
11
- return this.args.inquiry[key];
12
- }
13
-
14
- get info() {
15
- const document =
16
- this.args.type === "request"
17
- ? this.args.inquiry.document
18
- : this.args.type === "answer"
19
- ? this.args.inquiry.childCase.document
20
- : null;
21
-
22
- return document.info.edges[0]?.node.value;
23
- }
24
- }
@@ -1,16 +0,0 @@
1
- <article
2
- class="uk-card uk-card-default uk-margin
3
- {{if this.config.ui.small 'uk-card-small'}}"
4
- >
5
- <div class="uk-card-body">
6
- <InquiryDialog::InquiryDeadline @inquiry={{@inquiry}} />
7
-
8
- {{#if this.hasAnswer}}
9
- <InquiryDialog::InquiryPart @inquiry={{@inquiry}} @type="answer" />
10
-
11
- <InquiryDialog::InquiryDivider @inquiry={{@inquiry}} />
12
- {{/if}}
13
-
14
- <InquiryDialog::InquiryPart @inquiry={{@inquiry}} @type="request" />
15
- </div>
16
- </article>
@@ -1,42 +0,0 @@
1
- import Component from "@glimmer/component";
2
- import { queryManager } from "ember-apollo-client";
3
- import { dropTask } from "ember-concurrency";
4
- import { useTask } from "ember-resources";
5
-
6
- import config from "@projectcaluma/ember-distribution/config";
7
- import inquiryDialogQuery from "@projectcaluma/ember-distribution/gql/queries/inquiry-dialog.graphql";
8
-
9
- export default class InquiryDialogComponent extends Component {
10
- @config config;
11
-
12
- @queryManager apollo;
13
-
14
- get inquiries() {
15
- return this._inquiries.value?.allWorkItems.edges.map((edge) => edge.node);
16
- }
17
-
18
- _inquiries = useTask(this, this.fetchDialog, () => [
19
- this.args.from,
20
- this.args.to,
21
- this.args.caseId,
22
- this.config,
23
- ]);
24
-
25
- @dropTask
26
- *fetchDialog() {
27
- return yield this.apollo.watchQuery({
28
- query: inquiryDialogQuery,
29
- variables: {
30
- from: this.args.from,
31
- to: this.args.to,
32
- caseId: this.args.caseId,
33
- task: this.config.inquiry.task,
34
- infoQuestion: this.config.inquiry.infoQuestion,
35
- deadlineQuestion: this.config.inquiry.deadlineQuestion,
36
- statusQuestion: this.config.inquiry.answer.statusQuestion,
37
- answerInfoQuestion: this.config.inquiry.answer.infoQuestion,
38
- includeNavigationData: true,
39
- },
40
- });
41
- }
42
- }
@@ -1,37 +0,0 @@
1
- import { getOwner } from "@ember/application";
2
- import Service, { inject as service } from "@ember/service";
3
- import { queryManager } from "ember-apollo-client";
4
- import { dropTask } from "ember-concurrency";
5
- import { useTask } from "ember-resources";
6
-
7
- import config from "@projectcaluma/ember-distribution/config";
8
- import controlWorkItemsQuery from "@projectcaluma/ember-distribution/gql/queries/control-work-items.graphql";
9
-
10
- export default class CalumaDistributionControlsService extends Service {
11
- @service calumaOptions;
12
- @service router;
13
-
14
- @queryManager apollo;
15
-
16
- @config config;
17
-
18
- get caseId() {
19
- return getOwner(this).lookup("route:application").currentModel;
20
- }
21
-
22
- workItems = useTask(this, this.fetchWorkItems, () => [this.caseId]);
23
-
24
- @dropTask
25
- *fetchWorkItems(caseId) {
26
- return yield this.apollo.watchQuery({
27
- query: controlWorkItemsQuery,
28
- variables: {
29
- caseId,
30
- currentGroup: String(this.calumaOptions.currentGroupId),
31
- createTask: this.config.controls.createTask,
32
- completeTask: this.config.controls.completeTask,
33
- inquiryTask: this.config.inquiry.task,
34
- },
35
- });
36
- }
37
- }
@@ -1 +0,0 @@
1
- export { default } from "@projectcaluma/ember-distribution/components/distribution-navigation/controls";
@@ -1 +0,0 @@
1
- export { default } from "@projectcaluma/ember-distribution/components/distribution-navigation/section";
@@ -1 +0,0 @@
1
- export { default } from "@projectcaluma/ember-distribution/components/distribution-navigation/status-indicator";