Skip to content

Commit f701a4e

Browse files
author
Raushan Kumar Raman
committed
bug(case_contact): fixed the order of case contacts
1 parent 74a93e5 commit f701a4e

File tree

2 files changed

+15
-12
lines changed

2 files changed

+15
-12
lines changed

app/javascript/src/case_contact.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,12 @@ async function fireSwalFollowupAlert () {
4242
})
4343
}
4444

45+
$(document).on('turbo:load', function() {
46+
$('.filter-form').on('change', '.filter-input', function() {
47+
$(this).closest('form').submit();
48+
});
49+
});
50+
4551
$(() => { // JQuery's callback for the DOM loading
4652
$('[data-toggle="tooltip"]').tooltip()
4753
$('.followup-button').on('click', displayFollowupAlert)

app/views/case_contacts/index.html.erb

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
</div>
1616
</div>
1717

18-
<%= form_for_filterrific @filterrific, url: case_contacts_path, html: {class: "my-4"},
18+
<%= form_for_filterrific @filterrific, url: case_contacts_path, html: {class: "my-4 filter-form"}, remote: true,
1919
data: {turbo: true, turbo_frame: :case_contacts, turbo_action: :advance } do |f| %>
2020
<%= hidden_field_tag 'casa_case_id', params[:casa_case_id] %>
2121

@@ -38,18 +38,15 @@
3838
<div class="select-style-1 mb-0">
3939
<%= f.label :sorted_by %>
4040
<div class="select-position">
41-
<%= f.select(:sorted_by, @filterrific.select_options[:sorted_by], {}, {class: ""}) %>
41+
<%= f.select(:sorted_by, @filterrific.select_options[:sorted_by], {}, {class: "filter-input"}) %>
4242
</div>
4343
</div>
4444
<div class="form-check checkbox-style">
45-
<%= f.check_box :no_drafts, class: "form-check-input case-contact-contact-type" %>
45+
<%= f.check_box :no_drafts, class: "form-check-input case-contact-contact-type filter-input" %>
4646
<label class="form-check-label" for="filterrific_no_drafts">Hide drafts</label>
4747
</div>
4848
</div>
4949
<div>
50-
<%= button_tag( :class=> "btn-sm main-btn dark-btn") do %>
51-
<i class="lni lni-funnel mr-10"></i> Filter
52-
<% end %>
5350
<%= link_to("Reset filters", reset_filterrific_url,
5451
class: "btn-sm main-btn dark-btn-outline btn-hove",
5552
data: { turbo: true, turbo_frame: :case_contacts, turbo_action: :advance }) %>
@@ -65,11 +62,11 @@
6562
</div>
6663
<div class="col-sm-6 input-style-1">
6764
<%= f.label "Starting from", for: "filterrific_occurred_starting_at" %>
68-
<%= f.date_field(:occurred_starting_at, class: "") %>
65+
<%= f.date_field(:occurred_starting_at, class: "filter-input") %>
6966
</div>
7067
<div class="col-sm-6 input-style-1">
7168
<%= f.label "Ending at", for: "filterrific_occurred_ending_at" %>
72-
<%= f.date_field(:occurred_ending_at, class: "") %>
69+
<%= f.date_field(:occurred_ending_at, class: "filter-input") %>
7370
</div>
7471
</div>
7572
<div class="row mb-4">
@@ -84,7 +81,7 @@
8481
<div class="form-check checkbox-style">
8582
<%=
8683
f.check_box :contact_type,
87-
{multiple: true, class: "form-check-input case-contact-contact-type"},
84+
{multiple: true, class: "form-check-input case-contact-contact-type filter-input"},
8885
contact_type.id,
8986
nil
9087
%>
@@ -107,21 +104,21 @@
107104
<%= f.label :contact_medium %>
108105
<div class="select-position">
109106
<%= f.select(:contact_medium, options_from_collection_for_select(contact_mediums, "value", "label"),
110-
{include_blank: "Display all"}) %>
107+
{include_blank: "Display all", class: "filter-input"}) %>
111108
</div>
112109
</div>
113110
<div class="col-md-3 select-style-1 pr-5">
114111
<%= f.label :want_driving_reimbursement %>
115112
<div class="select-position">
116113
<%= f.select(:want_driving_reimbursement, @presenter.boolean_select_options,
117-
{include_blank: "Display all"}) %>
114+
{include_blank: "Display all", class: "filter-input"}) %>
118115
</div>
119116
</div>
120117
<div class="col-md-3 select-style-1 pr-5">
121118
<%= f.label :contact_made %>
122119
<div class="select-position">
123120
<%= f.select(:contact_made, @presenter.boolean_select_options,
124-
{include_blank: "Display all"}) %>
121+
{include_blank: "Display all", class: "filter-input"}) %>
125122
</div>
126123
</div>
127124
</div>

0 commit comments

Comments
 (0)