@projectcaluma/ember-distribution 1.0.0-beta.4 → 1.0.0-beta.7

Sign up to get free protection for your applications and to get access to all the features.
Files changed (80) hide show
  1. package/CHANGELOG.md +34 -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 +2 -1
  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 +16 -2
  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/cd-inquiry-dialog/inquiry.js +11 -0
  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} +2 -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} +20 -28
  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/config.js +1 -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/app/styles/_inquiry-divider.scss +22 -0
  63. package/index.js +14 -13
  64. package/package.json +23 -20
  65. package/public/assets/distribution.svg +1 -0
  66. package/translations/de.yaml +16 -2
  67. package/translations/en.yaml +17 -2
  68. package/translations/fr.yaml +16 -2
  69. package/addon/components/distribution-navigation/controls.js +0 -9
  70. package/addon/components/distribution-navigation.js +0 -81
  71. package/addon/components/icon-button.hbs +0 -20
  72. package/addon/components/inquiry-dialog/inquiry-deadline.hbs +0 -6
  73. package/addon/components/inquiry-dialog/inquiry-part.js +0 -20
  74. package/addon/components/inquiry-dialog/inquiry.hbs +0 -13
  75. package/addon/components/inquiry-dialog/inquiry.js +0 -7
  76. package/addon/components/inquiry-dialog.js +0 -42
  77. package/addon/services/caluma-distribution-controls.js +0 -37
  78. package/app/components/distribution-navigation/controls.js +0 -1
  79. package/app/components/distribution-navigation/section.js +0 -1
  80. package/app/components/distribution-navigation/status-indicator.js +0 -1
@@ -1,7 +1,16 @@
1
1
  caluma:
2
2
  distribution:
3
- empty: "There are no inquiries yet."
4
- create: "Create the first one now!"
3
+ empty: "No inquiries have been created yet."
4
+ start: "Start"
5
+ send: "Send pending inquiries"
6
+ send-confirm: "Do you really want to send all pending inquiries?"
7
+ complete-confirm:
8
+ "There {count, plural, =1 {is} other {are}} <b>{count} pending
9
+ {count, plural, =1 {inquiry} other {inquiries}}</b> on the current
10
+ distribution. Completing the distribution will cause all remaining
11
+ pending inquiries to be canceled. Would you like to continue?"
12
+ send-error: "Error while sending pending inquiries"
13
+ complete-error: "Error while completing distribution"
5
14
 
6
15
  edit:
7
16
  title: "Edit inquiry"
@@ -49,3 +58,9 @@ caluma:
49
58
  subtitle: "Page not found!"
50
59
  back: "Go back to the"
51
60
  link: "landing page"
61
+
62
+ withdraw:
63
+ link: "Withdraw"
64
+ confirm: "Do you really want to withdraw the inquiry?"
65
+ error: "Error while withdrawing the inquiry"
66
+ status: "Withdrawn"
@@ -1,7 +1,15 @@
1
1
  caluma:
2
2
  distribution:
3
- empty: "Il n'y a pas encore de demande."
4
- create: "Créez la première maintenant !"
3
+ empty: "Aucune demande n'a encore été créée."
4
+ start: "Lancer"
5
+ send: "Envoyer les demandes ouvertes"
6
+ send-confirm: "Voulez-vous vraiment envoyer toutes les demandes ouvertes ?"
7
+ complete-confirm:
8
+ "Il y a <b>{count} {count, plural, =1 {demande} other {demandes}} en
9
+ attente</b> sur la distribution actuelle. Si vous terminez la distribution,
10
+ toutes les demandes en attente seront annulées. Voulez-vous continuer ?"
11
+ send-error: "Erreur lors de l'envoi des demandes ouvertes"
12
+ complete-error: "Erreur lors de la terminaison de la distribution"
5
13
 
6
14
  edit:
7
15
  title: "Modifier la demande"
@@ -49,3 +57,9 @@ caluma:
49
57
  subtitle: "Page non trouvée !"
50
58
  back: "Retour à"
51
59
  link: "la page d'accueil"
