@projectcaluma/ember-distribution 14.11.1 → 14.13.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -91,7 +91,7 @@
91
91
  )
92
92
  }}
93
93
  @onClick={{fn
94
- (perform this.completeWorkItem)
94
+ this.completeWorkItem.perform
95
95
  buttonConfig.workItemId
96
96
  buttonConfig.willCompleteInquiry
97
97
  validate
@@ -115,7 +115,7 @@
115
115
  )
116
116
  }}
117
117
  @onClick={{fn
118
- (perform this.completeWorkItem)
118
+ this.completeWorkItem.perform
119
119
  buttonConfig.workItemId
120
120
  buttonConfig.willCompleteInquiry
121
121
  null
@@ -56,7 +56,7 @@
56
56
  <li>
57
57
  <a
58
58
  href=""
59
- {{on "click" (perform this.withdraw)}}
59
+ {{on "click" this.withdraw.perform}}
60
60
  data-test-withdraw
61
61
  >
62
62
  {{t "caluma.distribution.withdraw.link"}}
@@ -76,7 +76,7 @@
76
76
  {{/if}}
77
77
  {{#if (and (eq @type "answer") (can "reopen inquiry" @inquiry))}}
78
78
  <li>
79
- <a href="" {{on "click" (perform this.reopen)}} data-test-reopen>
79
+ <a href="" {{on "click" this.reopen.perform}} data-test-reopen>
80
80
  {{t "caluma.distribution.reopen-inquiry.link"}}
81
81
  </a>
82
82
  </li>
@@ -86,7 +86,7 @@
86
86
  <a
87
87
  data-test-send-reminder
88
88
  href=""
89
- {{on "click" (perform this.sendReminder)}}
89
+ {{on "click" this.sendReminder.perform}}
90
90
  >
91
91
  {{t "caluma.distribution.reminder.link"}}
92
92
  </a>
@@ -10,7 +10,7 @@
10
10
  class="uk-icon-button"
11
11
  {{uk-tooltip (t "caluma.distribution.new.title")}}
12
12
  data-test-new-inquiry
13
- {{on "click" (perform this.createInquiry)}}
13
+ {{on "click" this.createInquiry.perform}}
14
14
  >
15
15
  {{#if this.createInquiry.isRunning}}
16
16
  <UkSpinner @ratio={{0.6}} />
@@ -53,7 +53,7 @@
53
53
  this.send.isRunning
54
54
  this.distribution.sendAllInquiries.isRunning
55
55
  }}
56
- @onClick={{perform this.send validate}}
56
+ @onClick={{fn this.send.perform validate}}
57
57
  @loading={{this.send.isRunning}}
58
58
  >{{t "caluma.distribution.edit.send"}}</UkButton>
59
59
  </DocumentValidity>
@@ -18,7 +18,7 @@
18
18
  @type="submit"
19
19
  @loading={{this.submit.isRunning}}
20
20
  @disabled={{or (not isValid) this.submit.isRunning}}
21
- @onClick={{perform this.submit validate}}
21
+ @onClick={{fn this.submit.perform validate}}
22
22
  data-test-submit
23
23
  />
24
24
  </DocumentValidity>
@@ -24,6 +24,50 @@ export default class CdInquiryNewFormBulkEditComponent extends Component {
24
24
 
25
25
  answers = {};
26
26
 
27
+ /**
28
+ * Build the global JEXL context of the inquiry document.
29
+ *
30
+ * Neither the document nor its work item exist in the backend while the form
31
+ * is being filled out, so `documentGlobalJexlContext` can't be used here. The
32
+ * case comes from the controls query, the work item is the one
33
+ * `createInquiry` is about to create.
34
+ *
35
+ * @async
36
+ * @private
37
+ * @method #buildJexlContext
38
+ * @returns {Promise<Object>} The "faked" JEXL context for the bulk edit form
39
+ */
40
+ async #buildJexlContext() {
41
+ await this.distribution.controls;
42
+
43
+ const _case = this.distribution.controls.value?.case.edges[0]?.node;
44
+ // A case without a family is its own root, same as in the backend
45
+ const root = _case?.family ?? _case;
46
+
47
+ return {
48
+ info: {
49
+ case: _case
50
+ ? {
51
+ form: _case.document?.form.slug ?? null,
52
+ workflow: _case.workflow.slug,
53
+ meta: _case.meta,
54
+ root: {
55
+ form: root.document?.form.slug ?? null,
56
+ workflow: root.workflow.slug,
57
+ meta: root.meta,
58
+ },
59
+ }
60
+ : null,
61
+ workItem: {
62
+ task: this.config.inquiry.task,
63
+ meta: await this.calumaOptions.distributionInquiryWorkItemMeta(
64
+ this.args.selectedGroups,
65
+ ),
66
+ },
67
+ },
68
+ };
69
+ }
70
+
27
71
  document = trackedFunction(this, async () => {
28
72
  // Fetch the full form (like in cf-content) of the inquiry task
29
73
  const response = await this.apollo.query({
@@ -34,6 +78,7 @@ export default class CdInquiryNewFormBulkEditComponent extends Component {
34
78
  });
35
79
  const form = response.allTasks.edges[0].node.form;
36
80
  const answers = { edges: [] };
81
+ const jexlContext = await this.#buildJexlContext();
37
82
 
38
83
  // If we configured a default deadline lead time, we need to calculate the
39
84
  // deadline that should be displayed in the form per default and add it to
@@ -69,6 +114,7 @@ export default class CdInquiryNewFormBulkEditComponent extends Component {
69
114
  __typename: "Document",
70
115
  answers,
71
116
  form,
117
+ jexlContext,
72
118
  });
73
119
 
74
120
  const owner = getOwner(this);
@@ -22,7 +22,7 @@
22
22
  type="search"
23
23
  value={{@search}}
24
24
  data-test-search
25
- {{on "input" (perform this.updateSearch)}}
25
+ {{on "input" this.updateSearch.perform}}
26
26
  />
27
27
  </div>
28
28
 
@@ -19,7 +19,7 @@
19
19
  {{/if}}
20
20
  {{#if (can "complete distribution")}}
21
21
  <UkButton
22
- @onClick={{perform this.completeDistribution}}
22
+ @onClick={{this.completeDistribution.perform}}
23
23
  @label={{t "caluma.distribution.skip"}}
24
24
  @loading={{this.completeDistribution.isRunning}}
25
25
  @disabled={{this.completeDistribution.isRunning}}
@@ -28,7 +28,7 @@
28
28
  {{/if}}
29
29
  {{#if (can "reopen distribution")}}
30
30
  <UkButton
31
- @onClick={{perform this.reopenDistribution}}
31
+ @onClick={{this.reopenDistribution.perform}}
32
32
  @label={{t "caluma.distribution.reopen"}}
33
33
  @loading={{this.reopenDistribution.isRunning}}
34
34
  @disabled={{this.reopenDistribution.isRunning}}
@@ -44,7 +44,7 @@
44
44
  class="uk-icon-button uk-button-primary"
45
45
  {{uk-tooltip (t "caluma.distribution.send")}}
46
46
  data-test-send-pending-inquiries
47
- {{on "click" (perform this.distribution.sendAllInquiries)}}
47
+ {{on "click" this.distribution.sendAllInquiries.perform}}
48
48
  >
49
49
  {{#if this.distribution.sendAllInquiries.isRunning}}
50
50
  <UkSpinner @ratio={{0.6}} />
@@ -69,7 +69,7 @@
69
69
  class="uk-icon-button"
70
70
  {{uk-tooltip (t "caluma.distribution.check-inquiries")}}
71
71
  data-test-check-inquiries
72
- {{on "click" (perform this.checkInquiries)}}
72
+ {{on "click" this.checkInquiries.perform}}
73
73
  >
74
74
  {{#if this.checkInquiries.isRunning}}
75
75
  <UkSpinner @ratio={{0.6}} />
@@ -84,7 +84,7 @@
84
84
  class="uk-icon-button"
85
85
  {{uk-tooltip (t "caluma.distribution.complete")}}
86
86
  data-test-complete-distribution
87
- {{on "click" (perform this.completeDistribution)}}
87
+ {{on "click" this.completeDistribution.perform}}
88
88
  >
89
89
  {{#if this.completeDistribution.isRunning}}
90
90
  <UkSpinner @ratio={{0.6}} />
@@ -99,7 +99,7 @@
99
99
  class="uk-icon-button"
100
100
  {{uk-tooltip (t "caluma.distribution.reopen")}}
101
101
  data-test-reopen-distribution
102
- {{on "click" (perform this.reopenDistribution)}}
102
+ {{on "click" this.reopenDistribution.perform}}
103
103
  >
104
104
  {{#if this.reopenDistribution.isRunning}}
105
105
  <UkSpinner @ratio={{0.6}} />
@@ -76,6 +76,37 @@ query Controls(
76
76
  isRedoable
77
77
  addressedGroups
78
78
  }
79
+ # A new inquiry document doesn't exist in the backend yet, so its
80
+ # global JEXL context can't be fetched via `documentGlobalJexlContext`
81
+ # and has to be assembled from the case.
82
+ # See `#buildJexlContext` in `cd-inquiry-new-form/bulk-edit.js`
83
+ meta
84
+ workflow {
85
+ id
86
+ slug
87
+ }
88
+ document {
89
+ id
90
+ form {
91
+ id
92
+ slug
93
+ }
94
+ }
95
+ family {
96
+ id
97
+ meta
98
+ workflow {
99
+ id
100
+ slug
101
+ }
102
+ document {
103
+ id
104
+ form {
105
+ id
106
+ slug
107
+ }
108
+ }
109
+ }
79
110
  }
80
111
  }
81
112
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@projectcaluma/ember-distribution",
3
- "version": "14.11.1",
3
+ "version": "14.13.0",
4
4
  "description": "Ember engine for the Caluma distribution module.",
5
5
  "keywords": [
6
6
  "ember-addon",
@@ -35,9 +35,9 @@
35
35
  "luxon": "^3.5.0",
36
36
  "reactiveweb": "^1.3.0",
37
37
  "tracked-toolbox": "^2.0.0",
38
- "@projectcaluma/ember-core": "^14.11.1",
39
- "@projectcaluma/ember-workflow": "^14.11.1",
40
- "@projectcaluma/ember-form": "^14.11.1"
38
+ "@projectcaluma/ember-core": "^14.13.0",
39
+ "@projectcaluma/ember-workflow": "^14.13.0",
40
+ "@projectcaluma/ember-form": "^14.13.0"
41
41
  },
42
42
  "devDependencies": {
43
43
  "@ember/optional-features": "2.3.0",
@@ -68,7 +68,7 @@
68
68
  "sass": "1.97.3",
69
69
  "uikit": "3.25.6",
70
70
  "webpack": "5.104.1",
71
- "@projectcaluma/ember-testing": "14.11.1"
71
+ "@projectcaluma/ember-testing": "14.13.0"
72
72
  },
73
73
  "peerDependencies": {
74
74
  "ember-engines": "^0.11.0",