@projectcaluma/ember-distribution 11.0.0-beta.28 → 11.0.0-beta.29

Sign up to get free protection for your applications and to get access to all the features.
@@ -7,6 +7,7 @@ const hasStatus = (status) => (edge) => edge.node.status === status;
7
7
 
8
8
  export default class DistributionAbility extends Ability {
9
9
  @service distribution;
10
+ @service calumaOptions;
10
11
 
11
12
  @config config;
12
13
 
@@ -43,6 +44,9 @@ export default class DistributionAbility extends Ability {
43
44
  return (
44
45
  !this.config.ui.readonly &&
45
46
  (this.config.permissions.reopenDistribution?.() ?? true) &&
47
+ this.distribution.controls.value?.case.edges[0]?.node.parentWorkItem.addressedGroups
48
+ .map(String)
49
+ .includes(String(this.calumaOptions.currentGroupId)) &&
46
50
  this.distribution.controls.value?.case.edges[0]?.node.parentWorkItem
47
51
  .isRedoable
48
52
  );
@@ -61,7 +61,7 @@ export default class InquiryAbility extends Ability {
61
61
  get canReopen() {
62
62
  return (
63
63
  this.model.isRedoable &&
64
- this.model?.addressedGroups
64
+ this.model?.controllingGroups
65
65
  .map(String)
66
66
  .includes(String(this.calumaOptions.currentGroupId)) &&
67
67
  (this.config.permissions.reopenInquiry?.(this.model) ?? true)
@@ -1,6 +1,9 @@
1
1
  <p class="uk-text-large uk-margin-remove uk-flex uk-flex-middle">
2
2
  <div class="uk-width-expand">
3
3
  {{@name}}
4
+ {{#if @group}}
5
+ ({{group-name @group}})
6
+ {{/if}}
4
7
  {{#if @status}}
5
8
  <UkLabel @label={{@status}} class="uk-margin-left" />
6
9
  {{/if}}
@@ -52,8 +52,6 @@ export default class CdInquiryDialogComponent extends Component {
52
52
  },
53
53
  });
54
54
 
55
- this._setRedoableStates(response.allWorkItems);
56
-
57
55
  /**
58
56
  * Sadly this is necessary to handle what happens after the withdraw task in
59
57
  * the inquiry part component because the mutation triggers a refresh of the
@@ -70,39 +68,11 @@ export default class CdInquiryDialogComponent extends Component {
70
68
  if (allWorkItems.edges.every((edge) => edge.node.status === "CANCELED")) {
71
69
  this.router.transitionTo("index");
72
70
  }
73
-
74
- /**
75
- * Get work item that was redoable in the previous calulation and is now
76
- * not anymore. This indicates that the work item was redone which should
77
- * result in a transition to the answer view.
78
- */
79
- const redoneWorkItem = this._redoableStates.find((stateObj) => {
80
- const updatedWorkItem = allWorkItems.edges.find(
81
- (edge) => decodeId(edge.node.id) === stateObj.id
82
- );
83
-
84
- return (
85
- stateObj.isRedoable && !(updatedWorkItem?.node.isRedoable ?? true)
86
- );
87
- });
88
-
89
- if (redoneWorkItem) {
90
- this.router.transitionTo("inquiry.detail.answer", redoneWorkItem.id);
91
- }
92
-
93
- this._setRedoableStates(allWorkItems);
94
71
  });
95
72
 
96
73
  return response;
97
74
  }
98
75
 
99
- _setRedoableStates(allWorkItems) {
100
- this._redoableStates = allWorkItems.edges.map((edge) => ({
101
- id: decodeId(edge.node.id),
102
- isRedoable: edge.node.isRedoable,
103
- }));
104
- }
105
-
106
76
  @dropTask
107
77
  *createInquiry(e) {
108
78
  e.preventDefault();
@@ -6,6 +6,7 @@
6
6
  <:default as |content|>
7
7
  <CdDocumentHeader
8
8
  @name={{content.document.rootForm.raw.name}}
9
+ @group={{this.inquiry.addressedGroups}}
9
10
  @status={{if
10
11
  (eq this.inquiry.status "SUSPENDED")
11
12
  (t "caluma.distribution.status.draft")
@@ -43,6 +44,14 @@
43
44
  >{{t "caluma.distribution.edit.send"}}</UkButton>
44
45
  </DocumentValidity>
45
46
  {{/if}}
47
+ {{#if (can "answer inquiry" this.inquiry)}}
48
+ <LinkTo
49
+ @route="inquiry.detail.answer"
50
+ class="uk-button uk-button-primary"
51
+ >
52
+ {{t "caluma.distribution.answer.link"}}
53
+ </LinkTo>
54
+ {{/if}}
46
55
  </:default>
47
56
  <:notfound><CdNotfound /></:notfound>
48
57
  </CfContent>
@@ -1,18 +1,8 @@
1
1
  <div class="uk-text-center uk-margin-small-top">
2
- {{#if (can "create inquiry of distribution")}}
3
- <LinkTo
4
- @route="new"
5
- class="uk-icon-button"
6
- {{uk-tooltip (t "caluma.distribution.new.title")}}
7
- data-test-new-inquiry
8
- >
9
- <UkIcon @icon="plus" />
10
- </LinkTo>
11
- {{/if}}
12
2
  {{#if (can "send inquiries of distribution")}}
13
3
  <button
14
4
  type="button"
15
- class="uk-icon-button"
5
+ class="uk-icon-button uk-button-primary"
16
6
  {{uk-tooltip (t "caluma.distribution.send")}}
17
7
  data-test-send-pending-inquiries
18
8
  {{on "click" (perform this.sendInquiries)}}
@@ -24,18 +14,38 @@
24
14
  {{/if}}
25
15
  </button>
26
16
  {{/if}}
17
+ {{#if (can "create inquiry of distribution")}}
18
+ <LinkTo
19
+ @route="new"
20
+ class="uk-icon-button"
21
+ {{uk-tooltip (t "caluma.distribution.new.title")}}
22
+ data-test-new-inquiry
23
+ >
24
+ <UkIcon @icon="plus" />
25
+ </LinkTo>
26
+ {{/if}}
27
27
  {{#if (can "complete distribution")}}
28
28
  <button
29
29
  type="button"
30
30
  class="uk-icon-button"
31
- {{uk-tooltip (t "caluma.distribution.complete")}}
31
+ {{uk-tooltip
32
+ (t
33
+ (if
34
+ this.hasInquiries
35
+ "caluma.distribution.complete"
36
+ "caluma.distribution.skip"
37
+ )
38
+ )
39
+ }}
32
40
  data-test-complete-distribution
33
41
  {{on "click" (perform this.completeDistribution)}}
34
42
  >
35
43
  {{#if this.completeDistribution.isRunning}}
36
44
  <UkSpinner @ratio={{0.6}} />
37
- {{else}}
45
+ {{else if this.hasInquiries}}
38
46
  <UkIcon @icon="lock" />
47
+ {{else}}
48
+ <UkIcon @icon="forward" />
39
49
  {{/if}}
40
50
  </button>
41
51
  {{/if}}
@@ -20,26 +20,38 @@ export default class CdNavigationControlsComponent extends Component {
20
20
  @queryManager apollo;
21
21
  @config config;
22
22
 
23
+ get hasInquiries() {
24
+ return (
25
+ this.distribution.navigation.value?.addressed.edges.length > 0 ||
26
+ this.distribution.navigation.value?.controlling.edges.length > 0 ||
27
+ this.distribution.navigation.value?.more.edges.length > 0
28
+ );
29
+ }
30
+
23
31
  @dropTask
24
32
  *completeDistribution() {
25
33
  try {
26
- const incompleteInquiries = yield this.apollo.query(
27
- {
28
- query: incompleteInquiriesQuery,
29
- variables: {
30
- caseId: this.distribution.caseId,
31
- task: this.config.inquiry.task,
34
+ let confirmText = this.intl.t("caluma.distribution.skip-confirm");
35
+
36
+ if (this.hasInquiries) {
37
+ const incompleteInquiries = yield this.apollo.query(
38
+ {
39
+ query: incompleteInquiriesQuery,
40
+ variables: {
41
+ caseId: this.distribution.caseId,
42
+ task: this.config.inquiry.task,
43
+ },
32
44
  },
33
- },
34
- "allWorkItems.totalCount"
35
- );
36
-
37
- const confirmText =
38
- incompleteInquiries === 0
39
- ? this.intl.t("caluma.distribution.complete-confirm-empty")
40
- : this.intl.t("caluma.distribution.complete-confirm", {
41
- count: incompleteInquiries,
42
- });
45
+ "allWorkItems.totalCount"
46
+ );
47
+
48
+ confirmText =
49
+ incompleteInquiries === 0
50
+ ? this.intl.t("caluma.distribution.complete-confirm-empty")
51
+ : this.intl.t("caluma.distribution.complete-confirm", {
52
+ count: incompleteInquiries,
53
+ });
54
+ }
43
55
 
44
56
  if (!(yield confirm(confirmText))) {
45
57
  return;
@@ -1,4 +1,6 @@
1
- <li class="uk-margin-small-bottom uk-width-auto">
1
+ <li
2
+ class="uk-margin-small-bottom uk-width-auto {{if this.isActive 'uk-active'}}"
3
+ >
2
4
  <a href="" {{on "click" this.toggle}}>
3
5
  <span class="uk-width-expand">
4
6
  {{t (concat "caluma.distribution.types." @type)}}
@@ -1,10 +1,24 @@
1
1
  import { action } from "@ember/object";
2
+ import { inject as service } from "@ember/service";
2
3
  import Component from "@glimmer/component";
3
4
  import { tracked } from "@glimmer/tracking";
4
5
 
5
6
  export default class CdNavigationSectionComponent extends Component {
7
+ @service router;
8
+
6
9
  @tracked expanded = true;
7
10
 
11
+ get isActive() {
12
+ return (
13
+ this.inquiries.find((inquiry) =>
14
+ this.router.isActive("inquiry", {
15
+ to: inquiry.addressedGroups[0],
16
+ from: inquiry.controllingGroups[0],
17
+ })
18
+ ) !== undefined
19
+ );
20
+ }
21
+
8
22
  @action
9
23
  toggle(e) {
10
24
  e.preventDefault();
@@ -18,8 +32,10 @@ export default class CdNavigationSectionComponent extends Component {
18
32
  ? "controllingGroupName"
19
33
  : "addressedGroupName";
20
34
 
21
- return this.args.inquiries.sort((a, b) =>
22
- a[sortProperty].localeCompare(b[sortProperty])
35
+ return (
36
+ this.args.inquiries?.sort((a, b) =>
37
+ a[sortProperty].localeCompare(b[sortProperty])
38
+ ) ?? []
23
39
  );
24
40
  }
25
41
  }
@@ -2,12 +2,15 @@
2
2
  <UkIcon
3
3
  @icon="clock"
4
4
  class="uk-margin-small-right uk-text-{{this.deadline.color}}"
5
- {{uk-tooltip (format-date this.deadline.value)}}
5
+ {{uk-tooltip
6
+ (format-date this.deadline.value)
7
+ pos=(if this.config.ui.stack "left" "top")
8
+ }}
6
9
  />
7
10
  {{/if}}
8
11
 
9
12
  <UkIcon
10
13
  @icon={{this.status.icon}}
11
14
  class="uk-text-{{this.status.color}}"
12
- {{uk-tooltip this.status.label}}
15
+ {{uk-tooltip this.status.label pos=(if this.config.ui.stack "left" "top")}}
13
16
  />
@@ -57,6 +57,7 @@ query ControlWorkItems(
57
57
  parentWorkItem {
58
58
  id
59
59
  isRedoable
60
+ addressedGroups
60
61
  }
61
62
  }
62
63
  }
@@ -4,6 +4,7 @@ query InquiryEdit($inquiry: ID!) {
4
4
  node {
5
5
  id
6
6
  status
7
+ addressedGroups
7
8
  controllingGroups
8
9
  task {
9
10
  id
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@projectcaluma/ember-distribution",
3
- "version": "11.0.0-beta.28",
3
+ "version": "11.0.0-beta.29",
4
4
  "description": "Ember engine for the Caluma distribution module.",
5
5
  "keywords": [
6
6
  "ember-addon",
@@ -18,13 +18,14 @@
18
18
  "ember-engines": ">= 0.8"
19
19
  },
20
20
  "dependencies": {
21
+ "@ember/legacy-built-in-components": "^0.4.1",
21
22
  "@ember/string": "^3.0.0",
22
23
  "@embroider/macros": "^1.8.3",
23
24
  "@glimmer/component": "^1.1.2",
24
25
  "@glimmer/tracking": "^1.1.2",
25
- "@projectcaluma/ember-core": "^11.0.0-beta.28",
26
- "@projectcaluma/ember-form": "^11.0.0-beta.28",
27
- "@projectcaluma/ember-workflow": "^11.0.0-beta.28",
26
+ "@projectcaluma/ember-core": "^11.0.0-beta.29",
27
+ "@projectcaluma/ember-form": "^11.0.0-beta.29",
28
+ "@projectcaluma/ember-workflow": "^11.0.0-beta.29",
28
29
  "ember-apollo-client": "~4.0.2",
29
30
  "ember-auto-import": "^2.4.2",
30
31
  "ember-can": "^4.2.0",
@@ -35,10 +36,10 @@
35
36
  "ember-fetch": "^8.1.2",
36
37
  "ember-intl": "^5.7.2",
37
38
  "ember-pikaday": "^4.0.0",
38
- "ember-resources": "^5.3.2",
39
+ "ember-resources": "^5.4.0",
39
40
  "ember-svg-jar": "^2.3.4",
40
41
  "ember-test-selectors": "^6.0.0",
41
- "ember-uikit": "^6.0.0",
42
+ "ember-uikit": "^6.1.0",
42
43
  "graphql": "^15.8.0",
43
44
  "graphql-tag": "^2.12.6",
44
45
  "lodash.merge": "^4.6.2",
@@ -47,12 +48,12 @@
47
48
  },
48
49
  "devDependencies": {
49
50
  "@ember/optional-features": "2.0.0",
50
- "@ember/test-helpers": "2.8.1",
51
+ "@ember/test-helpers": "2.7.0",
51
52
  "@embroider/test-setup": "1.8.3",
52
53
  "@faker-js/faker": "7.5.0",
53
- "@projectcaluma/ember-testing": "11.0.0-beta.28",
54
+ "@projectcaluma/ember-testing": "11.0.0-beta.29",
54
55
  "broccoli-asset-rev": "3.0.0",
55
- "ember-cli": "3.28.5",
56
+ "ember-cli": "4.7.0",
56
57
  "ember-cli-code-coverage": "1.0.3",
57
58
  "ember-cli-dependency-checker": "3.3.1",
58
59
  "ember-cli-inject-live-reload": "2.1.0",
@@ -62,12 +63,10 @@
62
63
  "ember-cli-terser": "4.0.2",
63
64
  "ember-disable-prototype-extensions": "1.1.3",
64
65
  "ember-engines": "0.8.23",
65
- "ember-export-application-global": "2.0.1",
66
66
  "ember-load-initializers": "2.1.2",
67
- "ember-maybe-import-regenerator": "1.0.0",
68
67
  "ember-qunit": "5.1.5",
69
68
  "ember-resolver": "8.0.3",
70
- "ember-source": "3.28.9",
69
+ "ember-source": "4.7.0",
71
70
  "ember-source-channel-url": "3.0.0",
72
71
  "ember-try": "2.0.0",
73
72
  "loader.js": "4.7.0",
@@ -75,11 +74,11 @@
75
74
  "npm-run-all": "4.1.5",
76
75
  "qunit": "2.19.1",
77
76
  "qunit-dom": "2.0.0",
78
- "sass": "1.54.9",
77
+ "sass": "1.55.0",
79
78
  "webpack": "5.74.0"
80
79
  },
81
80
  "engines": {
82
- "node": "12.* || 14.* || >= 16"
81
+ "node": "14.* || >= 16"
83
82
  },
84
83
  "ember": {
85
84
  "edition": "octane"
@@ -4,6 +4,7 @@ caluma:
4
4
  start: "Starten"
5
5
  send: "Offene Anfragen versenden"
6
6
  complete: "Zirkulation abschliessen"
7
+ skip: "Zirkulation überspringen"
7
8
  reopen: "Zirkulation wiedereröffnen"
8
9
  send-confirm: "Wollen Sie wirklich alle offenen Anfragen versenden?"
9
10
  complete-confirm:
@@ -11,9 +12,11 @@ caluma:
11
12
  in der aktuellen Zirkulation. Wenn Sie die Zirkulation abschliessen, werden
12
13
  alle verbleibenden offenen Anfragen abgebrochen. Möchten Sie fortfahren?"
13
14
  complete-confirm-empty: "Möchten Sie die Zirkulation wirklich abschliessen?"
15
+ skip-confirm: "Wollen Sie die Zirkulation wirklich überspringen?"
14
16
  reopen-confirm: "Wollen Sie die Zirkulation wirklich wiedereröffnen?"
15
17
  send-error: "Fehler beim Versenden der offenen Anfragen"
16
18
  complete-error: "Fehler beim Abschliessen der Zirkulation"
19
+ skip-error: "Fehler beim Überspringen der Zirkulation"
17
20
  reopen-error: "Fehler beim Wiedereröffnen der Zirkulation"
18
21
 
19
22
  more: "mehr"
@@ -27,7 +30,7 @@ caluma:
27
30
 
28
31
  edit:
29
32
  link: "Bearbeiten"
30
- send: "Senden"
33
+ send: "Aktuelle Anfrage versenden"
31
34
  send-error: "Fehler beim Senden der Anfrage"
32
35
  send-not-allowed: "Sie sind nicht berechtigt diese Anfrage zu versenden."
33
36
 
@@ -4,6 +4,7 @@ caluma:
4
4
  start: "Start"
5
5
  send: "Send pending inquiries"
6
6
  complete: "Complete circulation"
7
+ skip: "Skip circulation"
7
8
  send-confirm: "Do you really want to send all pending inquiries?"
8
9
  reopen: "Reopen circulation"
9
10
  complete-confirm:
@@ -12,9 +13,11 @@ caluma:
12
13
  distribution. Completing the distribution will cause all remaining
13
14
  pending inquiries to be canceled. Would you like to continue?"
14
15
  complete-confirm-empty: "Do you really want to complete the distribution?"
16
+ skip-confirm: "Do you really want to skip the distribution?"
15
17
  reopen-confirm: "Do you really want to reopen the distribution?"
16
18
  send-error: "Error while sending pending inquiries"
17
19
  complete-error: "Error while completing the distribution"
20
+ skip-error: "Error while skipping the distribution"
18
21
  reopen-error: "Error while reopening the distribution"
19
22
 
20
23
  more: "more"
@@ -28,7 +31,7 @@ caluma:
28
31
 
29
32
  edit:
30
33
  link: "Edit"
31
- send: "Send"
34
+ send: "Send current inquiry"
32
35
  send-error: "Error while sending the inquiry"
33
36
  send-not-allowed: "You are not allowed to send this inquiry."
34
37
 
@@ -3,7 +3,8 @@ caluma:
3
3
  empty: "Aucune demande n'a encore été créée."
4
4
  start: "Lancer"
5
5
  send: "Envoyer les demandes ouvertes"
6
- complete: "Terminer la circulation"
6
+ complete: "Clore la circulation"
7
+ skip: "Sauter la procédure de circulation"
7
8
  send-confirm: "Voulez-vous vraiment envoyer toutes les demandes ouvertes ?"
8
9
  reopen: "Rouvrir la procédure de circulation"
9
10
  complete-confirm:
@@ -11,9 +12,11 @@ caluma:
11
12
  attente</b> sur la distribution actuelle. Si vous terminez la distribution,
12
13
  toutes les demandes en attente seront annulées. Voulez-vous continuer ?"
13
14
  complete-confirm-empty: "Vous voulez vraiment fermer la circulation ?"
15
+ skip-confirm: "Vous voulez vraiment sauter la circulation ?"
14
16
  reopen-confirm: "Vous voulez vraiment rouvrir la circulation ?"
15
17
  send-error: "Erreur lors de l'envoi des demandes ouvertes"
16
- complete-error: "Erreur lors de la terminaison de la circulation"
18
+ complete-error: "Erreur lors de la clôture de la circulation"
19
+ skip-error: "Erreur lors du saut de la circulation"
17
20
  reopen-error: "Erreur lors de la réouverture de la circulation"
18
21
 
19
22
  more: "plus"
@@ -27,7 +30,7 @@ caluma:
27
30
 
28
31
  edit:
29
32
  link: "Modifier"
30
- send: "Envoyer"
33
+ send: "Envoyer la demande actuelle"
31
34
  send-error: "Erreur lors de l'envoi de la demande"
32
35
  send-not-allowed: "Vous n'êtes pas autorisé à envoyer cette demande."
33
36