@projectcaluma/ember-distribution 1.0.0-beta.2 → 1.0.0-beta.5
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.
- package/CHANGELOG.md +38 -0
- package/addon/abilities/distribution.js +29 -0
- package/addon/components/distribution-navigation/controls.hbs +14 -12
- package/addon/components/distribution-navigation/controls.js +0 -36
- package/addon/components/distribution-navigation/item.hbs +1 -1
- package/addon/components/distribution-navigation/item.js +1 -1
- package/addon/components/distribution-navigation/section.hbs +8 -6
- package/addon/components/distribution-navigation.hbs +1 -1
- package/addon/components/distribution-navigation.js +10 -5
- package/addon/components/inquiry-answer-form.hbs +33 -31
- package/addon/components/inquiry-answer-form.js +1 -1
- package/addon/components/inquiry-dialog/inquiry-deadline.hbs +14 -6
- package/addon/components/inquiry-dialog/inquiry-divider.hbs +2 -1
- package/addon/components/inquiry-dialog/inquiry-part.hbs +13 -10
- package/addon/components/inquiry-dialog/inquiry-part.js +4 -0
- package/addon/components/inquiry-dialog/inquiry.hbs +4 -1
- package/addon/components/inquiry-dialog/inquiry.js +4 -0
- package/addon/components/inquiry-dialog.hbs +8 -6
- package/addon/components/inquiry-edit-form.hbs +21 -19
- package/addon/components/inquiry-edit-form.js +2 -1
- package/addon/components/inquiry-new-form.hbs +113 -102
- package/addon/components/inquiry-new-form.js +20 -20
- package/addon/components/notfound.hbs +12 -0
- package/addon/config.js +1 -0
- package/addon/controllers/application.js +7 -0
- package/addon/controllers/{distribution/new.js → new.js} +1 -1
- package/addon/gql/queries/control-work-items.graphql +18 -2
- package/addon/modifiers/pikaday.js +2 -0
- package/addon/routes/{distribution.js → application.js} +1 -1
- package/addon/routes/{distribution/index.js → index.js} +2 -2
- package/addon/routes/inquiry/detail/answer.js +7 -0
- package/addon/routes/inquiry/detail/index.js +7 -0
- package/addon/routes/{distribution/inquiry → inquiry}/detail.js +1 -1
- package/addon/routes/inquiry/index.js +10 -0
- package/addon/routes/{distribution/inquiry.js → inquiry.js} +1 -1
- package/addon/routes/new.js +7 -0
- package/addon/routes/notfound.js +3 -0
- package/addon/routes.js +5 -6
- package/addon/services/caluma-distribution-controls.js +37 -0
- package/addon/templates/application.hbs +8 -0
- package/addon/templates/index.hbs +8 -0
- package/addon/templates/{distribution/inquiry → inquiry}/detail/answer.hbs +0 -0
- package/addon/templates/{distribution/inquiry → inquiry}/detail/index.hbs +0 -0
- package/addon/templates/{distribution/inquiry → inquiry}/detail.hbs +0 -0
- package/addon/templates/{distribution/inquiry → inquiry}/index.hbs +0 -0
- package/addon/templates/{distribution/inquiry.hbs → inquiry.hbs} +0 -0
- package/addon/templates/{distribution/new.hbs → new.hbs} +0 -0
- package/addon/templates/notfound.hbs +1 -0
- package/addon/utils/inquiry-deadline.js +5 -6
- package/app/abilities/distribution.js +1 -0
- package/app/components/notfound.js +1 -0
- package/app/services/caluma-distribution-controls.js +1 -0
- package/app/styles/_inquiry-divider.scss +22 -0
- package/package.json +18 -15
- package/translations/de.yaml +9 -0
- package/translations/en.yaml +9 -0
- package/translations/fr.yaml +9 -0
- package/addon/routes/distribution/inquiry/detail/answer.js +0 -7
- package/addon/routes/distribution/inquiry/detail/index.js +0 -7
- package/addon/routes/distribution/inquiry/index.js +0 -10
- package/addon/routes/distribution/new.js +0 -7
- package/addon/templates/distribution.hbs +0 -8
| @@ -1,110 +1,121 @@ | |
| 1 | 
            -
             | 
