Merge pull request #3324 from aignatov-bio/ai-sci-5551-add-search-field-to-reports

Add search field to reports page [SCI-5551]
This commit is contained in:
Alex Kriuchykhin 2021-05-17 11:50:03 +02:00 committed by GitHub
commit 8e3e72654c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 23 additions and 0 deletions

View file

@ -374,6 +374,10 @@
});
}
$('.reports-index').on('change', '.report-search', function() {
REPORTS_TABLE.search($(this).val()).draw();
});
$('#show_report_preview').click();
initDatatable();

View file

@ -18,6 +18,13 @@
}
}
}
.search-report-container {
display: inline-block;
float: right;
margin-right: 2em;
width: 200px;
}
}
.reports-datatable {

View file

@ -103,5 +103,12 @@ class ReportDatatable < CustomDatatable
Report.from(res, :reports)
end
def filter_records(records)
records.where_attributes_like(
['project_name', 'reports.name', 'reports.description'],
dt_params.dig(:search, :value)
)
end
# ==== Insert 'presenter'-like methods below if necessary
end

View file

@ -46,4 +46,8 @@
<span class="hidden-xs"><%=t "projects.reports.index.delete" %></span>
<% end %>
</div>
<div class="sci-input-container left-icon search-report-container">
<input type="text" class="sci-input-field report-search" placeholder="<%= t("projects.reports.index.search_reports") %>"></input>
<i class="fas fa-search"></i>
</div>
<% end %>

View file

@ -495,6 +495,7 @@ en:
report_button: "Report"
update_pdf: "Update PDF"
save_pdf_to_inventory: "Save PDF to Inventory"
search_reports: "Find Reports"
request_docx: "Generate DOCX"
update_docx: "Update DOCX"
edit: "Edit"