@projectcaluma/ember-distribution 1.0.0-beta.1 → 1.0.0-beta.12

Sign up to get free protection for your applications and to get access to all the features.
Files changed (134) hide show
  1. package/CHANGELOG.md +130 -0
  2. package/addon/abilities/distribution.js +41 -0
  3. package/addon/abilities/inquiry.js +20 -0
  4. package/addon/components/cd-document-header.hbs +17 -0
  5. package/addon/components/cd-inquiry-answer-form.hbs +78 -0
  6. package/addon/components/{inquiry-answer-form.js → cd-inquiry-answer-form.js} +32 -14
  7. package/addon/components/cd-inquiry-dialog/inquiry-deadline.hbs +27 -0
  8. package/addon/components/{inquiry-dialog → cd-inquiry-dialog}/inquiry-deadline.js +5 -1
  9. package/addon/components/cd-inquiry-dialog/inquiry-divider.hbs +8 -0
  10. package/addon/components/{inquiry-dialog → cd-inquiry-dialog}/inquiry-divider.js +1 -1
  11. package/addon/components/cd-inquiry-dialog/inquiry-part.hbs +109 -0
  12. package/addon/components/cd-inquiry-dialog/inquiry-part.js +69 -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/cd-inquiry-dialog.hbs +30 -0
  16. package/addon/components/cd-inquiry-dialog.js +94 -0
  17. package/addon/components/cd-inquiry-edit-form.hbs +44 -0
  18. package/addon/components/{inquiry-edit-form.js → cd-inquiry-edit-form.js} +5 -4
  19. package/addon/components/cd-inquiry-new-form.hbs +125 -0
  20. package/addon/components/cd-inquiry-new-form.js +114 -0
  21. package/addon/components/cd-navigation/controls.hbs +41 -0
  22. package/addon/components/cd-navigation/controls.js +95 -0
  23. package/addon/components/cd-navigation/item.hbs +18 -0
  24. package/addon/components/{distribution-navigation → cd-navigation}/item.js +2 -2
  25. package/addon/components/cd-navigation/section.hbs +26 -0
  26. package/addon/components/{distribution-navigation → cd-navigation}/section.js +1 -1
  27. package/addon/components/cd-navigation/status-indicator.hbs +13 -0
  28. package/addon/components/{distribution-navigation → cd-navigation}/status-indicator.js +1 -1
  29. package/addon/components/cd-navigation.hbs +11 -0
  30. package/addon/components/cd-navigation.js +53 -0
  31. package/addon/components/cd-notfound.hbs +12 -0
  32. package/addon/components/cd-truncated.hbs +8 -0
  33. package/addon/components/cd-truncated.js +32 -0
  34. package/addon/config.js +12 -7
  35. package/addon/controllers/application.js +10 -0
  36. package/addon/controllers/{distribution/new.js → new.js} +2 -2
  37. package/addon/engine.js +7 -1
  38. package/addon/gql/fragments/inquiry.graphql +37 -12
  39. package/addon/gql/mutations/complete-work-item.graphql +8 -0
  40. package/addon/gql/mutations/withdraw-inquiry.graphql +8 -0
  41. package/addon/gql/queries/control-work-items.graphql +18 -2
  42. package/addon/gql/queries/incomplete-inquiries.graphql +13 -0
  43. package/addon/gql/queries/inquiry-answer.graphql +17 -12
  44. package/addon/gql/queries/inquiry-dialog.graphql +3 -2
  45. package/addon/gql/queries/inquiry-edit.graphql +2 -0
  46. package/addon/gql/queries/inquiry-navigation.graphql +4 -1
  47. package/addon/modifiers/pikaday.js +2 -0
  48. package/addon/routes/{distribution.js → application.js} +1 -1
  49. package/addon/routes/{distribution/index.js → index.js} +2 -2
  50. package/addon/routes/inquiry/detail/answer.js +7 -0
  51. package/addon/routes/inquiry/detail/index.js +7 -0
  52. package/addon/routes/{distribution/inquiry → inquiry}/detail.js +1 -1
  53. package/addon/routes/inquiry/index.js +10 -0
  54. package/addon/routes/{distribution/inquiry.js → inquiry.js} +1 -1
  55. package/addon/routes/new.js +7 -0
  56. package/addon/routes/notfound.js +3 -0
  57. package/addon/routes.js +5 -6
  58. package/addon/services/distribution.js +112 -0
  59. package/addon/templates/application.hbs +18 -0
  60. package/addon/templates/index.hbs +11 -0
  61. package/addon/templates/inquiry/detail/answer.hbs +1 -0
  62. package/addon/templates/inquiry/detail/index.hbs +1 -0
  63. package/addon/templates/{distribution/inquiry → inquiry}/detail.hbs +0 -0
  64. package/addon/templates/{distribution/inquiry → inquiry}/index.hbs +1 -1
  65. package/addon/templates/{distribution/inquiry.hbs → inquiry.hbs} +0 -0
  66. package/addon/templates/{distribution/new.hbs → new.hbs} +1 -1
  67. package/addon/templates/notfound.hbs +1 -0
  68. package/addon/utils/inquiry-answer-status.js +34 -0
  69. package/addon/utils/inquiry-deadline.js +6 -9
  70. package/addon/utils/inquiry-status.js +12 -7
  71. package/addon/utils/unique-by-groups.js +1 -0
  72. package/app/abilities/distribution.js +1 -0
  73. package/app/components/cd-document-header.js +1 -0
  74. package/app/components/{inquiry-dialog/inquiry.js → cd-inquiry-answer-form.js} +1 -1
  75. package/app/components/{inquiry-dialog → cd-inquiry-dialog}/inquiry-deadline.js +1 -1
  76. package/app/components/{inquiry-dialog → cd-inquiry-dialog}/inquiry-divider.js +1 -1
  77. package/app/components/{inquiry-dialog → cd-inquiry-dialog}/inquiry-part.js +1 -1
  78. package/app/components/{distribution-navigation.js → cd-inquiry-dialog/inquiry.js} +1 -1
  79. package/app/components/{inquiry-edit-form.js → cd-inquiry-dialog.js} +1 -1
  80. package/app/components/cd-inquiry-edit-form.js +1 -0
  81. package/app/components/{inquiry-answer-form.js → cd-inquiry-new-form.js} +1 -1
  82. package/app/components/cd-navigation/controls.js +1 -0
  83. package/app/components/cd-navigation/item.js +1 -0
  84. package/app/components/cd-navigation/section.js +1 -0
  85. package/app/components/{distribution-navigation/item.js → cd-navigation/status-indicator.js} +1 -1
  86. package/app/components/{inquiry-dialog.js → cd-navigation.js} +1 -1
  87. package/app/components/{icon-button.js → cd-notfound.js} +1 -1
  88. package/app/components/{inquiry-new-form.js → cd-truncated.js} +1 -1
  89. package/app/services/distribution.js +1 -0
  90. package/app/styles/@projectcaluma/ember-distribution.scss +3 -2
  91. package/app/styles/_answer-form.scss +4 -0
  92. package/app/styles/_group-list.scss +7 -0
  93. package/app/styles/_inquiry-divider.scss +22 -0
  94. package/app/styles/_truncated.scss +3 -0
  95. package/app/utils/inquiry-answer-status.js +1 -0
  96. package/index.js +10 -14
  97. package/package.json +31 -27
  98. package/public/assets/distribution.svg +1 -0
  99. package/translations/de.yaml +49 -8
  100. package/translations/en.yaml +50 -8
  101. package/translations/fr.yaml +49 -8
  102. package/addon/components/distribution-navigation/controls.hbs +0 -21
  103. package/addon/components/distribution-navigation/controls.js +0 -45
  104. package/addon/components/distribution-navigation/item.hbs +0 -18
  105. package/addon/components/distribution-navigation/section.hbs +0 -24
  106. package/addon/components/distribution-navigation/status-indicator.hbs +0 -17
  107. package/addon/components/distribution-navigation.hbs +0 -17
  108. package/addon/components/distribution-navigation.js +0 -81
  109. package/addon/components/icon-button.hbs +0 -20
  110. package/addon/components/icon-button.js +0 -22
  111. package/addon/components/inquiry-answer-form.hbs +0 -46
  112. package/addon/components/inquiry-dialog/inquiry-deadline.hbs +0 -6
  113. package/addon/components/inquiry-dialog/inquiry-divider.hbs +0 -7
  114. package/addon/components/inquiry-dialog/inquiry-part.hbs +0 -40
  115. package/addon/components/inquiry-dialog/inquiry-part.js +0 -20
  116. package/addon/components/inquiry-dialog/inquiry.hbs +0 -13
  117. package/addon/components/inquiry-dialog/inquiry.js +0 -7
  118. package/addon/components/inquiry-dialog.hbs +0 -9
  119. package/addon/components/inquiry-dialog.js +0 -42
  120. package/addon/components/inquiry-edit-form.hbs +0 -27
  121. package/addon/components/inquiry-new-form.hbs +0 -110
  122. package/addon/components/inquiry-new-form.js +0 -154
  123. package/addon/routes/distribution/inquiry/detail/answer.js +0 -7
  124. package/addon/routes/distribution/inquiry/detail/index.js +0 -7
  125. package/addon/routes/distribution/inquiry/index.js +0 -10
  126. package/addon/routes/distribution/new.js +0 -7
  127. package/addon/templates/distribution/inquiry/detail/answer.hbs +0 -1
  128. package/addon/templates/distribution/inquiry/detail/index.hbs +0 -1
  129. package/addon/templates/distribution.hbs +0 -8
  130. package/app/components/distribution-navigation/controls.js +0 -1
  131. package/app/components/distribution-navigation/section.js +0 -1
  132. package/app/components/distribution-navigation/status-indicator.js +0 -1
  133. package/app/styles/_icon-button.scss +0 -13
  134. package/app/styles/_status-indicator.scss +0 -31
