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

Sign up to get free protection for your applications and to get access to all the features.
package/CHANGELOG.md CHANGED
@@ -1,3 +1,16 @@
1
+ # [@projectcaluma/ember-distribution-v1.0.0-beta.6](https://github.com/projectcaluma/ember-caluma/compare/@projectcaluma/ember-distribution-v1.0.0-beta.5...@projectcaluma/ember-distribution-v1.0.0-beta.6) (2022-03-24)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * **embroider:** add missing dependency on @ember/string ([3a6e6bb](https://github.com/projectcaluma/ember-caluma/commit/3a6e6bb39a8c1a40a2ae00b3d4ea00606a755e25))
7
+
8
+
9
+ ### Features
10
+
11
+ * **distribution:** add functionality to send all pending inquiries ([d769953](https://github.com/projectcaluma/ember-caluma/commit/d769953d5a0ea196943426c8499ba87b77a42e61))
12
+ * **distribution:** add functionality to withdraw an inquiry ([c278895](https://github.com/projectcaluma/ember-caluma/commit/c2788957c0fb228c167ca9236fda4850717f5817))
13
+
1
14
  # [@projectcaluma/ember-distribution-v1.0.0-beta.5](https://github.com/projectcaluma/ember-caluma/compare/@projectcaluma/ember-distribution-v1.0.0-beta.4...@projectcaluma/ember-distribution-v1.0.0-beta.5) (2022-03-11)
2
15
 
3
16
 
@@ -4,26 +4,28 @@ import { Ability } from "ember-can";
4
4
  const hasStatus = (status) => (edge) => edge.node.status === status;
5
5
 
6
6
  export default class DistributionAbility extends Ability {
7
- @service("caluma-distribution-controls") controls;
7
+ @service distribution;
8
8
 
9
9
  get canSendInquiries() {
10
10
  return (
11
- this.controls.workItems.value?.send.edges.filter(hasStatus("SUSPENDED"))
12
- .length > 0
11
+ this.distribution.controls.value?.send.edges.filter(
12
+ hasStatus("SUSPENDED")
13
+ ).length > 0
13
14
  );
14
15
  }
15
16
 
16
17
  get canCreateInquiry() {
17
18
  return (
18
- this.controls.workItems.value?.create.edges.filter(hasStatus("READY"))
19
+ this.distribution.controls.value?.create.edges.filter(hasStatus("READY"))
19
20
  .length > 0
20
21
  );
21
22
  }
22
23
 
23
24
  get canComplete() {
24
25
  return (
25
- this.controls.workItems.value?.complete.edges.filter(hasStatus("READY"))
26
- .length > 0
26
+ this.distribution.controls.value?.complete.edges.filter(
27
+ hasStatus("READY")
28
+ ).length > 0
27
29
  );
28
30
  }
29
31
  }
@@ -4,13 +4,16 @@
4
4
  {{/if}}
5
5
  {{#if (can "send inquiries of distribution")}}
6
6
  <IconButton
7
+ @title={{t "caluma.distribution.send"}}
7
8
  @icon="paper-plane-outline"
8
9
  @fromSvgJar={{true}}
9
10
  @gutterTop={{4}}
10
11
  @gutterRight={{6}}
11
12
  @gutterLeft={{4}}
12
13
  @gutterBottom={{4}}
13
- @onClick={{this.noop}}
14
+ @onClick={{perform this.sendInquiries}}
15
+ @loading={{this.sendInquiries.isRunning}}
16
+ data-test-send-pending-inquiries
14
17
  />
15
18
  {{/if}}
16
19
  {{#if (can "complete distribution")}}
@@ -1,9 +1,51 @@
1
1
  import { action } from "@ember/object";
2
+ import { inject as service } from "@ember/service";
2
3
  import Component from "@glimmer/component";
4
+ import { queryManager } from "ember-apollo-client";
5
+ import { dropTask } from "ember-concurrency";
6
+ import { confirm } from "ember-uikit";
7
+ import { gql } from "graphql-tag";
8
+
9
+ import { decodeId } from "@projectcaluma/ember-core/helpers/decode-id";
3
10
 
4
11
  export default class DistributionNavigationControlsComponent extends Component {
12
+ @service distribution;
13
+ @service intl;
14
+
15
+ @queryManager apollo;
16
+
5
17
  @action
6
18
  noop(e) {
7
19
  e.preventDefault();
8
20
  }
21
+
22
+ @dropTask
23
+ *sendInquiries() {
24
+ if (!(yield confirm(this.intl.t("caluma.distribution.send-confirm")))) {
25
+ return;
26
+ }
27
+
28
+ try {
29
+ const ids = this.distribution.controls.value.send.edges.map((edge) =>
30
+ decodeId(edge.node.id)
31
+ );
32
+
33
+ const mutations = ids.map(
34
+ (id, index) => `
35
+ sendInquiry${index}: resumeWorkItem(input: { id: "${id}" }) {
36
+ workItem {
37
+ id
38
+ status
39
+ }
40
+ }
41
+ `
42
+ );
43
+
44
+ const mutation = gql`mutation SendInquiries {${mutations.join("\n")}}`;
45
+
46
+ yield this.apollo.mutate({ mutation });
47
+ } catch (e) {
48
+ this.notification.danger(this.intl.t("caluma.distribution.send-error"));
49
+ }
50
+ }
9
51
  }
@@ -3,9 +3,9 @@
3
3
  <div class="uk-flex uk-flex-middle uk-width-1-1">
4
4
  <div class="uk-width-expand uk-text-truncate">
5
5
  {{#if (eq @type "addressed")}}
6
- {{group-name @inquiry.controllingGroups}}
6
+ {{@inquiry.controllingGroupName}}
7
7
  {{else}}
8
- {{group-name @inquiry.addressedGroups}}
8
+ {{@inquiry.addressedGroupName}}
9
9
  {{/if}}
10
10
  </div>
11
11
 
@@ -1,24 +1,19 @@
1
1
  import { inject as service } from "@ember/service";
2
2
  import Component from "@glimmer/component";
3
- import { tracked } from "@glimmer/tracking";
4
3
  import { queryManager } from "ember-apollo-client";
5
- import { restartableTask } from "ember-concurrency";
6
- import { useTask } from "ember-resources";
7
4
 
8
5
  import config from "@projectcaluma/ember-distribution/config";
9
- import inquiryNavigationQuery from "@projectcaluma/ember-distribution/gql/queries/inquiry-navigation.graphql";
10
6
  import uniqueByGroups from "@projectcaluma/ember-distribution/utils/unique-by-groups";
11
7
 
12
8
  export default class DistributionNavigationComponent extends Component {
13
- @service calumaOptions;
14
9
  @service("-scheduler") scheduler;
10
+ @service calumaOptions;
11
+ @service distribution;
15
12
 
16
13
  @config config;
17
14
 
18
15
  @queryManager apollo;
19
16
 
20
- @tracked groups = [];
21
-
22
17
  get inquiries() {
23
18
  const findGroupName = (identifiers) => {
24
19
  const group = this.scheduler.groupCache.find((group) =>
@@ -30,57 +25,29 @@ export default class DistributionNavigationComponent extends Component {
30
25
  return group?.[this.calumaOptions.groupNameProperty] ?? "";
31
26
  };
32
27
 
33
- return Object.entries(this._inquiries.value || []).reduce(
28
+ return Object.entries(this.distribution.navigation.value ?? {}).reduce(
34
29
  (inquiries, [key, objects]) => {
35
30
  return {
36
31
  ...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
- ),
32
+ // Don't return any data until the internal scheduler has cached
33
+ // groups since we don't want to render empty navigation items
34
+ [key]: this.scheduler.groupCache.length
35
+ ? uniqueByGroups(
36
+ objects.edges.map((edge) => ({
37
+ ...edge.node,
38
+ // Populate the work item with the names of the involved
39
+ // groups so the <DistributionNavigation::Section /> component
40
+ // can sort by them
41
+ addressedGroupName: findGroupName(edge.node.addressedGroups),
42
+ controllingGroupName: findGroupName(
43
+ edge.node.controllingGroups
44
+ ),
45
+ }))
46
+ )
47
+ : [],
44
48
  };
45
49
  },
46
50
  {}
47
51
  );
48
52
  }
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
53
  }
@@ -1,20 +1,27 @@
1
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}}
2
+ <LinkTo @route={{@route}} class={{this.class}} title={{@title}} ...attributes>
3
+ {{#if @loading}}
4
+ <UkSpinner @ratio={{0.6}} />
5
+ {{else if @fromSvgJar}}
6
+ {{svg-jar @icon title=@title width="20" height="20"}}
7
+ {{else}}
8
+ <UkIcon @icon={{@icon}} />
9
+ {{/if}}
9
10
  </LinkTo>
10
11
  {{else}}
11
12
  <button
12
13
  type="button"
13
14
  class={{this.class}}
14
- uk-icon={{unless @fromSvgJar @icon}}
15
+ title={{@title}}
15
16
  ...attributes
16
17
  {{on "click" @onClick}}
17
18
  >
18
- {{#if @fromSvgJar}}{{svg-jar @icon width="20" height="20"}}{{/if}}
19
+ {{#if @loading}}
20
+ <UkSpinner @ratio={{0.6}} />
21
+ {{else if @fromSvgJar}}
22
+ {{svg-jar @icon title=@title width="20" height="20"}}
23
+ {{else}}
24
+ <UkIcon @icon={{@icon}} />
25
+ {{/if}}
19
26
  </button>
20
27
  {{/if}}
@@ -6,9 +6,22 @@
6
6
  'uk-margin-top uk-margin-right'
7
7
  'uk-margin-medium-top uk-margin-medium-right'
8
8
  }}
9
- uk-flex-inline uk-flex-middle uk-text-{{this.deadline.color}}"
9
+ {{if
10
+ this.isWithdrawn
11
+ 'uk-text-muted'
12
+ (concat 'uk-text-' this.deadline.color)
13
+ }}
14
+ uk-flex-inline uk-flex-middle"
10
15
  >
11
- {{svg-jar "alarm-outline" height=26 class="uk-margin-small-right"}}
12
- {{format-date this.deadline.value}}
16
+ {{svg-jar
17
+ (if this.isWithdrawn "ban-outline" "alarm-outline")
18
+ height=26
19
+ class="uk-margin-small-right"
20
+ }}
21
+ {{#if this.isWithdrawn}}
22
+ {{t "caluma.distribution.withdraw.status"}}
23
+ {{else}}
24
+ {{format-date this.deadline.value}}
25
+ {{/if}}
13
26
  </div>
14
27
  {{/if}}
@@ -7,4 +7,8 @@ export default class InquiryDialogInquiryDeadlineComponent extends Component {
7
7
  @config config;
8
8
 
9
9
  @inquiryDeadline deadline;
10
+
11
+ get isWithdrawn() {
12
+ return this.args.inquiry.status === "CANCELED";
13
+ }
10
14
  }
@@ -28,6 +28,11 @@
28
28
  {{t "caluma.distribution.edit.link"}}
29
29
  </LinkTo>
30
30
  </li>
31
+ <li>
32
+ <a href="" {{on "click" (perform this.withdraw)}} data-test-withdraw>
33
+ {{t "caluma.distribution.withdraw.link"}}
34
+ </a>
35
+ </li>
31
36
  {{/if}}
32
37
  {{#if (can "answer inquiry" @inquiry)}}
33
38
  <li>
@@ -1,8 +1,20 @@
1
+ import { inject as service } from "@ember/service";
1
2
  import Component from "@glimmer/component";
3
+ import { queryManager } from "ember-apollo-client";
4
+ import { dropTask } from "ember-concurrency";
5
+ import { confirm } from "ember-uikit";
2
6
 
7
+ import { decodeId } from "@projectcaluma/ember-core/helpers/decode-id";
3
8
  import config from "@projectcaluma/ember-distribution/config";
9
+ import withdrawInquiryMutation from "@projectcaluma/ember-distribution/gql/mutations/withdraw-inquiry.graphql";
4
10
 
5
11
  export default class InquiryDialogInquiryPartComponent extends Component {
12
+ @service notification;
13
+ @service router;
14
+ @service intl;
15
+
16
+ @queryManager apollo;
17
+
6
18
  @config config;
7
19
 
8
20
  get date() {
@@ -21,4 +33,27 @@ export default class InquiryDialogInquiryPartComponent extends Component {
21
33
 
22
34
  return document.info.edges[0]?.node.value;
23
35
  }
36
+
37
+ @dropTask
38
+ *withdraw(e) {
39
+ e.preventDefault();
40
+
41
+ /* istanbul ignore next */
42
+ if (!(yield confirm(this.intl.t("caluma.distribution.withdraw.confirm")))) {
43
+ return;
44
+ }
45
+
46
+ try {
47
+ yield this.apollo.mutate({
48
+ mutation: withdrawInquiryMutation,
49
+ variables: {
50
+ workItem: decodeId(this.args.inquiry.id),
51
+ },
52
+ });
53
+ } catch (error) {
54
+ this.notification.danger(
55
+ this.intl.t("caluma.distribution.withdraw.error")
56
+ );
57
+ }
58
+ }
24
59
  }
@@ -1,5 +1,6 @@
1
+ import { inject as service } from "@ember/service";
1
2
  import Component from "@glimmer/component";
2
- import { queryManager } from "ember-apollo-client";
3
+ import { queryManager, getObservable } from "ember-apollo-client";
3
4
  import { dropTask } from "ember-concurrency";
4
5
  import { useTask } from "ember-resources";
5
6
 
@@ -7,6 +8,8 @@ import config from "@projectcaluma/ember-distribution/config";
7
8
  import inquiryDialogQuery from "@projectcaluma/ember-distribution/gql/queries/inquiry-dialog.graphql";
8
9
 
9
10
  export default class InquiryDialogComponent extends Component {
11
+ @service router;
12
+
10
13
  @config config;
11
14
 
12
15
  @queryManager apollo;
@@ -24,7 +27,7 @@ export default class InquiryDialogComponent extends Component {
24
27
 
25
28
  @dropTask
26
29
  *fetchDialog() {
27
- return yield this.apollo.watchQuery({
30
+ const response = yield this.apollo.watchQuery({
28
31
  query: inquiryDialogQuery,
29
32
  variables: {
30
33
  from: this.args.from,
@@ -38,5 +41,25 @@ export default class InquiryDialogComponent extends Component {
38
41
  includeNavigationData: true,
39
42
  },
40
43
  });
44
+
45
+ /**
46
+ * Sadly this is necessary to handle what happens after the withdraw task in
47
+ * the inquiry part component because the mutation triggers a refresh of the
48
+ * query above in the same runloop instead of the next one. This causes
49
+ * `this.inquiries` to be recomputed which then triggers a rerender of the
50
+ * component and therefore cancels the withdraw task before we can do a
51
+ * transition.
52
+ *
53
+ * TODO: If https://github.com/ember-graphql/ember-apollo-client/pull/421 is
54
+ * merged and released, we can rewrite this into an action that is triggered
55
+ * in the withdraw task of the child component.
56
+ */
57
+ getObservable(response).subscribe(({ data: { allWorkItems } }) => {
58
+ if (allWorkItems.edges.every((edge) => edge.node.status === "CANCELED")) {
59
+ this.router.transitionTo("index");
60
+ }
61
+ });
62
+
63
+ return response;
41
64
  }
42
65
  }
@@ -6,12 +6,12 @@
6
6
  {{#if this.selectedGroups.length}}
7
7
  <div class="uk-flex uk-flex-middle">
8
8
  <div class="uk-width-expand">
9
- <button type="button" class="uk-link uk-text-light">
9
+ <a href="">
10
10
  {{t
11
11
  "caluma.distribution.new.groups"
12
12
  count=this.selectedGroups.length
13
13
  }}
14
- </button>
14
+ </a>
15
15
  <div uk-dropdown class="uk-width-auto">
16
16
  <ul
17
17
  class="uk-list uk-list-bullet uk-margin-remove uk-padding-remove"
@@ -10,7 +10,6 @@ import { useTask } from "ember-resources";
10
10
  import { decodeId } from "@projectcaluma/ember-core/helpers/decode-id";
11
11
  import config from "@projectcaluma/ember-distribution/config";
12
12
  import createInquiryMutation from "@projectcaluma/ember-distribution/gql/mutations/create-inquiry.graphql";
13
- import inquiryNavigationQuery from "@projectcaluma/ember-distribution/gql/queries/inquiry-navigation.graphql";
14
13
 
15
14
  const toggle = (value, array) => {
16
15
  const set = new Set(array);
@@ -25,7 +24,7 @@ export default class InquiryNewFormComponent extends Component {
25
24
  @service notification;
26
25
  @service intl;
27
26
  @service router;
28
- @service("caluma-distribution-controls") controls;
27
+ @service distribution;
29
28
 
30
29
  @queryManager apollo;
31
30
 
@@ -82,7 +81,7 @@ export default class InquiryNewFormComponent extends Component {
82
81
  try {
83
82
  // get create inquiry work item to complete
84
83
  const createId = decodeId(
85
- this.controls.workItems.value?.create.edges[0].node.id
84
+ this.distribution.controls.value?.create.edges[0].node.id
86
85
  );
87
86
 
88
87
  // create new inquiries
@@ -96,31 +95,20 @@ export default class InquiryNewFormComponent extends Component {
96
95
  },
97
96
  });
98
97
 
99
- // refetch navigation data
100
- const navigationData = yield this.apollo.query(
101
- {
102
- query: inquiryNavigationQuery,
103
- fetchPolicy: "network-only",
104
- variables: {
105
- caseId: this.args.caseId,
106
- task: this.config.inquiry.task,
107
- currentGroup: String(this.calumaOptions.currentGroupId),
108
- statusQuestion: this.config.inquiry.answer.statusQuestion,
109
- deadlineQuestion: this.config.inquiry.deadlineQuestion,
110
- includeNavigationData: true,
111
- },
112
- },
113
- "controlling.edges"
114
- );
98
+ // refetch navigation and controls data
99
+ yield this.distribution.refetch();
100
+
101
+ const lastControlling =
102
+ this.distribution.navigation.value.controlling.edges[0].node;
115
103
 
116
104
  // transition to last added inquiry
117
105
  this.router.transitionTo(
118
106
  "inquiry.detail.index",
119
107
  {
120
- from: navigationData[0].node.controllingGroups[0],
121
- to: navigationData[0].node.addressedGroups[0],
108
+ from: lastControlling.controllingGroups[0],
109
+ to: lastControlling.addressedGroups[0],
122
110
  },
123
- decodeId(navigationData[0].node.id)
111
+ decodeId(lastControlling.id)
124
112
  );
125
113
  } catch (e) {
126
114
  this.notification.danger(
@@ -0,0 +1,8 @@
1
+ mutation WithdrawInquiry($workItem: ID!) {
2
+ cancelWorkItem(input: { id: $workItem }) {
3
+ workItem {
4
+ id
5
+ status
6
+ }
7
+ }
8
+ }
@@ -13,6 +13,7 @@ query InquiryNavigation(
13
13
  { case: $caseId }
14
14
  { task: $task }
15
15
  { controllingGroups: [$currentGroup] }
16
+ { status: CANCELED, invert: true }
16
17
  ]
17
18
  order: [{ attribute: CREATED_AT, direction: DESC }]
18
19
  ) {
@@ -28,6 +29,7 @@ query InquiryNavigation(
28
29
  { task: $task }
29
30
  { addressedGroups: [$currentGroup] }
30
31
  { status: SUSPENDED, invert: true }
32
+ { status: CANCELED, invert: true }
31
33
  ]
32
34
  order: [{ attribute: CREATED_AT, direction: DESC }]
33
35
  ) {
@@ -0,0 +1,82 @@
1
+ import { getOwner } from "@ember/application";
2
+ import Service, { inject as service } from "@ember/service";
3
+ import { queryManager, getObservable } 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
+ import inquiryNavigationQuery from "@projectcaluma/ember-distribution/gql/queries/inquiry-navigation.graphql";
10
+
11
+ export default class DistributionService extends Service {
12
+ @service("-scheduler") scheduler;
13
+ @service calumaOptions;
14
+ @service router;
15
+
16
+ @queryManager apollo;
17
+
18
+ @config config;
19
+
20
+ get caseId() {
21
+ return getOwner(this).lookup("route:application").currentModel;
22
+ }
23
+
24
+ controls = useTask(this, this.fetchControls, () => [this.caseId]);
25
+ navigation = useTask(this, this.fetchNavigation, () => [this.caseId]);
26
+
27
+ async refetch() {
28
+ await getObservable(this.controls.value)?.refetch();
29
+ await getObservable(this.navigation.value)?.refetch();
30
+ }
31
+
32
+ @dropTask
33
+ *fetchControls(caseId) {
34
+ return yield this.apollo.watchQuery({
35
+ query: controlWorkItemsQuery,
36
+ variables: {
37
+ caseId,
38
+ currentGroup: String(this.calumaOptions.currentGroupId),
39
+ createTask: this.config.controls.createTask,
40
+ completeTask: this.config.controls.completeTask,
41
+ inquiryTask: this.config.inquiry.task,
42
+ },
43
+ });
44
+ }
45
+
46
+ @dropTask
47
+ *fetchNavigation(caseId) {
48
+ const response = yield this.apollo.watchQuery({
49
+ query: inquiryNavigationQuery,
50
+ variables: {
51
+ caseId,
52
+ task: this.config.inquiry.task,
53
+ currentGroup: String(this.calumaOptions.currentGroupId),
54
+ statusQuestion: this.config.inquiry.answer.statusQuestion,
55
+ deadlineQuestion: this.config.inquiry.deadlineQuestion,
56
+ includeNavigationData: true,
57
+ },
58
+ });
59
+
60
+ getObservable(response).subscribe(({ data }) => {
61
+ const groupIds = [
62
+ ...new Set(
63
+ Object.values(data)
64
+ .map((inquiries) => {
65
+ return inquiries.edges.map((edge) => [
66
+ ...edge.node.addressedGroups,
67
+ ...edge.node.controllingGroups,
68
+ ]);
69
+ })
70
+ .flat(2)
71
+ ),
72
+ ];
73
+
74
+ // Resolve all involved groups with the scheduler each time the query is
75
+ // updated. This will only trigger requests for new groups that are not in
76
+ // the cache.
77
+ this.scheduler.resolve(groupIds, "group");
78
+ });
79
+
80
+ return response;
81
+ }
82
+ }
@@ -1,8 +1,11 @@
1
- <div class="uk-text-center">
2
- <p class="uk-text-muted">{{t "caluma.distribution.empty"}}</p>
1
+ <div class="uk-text-center uk-text-muted">
2
+ {{svg-jar "distribution" class="uk-inline" width=200}}
3
+ <p class="uk-margin-medium uk-margin-remove-horizontal">
4
+ {{t "caluma.distribution.empty"}}
5
+ </p>
3
6
  {{#if (can "create inquiry of distribution")}}
4
- <LinkTo @route="new" class="uk-margin-top">
5
- {{t "caluma.distribution.create"}}
7
+ <LinkTo @route="new" class="uk-button uk-button-primary">
8
+ {{t "caluma.distribution.start"}}
6
9
  </LinkTo>
7
10
  {{/if}}
8
11
  </div>
@@ -2,6 +2,7 @@ export default function uniqueByGroups(workItems) {
2
2
  return [
3
3
  ...new Map(
4
4
  workItems
5
+ .filter((workItem) => workItem.status !== "CANCELED")
5
6
  .map((workItem) => {
6
7
  return [
7
8
  JSON.stringify({
@@ -1 +1 @@
1
- export { default } from "@projectcaluma/ember-distribution/services/caluma-distribution-controls";
1
+ export { default } from "@projectcaluma/ember-distribution/services/distribution";
package/index.js CHANGED
@@ -3,20 +3,21 @@
3
3
  // eslint-disable-next-line node/no-unpublished-require
4
4
  const { buildEngine } = require("ember-engines/lib/engine-addon");
5
5
 
6
- const ioniconsBase = require
7
- .resolve("ionicons")
8
- .split("/")
9
- .slice(0, -1)
10
- .join("/");
6
+ const name = require("./package").name;
11
7
 
12
- module.exports = buildEngine({
13
- name: require("./package").name,
8
+ const ioniconAssets = [
9
+ ...require.resolve("ionicons").split("/").slice(0, -1),
10
+ "svg",
11
+ ].join("/");
14
12
 
15
- lazyLoading: {
16
- enabled: false,
17
- },
13
+ const publicAssets = [
14
+ ...require.resolve(name).split("/").slice(0, -1),
15
+ "public",
16
+ "assets",
17
+ ].join("/");
18
18
 
19
- svgJar: {
20
- sourceDirs: [`${ioniconsBase}/svg`],
21
- },
19
+ module.exports = buildEngine({
20
+ name,
21
+ lazyLoading: { enabled: false },
22
+ svgJar: { sourceDirs: [ioniconAssets, publicAssets] },
22
23
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@projectcaluma/ember-distribution",
3
- "version": "1.0.0-beta.5",
3
+ "version": "1.0.0-beta.6",
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/string": "^3.0.0",
21
22
  "@embroider/macros": "^1.5.0",
22
23
  "@glimmer/component": "^1.0.4",
23
24
  "@glimmer/tracking": "^1.0.4",
24
- "@projectcaluma/ember-core": "^11.0.0-beta.5",
25
- "@projectcaluma/ember-form": "^11.0.0-beta.13",
26
- "@projectcaluma/ember-workflow": "^11.0.0-beta.5",
27
- "ember-apollo-client": "^3.2.0",
25
+ "@projectcaluma/ember-core": "^11.0.0-beta.6",
26
+ "@projectcaluma/ember-form": "^11.0.0-beta.16",
27
+ "@projectcaluma/ember-workflow": "^11.0.0-beta.6",
28
+ "ember-apollo-client": "^4.0.2",
28
29
  "ember-auto-import": "^2.4.0",
29
30
  "ember-can": "^4.1.0",
30
31
  "ember-cli-babel": "^7.26.11",
@@ -37,8 +38,9 @@
37
38
  "ember-resources": "^4.4.0",
38
39
  "ember-svg-jar": "^2.3.4",
39
40
  "ember-test-selectors": "^6.0.0",
40
- "ember-uikit": "^5.0.0",
41
+ "ember-uikit": "^5.1.1",
41
42
  "graphql": "^15.8.0",
43
+ "graphql-tag": "^2.12.6",
42
44
  "ionicons": "^6.0.1",
43
45
  "lodash.merge": "^4.6.2",
44
46
  "luxon": "^2.3.1",
@@ -48,8 +50,8 @@
48
50
  "@ember/optional-features": "2.0.0",
49
51
  "@ember/test-helpers": "2.6.0",
50
52
  "@embroider/test-setup": "1.5.0",
51
- "@faker-js/faker": "6.0.0-beta.0",
52
- "@projectcaluma/ember-testing": "11.0.0-beta.4",
53
+ "@faker-js/faker": "6.0.0",
54
+ "@projectcaluma/ember-testing": "11.0.0-beta.5",
53
55
  "broccoli-asset-rev": "3.0.0",
54
56
  "ember-cli": "3.28.5",
55
57
  "ember-cli-code-coverage": "1.0.3",
@@ -0,0 +1 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" xml:space="preserve" style="enable-background:new 0 0 512 512" viewBox="0 0 512 512"><path d="M477.867 102.4c-18.825 0-34.133 15.309-34.133 34.133s15.309 34.133 34.133 34.133S512 155.358 512 136.533c0-18.824-15.309-34.133-34.133-34.133zm0 51.2c-9.412 0-17.067-7.654-17.067-17.067 0-9.412 7.654-17.067 17.067-17.067s17.067 7.654 17.067 17.067c-.001 9.413-7.655 17.067-17.067 17.067zM34.133 384C15.309 384 0 399.309 0 418.133s15.309 34.133 34.133 34.133c18.825 0 34.133-15.309 34.133-34.133S52.958 384 34.133 384zm0 51.2c-9.412 0-17.067-7.654-17.067-17.067s7.654-17.067 17.067-17.067c9.412 0 17.067 7.654 17.067 17.067S43.546 435.2 34.133 435.2z"/><path d="m461.321 113.186-73.617-35.541c-4.25-2.057-9.344-.265-11.392 3.977-2.048 4.241-.265 9.344 3.977 11.392l73.617 35.541c1.195.58 2.458.853 3.703.853 3.174 0 6.221-1.775 7.688-4.83 2.048-4.241.265-9.344-3.976-11.392zM384 443.733c-18.825 0-34.133 15.309-34.133 34.133S365.175 512 384 512c18.825 0 34.133-15.309 34.133-34.133S402.825 443.733 384 443.733zm0 51.2c-9.412 0-17.067-7.654-17.067-17.067S374.588 460.8 384 460.8c9.412 0 17.067 7.654 17.067 17.067s-7.655 17.066-17.067 17.066z"/><path d="m367.454 454.52-73.617-35.541c-4.25-2.057-9.344-.273-11.392 3.977-2.048 4.241-.265 9.344 3.977 11.392l73.617 35.541c1.195.58 2.458.853 3.703.853 3.174 0 6.221-1.775 7.689-4.83 2.047-4.242.264-9.344-3.977-11.392zM256 230.4c-18.825 0-34.133 15.309-34.133 34.133 0 18.825 15.309 34.133 34.133 34.133 18.825 0 34.133-15.309 34.133-34.133 0-18.824-15.308-34.133-34.133-34.133zm0 51.2c-9.412 0-17.067-7.654-17.067-17.067 0-9.412 7.654-17.067 17.067-17.067 9.412 0 17.067 7.654 17.067 17.067S265.412 281.6 256 281.6z"/><path d="m240.998 242.142-56.55-44.075c-3.721-2.876-9.079-2.236-11.981 1.485-2.893 3.721-2.236 9.079 1.485 11.981l56.55 44.075c1.562 1.212 3.405 1.801 5.24 1.801 2.543 0 5.052-1.126 6.741-3.285 2.893-3.722 2.236-9.081-1.485-11.982zM409.6 221.867c-51.755 0-93.867 42.112-93.867 93.867s42.112 93.867 93.867 93.867 93.867-42.112 93.867-93.867-42.112-93.867-93.867-93.867zm0 170.666c-42.351 0-76.8-34.449-76.8-76.8s34.449-76.8 76.8-76.8 76.8 34.449 76.8 76.8-34.449 76.8-76.8 76.8z"/><path d="M409.6 256c-18.825 0-34.133 15.309-34.133 34.133 0 18.825 15.309 34.133 34.133 34.133 18.825 0 34.133-15.309 34.133-34.133S428.425 256 409.6 256zm0 51.2c-9.412 0-17.067-7.654-17.067-17.067 0-9.412 7.654-17.067 17.067-17.067 9.412 0 17.067 7.654 17.067 17.067S419.012 307.2 409.6 307.2zM434.355 341.333h-49.51c-14.583 0-26.445 11.546-26.445 25.728v22.494c0 3.046 1.621 5.862 4.258 7.39C376.96 405.222 393.19 409.6 409.6 409.6s32.64-4.378 46.942-12.655c2.637-1.519 4.258-4.344 4.258-7.381V367.07c0-14.191-11.861-25.737-26.445-25.737zm9.378 43.136c-21.239 10.581-47.027 10.581-68.267 0V367.07c0-4.779 4.207-8.67 9.378-8.67h49.51c5.171 0 9.378 3.891 9.378 8.67v17.399zM204.8 324.267c-51.755 0-93.867 42.112-93.867 93.867S153.045 512 204.8 512s93.867-42.112 93.867-93.867-42.112-93.866-93.867-93.866zm0 170.666c-42.351 0-76.8-34.449-76.8-76.8s34.449-76.8 76.8-76.8 76.8 34.449 76.8 76.8-34.449 76.8-76.8 76.8z"/><path d="M204.8 358.4c-18.825 0-34.133 15.309-34.133 34.133 0 18.825 15.309 34.133 34.133 34.133s34.133-15.309 34.133-34.133c0-18.824-15.308-34.133-34.133-34.133zm0 51.2c-9.412 0-17.067-7.654-17.067-17.067 0-9.412 7.654-17.067 17.067-17.067 9.412 0 17.067 7.654 17.067 17.067S214.212 409.6 204.8 409.6zM229.555 443.733h-49.51c-14.583 0-26.445 11.546-26.445 25.728v22.494c0 3.046 1.621 5.862 4.258 7.39C172.16 507.622 188.39 512 204.8 512s32.64-4.378 46.942-12.655c2.637-1.519 4.258-4.343 4.258-7.381V469.47c0-14.191-11.861-25.737-26.445-25.737zm9.378 43.136c-21.24 10.581-47.027 10.581-68.267 0V469.47c0-4.779 4.207-8.67 9.378-8.67h49.51c5.171 0 9.378 3.891 9.378 8.67v17.399zM93.867 110.933C42.112 110.933 0 153.045 0 204.8s42.112 93.867 93.867 93.867 93.867-42.112 93.867-93.867c-.001-51.755-42.113-93.867-93.867-93.867zm0 170.667c-42.351 0-76.8-34.449-76.8-76.8s34.449-76.8 76.8-76.8 76.8 34.449 76.8 76.8-34.449 76.8-76.8 76.8z"/><path d="M93.867 145.067c-18.825 0-34.133 15.309-34.133 34.133s15.309 34.133 34.133 34.133c18.825 0 34.133-15.309 34.133-34.133s-15.309-34.133-34.133-34.133zm0 51.2c-9.412 0-17.067-7.654-17.067-17.067s7.654-17.067 17.067-17.067c9.412 0 17.067 7.654 17.067 17.067s-7.655 17.067-17.067 17.067zM118.622 230.4h-49.51c-14.583 0-26.445 11.546-26.445 25.728v22.494c0 3.046 1.621 5.862 4.258 7.39 14.302 8.277 30.532 12.655 46.942 12.655s32.64-4.378 46.942-12.655c2.637-1.519 4.258-4.344 4.258-7.381v-22.494c0-14.191-11.862-25.737-26.445-25.737zM128 273.536c-21.239 10.581-47.027 10.581-68.267 0v-17.399c0-4.779 4.207-8.67 9.378-8.67h49.51c5.171 0 9.378 3.891 9.378 8.67v17.399zM298.667 0C246.912 0 204.8 42.112 204.8 93.867s42.112 93.867 93.867 93.867 93.867-42.112 93.867-93.867C392.533 42.112 350.421 0 298.667 0zm0 170.667c-42.351 0-76.8-34.449-76.8-76.8s34.449-76.8 76.8-76.8 76.8 34.449 76.8 76.8-34.449 76.8-76.8 76.8z"/><path d="M298.667 34.133c-18.825 0-34.133 15.309-34.133 34.133s15.309 34.133 34.133 34.133S332.8 87.091 332.8 68.267s-15.309-34.134-34.133-34.134zm0 51.2c-9.412 0-17.067-7.654-17.067-17.067 0-9.412 7.654-17.067 17.067-17.067s17.067 7.654 17.067 17.067c-.001 9.413-7.655 17.067-17.067 17.067zM323.422 119.467h-49.51c-14.583 0-26.445 11.546-26.445 25.728v22.494c0 3.046 1.621 5.862 4.258 7.39 14.302 8.277 30.532 12.655 46.942 12.655s32.64-4.378 46.942-12.655c2.637-1.519 4.258-4.344 4.258-7.381v-22.494c0-14.192-11.862-25.737-26.445-25.737zm9.378 43.136c-21.239 10.581-47.027 10.581-68.267 0v-17.399c0-4.779 4.207-8.67 9.378-8.67h49.51c5.171 0 9.378 3.891 9.378 8.67v17.399zM219.827 88.311c-3.063-3.567-8.448-3.994-12.032-.93l-59.136 50.603c-3.584 3.063-4.002 8.448-.939 12.032 1.69 1.971 4.079 2.987 6.485 2.987 1.963 0 3.934-.674 5.547-2.057l59.136-50.603c3.585-3.063 4.003-8.448.939-12.032z"/><path d="m407.893 225.289-51.2-68.267c-2.825-3.78-8.175-4.523-11.947-1.707-3.772 2.825-4.531 8.175-1.707 11.938l51.2 68.267c1.681 2.236 4.241 3.413 6.835 3.413 1.775 0 3.576-.555 5.112-1.707 3.772-2.824 4.532-8.174 1.707-11.937zM337.86 343.953c-2.825-3.772-8.175-4.531-11.947-1.707l-47.667 35.746c-3.772 2.825-4.531 8.175-1.707 11.938 1.681 2.236 4.241 3.413 6.835 3.413 1.783 0 3.575-.563 5.112-1.707l47.667-35.746c3.772-2.823 4.532-8.174 1.707-11.937zM119.467 409.6H59.733c-4.71 0-8.533 3.814-8.533 8.533s3.823 8.533 8.533 8.533h59.733c4.71 0 8.533-3.814 8.533-8.533s-3.822-8.533-8.532-8.533zM93.867 0C75.042 0 59.733 15.309 59.733 34.133c0 18.825 15.309 34.133 34.133 34.133 18.825 0 34.133-15.309 34.133-34.133C128 15.309 112.691 0 93.867 0zm0 51.2c-9.412 0-17.067-7.654-17.067-17.067 0-9.412 7.654-17.067 17.067-17.067 9.412 0 17.067 7.654 17.067 17.067-.001 9.413-7.655 17.067-17.067 17.067z"/><path d="M93.867 51.2c-4.71 0-8.533 3.814-8.533 8.533v59.733c0 4.719 3.823 8.533 8.533 8.533 4.71 0 8.533-3.814 8.533-8.533V59.733c0-4.719-3.823-8.533-8.533-8.533z"/></svg>
@@ -1,7 +1,10 @@
1
1
  caluma:
2
2
  distribution:
3
- empty: "Es gibt noch keine Anfragen."
4
- create: "Erstellen Sie die Erste jetzt!"
3
+ empty: "Es wurden noch keine Anfragen erstellt."
4
+ start: "Starten"
5
+ send: "Offene Anfragen versenden"
6
+ send-confirm: "Wollen Sie wirklich alle offenen Anfragen versenden?"
7
+ send-error: "Fehler beim Versenden der offenen Anfragen"
5
8
 
6
9
  edit:
7
10
  title: "Anfrage bearbeiten"
@@ -49,3 +52,9 @@ caluma:
49
52
  subtitle: "Seite nicht gefunden!"
50
53
  back: "Zurück zur"
51
54
  link: "Startseite"
55
+
56
+ withdraw:
57
+ link: "Zurückziehen"
58
+ confirm: "Wollen Sie die Anfrage wirklich zurückziehen?"
59
+ error: "Fehler beim Zurückziehen der Anfrage"
60
+ status: "Zurückgezogen"
@@ -1,7 +1,10 @@
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
+ send-error: "Error while sending pending inquiries"
5
8
 
6
9
  edit:
7
10
  title: "Edit inquiry"
@@ -49,3 +52,9 @@ caluma:
49
52
  subtitle: "Page not found!"
50
53
  back: "Go back to the"
51
54
  link: "landing page"
55
+
56
+ withdraw:
57
+ link: "Withdraw"
58
+ confirm: "Do you really want to withdraw the inquiry?"
59
+ error: "Error while withdrawing the inquiry"
60
+ status: "Withdrawn"
@@ -1,7 +1,10 @@
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
+ send-error: "Erreur lors de l'envoi des demandes ouvertes"
5
8
 
6
9
  edit:
7
10
  title: "Modifier la demande"
@@ -49,3 +52,9 @@ caluma:
49
52
  subtitle: "Page non trouvée !"
50
53
  back: "Retour à"
51
54
  link: "la page d'accueil"
55
+
56
+ withdraw:
57
+ link: "Retirer"
58
+ confirm: "Voulez-vous vraiment retirer la demande ?"
59
+ error: "Erreur lors du retrait de la demande"
60
+ status: "Retirée"
@@ -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
- }