mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2025-10-06 03:46:39 +08:00
Add start date to tasks table and change status representation [SCI-11801]
This commit is contained in:
parent
813ad37445
commit
864d5d29e9
5 changed files with 61 additions and 7 deletions
|
@ -25,6 +25,7 @@
|
||||||
@restore="restore"
|
@restore="restore"
|
||||||
@duplicate="duplicate"
|
@duplicate="duplicate"
|
||||||
@updateDueDate="updateDueDate"
|
@updateDueDate="updateDueDate"
|
||||||
|
@updateStartDate="updateStartDate"
|
||||||
@editTags="editTags"/>
|
@editTags="editTags"/>
|
||||||
|
|
||||||
<TagsModal v-if="tagsModalObject"
|
<TagsModal v-if="tagsModalObject"
|
||||||
|
@ -62,6 +63,7 @@ import NameRenderer from './renderers/name.vue';
|
||||||
import ResultsRenderer from './renderers/results.vue';
|
import ResultsRenderer from './renderers/results.vue';
|
||||||
import StatusRenderer from './renderers/status.vue';
|
import StatusRenderer from './renderers/status.vue';
|
||||||
import DueDateRenderer from '../shared/datatable/renderers/date.vue';
|
import DueDateRenderer from '../shared/datatable/renderers/date.vue';
|
||||||
|
import StartDateRenderer from '../shared/datatable/renderers/date.vue';
|
||||||
import DesignatedUsers from './renderers/designated_users.vue';
|
import DesignatedUsers from './renderers/designated_users.vue';
|
||||||
import TagsModal from './modals/tags.vue';
|
import TagsModal from './modals/tags.vue';
|
||||||
import TagsRenderer from './renderers/tags.vue';
|
import TagsRenderer from './renderers/tags.vue';
|
||||||
|
@ -130,6 +132,20 @@ export default {
|
||||||
headerName: this.i18n.t('experiments.table.column.id_html'),
|
headerName: this.i18n.t('experiments.table.column.id_html'),
|
||||||
sortable: true
|
sortable: true
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
field: 'start_date',
|
||||||
|
headerName: this.i18n.t('experiments.table.column.start_date_html'),
|
||||||
|
sortable: true,
|
||||||
|
cellRenderer: StartDateRenderer,
|
||||||
|
cellRendererParams: {
|
||||||
|
placeholder: this.i18n.t('my_modules.details.no_start_date_placeholder'),
|
||||||
|
field: 'start_date_cell',
|
||||||
|
mode: 'datetime',
|
||||||
|
emptyPlaceholder: this.i18n.t('my_modules.details.no_due_date'),
|
||||||
|
emitAction: 'updateStartDate'
|
||||||
|
},
|
||||||
|
minWidth: 200
|
||||||
|
},
|
||||||
{
|
{
|
||||||
field: 'due_date',
|
field: 'due_date',
|
||||||
headerName: this.i18n.t('experiments.table.column.due_date_html'),
|
headerName: this.i18n.t('experiments.table.column.due_date_html'),
|
||||||
|
@ -292,6 +308,15 @@ export default {
|
||||||
this.updateTable();
|
this.updateTable();
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
updateStartDate(value, params) {
|
||||||
|
axios.put(params.data.urls.update_start_date, {
|
||||||
|
my_module: {
|
||||||
|
started_on: this.formatDate(value)
|
||||||
|
}
|
||||||
|
}).then(() => {
|
||||||
|
this.updateTable();
|
||||||
|
});
|
||||||
|
},
|
||||||
formatDate(date) {
|
formatDate(date) {
|
||||||
if (!(date instanceof Date)) return null;
|
if (!(date instanceof Date)) return null;
|
||||||
|
|
||||||
|
|
|
@ -1,11 +1,14 @@
|
||||||
<template>
|
<template>
|
||||||
<span
|
<div class="flex items-center gap-2">
|
||||||
class="px-2 py-1 border border-solid rounded truncate"
|
<div
|
||||||
:class="{'text-sn-white' : !params.data.status.light_color}"
|
class="w-4 h-4 rounded-full"
|
||||||
:style="{'background-color': params.data.status.color}"
|
:class="{ 'bg-sn-grey-500': params.data.status.light_color }"
|
||||||
>
|
:style="!params.data.status.light_color && { backgroundColor: params.data.status.color }"
|
||||||
|
></div>
|
||||||
|
<span class="truncate">
|
||||||
{{ params.data.status.name }}
|
{{ params.data.status.name }}
|
||||||
</span>
|
</span>
|
||||||
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
|
|
@ -23,6 +23,7 @@ module Lists
|
||||||
comments
|
comments
|
||||||
due_date_formatted
|
due_date_formatted
|
||||||
due_date_cell
|
due_date_cell
|
||||||
|
start_date_cell
|
||||||
permissions
|
permissions
|
||||||
default_public_user_role_id
|
default_public_user_role_id
|
||||||
team
|
team
|
||||||
|
@ -71,6 +72,7 @@ module Lists
|
||||||
urls_list[:update_access] = access_permissions_my_module_path(object) if can_manage_project_users?(object.experiment.project)
|
urls_list[:update_access] = access_permissions_my_module_path(object) if can_manage_project_users?(object.experiment.project)
|
||||||
|
|
||||||
urls_list[:update_due_date] = my_module_path(object, user, format: :json) if can_update_my_module_due_date?(object)
|
urls_list[:update_due_date] = my_module_path(object, user, format: :json) if can_update_my_module_due_date?(object)
|
||||||
|
urls_list[:update_start_date] = my_module_path(object, user, format: :json) if can_update_my_module_start_date?(object)
|
||||||
|
|
||||||
urls_list
|
urls_list
|
||||||
end
|
end
|
||||||
|
@ -96,6 +98,14 @@ module Lists
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def start_date_cell
|
||||||
|
{
|
||||||
|
value: start_date,
|
||||||
|
value_formatted: start_date_formatted,
|
||||||
|
editable: can_update_my_module_due_date?(object)
|
||||||
|
}
|
||||||
|
end
|
||||||
|
|
||||||
def due_date_status
|
def due_date_status
|
||||||
if (archived || object.completed?) && object.due_date
|
if (archived || object.completed?) && object.due_date
|
||||||
return :ok
|
return :ok
|
||||||
|
@ -175,5 +185,15 @@ module Lists
|
||||||
def team
|
def team
|
||||||
object.team.name
|
object.team.name
|
||||||
end
|
end
|
||||||
|
|
||||||
|
private
|
||||||
|
|
||||||
|
def start_date
|
||||||
|
I18n.l(object.started_on, format: :default) if object.started_on
|
||||||
|
end
|
||||||
|
|
||||||
|
def start_date_formatted
|
||||||
|
I18n.l(object.started_on, format: :full_date) if object.started_on
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -40,6 +40,7 @@ module Lists
|
||||||
|
|
||||||
def sortable_columns
|
def sortable_columns
|
||||||
@sortable_columns ||= {
|
@sortable_columns ||= {
|
||||||
|
start_date: 'start_date',
|
||||||
due_date: 'due_date',
|
due_date: 'due_date',
|
||||||
name: 'name',
|
name: 'name',
|
||||||
code: 'id',
|
code: 'id',
|
||||||
|
@ -60,6 +61,10 @@ module Lists
|
||||||
sort = "#{sortable_columns[order_params[:column].to_sym]}_#{sort_direction(order_params)}"
|
sort = "#{sortable_columns[order_params[:column].to_sym]}_#{sort_direction(order_params)}"
|
||||||
|
|
||||||
case sort
|
case sort
|
||||||
|
when 'start_date_ASC'
|
||||||
|
@records = @records.order(:started_on, :name)
|
||||||
|
when 'start_date_DESC'
|
||||||
|
@records = @records.order(started_on: :desc, name: :asc)
|
||||||
when 'due_date_ASC'
|
when 'due_date_ASC'
|
||||||
@records = @records.order(:due_date, :name)
|
@records = @records.order(:due_date, :name)
|
||||||
when 'due_date_DESC'
|
when 'due_date_DESC'
|
||||||
|
|
|
@ -1783,6 +1783,7 @@ en:
|
||||||
id_html: 'ID'
|
id_html: 'ID'
|
||||||
task_name_html: 'Task name'
|
task_name_html: 'Task name'
|
||||||
due_date_html: 'Due date'
|
due_date_html: 'Due date'
|
||||||
|
start_date_html: 'Start date'
|
||||||
archived_html: 'Archived on'
|
archived_html: 'Archived on'
|
||||||
age_html: 'Age'
|
age_html: 'Age'
|
||||||
results_html: 'Results'
|
results_html: 'Results'
|
||||||
|
|
Loading…
Add table
Reference in a new issue