@@ -1,22 +1,50 @@
1
1
  caluma:
2
2
  distribution:
3
+ empty: "Es wurden noch keine Anfragen erstellt."
4
+ start: "Starten"
5
+ send: "Offene Anfragen versenden"
6
+ complete: "Zirkulation abschliessen"
7
+ send-confirm: "Wollen Sie wirklich alle offenen Anfragen versenden?"
8
+ complete-confirm:
9
+ "Es gibt noch <b>{count} offene {count, plural, =1 {Anfrage} other {Anfragen}}</b>
10
+ in der aktuellen Zirkulation. Wenn Sie die Zirkulation abschliessen, werden
11
+ alle verbleibenden offenen Anfragen abgebrochen. Möchten Sie fortfahren?"
12
+ send-error: "Fehler beim Versenden der offenen Anfragen"
13
+ complete-error: "Fehler beim Abschliessen der Zirkulation"
14
+
15
+ more: "mehr"
16
+ less: "weniger"
17
+
18
+ last-modified: "Zuletzt bearbeitet von {user} am {date} um {time}"
19
+ details: "Details"
20
+ not-allowed-hint:
21
+ "Sie können jedoch das Formular bearbeiten und die Eingabedaten werden
22
+ automatisch gespeichert."
23
+
3
24
  edit:
