diff --git a/ember/app/caluma-query/models/work-item.js b/ember/app/caluma-query/models/work-item.js index f69003b6..079b4b9f 100644 --- a/ember/app/caluma-query/models/work-item.js +++ b/ember/app/caluma-query/models/work-item.js @@ -1,45 +1,6 @@ -import { inject as service } from "@ember/service"; -import { tracked } from "@glimmer/tracking"; import WorkItemModel from "@projectcaluma/ember-core/caluma-query/models/work-item"; -import saveWorkItemMutation from "caluma-portal-demo/gql/mutations/save-work-item"; -import { queryManager } from "ember-apollo-client"; export default class CustomWorkItemModel extends WorkItemModel { - @queryManager apollo; - - @service store; - @service router; - @service intl; - @service notifications; - - @tracked meta = this.raw.meta; - @tracked notViewed = this.raw.meta["not-viewed"]; - @tracked assignedUsers = this.raw.assignedUsers; - @tracked addressedGroups = this.raw.addressedGroups; - - get assignedUser() { - return this.assignedUsers; - } - set assignedUser(user) { - this.assignedUsers = [user]; - } - - get addressedGroup() { - return this.addressedGroups; - } - - get closedByUser() { - return this.raw.closedByUser; - } - - get createdByUser() { - return this.raw.createdByUser; - } - - get createdByGroup() { - return this.raw.createdByGroup; - } - get isReady() { return this.raw.status === "READY"; } @@ -48,77 +9,10 @@ export default class CustomWorkItemModel extends WorkItemModel { return this.raw.status === "COMPLETED"; } - get canEdit() { - return this.isReady; - } - - get canEditAsCreator() { - return this.isReady; - } - - get canComplete() { - return this.isReady; - } - - get responsible() { - return this.assignedUser; - } - get case() { return this.raw.case.parentWorkItem?.case || this.raw.case; } - get calumaForm() { - return null; - } - - async toggleRead() { - try { - this.notViewed = !this.notViewed; - - await this.apollo.mutate({ - mutation: saveWorkItemMutation, - variables: { - input: { - workItem: this.id, - meta: JSON.stringify({ - ...this.raw.meta, - "not-viewed": this.notViewed, - }), - }, - }, - }); - - return true; - } catch (error) { - this.notifications.error(this.intl.t("workItems.saveError")); - } - } - - async assignToMe() { - return await this.assignToUser(/* TODO current user*/); - } - - async assignToUser(user) { - try { - this.assignedUser = user; - - await this.apollo.mutate({ - mutation: saveWorkItemMutation, - variables: { - input: { - workItem: this.id, - assignedUsers: this.assignedUsers, - }, - }, - }); - - return true; - } catch (error) { - this.notifications.error(this.intl.t("workItems.saveError")); - } - } - static fragment = `{ createdAt createdByUser diff --git a/ember/app/cases/detail/controller.js b/ember/app/cases/detail/controller.js index 793ef422..e9a42db9 100644 --- a/ember/app/cases/detail/controller.js +++ b/ember/app/cases/detail/controller.js @@ -16,8 +16,9 @@ export default class CasesDetailController extends Controller.extend( this.fetchCase.cancelAll(); } - @lastValue("fetchCase") caseNode; - @task *fetchCase() { + @lastValue("fetchCase") case; + @task + *fetchCase() { if (typeof this.model === "object" && this.model) { return this.model; } diff --git a/ember/app/cases/detail/template.hbs b/ember/app/cases/detail/template.hbs index 966ee5eb..1ab6d387 100644 --- a/ember/app/cases/detail/template.hbs +++ b/ember/app/cases/detail/template.hbs @@ -9,19 +9,19 @@ class="uk-icon-button uk-margin-right" uk-icon="icon: arrow-left; ratio: 2" /> - {{this.caseNode.document.form.name}} + {{this.case.document.form.name}} - + {{t "documents.subnav.overview"}} - - + + {{t "documents.subnav.workItems"}} - - + + {{t "documents.subnav.document"}} - + {{outlet}} diff --git a/ember/app/cases/detail/work-items/edit/controller.js b/ember/app/cases/detail/work-items/edit/controller.js deleted file mode 100644 index 4f653f7a..00000000 --- a/ember/app/cases/detail/work-items/edit/controller.js +++ /dev/null @@ -1,3 +0,0 @@ -import Controller from "@ember/controller"; - -export default class CasesDetailWorkItemsEditController extends Controller {} diff --git a/ember/app/cases/detail/work-items/edit/form/controller.js b/ember/app/cases/detail/work-items/edit/form/controller.js index 748c0ed0..c3737d9d 100644 --- a/ember/app/cases/detail/work-items/edit/form/controller.js +++ b/ember/app/cases/detail/work-items/edit/form/controller.js @@ -14,27 +14,26 @@ export default class CasesDetailWorkItemsEditFormController extends Controller { @queryManager apollo; @service store; - @service notifications; + @service notification; @service intl; - @service moment; - - @lastValue("fetchWorkItems") workItem; + @service router; @calumaQuery({ query: allWorkItems }) workItemsQuery; + @lastValue("fetchWorkItems") workItem; @restartableTask() - *fetchWorkItems(model) { - if (typeof model === "object") { - return model; + *fetchWorkItems(id) { + if (typeof id === "object") { + return id; } try { - yield this.workItemsQuery.fetch({ filter: [{ id: model }] }); + yield this.workItemsQuery.fetch({ filter: [{ id }] }); return this.workItemsQuery.value[0]; } catch (error) { console.error(error); - this.notifications.error(this.intl.t("workItems.fetchError")); + this.notification.danger(this.intl.t("workItems.fetchError")); } } @@ -44,6 +43,6 @@ export default class CasesDetailWorkItemsEditFormController extends Controller { mutation: completeWorkItem, variables: { id: this.workItem.id }, }); - this.transitionToRoute("cases.detail.work-items"); + this.router.transitionTo("cases.detail.work-items"); } } diff --git a/ember/app/cases/detail/work-items/edit/index/controller.js b/ember/app/cases/detail/work-items/edit/index/controller.js index 4c82ac81..98fe7b57 100644 --- a/ember/app/cases/detail/work-items/edit/index/controller.js +++ b/ember/app/cases/detail/work-items/edit/index/controller.js @@ -1,12 +1,12 @@ import Controller from "@ember/controller"; import { action } from "@ember/object"; import { inject as service } from "@ember/service"; -import { tracked } from "@glimmer/tracking"; import calumaQuery from "@projectcaluma/ember-core/caluma-query"; import { allWorkItems } from "@projectcaluma/ember-core/caluma-query/queries"; import completeWorkItem from "caluma-portal-demo/gql/mutations/complete-work-item"; import saveWorkItem from "caluma-portal-demo/gql/mutations/save-work-item"; import { queryManager } from "ember-apollo-client"; +import { lastValue } from "ember-concurrency"; import { dropTask } from "ember-concurrency-decorators"; import moment from "moment"; @@ -14,11 +14,9 @@ export default class CasesDetailWorkItemsEditController extends Controller { @queryManager apollo; @service store; - @service notifications; + @service notification; @service intl; - @service moment; - - @tracked workItem; + @service router; @calumaQuery({ query: allWorkItems, options: "options" }) workItemsQuery; @@ -29,14 +27,15 @@ export default class CasesDetailWorkItemsEditController extends Controller { }; } + @lastValue("fetchWorkItem") workItem; @dropTask() - *fetchWorkItems() { + *fetchWorkItem(id) { try { - yield this.workItemsQuery.fetch({ filter: [{ id: this.model }] }); + yield this.workItemsQuery.fetch({ filter: [{ id }] }); - this.workItem = this.workItemsQuery.value[0]; + return this.workItemsQuery.value[0]; } catch (error) { - this.notifications.error(this.intl.t("workItems.fetchError")); + this.notification.danger(this.intl.t("workItems.fetchError")); } } @@ -60,11 +59,11 @@ export default class CasesDetailWorkItemsEditController extends Controller { variables: { id: this.workItem.id }, }); - this.notifications.success(this.intl.t("workItems.finishSuccess")); + this.notification.success(this.intl.t("workItems.finishSuccess")); - this.transitionToRoute("cases.detail.work-items.index"); + this.router.transitionTo("cases.detail.work-items.index"); } catch (error) { - this.notifications.error(this.intl.t("workItems.saveError")); + this.notification.danger(this.intl.t("workItems.saveError")); } } @@ -85,11 +84,11 @@ export default class CasesDetailWorkItemsEditController extends Controller { }, }); - this.notifications.success(this.intl.t("workItems.saveSuccess")); + this.notification.success(this.intl.t("workItems.saveSuccess")); - this.transitionToRoute("cases.detail.work-items.index"); + this.router.transitionTo("cases.detail.work-items.index"); } catch (error) { - this.notifications.error(this.intl.t("workItems.saveError")); + this.notification.danger(this.intl.t("workItems.saveError")); } } @@ -97,4 +96,9 @@ export default class CasesDetailWorkItemsEditController extends Controller { setDeadline(value) { this.workItem.deadline = moment(value); } + + @action + cancel() { + this.router.transitionTo("cases.detail.work-items.index"); + } } diff --git a/ember/app/cases/detail/work-items/edit/index/route.js b/ember/app/cases/detail/work-items/edit/index/route.js index 1cfcf4f9..46d9d991 100644 --- a/ember/app/cases/detail/work-items/edit/index/route.js +++ b/ember/app/cases/detail/work-items/edit/index/route.js @@ -4,4 +4,9 @@ export default class CasesDetailWorkItemsEditRoute extends Route { model() { return this.modelFor("cases.detail.work-items.edit"); } + + setupController(controller, model) { + super.setupController(controller, model); + controller.fetchWorkItem.perform(model); + } } diff --git a/ember/app/cases/detail/work-items/edit/index/template.hbs b/ember/app/cases/detail/work-items/edit/index/template.hbs index 7e989a5a..ae140bbf 100644 --- a/ember/app/cases/detail/work-items/edit/index/template.hbs +++ b/ember/app/cases/detail/work-items/edit/index/template.hbs @@ -1,6 +1,4 @@ - - -

+

{{t "workItems.edit"}}

@@ -33,12 +31,6 @@ hour12=false }} -
- - {{t "workItems.comment"}} - - {{or this.workItem.meta.completion-comment "-"}} -
{{/if}} @@ -47,53 +39,29 @@ {{on "submit" (perform this.saveManualWorkItem)}} >
- -
- -
-
- -
-
-
- -
- -
-
-
-
-
{{t "workItems.notifications"}}
-
- -
- -
-
-
- - - + + + +
- -{{#if this.workItem.canComplete}} - -{{/if}} diff --git a/ember/app/cases/detail/work-items/edit/route.js b/ember/app/cases/detail/work-items/edit/route.js index 6c8b6759..c12f8892 100644 --- a/ember/app/cases/detail/work-items/edit/route.js +++ b/ember/app/cases/detail/work-items/edit/route.js @@ -1,7 +1,7 @@ import Route from "@ember/routing/route"; export default class CasesDetailWorkItemsEditRoute extends Route { - model(params) { - return params.work_item_id; + model({ work_item_id }) { + return work_item_id; } } diff --git a/ember/app/cases/detail/work-items/edit/template.hbs b/ember/app/cases/detail/work-items/edit/template.hbs deleted file mode 100644 index e2147cab..00000000 --- a/ember/app/cases/detail/work-items/edit/template.hbs +++ /dev/null @@ -1 +0,0 @@ -{{outlet}} \ No newline at end of file diff --git a/ember/app/cases/detail/work-items/index/controller.js b/ember/app/cases/detail/work-items/index/controller.js index 7dcfc1ad..d3403e7c 100644 --- a/ember/app/cases/detail/work-items/index/controller.js +++ b/ember/app/cases/detail/work-items/index/controller.js @@ -1,12 +1,9 @@ import Controller from "@ember/controller"; import calumaQuery from "@projectcaluma/ember-core/caluma-query"; import { allWorkItems } from "@projectcaluma/ember-core/caluma-query/queries"; -import { queryManager } from "ember-apollo-client"; import { restartableTask } from "ember-concurrency-decorators"; export default class CasesDetailWorkItemsController extends Controller { - @queryManager apollo; - @calumaQuery({ query: allWorkItems, options: "options", @@ -25,20 +22,48 @@ export default class CasesDetailWorkItemsController extends Controller { }; } - get columns() { - return [ - "task", - "instance", - "description", - ...(this.status === "open" - ? ["deadline", "responsible"] - : ["closedAt", "closedBy"]), - ]; + get readyTableConfig() { + return { + columns: [ + { + heading: { label: "workItems.task" }, + type: "task-name", + }, + { + heading: { label: "workItems.deadline" }, + modelKey: "deadline", + type: "date", + }, + { + heading: { label: "workItems.actions.title" }, + type: "work-item-actions", + }, + ], + }; + } + get completedTableConfig() { + return { + columns: [ + { + heading: { label: "workItems.task" }, + type: "task-name", + }, + { + heading: { label: "workItems.closedAt" }, + modelKey: "closedAt", + type: "date", + }, + { + heading: { label: "workItems.actions.title" }, + type: "work-item-actions", + }, + ], + }; } @restartableTask *fetchWorkItems() { - const filter = [{ hasDeadline: true }, { case: this.model.id }]; + const filter = [{ case: this.model.id }]; yield this.readyWorkItemsQuery.fetch({ filter: [...filter, { status: "READY" }], diff --git a/ember/app/cases/detail/work-items/index/template.hbs b/ember/app/cases/detail/work-items/index/template.hbs index 174d5ec6..2676e2e2 100644 --- a/ember/app/cases/detail/work-items/index/template.hbs +++ b/ember/app/cases/detail/work-items/index/template.hbs @@ -6,13 +6,13 @@

{{t "workItems.completedTitle"}}

\ No newline at end of file diff --git a/ember/app/cases/template.hbs b/ember/app/cases/template.hbs deleted file mode 100644 index c24cd689..00000000 --- a/ember/app/cases/template.hbs +++ /dev/null @@ -1 +0,0 @@ -{{outlet}} diff --git a/ember/app/components/context-menu/component.js b/ember/app/components/context-menu/component.js deleted file mode 100644 index b0b008d5..00000000 --- a/ember/app/components/context-menu/component.js +++ /dev/null @@ -1,25 +0,0 @@ -import { action } from "@ember/object"; -import { later, cancel } from "@ember/runloop"; -import Component from "@glimmer/component"; -import { tracked } from "@glimmer/tracking"; - -export default class ContextMenuComponent extends Component { - @tracked menuOpen = false; - closeMenuDelay; - - @action - handleMouseLeave() { - this.closeMenuDelay = later( - this, - function () { - this.menuOpen = false; - }, - 1000 - ); - } - - @action - handleMouseEnter() { - cancel(this.closeMenuDelay); - } -} diff --git a/ember/app/components/context-menu/template.hbs b/ember/app/components/context-menu/template.hbs index caa409fb..58f314d0 100644 --- a/ember/app/components/context-menu/template.hbs +++ b/ember/app/components/context-menu/template.hbs @@ -1,25 +1,25 @@ -{{!-- template-lint-disable no-invalid-interactive --}} -
- - {{#if this.menuOpen}} -
-
    - {{#each @actions as |action|}} -
  • - -
  • - {{/each}} -
-
- {{/if}} + + + + +
+
+
    + {{#each @actions as |action|}} +
  • + + {{action.title}} + +
  • + {{/each}} +
+
diff --git a/ember/app/components/dynamic-table/table-data/component.js b/ember/app/components/dynamic-table/table-data/component.js index 6f684153..21750931 100644 --- a/ember/app/components/dynamic-table/table-data/component.js +++ b/ember/app/components/dynamic-table/table-data/component.js @@ -7,7 +7,10 @@ export default class DynamicTableTableDataComponent extends Component { } get value() { - return get(this.args.value, this.args.tdDefinition.modelKey); + if (this.args.tdDefinition.modelKey) { + return get(this.args.value, this.args.tdDefinition.modelKey); + } + return this.args.value; } get linkToModel() { diff --git a/ember/app/components/dynamic-table/task-name/template.hbs b/ember/app/components/dynamic-table/task-name/template.hbs new file mode 100644 index 00000000..88d35f1b --- /dev/null +++ b/ember/app/components/dynamic-table/task-name/template.hbs @@ -0,0 +1,11 @@ +{{#if @value.document}} + + {{@value.name}} + +{{else}} + {{@value.name}} +{{/if}} diff --git a/ember/app/components/dynamic-table/template.hbs b/ember/app/components/dynamic-table/template.hbs index 8dc809e2..468c0cbf 100644 --- a/ember/app/components/dynamic-table/template.hbs +++ b/ember/app/components/dynamic-table/template.hbs @@ -28,6 +28,14 @@ /> {{/each}} + {{else}} + {{#unless @loading}} + + + {{t "global.empty"}} + + + {{/unless}} {{/each}} {{#if @hasNextPage}} diff --git a/ember/app/components/dynamic-table/work-item-actions/component.js b/ember/app/components/dynamic-table/work-item-actions/component.js new file mode 100644 index 00000000..443659a7 --- /dev/null +++ b/ember/app/components/dynamic-table/work-item-actions/component.js @@ -0,0 +1,31 @@ +import { inject as service } from "@ember/service"; +import Component from "@glimmer/component"; +import { dropTask } from "ember-concurrency"; +import { performHelper } from "ember-concurrency/helpers/perform"; + +export default class WorkItemActions extends Component { + @service router; + @service intl; + + get actions() { + return [this.editAction].filter(Boolean); + } + + get editAction() { + return { + action: performHelper([this.edit], {}), + title: this.intl.t("workItems.actions.edit"), + }; + } + + @dropTask + *edit(event) { + event.preventDefault(); + + return yield this.router.transitionTo( + "cases.detail.work-items.edit", + this.args.value.case.id, + this.args.value.id + ); + } +} diff --git a/ember/app/components/dynamic-table/work-item-actions/template.hbs b/ember/app/components/dynamic-table/work-item-actions/template.hbs new file mode 100644 index 00000000..5b851f3e --- /dev/null +++ b/ember/app/components/dynamic-table/work-item-actions/template.hbs @@ -0,0 +1,5 @@ +{{#if this.actions.length}} + + + +{{/if}} diff --git a/ember/app/components/notifications/component.js b/ember/app/components/notifications/component.js deleted file mode 100644 index 2e3fb327..00000000 --- a/ember/app/components/notifications/component.js +++ /dev/null @@ -1,24 +0,0 @@ -import { action } from "@ember/object"; -import { inject as service } from "@ember/service"; -import Component from "@glimmer/component"; - -export default class NotificationsComponent extends Component { - @service notifications; - - get type() { - const type = this.args.notification?.type ?? "default"; - - if (type === "error") { - return "danger"; - } - - return type; - } - - @action - remove(notification, event) { - event.preventDefault(); - - this.notifications.remove(notification.id); - } -} diff --git a/ember/app/components/notifications/template.hbs b/ember/app/components/notifications/template.hbs deleted file mode 100644 index 16b06e94..00000000 --- a/ember/app/components/notifications/template.hbs +++ /dev/null @@ -1,8 +0,0 @@ -
- {{#each this.notifications.all as |notification|}} -
- - {{notification.message}} -
- {{/each}} -
diff --git a/ember/app/components/pagination/template.hbs b/ember/app/components/pagination/template.hbs deleted file mode 100644 index 44963a5a..00000000 --- a/ember/app/components/pagination/template.hbs +++ /dev/null @@ -1,14 +0,0 @@ -{{#if (and @query.value.length (gt @query.pageSize 0))}} - -{{/if}} diff --git a/ember/app/router.js b/ember/app/router.js index b8a52bc3..bcfd6b46 100644 --- a/ember/app/router.js +++ b/ember/app/router.js @@ -19,16 +19,12 @@ Router.map(function () { this.route("detail", { path: "/:id" }, function () { this.route("edit"); this.route("work-items", function () { - this.route("edit", { path: "/:id" }, function () { + this.route("edit", { path: "/:work_item_id" }, function () { this.route("form"); }); }); }); this.route("new"); }); - this.route("work-items", function () { - this.route("detail", { path: "/ :id" }, function () { - this.route("edit"); - }); - }); + this.route("work-items"); }); diff --git a/ember/app/services/notification.js b/ember/app/services/notification.js deleted file mode 100644 index 095d9a30..00000000 --- a/ember/app/services/notification.js +++ /dev/null @@ -1,29 +0,0 @@ -import Service from "@ember/service"; -import { tracked } from "@glimmer/tracking"; -import { v4 } from "uuid"; - -export default class NotificationsService extends Service { - @tracked all = []; - - add(type, message) { - const id = v4(); - - this.all = [...this.all, { id, type, message }]; - } - - remove(id) { - this.all = this.all.filter((obj) => obj.id !== id); - } - - clear() { - this.all = []; - } - - success(message) { - this.add("success", message); - } - - error(message) { - this.add("error", message); - } -} diff --git a/ember/app/styles/app.css b/ember/app/styles/app.css deleted file mode 100644 index e69de29b..00000000 diff --git a/ember/app/styles/app.scss b/ember/app/styles/app.scss index cf792361..ae6f895d 100644 --- a/ember/app/styles/app.scss +++ b/ember/app/styles/app.scss @@ -13,8 +13,6 @@ $modal-z-index: 1; @import "components/nav-bar"; @import "components/filters"; -@import "components/work-item-list"; -@import "components/context-menu"; main { display: flex; diff --git a/ember/app/styles/components/context-menu/index.scss b/ember/app/styles/components/context-menu/index.scss deleted file mode 100644 index 4c464ca3..00000000 --- a/ember/app/styles/components/context-menu/index.scss +++ /dev/null @@ -1,39 +0,0 @@ -.context-menu-container { - position: relative; -} - -.context-menu-trigger { - background: none; - border: none; -} - -.context-menu { - width: auto; - right: 8px; - left: auto; - z-index: 1; - text-align: left; - display: flex; - flex-direction: column; - position: absolute; - padding: 1rem; - background: white; - box-shadow: 0 0 0.75rem rgba(0, 0, 0, 0.25); - - ul { - margin: 0 !important; - padding-left: 1rem; - - > li > button { - padding: 0; - background: none; - border: none; - white-space: nowrap; - cursor: pointer; - } - - > li:last-of-type { - margin-bottom: 0 !important; - } - } -} diff --git a/ember/app/styles/components/work-item-list/index.scss b/ember/app/styles/components/work-item-list/index.scss deleted file mode 100644 index 49523a3c..00000000 --- a/ember/app/styles/components/work-item-list/index.scss +++ /dev/null @@ -1,64 +0,0 @@ -$expired-color: #cc0000; -$expiring-color: #ff8800; - -.work-item-list { - tr.highlight { - th:first-child, - td:first-child { - padding-left: 0 !important; - padding-right: 0 !important; - } - - th:nth-child(2), - td:nth-child(2) { - border-left: none !important; - } - - td:first-child { - text-align: center; - - &::before { - content: ""; - display: inline-flex; - width: 6px; - height: 6px; - border-radius: 50%; - margin: 0 0 0 5px; - padding: 0; - border: 1px solid lightgrey; - } - } - - &--not-viewed { - font-weight: 700; - } - - &--expired td:first-child::before { - background-color: $expired-color; - border-color: darken($expired-color, 10%); - } - - &--expiring td:first-child::before { - background-color: $expiring-color; - border-color: darken($expiring-color, 10%); - } - } - - td:last-child { - text-align: center; - padding-left: 0 !important; - padding-right: 0 !important; - } - - td { - white-space: nowrap; - } - - td.task, - td.responsible, - td.description { - text-overflow: ellipsis; - overflow: hidden; - max-width: 200px; - } -} diff --git a/ember/app/work-items/index/controller.js b/ember/app/work-items/controller.js similarity index 52% rename from ember/app/work-items/index/controller.js rename to ember/app/work-items/controller.js index 18236f4b..64a9a821 100644 --- a/ember/app/work-items/index/controller.js +++ b/ember/app/work-items/controller.js @@ -3,23 +3,17 @@ import { action, set } from "@ember/object"; import { tracked } from "@glimmer/tracking"; import calumaQuery from "@projectcaluma/ember-core/caluma-query"; import { allWorkItems } from "@projectcaluma/ember-core/caluma-query/queries"; -import { queryManager } from "ember-apollo-client"; import { restartableTask } from "ember-concurrency-decorators"; -export default class WorkItemsIndexController extends Controller { - queryParams = ["order", "responsible", "type", "status", "role"]; - - @queryManager apollo; +export default class WorkItemsController extends Controller { + queryParams = ["order", "status"]; @calumaQuery({ query: allWorkItems, options: "options" }) workItemsQuery; // Filters @tracked order = "urgent"; - @tracked responsible = "all"; - @tracked type = "all"; @tracked status = "open"; - @tracked role = "active"; get options() { return { @@ -27,26 +21,15 @@ export default class WorkItemsIndexController extends Controller { }; } - get columns() { - return [ - "task", - "instance", - "description", - ...(this.status === "open" - ? ["deadline", "responsible"] - : ["closedAt", "closedBy"]), - ]; - } - get tableConfig() { return { columns: [ { - heading: { label: "work-items.task" }, + heading: { label: "workItems.task" }, type: "task-name", }, { - heading: { label: "work-items.case" }, + heading: { label: "workItems.document" }, modelKey: "case.document.form.name", linkTo: "cases.detail.index", linkToModelField: "case.id", @@ -54,27 +37,20 @@ export default class WorkItemsIndexController extends Controller { ...(this.status === "open" ? [ { - heading: { label: "work-items.deadline" }, + heading: { label: "workItems.deadline" }, modelKey: "deadline", - }, - { - heading: { label: "work-items.responsible" }, - modelKey: "responsible", + type: "date", }, ] : [ { - heading: { label: "work-items.closedAt" }, + heading: { label: "workItems.closedAt" }, modelKey: "closedAt", type: "date", }, - { - heading: { label: "work-items.closedBy" }, - modelKey: "closedByUser.fullName", - }, ]), { - heading: { label: "work-items.action" }, + heading: { label: "workItems.actions.title" }, type: "work-item-actions", }, ], @@ -83,18 +59,7 @@ export default class WorkItemsIndexController extends Controller { @restartableTask *fetchWorkItems() { - const filter = [{ hasDeadline: true }]; - - if (this.responsible === "own") { - // TODO user - filter.push({ assignedUsers: [] }); - } else { - filter.push({ assignedUsers: [] }); - } - - if (this.type === "unread") { - filter.push({ metaValue: [{ key: "not-viewed", value: true }] }); - } + const filter = []; if (this.status === "closed") { filter.push({ status: "COMPLETED" }); @@ -102,13 +67,6 @@ export default class WorkItemsIndexController extends Controller { filter.push({ status: "READY" }); } - if (this.role === "control") { - // TODO group - filter.push({ controllingGroups: [] }); - } else { - filter.push({ addressedGroups: [] }); - } - const order = this.order === "urgent" ? [{ attribute: "DEADLINE", direction: "ASC" }] diff --git a/ember/app/work-items/detail/edit/controller.js b/ember/app/work-items/detail/edit/controller.js deleted file mode 100644 index 3d949988..00000000 --- a/ember/app/work-items/detail/edit/controller.js +++ /dev/null @@ -1,100 +0,0 @@ -import Controller from "@ember/controller"; -import { action } from "@ember/object"; -import { inject as service } from "@ember/service"; -import { tracked } from "@glimmer/tracking"; -import calumaQuery from "@projectcaluma/ember-core/caluma-query"; -import { allWorkItems } from "@projectcaluma/ember-core/caluma-query/queries"; -import completeWorkItem from "caluma-portal-demo/gql/mutations/complete-work-item"; -import saveWorkItem from "caluma-portal-demo/gql/mutations/save-work-item"; -import { queryManager } from "ember-apollo-client"; -import { dropTask } from "ember-concurrency-decorators"; -import moment from "moment"; - -export default class WorkItemsDetailEditController extends Controller { - @queryManager apollo; - - @service store; - @service notifications; - @service intl; - @service moment; - - @tracked workItem; - - @calumaQuery({ query: allWorkItems, options: "options" }) - workItemsQuery; - - get options() { - return { - pageSize: 1, - }; - } - - @dropTask() - *fetchWorkItems() { - try { - yield this.workItemsQuery.fetch({ filter: [{ id: this.model }] }); - - this.workItem = this.workItemsQuery.value[0]; - } catch (error) { - this.notifications.error(this.intl.t("workItems.fetchError")); - } - } - - @dropTask - *finishWorkItem(event) { - event.preventDefault(); - - try { - yield this.apollo.mutate({ - mutation: saveWorkItem, - variables: { - input: { - workItem: this.workItem.id, - meta: JSON.stringify(this.workItem.meta), - }, - }, - }); - - yield this.apollo.mutate({ - mutation: completeWorkItem, - variables: { id: this.workItem.id }, - }); - - this.notifications.success(this.intl.t("workItems.finishSuccess")); - - this.transitionToRoute("work-items.index"); - } catch (error) { - this.notifications.error(this.intl.t("workItems.saveError")); - } - } - - @dropTask - *saveManualWorkItem(event) { - event.preventDefault(); - - try { - yield this.apollo.mutate({ - mutation: saveWorkItem, - variables: { - input: { - workItem: this.workItem.id, - description: this.workItem.description, - deadline: this.workItem.deadline, - meta: JSON.stringify(this.workItem?.meta), - }, - }, - }); - - this.notifications.success(this.intl.t("workItems.saveSuccess")); - - this.transitionToRoute("work-items.index"); - } catch (error) { - this.notifications.error(this.intl.t("workItems.saveError")); - } - } - - @action - setDeadline(value) { - this.workItem.deadline = moment(value); - } -} diff --git a/ember/app/work-items/detail/edit/route.js b/ember/app/work-items/detail/edit/route.js deleted file mode 100644 index 1141a3c1..00000000 --- a/ember/app/work-items/detail/edit/route.js +++ /dev/null @@ -1,7 +0,0 @@ -import Route from "@ember/routing/route"; - -export default class WorkItemsDetailEditRoute extends Route { - model() { - return this.modelFor("work-items.detail"); - } -} diff --git a/ember/app/work-items/detail/edit/template.hbs b/ember/app/work-items/detail/edit/template.hbs deleted file mode 100644 index fc9306c9..00000000 --- a/ember/app/work-items/detail/edit/template.hbs +++ /dev/null @@ -1,201 +0,0 @@ - - -

- {{t "workItems.edit"}} -

- -
- -

- {{this.workItem.task.name}} -

- -
- {{#if this.workItem.isCompleted}} -
- - {{t "workItems.closedBy"}} - - {{this.workItem.closedByUser.fullName}} -
-
- - {{t "workItems.closedAt"}} - - {{ - format-date - this.workItem.closedAt - day="2-digit" - month="2-digit" - year="numeric" - hour="2-digit" - minute="2-digit" - hour12=false - }} -
-
- - {{t "workItems.comment"}} - - {{or this.workItem.meta.completion-comment "-"}} -
- {{/if}} -
- -
-
- -
- -
-
- -
- -
- -
-
- -
- -
- -
-
- -
- -
-