Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/server/quote/check-your-answers/index.njk
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
{
key: { text: "Red line boundary" },
value: { text: 'Added' },
actions: { items: [{ href: "/quote/upload-boundary" if formSubmitData.boundaryEntryType === 'upload' else "/quote/map", text: "Change", visuallyHiddenText: "red line boundary" }] }
actions: { items: [{ href: "/quote/upload-boundary" if formSubmitData.boundaryEntryType === 'upload' else "/quote/upload-preview-map", text: "Change", visuallyHiddenText: "red line boundary" }] }
} if formSubmitData.boundaryEntryType,
{
key: { text: "Development types" },
Expand Down
2 changes: 1 addition & 1 deletion src/server/quote/check-your-answers/page.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ describe('Check your answers page', () => {
getByRole(document, 'link', {
name: 'Changered line boundary'
})
).toHaveAttribute('href', '/quote/map')
).toHaveAttribute('href', '/quote/upload-preview-map')
})

it('should redirect to the confirmation page if Submit is clicked', async () => {
Expand Down
4 changes: 2 additions & 2 deletions src/server/quote/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import routesDevelopmentType from './development-types/routes.js'
import routesEmail from './email/routes.js'
import routesUploadBoundary from './upload-boundary/routes.js'
import routesUploadReceived from './upload-received/routes.js'
import routesMap from './map/routes.js'
import routesUploadPreviewMap from './upload-preview-map/routes.js'
import routesCheckYourAnswers from './check-your-answers/routes.js'
import routesConfirmation from './confirmation/routes.js'
import routesPeopleCount from './people-count/routes.js'
Expand Down Expand Up @@ -45,7 +45,7 @@ export const quote = {
...routesEmail,
...routesUploadBoundary,
...routesUploadReceived,
...routesMap,
...routesUploadPreviewMap,
...routesCheckYourAnswers,
...routesPeopleCount,
...routesConfirmation,
Expand Down
75 changes: 0 additions & 75 deletions src/server/quote/map/controller.js

This file was deleted.

11 changes: 0 additions & 11 deletions src/server/quote/map/form-validation.js

This file was deleted.

28 changes: 0 additions & 28 deletions src/server/quote/map/form-validation.test.js

This file was deleted.

9 changes: 0 additions & 9 deletions src/server/quote/map/get-next-page.js

This file was deleted.

19 changes: 0 additions & 19 deletions src/server/quote/map/get-next-page.test.js

This file was deleted.

37 changes: 0 additions & 37 deletions src/server/quote/map/routes.js

This file was deleted.

3 changes: 2 additions & 1 deletion src/server/quote/no-edp/get-view-model.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
import { getPageTitle } from '../../common/helpers/page-title.js'
import { routePath as mapPath } from '../upload-preview-map/routes.js'

const title = 'Nature Restoration Fund levy is not available in this area'

export default function getViewModel() {
return {
pageTitle: getPageTitle(title),
pageHeading: title,
backLinkPath: '#'
backLinkPath: mapPath
}
}
2 changes: 1 addition & 1 deletion src/server/quote/no-edp/page.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ describe('No EDP page', () => {
)
expect(getByRole(document, 'link', { name: 'Back' })).toHaveAttribute(
'href',
'#'
'/quote/upload-preview-map'
)
})
})
44 changes: 44 additions & 0 deletions src/server/quote/upload-preview-map/controller.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
import { createLogger } from '../../common/helpers/logging/logger.js'
import { saveQuoteDataToCache } from '../helpers/get-quote-session/index.js'
import { routePath as uploadBoundaryPath } from '../upload-boundary/routes.js'
import { routePath as noEdpPath } from '../no-edp/routes.js'
import getViewModel from './get-view-model.js'

const logger = createLogger()

export function handler(request, h) {
const boundaryGeojson = request.yar.get('boundaryGeojson')

// Session may be missing if it expired or the user navigated here directly
if (!boundaryGeojson) {
logger.info('map - no boundary data in session')
return h.redirect(uploadBoundaryPath)
}

const viewModel = getViewModel(boundaryGeojson)

return h.view('quote/upload-preview-map/index', {
...viewModel
})
}

export function postHandler(request, h) {
const boundaryGeojson = request.yar.get('boundaryGeojson')

// Session may be missing if it expired or the user navigated here directly
if (!boundaryGeojson) {
return h.redirect(uploadBoundaryPath)
}

const intersectsEdp = boundaryGeojson?.intersects_edp ?? false

saveQuoteDataToCache(request, { boundaryGeojson })
request.yar.clear('boundaryGeojson')

if (intersectsEdp) {
return h.redirect('/quote/development-types')
}

logger.info('map - boundary does not intersect EDP, saved to quote data')
return h.redirect(noEdpPath)
}
Loading
Loading