Skip to content

Commit

Permalink
Rollback of submission search (#4459)
Browse files Browse the repository at this point in the history
* Rollback of submission search
  • Loading branch information
tofarr committed Apr 9, 2024
1 parent 252819e commit 1b82e67
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 33 deletions.
11 changes: 0 additions & 11 deletions app/assets/stylesheets/_state-file.scss
Expand Up @@ -687,14 +687,3 @@ $state-colors: (
border-bottom-right-radius: 8px;
}
}

.state-file-submissions {
.pagination-wrapper {
align-items: center;
}
.search-container {
padding-bottom: 2rem;
.hub-searchbar__input{
}
}
}
18 changes: 0 additions & 18 deletions app/controllers/hub/state_file/efile_submissions_controller.rb
Expand Up @@ -5,24 +5,6 @@ class EfileSubmissionsController < Hub::StateFile::BaseController
before_action :load_efile_submissions, only: [:index]

def index

join_sql = StateFileBaseIntake::STATE_CODES.map do |state_code|
"SELECT state_file_#{state_code}_intakes.id as intake_id, 'StateFile#{state_code.to_s.titleize}Intake' as ds_type, '#{state_code}' as data_source_state_code, state_file_#{state_code}_intakes.email_address FROM state_file_#{state_code}_intakes"
end
join_sql = "INNER JOIN (#{join_sql.join(" UNION ")}) data_source ON data_source.ds_type = efile_submissions.data_source_type and data_source.ds_type = efile_submissions.data_source_type"
@efile_submissions = EfileSubmission.joins(join_sql).select("efile_submissions.*, data_source.*")

search = params[:search]
if search.present?
query = "email_address LIKE ? OR irs_submission_id LIKE ?"
query_args = ["%#{search}%", "%#{search}%"]
if search.to_i.to_s == search
query << " OR id=? OR intake_id=?"
query_args.concat [search.to_i, search.to_i]
end
@efile_submissions = @efile_submissions.where(query, *query_args)
end

@efile_submissions = @efile_submissions.includes(:efile_submission_transitions).reorder(created_at: :desc).paginate(page: params[:page], per_page: 30)
@efile_submissions = @efile_submissions.in_state(params[:status]) if params[:status].present?

Expand Down
6 changes: 3 additions & 3 deletions app/views/hub/state_file/efile_submissions/index.html.erb
Expand Up @@ -3,7 +3,7 @@
<div class="efile-state-counts" style="display: flex;">
<%= render "state_counts", efile_submission_state_counts: @efile_submission_state_counts %>
</div>
<div class="slab slab--not-padded spacing-above-25 state-file-submissions">
<div class="slab slab--not-padded spacing-above-25">
<div class="search-container">
<%= form_tag hub_state_file_efile_submissions_path, method: "get", class: "hub-searchbar" do %>
<input type="text" class="hub-searchbar__input" id="search" name="search" <%= tag.attributes value: params[:search] %>>
Expand Down Expand Up @@ -79,8 +79,8 @@
<td class="index-table__cell">
<%= submission.irs_submission_id.present? ? link_to(submission.irs_submission_id, hub_state_file_efile_submission_path(id: submission.id)) : "" %>
</td>
<td class="index-table__cell"><%= submission.data_source_state_code %><%=submission.data_source_id %></td>
<td class="index-table__cell"><%= submission.email_address %></td>
<td class="index-table__cell"><%= submission.data_source.state_name %></td>
<td class="index-table__cell"><%= submission.data_source.email_address %></td>
</tr>
<% end %>
</tbody>
Expand Down
2 changes: 1 addition & 1 deletion spec/features/hub/state_file/efile_submissions_spec.rb
Expand Up @@ -15,7 +15,7 @@
expect(page).to have_content(efile_submission.id)
expect(page).to have_content(efile_submission.current_state.humanize(capitalize: false))
expect(page).to have_content(efile_submission.irs_submission_id)
expect(page).to have_content("#{efile_submission.data_source.state_code}#{efile_submission.data_source.id}")
expect(page).to have_content(efile_submission.data_source.state_name)
expect(page).to have_content(efile_submission.data_source.email_address)
end

Expand Down

0 comments on commit 1b82e67

Please sign in to comment.