|
1 | | -<% if @job_applications.any? %> |
| 1 | +<% if JobApplication.exists? %> |
2 | 2 | <div class="mb-8 flex justify-end"> |
3 | 3 | <%= link_to 'New Job Application', new_job_application_path, class: 'text-sm bg-blue-600 hover:bg-blue-700 text-white font-bold py-2 px-4 rounded cursor-pointer', data: { turbo_frame: "_top" } %> |
4 | 4 | </div> |
5 | 5 | <%= form_with url: job_applications_path, method: :get, data: { controller: "job-filter", turbo_frame: "job_applications_table" } do |form| %> |
6 | | - <!-- Your existing filter form code here --> |
| 6 | + <div class="flex flex-wrap -mx-2 mb-4"> |
| 7 | + <div class="w-full md:w-1/6 px-2 mb-4 md:mb-0"> |
| 8 | + <%= form.label :search, "Search", class: "sr-only" %> |
| 9 | + <%= form.text_field :search, value: params[:search], class: "shadow appearance-none border rounded w-full py-2 px-3 text-gray-700 leading-tight focus:outline-none focus:shadow-outline", placeholder: "Search", data: { action: "input->job-filter#submit" } %> |
| 10 | + </div> |
| 11 | + <div class="w-full md:w-1/6 px-2 mb-4 md:mb-0"> |
| 12 | + <%= form.label :method_of_contact, "Contact Method", class: "sr-only" %> |
| 13 | + <%= form.select :method_of_contact, |
| 14 | + options_for_select([["All Contact Methods", ""]] + JobApplication.method_of_contacts.map { |k, v| [k.humanize, v] }, params[:method_of_contact]), |
| 15 | + {}, |
| 16 | + class: "shadow appearance-none border rounded w-full py-2 px-3 text-gray-700 leading-tight focus:outline-none focus:shadow-outline", |
| 17 | + data: { action: "change->job-filter#submit" } |
| 18 | + %> |
| 19 | + </div> |
| 20 | + <div class="w-full md:w-1/6 px-2 mb-4 md:mb-0"> |
| 21 | + <%= form.label :position_type, "Position Type", class: "sr-only" %> |
| 22 | + <%= form.select :position_type, |
| 23 | + options_for_select([["All Position Types", ""]] + JobApplication.position_types.map { |k, v| [display_position_type(k), v] }, params[:position_type]), |
| 24 | + {}, |
| 25 | + class: "shadow appearance-none border rounded w-full py-2 px-3 text-gray-700 leading-tight focus:outline-none focus:shadow-outline", |
| 26 | + data: { action: "change->job-filter#submit" } |
| 27 | + %> |
| 28 | + </div> |
| 29 | + <div class="w-full md:w-1/6 px-2 mb-4 md:mb-0"> |
| 30 | + <%= form.label :claimed_for_unemployment, "Unemployment Claim", class: "sr-only" %> |
| 31 | + <%= form.select :claimed_for_unemployment, |
| 32 | + options_for_select([["All Claims", ""], ["Claimed", "true"], ["Not Claimed", "false"]], params[:claimed_for_unemployment]), |
| 33 | + {}, |
| 34 | + class: "shadow appearance-none border rounded w-full py-2 px-3 text-gray-700 leading-tight focus:outline-none focus:shadow-outline", |
| 35 | + data: { action: "change->job-filter#submit" } |
| 36 | + %> |
| 37 | + </div> |
| 38 | + <div class="w-full md:w-1/6 px-2 mb-4 md:mb-0"> |
| 39 | + <%= form.label :status, "Application Status", class: "sr-only" %> |
| 40 | + <%= form.select :status, |
| 41 | + options_for_select([["All Statuses", ""]] + JobApplication.statuses.map { |k, v| [k.humanize, v] }, params[:status]), |
| 42 | + {}, |
| 43 | + class: "shadow appearance-none border rounded w-full py-2 px-3 text-gray-700 leading-tight focus:outline-none focus:shadow-outline", |
| 44 | + data: { action: "change->job-filter#submit" } |
| 45 | + %> |
| 46 | + </div> |
| 47 | + <div class="w-full md:w-1/6 px-2 mt-4 md:mt-0"> |
| 48 | + <%= form.button "Reset Filters", type: "button", class: "w-full bg-gray-600 hover:bg-gray-700 text-white font-bold py-2 px-4 rounded cursor-pointer", data: { action: "click->job-filter#reset" } %> |
| 49 | + </div> |
| 50 | + </div> |
7 | 51 | <% end %> |
8 | 52 | <%= turbo_frame_tag "job_applications_table" do %> |
9 | 53 | <%= render partial: "job_applications_table", locals: { job_applications: @job_applications } %> |
10 | | - <div id="pagination" class="mt-4"> |
11 | | - <%= render partial: "pagination", locals: { job_applications: @job_applications, job_application_count: @job_application_count } %> |
12 | | - </div> |
| 54 | + <% if @job_applications.any? %> |
| 55 | + <div id="pagination" class="mt-4"> |
| 56 | + <%= render partial: "pagination", locals: { job_applications: @job_applications, job_application_count: @job_applications.count } %> |
| 57 | + </div> |
| 58 | + <% end %> |
13 | 59 | <% end %> |
14 | 60 | <% else %> |
15 | 61 | <%= render 'empty_state' %> |
|
0 commit comments