mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2025-10-10 22:06:46 +08:00
Merge pull request #5423 from sboursen-scinote/sb_SCI-8252
Button in the toolbar for assigning items to task from the inventory [SCI-8252]
This commit is contained in:
commit
cabd6bbed5
8 changed files with 36 additions and 7 deletions
|
@ -872,6 +872,12 @@ var RepositoryDatatable = (function(global) {
|
||||||
changeToEditMode();
|
changeToEditMode();
|
||||||
// adjustTableHeader();
|
// adjustTableHeader();
|
||||||
})
|
})
|
||||||
|
.on('click', '#assignRepositoryRecords', function(e) {
|
||||||
|
e.preventDefault();
|
||||||
|
e.stopPropagation();
|
||||||
|
|
||||||
|
window.AssignItemsToTaskModalComponentContainer.showModal();
|
||||||
|
})
|
||||||
.on('click', '#deleteRepositoryRecords', function(e) {
|
.on('click', '#deleteRepositoryRecords', function(e) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
|
|
|
@ -22,7 +22,10 @@
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
row-gap: .25rem;
|
row-gap: .25rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sn-select__search-input:focus {
|
||||||
|
box-shadow: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
label {
|
label {
|
||||||
|
|
|
@ -26,6 +26,9 @@ function initAssignItemsToTaskModalComponent() {
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
showModal() {
|
||||||
|
this.visibility = true;
|
||||||
|
},
|
||||||
closeModal() {
|
closeModal() {
|
||||||
this.visibility = false;
|
this.visibility = false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -39,6 +39,7 @@
|
||||||
</label>
|
</label>
|
||||||
|
|
||||||
<SelectSearch
|
<SelectSearch
|
||||||
|
:value="selectedProject"
|
||||||
ref="projectsSelector"
|
ref="projectsSelector"
|
||||||
@change="changeProject"
|
@change="changeProject"
|
||||||
:options="projects"
|
:options="projects"
|
||||||
|
@ -65,6 +66,7 @@
|
||||||
</label>
|
</label>
|
||||||
|
|
||||||
<SelectSearch
|
<SelectSearch
|
||||||
|
:value="selectedExperiment"
|
||||||
:disabled="!selectedProject"
|
:disabled="!selectedProject"
|
||||||
ref="experimentsSelector"
|
ref="experimentsSelector"
|
||||||
@change="changeExperiment"
|
@change="changeExperiment"
|
||||||
|
@ -88,6 +90,7 @@
|
||||||
</label>
|
</label>
|
||||||
|
|
||||||
<SelectSearch
|
<SelectSearch
|
||||||
|
:value="selectedTask"
|
||||||
:disabled="!selectedExperiment"
|
:disabled="!selectedExperiment"
|
||||||
ref="tasksSelector"
|
ref="tasksSelector"
|
||||||
@change="changeTask"
|
@change="changeTask"
|
||||||
|
|
|
@ -18,6 +18,7 @@
|
||||||
export default {
|
export default {
|
||||||
name: 'Select',
|
name: 'Select',
|
||||||
props: {
|
props: {
|
||||||
|
value: { type: [String, Number] },
|
||||||
options: { type: Array, default: () => [] },
|
options: { type: Array, default: () => [] },
|
||||||
initialValue: { type: [String, Number] },
|
initialValue: { type: [String, Number] },
|
||||||
placeholder: { type: String },
|
placeholder: { type: String },
|
||||||
|
@ -25,7 +26,6 @@
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
value: null,
|
|
||||||
isOpen: false,
|
isOpen: false,
|
||||||
optionPositionStyle: ''
|
optionPositionStyle: ''
|
||||||
}
|
}
|
||||||
|
@ -66,8 +66,7 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
setValue(value) {
|
setValue(value) {
|
||||||
this.value = value;
|
this.$emit('change', value);
|
||||||
this.$emit('change', this.value);
|
|
||||||
},
|
},
|
||||||
updateOptionPosition() {
|
updateOptionPosition() {
|
||||||
const container = this.$refs.container;
|
const container = this.$refs.container;
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
<template>
|
<template>
|
||||||
<Select class="sn-select--search" :options="currentOptions" :placeholder="placeholder" v-bind:disabled="disabled" @change="change" @blur="blur" @open="open" @close="close">
|
<Select class="sn-select--search" :value="value" :options="currentOptions" :placeholder="placeholder" v-bind:disabled="disabled" @change="change" @blur="blur" @open="open" @close="close">
|
||||||
<input ref="focusElement" v-model="query" type="text" class="sn-select__search-input" :placeholder="searchPlaceholder" />
|
<input ref="focusElement" v-model="query" type="text" class="sn-select__search-input" :placeholder="searchPlaceholder" />
|
||||||
<span class="sn-select__value">{{ valueLabel || (placeholder || i18n.t('general.select')) }}</span>
|
<span class="sn-select__value">{{ valueLabel || (placeholder || i18n.t('general.select')) }}</span>
|
||||||
<span class="sn-select__caret caret"></span>
|
<span class="sn-select__caret caret"></span>
|
||||||
|
@ -12,6 +12,7 @@
|
||||||
export default {
|
export default {
|
||||||
name: 'SelectSearch',
|
name: 'SelectSearch',
|
||||||
props: {
|
props: {
|
||||||
|
value: { type: [String, Number] },
|
||||||
options: { type: Array, default: () => [] },
|
options: { type: Array, default: () => [] },
|
||||||
optionsUrl: { type: String },
|
optionsUrl: { type: String },
|
||||||
placeholder: { type: String },
|
placeholder: { type: String },
|
||||||
|
@ -21,7 +22,6 @@
|
||||||
components: { Select },
|
components: { Select },
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
value: null,
|
|
||||||
query: null,
|
query: null,
|
||||||
currentOptions: null,
|
currentOptions: null,
|
||||||
isOpen: false
|
isOpen: false
|
||||||
|
@ -59,15 +59,15 @@
|
||||||
this.$emit('blur');
|
this.$emit('blur');
|
||||||
},
|
},
|
||||||
change(value) {
|
change(value) {
|
||||||
this.value = value;
|
|
||||||
this.isOpen = false;
|
this.isOpen = false;
|
||||||
this.$emit('change', this.value);
|
this.$emit('change', value);
|
||||||
},
|
},
|
||||||
open() {
|
open() {
|
||||||
this.isOpen = true;
|
this.isOpen = true;
|
||||||
this.$emit('open');
|
this.$emit('open');
|
||||||
},
|
},
|
||||||
close() {
|
close() {
|
||||||
|
this.query = '';
|
||||||
this.isOpen = false;
|
this.isOpen = false;
|
||||||
this.$emit('close');
|
this.$emit('close');
|
||||||
},
|
},
|
||||||
|
|
|
@ -30,6 +30,7 @@ module Toolbars
|
||||||
[
|
[
|
||||||
restore_action,
|
restore_action,
|
||||||
edit_action,
|
edit_action,
|
||||||
|
assign_action,
|
||||||
duplicate_action,
|
duplicate_action,
|
||||||
export_action,
|
export_action,
|
||||||
print_label_action,
|
print_label_action,
|
||||||
|
@ -68,6 +69,19 @@ module Toolbars
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def assign_action
|
||||||
|
return unless can_manage_repository_rows?(@repository)
|
||||||
|
|
||||||
|
{
|
||||||
|
name: 'assign',
|
||||||
|
label: I18n.t('repositories.assign_record'),
|
||||||
|
icon: 'fas fa-paperclip',
|
||||||
|
button_class: 'assign-repository-rows-btn',
|
||||||
|
button_id: 'assignRepositoryRecords',
|
||||||
|
type: :legacy
|
||||||
|
}
|
||||||
|
end
|
||||||
|
|
||||||
def duplicate_action
|
def duplicate_action
|
||||||
return unless can_create_repository_rows?(@repository)
|
return unless can_create_repository_rows?(@repository)
|
||||||
|
|
||||||
|
|
|
@ -1958,6 +1958,7 @@ en:
|
||||||
errors_list_title: "Items were not imported because one or more errors were found:"
|
errors_list_title: "Items were not imported because one or more errors were found:"
|
||||||
no_repository_name: "Item name is required!"
|
no_repository_name: "Item name is required!"
|
||||||
edit_record: "Edit"
|
edit_record: "Edit"
|
||||||
|
assign_record: "Assign to task"
|
||||||
copy_record: "Duplicate"
|
copy_record: "Duplicate"
|
||||||
delete_record: "Delete"
|
delete_record: "Delete"
|
||||||
archive_record: "Archive"
|
archive_record: "Archive"
|
||||||
|
|
Loading…
Add table
Reference in a new issue