Skip to content
This repository has been archived by the owner on Nov 16, 2019. It is now read-only.

Commit

Permalink
Merge pull request #427 from ServiceInnovationLab/dev
Browse files Browse the repository at this point in the history
get ready for SS4 deploy to production
  • Loading branch information
mischa-s authored Jun 24, 2019
2 parents 2cbd3a5 + 2f9cfcc commit 570ce4a
Show file tree
Hide file tree
Showing 56 changed files with 731 additions and 428 deletions.
1 change: 1 addition & 0 deletions app/assets/images/blue-download.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
41 changes: 37 additions & 4 deletions app/assets/stylesheets/admin/batches.css
Original file line number Diff line number Diff line change
Expand Up @@ -25,28 +25,34 @@
letter-spacing: normal;
width: 770px
}

.batches-flex-table-row {
padding: 1em 1.75em;
display: flex;
border-top: 2px solid var(--dove);
}

.batches-flex-table-cell {
width: 30%
}

.batches-flex-table-first-cell {
width: 40%
}

.batches-accordion-header-row {
width: 100%;
color: var(--dark-gray)
}

.batches-accordion-header-title {
display: flex;
align-items: center;
font-size: 22px;
font-weight: bold;
color: var(--black)
}

.batches-accordion-header-button {
font-size: 18px;
text-transform: uppercase;
Expand All @@ -57,11 +63,39 @@
border-radius: .2em;
margin-left: auto;
padding: .5em 2em;
}

.batches-header-sheet-download-button,
.batches-applications-button,
.batches-applications-header {
color: var(--blue);
font-family: "Fira-Bold", Helvetica, Arial, sans-serif;
font-size: 18px;
}

.batches-header-sheet-download-button {
margin-right: 64px;
}

.batches-header-sheet-required {
display: inline;
margin-right: 50px;
}

.batches-download-icon {
width: 20px;
margin-right: 10px;
}

.batches-accordion-header-button:hover {
background-color: var(--blue-hover);
}

.batches-applications-header {
margin-left: 500px;
position: absolute;
}

.batch-details-link {
display: flex;
align-items: center;
Expand All @@ -70,13 +104,16 @@
font-weight: bold;
color: var(--blue)
}

.batch-details-link:hover {
border: 1px solid var(--blue);
}

.accordion {
border: 1px solid rgba(0, 0, 0, 0.1);
border-radius: 2px;
}

.accordion__item {
margin-bottom: .5em
}
Expand All @@ -91,10 +128,6 @@
border: 2px solid var(--dove);
}

.accordion__button:hover {
background-color: var(--gray);
}

.accordion__button:after {
color: var(--blue);
display: inline-block;
Expand Down
42 changes: 39 additions & 3 deletions app/assets/stylesheets/admin/rebate_form.css
Original file line number Diff line number Diff line change
Expand Up @@ -75,11 +75,30 @@
width: 1.75em;
}

.rebate-details-header {
align-items: center;
display: flex;
justify-content: space-between;
margin: auto;
max-width: 1000px;
min-width: 500px;
width: 90vw;
}

.customer-details-header {
margin-top: 30px;
}

.rebate-details-title,
.rebate-edit {
display: inline-block;
}

.rebate-edit {
background-color: var(--blue);
border-radius: .2em;
color: var(--white);
float: right;
margin-bottom: 10px;
width: 5em;
}

Expand Down Expand Up @@ -138,6 +157,10 @@
align-items: center
}

.council-row {
align-items: normal;
}

.flex-column {
display: flex;
flex-direction: column
Expand Down Expand Up @@ -177,25 +200,38 @@
margin-top: -5em;
}

.council-buttons {
margin-top: -10em;
min-width: 0;
}

.rebate-cancel-button {
background-color: var(--white);
border-radius: .2em;
border: 1px solid var(--black);
color: var(--black);
margin: 0 1em 1.5em 5em;
/* margin: auto; */
float: right;
}

.rebate-council-cancel-button {
float: none;
height: 39px;
margin: 0 1em 0 0;
}

.rebate-submit-button {
background-color: var(--blue);
border-radius: .2em;
color: var(--white);
margin-bottom: 1.5em;
/* margin: auto; */
float: right;
}

.rebate-council-submit-button {
margin-top: 0 !important;
}