| 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 | 
            -
             | 
| 5 | 
            -
             | 
| 6 | 
            -
             | 
| 7 | 
            -
             | 
| 8 | 
            -
             | 
| 9 | 
            -
             | 
| 10 | 
            -
             | 
| 11 | 
            -
             | 
| 12 | 
            -
             | 
| 13 | 
            -
             | 
| 14 | 
            -
             | 
| 15 | 
            -
                         | 
| 16 | 
            -
                       | 
| 17 | 
            -
             | 
| 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 | 
            -
             | 
| 39 | 
            -
               | 
| 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- | 
| 56 | 
            -
             | 
| 57 | 
            -
             | 
| 58 | 
            -
             | 
| 59 | 
            -
             | 
| 60 | 
            -
             | 
| 61 | 
            -
             | 
| 62 | 
            -
             | 
| 63 | 
            -
             | 
| 64 | 
            -
             | 
| 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 | 
            -
             | 
| 69 | 
            -
             | 
| 70 | 
            -
                < | 
| 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 | 
            -
             | 
| 73 | 
            -
               | 
| 74 | 
            -
                 | 
| 75 | 
            -
                  {{ | 
| 76 | 
            -
             | 
| 77 | 
            -
             | 
| 78 | 
            -
             | 
| 79 | 
            -
             | 
| 80 | 
            -
                    {{ | 
| 81 | 
            -
             | 
| 82 | 
            -
             | 
| 83 | 
            -
             | 
| 84 | 
            -
                       | 
| 85 | 
            -
             | 
| 86 | 
            -
             | 
| 87 | 
            -
             | 
| 88 | 
            -
             | 
| 89 | 
            -
             | 
| 90 | 
            -
             | 
| 91 | 
            -
             | 
| 92 | 
            -
             | 
| 93 | 
            -
             | 
| 94 | 
            -
                         | 
| 95 | 
            -
                         | 
| 96 | 
            -
             | 
| 97 | 
            -
             | 
| 98 | 
            -
             | 
| 99 | 
            -
             | 
| 100 | 
            -
             | 
| 101 | 
            -
             | 
| 102 | 
            -
             | 
| 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 | 
            -
              < | 
| 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 | 
            -
                 | 
| 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 | 
| 78 | 
            -
                   | 
| 79 | 
            -
             | 
| 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:  | 
| 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( | 
| 122 | 
            -
                     | 
| 123 | 
            -
                     | 
| 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
    
    
| @@ -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  | 
| 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 | 
             
              }
         | 
| @@ -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  | 
| 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(" | 
| 38 | 
            +
                  return this.router.replaceWith("inquiry", models[0]);
         | 
| 39 39 | 
             
                }
         | 
| 40 40 | 
             
              }
         | 
| 41 41 | 
             
            }
         | 
    
        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(" | 
| 5 | 
            -
             | 
| 6 | 
            -
                this.route(" | 
| 7 | 
            -
                  this.route(" | 
| 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>
         | 
| 
            File without changes
         | 
| 
            File without changes
         | 
| 
            File without changes
         | 
| 
            File without changes
         | 
| 
            File without changes
         | 
| 
            File without changes
         | 
| @@ -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  | 
| 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 =  | 
| 25 | 
            -
                  const now =  | 
| 24 | 
            +
                  const deadline = DateTime.fromISO(value).startOf("day");
         | 
| 25 | 
            +
                  const now = DateTime.now().startOf("day");
         | 
| 26 26 |  | 
| 27 | 
            -
                  const isOverdue = !isAnswered && now | 
| 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 | 
            +
            }
         |