2019-11-24 14:16:24 +01:00
|
|
|
<template>
|
2021-01-21 20:20:51 +01:00
|
|
|
<div :class="{ 'is-loading': taskService.loading, 'visible': visible}" class="loader-container task-view-container">
|
2019-11-24 14:16:24 +01:00
|
|
|
<div class="task-view">
|
2021-01-10 22:37:43 +01:00
|
|
|
<heading v-model="task" :can-write="canWrite" ref="heading"/>
|
2020-05-09 23:28:54 +02:00
|
|
|
<h6 class="subtitle" v-if="parent && parent.namespace && parent.list">
|
2021-07-09 10:22:20 +02:00
|
|
|
{{ getNamespaceTitle(parent.namespace) }} >
|
2021-07-19 11:20:05 +02:00
|
|
|
<router-link :to="{ name: 'list.index', params: { listId: parent.list.id } }">
|
2021-07-09 10:22:20 +02:00
|
|
|
{{ getListTitle(parent.list) }}
|
2020-05-09 23:28:54 +02:00
|
|
|
</router-link>
|
|
|
|
</h6>
|
2019-11-24 14:16:24 +01:00
|
|
|
|
|
|
|
<!-- Content and buttons -->
|
|
|
|
<div class="columns">
|
|
|
|
<!-- Content -->
|
2020-09-05 22:35:52 +02:00
|
|
|
<div :class="{'is-two-thirds': canWrite}" class="column">
|
2019-11-24 14:16:24 +01:00
|
|
|
<div class="columns details">
|
|
|
|
<div class="column assignees" v-if="activeFields.assignees">
|
|
|
|
<!-- Assignees -->
|
|
|
|
<div class="detail-title">
|
|
|
|
<icon icon="users"/>
|
2021-06-24 01:24:57 +02:00
|
|
|
{{ $t('task.attributes.assignees') }}
|
2019-11-24 14:16:24 +01:00
|
|
|
</div>
|
|
|
|
<edit-assignees
|
2020-09-05 22:35:52 +02:00
|
|
|
:disabled="!canWrite"
|
|
|
|
:list-id="task.listId"
|
|
|
|
:task-id="task.id"
|
|
|
|
ref="assignees"
|
2020-10-02 18:40:04 +02:00
|
|
|
v-model="task.assignees"
|
2019-11-24 14:16:24 +01:00
|
|
|
/>
|
|
|
|
</div>
|
2021-01-04 22:22:56 +01:00
|
|
|
<transition name="flash-background" appear>
|
|
|
|
<div class="column" v-if="activeFields.priority">
|
|
|
|
<!-- Priority -->
|
|
|
|
<div class="detail-title">
|
|
|
|
<icon :icon="['far', 'star']"/>
|
2021-06-24 01:24:57 +02:00
|
|
|
{{ $t('task.attributes.priority') }}
|
2021-01-04 22:22:56 +01:00
|
|
|
</div>
|
|
|
|
<priority-select
|
|
|
|
:disabled="!canWrite"
|
|
|
|
@change="saveTask"
|
|
|
|
ref="priority"
|
|
|
|
v-model="task.priority"/>
|
2019-11-24 14:16:24 +01:00
|
|
|
</div>
|
2021-01-04 22:22:56 +01:00
|
|
|
</transition>
|
|
|
|
<transition name="flash-background" appear>
|
|
|
|
<div class="column" v-if="activeFields.dueDate">
|
|
|
|
<!-- Due Date -->
|
|
|
|
<div class="detail-title">
|
|
|
|
<icon icon="calendar"/>
|
2021-06-24 01:24:57 +02:00
|
|
|
{{ $t('task.attributes.dueDate') }}
|
2021-01-04 22:22:56 +01:00
|
|
|
</div>
|
|
|
|
<div class="date-input">
|
|
|
|
<datepicker
|
|
|
|
v-model="task.dueDate"
|
|
|
|
@close-on-change="() => saveTask()"
|
2021-06-24 01:24:57 +02:00
|
|
|
:choose-date-label="$t('task.detail.chooseDueDate')"
|
2021-01-04 22:22:56 +01:00
|
|
|
:disabled="taskService.loading || !canWrite"
|
|
|
|
ref="dueDate"
|
2021-01-17 18:57:57 +01:00
|
|
|
/>
|
|
|
|
<a
|
|
|
|
@click="() => {task.dueDate = null;saveTask()}"
|
|
|
|
v-if="task.dueDate && canWrite"
|
|
|
|
class="remove">
|
2021-01-04 22:22:56 +01:00
|
|
|
<span class="icon is-small">
|
|
|
|
<icon icon="times"></icon>
|
|
|
|
</span>
|
|
|
|
</a>
|
|
|
|
</div>
|
2019-11-24 14:16:24 +01:00
|
|
|
</div>
|
2021-01-04 22:22:56 +01:00
|
|
|
</transition>
|
|
|
|
<transition name="flash-background" appear>
|
|
|
|
<div class="column" v-if="activeFields.percentDone">
|
|
|
|
<!-- Percent Done -->
|
|
|
|
<div class="detail-title">
|
|
|
|
<icon icon="percent"/>
|
2021-06-24 01:24:57 +02:00
|
|
|
{{ $t('task.attributes.percentDone') }}
|
2021-01-04 22:22:56 +01:00
|
|
|
</div>
|
|
|
|
<percent-done-select
|
|
|
|
:disabled="!canWrite"
|
|
|
|
@change="saveTask"
|
|
|
|
ref="percentDone"
|
|
|
|
v-model="task.percentDone"/>
|
2019-11-24 14:16:24 +01:00
|
|
|
</div>
|
2021-01-04 22:22:56 +01:00
|
|
|
</transition>
|
|
|
|
<transition name="flash-background" appear>
|
|
|
|
<div class="column" v-if="activeFields.startDate">
|
|
|
|
<!-- Start Date -->
|
|
|
|
<div class="detail-title">
|
|
|
|
<icon icon="calendar-week"/>
|
2021-06-24 01:24:57 +02:00
|
|
|
{{ $t('task.attributes.startDate') }}
|
2021-01-04 22:22:56 +01:00
|
|
|
</div>
|
|
|
|
<div class="date-input">
|
|
|
|
<datepicker
|
|
|
|
v-model="task.startDate"
|
|
|
|
@close-on-change="() => saveTask()"
|
2021-06-24 01:24:57 +02:00
|
|
|
:choose-date-label="$t('task.detail.chooseStartDate')"
|
2021-01-04 22:22:56 +01:00
|
|
|
:disabled="taskService.loading || !canWrite"
|
|
|
|
ref="startDate"
|
|
|
|
/>
|
2021-01-17 18:57:57 +01:00
|
|
|
<a
|
|
|
|
@click="() => {task.startDate = null;saveTask()}"
|
|
|
|
v-if="task.startDate && canWrite"
|
|
|
|
class="remove"
|
|
|
|
>
|
2021-01-04 22:22:56 +01:00
|
|
|
<span class="icon is-small">
|
|
|
|
<icon icon="times"></icon>
|
|
|
|
</span>
|
|
|
|
</a>
|
|
|
|
</div>
|
2019-11-24 14:16:24 +01:00
|
|
|
</div>
|
2021-01-04 22:22:56 +01:00
|
|
|
</transition>
|
|
|
|
<transition name="flash-background" appear>
|
|
|
|
<div class="column" v-if="activeFields.endDate">
|
|
|
|
<!-- End Date -->
|
|
|
|
<div class="detail-title">
|
|
|
|
<icon icon="calendar-week"/>
|
2021-06-24 01:24:57 +02:00
|
|
|
{{ $t('task.attributes.endDate') }}
|
2021-01-04 22:22:56 +01:00
|
|
|
</div>
|
|
|
|
<div class="date-input">
|
|
|
|
<datepicker
|
|
|
|
v-model="task.endDate"
|
|
|
|
@close-on-change="() => saveTask()"
|
2021-06-24 01:24:57 +02:00
|
|
|
:choose-date-label="$t('task.detail.chooseEndDate')"
|
2021-01-04 22:22:56 +01:00
|
|
|
:disabled="taskService.loading || !canWrite"
|
|
|
|
ref="endDate"
|
|
|
|
/>
|
2021-01-17 18:57:57 +01:00
|
|
|
<a
|
|
|
|
@click="() => {task.endDate = null;saveTask()}"
|
|
|
|
v-if="task.endDate && canWrite"
|
|
|
|
class="remove">
|
2021-01-04 22:22:56 +01:00
|
|
|
<span class="icon is-small">
|
|
|
|
<icon icon="times"></icon>
|
|
|
|
</span>
|
|
|
|
</a>
|
|
|
|
</div>
|
2019-11-24 14:16:24 +01:00
|
|
|
</div>
|
2021-01-04 22:22:56 +01:00
|
|
|
</transition>
|
|
|
|
<transition name="flash-background" appear>
|
|
|
|
<div class="column" v-if="activeFields.reminders">
|
|
|
|
<!-- Reminders -->
|
|
|
|
<div class="detail-title">
|
|
|
|
<icon icon="history"/>
|
2021-06-24 01:24:57 +02:00
|
|
|
{{ $t('task.attributes.reminders') }}
|
2021-01-04 22:22:56 +01:00
|
|
|
</div>
|
|
|
|
<reminders
|
|
|
|
:disabled="!canWrite"
|
|
|
|
@change="saveTask"
|
|
|
|
ref="reminders"
|
|
|
|
v-model="task.reminderDates"/>
|
2019-11-24 14:16:24 +01:00
|
|
|
</div>
|
2021-01-04 22:22:56 +01:00
|
|
|
</transition>
|
|
|
|
<transition name="flash-background" appear>
|
|
|
|
<div class="column" v-if="activeFields.repeatAfter">
|
|
|
|
<!-- Repeat after -->
|
|
|
|
<div class="detail-title">
|
|
|
|
<icon :icon="['far', 'clock']"/>
|
2021-06-24 01:24:57 +02:00
|
|
|
{{ $t('task.attributes.repeat') }}
|
2021-01-04 22:22:56 +01:00
|
|
|
</div>
|
|
|
|
<repeat-after
|
|
|
|
:disabled="!canWrite"
|
|
|
|
@change="saveTask"
|
|
|
|
ref="repeatAfter"
|
|
|
|
v-model="task"/>
|
2019-11-24 14:16:24 +01:00
|
|
|
</div>
|
2021-01-04 22:22:56 +01:00
|
|
|
</transition>
|
|
|
|
<transition name="flash-background" appear>
|
|
|
|
<div class="column" v-if="activeFields.color">
|
|
|
|
<!-- Color -->
|
|
|
|
<div class="detail-title">
|
|
|
|
<icon icon="fill-drip"/>
|
2021-06-24 01:24:57 +02:00
|
|
|
{{ $t('task.attributes.color') }}
|
2021-01-04 22:22:56 +01:00
|
|
|
</div>
|
|
|
|
<color-picker
|
|
|
|
@change="saveTask"
|
|
|
|
menu-position="bottom"
|
|
|
|
ref="color"
|
|
|
|
v-model="taskColor"/>
|
2020-06-21 20:27:39 +02:00
|
|
|
</div>
|
2021-01-04 22:22:56 +01:00
|
|
|
</transition>
|
2019-11-24 14:16:24 +01:00
|
|
|
</div>
|
|
|
|
|
|
|
|
<!-- Labels -->
|
|
|
|
<div class="labels-list details" v-if="activeFields.labels">
|
|
|
|
<div class="detail-title">
|
|
|
|
<span class="icon is-grey">
|
|
|
|
<icon icon="tags"/>
|
|
|
|
</span>
|
2021-06-24 01:24:57 +02:00
|
|
|
{{ $t('task.attributes.labels') }}
|
2019-11-24 14:16:24 +01:00
|
|
|
</div>
|
2020-09-05 22:35:52 +02:00
|
|
|
<edit-labels :disabled="!canWrite" :task-id="taskId" ref="labels" v-model="task.labels"/>
|
2019-11-24 14:16:24 +01:00
|
|
|
</div>
|
|
|
|
|
|
|
|
<!-- Description -->
|
2021-01-16 21:55:43 +01:00
|
|
|
<div class="details content description">
|
2020-11-22 17:32:35 +01:00
|
|
|
<description
|
|
|
|
v-model="task"
|
|
|
|
:can-write="canWrite"
|
|
|
|
:attachment-upload="attachmentUpload"
|
|
|
|
/>
|
2019-11-24 14:16:24 +01:00
|
|
|
</div>
|
|
|
|
|
|
|
|
<!-- Attachments -->
|
2021-01-18 21:58:34 +01:00
|
|
|
<div class="content attachments" v-if="activeFields.attachments || hasAttachments">
|
2019-11-24 14:16:24 +01:00
|
|
|
<attachments
|
2020-09-05 22:35:52 +02:00
|
|
|
:edit-enabled="canWrite"
|
|
|
|
:task-id="taskId"
|
|
|
|
ref="attachments"
|
2019-11-24 14:16:24 +01:00
|
|
|
/>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<!-- Related Tasks -->
|
2021-01-16 21:55:43 +01:00
|
|
|
<div class="content details mb-0" v-if="activeFields.relatedTasks">
|
2019-11-24 14:16:24 +01:00
|
|
|
<h3>
|
|
|
|
<span class="icon is-grey">
|
|
|
|
<icon icon="tasks"/>
|
|
|
|
</span>
|
2021-06-24 01:24:57 +02:00
|
|
|
{{ $t('task.attributes.relatedTasks') }}
|
2019-11-24 14:16:24 +01:00
|
|
|
</h3>
|
|
|
|
<related-tasks
|
2020-09-05 22:35:52 +02:00
|
|
|
:edit-enabled="canWrite"
|
|
|
|
:initial-related-tasks="task.relatedTasks"
|
|
|
|
:list-id="task.listId"
|
|
|
|
:show-no-relations-notice="true"
|
|
|
|
:task-id="taskId"
|
|
|
|
ref="relatedTasks"
|
2019-11-24 14:16:24 +01:00
|
|
|
/>
|
|
|
|
</div>
|
2020-02-25 21:11:36 +01:00
|
|
|
|
2020-04-18 14:39:56 +02:00
|
|
|
<!-- Move Task -->
|
2021-01-16 21:55:43 +01:00
|
|
|
<div class="content details" v-if="activeFields.moveList">
|
2020-04-18 14:39:56 +02:00
|
|
|
<h3>
|
|
|
|
<span class="icon is-grey">
|
|
|
|
<icon icon="list"/>
|
|
|
|
</span>
|
2021-06-24 01:24:57 +02:00
|
|
|
{{ $t('task.detail.move') }}
|
2020-04-18 14:39:56 +02:00
|
|
|
</h3>
|
|
|
|
<div class="field has-addons">
|
|
|
|
<div class="control is-expanded">
|
2020-06-27 23:12:33 +02:00
|
|
|
<list-search @selected="changeList" ref="moveList"/>
|
2020-04-18 14:39:56 +02:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
2020-02-25 21:11:36 +01:00
|
|
|
<!-- Comments -->
|
2020-09-05 22:35:52 +02:00
|
|
|
<comments :can-write="canWrite" :task-id="taskId"/>
|
2019-11-24 14:16:24 +01:00
|
|
|
</div>
|
2020-08-11 20:18:59 +02:00
|
|
|
<div class="column is-one-third action-buttons" v-if="canWrite">
|
2021-01-17 18:57:57 +01:00
|
|
|
<x-button
|
|
|
|
:class="{'is-success': !task.done}"
|
|
|
|
:shadow="task.done"
|
2020-09-05 22:35:52 +02:00
|
|
|
@click="toggleTaskDone()"
|
2021-01-17 18:57:57 +01:00
|
|
|
class="is-outlined has-no-border"
|
|
|
|
icon="check-double"
|
|
|
|
type="secondary"
|
|
|
|
>
|
2021-06-24 01:24:57 +02:00
|
|
|
{{ task.done ? $t('task.detail.undone') : $t('task.detail.done') }}
|
2021-01-17 18:57:57 +01:00
|
|
|
</x-button>
|
2021-02-14 20:18:51 +01:00
|
|
|
<task-subscription
|
|
|
|
entity="task"
|
|
|
|
:entity-id="task.id"
|
|
|
|
:subscription="task.subscription"
|
|
|
|
@change="sub => task.subscription = sub"
|
|
|
|
/>
|
2021-01-17 18:57:57 +01:00
|
|
|
<x-button
|
2020-09-05 22:35:52 +02:00
|
|
|
@click="setFieldActive('assignees')"
|
2021-05-19 17:48:32 +02:00
|
|
|
@shortkey.native="setFieldActive('assignees')"
|
2021-01-17 18:57:57 +01:00
|
|
|
type="secondary"
|
2020-11-11 21:31:11 +01:00
|
|
|
v-shortkey="['a']">
|
2019-11-24 14:16:24 +01:00
|
|
|
<span class="icon is-small"><icon icon="users"/></span>
|
2021-06-24 01:24:57 +02:00
|
|
|
{{ $t('task.detail.actions.assign') }}
|
2021-01-17 18:57:57 +01:00
|
|
|
</x-button>
|
|
|
|
<x-button
|
2020-09-05 22:35:52 +02:00
|
|
|
@click="setFieldActive('labels')"
|
2021-05-19 17:48:32 +02:00
|
|
|
@shortkey.native="setFieldActive('labels')"
|
2021-01-17 18:57:57 +01:00
|
|
|
type="secondary"
|
|
|
|
v-shortkey="['l']"
|
|
|
|
icon="tags"
|
|
|
|
>
|
2021-06-24 01:24:57 +02:00
|
|
|
{{ $t('task.detail.actions.label') }}
|
2021-01-17 18:57:57 +01:00
|
|
|
</x-button>
|
|
|
|
<x-button
|
|
|
|
@click="setFieldActive('priority')"
|
|
|
|
type="secondary"
|
|
|
|
:icon="['far', 'star']"
|
|
|
|
>
|
2021-06-24 01:24:57 +02:00
|
|
|
{{ $t('task.detail.actions.priority') }}
|
2021-01-17 18:57:57 +01:00
|
|
|
</x-button>
|
|
|
|
<x-button
|
2020-09-05 22:35:52 +02:00
|
|
|
@click="setFieldActive('dueDate')"
|
2021-05-19 17:48:32 +02:00
|
|
|
@shortkey.native="setFieldActive('dueDate')"
|
2021-01-17 18:57:57 +01:00
|
|
|
type="secondary"
|
|
|
|
v-shortkey="['d']"
|
|
|
|
icon="calendar"
|
|
|
|
>
|
2021-06-24 01:24:57 +02:00
|
|
|
{{ $t('task.detail.actions.dueDate') }}
|
2021-01-17 18:57:57 +01:00
|
|
|
</x-button>
|
|
|
|
<x-button
|
|
|
|
@click="setFieldActive('startDate')"
|
|
|
|
type="secondary"
|
|
|
|
icon="calendar-week"
|
|
|
|
>
|
2021-06-24 01:24:57 +02:00
|
|
|
{{ $t('task.detail.actions.startDate') }}
|
2021-01-17 18:57:57 +01:00
|
|
|
</x-button>
|
|
|
|
<x-button
|
|
|
|
@click="setFieldActive('endDate')"
|
|
|
|
type="secondary"
|
|
|
|
icon="calendar-week"
|
|
|
|
>
|
2021-06-24 01:24:57 +02:00
|
|
|
{{ $t('task.detail.actions.endDate') }}
|
2021-01-17 18:57:57 +01:00
|
|
|
</x-button>
|
|
|
|
<x-button
|
|
|
|
@click="setFieldActive('reminders')"
|
|
|
|
type="secondary"
|
|
|
|
icon="history"
|
|
|
|
>
|
2021-06-24 01:24:57 +02:00
|
|
|
{{ $t('task.detail.actions.reminders') }}
|
2021-01-17 18:57:57 +01:00
|
|
|
</x-button>
|
|
|
|
<x-button
|
|
|
|
@click="setFieldActive('repeatAfter')"
|
|
|
|
type="secondary"
|
|
|
|
:icon="['far', 'clock']"
|
|
|
|
>
|
2021-06-24 01:24:57 +02:00
|
|
|
{{ $t('task.detail.actions.repeatAfter') }}
|
2021-01-17 18:57:57 +01:00
|
|
|
</x-button>
|
|
|
|
<x-button
|
|
|
|
@click="setFieldActive('percentDone')"
|
|
|
|
type="secondary"
|
|
|
|
icon="percent"
|
|
|
|
>
|
2021-06-24 01:24:57 +02:00
|
|
|
{{ $t('task.detail.actions.percentDone') }}
|
2021-01-17 18:57:57 +01:00
|
|
|
</x-button>
|
|
|
|
<x-button
|
2020-09-05 22:35:52 +02:00
|
|
|
@click="setFieldActive('attachments')"
|
2021-05-19 17:48:32 +02:00
|
|
|
@shortkey.native="setFieldActive('attachments')"
|
2021-01-17 18:57:57 +01:00
|
|
|
type="secondary"
|
|
|
|
v-shortkey="['f']"
|
|
|
|
icon="paperclip"
|
|
|
|
>
|
2021-06-24 01:24:57 +02:00
|
|
|
{{ $t('task.detail.actions.attachments') }}
|
2021-01-17 18:57:57 +01:00
|
|
|
</x-button>
|
|
|
|
<x-button
|
2020-09-05 22:35:52 +02:00
|
|
|
@click="setFieldActive('relatedTasks')"
|
2021-05-19 17:48:32 +02:00
|
|
|
@shortkey.native="setFieldActive('relatedTasks')"
|
2021-01-17 18:57:57 +01:00
|
|
|
type="secondary"
|
|
|
|
v-shortkey="['r']"
|
|
|
|
icon="tasks"
|
|
|
|
>
|
2021-06-24 01:24:57 +02:00
|
|
|
{{ $t('task.detail.actions.relatedTasks') }}
|
2021-01-17 18:57:57 +01:00
|
|
|
</x-button>
|
|
|
|
<x-button
|
|
|
|
@click="setFieldActive('moveList')"
|
|
|
|
type="secondary"
|
|
|
|
icon="list"
|
|
|
|
>
|
2021-06-24 01:24:57 +02:00
|
|
|
{{ $t('task.detail.actions.moveList') }}
|
2021-01-17 18:57:57 +01:00
|
|
|
</x-button>
|
|
|
|
<x-button
|
|
|
|
@click="setFieldActive('color')"
|
|
|
|
type="secondary"
|
|
|
|
icon="fill-drip"
|
|
|
|
>
|
2021-06-24 01:24:57 +02:00
|
|
|
{{ $t('task.detail.actions.color') }}
|
2021-01-17 18:57:57 +01:00
|
|
|
</x-button>
|
|
|
|
<x-button
|
|
|
|
@click="showDeleteModal = true"
|
|
|
|
icon="trash-alt"
|
|
|
|
:shadow="false"
|
|
|
|
class="is-danger is-outlined has-no-border"
|
|
|
|
>
|
2021-06-24 01:24:57 +02:00
|
|
|
{{ $t('task.detail.actions.delete') }}
|
2021-01-17 18:57:57 +01:00
|
|
|
</x-button>
|
2020-10-25 12:25:08 +01:00
|
|
|
|
|
|
|
<!-- Created / Updated [by] -->
|
|
|
|
<p class="created">
|
2021-06-24 01:24:57 +02:00
|
|
|
<i18n path="task.detail.created">
|
|
|
|
<span v-tooltip="formatDate(task.created)">{{ formatDateSince(task.created) }}</span>
|
|
|
|
{{ task.createdBy.getDisplayName() }}
|
|
|
|
</i18n>
|
2020-10-25 12:25:08 +01:00
|
|
|
<template v-if="+new Date(task.created) !== +new Date(task.updated)">
|
|
|
|
<br/>
|
|
|
|
<!-- Computed properties to show the actual date every time it gets updated -->
|
2021-06-24 01:24:57 +02:00
|
|
|
<i18n path="task.detail.updated">
|
|
|
|
<span v-tooltip="updatedFormatted">{{ updatedSince }}</span>
|
|
|
|
</i18n>
|
2020-10-25 12:25:08 +01:00
|
|
|
</template>
|
2020-11-28 15:52:15 +01:00
|
|
|
<template v-if="task.done">
|
|
|
|
<br/>
|
2021-06-24 01:24:57 +02:00
|
|
|
<i18n path="task.detail.doneAt">
|
|
|
|
<span v-tooltip="doneFormatted">{{ doneSince }}</span>
|
|
|
|
</i18n>
|
2020-11-28 15:52:15 +01:00
|
|
|
</template>
|
2020-10-25 12:25:08 +01:00
|
|
|
</p>
|
2019-11-24 14:16:24 +01:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
2020-01-22 21:18:39 +01:00
|
|
|
|
2021-01-23 18:54:22 +01:00
|
|
|
<transition name="modal">
|
|
|
|
<modal
|
|
|
|
@close="showDeleteModal = false"
|
|
|
|
@submit="deleteTask()"
|
|
|
|
v-if="showDeleteModal">
|
2021-06-24 01:24:57 +02:00
|
|
|
<span slot="header">{{ $t('task.detail.delete.header') }}</span>
|
2021-01-23 18:54:22 +01:00
|
|
|
<p slot="text">
|
2021-06-24 01:24:57 +02:00
|
|
|
{{ $t('task.detail.delete.text1') }}<br/>
|
|
|
|
{{ $t('task.detail.delete.text2') }}
|
2021-01-23 18:54:22 +01:00
|
|
|
</p>
|
|
|
|
</modal>
|
|
|
|
</transition>
|
2019-11-24 14:16:24 +01:00
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
2020-09-05 22:35:52 +02:00
|
|
|
import TaskService from '../../services/task'
|
|
|
|
import TaskModel from '../../models/task'
|
|
|
|
import relationKinds from '../../models/relationKinds.json'
|
2019-11-24 14:16:24 +01:00
|
|
|
|
2020-09-05 22:35:52 +02:00
|
|
|
import priorites from '../../models/priorities.json'
|
|
|
|
import rights from '../../models/rights.json'
|
2019-11-24 14:16:24 +01:00
|
|
|
|
2020-09-05 22:35:52 +02:00
|
|
|
import PrioritySelect from '../../components/tasks/partials/prioritySelect'
|
|
|
|
import PercentDoneSelect from '../../components/tasks/partials/percentDoneSelect'
|
|
|
|
import EditLabels from '../../components/tasks/partials/editLabels'
|
|
|
|
import EditAssignees from '../../components/tasks/partials/editAssignees'
|
|
|
|
import Attachments from '../../components/tasks/partials/attachments'
|
|
|
|
import RelatedTasks from '../../components/tasks/partials/relatedTasks'
|
|
|
|
import RepeatAfter from '../../components/tasks/partials/repeatAfter'
|
|
|
|
import Reminders from '../../components/tasks/partials/reminders'
|
|
|
|
import Comments from '../../components/tasks/partials/comments'
|
|
|
|
import ListSearch from '../../components/tasks/partials/listSearch'
|
2020-11-22 17:32:35 +01:00
|
|
|
import description from '@/components/tasks/partials/description'
|
2020-09-05 22:35:52 +02:00
|
|
|
import ColorPicker from '../../components/input/colorPicker'
|
|
|
|
import attachmentUpload from '../../components/tasks/mixins/attachmentUpload'
|
2020-11-22 17:32:35 +01:00
|
|
|
import heading from '@/components/tasks/partials/heading'
|
2020-11-28 14:59:27 +01:00
|
|
|
import Datepicker from '@/components/input/datepicker'
|
2021-01-30 21:45:54 +01:00
|
|
|
import {playPop} from '@/helpers/playPop'
|
2021-02-14 20:18:51 +01:00
|
|
|
import TaskSubscription from '@/components/misc/subscription'
|
2021-05-30 20:30:08 +02:00
|
|
|
import {CURRENT_LIST} from '@/store/mutation-types'
|
2019-11-24 14:16:24 +01:00
|
|
|
|
2020-09-05 22:35:52 +02:00
|
|
|
export default {
|
|
|
|
name: 'TaskDetailView',
|
|
|
|
components: {
|
2021-02-14 20:18:51 +01:00
|
|
|
TaskSubscription,
|
2020-11-28 14:59:27 +01:00
|
|
|
Datepicker,
|
2020-09-05 22:35:52 +02:00
|
|
|
ColorPicker,
|
|
|
|
ListSearch,
|
|
|
|
Reminders,
|
|
|
|
RepeatAfter,
|
|
|
|
RelatedTasks,
|
|
|
|
Attachments,
|
|
|
|
EditAssignees,
|
|
|
|
EditLabels,
|
|
|
|
PercentDoneSelect,
|
|
|
|
PrioritySelect,
|
|
|
|
Comments,
|
2020-11-22 17:32:35 +01:00
|
|
|
description,
|
|
|
|
heading,
|
2020-09-05 22:35:52 +02:00
|
|
|
},
|
|
|
|
mixins: [
|
|
|
|
attachmentUpload,
|
|
|
|
],
|
|
|
|
data() {
|
|
|
|
return {
|
|
|
|
taskId: Number(this.$route.params.id),
|
|
|
|
taskService: TaskService,
|
|
|
|
task: TaskModel,
|
|
|
|
relationKinds: relationKinds,
|
|
|
|
// We doubled the task color property here because verte does not have a real change property, leading
|
|
|
|
// to the color property change being triggered when the # is removed from it, leading to an update,
|
|
|
|
// which leads in turn to a change... This creates an infinite loop in which the task is updated, changed,
|
|
|
|
// updated, changed, updated and so on.
|
|
|
|
// To prevent this, we put the task color property in a seperate value which is set to the task color
|
|
|
|
// when it is saved and loaded.
|
|
|
|
taskColor: '',
|
2019-11-24 14:16:24 +01:00
|
|
|
|
2020-09-05 22:35:52 +02:00
|
|
|
showDeleteModal: false,
|
|
|
|
descriptionChanged: false,
|
2021-01-21 20:20:51 +01:00
|
|
|
// Used to avoid flashing of empty elements if the task content is not yet loaded.
|
|
|
|
visible: false,
|
2019-11-24 14:16:24 +01:00
|
|
|
|
2020-09-05 22:35:52 +02:00
|
|
|
priorities: priorites,
|
|
|
|
activeFields: {
|
|
|
|
assignees: false,
|
|
|
|
priority: false,
|
|
|
|
dueDate: false,
|
|
|
|
percentDone: false,
|
|
|
|
startDate: false,
|
|
|
|
endDate: false,
|
|
|
|
reminders: false,
|
|
|
|
repeatAfter: false,
|
|
|
|
labels: false,
|
|
|
|
attachments: false,
|
|
|
|
relatedTasks: false,
|
|
|
|
moveList: false,
|
|
|
|
color: false,
|
|
|
|
},
|
|
|
|
}
|
|
|
|
},
|
|
|
|
watch: {
|
|
|
|
'$route': 'loadTask',
|
|
|
|
},
|
|
|
|
created() {
|
|
|
|
this.taskService = new TaskService()
|
|
|
|
this.task = new TaskModel()
|
|
|
|
},
|
|
|
|
mounted() {
|
|
|
|
this.loadTask()
|
|
|
|
},
|
|
|
|
computed: {
|
2021-06-03 16:27:41 +02:00
|
|
|
currentList() {
|
|
|
|
return this.$store.state[CURRENT_LIST]
|
|
|
|
},
|
2020-09-05 22:35:52 +02:00
|
|
|
parent() {
|
|
|
|
if (!this.task.listId) {
|
|
|
|
return {
|
|
|
|
namespace: null,
|
|
|
|
list: null,
|
2020-05-09 23:28:54 +02:00
|
|
|
}
|
2020-09-05 22:35:52 +02:00
|
|
|
}
|
2020-05-09 23:28:54 +02:00
|
|
|
|
2020-09-05 22:35:52 +02:00
|
|
|
if (!this.$store.getters['namespaces/getListAndNamespaceById']) {
|
|
|
|
return null
|
|
|
|
}
|
2020-05-09 23:28:54 +02:00
|
|
|
|
2021-05-30 20:30:08 +02:00
|
|
|
const list = this.$store.getters['namespaces/getListAndNamespaceById'](this.task.listId)
|
2021-06-03 16:27:41 +02:00
|
|
|
this.$store.commit(CURRENT_LIST, list !== null ? list.list : this.currentList)
|
2021-05-30 20:30:08 +02:00
|
|
|
return list
|
2020-05-09 23:28:54 +02:00
|
|
|
},
|
2020-09-05 22:35:52 +02:00
|
|
|
canWrite() {
|
2021-06-03 16:27:41 +02:00
|
|
|
return typeof this.task !== 'undefined' && typeof this.task.maxRight !== 'undefined' && this.task.maxRight > rights.READ
|
2020-09-05 22:35:52 +02:00
|
|
|
},
|
2020-10-25 12:25:08 +01:00
|
|
|
updatedSince() {
|
|
|
|
return this.formatDateSince(this.task.updated)
|
|
|
|
},
|
|
|
|
updatedFormatted() {
|
|
|
|
return this.formatDate(this.task.updated)
|
|
|
|
},
|
2020-11-28 15:52:15 +01:00
|
|
|
doneSince() {
|
|
|
|
return this.formatDateSince(this.task.doneAt)
|
|
|
|
},
|
|
|
|
doneFormatted() {
|
|
|
|
return this.formatDate(this.task.doneAt)
|
|
|
|
},
|
2021-01-18 21:58:34 +01:00
|
|
|
hasAttachments() {
|
|
|
|
return this.$store.state.attachments.attachments.length > 0
|
|
|
|
},
|
2020-09-05 22:35:52 +02:00
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
loadTask() {
|
|
|
|
this.taskId = Number(this.$route.params.id)
|
|
|
|
this.taskService.get({id: this.taskId})
|
|
|
|
.then(r => {
|
|
|
|
this.$set(this, 'task', r)
|
|
|
|
this.$store.commit('attachments/set', r.attachments)
|
|
|
|
this.taskColor = this.task.hexColor
|
|
|
|
this.setActiveFields()
|
|
|
|
this.setTitle(this.task.title)
|
|
|
|
})
|
|
|
|
.catch(e => {
|
2021-06-22 22:07:57 +02:00
|
|
|
this.error(e)
|
2020-09-05 22:35:52 +02:00
|
|
|
})
|
2021-01-10 22:37:43 +01:00
|
|
|
.finally(() => {
|
2021-01-21 20:20:51 +01:00
|
|
|
this.$nextTick(() => this.visible = true)
|
2021-01-10 22:37:43 +01:00
|
|
|
this.scrollToHeading()
|
|
|
|
})
|
|
|
|
},
|
|
|
|
scrollToHeading() {
|
|
|
|
this.$refs.heading.$el.scrollIntoView({block: 'center'})
|
2020-09-05 22:35:52 +02:00
|
|
|
},
|
|
|
|
setActiveFields() {
|
2020-02-08 18:37:23 +01:00
|
|
|
|
2020-09-05 22:35:52 +02:00
|
|
|
this.task.startDate = this.task.startDate ? this.task.startDate : null
|
|
|
|
this.task.endDate = this.task.endDate ? this.task.endDate : null
|
2020-02-08 18:37:23 +01:00
|
|
|
|
2020-09-05 22:35:52 +02:00
|
|
|
// Set all active fields based on values in the model
|
|
|
|
this.activeFields.assignees = this.task.assignees.length > 0
|
|
|
|
this.activeFields.priority = this.task.priority !== priorites.UNSET
|
|
|
|
this.activeFields.dueDate = this.task.dueDate !== null
|
|
|
|
this.activeFields.percentDone = this.task.percentDone > 0
|
|
|
|
this.activeFields.startDate = this.task.startDate !== null
|
|
|
|
this.activeFields.endDate = this.task.endDate !== null
|
2020-10-24 18:12:14 +02:00
|
|
|
this.activeFields.reminders = this.task.reminderDates.length > 0
|
2020-09-05 22:35:52 +02:00
|
|
|
this.activeFields.repeatAfter = this.task.repeatAfter.amount > 0
|
|
|
|
this.activeFields.labels = this.task.labels.length > 0
|
|
|
|
this.activeFields.attachments = this.task.attachments.length > 0
|
|
|
|
this.activeFields.relatedTasks = Object.keys(this.task.relatedTasks).length > 0
|
|
|
|
},
|
2020-11-22 17:32:35 +01:00
|
|
|
saveTask(showNotification = true, undoCallback = null) {
|
2020-02-09 14:52:45 +01:00
|
|
|
|
2020-09-05 22:35:52 +02:00
|
|
|
if (!this.canWrite) {
|
|
|
|
return
|
|
|
|
}
|
2020-08-11 20:18:59 +02:00
|
|
|
|
2020-10-03 14:30:26 +02:00
|
|
|
// We're doing the whole update in a nextTick because sometimes race conditions can occur when
|
|
|
|
// setting the due date on mobile which leads to no due date change being saved.
|
|
|
|
this.$nextTick(() => {
|
|
|
|
this.task.hexColor = this.taskColor
|
2020-05-09 19:00:54 +02:00
|
|
|
|
2020-10-03 14:30:26 +02:00
|
|
|
// If no end date is being set, but a start date and due date,
|
|
|
|
// use the due date as the end date
|
|
|
|
if (this.task.endDate === null && this.task.startDate !== null && this.task.dueDate !== null) {
|
|
|
|
this.task.endDate = this.task.dueDate
|
|
|
|
}
|
2020-02-09 14:52:45 +01:00
|
|
|
|
2020-10-03 14:30:26 +02:00
|
|
|
this.$store.dispatch('tasks/update', this.task)
|
|
|
|
.then(r => {
|
|
|
|
this.$set(this, 'task', r)
|
2020-11-22 17:32:35 +01:00
|
|
|
this.setActiveFields()
|
|
|
|
|
|
|
|
if (!showNotification) {
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
2020-10-03 14:30:26 +02:00
|
|
|
let actions = []
|
|
|
|
if (undoCallback !== null) {
|
|
|
|
actions = [{
|
|
|
|
title: 'Undo',
|
|
|
|
callback: undoCallback,
|
|
|
|
}]
|
|
|
|
}
|
2021-06-24 01:24:57 +02:00
|
|
|
this.success({message: this.$t('task.detail.updateSuccess')}, actions)
|
2020-10-03 14:30:26 +02:00
|
|
|
})
|
|
|
|
.catch(e => {
|
2021-06-22 22:07:57 +02:00
|
|
|
this.error(e)
|
2020-10-03 14:30:26 +02:00
|
|
|
})
|
|
|
|
})
|
2020-09-05 22:35:52 +02:00
|
|
|
},
|
|
|
|
setFieldActive(fieldName) {
|
|
|
|
this.activeFields[fieldName] = true
|
|
|
|
this.$nextTick(() => {
|
|
|
|
if (this.$refs[fieldName]) {
|
2021-01-17 18:57:57 +01:00
|
|
|
this.$refs[fieldName].$el.focus()
|
2021-01-04 22:22:56 +01:00
|
|
|
|
|
|
|
// scroll the field to the center of the screen if not in viewport already
|
2021-01-17 18:57:57 +01:00
|
|
|
const boundingRect = this.$refs[fieldName].$el.getBoundingClientRect()
|
2021-01-04 22:22:56 +01:00
|
|
|
|
|
|
|
if (boundingRect.top > (window.scrollY + window.innerHeight) || boundingRect.top < window.scrollY)
|
2021-01-17 18:57:57 +01:00
|
|
|
this.$refs[fieldName].$el.scrollIntoView({
|
|
|
|
behavior: 'smooth',
|
|
|
|
block: 'center',
|
2021-07-17 23:21:46 +02:00
|
|
|
inline: 'nearest',
|
2021-01-17 18:57:57 +01:00
|
|
|
})
|
2020-03-01 16:50:05 +01:00
|
|
|
}
|
2020-09-05 22:35:52 +02:00
|
|
|
})
|
|
|
|
},
|
|
|
|
deleteTask() {
|
|
|
|
this.$store.dispatch('tasks/delete', this.task)
|
|
|
|
.then(() => {
|
2021-06-24 01:24:57 +02:00
|
|
|
this.success({message: this.$t('task.detail.deleteSuccess')})
|
2020-12-10 14:52:35 +01:00
|
|
|
this.$router.push({name: 'list.index', params: {listId: this.task.listId}})
|
2020-09-05 22:35:52 +02:00
|
|
|
})
|
|
|
|
.catch(e => {
|
2021-06-22 22:07:57 +02:00
|
|
|
this.error(e)
|
2020-09-05 22:35:52 +02:00
|
|
|
})
|
|
|
|
},
|
|
|
|
toggleTaskDone() {
|
|
|
|
this.task.done = !this.task.done
|
2021-01-30 21:45:54 +01:00
|
|
|
|
2021-04-18 16:50:12 +02:00
|
|
|
if (this.task.done) {
|
2021-01-30 21:45:54 +01:00
|
|
|
playPop()
|
|
|
|
}
|
|
|
|
|
2020-11-22 17:32:35 +01:00
|
|
|
this.saveTask(true, () => this.toggleTaskDone())
|
2020-09-05 22:35:52 +02:00
|
|
|
},
|
|
|
|
setDescriptionChanged(e) {
|
|
|
|
if (e.key === 'Enter' || e.key === 'Control') {
|
|
|
|
return
|
|
|
|
}
|
|
|
|
this.descriptionChanged = true
|
|
|
|
},
|
|
|
|
saveTaskIfDescriptionChanged() {
|
|
|
|
// We want to only save the description if it was changed.
|
|
|
|
// Since we can either trigger this with ctrl+enter or @change, it would be possible to save a task first
|
|
|
|
// with ctrl+enter and then with @change although nothing changed since the last save when @change gets fired.
|
|
|
|
// To only save one time we added this method.
|
|
|
|
if (this.descriptionChanged) {
|
|
|
|
this.descriptionChanged = false
|
2020-04-18 14:39:56 +02:00
|
|
|
this.saveTask()
|
2020-09-05 22:35:52 +02:00
|
|
|
}
|
|
|
|
},
|
|
|
|
changeList(list) {
|
|
|
|
this.task.listId = list.id
|
|
|
|
this.saveTask()
|
2021-02-20 15:35:30 +01:00
|
|
|
this.$store.commit('kanban/removeTaskInBucket', this.task)
|
2019-11-24 14:16:24 +01:00
|
|
|
},
|
2020-09-05 22:35:52 +02:00
|
|
|
},
|
|
|
|
}
|
2019-11-24 14:16:24 +01:00
|
|
|
</script>
|