Merge pull request #4668 from G-Chubinidze/gc_SCI_7494

Archived table view filters update [SCI-7494]
This commit is contained in:
G-Chubinidze 2022-12-01 12:32:41 +04:00 committed by GitHub
commit 2d04357ba8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 40 additions and 0 deletions

View file

@ -468,6 +468,36 @@ ExperimnetTable.filters.push({
}
});
ExperimnetTable.filters.push({
name: 'archived_on_from',
init: () => {},
closeFilter: () => {},
apply: ($container) => {
return ExperimnetTable.selectDate($('.archived-on-filter .from-date', $container));
},
active: (value) => { return value; },
clearFilter: ($container) => {
if ($('.archived-on-filter .from-date', $container).data('DateTimePicker')) {
$('.archived-on-filter .from-date', $container).data('DateTimePicker').clear();
}
}
});
ExperimnetTable.filters.push({
name: 'archived_on_to',
init: () => {},
closeFilter: () => {},
apply: ($container) => {
return ExperimnetTable.selectDate($('.archived-on-filter .to-date', $container));
},
active: (value) => { return value; },
clearFilter: ($container) => {
if ($('.archived-on-filter .to-date', $container).data('DateTimePicker')) {
$('.archived-on-filter .to-date', $container).data('DateTimePicker').clear();
}
}
});
ExperimnetTable.filters.push({
name: 'assigned_users',
init: ($container) => {

View file

@ -181,6 +181,14 @@ module Experiments
my_modules.where('my_modules.due_date <= ?', value)
end
def archived_on_from_filter(my_modules, value)
my_modules.where('my_modules.archived_on >= ?', value)
end
def archived_on_to_filter(my_modules, value)
my_modules.where('my_modules.archived_on <= ?', value)
end
def assigned_users_filter(my_modules, value)
my_modules.joins(:user_my_modules).where(user_my_modules: { user_id: value })
end

View file

@ -5,6 +5,8 @@
} do %>
<%= render partial: 'shared/filter_dropdown/text_search', locals: {container_class: 'task-name-filter', label_text: t('experiments.table.filters.name')} %>
<%= render partial: 'shared/filter_dropdown/datetime_search', locals: {container_class: 'due-date-filter', label: t('experiments.table.filters.due_date'), view_mode: nil } %>
<%= render partial: 'shared/filter_dropdown/datetime_search', locals: {container_class: 'archived-on-filter', label: t("filters_modal.archived_on.label"), view_mode: 'archived' } if params[:view_mode] == 'archived' %>
<div class="select-block status-container">
<label><%= t('experiments.table.filters.status') %></label>
<select class="status-filter"