60
+
61
+ withdraw:
62
+ link: "Retirer"
63
+ confirm: "Voulez-vous vraiment retirer la demande ?"
64
+ error: "Erreur lors du retrait de la demande"
65
+ status: "Retirée"
@@ -1,9 +0,0 @@
1
- import { action } from "@ember/object";
2
- import Component from "@glimmer/component";
3
-
4
- export default class DistributionNavigationControlsComponent extends Component {
5
- @action
6
- noop(e) {
7
- e.preventDefault();
8
- }
9
- }
@@ -1,81 +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 = (ids) =>
24
- this.groups.find((g) =>
25
- ids.includes(g[this.calumaOptions.groupIdentifierProperty])
26
- )?.[this.calumaOptions.groupNameProperty];
27
-
28
- return Object.entries(this._inquiries.value || []).reduce(
29
- (inquiries, [key, objects]) => {
30
- return {
31
- ...inquiries,
32
- [key]: uniqueByGroups(
33
- objects.edges.map((edge) => ({
34
- ...edge.node,
35
- addressedGroupName: findGroupName(edge.node.addressedGroups),
36
- controllingGroupName: findGroupName(edge.node.controllingGroups),
37
- }))
38
- ),
39
- };
40
- },
41
- {}
42
- );
43
- }
44
-
45
- _inquiries = useTask(this, this.fetchInquiries, () => [
46
- this.args.caseId,
47
- this.config,
48
- ]);
49
-
50
- @restartableTask
51
- *fetchInquiries() {
52
- const response = yield this.apollo.watchQuery({
53
- query: inquiryNavigationQuery,
54
- variables: {
55
- caseId: this.args.caseId,
56
- task: this.config.inquiry.task,
57
- currentGroup: String(this.calumaOptions.currentGroupId),
58
- statusQuestion: this.config.inquiry.answer.statusQuestion,
59
- deadlineQuestion: this.config.inquiry.deadlineQuestion,
60
- includeNavigationData: true,
61
- },
62
- });
63
-
64
- const groupIds = [
65
- ...new Set(
66
- Object.values(response)
67
- .map((inquiries) => {
68
- return inquiries.edges.map((edge) => [
69
- ...edge.node.addressedGroups,
70
- ...edge.node.controllingGroups,
71
- ]);
72
- })
73
- .flat(2)
74
- ),
75
- ];
76
-
77
- this.groups = yield this.scheduler.resolve(groupIds, "group");
78
-
79
- return response;
80
- }
81
- }
@@ -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,6 +0,0 @@
1
- <div
2
- class="uk-position-top-right uk-margin-medium-top uk-margin-medium-right uk-flex-inline uk-flex-middle uk-text-{{this.deadline.color}}"
3
- >
4
- {{svg-jar "alarm-outline" height=26 class="uk-margin-small-right"}}
5
- {{format-date this.deadline.value}}
6
- </div>
@@ -1,20 +0,0 @@
1
- import Component from "@glimmer/component";
2
-
3
- export default class InquiryDialogInquiryPartComponent extends Component {
4
- get date() {
5
- const key = this.args.type === "request" ? "createdAt" : "closedAt";
6
-
7
- return this.args.inquiry[key];
8
- }
9
-
10
- get info() {
11
- const document =
12
- this.args.type === "request"
13
- ? this.args.inquiry.document
14
- : this.args.type === "answer"
15
- ? this.args.inquiry.childCase.document
16
- : null;
17
-
18
- return document.info.edges[0]?.node.value;
19
- }
20
- }
@@ -1,13 +0,0 @@
1
- <article class="uk-card uk-card-default uk-margin">
2
- <div class="uk-card-body">
3
- <InquiryDialog::InquiryDeadline @inquiry={{@inquiry}} />
4
-
5
- {{#if this.hasAnswer}}
6
- <InquiryDialog::InquiryPart @inquiry={{@inquiry}} @type="answer" />
7
-
8
- <InquiryDialog::InquiryDivider @inquiry={{@inquiry}} />
9
- {{/if}}
10
-
11
- <InquiryDialog::InquiryPart @inquiry={{@inquiry}} @type="request" />
12
- </div>
13
- </article>
@@ -1,7 +0,0 @@
1
- import Component from "@glimmer/component";
2
-
3
- export default class InquiryDialogInquiryComponent extends Component {
4
- get hasAnswer() {
5
- return this.args.inquiry.status === "COMPLETED";
6
- }
7
- }
@@ -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";