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

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.12](https://github.com/projectcaluma/ember-caluma/compare/@projectcaluma/ember-distribution-v1.0.0-beta.11...@projectcaluma/ember-distribution-v1.0.0-beta.12) (2022-06-09)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * **distribution:** fix selection of groups with the checkbox ([9f028dc](https://github.com/projectcaluma/ember-caluma/commit/9f028dc6ec16214249f43e519280397131006e7c))
7
+ * **distribution:** refetch inquiry answer after work-item completion ([60cfaca](https://github.com/projectcaluma/ember-caluma/commit/60cfaca04d94a44efc4950eeb1aecee767b4eeb5))
8
+
9
+
10
+ ### Features
11
+
12
+ * **distribution:** add configurable status for unanswered inquiries ([e08247f](https://github.com/projectcaluma/ember-caluma/commit/e08247f6e2b73f859011f4eac7ffff71f101f546))
13
+
1
14
  # [@projectcaluma/ember-distribution-v1.0.0-beta.11](https://github.com/projectcaluma/ember-caluma/compare/@projectcaluma/ember-distribution-v1.0.0-beta.10...@projectcaluma/ember-distribution-v1.0.0-beta.11) (2022-05-13)
2
15
 
3
16
 
@@ -1,10 +1,7 @@
1
1
  <p class="uk-text-large uk-margin-remove">
2
2
  {{@name}}
3
- {{#if @isDraft}}
4
- <UkLabel
5
- @label={{t "caluma.distribution.status.draft"}}
6
- class="uk-margin-left"
7
- />
3
+ {{#if @status}}
4
+ <UkLabel @label={{@status}} class="uk-margin-left" />
8
5
  {{/if}}
9
6
  </p>
10
7
 
@@ -8,7 +8,7 @@
8
8
  <div class="uk-position-relative">
9
9
  <CdDocumentHeader
10
10
  @name={{content.document.rootForm.raw.name}}
11
- @isDraft={{eq this.inquiry.status "READY"}}
11
+ @status={{if (eq this.inquiry.status "READY") this.answerStatus}}
12
12
  @modifiedAt={{this.inquiry.childCase.document.modifiedContentAt}}
13
13
  @modifiedBy={{this.inquiry.childCase.document.modifiedContentByUser}}
14
14
  />
@@ -1,6 +1,6 @@
1
1
  import { inject as service } from "@ember/service";
2
2
  import Component from "@glimmer/component";
3
- import { queryManager } from "ember-apollo-client";
3
+ import { queryManager, getObservable } from "ember-apollo-client";
4
4
  import { dropTask } from "ember-concurrency";
5
5
  import { trackedTask } from "ember-resources/util/ember-concurrency";
6
6
 
@@ -8,6 +8,7 @@ import { decodeId } from "@projectcaluma/ember-core/helpers/decode-id";
8
8
  import config from "@projectcaluma/ember-distribution/config";
9
9
  import completeInquiryWorkItemMutation from "@projectcaluma/ember-distribution/gql/mutations/complete-inquiry-work-item.graphql";
10
10
  import inquiryAnswerQuery from "@projectcaluma/ember-distribution/gql/queries/inquiry-answer.graphql";
11
+ import inquiryAnswerStatus from "@projectcaluma/ember-distribution/utils/inquiry-answer-status";
11
12
 
12
13
  export default class CdInquiryAnswerFormComponent extends Component {
13
14
  @service intl;
@@ -19,6 +20,8 @@ export default class CdInquiryAnswerFormComponent extends Component {
19
20
 
20
21
  @queryManager apollo;
21
22
 
23
+ @inquiryAnswerStatus({ inquiryProperty: "inquiry" }) answerStatus;
24
+
22
25
  _inquiry = trackedTask(this, this.fetchInquiryAnswer, () => [
23
26
  this.args.inquiry,
24
27
  ]);
@@ -79,6 +82,7 @@ export default class CdInquiryAnswerFormComponent extends Component {
79
82
  },
80
83
  });
81
84
 
85
+ yield getObservable(this._inquiry.value)?.refetch();
82
86
  yield this.router.transitionTo("inquiry.index");
83
87
  } catch (error) {
84
88
  this.notification.danger(
@@ -1,8 +1,16 @@
1
1
  <div class="uk-margin-remove-last-child">
2
- <p class="uk-flex uk-flex-middle uk-text-large uk-margin-remove">
2
+ <p
3
+ class="uk-flex uk-flex-middle uk-text-large uk-margin-remove"
4
+ data-test-title
5
+ >
3
6
  {{#if (eq @type "request")}}
4
7
  <UkIcon @icon="forward" class="uk-margin-small-right" />
5
8
  {{group-name @inquiry.controllingGroups}}
9
+ {{#if
10
+ (and (can "answer inquiry" @inquiry) (not @disabled) this.answerStatus)
11
+ }}
12
+ <UkLabel @label={{this.answerStatus}} class="uk-margin-left" />
13
+ {{/if}}
6
14
  {{else if (eq @type "answer")}}
7
15
  <UkIcon @icon="reply" class="uk-margin-small-right" />
8
16
  {{group-name @inquiry.addressedGroups}}
@@ -8,6 +8,7 @@ import { confirm } from "ember-uikit";
8
8
  import { decodeId } from "@projectcaluma/ember-core/helpers/decode-id";
9
9
  import config from "@projectcaluma/ember-distribution/config";
10
10
  import withdrawInquiryMutation from "@projectcaluma/ember-distribution/gql/mutations/withdraw-inquiry.graphql";
11
+ import inquiryAnswerStatus from "@projectcaluma/ember-distribution/utils/inquiry-answer-status";
11
12
 
12
13
  export default class CdInquiryDialogInquiryPartComponent extends Component {
13
14
  @service notification;
@@ -18,6 +19,8 @@ export default class CdInquiryDialogInquiryPartComponent extends Component {
18
19
 
19
20
  @config config;
20
21
 
22
+ @inquiryAnswerStatus answerStatus;
23
+
21
24
  get date() {
22
25
  const key = this.args.type === "request" ? "createdAt" : "closedAt";
23
26
 
@@ -47,6 +47,7 @@ export default class CdInquiryDialogComponent extends Component {
47
47
  deadlineQuestion: this.config.inquiry.deadlineQuestion,
48
48
  statusQuestion: this.config.inquiry.answer.statusQuestion,
49
49
  answerInfoQuestions: this.config.inquiry.answer.infoQuestions,
50
+ buttonTasks: Object.keys(this.config.inquiry.answer.buttons),
50
51
  includeNavigationData: true,
51
52
  },
52
53
  });
@@ -6,7 +6,10 @@
6
6
  <:default as |content|>
7
7
  <CdDocumentHeader
8
8
  @name={{content.document.rootForm.raw.name}}
9
- @isDraft={{eq this.inquiry.status "SUSPENDED"}}
9
+ @status={{if
10
+ (eq this.inquiry.status "SUSPENDED")
11
+ (t "caluma.distribution.status.draft")
12
+ }}
10
13
  @modifiedAt={{this.inquiry.document.modifiedContentAt}}
11
14
  @modifiedBy={{this.inquiry.document.modifiedContentByUser}}
12
15
  />
@@ -80,34 +80,38 @@
80
80
  <UkSpinner @ratio={{2}} />
81
81
  </div>
82
82
  {{else if this.groups.value.length}}
83
- <ul class="uk-list uk-list-striped">
84
- {{#each this.groups.value as |group|}}
85
- {{! template-lint-disable require-presentational-children }}
86
- <li
87
- role="checkbox"
88
- class="uk-flex uk-flex-between uk-flex-middle"
89
- data-test-group={{group.identifier}}
90
- {{on "click" (fn this.updateSelectedGroups group.identifier)}}
91
- >
92
- {{! template-lint-disable no-nested-interactive }}
93
- <label for="group-{{group.identifier}}">
94
- <input
95
- type="checkbox"
96
- class="uk-checkbox uk-margin-small-right"
97
- checked={{includes group.identifier this.selectedGroups}}
98
- id="group-{{group.identifier}}"
99
- />
100
- {{group-name group.identifier}}
101
- </label>
102
- {{#if group.config.icon}}
103
- <UkIcon
104
- @icon={{group.config.icon}}
105
- class="uk-text-{{group.config.iconColor}}"
106
- />
107
- {{/if}}
108
- </li>
109
- {{/each}}
110
- </ul>
83
+ <table
84
+ class="uk-table uk-table-striped uk-table-hover uk-table-small uk-table-middle group-list"
85
+ >
86
+ <tbody>
87
+ {{#each this.groups.value as |group|}}
88
+ {{! template-lint-disable require-presentational-children }}
89
+ <tr
90
+ role="checkbox"
91
+ data-test-group={{group.identifier}}
92
+ {{on "click" (fn this.updateSelectedGroups group.identifier)}}
93
+ >
94
+ <td class="uk-padding-remove-right">
95
+ {{! template-lint-disable require-input-label no-nested-interactive }}
96
+ <input
97
+ type="checkbox"
98
+ class="uk-checkbox"
99
+ checked={{includes group.identifier this.selectedGroups}}
100
+ />
101
+ </td>
102
+ <td class="uk-width-expand">{{group-name group.identifier}}</td>
103
+ <td class="uk-text-right">
104
+ {{#if group.config.icon}}
105
+ <UkIcon
106
+ @icon={{group.config.icon}}
107
+ class="uk-display-block uk-text-{{group.config.iconColor}}"
108
+ />
109
+ {{/if}}
110
+ </td>
111
+ </tr>
112
+ {{/each}}
113
+ </tbody>
114
+ </table>
111
115
  {{else}}
112
116
  <div class="uk-text-center">
113
117
  <UkIcon @icon="search" @ratio={{10}} class="uk-margin-top" />
@@ -44,9 +44,7 @@ export default class CdInquiryNewFormComponent extends Component {
44
44
  }
45
45
 
46
46
  @action
47
- updateSelectedGroups(identifier, e) {
48
- e.preventDefault();
49
-
47
+ updateSelectedGroups(identifier) {
50
48
  this.selectedGroups = toggle(identifier, this.selectedGroups);
51
49
  }
52
50
 
package/addon/config.js CHANGED
@@ -38,20 +38,22 @@ export default function config(target, property) {
38
38
  buttons: {
39
39
  "compose-inquiry-answer": {
40
40
  color: "primary",
41
- label: "caluma.distribution.answer.release-for-review",
41
+ label: "caluma.distribution.answer.buttons.compose.label",
42
+ status: "caluma.distribution.answer.buttons.compose.status",
42
43
  },
43
44
  "confirm-inquiry-answer": {
44
45
  color: "primary",
45
- label: "caluma.distribution.answer.confirm",
46
+ label: "caluma.distribution.answer.buttons.confirm.label",
47
+ status: "caluma.distribution.answer.buttons.confirm.status",
46
48
  },
47
49
  "revise-inquiry-answer": {
48
50
  color: "default",
49
- label: "caluma.distribution.answer.revise",
51
+ label: "caluma.distribution.answer.buttons.revise.label",
50
52
  },
51
53
  "adjust-inquiry-answer": {
52
54
  color: "primary",
53
- label:
54
- "caluma.distribution.answer.release-adjustment-for-review",
55
+ label: "caluma.distribution.answer.buttons.adjust.label",
56
+ status: "caluma.distribution.answer.buttons.adjust.status",
55
57
  },
56
58
  },
57
59
  },
@@ -1,3 +1,18 @@
1
+ fragment InquiryAnswerButtons on Case {
2
+ workItems(tasks: $buttonTasks, status: READY) {
3
+ edges {
4
+ node {
5
+ id
6
+ status
7
+ task {
8
+ id
9
+ slug
10
+ }
11
+ }
12
+ }
13
+ }
14
+ }
15
+
1
16
  fragment InquiryDeadlineDocument on Document {
2
17
  id
3
18
  deadline: answers(question: $deadlineQuestion) {
@@ -61,6 +76,7 @@ fragment InquiryDialog on WorkItem {
61
76
  }
62
77
  childCase {
63
78
  id
79
+ ...InquiryAnswerButtons
64
80
  document {
65
81
  ...InquiryStatusDocument
66
82
  info: answers(questions: $answerInfoQuestions) {
@@ -1,4 +1,4 @@
1
- #import InquiryDeadlineDocument, InquiryRequest from '../fragments/inquiry.graphql'
1
+ #import InquiryAnswerButtons, InquiryDeadlineDocument, InquiryRequest from '../fragments/inquiry.graphql'
2
2
 
3
3
  query InquiryAnswer(
4
4
  $inquiry: ID!
@@ -14,6 +14,7 @@ query InquiryAnswer(
14
14
  addressedGroups
15
15
  controllingGroups
16
16
  createdAt
17
+ closedAt
17
18
  task {
18
19
  id
19
20
  slug
@@ -29,17 +30,7 @@ query InquiryAnswer(
29
30
  modifiedContentAt
30
31
  modifiedContentByUser
31
32
  }
32
- workItems(tasks: $buttonTasks, status: READY) {
33
- edges {
34
- node {
35
- id
36
- task {
37
- id
38
- slug
39
- }
40
- }
41
- }
42
- }
33
+ ...InquiryAnswerButtons
43
34
  }
44
35
  }
45
36
  }
@@ -1,7 +1,8 @@
1
- #import InquiryDialog, InquiryDeadlineDocument, InquiryStatusDocument, InquiryRequest from '../fragments/inquiry.graphql'
1
+ #import InquiryAnswerButtons, InquiryDialog, InquiryDeadlineDocument, InquiryStatusDocument, InquiryRequest from '../fragments/inquiry.graphql'
2
2
 
3
3
  query InquiryDialog(
4
4
  $task: ID!
5
+ $buttonTasks: [String]!
5
6
  $statusQuestion: ID!
6
7
  $deadlineQuestion: ID!
7
8
  $infoQuestion: ID!
@@ -0,0 +1,34 @@
1
+ import { assert } from "@ember/debug";
2
+ import { get } from "@ember/object";
3
+
4
+ import { createDecorator } from "@projectcaluma/ember-distribution/-private/decorator";
5
+
6
+ function decorator(
7
+ target,
8
+ key,
9
+ desc,
10
+ { inquiryProperty = "args.inquiry" } = {}
11
+ ) {
12
+ assert(
13
+ `The @projectcaluma/ember-distribution config must be injected in order to use @inquiryAnswerStatus: \`@config config\``,
14
+ Object.prototype.hasOwnProperty.call(target, "config")
15
+ );
16
+
17
+ return {
18
+ get() {
19
+ const inquiry = get(this, inquiryProperty);
20
+ const readyWorkItems =
21
+ inquiry.childCase?.workItems.edges
22
+ .filter((edge) => edge.node.status === "READY")
23
+ .map((edge) => edge.node.task.slug) ?? [];
24
+
25
+ const buttonConfig = Object.entries(
26
+ this.config.inquiry.answer.buttons
27
+ ).find(([task]) => readyWorkItems.includes(task))?.[1];
28
+
29
+ return buttonConfig?.status ? this.intl.t(buttonConfig.status) : null;
30
+ },
31
+ };
32
+ }
33
+
34
+ export default createDecorator(decorator);
@@ -1,3 +1,4 @@
1
1
  @import "../answer-form";
2
+ @import "../group-list";
2
3
  @import "../inquiry-divider";
3
4
  @import "../truncated";
@@ -0,0 +1,7 @@
1
+ .group-list tr {
2
+ cursor: pointer;
3
+
4
+ > td:last-of-type svg {
5
+ min-width: 20px;
6
+ }
7
+ }
@@ -0,0 +1 @@
1
+ export { default } from "@projectcaluma/ember-distribution/utils/inquiry-answer-status";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@projectcaluma/ember-distribution",
3
- "version": "1.0.0-beta.11",
3
+ "version": "1.0.0-beta.12",
4
4
  "description": "Ember engine for the Caluma distribution module.",
5
5
  "keywords": [
6
6
  "ember-addon",
@@ -19,14 +19,14 @@
19
19
  },
20
20
  "dependencies": {
21
21
  "@ember/string": "^3.0.0",
22
- "@embroider/macros": "^1.6.0",
22
+ "@embroider/macros": "^1.7.1",
23
23
  "@glimmer/component": "^1.1.2",
24
24
  "@glimmer/tracking": "^1.1.2",
25
25
  "@projectcaluma/ember-core": "^11.0.0-beta.7",
26
- "@projectcaluma/ember-form": "^11.0.0-beta.19",
26
+ "@projectcaluma/ember-form": "^11.0.0-beta.20",
27
27
  "@projectcaluma/ember-workflow": "^11.0.0-beta.7",
28
28
  "ember-apollo-client": "^4.0.2",
29
- "ember-auto-import": "^2.4.1",
29
+ "ember-auto-import": "^2.4.2",
30
30
  "ember-can": "^4.2.0",
31
31
  "ember-cli-babel": "^7.26.11",
32
32
  "ember-cli-htmlbars": "^6.0.1",
@@ -35,7 +35,7 @@
35
35
  "ember-fetch": "^8.1.1",
36
36
  "ember-intl": "^5.7.2",
37
37
  "ember-pikaday": "^4.0.0",
38
- "ember-resources": "^4.7.1",
38
+ "ember-resources": "^4.8.2",
39
39
  "ember-svg-jar": "^2.3.4",
40
40
  "ember-test-selectors": "^6.0.0",
41
41
  "ember-uikit": "^5.1.3",
@@ -47,9 +47,9 @@
47
47
  },
48
48
  "devDependencies": {
49
49
  "@ember/optional-features": "2.0.0",
50
- "@ember/test-helpers": "2.7.0",
51
- "@embroider/test-setup": "1.6.0",
52
- "@faker-js/faker": "6.3.1",
50
+ "@ember/test-helpers": "2.8.1",
51
+ "@embroider/test-setup": "1.7.1",
52
+ "@faker-js/faker": "7.2.0",
53
53
  "@projectcaluma/ember-testing": "11.0.0-beta.8",
54
54
  "broccoli-asset-rev": "3.0.0",
55
55
  "ember-cli": "3.28.5",
@@ -71,12 +71,12 @@
71
71
  "ember-source-channel-url": "3.0.0",
72
72
  "ember-try": "2.0.0",
73
73
  "loader.js": "4.7.0",
74
- "miragejs": "0.1.44",
74
+ "miragejs": "0.1.45",
75
75
  "npm-run-all": "4.1.5",
76
76
  "qunit": "2.19.1",
77
77
  "qunit-dom": "2.0.0",
78
- "sass": "1.51.0",
79
- "webpack": "5.72.1"
78
+ "sass": "1.52.3",
79
+ "webpack": "5.73.0"
80
80
  },
81
81
  "engines": {
82
82
  "node": "12.* || 14.* || >= 16"
@@ -29,14 +29,23 @@ caluma:
29
29
 
30
30
  answer:
31
31
  link: "Beantworten"
32
- release-for-review: "Zur Kontrolle freigeben"
33
- release-adjustment-for-review: "Anpassung zur Kontrolle freigeben"
34
- confirm: "Bestätigen"
35
- revise: "Überarbeiten"
36
32
 
37
33
  complete-error: "Fehler beim Abschliessen der Aufgabe"
38
34
  complete-not-allowed: "Sie sind nicht berechtigt diese Antwort zu versenden."
39
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"
48
+
40
49
  new:
41
50
  title: "Neue Anfrage"
42
51
  search: "Suchen..."
@@ -30,14 +30,23 @@ caluma:
30
30
 
31
31
  answer:
32
32
  link: "Answer"
33
- release-for-review: "Release for review"
34
- release-adjustment-for-review: "Release adjustment for review"
35
- confirm: "Confirm"
36
- revise: "Revise"
37
33
 
38
34
  complete-error: "Error while completing the work item"
39
35
  complete-not-allowed: "You are not allowed to send this inquiry answer."
40
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"
49
+
41
50
  new:
42
51
  title: "New inquiry"
43
52
  search: "Search..."
@@ -29,14 +29,23 @@ caluma:
29
29
 
30
30
  answer:
31
31
  link: "Répondre"
32
- release-for-review: "Valider pour vérification"
33
- release-adjustment-for-review: "Valider la révision pour vérification"
34
- confirm: "Confirmer"
35
- revise: "Réviser"
36
32
 
37
33
  complete-error: "Erreur lors de la clôture de la tâche"
38
34
  complete-not-allowed: "Vous n'êtes pas autorisé à envoyer cette réponse."
39
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"
48
+
40
49
  new:
41
50
  title: "Nouvelle demande"
42
51
  search: "Chercher..."