@projectcaluma/ember-distribution 1.0.0-beta.1
Sign up to get free protection for your applications and to get access to all the features.
- package/CHANGELOG.md +38 -0
- package/addon/-private/decorator.js +24 -0
- package/addon/abilities/inquiry.js +39 -0
- package/addon/components/distribution-navigation/controls.hbs +21 -0
- package/addon/components/distribution-navigation/controls.js +45 -0
- package/addon/components/distribution-navigation/item.hbs +18 -0
- package/addon/components/distribution-navigation/item.js +17 -0
- package/addon/components/distribution-navigation/section.hbs +24 -0
- package/addon/components/distribution-navigation/section.js +25 -0
- package/addon/components/distribution-navigation/status-indicator.hbs +17 -0
- package/addon/components/distribution-navigation/status-indicator.js +19 -0
- package/addon/components/distribution-navigation.hbs +17 -0
- package/addon/components/distribution-navigation.js +81 -0
- package/addon/components/icon-button.hbs +20 -0
- package/addon/components/icon-button.js +22 -0
- package/addon/components/inquiry-answer-form.hbs +46 -0
- package/addon/components/inquiry-answer-form.js +75 -0
- package/addon/components/inquiry-dialog/inquiry-deadline.hbs +6 -0
- package/addon/components/inquiry-dialog/inquiry-deadline.js +10 -0
- package/addon/components/inquiry-dialog/inquiry-divider.hbs +7 -0
- package/addon/components/inquiry-dialog/inquiry-divider.js +13 -0
- package/addon/components/inquiry-dialog/inquiry-part.hbs +40 -0
- package/addon/components/inquiry-dialog/inquiry-part.js +20 -0
- package/addon/components/inquiry-dialog/inquiry.hbs +13 -0
- package/addon/components/inquiry-dialog/inquiry.js +7 -0
- package/addon/components/inquiry-dialog.hbs +9 -0
- package/addon/components/inquiry-dialog.js +42 -0
- package/addon/components/inquiry-edit-form.hbs +27 -0
- package/addon/components/inquiry-edit-form.js +53 -0
- package/addon/components/inquiry-new-form.hbs +110 -0
- package/addon/components/inquiry-new-form.js +154 -0
- package/addon/config.js +72 -0
- package/addon/controllers/distribution/new.js +22 -0
- package/addon/engine.js +18 -0
- package/addon/gql/fragments/inquiry.graphql +89 -0
- package/addon/gql/mutations/complete-inquiry-work-item.graphql +36 -0
- package/addon/gql/mutations/create-inquiry.graphql +5 -0
- package/addon/gql/mutations/resume-work-item.graphql +8 -0
- package/addon/gql/queries/control-work-items.graphql +37 -0
- package/addon/gql/queries/inquiry-answer.graphql +33 -0
- package/addon/gql/queries/inquiry-dialog.graphql +28 -0
- package/addon/gql/queries/inquiry-edit.graphql +18 -0
- package/addon/gql/queries/inquiry-navigation.graphql +56 -0
- package/addon/routes/distribution/index.js +41 -0
- package/addon/routes/distribution/inquiry/detail/answer.js +7 -0
- package/addon/routes/distribution/inquiry/detail/index.js +7 -0
- package/addon/routes/distribution/inquiry/detail.js +7 -0
- package/addon/routes/distribution/inquiry/index.js +10 -0
- package/addon/routes/distribution/inquiry.js +7 -0
- package/addon/routes/distribution/new.js +7 -0
- package/addon/routes/distribution.js +7 -0
- package/addon/routes.js +12 -0
- package/addon/templates/distribution/inquiry/detail/answer.hbs +1 -0
- package/addon/templates/distribution/inquiry/detail/index.hbs +1 -0
- package/addon/templates/distribution/inquiry/detail.hbs +1 -0
- package/addon/templates/distribution/inquiry/index.hbs +5 -0
- package/addon/templates/distribution/inquiry.hbs +1 -0
- package/addon/templates/distribution/new.hbs +7 -0
- package/addon/templates/distribution.hbs +8 -0
- package/addon/utils/inquiry-deadline.js +48 -0
- package/addon/utils/inquiry-status.js +68 -0
- package/addon/utils/unique-by-groups.js +17 -0
- package/app/abilities/inquiry.js +1 -0
- package/app/components/distribution-navigation/controls.js +1 -0
- package/app/components/distribution-navigation/item.js +1 -0
- package/app/components/distribution-navigation/section.js +1 -0
- package/app/components/distribution-navigation/status-indicator.js +1 -0
- package/app/components/distribution-navigation.js +1 -0
- package/app/components/icon-button.js +1 -0
- package/app/components/inquiry-answer-form.js +1 -0
- package/app/components/inquiry-dialog/inquiry-deadline.js +1 -0
- package/app/components/inquiry-dialog/inquiry-divider.js +1 -0
- package/app/components/inquiry-dialog/inquiry-part.js +1 -0
- package/app/components/inquiry-dialog/inquiry.js +1 -0
- package/app/components/inquiry-dialog.js +1 -0
- package/app/components/inquiry-edit-form.js +1 -0
- package/app/components/inquiry-new-form.js +1 -0
- package/app/styles/@projectcaluma/ember-distribution.scss +3 -0
- package/app/styles/_icon-button.scss +13 -0
- package/app/styles/_inquiry-divider.scss +49 -0
- package/app/styles/_status-indicator.scss +31 -0
- package/app/styles/app.scss +1 -0
- package/app/utils/inquiry-deadline.js +1 -0
- package/app/utils/inquiry-status.js +1 -0
- package/app/utils/unique-by-groups.js +1 -0
- package/config/environment.js +10 -0
- package/index.js +22 -0
- package/package.json +86 -0
- package/translations/de.yaml +42 -0
- package/translations/en.yaml +42 -0
- package/translations/fr.yaml +42 -0
@@ -0,0 +1,13 @@
|
|
1
|
+
<article class="uk-card uk-card-default uk-margin">
|
2
|
+
<div class="uk-card-body">
|
3
|
+
<InquiryDialog::InquiryDeadline @inquiry={{@inquiry}} />
|
4
|
+
|
5
|
+
{{#if this.hasAnswer}}
|
6
|
+
<InquiryDialog::InquiryPart @inquiry={{@inquiry}} @type="answer" />
|
7
|
+
|
8
|
+
<InquiryDialog::InquiryDivider @inquiry={{@inquiry}} />
|
9
|
+
{{/if}}
|
10
|
+
|
11
|
+
<InquiryDialog::InquiryPart @inquiry={{@inquiry}} @type="request" />
|
12
|
+
</div>
|
13
|
+
</article>
|
@@ -0,0 +1,42 @@
|
|
1
|
+
import Component from "@glimmer/component";
|
2
|
+
import { queryManager } from "ember-apollo-client";
|
3
|
+
import { dropTask } from "ember-concurrency";
|
4
|
+
import { useTask } from "ember-resources";
|
5
|
+
|
6
|
+
import config from "@projectcaluma/ember-distribution/config";
|
7
|
+
import inquiryDialogQuery from "@projectcaluma/ember-distribution/gql/queries/inquiry-dialog.graphql";
|
8
|
+
|
9
|
+
export default class InquiryDialogComponent extends Component {
|
10
|
+
@config config;
|
11
|
+
|
12
|
+
@queryManager apollo;
|
13
|
+
|
14
|
+
get inquiries() {
|
15
|
+
return this._inquiries.value?.allWorkItems.edges.map((edge) => edge.node);
|
16
|
+
}
|
17
|
+
|
18
|
+
_inquiries = useTask(this, this.fetchDialog, () => [
|
19
|
+
this.args.from,
|
20
|
+
this.args.to,
|
21
|
+
this.args.caseId,
|
22
|
+
this.config,
|
23
|
+
]);
|
24
|
+
|
25
|
+
@dropTask
|
26
|
+
*fetchDialog() {
|
27
|
+
return yield this.apollo.watchQuery({
|
28
|
+
query: inquiryDialogQuery,
|
29
|
+
variables: {
|
30
|
+
from: this.args.from,
|
31
|
+
to: this.args.to,
|
32
|
+
caseId: this.args.caseId,
|
33
|
+
task: this.config.inquiry.task,
|
34
|
+
infoQuestion: this.config.inquiry.infoQuestion,
|
35
|
+
deadlineQuestion: this.config.inquiry.deadlineQuestion,
|
36
|
+
statusQuestion: this.config.inquiry.answer.statusQuestion,
|
37
|
+
answerInfoQuestion: this.config.inquiry.answer.infoQuestion,
|
38
|
+
includeNavigationData: true,
|
39
|
+
},
|
40
|
+
});
|
41
|
+
}
|
42
|
+
}
|
@@ -0,0 +1,27 @@
|
|
1
|
+
<CfContent
|
2
|
+
@documentId={{decode-id this.inquiry.document.id}}
|
3
|
+
@disabled={{cannot "edit inquiry" this.inquiry}}
|
4
|
+
@loading={{this._inquiry.isRunning}}
|
5
|
+
as |content|
|
6
|
+
>
|
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
|
+
|
17
|
+
<content.form />
|
18
|
+
|
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
|
+
@on-click={{perform this.send validate}}
|
25
|
+
>{{t "caluma.distribution.edit.send"}}</UkButton>
|
26
|
+
</DocumentValidity>
|
27
|
+
</CfContent>
|
@@ -0,0 +1,53 @@
|
|
1
|
+
import { inject as service } from "@ember/service";
|
2
|
+
import Component from "@glimmer/component";
|
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 resumeWorkItemMutation from "@projectcaluma/ember-distribution/gql/mutations/resume-work-item.graphql";
|
9
|
+
import inquiryEditQuery from "@projectcaluma/ember-distribution/gql/queries/inquiry-edit.graphql";
|
10
|
+
|
11
|
+
export default class InquiryEditFormComponent extends Component {
|
12
|
+
@service notification;
|
13
|
+
@service router;
|
14
|
+
|
15
|
+
@config config;
|
16
|
+
|
17
|
+
@queryManager apollo;
|
18
|
+
|
19
|
+
_inquiry = useTask(this, this.fetchInquiry, () => [this.args.inquiry]);
|
20
|
+
|
21
|
+
get inquiry() {
|
22
|
+
return this._inquiry.value?.[0]?.node;
|
23
|
+
}
|
24
|
+
|
25
|
+
@dropTask
|
26
|
+
*fetchInquiry() {
|
27
|
+
return yield this.apollo.watchQuery(
|
28
|
+
{
|
29
|
+
query: inquiryEditQuery,
|
30
|
+
variables: { inquiry: this.args.inquiry },
|
31
|
+
},
|
32
|
+
"allWorkItems.edges"
|
33
|
+
);
|
34
|
+
}
|
35
|
+
|
36
|
+
@dropTask
|
37
|
+
*send(validate) {
|
38
|
+
try {
|
39
|
+
if (!(yield validate())) return;
|
40
|
+
|
41
|
+
yield this.apollo.mutate({
|
42
|
+
mutation: resumeWorkItemMutation,
|
43
|
+
variables: { workItem: this.args.inquiry },
|
44
|
+
});
|
45
|
+
|
46
|
+
yield this.router.transitionTo("distribution.inquiry.index");
|
47
|
+
} catch (error) {
|
48
|
+
this.notification.danger(
|
49
|
+
this.intl.t("caluma.distribution.edit.send-error")
|
50
|
+
);
|
51
|
+
}
|
52
|
+
}
|
53
|
+
}
|
@@ -0,0 +1,110 @@
|
|
1
|
+
<h1>{{t "caluma.distribution.new.title"}}</h1>
|
2
|
+
|
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>
|
18
|
+
</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
|
+
@on-click={{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
|
+
@on-click={{perform this.submit}}
|
35
|
+
data-test-submit
|
36
|
+
/>
|
37
|
+
</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
|
+
@on-click={{fn this.updateSelectedTypes slug}}
|
50
|
+
/>
|
51
|
+
{{/unless}}
|
52
|
+
{{/each-in}}
|
53
|
+
</div>
|
54
|
+
|
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>
|
67
|
+
|
68
|
+
{{#if this.groups.isRunning}}
|
69
|
+
<div class="uk-text-center uk-margin">
|
70
|
+
<UkSpinner @ratio={{2}} />
|
71
|
+
</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>
|
103
|
+
{{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>
|
110
|
+
{{/if}}
|
@@ -0,0 +1,154 @@
|
|
1
|
+
import { action } from "@ember/object";
|
2
|
+
import { inject as service } from "@ember/service";
|
3
|
+
import Component from "@glimmer/component";
|
4
|
+
import { tracked } from "@glimmer/tracking";
|
5
|
+
import { queryManager } from "ember-apollo-client";
|
6
|
+
import { timeout, restartableTask, dropTask, task } from "ember-concurrency";
|
7
|
+
import { useTask } from "ember-resources";
|
8
|
+
|
9
|
+
import { decodeId } from "@projectcaluma/ember-core/helpers/decode-id";
|
10
|
+
import config from "@projectcaluma/ember-distribution/config";
|
11
|
+
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
|
+
import inquiryNavigationQuery from "@projectcaluma/ember-distribution/gql/queries/inquiry-navigation.graphql";
|
14
|
+
|
15
|
+
const toggle = (value, array) => {
|
16
|
+
const set = new Set(array);
|
17
|
+
|
18
|
+
set.delete(value) || set.add(value);
|
19
|
+
|
20
|
+
return [...set];
|
21
|
+
};
|
22
|
+
|
23
|
+
export default class InquiryNewFormComponent extends Component {
|
24
|
+
@service calumaOptions;
|
25
|
+
@service notification;
|
26
|
+
@service intl;
|
27
|
+
@service router;
|
28
|
+
|
29
|
+
@queryManager apollo;
|
30
|
+
|
31
|
+
@config config;
|
32
|
+
|
33
|
+
@tracked selectedGroups = [];
|
34
|
+
|
35
|
+
groups = useTask(this, this.fetchGroups, () => [
|
36
|
+
this.args.selectedTypes,
|
37
|
+
this.args.search,
|
38
|
+
]);
|
39
|
+
|
40
|
+
@action
|
41
|
+
updateSelectedTypes(type, e) {
|
42
|
+
e.preventDefault();
|
43
|
+
|
44
|
+
this.args.onChangeSelectedTypes(toggle(type, this.args.selectedTypes));
|
45
|
+
}
|
46
|
+
|
47
|
+
@action
|
48
|
+
updateSelectedGroups(identifier, e) {
|
49
|
+
e.preventDefault();
|
50
|
+
|
51
|
+
this.selectedGroups = toggle(identifier, this.selectedGroups);
|
52
|
+
}
|
53
|
+
|
54
|
+
@action
|
55
|
+
clearSelectedGroups(e) {
|
56
|
+
e.preventDefault();
|
57
|
+
|
58
|
+
this.selectedGroups = [];
|
59
|
+
}
|
60
|
+
|
61
|
+
@restartableTask
|
62
|
+
*updateSearch(e) {
|
63
|
+
e.preventDefault();
|
64
|
+
|
65
|
+
yield timeout(500);
|
66
|
+
|
67
|
+
this.args.onChangeSearch(e.target.value);
|
68
|
+
}
|
69
|
+
|
70
|
+
@dropTask
|
71
|
+
*submit(e) {
|
72
|
+
e.preventDefault();
|
73
|
+
|
74
|
+
if (!this.selectedGroups.length) return;
|
75
|
+
|
76
|
+
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"
|
90
|
+
);
|
91
|
+
|
92
|
+
// create new inquiries
|
93
|
+
yield this.apollo.mutate({
|
94
|
+
mutation: createInquiryMutation,
|
95
|
+
variables: {
|
96
|
+
id: decodeId(controlsData[0].node.id),
|
97
|
+
context: JSON.stringify({
|
98
|
+
addressed_groups: this.selectedGroups.map(String),
|
99
|
+
}),
|
100
|
+
},
|
101
|
+
});
|
102
|
+
|
103
|
+
// refetch navigation data
|
104
|
+
const navigationData = yield this.apollo.query(
|
105
|
+
{
|
106
|
+
query: inquiryNavigationQuery,
|
107
|
+
fetchPolicy: "network-only",
|
108
|
+
variables: {
|
109
|
+
caseId: this.args.caseId,
|
110
|
+
task: this.config.inquiry.task,
|
111
|
+
currentGroup: String(this.calumaOptions.currentGroupId),
|
112
|
+
statusQuestion: this.config.inquiry.answer.statusQuestion,
|
113
|
+
deadlineQuestion: this.config.inquiry.deadlineQuestion,
|
114
|
+
includeNavigationData: true,
|
115
|
+
},
|
116
|
+
},
|
117
|
+
"controlling.edges"
|
118
|
+
);
|
119
|
+
|
120
|
+
// 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
|
+
});
|
125
|
+
} catch (e) {
|
126
|
+
this.notification.danger(
|
127
|
+
this.intl.t("caluma.distribution.new.error", {
|
128
|
+
count: this.selectedGroups.length,
|
129
|
+
})
|
130
|
+
);
|
131
|
+
}
|
132
|
+
}
|
133
|
+
|
134
|
+
@task
|
135
|
+
*fetchGroups(types, search) {
|
136
|
+
// https://github.com/ember-cli/eslint-plugin-ember/issues/1413
|
137
|
+
yield Promise.resolve();
|
138
|
+
|
139
|
+
const typedGroups = yield this.calumaOptions.fetchTypedGroups(
|
140
|
+
types,
|
141
|
+
search
|
142
|
+
);
|
143
|
+
|
144
|
+
return Object.entries(typedGroups)
|
145
|
+
.flatMap(([type, groups]) => {
|
146
|
+
return groups.map((group) => ({
|
147
|
+
identifier: group[this.calumaOptions.groupIdentifierProperty],
|
148
|
+
name: group[this.calumaOptions.groupNameProperty],
|
149
|
+
config: this.config.new.types[type],
|
150
|
+
}));
|
151
|
+
})
|
152
|
+
.sort((a, b) => a.name.localeCompare(b.name));
|
153
|
+
}
|
154
|
+
}
|
package/addon/config.js
ADDED
@@ -0,0 +1,72 @@
|
|
1
|
+
import { getOwner } from "@ember/application";
|
2
|
+
import merge from "lodash.merge";
|
3
|
+
import { cached } from "tracked-toolbox";
|
4
|
+
|
5
|
+
export const INQUIRY_STATUS = {
|
6
|
+
DRAFT: "draft",
|
7
|
+
SENT: "sent",
|
8
|
+
POSITIVE: "positive",
|
9
|
+
NEGATIVE: "negative",
|
10
|
+
NEEDS_INTERACTION: "needs-interaction",
|
11
|
+
};
|
12
|
+
|
13
|
+
export default function config(target, property) {
|
14
|
+
return cached(target, property, {
|
15
|
+
get() {
|
16
|
+
return merge(
|
17
|
+
{
|
18
|
+
controls: {
|
19
|
+
createTask: "create-inquiry",
|
20
|
+
completeTask: "complete-distribution",
|
21
|
+
},
|
22
|
+
warningPeriod: 3,
|
23
|
+
inquiry: {
|
24
|
+
task: "inquiry",
|
25
|
+
deadlineQuestion: "inquiry-deadline",
|
26
|
+
infoQuestion: "inquiry-remark",
|
27
|
+
answer: {
|
28
|
+
statusQuestion: "inquiry-answer-status",
|
29
|
+
infoQuestion: "inquiry-answer-reason",
|
30
|
+
statusMapping: {
|
31
|
+
"inquiry-answer-status-positive": INQUIRY_STATUS.POSITIVE,
|
32
|
+
"inquiry-answer-status-negative": INQUIRY_STATUS.NEGATIVE,
|
33
|
+
"inquiry-answer-status-needs-interaction":
|
34
|
+
INQUIRY_STATUS.NEEDS_INTERACTION,
|
35
|
+
},
|
36
|
+
buttons: {
|
37
|
+
"compose-inquiry-answer": {
|
38
|
+
color: "primary",
|
39
|
+
label: "caluma.distribution.answer.release-for-review",
|
40
|
+
},
|
41
|
+
"confirm-inquiry-answer": {
|
42
|
+
color: "primary",
|
43
|
+
label: "caluma.distribution.answer.confirm",
|
44
|
+
},
|
45
|
+
"revise-inquiry-answer": {
|
46
|
+
color: "default",
|
47
|
+
label: "caluma.distribution.answer.revise",
|
48
|
+
},
|
49
|
+
"adjust-inquiry-answer": {
|
50
|
+
color: "primary",
|
51
|
+
label:
|
52
|
+
"caluma.distribution.answer.release-adjustment-for-review",
|
53
|
+
},
|
54
|
+
},
|
55
|
+
},
|
56
|
+
},
|
57
|
+
new: {
|
58
|
+
defaultTypes: ["suggestions"],
|
59
|
+
types: {
|
60
|
+
suggestions: {
|
61
|
+
label: "caluma.distribution.new.suggestions",
|
62
|
+
icon: "bulb-outline",
|
63
|
+
iconColor: "warning",
|
64
|
+
},
|
65
|
+
},
|
66
|
+
},
|
67
|
+
},
|
68
|
+
getOwner(this).lookup("service:calumaOptions")?.distribution ?? {}
|
69
|
+
);
|
70
|
+
},
|
71
|
+
});
|
72
|
+
}
|
@@ -0,0 +1,22 @@
|
|
1
|
+
import Controller from "@ember/controller";
|
2
|
+
import { dedupeTracked, cached } from "tracked-toolbox";
|
3
|
+
|
4
|
+
import config from "@projectcaluma/ember-distribution/config";
|
5
|
+
|
6
|
+
export default class DistributionNewController extends Controller {
|
7
|
+
@config config;
|
8
|
+
|
9
|
+
queryParams = ["types", "search"];
|
10
|
+
|
11
|
+
@dedupeTracked types = String(this.config.new.defaultTypes);
|
12
|
+
@dedupeTracked search = "";
|
13
|
+
|
14
|
+
@cached
|
15
|
+
get selectedTypes() {
|
16
|
+
return this.types.split(",");
|
17
|
+
}
|
18
|
+
|
19
|
+
set selectedTypes(value) {
|
20
|
+
this.types = String(value);
|
21
|
+
}
|
22
|
+
}
|
package/addon/engine.js
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
import Engine from "ember-engines/engine";
|
2
|
+
import loadInitializers from "ember-load-initializers";
|
3
|
+
import Resolver from "ember-resolver";
|
4
|
+
|
5
|
+
import config from "./config/environment";
|
6
|
+
|
7
|
+
const { modulePrefix } = config;
|
8
|
+
|
9
|
+
export default class DistributionEngine extends Engine {
|
10
|
+
modulePrefix = modulePrefix;
|
11
|
+
Resolver = Resolver;
|
12
|
+
|
13
|
+
dependencies = {
|
14
|
+
services: ["apollo", "notification", "intl", "caluma-options"],
|
15
|
+
};
|
16
|
+
}
|
17
|
+
|
18
|
+
loadInitializers(DistributionEngine, modulePrefix);
|
@@ -0,0 +1,89 @@
|
|
1
|
+
fragment InquiryDeadlineDocument on Document {
|
2
|
+
id
|
3
|
+
deadline: answers(question: $deadlineQuestion) {
|
4
|
+
edges {
|
5
|
+
node {
|
6
|
+
id
|
7
|
+
... on DateAnswer {
|
8
|
+
value
|
9
|
+
}
|
10
|
+
}
|
11
|
+
}
|
12
|
+
}
|
13
|
+
}
|
14
|
+
|
15
|
+
fragment InquiryStatusDocument on Document {
|
16
|
+
id
|
17
|
+
status: answers(question: $statusQuestion) {
|
18
|
+
edges {
|
19
|
+
node {
|
20
|
+
id
|
21
|
+
... on StringAnswer {
|
22
|
+
value
|
23
|
+
selectedOption {
|
24
|
+
slug
|
25
|
+
label
|
26
|
+
}
|
27
|
+
}
|
28
|
+
}
|
29
|
+
}
|
30
|
+
}
|
31
|
+
}
|
32
|
+
|
33
|
+
fragment InquiryDialog on WorkItem {
|
34
|
+
id
|
35
|
+
addressedGroups
|
36
|
+
controllingGroups
|
37
|
+
createdAt
|
38
|
+
closedAt
|
39
|
+
status
|
40
|
+
task {
|
41
|
+
id
|
42
|
+
slug
|
43
|
+
}
|
44
|
+
document {
|
45
|
+
...InquiryDeadlineDocument
|
46
|
+
info: answers(question: $infoQuestion) {
|
47
|
+
edges {
|
48
|
+
node {
|
49
|
+
id
|
50
|
+
... on StringAnswer {
|
51
|
+
value
|
52
|
+
}
|
53
|
+
}
|
54
|
+
}
|
55
|
+
}
|
56
|
+
}
|
57
|
+
childCase {
|
58
|
+
id
|
59
|
+
document {
|
60
|
+
...InquiryStatusDocument
|
61
|
+
info: answers(question: $answerInfoQuestion) {
|
62
|
+
edges {
|
63
|
+
node {
|
64
|
+
id
|
65
|
+
... on StringAnswer {
|
66
|
+
value
|
67
|
+
}
|
68
|
+
}
|
69
|
+
}
|
70
|
+
}
|
71
|
+
}
|
72
|
+
}
|
73
|
+
}
|
74
|
+
|
75
|
+
fragment Inquiry on WorkItem {
|
76
|
+
id
|
77
|
+
status
|
78
|
+
addressedGroups
|
79
|
+
controllingGroups
|
80
|
+
document @include(if: $includeNavigationData) {
|
81
|
+
...InquiryDeadlineDocument
|
82
|
+
}
|
83
|
+
childCase @include(if: $includeNavigationData) {
|
84
|
+
id
|
85
|
+
document {
|
86
|
+
...InquiryStatusDocument
|
87
|
+
}
|
88
|
+
}
|
89
|
+
}
|
@@ -0,0 +1,36 @@
|
|
1
|
+
#import InquiryStatusDocument from '../fragments/inquiry.graphql'
|
2
|
+
|
3
|
+
mutation CompleteInquiryWorkItem(
|
4
|
+
$workItem: ID!
|
5
|
+
$statusQuestion: ID!
|
6
|
+
$buttonTasks: [String]!
|
7
|
+
) {
|
8
|
+
completeWorkItem(input: { id: $workItem }) {
|
9
|
+
workItem {
|
10
|
+
id
|
11
|
+
status
|
12
|
+
case {
|
13
|
+
id
|
14
|
+
document {
|
15
|
+
id
|
16
|
+
...InquiryStatusDocument
|
17
|
+
}
|
18
|
+
workItems(tasks: $buttonTasks, status: READY) {
|
19
|
+
edges {
|
20
|
+
node {
|
21
|
+
id
|
22
|
+
task {
|
23
|
+
id
|
24
|
+
slug
|
25
|
+
}
|
26
|
+
}
|
27
|
+
}
|
28
|
+
}
|
29
|
+
parentWorkItem {
|
30
|
+
id
|
31
|
+
status
|
32
|
+
}
|
33
|
+
}
|
34
|
+
}
|
35
|
+
}
|
36
|
+
}
|