mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2025-01-27 10:08:11 +08:00
Add search field to reports page [SCI-5551]
This commit is contained in:
parent
34c79d66b8
commit
e953666762
5 changed files with 21 additions and 0 deletions
|
@ -360,6 +360,10 @@
|
|||
});
|
||||
}
|
||||
|
||||
$('.reports-index').on('change', '.report-search', function() {
|
||||
REPORTS_TABLE.search($(this).val()).draw();
|
||||
});
|
||||
|
||||
$('#show_report_preview').click();
|
||||
|
||||
initDatatable();
|
||||
|
|
|
@ -18,6 +18,13 @@
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
.search-report-container {
|
||||
display: inline-block;
|
||||
float: right;
|
||||
margin-right: 2em;
|
||||
width: 200px;
|
||||
}
|
||||
}
|
||||
|
||||
.reports-datatable {
|
||||
|
|
|
@ -103,5 +103,10 @@ class ReportDatatable < CustomDatatable
|
|||
Report.from(res, :reports)
|
||||
end
|
||||
|
||||
def filter_records(records)
|
||||
records.where('project_name ILIKE :q OR reports.name ILIKE :q OR reports.description ILIKE :q',
|
||||
{ q: "%#{dt_params.dig(:search, :value)}%" })
|
||||
end
|
||||
|
||||
# ==== Insert 'presenter'-like methods below if necessary
|
||||
end
|
||||
|
|
|
@ -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 %>
|
||||
|
|
|
@ -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"
|
||||
|
|
Loading…
Reference in a new issue