@projectcaluma/ember-distribution 12.5.0 → 12.7.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.
@@ -14,7 +14,7 @@ export default class DistributionAbility extends Ability {
14
14
  get canSendInquiries() {
15
15
  return (
16
16
  !this.config.ui.readonly &&
17
- (this.config.permissions.sendInquiry?.(null) ?? true) &&
17
+ (this.config.permissions.sendInquiry?.(this.distribution) ?? true) &&
18
18
  this.distribution.controls.value?.send.edges.filter(
19
19
  hasStatus("SUSPENDED"),
20
20
  ).length > 0
@@ -24,7 +24,7 @@ export default class DistributionAbility extends Ability {
24
24
  get canCreateInquiry() {
25
25
  return (
26
26
  !this.config.ui.readonly &&
27
- (this.config.permissions.createInquiry?.() ?? true) &&
27
+ (this.config.permissions.createInquiry?.(this.distribution) ?? true) &&
28
28
  this.distribution.controls.value?.create.edges.filter(hasStatus("READY"))
29
29
  .length > 0
30
30
  );
@@ -33,7 +33,7 @@ export default class DistributionAbility extends Ability {
33
33
  get canCheckInquiries() {
34
34
  return (
35
35
  !this.config.ui.readonly &&
36
- (this.config.permissions.checkInquiries?.() ?? true) &&
36
+ (this.config.permissions.checkInquiries?.(this.distribution) ?? true) &&
37
37
  this.distribution.controls.value?.check.edges.filter(hasStatus("READY"))
38
38
  .length > 0
39
39
  );
@@ -42,7 +42,8 @@ export default class DistributionAbility extends Ability {
42
42
  get canComplete() {
43
43
  return (
44
44
  !this.config.ui.readonly &&
45
- (this.config.permissions.completeDistribution?.() ?? true) &&
45
+ (this.config.permissions.completeDistribution?.(this.distribution) ??
46
+ true) &&
46
47
  this.distribution.controls.value?.complete.edges.filter(
47
48
  hasStatus("READY"),
48
49
  ).length > 0
@@ -52,7 +53,8 @@ export default class DistributionAbility extends Ability {
52
53
  get canReopen() {
53
54
  return (
54
55
  !this.config.ui.readonly &&
55
- (this.config.permissions.reopenDistribution?.() ?? true) &&
56
+ (this.config.permissions.reopenDistribution?.(this.distribution) ??
57
+ true) &&
56
58
  this.distribution.controls.value?.case.edges[0]?.node.parentWorkItem.addressedGroups
57
59
  .map(String)
58
60
  .includes(String(this.calumaOptions.currentGroupId)) &&
@@ -59,7 +59,12 @@ export default class CdInquiryDialogInquiryPartComponent extends Component {
59
59
 
60
60
  return this.args.type === "answer"
61
61
  ? this.args.inquiry.childCase.document.info.edges
62
- .filter((edge) => !isEmpty(edge.node.value))
62
+ .filter(
63
+ (edge) =>
64
+ !isEmpty(edge.node.value) ||
65
+ !isEmpty(edge.node.selectedOption) ||
66
+ !isEmpty(edge.node.selectedOptions),
67
+ )
63
68
  .sort(
64
69
  (a, b) =>
65
70
  questions.indexOf(a.node.question.slug) -
@@ -67,7 +72,11 @@ export default class CdInquiryDialogInquiryPartComponent extends Component {
67
72
  )
68
73
  .map((edge) => ({
69
74
  question: edge.node.question.label,
70
- value: edge.node.value,
75
+ value: edge.node.selectedOption // single choice answer
76
+ ? edge.node.selectedOption.label
77
+ : edge.node.selectedOptions // multiple choice answer
78
+ ? edge.node.selectedOptions.edges.map((edge) => edge.node.label)
79
+ : edge.node.value, // regular answer
71
80
  }))
72
81
  : null;
73
82
  }
@@ -0,0 +1,23 @@
1
+ {{! template-lint-disable require-presentational-children }}
2
+ <tr
3
+ class="uk-background-muted uk-text-bold"
4
+ role="button"
5
+ {{on "click" (fn (mut this.isExpanded) (not this.isExpanded))}}
6
+ data-test-group-type={{@type.name}}
7
+ >
8
+ <td colspan="3" class="">
9
+ <div class="uk-flex uk-flex-between">
10
+ {{t @type.name}}
11
+ <UkIcon @icon={{if this.isExpanded "chevron-up" "chevron-down"}} />
12
+ </div>
13
+ </td>
14
+ </tr>
15
+ {{#if this.isExpanded}}
16
+ {{#each @type.groups as |group|}}
17
+ <CdInquiryNewForm::Group
18
+ @group={{group}}
19
+ @selectedGroups={{@selectedGroups}}
20
+ @updateSelectedGroups={{@updateSelectedGroups}}
21
+ />
22
+ {{/each}}
23
+ {{/if}}
@@ -0,0 +1,15 @@
1
+ import Component from "@glimmer/component";
2
+ import { tracked } from "@glimmer/tracking";
3
+
4
+ export default class CdInquiryNewFormGroupTypeComponent extends Component {
5
+ @tracked _isExpanded = true;
6
+
7
+ get isExpanded() {
8
+ // if we are searching all the groups need to be expanded anyway
9
+ return this.args.search !== "" ? true : this._isExpanded;
10
+ }
11
+
12
+ set isExpanded(value) {
13
+ this._isExpanded = value;
14
+ }
15
+ }
@@ -0,0 +1,25 @@
1
+ {{! template-lint-disable require-presentational-children }}
2
+ <tr
3
+ role="checkbox"
4
+ data-test-group={{@group.identifier}}
5
+ aria-checked={{includes @group.identifier @selectedGroups}}
6
+ {{on "click" (fn @updateSelectedGroups @group.identifier)}}
7
+ >
8
+ <td class="uk-padding-remove-right">
9
+ {{! template-lint-disable require-input-label no-nested-interactive }}
10
+ <input
11
+ type="checkbox"
12
+ class="uk-checkbox"
13
+ checked={{includes @group.identifier @selectedGroups}}
14
+ />
15
+ </td>
16
+ <td class="uk-width-expand">{{group-name @group.identifier}}</td>
17
+ <td class="uk-text-right">
18
+ {{#if @group.config.icon}}
19
+ <UkIcon
20
+ @icon={{@group.config.icon}}
21
+ class="uk-display-block uk-text-{{@group.config.iconColor}}"
22
+ />
23
+ {{/if}}
24
+ </td>
25
+ </tr>
@@ -1,15 +1,17 @@
1
- <div class="uk-margin-bottom uk-button-group">
2
- {{#each-in this.config.new.types as |slug config|}}
3
- {{#unless config.disabled}}
4
- <UkButton
5
- data-test-type={{slug}}
6
- @label={{t config.label}}
7
- @color={{if (includes slug @selectedTypes) "primary" "default"}}
8
- @onClick={{fn this.updateSelectedTypes slug}}
9
- />
10
- {{/unless}}
11
- {{/each-in}}
12
- </div>
1
+ {{#unless this.showAllServices}}
2
+ <div class="uk-margin-bottom uk-button-group" data-test-group-toggle-bar>
3
+ {{#each-in this.config.new.types as |slug config|}}
4
+ {{#unless config.disabled}}
5
+ <UkButton
6
+ data-test-type={{slug}}
7
+ @label={{t config.label}}
8
+ @color={{if (includes slug @selectedTypes) "primary" "default"}}
9
+ @onClick={{fn this.updateSelectedTypes slug}}
10
+ />
11
+ {{/unless}}
12
+ {{/each-in}}
13
+ </div>
14
+ {{/unless}}
13
15
 
14
16
  <div class="uk-search uk-search-default uk-width-1-1">
15
17
  <span class="uk-search-icon-flip" uk-search-icon></span>
@@ -30,36 +32,30 @@
30
32
  </div>
31
33
  {{else if this.groups.value.length}}
32
34
  <table
33
- class="uk-table uk-table-striped uk-table-hover uk-table-small uk-table-middle group-list"
35
+ class={{concat
36
+ "uk-table uk-table-hover uk-table-small uk-table-middle group-list "
37
+ (if this.showAllServices "uk-table-divider" "uk-table-striped")
38
+ }}
34
39
  >
35
40
  <tbody>
36
- {{#each this.groups.value as |group|}}
37
- {{! template-lint-disable require-presentational-children }}
38
- <tr
39
- role="checkbox"
40
- data-test-group={{group.identifier}}
41
- aria-checked={{includes group.identifier @selectedGroups}}
42
- {{on "click" (fn this.updateSelectedGroups group.identifier)}}
43
- >
44
- <td class="uk-padding-remove-right">
45
- {{! template-lint-disable require-input-label no-nested-interactive }}
46
- <input
47
- type="checkbox"
48
- class="uk-checkbox"
49
- checked={{includes group.identifier @selectedGroups}}
50
- />
51
- </td>
52
- <td class="uk-width-expand">{{group-name group.identifier}}</td>
53
- <td class="uk-text-right">
54
- {{#if group.config.icon}}
55
- <UkIcon
56
- @icon={{group.config.icon}}
57
- class="uk-display-block uk-text-{{group.config.iconColor}}"
58
- />
59
- {{/if}}
60
- </td>
61
- </tr>
62
- {{/each}}
41
+ {{#if this.showAllServices}}
42
+ {{#each this.groupTypes as |type|}}
43
+ <CdInquiryNewForm::GroupType
44
+ @type={{type}}
45
+ @selectedGroups={{@selectedGroups}}
46
+ @updateSelectedGroups={{this.updateSelectedGroups}}
47
+ @search={{@search}}
48
+ />
49
+ {{/each}}
50
+ {{else}}
51
+ {{#each this.groups.value as |group|}}
52
+ <CdInquiryNewForm::Group
53
+ @group={{group}}
54
+ @selectedGroups={{@selectedGroups}}
55
+ @updateSelectedGroups={{this.updateSelectedGroups}}
56
+ />
57
+ {{/each}}
58
+ {{/if}}
63
59
  </tbody>
64
60
  </table>
65
61
  {{else}}
@@ -20,8 +20,28 @@ export default class CdInquiryNewFormSelectComponent extends Component {
20
20
 
21
21
  @config config;
22
22
 
23
+ get showAllServices() {
24
+ return this.config.ui?.new?.showAllServices;
25
+ }
26
+
27
+ get groupTypes() {
28
+ return Object.entries(this.config.new.types)
29
+ .filter(([, { disabled }]) => !disabled)
30
+ .map(([identifier, group]) => ({
31
+ identifier,
32
+ name: group.label,
33
+ config: group.config,
34
+ groups: this.groups?.value?.filter(
35
+ (group) => group.type === identifier,
36
+ ),
37
+ }));
38
+ }
39
+
23
40
  groups = trackedTask(this, this.fetchGroups, () => [
24
- this.args.selectedTypes,
41
+ // if we want to show all services we need to fetch all groups
42
+ this.showAllServices
43
+ ? Object.keys(this.config.new.types)
44
+ : this.args.selectedTypes,
25
45
  this.args.search,
26
46
  ]);
27
47
 
@@ -69,6 +89,7 @@ export default class CdInquiryNewFormSelectComponent extends Component {
69
89
  identifier: group[this.calumaOptions.groupIdentifierProperty],
70
90
  name: group[this.calumaOptions.groupNameProperty],
71
91
  config: this.config.new.types[type],
92
+ type,
72
93
  }));
73
94
  })
74
95
  .sort((a, b) => a.name.localeCompare(b.name));
@@ -1,8 +1,16 @@
1
- <p class="cd-truncated" ...attributes>
2
- {{~this.displayedText~}}
3
- {{#if this.truncate}}
4
- <a href="" {{on "click" this.toggleExpand}}>
5
- {{~t (concat "caluma.distribution." (if this.expand "less" "more"))~}}
6
- </a>
7
- {{/if}}
8
- </p>
1
+ {{#if (is-array @text)}}
2
+ <UkList @bullet={{true}} class="uk-margin-remove" ...attributes as |list|>
3
+ {{#each @text as |item|}}
4
+ <list.item>{{item}}</list.item>
5
+ {{/each}}
6
+ </UkList>
7
+ {{else}}
8
+ <p class="cd-truncated" ...attributes>
9
+ {{~this.displayedText~}}
10
+ {{#if this.truncate}}
11
+ <a href="" {{on "click" this.toggleExpand}}>
12
+ {{~t (concat "caluma.distribution." (if this.expand "less" "more"))~}}
13
+ </a>
14
+ {{/if}}
15
+ </p>
16
+ {{/if}}
@@ -52,6 +52,18 @@ fragment InquiryAnswer on Document {
52
52
  }
53
53
  ... on StringAnswer {
54
54
  value
55
+ selectedOption {
56
+ label
57
+ }
58
+ }
59
+ ... on ListAnswer {
60
+ selectedOptions {
61
+ edges {
62
+ node {
63
+ label
64
+ }
65
+ }
66
+ }
55
67
  }
56
68
  }
57
69
  }
@@ -1,7 +1,17 @@
1
1
  <div class="uk-text-center uk-text-muted">
2
2
  {{svg-jar "distribution" class="uk-inline" width=200}}
3
3
  <p class="uk-margin-medium uk-margin-remove-horizontal">
4
- {{t "caluma.distribution.empty"}}
4
+ {{#if
5
+ (or
6
+ (can "create inquiry of distribution")
7
+ (can "complete distribution")
8
+ (can "reopen distribution")
9
+ )
10
+ }}
11
+ {{t "caluma.distribution.empty"}}
12
+ {{else}}
13
+ {{t "caluma.distribution.no-actions"}}
14
+ {{/if}}
5
15
  </p>
6
16
  <CdNavigation::Controls @useButtons={{true}} />
7
17
  </div>
@@ -35,10 +35,10 @@ function decorator(
35
35
  color: isDone
36
36
  ? "muted"
37
37
  : isOverdue
38
- ? "danger"
39
- : isWarning
40
- ? "warning"
41
- : "emphasis",
38
+ ? "danger"
39
+ : isWarning
40
+ ? "warning"
41
+ : "emphasis",
42
42
  };
43
43
  },
44
44
  };
@@ -67,12 +67,12 @@ function decorator(
67
67
  const statusConfig = isSkipped
68
68
  ? INQUIRY_STATUS.SKIPPED
69
69
  : isInProgress
70
- ? INQUIRY_STATUS.IN_PROGRESS
71
- : isDraft
72
- ? INQUIRY_STATUS.DRAFT
73
- : isSent
74
- ? INQUIRY_STATUS.SENT
75
- : this.config.inquiry.answer.statusMapping[answer.value];
70
+ ? INQUIRY_STATUS.IN_PROGRESS
71
+ : isDraft
72
+ ? INQUIRY_STATUS.DRAFT
73
+ : isSent
74
+ ? INQUIRY_STATUS.SENT
75
+ : this.config.inquiry.answer.statusMapping[answer.value];
76
76
 
77
77
  return {
78
78
  slug: statusConfig.slug,
@@ -0,0 +1 @@
1
+ export { default } from "@projectcaluma/ember-distribution/components/cd-inquiry-new-form/group-type";
@@ -0,0 +1 @@
1
+ export { default } from "@projectcaluma/ember-distribution/components/cd-inquiry-new-form/group";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@projectcaluma/ember-distribution",
3
- "version": "12.5.0",
3
+ "version": "12.7.0",
4
4
  "description": "Ember engine for the Caluma distribution module.",
5
5
  "keywords": [
6
6
  "ember-addon",
@@ -10,70 +10,86 @@
10
10
  "homepage": "https://docs.caluma.io/ember-caluma",
11
11
  "repository": "github:projectcaluma/ember-caluma",
12
12
  "dependencies": {
13
- "@ember/legacy-built-in-components": "^0.4.2",
13
+ "@babel/core": "^7.23.6",
14
+ "@ember/legacy-built-in-components": "^0.5.0",
14
15
  "@ember/string": "^3.1.1",
15
- "@embroider/macros": "^1.13.0",
16
+ "@embroider/macros": "^1.13.3",
16
17
  "@glimmer/component": "^1.1.2",
17
18
  "@glimmer/tracking": "^1.1.2",
18
19
  "ember-apollo-client": "~4.0.2",
19
- "ember-auto-import": "^2.6.3",
20
+ "ember-auto-import": "^2.7.0",
20
21
  "ember-can": "^4.2.0",
21
- "ember-cli-babel": "^7.26.11",
22
- "ember-cli-htmlbars": "^6.2.0",
23
- "ember-concurrency": "^3.0.0",
24
- "ember-engines-router-service": "^0.3.0",
22
+ "ember-cli-babel": "^8.2.0",
23
+ "ember-cli-htmlbars": "^6.3.0",
24
+ "ember-concurrency": "^3.1.1",
25
+ "ember-engines-router-service": "^0.5.0",
25
26
  "ember-fetch": "^8.1.2",
26
27
  "ember-flatpickr": "^4.0.0",
27
- "ember-intl": "^5.7.2",
28
- "ember-resources": "^6.4.0",
29
- "ember-svg-jar": "^2.4.3",
28
+ "ember-intl": "^6.4.0",
29
+ "ember-resources": "^6.4.2",
30
+ "ember-svg-jar": "^2.4.7",
30
31
  "ember-test-selectors": "^6.0.0",
31
- "ember-uikit": "^8.0.0",
32
+ "ember-uikit": "^9.0.0",
32
33
  "graphql": "^15.8.0",
33
34
  "graphql-tag": "^2.12.6",
34
35
  "lodash.merge": "^4.6.2",
35
- "luxon": "^3.3.0",
36
+ "luxon": "^3.4.4",
36
37
  "tracked-toolbox": "^2.0.0",
37
- "@projectcaluma/ember-core": "^12.5.0",
38
- "@projectcaluma/ember-form": "^12.5.0",
39
- "@projectcaluma/ember-workflow": "^12.5.0"
38
+ "@projectcaluma/ember-core": "^12.7.0",
39
+ "@projectcaluma/ember-workflow": "^12.7.0",
40
+ "@projectcaluma/ember-form": "^12.7.0"
40
41
  },
41
42
  "devDependencies": {
42
43
  "@ember/optional-features": "2.0.0",
43
- "@ember/test-helpers": "3.2.0",
44
- "@embroider/test-setup": "3.0.1",
45
- "@faker-js/faker": "8.0.2",
44
+ "@ember/test-helpers": "3.2.1",
45
+ "@embroider/test-setup": "3.0.3",
46
+ "@faker-js/faker": "8.3.1",
46
47
  "broccoli-asset-rev": "3.0.0",
47
- "ember-cli": "4.12.2",
48
- "ember-cli-code-coverage": "2.0.0",
48
+ "ember-cli": "5.5.0",
49
+ "ember-cli-clean-css": "3.0.0",
50
+ "ember-cli-code-coverage": "2.0.3",
49
51
  "ember-cli-dependency-checker": "3.3.2",
50
52
  "ember-cli-inject-live-reload": "2.1.0",
51
- "ember-cli-mirage": "3.0.0-alpha.3",
53
+ "ember-cli-mirage": "3.0.2",
52
54
  "ember-cli-sass": "11.0.1",
53
55
  "ember-cli-sri": "2.1.1",
54
56
  "ember-cli-terser": "4.0.2",
55
57
  "ember-engines": "0.9.0",
56
58
  "ember-load-initializers": "2.1.2",
57
- "ember-qunit": "7.0.0",
58
- "ember-resolver": "11.0.0",
59
- "ember-source": "4.12.3",
59
+ "ember-qunit": "8.0.2",
60
+ "ember-resolver": "11.0.1",
61
+ "ember-source": "5.5.0",
60
62
  "ember-source-channel-url": "3.0.0",
61
- "ember-try": "2.0.0",
63
+ "ember-try": "3.0.0",
62
64
  "loader.js": "4.7.0",
63
- "miragejs": "0.1.47",
64
- "qunit": "2.19.4",
65
- "qunit-dom": "2.0.0",
66
- "sass": "1.66.0",
67
- "uikit": "3.16.26",
68
- "webpack": "5.88.2",
69
- "@projectcaluma/ember-testing": "12.5.0"
65
+ "miragejs": "0.1.48",
66
+ "qunit": "2.20.0",
67
+ "qunit-dom": "3.0.0",
68
+ "sass": "1.69.5",
69
+ "uikit": "3.17.11",
70
+ "webpack": "5.89.0",
71
+ "@projectcaluma/ember-testing": "12.7.0"
70
72
  },
71
73
  "peerDependencies": {
72
74
  "ember-engines": "^0.9.0",
73
75
  "ember-source": "^4.0.0"
74
76
  },
77
+ "dependenciesMeta": {
78
+ "@projectcaluma/ember-core": {
79
+ "injected": true
80
+ },
81
+ "@projectcaluma/ember-form": {
82
+ "injected": true
83
+ },
84
+ "@projectcaluma/ember-testing": {
85
+ "injected": true
86
+ },
87
+ "@projectcaluma/ember-workflow": {
88
+ "injected": true
89
+ }
90
+ },
75
91
  "engines": {
76
- "node": "14.* || 16.* || >= 18"
92
+ "node": ">= 18"
77
93
  },
78
94
  "ember": {
79
95
  "edition": "octane"
@@ -1,6 +1,7 @@
1
1
  caluma:
2
2
  distribution:
3
3
  empty: "Es wurden noch keine Anfragen erstellt."
4
+ no-actions: "Im aktuellen Zustand stehen keine Aktionen zur Verfügung."
4
5
  start: "Zirkulation starten"
5
6
  send: "Offene Anfragen versenden"
6
7
  complete: "Zirkulation abschliessen"
@@ -1,6 +1,7 @@
1
1
  caluma:
2
2
  distribution:
3
3
  empty: "No inquiries have been created yet."
4
+ no-actions: "There are no actions available in the current state."
4
5
  start: "Start circulation"
5
6
  send: "Send pending inquiries"
6
7
  complete: "Complete circulation"
@@ -1,6 +1,7 @@
1
1
  caluma:
2
2
  distribution:
3
3
  empty: "Aucune demande n'a encore été créée."
4
+ no-actions: "Aucune action n'est disponible dans l'état actuel."
4
5
  start: "Lancer la procédure de circulation"
5
6
  send: "Envoyer les demandes ouvertes"
6
7
  complete: "Clore la circulation"
@@ -0,0 +1,10 @@
1
+ {
2
+ "extends": "./tsconfig.json",
3
+ "compilerOptions": {
4
+ "declarationDir": "declarations",
5
+ "emitDeclarationOnly": true,
6
+ "noEmit": false,
7
+ "rootDir": "."
8
+ },
9
+ "include": ["addon", "addon-test-support"]
10
+ }