.rebate-add-income-button {
line-height: 2em;
margin: 0 auto .5em auto;
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/admin/batches_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ def index
@batches = policy_scope(Batch)
.all
.order(created_at: :desc)
.to_json(include: { rebate_forms: { include: :property } })
.to_json(include: [:rebate_forms])
end

def edit
Expand Down
3 changes: 1 addition & 2 deletions app/controllers/admin/processed_rebate_forms_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,8 @@ def index
@processed_rebate_forms = policy_scope(RebateForm)
.where(status: RebateForm::PROCESSED_STATUS)
.order(created_at: :asc)
.to_json(include: [:property])

respond_with json: @processed_rebate_forms.to_json(include: [:property])
respond_with json: @processed_rebate_forms
end

def create
Expand Down
22 changes: 0 additions & 22 deletions app/controllers/admin/production-deployment-how-to.md

This file was deleted.

20 changes: 8 additions & 12 deletions app/controllers/admin/rebate_forms_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ def index
# filter by the search form fields
@rebate_forms = @rebate_forms.where("fields ->> 'full_name' iLIKE ?", "%#{@name}%") if @name.present?

respond_with json: @rebate_forms.to_json(include: [:property])
respond_with json: @rebate_forms
end

# GET /admin/rebate_forms/1
Expand All @@ -40,16 +40,12 @@ def show

@updated_by = User.find(@rebate_form.updated_by) unless @rebate_form.updated_by.nil?

respond_with(@rebate_form) do |format|
format.pdf do
render pdf: pdf_filename, page_size: 'A4', layout: 'pdf', margin: { top: 0, bottom: 0, left: 0, right: 0 }, dpi: '300'
end
end
respond_with(@rebate_form)
end

# PATCH/PUT /admin/rebate_forms/1
def update
@rebate_form = RebateFormsService.new(rebate_form_fields_params).update!
@rebate_form = RebateFormsUpdateService.new(rebate_form_fields_params).update!
@rebate_form.update(updated_by: current_user.id)
respond_with @rebate_form, location: admin_rebate_form_url(@rebate_form), notice: 'Rebate form was successfully updated.'
end
Expand All @@ -72,11 +68,11 @@ def set_rebate_form
end

def rebate_form_fields_params
params.permit(:id, :valuation_id, :total_rates, :location, :council, fields: {})
end

def rebate_form_params
params.require(:rebate_form).permit(attachments: [])
params.permit(:id,
:total_rates,
:location,
:council,
fields: {})
end

def pdf_filename
Expand Down
25 changes: 25 additions & 0 deletions app/controllers/admin/rebate_forms_council_details_controller.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# frozen_string_literal: true

class Admin::RebateFormsCouncilDetailsController < Admin::BaseController
def edit
@rebate_form = RebateForm.find(params[:rebate_form_id])
authorize @rebate_form
end

def update
rebate_form = RebateForm.find(params['id'])
authorize rebate_form

rebate_form.update!(valuation_id: rebate_form_council_details_params['valuation_id'],
customer_id: rebate_form_council_details_params['customer_id'],
application_id: rebate_form_council_details_params['application_id'])

redirect_to admin_rebate_form_path(rebate_form)
end

private

def rebate_form_council_details_params
params.require(:rebate_form).permit(:customer_id, :valuation_id, :application_id)
end
end
4 changes: 2 additions & 2 deletions app/controllers/admin/signed_rebate_forms_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ def index
@signed_rebate_forms = policy_scope(RebateForm)
.where(status: RebateForm::SIGNED_STATUS)
.order(created_at: :asc)
.to_json(include: [:property])
respond_with json: @signed_rebate_forms.to_json(include: [:property])

respond_with json: @signed_rebate_forms
end
end
1 change: 1 addition & 0 deletions app/controllers/properties_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ def index
Property.where('location ILIKE ?', "%#{params[:q]}%")
.where(rating_year: Rails.configuration.rating_year)
.where(council_id: params[:council_id])
.where(include_in_address_lookups: true)
)
end
end
7 changes: 3 additions & 4 deletions app/controllers/rebate_forms_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ def show_by_jwt
end

def create
rebate_form = RebateFormsService.new(rebate_form_params).update!
rebate_form = RebateFormsService.new(rebate_form_params).create!

render_jsonapi(rebate_form, scope: false)
rescue RebateFormsService::Error
Expand All @@ -39,11 +39,10 @@ def rebate_form_params
.require(:api)
.require(:data)
.require(:attributes)
.permit(:id,
:valuation_id,
.permit(:valuation_id,
:council,
:total_rates,
:location,
:total_rates,
fields: {},
applicant_signature: {},
witness_signature: {})
Expand Down
28 changes: 15 additions & 13 deletions app/javascript/components/BatchesSummary.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,28 +45,30 @@ export function BatchesSummary(batches, isDiaUser, isCouncilUser) {
<br/>
<div className='batches-accordion-header-row'>
{cover_sheet_attached
? isDiaUser
? <a
target='_blank'
rel='noopener'
href={download_link}
id='header-sheet'
download>
? <a
target='_blank'
rel='noopener'
href={download_link}
id='header-sheet'
className='batches-header-sheet-download-button'
download>
<img className='batches-download-icon' alt='blue download icon' src='/assets/blue-download.svg'/>
HEADER SHEET
</a>
: 'HEADER SHEET'
: 'HEADER SHEET REQUIRED'
</a>
: <div className='batches-header-sheet-required'>Header sheet required</div>
}
{isDiaUser && <button
{isDiaUser && <a
target='_blank'
rel='noopener'
className='applications-button'
className='batches-applications-button'
onClick={() => {
window.open(`/admin/batches/${id}.pdf`);
}}>
<img className='batches-download-icon batch-download-icon' alt='blue download icon' src='/assets/blue-download.svg'/>
BATCH
</button>}
</a>}
</div>
<div className='batches-applications-header'>APPLICATIONS</div>
</AccordionItemButton>
</AccordionItemHeading>
<AccordionItemPanel>
Expand Down
Loading

0 comments on commit 570ce4a

Please # to comment.