@projectcaluma/ember-distribution 1.0.0-beta.3 → 1.0.0-beta.4
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 +16 -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/inquiry-answer-form.hbs +33 -31
- package/addon/components/inquiry-answer-form.js +1 -1
- package/addon/components/inquiry-dialog/inquiry-part.hbs +2 -8
- package/addon/components/inquiry-dialog.hbs +8 -6
- package/addon/components/inquiry-edit-form.hbs +21 -19
- package/addon/components/inquiry-edit-form.js +1 -1
- package/addon/components/inquiry-new-form.hbs +113 -101
- package/addon/components/inquiry-new-form.js +6 -16
- 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/app/abilities/distribution.js +1 -0
- package/app/components/notfound.js +1 -0
- package/app/services/caluma-distribution-controls.js +1 -0
- package/package.json +9 -7
- 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
package/CHANGELOG.md
CHANGED
@@ -1,3 +1,19 @@
|
|
1
|
+
# [@projectcaluma/ember-distribution-v1.0.0-beta.4](https://github.com/projectcaluma/ember-caluma/compare/@projectcaluma/ember-distribution-v1.0.0-beta.3...@projectcaluma/ember-distribution-v1.0.0-beta.4) (2022-02-16)
|
2
|
+
|
3
|
+
|
4
|
+
### Bug Fixes
|
5
|
+
|
6
|
+
* **distribution:** show controls if no inquiries exist yet ([5c73b6d](https://github.com/projectcaluma/ember-caluma/commit/5c73b6d0a870fd0e34d96af3fa34095733fe9fd9))
|
7
|
+
* **pikaday:** add pikaday modifier reexport in engines ([c13d302](https://github.com/projectcaluma/ember-caluma/commit/c13d3021bb8fe82e1245a60182af01287c507697))
|
8
|
+
|
9
|
+
|
10
|
+
### Features
|
11
|
+
|
12
|
+
* **distribution:** add config variable to stack the UI ([2ad285a](https://github.com/projectcaluma/ember-caluma/commit/2ad285a24bf5fb45d15fe237e3f420dd1f1d94f2))
|
13
|
+
* **distribution:** add index page when no inquiries exist ([689089c](https://github.com/projectcaluma/ember-caluma/commit/689089c8f28146a33346f382fe69e7ca1b588d97))
|
14
|
+
* **distribution:** add proper 404 handling ([73e62e6](https://github.com/projectcaluma/ember-caluma/commit/73e62e671a9425fc549d7057dd653d1dc59883aa))
|
15
|
+
* **distribution:** remove distribution top level route ([6f396da](https://github.com/projectcaluma/ember-caluma/commit/6f396daf2881f07cdddaac6c7ca784db2b8777d3))
|
16
|
+
|
1
17
|
# [@projectcaluma/ember-distribution-v1.0.0-beta.3](https://github.com/projectcaluma/ember-caluma/compare/@projectcaluma/ember-distribution-v1.0.0-beta.2...@projectcaluma/ember-distribution-v1.0.0-beta.3) (2022-02-07)
|
2
18
|
|
3
19
|
|
@@ -0,0 +1,29 @@
|
|
1
|
+
import { inject as service } from "@ember/service";
|
2
|
+
import { Ability } from "ember-can";
|
3
|
+
|
4
|
+
const hasStatus = (status) => (edge) => edge.node.status === status;
|
5
|
+
|
6
|
+
export default class DistributionAbility extends Ability {
|
7
|
+
@service("caluma-distribution-controls") controls;
|
8
|
+
|
9
|
+
get canSendInquiries() {
|
10
|
+
return (
|
11
|
+
this.controls.workItems.value?.send.edges.filter(hasStatus("SUSPENDED"))
|
12
|
+
.length > 0
|
13
|
+
);
|
14
|
+
}
|
15
|
+
|
16
|
+
get canCreateInquiry() {
|
17
|
+
return (
|
18
|
+
this.controls.workItems.value?.create.edges.filter(hasStatus("READY"))
|
19
|
+
.length > 0
|
20
|
+
);
|
21
|
+
}
|
22
|
+
|
23
|
+
get canComplete() {
|
24
|
+
return (
|
25
|
+
this.controls.workItems.value?.complete.edges.filter(hasStatus("READY"))
|
26
|
+
.length > 0
|
27
|
+
);
|
28
|
+
}
|
29
|
+
}
|
@@ -1,17 +1,19 @@
|
|
1
1
|
<div class="uk-text-center uk-margin-small-top">
|
2
|
-
{{#if
|
3
|
-
<IconButton @route="
|
2
|
+
{{#if (can "create inquiry of distribution")}}
|
3
|
+
<IconButton @route="new" @icon="plus" />
|
4
4
|
{{/if}}
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
5
|
+
{{#if (can "send inquiries of distribution")}}
|
6
|
+
<IconButton
|
7
|
+
@icon="paper-plane-outline"
|
8
|
+
@fromSvgJar={{true}}
|
9
|
+
@gutterTop={{4}}
|
10
|
+
@gutterRight={{6}}
|
11
|
+
@gutterLeft={{4}}
|
12
|
+
@gutterBottom={{4}}
|
13
|
+
@onClick={{this.noop}}
|
14
|
+
/>
|
15
|
+
{{/if}}
|
16
|
+
{{#if (can "complete distribution")}}
|
15
17
|
<IconButton
|
16
18
|
@icon="lock-closed-outline"
|
17
19
|
@fromSvgJar={{true}}
|
@@ -1,45 +1,9 @@
|
|
1
1
|
import { action } from "@ember/object";
|
2
|
-
import { inject as service } from "@ember/service";
|
3
2
|
import Component from "@glimmer/component";
|
4
|
-
import { queryManager } from "ember-apollo-client";
|
5
|
-
import { dropTask } from "ember-concurrency";
|
6
|
-
import { useTask } from "ember-resources";
|
7
|
-
|
8
|
-
import config from "@projectcaluma/ember-distribution/config";
|
9
|
-
import controlWorkItemsQuery from "@projectcaluma/ember-distribution/gql/queries/control-work-items.graphql";
|
10
3
|
|
11
4
|
export default class DistributionNavigationControlsComponent extends Component {
|
12
|
-
@service calumaOptions;
|
13
|
-
|
14
|
-
@queryManager apollo;
|
15
|
-
|
16
|
-
@config config;
|
17
|
-
|
18
|
-
workItems = useTask(this, this.fetchWorkItems, () => []);
|
19
|
-
|
20
|
-
get canCreate() {
|
21
|
-
return this.workItems.value?.create.edges.length > 0;
|
22
|
-
}
|
23
|
-
|
24
|
-
get canComplete() {
|
25
|
-
return this.workItems.value?.complete.edges.length > 0;
|
26
|
-
}
|
27
|
-
|
28
5
|
@action
|
29
6
|
noop(e) {
|
30
7
|
e.preventDefault();
|
31
8
|
}
|
32
|
-
|
33
|
-
@dropTask
|
34
|
-
*fetchWorkItems() {
|
35
|
-
return yield this.apollo.watchQuery({
|
36
|
-
query: controlWorkItemsQuery,
|
37
|
-
variables: {
|
38
|
-
caseId: this.args.caseId,
|
39
|
-
currentGroup: String(this.calumaOptions.currentGroupId),
|
40
|
-
createTask: this.config.controls.createTask,
|
41
|
-
completeTask: this.config.controls.completeTask,
|
42
|
-
},
|
43
|
-
});
|
44
|
-
}
|
45
9
|
}
|
@@ -1,5 +1,5 @@
|
|
1
1
|
<li class={{if this.isActive "uk-active"}}>
|
2
|
-
<LinkTo @route="
|
2
|
+
<LinkTo @route="inquiry" @model={{this.model}}>
|
3
3
|
<div class="uk-flex uk-flex-middle uk-width-1-1">
|
4
4
|
<div class="uk-width-expand uk-text-truncate">
|
5
5
|
{{#if (eq @type "addressed")}}
|
@@ -10,12 +10,14 @@
|
|
10
10
|
{{/if}}
|
11
11
|
</a>
|
12
12
|
|
13
|
-
{{#if
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
13
|
+
{{#if this.expanded}}
|
14
|
+
{{#if @inquiries.length}}
|
15
|
+
<ul class="uk-tab uk-tab-left uk-margin-left">
|
16
|
+
{{#each this.inquiries as |inquiry|}}
|
17
|
+
<DistributionNavigation::Item @inquiry={{inquiry}} @type={{@type}} />
|
18
|
+
{{/each}}
|
19
|
+
</ul>
|
20
|
+
{{/if}}
|
19
21
|
|
20
22
|
{{#if (eq @type "controlling")}}
|
21
23
|
<DistributionNavigation::Controls @caseId={{@caseId}} />
|
@@ -2,45 +2,47 @@
|
|
2
2
|
@documentId={{decode-id this.inquiry.childCase.document.id}}
|
3
3
|
@disabled={{cannot "edit answer form of inquiry" this.inquiry}}
|
4
4
|
@loading={{this._inquiry.isRunning}}
|
5
|
-
as |content|
|
6
5
|
>
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
6
|
+
<:default as |content|>
|
7
|
+
<h1 class="uk-flex uk-flex-middle">
|
8
|
+
{{t "caluma.distribution.answer.title"}}
|
9
|
+
{{#if (eq this.inquiry.status "RUNNING")}}
|
10
|
+
<UkLabel
|
11
|
+
class="uk-margin-left"
|
12
|
+
@label={{t "caluma.distribution.status.draft"}}
|
13
|
+
/>
|
14
|
+
{{/if}}
|
15
|
+
</h1>
|
16
16
|
|
17
|
-
|
17
|
+
<content.form />
|
18
18
|
|
19
|
-
|
20
|
-
|
21
|
-
|
19
|
+
{{#each this.buttons as |buttonConfig|}}
|
20
|
+
{{#if buttonConfig.isFormButton}}
|
21
|
+
<DocumentValidity @document={{content.document}} as |isValid validate|>
|
22
|
+
<UkButton
|
23
|
+
@type="submit"
|
24
|
+
@color={{buttonConfig.color}}
|
25
|
+
@disabled={{or (not isValid) this.completeWorkItem.isRunning}}
|
26
|
+
@onClick={{fn
|
27
|
+
(perform this.completeWorkItem)
|
28
|
+
buttonConfig.workItemId
|
29
|
+
validate
|
30
|
+
}}
|
31
|
+
>{{buttonConfig.label}}</UkButton>
|
32
|
+
</DocumentValidity>
|
33
|
+
{{else}}
|
22
34
|
<UkButton
|
23
|
-
@type="
|
35
|
+
@type="button"
|
24
36
|
@color={{buttonConfig.color}}
|
25
|
-
@disabled={{
|
37
|
+
@disabled={{this.completeWorkItem.isRunning}}
|
26
38
|
@onClick={{fn
|
27
39
|
(perform this.completeWorkItem)
|
28
40
|
buttonConfig.workItemId
|
29
|
-
|
41
|
+
null
|
30
42
|
}}
|
31
43
|
>{{buttonConfig.label}}</UkButton>
|
32
|
-
|
33
|
-
{{
|
34
|
-
|
35
|
-
|
36
|
-
@color={{buttonConfig.color}}
|
37
|
-
@disabled={{this.completeWorkItem.isRunning}}
|
38
|
-
@onClick={{fn
|
39
|
-
(perform this.completeWorkItem)
|
40
|
-
buttonConfig.workItemId
|
41
|
-
null
|
42
|
-
}}
|
43
|
-
>{{buttonConfig.label}}</UkButton>
|
44
|
-
{{/if}}
|
45
|
-
{{/each}}
|
44
|
+
{{/if}}
|
45
|
+
{{/each}}
|
46
|
+
</:default>
|
47
|
+
<:notfound><Notfound /></:notfound>
|
46
48
|
</CfContent>
|
@@ -65,7 +65,7 @@ export default class InquiryAnswerFormComponent extends Component {
|
|
65
65
|
},
|
66
66
|
});
|
67
67
|
|
68
|
-
yield this.router.transitionTo("
|
68
|
+
yield this.router.transitionTo("inquiry.index");
|
69
69
|
} catch (error) {
|
70
70
|
this.notification.danger(
|
71
71
|
this.intl.t("caluma.distribution.answer.complete-error")
|
@@ -17,20 +17,14 @@
|
|
17
17
|
</li>
|
18
18
|
{{#if (can "edit inquiry" @inquiry)}}
|
19
19
|
<li>
|
20
|
-
<LinkTo
|
21
|
-
@route="distribution.inquiry.detail.index"
|
22
|
-
@model={{decode-id @inquiry.id}}
|
23
|
-
>
|
20
|
+
<LinkTo @route="inquiry.detail.index" @model={{decode-id @inquiry.id}}>
|
24
21
|
{{t "caluma.distribution.edit.link"}}
|
25
22
|
</LinkTo>
|
26
23
|
</li>
|
27
24
|
{{/if}}
|
28
25
|
{{#if (can "answer inquiry" @inquiry)}}
|
29
26
|
<li>
|
30
|
-
<LinkTo
|
31
|
-
@route="distribution.inquiry.detail.answer"
|
32
|
-
@model={{decode-id @inquiry.id}}
|
33
|
-
>
|
27
|
+
<LinkTo @route="inquiry.detail.answer" @model={{decode-id @inquiry.id}}>
|
34
28
|
{{t "caluma.distribution.answer.link"}}
|
35
29
|
</LinkTo>
|
36
30
|
</li>
|
@@ -1,9 +1,11 @@
|
|
1
|
-
|
2
|
-
{{
|
3
|
-
|
4
|
-
|
1
|
+
{{#if this._inquiries.isRunning}}
|
2
|
+
<div class="uk-text-center"><UkSpinner @ratio={{2}} /></div>
|
3
|
+
{{else if this.inquiries.length}}
|
4
|
+
<section>
|
5
5
|
{{#each this.inquiries as |inquiry|}}
|
6
6
|
<InquiryDialog::Inquiry @inquiry={{inquiry}} />
|
7
7
|
{{/each}}
|
8
|
-
|
9
|
-
|
8
|
+
</section>
|
9
|
+
{{else}}
|
10
|
+
<Notfound />
|
11
|
+
{{/if}}
|
@@ -2,26 +2,28 @@
|
|
2
2
|
@documentId={{decode-id this.inquiry.document.id}}
|
3
3
|
@disabled={{cannot "edit inquiry" this.inquiry}}
|
4
4
|
@loading={{this._inquiry.isRunning}}
|
5
|
-
as |content|
|
6
5
|
>
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
6
|
+
<:default as |content|>
|
7
|
+
<h1 class="uk-flex uk-flex-middle">
|
8
|
+
{{t "caluma.distribution.edit.title"}}
|
9
|
+
{{#if (eq this.inquiry.status "RUNNING")}}
|
10
|
+
<UkLabel
|
11
|
+
class="uk-margin-left"
|
12
|
+
@label={{t "caluma.distribution.status.draft"}}
|
13
|
+
/>
|
14
|
+
{{/if}}
|
15
|
+
</h1>
|
16
16
|
|
17
|
-
|
17
|
+
<content.form />
|
18
18
|
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
19
|
+
<DocumentValidity @document={{content.document}} as |isValid validate|>
|
20
|
+
<UkButton
|
21
|
+
@type="submit"
|
22
|
+
@color="primary"
|
23
|
+
@disabled={{or (not isValid) this.send.isRunning}}
|
24
|
+
@onClick={{perform this.send validate}}
|
25
|
+
>{{t "caluma.distribution.edit.send"}}</UkButton>
|
26
|
+
</DocumentValidity>
|
27
|
+
</:default>
|
28
|
+
<:notfound><Notfound /></:notfound>
|
27
29
|
</CfContent>
|
@@ -43,7 +43,7 @@ export default class InquiryEditFormComponent extends Component {
|
|
43
43
|
variables: { workItem: this.args.inquiry },
|
44
44
|
});
|
45
45
|
|
46
|
-
yield this.router.transitionTo("
|
46
|
+
yield this.router.transitionTo("inquiry.index");
|
47
47
|
} catch (error) {
|
48
48
|
this.notification.danger(
|
49
49
|
this.intl.t("caluma.distribution.edit.send-error")
|
@@ -1,109 +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
|
-
@label={{t "caluma.distribution.new.reset"}}
|
24
|
-
@onClick={{this.clearSelectedGroups}}
|
25
|
-
data-test-reset
|
26
|
-
/>
|
27
|
-
<UkButton
|
28
|
-
@color="primary"
|
29
|
-
@label={{t "caluma.distribution.new.create-draft"}}
|
30
|
-
@type="submit"
|
31
|
-
@loading={{this.submit.isRunning}}
|
32
|
-
@disabled={{this.submit.isRunning}}
|
33
|
-
@onClick={{perform this.submit}}
|
34
|
-
data-test-submit
|
35
|
-
/>
|
36
46
|
</div>
|
37
|
-
|
38
|
-
|
39
|
-
{{/if}}
|
40
|
-
|
41
|
-
<div class="uk-margin-bottom uk-button-group">
|
42
|
-
{{#each-in this.config.new.types as |slug config|}}
|
43
|
-
{{#unless config.disabled}}
|
44
|
-
<UkButton
|
45
|
-
data-test-type={{slug}}
|
46
|
-
@label={{t config.label}}
|
47
|
-
@color={{if (includes slug @selectedTypes) "primary" "default"}}
|
48
|
-
@onClick={{fn this.updateSelectedTypes slug}}
|
49
|
-
/>
|
50
|
-
{{/unless}}
|
51
|
-
{{/each-in}}
|
52
|
-
</div>
|
47
|
+
<hr />
|
48
|
+
{{/if}}
|
53
49
|
|
54
|
-
<div class="uk-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
</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>
|
66
62
|
|
67
|
-
|
68
|
-
|
69
|
-
<
|
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
|
+
/>
|
70
74
|
</div>
|
71
|
-
|
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
|
-
|
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}}
|
102
119
|
{{else}}
|
103
|
-
<
|
104
|
-
<UkIcon @icon="search" @ratio={{10}} class="uk-margin-top" />
|
105
|
-
<p class="uk-text-muted">
|
106
|
-
{{t "caluma.distribution.new.empty"}}
|
107
|
-
</p>
|
108
|
-
</div>
|
120
|
+
<Notfound />
|
109
121
|
{{/if}}
|
@@ -10,7 +10,6 @@ import { useTask } from "ember-resources";
|
|
10
10
|
import { decodeId } from "@projectcaluma/ember-core/helpers/decode-id";
|
11
11
|
import config from "@projectcaluma/ember-distribution/config";
|
12
12
|
import createInquiryMutation from "@projectcaluma/ember-distribution/gql/mutations/create-inquiry.graphql";
|
13
|
-
import controlWorkItemsQuery from "@projectcaluma/ember-distribution/gql/queries/control-work-items.graphql";
|
14
13
|
import inquiryNavigationQuery from "@projectcaluma/ember-distribution/gql/queries/inquiry-navigation.graphql";
|
15
14
|
|
16
15
|
const toggle = (value, array) => {
|
@@ -26,6 +25,7 @@ export default class InquiryNewFormComponent extends Component {
|
|
26
25
|
@service notification;
|
27
26
|
@service intl;
|
28
27
|
@service router;
|
28
|
+
@service("caluma-distribution-controls") controls;
|
29
29
|
|
30
30
|
@queryManager apollo;
|
31
31
|
|
@@ -80,26 +80,16 @@ export default class InquiryNewFormComponent extends Component {
|
|
80
80
|
if (!this.selectedGroups.length) return;
|
81
81
|
|
82
82
|
try {
|
83
|
-
// get create inquiry work item to complete
|
84
|
-
|
85
|
-
|
86
|
-
{
|
87
|
-
query: controlWorkItemsQuery,
|
88
|
-
variables: {
|
89
|
-
caseId: this.args.caseId,
|
90
|
-
currentGroup: String(this.calumaOptions.currentGroupId),
|
91
|
-
createTask: this.config.controls.createTask,
|
92
|
-
completeTask: this.config.controls.completeTask,
|
93
|
-
},
|
94
|
-
},
|
95
|
-
"create.edges"
|
83
|
+
// get create inquiry work item to complete
|
84
|
+
const createId = decodeId(
|
85
|
+
this.controls.workItems.value?.create.edges[0].node.id
|
96
86
|
);
|
97
87
|
|
98
88
|
// create new inquiries
|
99
89
|
yield this.apollo.mutate({
|
100
90
|
mutation: createInquiryMutation,
|
101
91
|
variables: {
|
102
|
-
id:
|
92
|
+
id: createId,
|
103
93
|
context: JSON.stringify({
|
104
94
|
addressed_groups: this.selectedGroups.map(String),
|
105
95
|
}),
|
@@ -124,7 +114,7 @@ export default class InquiryNewFormComponent extends Component {
|
|
124
114
|
);
|
125
115
|
|
126
116
|
// transition to last added inquiry
|
127
|
-
this.router.transitionTo("
|
117
|
+
this.router.transitionTo("inquiry", {
|
128
118
|
from: navigationData[0].node.controllingGroups[0],
|
129
119
|
to: navigationData[0].node.addressedGroups[0],
|
130
120
|
});
|
@@ -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 />
|
@@ -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";
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@projectcaluma/ember-distribution",
|
3
|
-
"version": "1.0.0-beta.
|
3
|
+
"version": "1.0.0-beta.4",
|
4
4
|
"description": "Ember engine for the Caluma distribution module.",
|
5
5
|
"keywords": [
|
6
6
|
"ember-addon",
|
@@ -21,17 +21,18 @@
|
|
21
21
|
"@glimmer/component": "^1.0.4",
|
22
22
|
"@glimmer/tracking": "^1.0.4",
|
23
23
|
"@projectcaluma/ember-core": "^11.0.0-beta.4",
|
24
|
-
"@projectcaluma/ember-form": "^11.0.0-beta.
|
24
|
+
"@projectcaluma/ember-form": "^11.0.0-beta.11",
|
25
25
|
"@projectcaluma/ember-workflow": "^11.0.0-beta.4",
|
26
26
|
"ember-apollo-client": "^3.2.0",
|
27
27
|
"ember-auto-import": "^2.4.0",
|
28
28
|
"ember-can": "^4.1.0",
|
29
29
|
"ember-cli-babel": "^7.26.11",
|
30
30
|
"ember-cli-htmlbars": "^6.0.1",
|
31
|
-
"ember-concurrency": "^2.2.
|
31
|
+
"ember-concurrency": "^2.2.1",
|
32
32
|
"ember-engines-router-service": "^0.3.0",
|
33
33
|
"ember-fetch": "^8.1.1",
|
34
34
|
"ember-intl": "^5.7.2",
|
35
|
+
"ember-pikaday": "^4.0.0",
|
35
36
|
"ember-resources": "^4.3.1",
|
36
37
|
"ember-svg-jar": "^2.3.4",
|
37
38
|
"ember-test-selectors": "^6.0.0",
|
@@ -45,11 +46,12 @@
|
|
45
46
|
"devDependencies": {
|
46
47
|
"@ember/optional-features": "2.0.0",
|
47
48
|
"@ember/test-helpers": "2.6.0",
|
48
|
-
"@embroider/test-setup": "1.
|
49
|
-
"@faker-js/faker": "6.0.0-alpha.
|
50
|
-
"@projectcaluma/ember-testing": "11.0.0-beta.
|
49
|
+
"@embroider/test-setup": "1.2.0",
|
50
|
+
"@faker-js/faker": "6.0.0-alpha.6",
|
51
|
+
"@projectcaluma/ember-testing": "11.0.0-beta.3",
|
51
52
|
"broccoli-asset-rev": "3.0.0",
|
52
53
|
"ember-cli": "3.28.5",
|
54
|
+
"ember-cli-code-coverage": "1.0.3",
|
53
55
|
"ember-cli-dependency-checker": "3.2.0",
|
54
56
|
"ember-cli-inject-live-reload": "2.1.0",
|
55
57
|
"ember-cli-mirage": "2.4.0",
|
@@ -72,7 +74,7 @@
|
|
72
74
|
"qunit": "2.17.2",
|
73
75
|
"qunit-dom": "2.0.0",
|
74
76
|
"sass": "1.49.7",
|
75
|
-
"webpack": "5.
|
77
|
+
"webpack": "5.69.0"
|
76
78
|
},
|
77
79
|
"engines": {
|
78
80
|
"node": "12.* || 14.* || >= 16"
|
package/translations/de.yaml
CHANGED
@@ -1,5 +1,8 @@
|
|
1
1
|
caluma:
|
2
2
|
distribution:
|
3
|
+
empty: "Es gibt noch keine Anfragen."
|
4
|
+
create: "Erstellen Sie die Erste jetzt!"
|
5
|
+
|
3
6
|
edit:
|
4
7
|
title: "Anfrage bearbeiten"
|
5
8
|
link: "Bearbeiten"
|
@@ -40,3 +43,9 @@ caluma:
|
|
40
43
|
positive: "Positiv"
|
41
44
|
negative: "Negativ"
|
42
45
|
needs-interaction: "Aktion erforderlich"
|
46
|
+
|
47
|
+
notfound:
|
48
|
+
title: "404"
|
49
|
+
subtitle: "Seite nicht gefunden!"
|
50
|
+
back: "Zurück zur"
|
51
|
+
link: "Startseite"
|
package/translations/en.yaml
CHANGED
@@ -1,5 +1,8 @@
|
|
1
1
|
caluma:
|
2
2
|
distribution:
|
3
|
+
empty: "There are no inquiries yet."
|
4
|
+
create: "Create the first one now!"
|
5
|
+
|
3
6
|
edit:
|
4
7
|
title: "Edit inquiry"
|
5
8
|
link: "Edit"
|
@@ -40,3 +43,9 @@ caluma:
|
|
40
43
|
positive: "Positive"
|
41
44
|
negative: "Negative"
|
42
45
|
needs-interaction: "Needs interaction"
|
46
|
+
|
47
|
+
notfound:
|
48
|
+
title: "404"
|
49
|
+
subtitle: "Page not found!"
|
50
|
+
back: "Go back to the"
|
51
|
+
link: "landing page"
|
package/translations/fr.yaml
CHANGED
@@ -1,5 +1,8 @@
|
|
1
1
|
caluma:
|
2
2
|
distribution:
|
3
|
+
empty: "Il n'y a pas encore de demande."
|
4
|
+
create: "Créez la première maintenant !"
|
5
|
+
|
3
6
|
edit:
|
4
7
|
title: "Modifier la demande"
|
5
8
|
link: "Modifier"
|
@@ -40,3 +43,9 @@ caluma:
|
|
40
43
|
positive: "Positif"
|
41
44
|
negative: "Negatif"
|
42
45
|
needs-interaction: "Action nécessaire"
|
46
|
+
|
47
|
+
notfound:
|
48
|
+
title: "404"
|
49
|
+
subtitle: "Page non trouvée !"
|
50
|
+
back: "Retour à"
|
51
|
+
link: "la page d'accueil"
|