4
- title: "Anfrage bearbeiten"
5
25
  link: "Bearbeiten"
6
-
7
26
  send: "Senden"
8
27
  send-error: "Fehler beim Senden der Anfrage"
28
+ send-not-allowed: "Sie sind nicht berechtigt diese Anfrage zu versenden."
9
29
 
10
30
  answer:
11
- title: "Anfrage beantworten"
12
31
  link: "Beantworten"
13
32
 
14
- release-for-review: "Zur Kontrolle freigeben"
15
- release-adjustment-for-review: "Anpassung zur Kontrolle freigeben"
16
- confirm: "Bestätigen"
17
- revise: "Überarbeiten"
18
-
19
33
  complete-error: "Fehler beim Abschliessen der Aufgabe"
34
+ complete-not-allowed: "Sie sind nicht berechtigt diese Antwort zu versenden."
35
+
36
+ buttons:
37
+ compose:
38
+ label: "Zur Kontrolle freigeben"
39
+ status: "In Bearbeitung"
40
+ adjust:
41
+ label: "Anpassung zur Kontrolle freigeben"
42
+ status: "In Überarbeitung"
43
+ confirm:
44
+ label: "Bestätigen"
45
+ status: "In Prüfung"
46
+ revise:
47
+ label: "Überarbeiten"
20
48
 
21
49
  new:
22
50
  title: "Neue Anfrage"
@@ -36,7 +64,20 @@ caluma:
36
64
 
37
65
  status:
38
66
  draft: "Entwurf"
