|
6 | 6 | <div class="mb-8 flex justify-between items-center"> |
7 | 7 | <div class="flex items-center"> |
8 | 8 | <%= image_tag(asset_path('apple-touch-icon.png'), |
9 | | - height: '32', |
10 | | - width: '32', |
11 | | - class: "rounded-full object-cover shadow-sm border-2 border-gray-200 mr-2", |
12 | | - aria: { label: "Job Tracker logo" }, |
13 | | - title: "Job Tracker logo") %> |
| 9 | + height: '32', |
| 10 | + width: '32', |
| 11 | + class: "rounded-full object-cover shadow-sm border-2 border-gray-200 mr-2", |
| 12 | + aria: { label: "Job Tracker logo" }, |
| 13 | + title: "Job Tracker logo") %> |
14 | 14 | <h2 class="hidden md:block md:text-2xl font-semibold text-gray-700 shadow-2xl"> |
15 | 15 | Job Tracker |
16 | 16 | </h2> |
17 | 17 | </div> |
18 | | - <%= 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" } %> |
| 18 | + <% if @job_applications.any? %> |
| 19 | + <%= 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" } %> |
| 20 | + <% end %> |
19 | 21 | </div> |
20 | | - <%= form_with url: job_applications_path, method: :get, data: { controller: "job-filter", turbo_frame: "job_applications_table" } do |form| %> |
21 | | - <div class="flex flex-wrap -mx-2 mb-4"> |
22 | | - <div class="w-full md:w-1/6 px-2 mb-4 md:mb-0"> |
23 | | - <%= form.label :search, "Search", class: "sr-only" %> |
24 | | - <%= 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" } %> |
| 22 | + <% if @job_applications.any? %> |
| 23 | + <%= form_with url: job_applications_path, method: :get, data: { controller: "job-filter", turbo_frame: "job_applications_table" } do |form| %> |
| 24 | + <div class="flex flex-wrap -mx-2 mb-4"> |
| 25 | + <div class="w-full md:w-1/6 px-2 mb-4 md:mb-0"> |
| 26 | + <%= form.label :search, "Search", class: "sr-only" %> |
| 27 | + <%= 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" } %> |
| 28 | + </div> |
| 29 | + <div class="w-full md:w-1/6 px-2 mb-4 md:mb-0"> |
| 30 | + <%= form.label :method_of_contact, "Contact Method", class: "sr-only" %> |
| 31 | + <%= form.select :method_of_contact, |
| 32 | + options_for_select([["All Contact Methods", ""]] + JobApplication.method_of_contacts.map { |k, v| [k.humanize, v] }, params[:method_of_contact]), |
| 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 :position_type, "Position Type", class: "sr-only" %> |
| 40 | + <%= form.select :position_type, |
| 41 | + options_for_select([["All Position Types", ""]] + JobApplication.position_types.map { |k, v| [display_position_type(k), v] }, params[:position_type]), |
| 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 mb-4 md:mb-0"> |
| 48 | + <%= form.label :claimed_for_unemployment, "Unemployment Claim", class: "sr-only" %> |
| 49 | + <%= form.select :claimed_for_unemployment, |
| 50 | + options_for_select([["All Claims", ""], ["Claimed", "true"], ["Not Claimed", "false"]], params[:claimed_for_unemployment]), |
| 51 | + {}, |
| 52 | + class: "shadow appearance-none border rounded w-full py-2 px-3 text-gray-700 leading-tight focus:outline-none focus:shadow-outline", |
| 53 | + data: { action: "change->job-filter#submit" } |
| 54 | + %> |
| 55 | + </div> |
| 56 | + <div class="w-full md:w-1/6 px-2 mb-4 md:mb-0"> |
| 57 | + <%= form.label :status, "Application Status", class: "sr-only" %> |
| 58 | + <%= form.select :status, |
| 59 | + options_for_select([["All Statuses", ""]] + JobApplication.statuses.map { |k, v| [k.humanize, v] }, params[:status]), |
| 60 | + {}, |
| 61 | + class: "shadow appearance-none border rounded w-full py-2 px-3 text-gray-700 leading-tight focus:outline-none focus:shadow-outline", |
| 62 | + data: { action: "change->job-filter#submit" } |
| 63 | + %> |
| 64 | + </div> |
| 65 | + <div class="w-full md:w-1/6 px-2 mt-4 md:mt-0"> |
| 66 | + <%= 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" } %> |
| 67 | + </div> |
25 | 68 | </div> |
26 | | - <div class="w-full md:w-1/6 px-2 mb-4 md:mb-0"> |
27 | | - <%= form.label :method_of_contact, "Contact Method", class: "sr-only" %> |
28 | | - <%= form.select :method_of_contact, |
29 | | - options_for_select([["All Contact Methods", ""]] + JobApplication.method_of_contacts.map { |k, v| [k.humanize, v] }, params[:method_of_contact]), |
30 | | - {}, |
31 | | - class: "shadow appearance-none border rounded w-full py-2 px-3 text-gray-700 leading-tight focus:outline-none focus:shadow-outline", |
32 | | - data: { action: "change->job-filter#submit" } |
33 | | - %> |
| 69 | + <% end %> |
| 70 | + <%= turbo_frame_tag "job_applications_table" do %> |
| 71 | + <%= render partial: "job_applications_table", locals: { job_applications: @job_applications } %> |
| 72 | + <div id="pagination" class="mt-4"> |
| 73 | + <%= render partial: "pagination", locals: { job_applications: @job_applications, job_application_count: @job_application_count } %> |
34 | 74 | </div> |
35 | | - <div class="w-full md:w-1/6 px-2 mb-4 md:mb-0"> |
36 | | - <%= form.label :position_type, "Position Type", class: "sr-only" %> |
37 | | - <%= form.select :position_type, |
38 | | - options_for_select([["All Position Types", ""]] + JobApplication.position_types.map { |k, v| [display_position_type(k), v] }, params[:position_type]), |
39 | | - {}, |
40 | | - class: "shadow appearance-none border rounded w-full py-2 px-3 text-gray-700 leading-tight focus:outline-none focus:shadow-outline", |
41 | | - data: { action: "change->job-filter#submit" } |
42 | | - %> |
43 | | - </div> |
44 | | - <div class="w-full md:w-1/6 px-2 mb-4 md:mb-0"> |
45 | | - <%= form.label :claimed_for_unemployment, "Unemployment Claim", class: "sr-only" %> |
46 | | - <%= form.select :claimed_for_unemployment, |
47 | | - options_for_select([["All Claims", ""], ["Claimed", "true"], ["Not Claimed", "false"]], params[:claimed_for_unemployment]), |
48 | | - {}, |
49 | | - class: "shadow appearance-none border rounded w-full py-2 px-3 text-gray-700 leading-tight focus:outline-none focus:shadow-outline", |
50 | | - data: { action: "change->job-filter#submit" } |
51 | | - %> |
52 | | - </div> |
53 | | - <div class="w-full md:w-1/6 px-2 mb-4 md:mb-0"> |
54 | | - <%= form.label :status, "Application Status", class: "sr-only" %> |
55 | | - <%= form.select :status, |
56 | | - options_for_select([["All Statuses", ""]] + JobApplication.statuses.map { |k, v| [k.humanize, v] }, params[:status]), |
57 | | - {}, |
58 | | - class: "shadow appearance-none border rounded w-full py-2 px-3 text-gray-700 leading-tight focus:outline-none focus:shadow-outline", |
59 | | - data: { action: "change->job-filter#submit" } |
60 | | - %> |
61 | | - </div> |
62 | | - <div class="w-full md:w-1/6 px-2 mt-4 md:mt-0"> |
63 | | - <%= 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" } %> |
64 | | - </div> |
65 | | - </div> |
66 | | - <% end %> |
67 | | - <%= turbo_frame_tag "job_applications_table" do %> |
68 | | - <%= render partial: "job_applications_table", locals: { job_applications: @job_applications } %> |
69 | | - <div id="pagination" class="mt-4"> |
70 | | - <%= render partial: "pagination", locals: { job_applications: @job_applications, job_application_count: @job_application_count } %> |
71 | | - </div> |
| 75 | + <% end %> |
| 76 | + <% else %> |
| 77 | + <%= render 'empty_state' %> |
72 | 78 | <% end %> |
73 | 79 | <%= turbo_frame_tag "new_job_application" %> |
74 | 80 | </div> |
|
0 commit comments