+<% status_icon = { 'declined' => 'x_circle', 'expired' => 'clock_cancel', 'partially_completed' => 'clock_edit', 'sent' => 'send', 'opened' => 'mail_opened' }[params[:status]] %>
+<% status_icons = { 'all' => 'list', 'pending' => 'clock', 'completed' => 'circle_check' } %>
+<% current_status = status_icons.key?(params[:status].to_s) ? params[:status].to_s : 'all' %>
+<% with_status_button = local_assigns[:with_status] && status_icon.blank? %>
+<% chips_html = capture do %>
+ <% if status_icon %>
+
<%= 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(status_icon, class: 'w-5 h-5 shrink-0') %>
<%= t(params[:status]) %>
<% end %>
<%= link_to url_for(params: request.query_parameters.except('status')), class: 'rounded-lg ml-1 shrink-0 hover:bg-base-content hover:text-white' do %>
@@ -82,4 +77,35 @@
<% end %>
<% end %>
-
+<% end %>
+<% if with_status_button && chips_html.blank? %>
+
+
+
+ <% { 'all' => request.query_parameters.except('status'), 'pending' => request.query_parameters.merge('status' => 'pending'), 'completed' => request.query_parameters.merge('status' => 'completed') }.each do |status, status_params| %>
+ -
+ <%= link_to url_for(params: status_params), class: ('bg-base-200' if current_status == status) do %>
+ <%= svg_icon(status_icons[status], class: 'w-5 h-5 shrink-0') %>
+ <%= t(status) %>
+ <% end %>
+
+ <% end %>
+
+
+<% end %>
+<% if chips_html.present? %>
+
+ <% if with_status_button %>
+
+ <%= svg_icon(status_icons[current_status], class: 'w-5 h-5 shrink-0') %>
+ <%= t(current_status) %>
+ <%= svg_icon('chevron_down', class: 'w-4 h-4 shrink-0') %>
+
+ <% end %>
+ <%= chips_html %>
+
+<% end %>
diff --git a/app/views/submissions_filters/_filter_button.html.erb b/app/views/submissions_filters/_filter_button.html.erb
index ec20c1ee..601b2d02 100644
--- a/app/views/submissions_filters/_filter_button.html.erb
+++ b/app/views/submissions_filters/_filter_button.html.erb
@@ -1,9 +1,11 @@
<% query_params = params.permit(:q).merge(filter_params) %>
<% advanced_filters = filter_params.then { |f| f[:status].in?(%w[pending completed]) ? f.except(:status) : f } %>
-
-
- <%= render 'submissions_filters/applied_filters', filter_params: %>
-
+
+ <%= render 'submissions_filters/applied_filters', filter_params:, with_status: true %>
+
<%= link_to new_template_submissions_export_path(@template, archived: true), class: 'btn btn-ghost text-base h-10 min-h-10', data: { turbo_frame: 'modal' } do %>
<%= svg_icon('download', class: 'w-6 h-6 stroke-2') %>
<%= t('export') %>