67
+ skipped: "Vorzeitig beendet"
39
68
  sent: "Versendet"
40
69
  positive: "Positiv"
41
70
  negative: "Negativ"
42
71
  needs-interaction: "Aktion erforderlich"
72
+
73
+ notfound:
74
+ title: "404"
75
+ subtitle: "Seite nicht gefunden!"
76
+ back: "Zurück zur"
77
+ link: "Startseite"
78
+
79
+ withdraw:
80
+ link: "Zurückziehen"
81
+ confirm: "Wollen Sie die Anfrage wirklich zurückziehen?"
82
+ error: "Fehler beim Zurückziehen der Anfrage"
83
+ status: "Zurückgezogen"
@@ -1,22 +1,51 @@
1
1
  caluma:
2
2
  distribution:
3
+ empty: "No inquiries have been created yet."
4
+ start: "Start"
5
+ send: "Send pending inquiries"
6
+ complete: "Complete circulation"
7
+ send-confirm: "Do you really want to send all pending inquiries?"
8
+ complete-confirm:
9
+ "There {count, plural, =1 {is} other {are}} <b>{count} pending
10
+ {count, plural, =1 {inquiry} other {inquiries}}</b> on the current
11
+ distribution. Completing the distribution will cause all remaining
12
+ pending inquiries to be canceled. Would you like to continue?"
13
+ send-error: "Error while sending pending inquiries"
14
+ complete-error: "Error while completing distribution"
15
+
16
+ more: "more"
17
+ less: "less"
18
+
19
+ last-modified: "Last modified by {user} on {date} at {time}"
20
+ details: "Details"
21
+ not-allowed-hint:
22
+ "However, you can edit the form and the input will be saved
23
+ automatically."
24
+
3
25
  edit:
4
- title: "Edit inquiry"
5
26
  link: "Edit"
6
-
7
27
  send: "Send"
8
28
  send-error: "Error while sending the inquiry"
29
+ send-not-allowed: "You are not allowed to send this inquiry."
9
30
 
10
31
  answer:
11
- title: "Answer inquiry"
12
32
  link: "Answer"
13
33
 
14
- release-for-review: "Release for review"
15
- release-adjustment-for-review: "Release adjustment for review"
16
- confirm: "Confirm"
17
- revise: "Revise"
18
-
19
34
  complete-error: "Error while completing the work item"
35
+ complete-not-allowed: "You are not allowed to send this inquiry answer."
36
+
37
+ buttons:
38
+ compose:
39
+ label: "Release for review"
40
+ status: "In progress"
41
+ adjust:
42
+ label: "Release adjustment for review"
43
+ status: "In revision"
44
+ confirm:
45
+ label: "Confirm"
46
+ status: "In review"
47
+ revise:
48
+ label: "Revise"
20
49
 
21
50
  new:
22
51
  title: "New inquiry"
@@ -36,7 +65,20 @@ caluma:
36
65
 
37
66
  status:
38
67
  draft: "Draft"
68
+ skipped: "Aborted"
39
69
  sent: "Sent"
40
70
  positive: "Positive"
41
71
  negative: "Negative"
42
72
  needs-interaction: "Needs interaction"
73
+
74
+ notfound:
75
+ title: "404"
76
+ subtitle: "Page not found!"
77
+ back: "Go back to the"
78
+ link: "landing page"
79
+
80
+ withdraw:
81
+ link: "Withdraw"
82
+ confirm: "Do you really want to withdraw the inquiry?"
83
+ error: "Error while withdrawing the inquiry"
84
+ status: "Withdrawn"
@@ -1,22 +1,50 @@
1
1
  caluma:
2
2
  distribution:
3
+ empty: "Aucune demande n'a encore été créée."
4
+ start: "Lancer"
5
+ send: "Envoyer les demandes ouvertes"
6
+ complete: "Terminer la circulation"
7
+ send-confirm: "Voulez-vous vraiment envoyer toutes les demandes ouvertes ?"
8
+ complete-confirm:
9
+ "Il y a <b>{count} {count, plural, =1 {demande} other {demandes}} en
10
+ attente</b> sur la distribution actuelle. Si vous terminez la distribution,
11
+ toutes les demandes en attente seront annulées. Voulez-vous continuer ?"
12
+ send-error: "Erreur lors de l'envoi des demandes ouvertes"
13
+ complete-error: "Erreur lors de la terminaison de la distribution"
14
+
15
+ more: "plus"
16
+ less: "moins"
17
+
18
+ last-modified: "Dernière modification par {user} le {date} à {time}"
19
+ details: "Détails"
20
+ not-allowed-hint:
21
+ "Vous pouvez toutefois modifier le formulaire et les données seront
22
+ automatiquement enregistrées."
23
+
3
24
  edit:
4
- title: "Modifier la demande"
5
25
  link: "Modifier"
6
-
7
26
  send: "Envoyer"
8
27
  send-error: "Erreur lors de l'envoi de la demande"
28
+ send-not-allowed: "Vous n'êtes pas autorisé à envoyer cette demande."
9
29
 
10
30
  answer:
11
- title: "Répondre à la demande"
12
31
  link: "Répondre"
13
32
 
14
- release-for-review: "Valider pour vérification"
15
- release-adjustment-for-review: "Valider la révision pour vérification"
16
- confirm: "Confirmer"
17
- revise: "Réviser"
18
-
19
33
  complete-error: "Erreur lors de la clôture de la tâche"
34
+ complete-not-allowed: "Vous n'êtes pas autorisé à envoyer cette réponse."
35
+
36
+ buttons:
37
+ compose:
38
+ label: "Valider pour vérification"
39
+ status: "En cours"
40
+ adjust:
41
+ label: "Valider la révision pour vérification"
42
+ status: "En révision"
43
+ confirm:
44
+ label: "Confirmer"
45
+ status: "En examen"
46
+ revise:
47
+ label: "Réviser"
20
48
 
21
49
  new:
22
50
  title: "Nouvelle demande"
@@ -36,7 +64,20 @@ caluma:
36
64
 
37
65
  status:
38
66
  draft: "Brouillon"
67
+ skipped: "Terminé prématurément"
39
68
  sent: "Envoyé"
40
69
  positive: "Positif"
41
70
  negative: "Negatif"
42
71
  needs-interaction: "Action nécessaire"
