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

Sign up to get free protection for your applications and to get access to all the features.
Files changed (62) hide show
  1. package/CHANGELOG.md +38 -0
  2. package/addon/abilities/distribution.js +29 -0
  3. package/addon/components/distribution-navigation/controls.hbs +14 -12
  4. package/addon/components/distribution-navigation/controls.js +0 -36
  5. package/addon/components/distribution-navigation/item.hbs +1 -1
  6. package/addon/components/distribution-navigation/item.js +1 -1
  7. package/addon/components/distribution-navigation/section.hbs +8 -6
  8. package/addon/components/distribution-navigation.hbs +1 -1
  9. package/addon/components/distribution-navigation.js +10 -5
  10. package/addon/components/inquiry-answer-form.hbs +33 -31
  11. package/addon/components/inquiry-answer-form.js +1 -1
  12. package/addon/components/inquiry-dialog/inquiry-deadline.hbs +14 -6
  13. package/addon/components/inquiry-dialog/inquiry-divider.hbs +2 -1
  14. package/addon/components/inquiry-dialog/inquiry-part.hbs +13 -10
  15. package/addon/components/inquiry-dialog/inquiry-part.js +4 -0
  16. package/addon/components/inquiry-dialog/inquiry.hbs +4 -1
  17. package/addon/components/inquiry-dialog/inquiry.js +4 -0
  18. package/addon/components/inquiry-dialog.hbs +8 -6
  19. package/addon/components/inquiry-edit-form.hbs +21 -19
  20. package/addon/components/inquiry-edit-form.js +2 -1
  21. package/addon/components/inquiry-new-form.hbs +113 -102
  22. package/addon/components/inquiry-new-form.js +20 -20
  23. package/addon/components/notfound.hbs +12 -0
  24. package/addon/config.js +1 -0
  25. package/addon/controllers/application.js +7 -0
  26. package/addon/controllers/{distribution/new.js → new.js} +1 -1
  27. package/addon/gql/queries/control-work-items.graphql +18 -2
  28. package/addon/modifiers/pikaday.js +2 -0
  29. package/addon/routes/{distribution.js → application.js} +1 -1
  30. package/addon/routes/{distribution/index.js → index.js} +2 -2
  31. package/addon/routes/inquiry/detail/answer.js +7 -0
  32. package/addon/routes/inquiry/detail/index.js +7 -0
  33. package/addon/routes/{distribution/inquiry → inquiry}/detail.js +1 -1
  34. package/addon/routes/inquiry/index.js +10 -0
  35. package/addon/routes/{distribution/inquiry.js → inquiry.js} +1 -1
  36. package/addon/routes/new.js +7 -0
  37. package/addon/routes/notfound.js +3 -0
  38. package/addon/routes.js +5 -6
  39. package/addon/services/caluma-distribution-controls.js +37 -0
  40. package/addon/templates/application.hbs +8 -0
  41. package/addon/templates/index.hbs +8 -0
  42. package/addon/templates/{distribution/inquiry → inquiry}/detail/answer.hbs +0 -0
  43. package/addon/templates/{distribution/inquiry → inquiry}/detail/index.hbs +0 -0
  44. package/addon/templates/{distribution/inquiry → inquiry}/detail.hbs +0 -0
  45. package/addon/templates/{distribution/inquiry → inquiry}/index.hbs +0 -0
  46. package/addon/templates/{distribution/inquiry.hbs → inquiry.hbs} +0 -0
  47. package/addon/templates/{distribution/new.hbs → new.hbs} +0 -0
  48. package/addon/templates/notfound.hbs +1 -0
  49. package/addon/utils/inquiry-deadline.js +5 -6
  50. package/app/abilities/distribution.js +1 -0
  51. package/app/components/notfound.js +1 -0
  52. package/app/services/caluma-distribution-controls.js +1 -0
  53. package/app/styles/_inquiry-divider.scss +22 -0
  54. package/package.json +18 -15
  55. package/translations/de.yaml +9 -0
  56. package/translations/en.yaml +9 -0
  57. package/translations/fr.yaml +9 -0
  58. package/addon/routes/distribution/inquiry/detail/answer.js +0 -7
  59. package/addon/routes/distribution/inquiry/detail/index.js +0 -7
  60. package/addon/routes/distribution/inquiry/index.js +0 -10
  61. package/addon/routes/distribution/new.js +0 -7
  62. package/addon/templates/distribution.hbs +0 -8
