Revamp of (top) toolbar - Reports [SCI-8370]

This commit is contained in:
Giga Chubinidze 2023-05-10 01:09:05 +04:00
parent 8f657710ad
commit 57c0e299e8
3 changed files with 59 additions and 4 deletions

View file

@ -353,6 +353,25 @@
generateReportRequest('generate-pdf-path', reportId); generateReportRequest('generate-pdf-path', reportId);
}); });
// Search container logic
const $searchIcon = $('.search-icon');
const $searchInput = $('.report-search');
$searchIcon.click(function() {
$searchIcon.addClass('hidden');
$searchInput.removeClass('hidden').addClass('search-input-field');
});
$(document).click(function(event) {
const isClickInside = $searchInput.is(event.target) || $searchIcon.is(event.target);
if (!isClickInside) {
if ($searchInput.val().trim() === '') {
$searchIcon.removeClass('hidden');
$searchInput.addClass('hidden').removeClass('search-input-field');
}
}
});
$('#show_report_preview').click(); $('#show_report_preview').click();
initDatatable(); initDatatable();

View file

@ -19,12 +19,48 @@
} }
} }
.toolbar-row {
display: flex;
justify-content: space-between;
}
.search-report-container { .search-report-container {
display: inline-block;
float: right; float: right;
margin-right: 2em; margin-right: 2em;
width: 200px; width: 200px;
} }
.sci-input-container {
display: flex;
align-items: center;
position: relative;
width: 200px;
}
.flex-row-reverse {
flex-direction: row-reverse;
}
.search-icon {
cursor: pointer;
}
.report-search {
position: absolute;
top: 0;
left: auto;
right: 100%;
width: 100%;
}
.hidden {
display: none;
}
.search-input-field {
position: relative;
left: 5px;
}
} }
.reports-datatable { .reports-datatable {

View file

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