|
|
|
@ -1,6 +1,20 @@
|
|
|
|
<% query_params = params.permit(:q).merge(filter_params) %>
|
|
|
|
<% query_params = params.permit(:q).merge(filter_params) %>
|
|
|
|
|
|
|
|
<% filter_names = %w[status folder author completed_at created_at] %>
|
|
|
|
|
|
|
|
<% ordered_filters = request.query_parameters.keys.filter_map { |key| filter_names.find { |name| key.start_with?(name) } }.uniq %>
|
|
|
|
|
|
|
|
<% chip_order = ordered_filters.reverse.each_with_index.to_h { |name, index| [name, index + 1] } %>
|
|
|
|
|
|
|
|
<% chip_order.default = ordered_filters.size + 1 %>
|
|
|
|
|
|
|
|
<scroll-fade class="flex items-center gap-2 overflow-x-auto flex-1 min-w-0 [scrollbar-width:none] [&::-webkit-scrollbar]:hidden [&::-webkit-scrollbar]:h-0 [&::-webkit-scrollbar]:w-0 md:contents">
|
|
|
|
|
|
|
|
<% if local_assigns[:with_status] %>
|
|
|
|
|
|
|
|
<% status_icons = { 'all' => 'list', 'pending' => 'clock', 'completed' => 'circle_check', 'partially_completed' => 'clock_edit', 'sent' => 'send', 'opened' => 'mail_opened', 'declined' => 'x_circle', 'expired' => 'clock_cancel' } %>
|
|
|
|
|
|
|
|
<% current_status = status_icons.key?(params[:status].to_s) ? params[:status] : 'all' %>
|
|
|
|
|
|
|
|
<a href="<%= submissions_filter_path('status', query_params.merge(path: url_for)) %>" data-turbo-frame="modal" class="order-<%= current_status == 'all' ? 'none' : chip_order['status'] %> md:hidden flex h-10 px-2 py-1 space-x-1 text-base items-center border text-neutral rounded-xl shrink-0 <%= current_status == 'all' ? 'border-neutral-300' : 'border-neutral-700' %>">
|
|
|
|
|
|
|
|
<%= svg_icon(status_icons[current_status], class: 'w-5 h-5 shrink-0') %>
|
|
|
|
|
|
|
|
<span><%= t(current_status) %></span>
|
|
|
|
|
|
|
|
<%= svg_icon('chevron_down', class: 'w-4 h-4 shrink-0') %>
|
|
|
|
|
|
|
|
</a>
|
|
|
|
|
|
|
|
<% end %>
|
|
|
|
<% if icon = { 'declined' => 'x_circle', 'expired' => 'clock_cancel', 'partially_completed' => 'clock_edit', 'sent' => 'send', 'opened' => 'mail_opened' }[params[:status]] %>
|
|
|
|
<% if icon = { 'declined' => 'x_circle', 'expired' => 'clock_cancel', 'partially_completed' => 'clock_edit', 'sent' => 'send', 'opened' => 'mail_opened' }[params[:status]] %>
|
|
|
|
<div class="flex h-10 px-2 py-1 text-lg items-center justify-between border text-center text-neutral font-semibold rounded-xl w-full md:w-36 border-neutral-700">
|
|
|
|
<div class="order-<%= chip_order['status'] %> md:order-none <%= 'hidden md:flex' if local_assigns[:with_status] %> flex h-10 px-2 py-1 text-base md:text-lg items-center justify-between border text-center text-neutral font-semibold rounded-xl shrink-0 max-w-[60vw] md:w-36 border-neutral-700">
|
|
|
|
<%= link_to submissions_filter_path('status', query_params.merge(path: url_for, with_remove: true)), data: { turbo_frame: 'modal' }, class: 'flex items-center space-x-1 flex-1 min-w-0 pr-1' do %>
|
|
|
|
<%= link_to submissions_filter_path('status', query_params.merge(path: url_for, with_remove: true)), data: { turbo_frame: 'modal' }, class: 'flex items-center space-x-1 flex-1 min-w-0 pr-1' do %>
|
|
|
|
<%= svg_icon(icon, class: 'w-5 h-5 shrink-0') %>
|
|
|
|
<%= svg_icon(icon, class: 'w-5 h-5 shrink-0') %>
|
|
|
|
<span class="font-normal truncate"><%= t(params[:status]) %></span>
|
|
|
|
<span class="font-normal truncate"><%= t(params[:status]) %></span>
|
|
|
|
@ -11,7 +25,7 @@
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<% end %>
|
|
|
|
<% end %>
|
|
|
|
<% if params[:folder].present? %>
|
|
|
|
<% if params[:folder].present? %>
|
|
|
|
<div class="tooltip tooltip-no-touch tooltip-bottom flex h-10 px-2 py-1 text-lg items-center justify-between border text-center text-neutral font-semibold rounded-xl w-full md:w-36 border-neutral-700" data-tip="<%= t('folder') %>">
|
|
|
|
<div class="order-<%= chip_order['folder'] %> md:order-none md:tooltip tooltip-no-touch tooltip-bottom flex md:flex h-10 px-2 py-1 text-base md:text-lg items-center justify-between border text-center text-neutral font-semibold rounded-xl shrink-0 max-w-[60vw] md:w-36 border-neutral-700" data-tip="<%= t('folder') %>">
|
|
|
|
<%= link_to submissions_filter_path('folder', query_params.merge(path: url_for, with_remove: true)), data: { turbo_frame: 'modal' }, class: 'flex items-center space-x-1 flex-1 min-w-0 pr-1' do %>
|
|
|
|
<%= link_to submissions_filter_path('folder', query_params.merge(path: url_for, with_remove: true)), data: { turbo_frame: 'modal' }, class: 'flex items-center space-x-1 flex-1 min-w-0 pr-1' do %>
|
|
|
|
<%= svg_icon('folder', class: 'w-5 h-5 shrink-0') %>
|
|
|
|
<%= svg_icon('folder', class: 'w-5 h-5 shrink-0') %>
|
|
|
|
<span class="font-normal truncate"><%= params[:folder] %></span>
|
|
|
|
<span class="font-normal truncate"><%= params[:folder] %></span>
|
|
|
|
@ -22,7 +36,7 @@
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<% end %>
|
|
|
|
<% end %>
|
|
|
|
<% if params[:author].present? %>
|
|
|
|
<% if params[:author].present? %>
|
|
|
|
<div class="tooltip tooltip-no-touch tooltip-bottom flex h-10 px-2 py-1 text-lg items-center justify-between border text-center text-neutral font-semibold rounded-xl w-full md:w-36 border-neutral-700" data-tip="<%= t('author') %>">
|
|
|
|
<div class="order-<%= chip_order['author'] %> md:order-none md:tooltip tooltip-no-touch tooltip-bottom flex md:flex h-10 px-2 py-1 text-base md:text-lg items-center justify-between border text-center text-neutral font-semibold rounded-xl shrink-0 max-w-[60vw] md:w-36 border-neutral-700" data-tip="<%= t('author') %>">
|
|
|
|
<%= link_to submissions_filter_path('author', query_params.merge(path: url_for, with_remove: true)), data: { turbo_frame: 'modal' }, class: 'flex items-center space-x-1 flex-1 min-w-0 pr-1' do %>
|
|
|
|
<%= link_to submissions_filter_path('author', query_params.merge(path: url_for, with_remove: true)), data: { turbo_frame: 'modal' }, class: 'flex items-center space-x-1 flex-1 min-w-0 pr-1' do %>
|
|
|
|
<%= svg_icon('user', class: 'w-5 h-5 shrink-0') %>
|
|
|
|
<%= svg_icon('user', class: 'w-5 h-5 shrink-0') %>
|
|
|
|
<span class="font-normal truncate"><%= current_account.users.accessible_by(current_ability).where(account: current_account).find_by(email: params[:author])&.full_name || 'NA' %></span>
|
|
|
|
<span class="font-normal truncate"><%= current_account.users.accessible_by(current_ability).where(account: current_account).find_by(email: params[:author])&.full_name || 'NA' %></span>
|
|
|
|
@ -33,15 +47,14 @@
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<% end %>
|
|
|
|
<% end %>
|
|
|
|
<% if query_params[:completed_at_from].present? || query_params[:completed_at_to].present? %>
|
|
|
|
<% if query_params[:completed_at_from].present? || query_params[:completed_at_to].present? %>
|
|
|
|
<div class="tooltip tooltip-no-touch tooltip-bottom flex h-10 px-2 py-1 text-lg items-center justify-between border text-center text-neutral font-semibold rounded-xl w-full md:w-36 border-neutral-700" data-tip="<%= t('completed_at') %>">
|
|
|
|
<div class="order-<%= chip_order['completed_at'] %> md:order-none md:tooltip tooltip-no-touch tooltip-bottom flex md:flex h-10 px-2 py-1 text-base md:text-lg items-center justify-between border text-center text-neutral font-semibold rounded-xl shrink-0 max-w-[60vw] md:w-36 border-neutral-700" data-tip="<%= t('completed_at') %>">
|
|
|
|
<%= link_to submissions_filter_path('completed_at', query_params.merge(path: url_for, with_remove: true)), data: { turbo_frame: 'modal' }, class: 'flex items-center space-x-1 flex-1 min-w-0 pr-1' do %>
|
|
|
|
<%= link_to submissions_filter_path('completed_at', query_params.merge(path: url_for, with_remove: true)), data: { turbo_frame: 'modal' }, class: 'flex items-center space-x-1 flex-1 min-w-0 pr-1' do %>
|
|
|
|
<%= svg_icon('calendar_check', class: 'w-5 h-5 shrink-0') %>
|
|
|
|
<%= svg_icon('calendar_check', class: 'w-5 h-5 shrink-0') %>
|
|
|
|
<span class="flex flex-row md:flex-col font-normal text-left md:text-center md:text-xs">
|
|
|
|
<span class="flex flex-col font-normal text-left md:text-center text-xs">
|
|
|
|
<% if query_params[:completed_at_from] == query_params[:completed_at_to] %>
|
|
|
|
<% if query_params[:completed_at_from] == query_params[:completed_at_to] %>
|
|
|
|
<span><%= l(Date.parse(query_params[:completed_at_from]), locale: current_account.locale) %></span>
|
|
|
|
<span><%= l(Date.parse(query_params[:completed_at_from]), locale: current_account.locale) %></span>
|
|
|
|
<% else %>
|
|
|
|
<% else %>
|
|
|
|
<span><%= query_params[:completed_at_from].present? ? l(Date.parse(query_params[:completed_at_from]), locale: current_account.locale) : '∞' %></span>
|
|
|
|
<span><%= query_params[:completed_at_from].present? ? l(Date.parse(query_params[:completed_at_from]), locale: current_account.locale) : '∞' %></span>
|
|
|
|
<span class="px-1 md:px-0 md:hidden">-</span>
|
|
|
|
|
|
|
|
<span><%= query_params[:completed_at_to].present? ? l(Date.parse(query_params[:completed_at_to]), locale: current_account.locale) : t('today') %></span>
|
|
|
|
<span><%= query_params[:completed_at_to].present? ? l(Date.parse(query_params[:completed_at_to]), locale: current_account.locale) : t('today') %></span>
|
|
|
|
<% end %>
|
|
|
|
<% end %>
|
|
|
|
</span>
|
|
|
|
</span>
|
|
|
|
@ -52,15 +65,14 @@
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<% end %>
|
|
|
|
<% end %>
|
|
|
|
<% if query_params[:created_at_from].present? || query_params[:created_at_to].present? %>
|
|
|
|
<% if query_params[:created_at_from].present? || query_params[:created_at_to].present? %>
|
|
|
|
<div class="tooltip tooltip-no-touch tooltip-bottom flex h-10 px-2 py-1 text-lg items-center justify-between border text-center text-neutral font-semibold rounded-xl w-full md:w-36 border-neutral-700" data-tip="<%= t('created_at') %>">
|
|
|
|
<div class="order-<%= chip_order['created_at'] %> md:order-none md:tooltip tooltip-no-touch tooltip-bottom flex md:flex h-10 px-2 py-1 text-base md:text-lg items-center justify-between border text-center text-neutral font-semibold rounded-xl shrink-0 max-w-[60vw] md:w-36 border-neutral-700" data-tip="<%= t('created_at') %>">
|
|
|
|
<%= link_to submissions_filter_path('created_at', query_params.merge(path: url_for, with_remove: true)), data: { turbo_frame: 'modal' }, class: 'flex items-center space-x-1 flex-1 min-w-0 pr-1' do %>
|
|
|
|
<%= link_to submissions_filter_path('created_at', query_params.merge(path: url_for, with_remove: true)), data: { turbo_frame: 'modal' }, class: 'flex items-center space-x-1 flex-1 min-w-0 pr-1' do %>
|
|
|
|
<%= svg_icon('calendar', class: 'w-5 h-5 shrink-0') %>
|
|
|
|
<%= svg_icon('calendar', class: 'w-5 h-5 shrink-0') %>
|
|
|
|
<span class="flex flex-row md:flex-col font-normal text-left md:text-center md:text-xs">
|
|
|
|
<span class="flex flex-col font-normal text-left md:text-center text-xs">
|
|
|
|
<% if query_params[:created_at_from] == query_params[:created_at_to] %>
|
|
|
|
<% if query_params[:created_at_from] == query_params[:created_at_to] %>
|
|
|
|
<span><%= l(Date.parse(query_params[:created_at_from]), locale: current_account.locale) %></span>
|
|
|
|
<span><%= l(Date.parse(query_params[:created_at_from]), locale: current_account.locale) %></span>
|
|
|
|
<% else %>
|
|
|
|
<% else %>
|
|
|
|
<span><%= query_params[:created_at_from].present? ? l(Date.parse(query_params[:created_at_from]), locale: current_account.locale) : '∞' %></span>
|
|
|
|
<span><%= query_params[:created_at_from].present? ? l(Date.parse(query_params[:created_at_from]), locale: current_account.locale) : '∞' %></span>
|
|
|
|
<span class="px-1 md:px-0 md:hidden">-</span>
|
|
|
|
|
|
|
|
<span><%= query_params[:created_at_to].present? ? l(Date.parse(query_params[:created_at_to]), locale: current_account.locale) : t('today') %></span>
|
|
|
|
<span><%= query_params[:created_at_to].present? ? l(Date.parse(query_params[:created_at_to]), locale: current_account.locale) : t('today') %></span>
|
|
|
|
<% end %>
|
|
|
|
<% end %>
|
|
|
|
</span>
|
|
|
|
</span>
|
|
|
|
@ -70,3 +82,4 @@
|
|
|
|
<% end %>
|
|
|
|
<% end %>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<% end %>
|
|
|
|
<% end %>
|
|
|
|
|
|
|
|
</scroll-fade>
|
|
|
|
|