@@ -1,110 +1,121 @@
1
- <h1>{{t "caluma.distribution.new.title"}}</h1>
1
+ {{#if this.controls.workItems.isRunning}}
2
+ <div class="uk-text-center"><UkSpinner @ratio={{2}} /></div>
3
+ {{else if (can "create inquiry of distribution")}}
4
+ <h1>{{t "caluma.distribution.new.title"}}</h1>
2
5
 
3
- {{#if this.selectedGroups.length}}
4
- <div class="uk-flex uk-flex-middle">
5
- <div class="uk-width-expand">
6
- <button type="button" class="uk-link uk-text-light">
7
- {{t "caluma.distribution.new.groups" count=this.selectedGroups.length}}
8
- </button>
9
- <div uk-dropdown class="uk-width-auto">
10
- <ul
11
- class="uk-list uk-list-bullet uk-margin-remove uk-padding-remove"
12
- data-test-selected-groups
13
- >
14
- {{#each this.selectedGroups as |identifier|}}
15
- <li class="uk-text-nowrap">{{group-name identifier}}</li>
16
- {{/each}}
17
- </ul>
6
+ {{#if this.selectedGroups.length}}
7
+ <div class="uk-flex uk-flex-middle">
8
+ <div class="uk-width-expand">
9
+ <button type="button" class="uk-link uk-text-light">
10
+ {{t
11
+ "caluma.distribution.new.groups"
12
+ count=this.selectedGroups.length
13
+ }}
14
+ </button>
15
+ <div uk-dropdown class="uk-width-auto">
16
+ <ul
17
+ class="uk-list uk-list-bullet uk-margin-remove uk-padding-remove"
18
+ data-test-selected-groups
19
+ >
20
+ {{#each this.selectedGroups as |identifier|}}
21
+ <li class="uk-text-nowrap">{{group-name identifier}}</li>
22
+ {{/each}}
23
+ </ul>
24
+ </div>
25
+ {{t
26
+ "caluma.distribution.new.selected"
27
+ count=this.selectedGroups.length
28
+ }}
29
+ </div>
30
+ <div>
31
+ <UkButton
32
+ @label={{t "caluma.distribution.new.reset"}}
33
+ @onClick={{this.clearSelectedGroups}}
34
+ data-test-reset
35
+ />
36
+ <UkButton
37
+ @color="primary"
38
+ @label={{t "caluma.distribution.new.create-draft"}}
39
+ @type="submit"
40
+ @loading={{this.submit.isRunning}}
41
+ @disabled={{this.submit.isRunning}}
42
+ @onClick={{perform this.submit}}
43
+ data-test-submit
44
+ />
18
45
  </div>
19
- {{t "caluma.distribution.new.selected" count=this.selectedGroups.length}}
20
- </div>
21
- <div>
22
- <UkButton
23
- @color="default"
24
- @label={{t "caluma.distribution.new.reset"}}
25
- @onClick={{this.clearSelectedGroups}}
26
- data-test-reset
27
- />
28
- <UkButton
29
- @color="primary"
30
- @label={{t "caluma.distribution.new.create-draft"}}
31
- @type="submit"
32
- @loading={{this.submit.isRunning}}
33
- @disabled={{this.submit.isRunning}}
34
- @onClick={{perform this.submit}}
35
- data-test-submit
36
- />
37
46
  </div>
38
- </div>
39
- <hr />
40
- {{/if}}
41
-
42
- <div class="uk-margin-bottom uk-button-group">
43
- {{#each-in this.config.new.types as |slug config|}}
44
- {{#unless config.disabled}}
45
- <UkButton
46
- data-test-type={{slug}}
47
- @label={{t config.label}}
48
- @color={{if (includes slug @selectedTypes) "primary" "default"}}
49
- @onClick={{fn this.updateSelectedTypes slug}}
50
- />
51
- {{/unless}}
52
- {{/each-in}}
53
- </div>
47
+ <hr />
48
+ {{/if}}
54
49
 
55
- <div class="uk-search uk-search-default uk-width-1-1">
56
- <span class="uk-search-icon-flip" uk-search-icon></span>
57
- <input
58
- placeholder={{t "caluma.distribution.new.search"}}
59
- aria-label={{t "caluma.distribution.new.search"}}
60
- class="uk-search-input"
61
- type="search"
62
- value={{@search}}
63
- data-test-search
64
- {{on "input" (perform this.updateSearch)}}
65
- />
66
- </div>
50
+ <div class="uk-margin-bottom uk-button-group">
51
+ {{#each-in this.config.new.types as |slug config|}}
52
+ {{#unless config.disabled}}
53
+ <UkButton
54
+ data-test-type={{slug}}
55
+ @label={{t config.label}}
56
+ @color={{if (includes slug @selectedTypes) "primary" "default"}}
57
+ @onClick={{fn this.updateSelectedTypes slug}}
58
+ />
59
+ {{/unless}}
60
+ {{/each-in}}
61
+ </div>
67
62
 
68
- {{#if this.groups.isRunning}}
69
- <div class="uk-text-center uk-margin">
70
- <UkSpinner @ratio={{2}} />
63
+ <div class="uk-search uk-search-default uk-width-1-1">
64
+ <span class="uk-search-icon-flip" uk-search-icon></span>
65
+ <input
66
+ placeholder={{t "caluma.distribution.new.search"}}
67
+ aria-label={{t "caluma.distribution.new.search"}}
68
+ class="uk-search-input"
69
+ type="search"
70
+ value={{@search}}
71
+ data-test-search
72
+ {{on "input" (perform this.updateSearch)}}
73
+ />
71
74
  </div>
72
- {{else if this.groups.value.length}}
73
- <ul class="uk-list uk-list-striped">
74
- {{#each this.groups.value as |group|}}
75
- {{! template-lint-disable require-presentational-children }}
76
- <li
77
- role="checkbox"
78
- class="uk-flex uk-flex-between uk-flex-middle"
79
- data-test-group={{group.identifier}}
80
- {{on "click" (fn this.updateSelectedGroups group.identifier)}}
81
- >
82
- {{! template-lint-disable no-nested-interactive }}
83
- <label for="group-{{group.identifier}}">
84
- <input
85
- type="checkbox"
86
- class="uk-checkbox uk-margin-small-right"
87
- checked={{includes group.identifier this.selectedGroups}}
88
- id="group-{{group.identifier}}"
89
- />
90
- {{group-name group.identifier}}
91
- </label>
92
- {{#if group.config.icon}}
93
- {{svg-jar
94
- group.config.icon
95
- width="20"
96
- height="20"
97
- class=(concat "uk-text-" group.config.iconColor)
98
- }}
99
- {{/if}}
100
- </li>
101
- {{/each}}
102
- </ul>
75
+
76
+ {{#if this.groups.isRunning}}
77
+ <div class="uk-text-center uk-margin">
78
+ <UkSpinner @ratio={{2}} />
79
+ </div>
80
+ {{else if this.groups.value.length}}
81
+ <ul class="uk-list uk-list-striped">
82
+ {{#each this.groups.value as |group|}}
83
+ {{! template-lint-disable require-presentational-children }}
84
+ <li
85
+ role="checkbox"
86
+ class="uk-flex uk-flex-between uk-flex-middle"
87
+ data-test-group={{group.identifier}}
88
+ {{on "click" (fn this.updateSelectedGroups group.identifier)}}
89
+ >
90
+ {{! template-lint-disable no-nested-interactive }}
91
+ <label for="group-{{group.identifier}}">
92
+ <input
93
+ type="checkbox"
94
+ class="uk-checkbox uk-margin-small-right"
95
+ checked={{includes group.identifier this.selectedGroups}}
96
+ id="group-{{group.identifier}}"
97
+ />
98
+ {{group-name group.identifier}}
99
+ </label>
100
+ {{#if group.config.icon}}
101
+ {{svg-jar
102
+ group.config.icon
103
+ width="20"
104
+ height="20"
105
+ class=(concat "uk-text-" group.config.iconColor)
106
+ }}
107
+ {{/if}}
108
+ </li>
109
+ {{/each}}
110
+ </ul>
111
+ {{else}}
112
+ <div class="uk-text-center">
113
+ <UkIcon @icon="search" @ratio={{10}} class="uk-margin-top" />
114
+ <p class="uk-text-muted">
115
+ {{t "caluma.distribution.new.empty"}}
116
+ </p>
117
+ </div>
118
+ {{/if}}
103
119
  {{else}}
104
- <div class="uk-text-center">
105
- <UkIcon @icon="search" @ratio={{10}} class="uk-margin-top" />
106
- <p class="uk-text-muted">
107
- {{t "caluma.distribution.new.empty"}}
108
- </p>
109
- </div>
120
+ <Notfound />
110
121
  {{/if}}
@@ -1,5 +1,6 @@
1
1
  import { action } from "@ember/object";
2
2
  import { inject as service } from "@ember/service";
3
+ import { macroCondition, isTesting } from "@embroider/macros";
3
4
  import Component from "@glimmer/component";
4
5
  import { tracked } from "@glimmer/tracking";
5
6
  import { queryManager } from "ember-apollo-client";
@@ -9,7 +10,6 @@ import { useTask } from "ember-resources";
9
10
  import { decodeId } from "@projectcaluma/ember-core/helpers/decode-id";
10
11
  import config from "@projectcaluma/ember-distribution/config";
11
12
  import createInquiryMutation from "@projectcaluma/ember-distribution/gql/mutations/create-inquiry.graphql";
12
- import controlWorkItemsQuery from "@projectcaluma/ember-distribution/gql/queries/control-work-items.graphql";
13
13
  import inquiryNavigationQuery from "@projectcaluma/ember-distribution/gql/queries/inquiry-navigation.graphql";
14
14
 
15
15
  const toggle = (value, array) => {
@@ -25,6 +25,7 @@ export default class InquiryNewFormComponent extends Component {
25
25
  @service notification;
26
26
  @service intl;
27
27
  @service router;
28
+ @service("caluma-distribution-controls") controls;
28
29
 
29
30
  @queryManager apollo;
30
31
 
@@ -62,7 +63,12 @@ export default class InquiryNewFormComponent extends Component {
62
63
  *updateSearch(e) {
63
64
  e.preventDefault();
64
65
 
65
- yield timeout(500);
66
+ /* istanbul ignore next */
67
+ if (macroCondition(isTesting())) {
68
+ // no timeout
69
+ } else {
70
+ yield timeout(500);
71
+ }
66
72
 
67
73
  this.args.onChangeSearch(e.target.value);
68
74
  }
@@ -74,26 +80,16 @@ export default class InquiryNewFormComponent extends Component {
74
80
  if (!this.selectedGroups.length) return;
75
81
 
76
82
  try {
77
- // get create inquiry work item to complete, this will not trigger a
78
- // network request since it's already fetch in the controls
79
- const controlsData = yield this.apollo.watchQuery(
80
- {
81
- query: controlWorkItemsQuery,
82
- variables: {
83
- caseId: this.args.caseId,
84
- currentGroup: String(this.calumaOptions.currentGroupId),
85
- createTask: this.config.controls.createTask,
86
- completeTask: this.config.controls.completeTask,
87
- },
88
- },
89
- "create.edges"
83
+ // get create inquiry work item to complete
84
+ const createId = decodeId(
85
+ this.controls.workItems.value?.create.edges[0].node.id
90
86
  );
91
87
 
92
88
  // create new inquiries
93
89
  yield this.apollo.mutate({
94
90
  mutation: createInquiryMutation,
95
91
  variables: {
96
- id: decodeId(controlsData[0].node.id),
92
+ id: createId,
97
93
  context: JSON.stringify({
98
94
  addressed_groups: this.selectedGroups.map(String),
99
95
  }),
@@ -118,10 +114,14 @@ export default class InquiryNewFormComponent extends Component {
118
114
  );
119
115
 
120
116
  // transition to last added inquiry
121
- this.router.transitionTo("distribution.inquiry", {
122
- from: navigationData[0].node.controllingGroups[0],
123
- to: navigationData[0].node.addressedGroups[0],
124
- });
117
+ this.router.transitionTo(
118
+ "inquiry.detail.index",
119
+ {
120
+ from: navigationData[0].node.controllingGroups[0],
121
+ to: navigationData[0].node.addressedGroups[0],
122
+ },
123
+ decodeId(navigationData[0].node.id)
124
+ );
125
125
  } catch (e) {
126
126
  this.notification.danger(
127
127
  this.intl.t("caluma.distribution.new.error", {
@@ -0,0 +1,12 @@
1
+ <div class="uk-text-center">
2
+ <h1 class="uk-heading-xlarge">
3
+ {{t "caluma.distribution.notfound.title"}}
4
+ </h1>
5
+ <h2 class="uk-heading-small uk-margin-remove-top uk-text-muted">
6
+ {{t "caluma.distribution.notfound.subtitle"}}
7
+ </h2>
8
+ <p class="uk-text-muted">
9
+ {{t "caluma.distribution.notfound.back"}}
10
+ <LinkTo @route="index">{{t "caluma.distribution.notfound.link"}}</LinkTo>
11
+ </p>
12
+ </div>
package/addon/config.js CHANGED
@@ -15,6 +15,7 @@ export default function config(target, property) {
15
15
  get() {
16
16
  return merge(
17
17
  {
18
+ ui: { stack: false, small: false },
18
19
  controls: {
19
20
  createTask: "create-inquiry",
20
21
  completeTask: "complete-distribution",
@@ -0,0 +1,7 @@
1
+ import Controller from "@ember/controller";
2
+
3
+ import config from "@projectcaluma/ember-distribution/config";
4
+
5
+ export default class ApplicationController extends Controller {
6
+ @config config;
7
+ }
@@ -3,7 +3,7 @@ import { dedupeTracked, cached } from "tracked-toolbox";
3
3
 
4
4
  import config from "@projectcaluma/ember-distribution/config";
5
5
 
6
- export default class DistributionNewController extends Controller {
6
+ export default class NewController extends Controller {
7
7
  @config config;
8
8
 
9
9
  queryParams = ["types", "search"];
@@ -1,6 +1,7 @@
1
1
  query ControlWorkItems(
2
2
  $createTask: ID!
3
3
  $completeTask: ID!
4
+ $inquiryTask: ID!
4
5
  $caseId: ID!
5
6
  $currentGroup: String!
6
7
  ) {
@@ -11,11 +12,11 @@ query ControlWorkItems(
11
12
  { status: READY }
12
13
  { addressedGroups: [$currentGroup] }
13
14
  ]
14
- first: 1
15
15
  ) {
16
16
  edges {
17
17
  node {
18
18
  id
19
+ status
19
20
  }
20
21
  }
21
22
  }
@@ -26,11 +27,26 @@ query ControlWorkItems(
26
27
  { status: READY }
27
28
  { addressedGroups: [$currentGroup] }
28
29
  ]
29
- first: 1
30
30
  ) {
31
31
  edges {
32
32
  node {
33
33
  id
34
+ status
35
+ }
36
+ }
37
+ }
38
+ send: allWorkItems(
39
+ filter: [
40
+ { case: $caseId }
41
+ { task: $inquiryTask }
42
+ { status: SUSPENDED }
43
+ { controllingGroups: [$currentGroup] }
44
+ ]
45
+ ) {
46
+ edges {
47
+ node {
48
+ id
49
+ status
34
50
  }
35
51
  }
36
52
  }
@@ -0,0 +1,2 @@
1
+ import "ember-pikaday/pikaday.css";
2
+ export { default } from "ember-pikaday/modifiers/pikaday";
@@ -1,6 +1,6 @@
1
1
  import Route from "@ember/routing/route";
2
2
 
3
- export default class DistributionRoute extends Route {
3
+ export default class ApplicationRoute extends Route {
4
4
  model(params) {
5
5
  return params.case;
6
6
  }
@@ -6,7 +6,7 @@ import config from "@projectcaluma/ember-distribution/config";
6
6
  import inquiryNavigationQuery from "@projectcaluma/ember-distribution/gql/queries/inquiry-navigation.graphql";
7
7
  import uniqueByGroups from "@projectcaluma/ember-distribution/utils/unique-by-groups";
8
8
 
9
- export default class DistributionIndexRoute extends Route {
9
+ export default class IndexRoute extends Route {
10
10
  @service router;
11
11
  @service calumaOptions;
12
12
 
@@ -35,7 +35,7 @@ export default class DistributionIndexRoute extends Route {
35
35
  }, {});
36
36
 
37
37
  if (models.length) {
38
- return this.router.replaceWith("distribution.inquiry", models[0]);
38
+ return this.router.replaceWith("inquiry", models[0]);
39
39
  }
40
40
  }
41
41
  }
@@ -0,0 +1,7 @@
1
+ import Route from "@ember/routing/route";
2
+
3
+ export default class InquiryDetailAnswerRoute extends Route {
4
+ model() {
5
+ return this.modelFor("inquiry.detail");
6
+ }
7
+ }
@@ -0,0 +1,7 @@
1
+ import Route from "@ember/routing/route";
2
+
3
+ export default class InquiryDetailIndexRoute extends Route {
4
+ model() {
5
+ return this.modelFor("inquiry.detail");
6
+ }
7
+ }
@@ -1,6 +1,6 @@
1
1
  import Route from "@ember/routing/route";
2
2
 
3
- export default class DistributionInquiryDetailRoute extends Route {
3
+ export default class InquiryDetailRoute extends Route {
4
4
  model({ inquiry }) {
5
5
  return inquiry;
6
6
  }
@@ -0,0 +1,10 @@
1
+ import Route from "@ember/routing/route";
2
+
3
+ export default class InquiryIndexRoute extends Route {
4
+ model() {
5
+ return {
6
+ ...this.modelFor("inquiry"),
7
+ case: this.modelFor("application"),
8
+ };
9
+ }
10
+ }
@@ -1,6 +1,6 @@
1
1
  import Route from "@ember/routing/route";
2
2
 
3
- export default class DistributionInquiryRoute extends Route {
3
+ export default class InquiryRoute extends Route {
4
4
  model({ from, to }) {
5
5
  return { from, to };
6
6
  }
@@ -0,0 +1,7 @@
1
+ import Route from "@ember/routing/route";
2
+
3
+ export default class NewRoute extends Route {
4
+ model() {
5
+ return this.modelFor("application");
6
+ }
7
+ }
@@ -0,0 +1,3 @@
1
+ import Route from "@ember/routing/route";
2
+
3
+ export default class NotfoundRoute extends Route {}
package/addon/routes.js CHANGED
@@ -1,12 +1,11 @@
1
1
  import buildRoutes from "ember-engines/routes";
2
2
 
3
3
  export default buildRoutes(function () {
4
- this.route("distribution", { path: "/case/:case" }, function () {
5
- this.route("new");
6
- this.route("inquiry", { path: "/from/:from/to/:to" }, function () {
7
- this.route("detail", { path: "/detail/:inquiry" }, function () {
8
- this.route("answer");
9
- });
4
+ this.route("new");
5
+ this.route("inquiry", { path: "/from/:from/to/:to" }, function () {
6
+ this.route("detail", { path: "/:inquiry" }, function () {
7
+ this.route("answer");
10
8
  });
11
9
  });
10
+ this.route("notfound", { path: "/*path" });
12
11
  });
@@ -0,0 +1,37 @@
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
+ }
@@ -0,0 +1,8 @@
1
+ <div uk-grid class={{if this.config.ui.stack "uk-grid-small"}}>
2
+ <div class={{if this.config.ui.stack "uk-width-1-1" "uk-width-1-3"}}>
3
+ <DistributionNavigation @caseId={{@model}} />
4
+ </div>
5
+ <div class={{if this.config.ui.stack "uk-width-1-1" "uk-width-2-3"}}>
6
+ {{outlet}}
7
+ </div>
8
+ </div>
@@ -0,0 +1,8 @@
1
+ <div class="uk-text-center">
2
+ <p class="uk-text-muted">{{t "caluma.distribution.empty"}}</p>
3
+ {{#if (can "create inquiry of distribution")}}
4
+ <LinkTo @route="new" class="uk-margin-top">
5
+ {{t "caluma.distribution.create"}}
6
+ </LinkTo>
7
+ {{/if}}
8
+ </div>
@@ -0,0 +1 @@
1
+ <Notfound />
@@ -1,6 +1,6 @@
1
1
  import { assert } from "@ember/debug";
2
2
  import { get } from "@ember/object";
3
- import moment from "moment";
3
+ import { DateTime } from "luxon";
4
4
 
5
5
  import { createDecorator } from "@projectcaluma/ember-distribution/-private/decorator";
6
6
 
@@ -21,13 +21,12 @@ function decorator(
21
21
  const value = inquiry.document?.deadline.edges[0]?.node.value;
22
22
  const isAnswered = inquiry.status === "COMPLETED";
23
23
 
24
- const deadline = moment.utc(value);
25
- const now = moment.utc();
24
+ const deadline = DateTime.fromISO(value).startOf("day");
25
+ const now = DateTime.now().startOf("day");
26
26
 
27
- const isOverdue = !isAnswered && now.isAfter(deadline, "day");
27
+ const isOverdue = !isAnswered && now > deadline;
28
28
  const isWarning =
29
- !isAnswered &&
30
- now.add(this.config.warningPeriod, "days").isAfter(deadline, "day");
29
+ !isAnswered && now.plus({ days: this.config.warningPeriod }) > deadline;
31
30
 
32
31
  return {
33
32
  value,
@@ -0,0 +1 @@
1
+ export { default } from "@projectcaluma/ember-distribution/abilities/distribution";
@@ -0,0 +1 @@
1
+ export { default } from "@projectcaluma/ember-distribution/components/notfound";
@@ -0,0 +1 @@
1
+ export { default } from "@projectcaluma/ember-distribution/services/caluma-distribution-controls";
@@ -3,6 +3,9 @@
3
3
  $size: 36px;
4
4
  $iconSize: $size * 0.6;
5
5
 
6
+ $sizeSmall: 24px;
7
+ $iconSizeSmall: $sizeSmall * 0.6;
8
+
6
9
  $colors: (
7
10
  muted: $text-muted-color,
8
11
  emphasis: $text-emphasis-color,
@@ -47,3 +50,22 @@ $colors: (
47
50
  }
48
51
  }
49
52
  }
53
+ .inquiry-divider--small {
54
+ &::before,
55
+ &::after {
56
+ height: 1px;
57
+ width: calc(50% - #{$sizeSmall * 0.5});
58
+ }
59
+
60
+ .inquiry-divider__icon {
61
+ width: $sizeSmall;
62
+ height: $sizeSmall;
63
+
64
+ border-width: 1px;
65
+
66
+ > svg {
67
+ width: $iconSizeSmall;
68
+ height: $iconSizeSmall;
69
+ }
70
+ }
71
+ }