Skip to content

Commit

Permalink
Release2 (#799)
Browse files Browse the repository at this point in the history
* task/JM-8185 (#789)

* Add business rule error if trying to defer into the existing pool

* Add error when adding to pool from deferral maintenance

* Update yarn-audit-known-issues

* feature/JM-8203: Confirm attendance for jurors that have dropped off the record attendance list (#797)

* Unconfirmed jurors screen and confirming attendance

* Update yarn-audit-known-issues

* Update yarn-audit-known-issues

* Update court create juror success banner (#800)

* Add BVR for deferral with no DOB and general refactoring (#801)

* JM-8054 -Bureau third party reason descriptions (#802)

* Add defer DOB bvr to digital summons (#804)

* JM-8216 - Node vulnerability updates (#805)

---------

Co-authored-by: Christopher Powell (CGI) <[email protected]>
  • Loading branch information
callum-r-young and ChrisPowellcgi authored Oct 10, 2024
1 parent 23a029b commit f6b6d88
Show file tree
Hide file tree
Showing 20 changed files with 871 additions and 966 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,14 @@

{% set thirdPartyReason = "-" %}

{% if juror.thirdParty.thirdPartyReason and juror.thirdParty.thirdPartyOtherReason %}
{% set thirdPartyReason = juror.thirdParty.thirdPartyReason + " - " + juror.thirdParty.thirdPartyOtherReason %}
{% elif juror.thirdParty.thirdPartyReason %}
{% set thirdPartyReason = juror.thirdParty.thirdPartyReason %}
{% if juror.thirdParty.thirdPartyReason === "other" and juror.thirdParty.thirdPartyOtherReason %}
{% set thirdPartyReason = "Other - " + juror.thirdParty.thirdPartyOtherReason %}
{% elif juror.thirdParty.thirdPartyReason === "nothere"%}
{% set thirdPartyReason = "Juror is not here" %}
{% elif juror.thirdParty.thirdPartyReason === "assistance"%}
{% set thirdPartyReason = "Assistance" %}
{% elif juror.thirdParty.thirdPartyReason === "deceased"%}
{% set thirdPartyReason = "Deceased" %}
{% elif juror.thirdParty.thirdPartyOtherReason %}
{% set thirdPartyReason = juror.thirdParty.thirdPartyOtherReason %}
{% endif %}
Expand Down
4 changes: 2 additions & 2 deletions client/templates/juror-management/attendance/change-times.njk
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@

{% include "includes/errors.njk" %}

<span class="govuk-caption-l">Attendance</span>
<span class="govuk-caption-l">{{ caption }}</span>
<h1 class="govuk-heading-l">{{juror.firstName}} {{juror.lastName}}</h1>

<p class="govuk-body-l ">{{attendanceDate | dateFilter(null, "dddd D MMMM YYYY")}}</p>
Expand Down Expand Up @@ -91,7 +91,7 @@

<div class="govuk-button-group">
{{ govukButton({
text: "Save changes",
text: submitButtonText,
type: "submit"
}) }}
<a class="govuk-link" href="{{ _cancelUrl }}">Cancel</a>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,14 @@

{% set currentTab = confirmedTab %}

{% if unconfirmedAttendancesUrl %}
<div class="govuk-grid-row">
<div class="govuk-grid-column-full govuk-body govuk-!-margin-top-3 govuk-!-margin-bottom-2">
<a href="{{ unconfirmedAttendancesUrl }}" class="govuk-link">Jurors with a check in/check out time that have not had attendance confirmed</a>
</div>
</div>
{% endif %}

{{ mojSubNavigation({
label: "Sub navigation",
items: [{
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,127 @@
{% extends "layouts/default.njk" %}

{% from "govuk/components/table/macro.njk" import govukTable %}
{% from "../_partials/attendance-sub-nav.njk" import attendanceSubNav %}

{% block page_title %}{{ serviceName }} - Juror management - Attendance - Unconfirmed attendances{% endblock %}
{% block page_identifier %}Juror management - Attendance - Unconfirmed attendances{% endblock %}

{% set currentApp = "Jurors" %}

{% block beforeContent %}
{% include "includes/back-link.njk" %}
{% endblock %}

{% block content %}

{% if bannerMessage %}
{{ mojBanner({
type: "success",
html: bannerMessage,
iconFallbackText: "Success"
}) }}
{% endif %}

{% set unconfirmedRows = [] %}
{% for juror in unconfirmedJurors %}
{% set row = [
{
html: "<a href='" + url('juror-record.overview.get', { jurorNumber: juror.jurorNumber }) + "' class='govuk-link'>" + juror.jurorNumber + "</a>",
attributes: {
"data-sort-value": juror.jurorNumber
}
},
{
text: juror.firstName,
attributes: {
"data-sort-value": juror.firstName
}
},
{
text: juror.lastName,
attributes: {
"data-sort-value": juror.lastName }
},
{
text: juror.status | toSentenceCase,
attributes: {
"data-sort-value": juror.status | toSentenceCase
}
},
{
text: (juror.checkInTime | timeArrayToString | convert24to12) if juror.checkInTime else "-",
attributes: {
"data-sort-value": (juror.checkInTime | timeArrayToString | convertAmPmToLong) if juror.checkInTime else 0
}
},
{
text: (juror.checkOutTime | timeArrayToString | convert24to12) if juror.checkOutTime else "-",
attributes: {
"data-sort-value": (juror.checkOutTime | timeArrayToString | convertAmPmToLong) if juror.checkOutTime else 0
}
},
{
html: "<a href='" + url('juror-management.attendance.unconfirmed-attendances.update.get', { jurorNumber: juror.jurorNumber }) + "?date=" + date + "' class='govuk-link'>Change</a>"
}
] %}
{% set unconfirmedRows = (unconfirmedRows.push(row), unconfirmedRows) %}
{% endfor %}

<div class="govuk-grid-row">
<div class="govuk-grid-column-one-half">
<span class="govuk-caption-l">Unconfirmed attendances</span>
<h1 class="govuk-heading-l" id="attendanceDate">{{ selectedDate }}</h1>
</div>
</div>

{% if unconfirmedRows | length %}
{{ govukTable({
attributes: {
'data-module': 'moj-sortable-table'
},
head: [
{
text: "Juror number",
attributes: {
"aria-sort": "none"
}
},
{
text: "First name",
attributes: {
"aria-sort": "none"
}
},
{
text: "Last name",
attributes: {
"aria-sort": "ascending"
}
},
{
text: "Status",
attributes: {
"aria-sort": "none"
}
},
{
text: "Checked in",
attributes: {
"aria-sort": "none"
}
},
{
text: "Checked out",
attributes: {
"aria-sort": "none"
}
},
{}
],
rows: unconfirmedRows
}) }}
{% else %}
<p class="govuk-body govuk-!-font-weight-bold">No unconfirmed attendances for this date</p>
{% endif %}

{% endblock %}
7 changes: 3 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
"build": "NODE_ENV=development webpack --config webpack.config.js",
"build:prod": "NODE_ENV=production webpack --config webpack.config.js",
"dev": "yarn build && NODE_ENV=development node ./dev/server/index.js",
"dev:debug": "yarn build && NODE_ENV=development node --inspect ./dev/server/index.js",
"dev:watch": "yarn build && NODE_ENV=development nodemon",
"serve": "yarn build:prod && NODE_ENV=production node ./dist/server/index.js",
"debug": "yarn build:prod && NODE_ENV=production node --inspect-brk ./dist/server/index.js",
Expand All @@ -19,8 +20,7 @@
"test:a11y": "echo TODO: a11y",
"test:smoke": "echo TODO: smoke",
"test:functional": "echo TODO: functional",
"cichecks": "echo TODO: cichecks",
"nsp": "nsp check"
"cichecks": "echo TODO: cichecks"
},
"dependencies": {
"@azure/identity": "^4.2.1",
Expand All @@ -38,7 +38,7 @@
"connect-redis": "^7.1.0",
"csurf": "^1.9.0",
"errorhandler": "^1.4.3",
"express": "^4.19.2",
"express": "^4.21.0",
"express-nunjucks": "^3.1.1",
"express-rate-limit": "^7.3.1",
"express-session": "^1.14.0",
Expand Down Expand Up @@ -76,7 +76,6 @@
"mocha": "^10.0.0",
"mochawesome": "^3.0.0",
"nodemon": "^3.1.1",
"nsp": "^3.1.0",
"postcss": "^8.4.38",
"sass": "^1.77.5",
"sass-loader": "^14.2.1",
Expand Down
10 changes: 10 additions & 0 deletions server/objects/juror-attendance.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
transform: utils.basicDataTransform,
};
const rp = require('request-promise');
const { replaceAllObjKeys } = require('../lib/mod-utils');

module.exports.jurorsAttending = {
resource: 'moj/juror-management/appearance',
Expand Down Expand Up @@ -164,5 +165,14 @@
};
},
});
module.exports.unconfirmedJurorAttendancesDAO = new DAO('moj/juror-management/unconfirmed-jurors/{locCode}', {
get: function(locCode, date) {
return {
uri: this.resource.replace('{locCode}', locCode) + `?attendanceDate=${date}`,
transform: (data) => { delete data['_headers']; return replaceAllObjKeys(data.jurors, _.camelCase); },
};
},
});
module.exports.confirmJurorAttendanceDAO = new DAO('moj/juror-management/confirm-attendance');

})();
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@
module.exports.getChangeTimes = function(app) {
return async function(req, res) {
const { jurorNumber } = req.params;
let processUrl
, cancelUrl
, deleteUrl
, attendanceDate
, tmpErrors = _.clone(req.session.errors)
, tmpBody = _.clone(req.session.formFields);
let processUrl;
let cancelUrl;
let deleteUrl;
let attendanceDate;
let tmpErrors = _.clone(req.session.errors);
let tmpBody = _.clone(req.session.formFields);

delete req.session.errors;
delete req.session.formFields;
Expand Down Expand Up @@ -56,6 +56,11 @@
jurorNumber: juror.jurorNumber,
});
req.session.jurorNameChangeAttendance = juror.firstName + ' ' + juror.lastName;
} else if (req.url.includes('attendance/unconfirmed-attendances')) {
processUrl = app.namedRoutes.build('juror-management.attendance.unconfirmed-attendances.update.post', {
jurorNumber: juror.jurorNumber,
}) + '?date=' + attendanceDate;
cancelUrl = app.namedRoutes.build('juror-management.attendance.unconfirmed-attendances.get') + '?date=' + attendanceDate;
} else {
processUrl = app.namedRoutes.build('juror-management.attendance.change-times.post', {
jurorNumber: juror.jurorNumber,
Expand Down Expand Up @@ -102,6 +107,8 @@
},
checkInTime,
checkOutTime,
caption: req.url.includes('attendance/unconfirmed-attendances') ? 'Unconfirmed Attendance' : 'Attendance',
submitButtonText: req.url.includes('attendance/unconfirmed-attendances') ? 'Confirm attendance' : 'Save changes'
});
} catch (err) {
app.logger.crit('Failed to fetch attendance records for given day and juror number', {
Expand Down
1 change: 1 addition & 0 deletions server/routes/juror-management/attendance/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

module.exports = function(app) {
require('./confirm-attendance')(app);
require('./unconfirmed-attendances')(app);

app.post('/juror-management/attendance/check-in',
'juror-management.check-in.post',
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
(function() {
'use strict';

const controller = require('./unconfirmed-attendances.controller');
const changeTimesController = require('../change-times/change-times.controller');
const auth = require('../../../../components/auth');

module.exports = function(app) {
app.get('/juror-management/attendance/unconfirmed-attendances',
'juror-management.attendance.unconfirmed-attendances.get',
auth.verify,
controller.getUnconfirmedAttendances(app)
);

app.get('/juror-management/attendance/unconfirmed-attendances/:jurorNumber/update',
'juror-management.attendance.unconfirmed-attendances.update.get',
auth.verify,
changeTimesController.getChangeTimes(app),
);

app.post('/juror-management/attendance/unconfirmed-attendances/:jurorNumber/update',
'juror-management.attendance.unconfirmed-attendances.update.post',
auth.verify,
controller.postUpdateAttendance(app),
);
};

})();

Loading

0 comments on commit f6b6d88

Please sign in to comment.