-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Create Completed Return Logs page (#1484)
https://eaflood.atlassian.net/browse/WATER-4745 This PR introduces the View Return Logs page. The following changes are made to accommodate this: - `unitNames` and `returnUnits` are added to `static-lookups.lib.js` for consistency; - `ReturnSubmissionModel` has methods added `$applyReadings()`, `$meter()`, `$method()` and `$units()`; - `BasePresenter` has `formatNumber()` which formats a number for display; - `BasePresenter.titleCase()` is amended to first convert the string to lower-case, which was necessary for us to correctly convert text from `ALL CAPS` to `All Caps`. Display of the page is gated behind the `enableSystemReturnsView` feature flag.
- Loading branch information
Showing
24 changed files
with
2,600 additions
and
92 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
'use strict' | ||
|
||
/** | ||
* Controller for /return-logs endpoints | ||
* @module ReturnLogsController | ||
*/ | ||
|
||
const Boom = require('@hapi/boom') | ||
|
||
const ViewReturnLogService = require('../services/return-logs/view-return-log.service.js') | ||
|
||
async function view(request, h) { | ||
const { auth, query } = request | ||
|
||
if (!query.id) { | ||
return Boom.badImplementation('Id is required') | ||
} | ||
|
||
const version = query.version ? Number(query.version) : 0 | ||
|
||
const pageData = await ViewReturnLogService.go(query.id, version, auth) | ||
|
||
return h.view('return-logs/view.njk', pageData) | ||
} | ||
|
||
module.exports = { | ||
view | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.