72
+
73
+ notfound:
74
+ title: "404"
75
+ subtitle: "Page non trouvée !"
76
+ back: "Retour à"
77
+ link: "la page d'accueil"
78
+
79
+ withdraw:
80
+ link: "Retirer"
81
+ confirm: "Voulez-vous vraiment retirer la demande ?"
82
+ error: "Erreur lors du retrait de la demande"
83
+ status: "Retirée"
@@ -1,21 +0,0 @@
1
- <div class="uk-text-center uk-margin-small-top">
2
- {{#if this.canCreate}}
3
- <IconButton @route="distribution.new" @icon="plus" />
4
- {{/if}}
5
- <IconButton
6
- @icon="paper-plane-outline"
7
- @fromSvgJar={{true}}
8
- @gutterTop={{4}}
9
- @gutterRight={{6}}
10
- @gutterLeft={{4}}
11
- @gutterBottom={{4}}
12
- @onClick={{this.noop}}
13
- />
14
- {{#if this.canComplete}}
15
- <IconButton
16
- @icon="lock-closed-outline"
17
- @fromSvgJar={{true}}
18
- @onClick={{this.noop}}
19
- />
20
- {{/if}}
21
- </div>
@@ -1,45 +0,0 @@
1
- import { action } from "@ember/object";
2
- import { inject as service } from "@ember/service";
3
- import Component from "@glimmer/component";
4
- import { queryManager } from "ember-apollo-client";
5
- import { dropTask } from "ember-concurrency";
6
- import { useTask } from "ember-resources";
7
-
8
- import config from "@projectcaluma/ember-distribution/config";
9
- import controlWorkItemsQuery from "@projectcaluma/ember-distribution/gql/queries/control-work-items.graphql";
10
-
11
- export default class DistributionNavigationControlsComponent extends Component {
12
- @service calumaOptions;
13
-
14
- @queryManager apollo;
15
-
16
- @config config;
17
-
18
- workItems = useTask(this, this.fetchWorkItems, () => []);
19
-
20
- get canCreate() {
21
- return this.workItems.value?.create.edges.length > 0;
22
- }
23
-
24
- get canComplete() {
25
- return this.workItems.value?.complete.edges.length > 0;
26
- }
27
-
28
- @action
29
- noop(e) {
30
- e.preventDefault();
31
- }
32
-
33
- @dropTask
34
- *fetchWorkItems() {
35
- return yield this.apollo.watchQuery({
36
- query: controlWorkItemsQuery,
37
- variables: {
38
- caseId: this.args.caseId,
39
- currentGroup: String(this.calumaOptions.currentGroupId),
40
- createTask: this.config.controls.createTask,
41
- completeTask: this.config.controls.completeTask,
42
- },
43
- });
44
- }
45
- }
@@ -1,18 +0,0 @@
1
- <li class={{if this.isActive "uk-active"}}>
2
- <LinkTo @route="distribution.inquiry" @model={{this.model}}>
3
- <div class="uk-flex uk-flex-middle uk-width-1-1">
4
- <div class="uk-width-expand uk-text-truncate">
5
- {{#if (eq @type "addressed")}}
6
- {{group-name @inquiry.controllingGroups}}
7
- {{else}}
8
- {{group-name @inquiry.addressedGroups}}
9
- {{/if}}
10
- </div>
11
-
12
- <DistributionNavigation::StatusIndicator
13
- @inquiry={{@inquiry}}
14
- @type={{@type}}
15
- />
16
- </div>
17
- </LinkTo>
18
- </li>
@@ -1,24 +0,0 @@
1
- <li class="uk-margin-small-bottom">
2
- <a href="" class="uk-margin-small-bottom" {{on "click" this.toggle}}>
3
- <span class="uk-width-expand">
4
- {{t (concat "caluma.distribution.types." @type)}}
5
- </span>
6
- {{#if this.expanded}}
7
- <UkIcon @icon="chevron-down" />
8
- {{else}}
9
- <UkIcon @icon="chevron-right" />
10
- {{/if}}
11
- </a>
12
-
13
- {{#if (and @inquiries.length this.expanded)}}
14
- <ul class="uk-tab uk-tab-left uk-margin-left">
15
- {{#each this.inquiries as |inquiry|}}
16
- <DistributionNavigation::Item @inquiry={{inquiry}} @type={{@type}} />
17
- {{/each}}
18
- </ul>
19
-
20
- {{#if (eq @type "controlling")}}
21
- <DistributionNavigation::Controls @caseId={{@caseId}} />
22
- {{/if}}
23
- {{/if}}
24
- </li>
@@ -1,17 +0,0 @@
1
- {{#if this.showDeadlineIndicator}}
2
- <div
3
- class="deadline-indicator uk-flex-uk-flex-middle uk-flex-center uk-margin-small-left uk-text-{{this.deadline.color}}"
4
- >
5
- {{svg-jar
6
- "notifications-outline"
7
- height=16
8
- title=(format-date this.deadline.value)
9
- }}
10
- </div>
11
- {{/if}}
12
-
13
- <div
14
- class="status-indicator uk-flex uk-flex-middle uk-flex-center uk-margin-small-left uk-text-{{this.status.color}}"
15
- >
16
- {{svg-jar this.status.icon title=this.status.label}}
17
- </div>
@@ -1,17 +0,0 @@
1
- <aside>
2
- <ul class="uk-tab uk-tab-left">
3
- <DistributionNavigation::Section
4
- @type="controlling"
5
- @inquiries={{this.inquiries.controlling}}
6
- @caseId={{@caseId}}
7
- />
8
- <DistributionNavigation::Section
9
- @type="addressed"
10
- @inquiries={{this.inquiries.addressed}}
11
- />
12
- <DistributionNavigation::Section
13
- @type="more"
14
- @inquiries={{this.inquiries.more}}
15
- />
16
- </ul>
17
- </aside>
@@ -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,22 +0,0 @@
1
- import { dasherize } from "@ember/string";
2
- import Component from "@glimmer/component";
3
-
4
- export default class IconButtonComponent extends Component {
5
- get class() {
6
- const gutters = [
7
- "gutter",
8
- "gutterTop",
9
- "gutterRight",
10
- "gutterBottom",
11
- "gutterLeft",
12
- ]
13
- .map((arg) =>
14
- this.args[arg]
15
- ? `uk-icon-button--${dasherize(arg)}-${this.args[arg]}`
16
- : null
17
- )
18
- .filter(Boolean);
19
-
20
- return ["uk-icon-button", ...gutters].join(" ");
21
- }
22
- }
@@ -1,46 +0,0 @@
1
- <CfContent
2
- @documentId={{decode-id this.inquiry.childCase.document.id}}
3
- @disabled={{cannot "edit answer form of inquiry" this.inquiry}}
4
- @loading={{this._inquiry.isRunning}}
5
- as |content|
6
- >
7
- <h1 class="uk-flex uk-flex-middle">
8
- {{t "caluma.distribution.answer.title"}}
9
- {{#if (eq this.inquiry.status "RUNNING")}}
10
- <UkLabel
11
- class="uk-margin-left"
12
- @label={{t "caluma.distribution.status.draft"}}
13
- />
14
- {{/if}}
15
- </h1>
16
-
17
- <content.form />
18
-
19
- {{#each this.buttons as |buttonConfig|}}
20
- {{#if buttonConfig.isFormButton}}
21
- <DocumentValidity @document={{content.document}} as |isValid validate|>
22
- <UkButton
23
- @type="submit"
24
- @color={{buttonConfig.color}}
25
- @disabled={{or (not isValid) this.completeWorkItem.isRunning}}
26
- @on-click={{fn
27
- (perform this.completeWorkItem)
28
- buttonConfig.workItemId
29
- validate
30
- }}
31
- >{{buttonConfig.label}}</UkButton>
32
- </DocumentValidity>
33
- {{else}}
34
- <UkButton
35
- @type="button"
36
- @color={{buttonConfig.color}}
37
- @disabled={{this.completeWorkItem.isRunning}}
38
- @on-click={{fn
39
- (perform this.completeWorkItem)
40
- buttonConfig.workItemId
41
- null
42
- }}
43
- >{{buttonConfig.label}}</UkButton>
44
- {{/if}}
45
- {{/each}}
46
- </CfContent>
@@ -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,7 +0,0 @@
1
- <div
2
- class="inquiry-divider uk-flex uk-flex-center uk-flex-middle uk-flex-between uk-margin uk-text-{{this.status.color}}"
3
- >
4
- <div class="inquiry-divider__icon uk-flex uk-flex-center uk-flex-middle">
5
- {{svg-jar this.status.icon title=this.status.label}}
6
- </div>
7
- </div>
@@ -1,40 +0,0 @@
1
- <p class="uk-flex uk-flex-middle uk-text-bold uk-margin-remove">
2
- {{#if (eq @type "request")}}
3
- {{svg-jar "arrow-redo-outline" height=24 class="uk-margin-small-right"}}
4
- {{group-name @inquiry.controllingGroups}}
5
- {{else if (eq @type "answer")}}
6
- {{svg-jar "arrow-undo-outline" height=24 class="uk-margin-small-right"}}
7
- {{group-name @inquiry.addressedGroups}}
8
- {{/if}}
9
- </p>
10
-
11
- <ul class="uk-subnav uk-subnav-divider uk-margin-small-top">
12
- <li>
13
- <span>
14
- {{format-date this.date}}
15
- {{format-time this.date hour="2-digit" minute="2-digit"}}
16
- </span>
17
- </li>
18
- {{#if (can "edit inquiry" @inquiry)}}
19
- <li>
20
- <LinkTo
21
- @route="distribution.inquiry.detail.index"
22
- @model={{decode-id @inquiry.id}}
23
- >
24
- {{t "caluma.distribution.edit.link"}}
25
- </LinkTo>
26
- </li>
27
- {{/if}}
28
- {{#if (can "answer inquiry" @inquiry)}}
29
- <li>
30
- <LinkTo
31
- @route="distribution.inquiry.detail.answer"
32
- @model={{decode-id @inquiry.id}}
33
- >
34
- {{t "caluma.distribution.answer.link"}}
35
- </LinkTo>
36
- </li>
37
- {{/if}}
38
- </ul>
39
-
40
- <p class="uk-margin-remove-bottom">{{this.info}}</p>
@@ -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,9 +0,0 @@
1
- <section>
2
- {{#if this._inquiries.isRunning}}
3
- <div class="uk-text-center"><UkSpinner @ratio={{2}} /></div>
4
- {{else}}
5
- {{#each this.inquiries as |inquiry|}}
6
- <InquiryDialog::Inquiry @inquiry={{inquiry}} />
7
- {{/each}}
8
- {{/if}}
9
- </section>