@ministryofjustice/hmpps-digital-prison-reporting-frontend 4.0.0 → 4.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -327,8 +327,8 @@ class DprQueryParamClass extends DprClientClass {
327
327
  if (type === 'radio' || type === 'checkbox') {
328
328
  this.setMultiSelectValue(inputs, value);
329
329
  } else if (input.classList.contains('moj-js-datepicker-input')) {
330
- const formatted = dayjs(value, 'YYYY-MM-DD');
331
- input.value = formatted.format('DD/MM/YYYY');
330
+ const formatted = dayjs(value, 'YYYY-MM-DD').format('DD/MM/YYYY');
331
+ input.value = formatted !== 'Invalid Date' ? formatted : '';
332
332
  } else {
333
333
  input.value = value;
334
334
  }
@@ -376,13 +376,13 @@ class DprQueryParamClass extends DprClientClass {
376
376
  } else {
377
377
  const { name } = input;
378
378
  let { value } = input;
379
- let { staticOptionNameValue } = input;
380
- let isDateInput = input.classList.contains('moj-js-datepicker-input');
379
+ const { staticOptionNameValue } = input;
380
+ const isDateInput = input.classList.contains('moj-js-datepicker-input');
381
381
  if (isDateInput) {
382
382
  const formatted = dayjs(value, 'D/M/YYYY').format('YYYY-MM-DD');
383
383
  value = formatted !== 'Invalid Date' ? formatted : '';
384
384
  }
385
- let valueToUpdate = !isDateInput && staticOptionNameValue ? staticOptionNameValue : value;
385
+ const valueToUpdate = !isDateInput && staticOptionNameValue ? staticOptionNameValue : value;
386
386
  if (name) this.updateQueryParam(name, valueToUpdate);
387
387
  }
388
388
  }
@@ -1021,7 +1021,7 @@ class Filters extends DprClientClass {
1021
1021
 
1022
1022
  if (v.match(dateRegEx)) {
1023
1023
  // eslint-disable-next-line no-param-reassign
1024
- v = dayjs(v, 'DD/MM/YYYY').format('YYYY-MM-DD');
1024
+ v = dayjs(v, 'D/M/YYYY').format('YYYY-MM-DD');
1025
1025
  }
1026
1026
 
1027
1027
  serializedFormData += `&${n}=${v}`;
@@ -1067,7 +1067,7 @@ class Filters extends DprClientClass {
1067
1067
 
1068
1068
  class DprPollingStatusClass extends DprClientClass {
1069
1069
  getPollingFrquency() {
1070
- return '20' // 2 seconds
1070
+ return '2000' // 2 seconds
1071
1071
  }
1072
1072
 
1073
1073
  getPollingStatuses() {
@@ -5,8 +5,11 @@
5
5
  {% for group in scorecardGroup %}
6
6
  {% set title = group.title %}
7
7
  {% set scorecards = group.scorecards %}
8
+
9
+ {% if scorecardGroup.length !== 1 %}
10
+ <p class="govuk-heading-s"><strong>{{ title }}</strong></p>
11
+ {% endif %}
8
12
 
9
- <p class="govuk-heading-s"><strong>{{ title }}</strong></p>
10
13
  <div class="dpr-scorecard-group">
11
14
  {% for scorecard in scorecards %}
12
15
  {{ dprScoreCard(scorecard) }}
@@ -35,7 +35,7 @@
35
35
  {% endif %}
36
36
 
37
37
  {% if value %}
38
- {% set value = value | date %}
38
+ {% set value = value | dprDate %}
39
39
  {% endif %}
40
40
 
41
41
  <div class="dpr-date"
@@ -58,8 +58,8 @@
58
58
  name: id,
59
59
  label: labelText,
60
60
  value: value,
61
- minDate: minDate | date,
62
- maxDate: maxDate | date,
61
+ minDate: minDate | dprDate,
62
+ maxDate: maxDate | dprDate,
63
63
  hint: {
64
64
  text: "For example 17/05/2024."
65
65
  },
@@ -71,22 +71,22 @@
71
71
  {% if toggleMin and minDate %}
72
72
  <a class="govuk-body-s daterange-set-to-minmax"
73
73
  data-set-to-input='{{ id }}'
74
- data-set-min-max-value={{ minDate | date }}
74
+ data-set-min-max-value={{ minDate | dprDate }}
75
75
  data-set-min-max-trigger='true'
76
76
  href="#"
77
77
  >
78
- set to min ({{ minDate | date }})
78
+ set to min ({{ minDate | dprDate }})
79
79
  </a>
80
80
  {% endif %}
81
81
 
82
82
  {% if toggleMax and maxDate %}
83
83
  <a class="govuk-body-s daterange-set-to-minmax"
84
84
  data-set-to-input='{{ id }}'
85
- data-set-min-max-value={{ maxDate | date }}
85
+ data-set-min-max-value={{ maxDate | dprDate }}
86
86
  data-set-min-max-trigger='true'
87
87
  href="#"
88
88
  >
89
- set to max ({{ maxDate | date }})
89
+ set to max ({{ maxDate | dprDate }})
90
90
  </a>
91
91
  {% endif %}
92
92
  </div>
@@ -6,12 +6,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
6
6
  const enum_1 = require("../_filters/filter-input/enum");
7
7
  const urlHelper_1 = require("../../utils/urlHelper");
8
8
  const utils_1 = __importDefault(require("../_inputs/start-end-date/utils"));
9
- const logger_1 = __importDefault(require("../../utils/logger"));
10
9
  const LOCALE = 'en-GB';
11
10
  const toLocaleDate = (isoDate) => {
12
11
  const date = new Date(isoDate);
13
- const dateString = isoDate ? date.toLocaleDateString(LOCALE) : null;
14
- logger_1.default.info('toLocaleDate:', isoDate, date, dateString);
15
12
  return isoDate ? date.toLocaleDateString(LOCALE) : null;
16
13
  };
17
14
  const filterHasValue = (value) => {
@@ -33,12 +30,6 @@ const getSelectedFilters = (format, reportQuery, createUrlForParameters) => form
33
30
  const { start, end } = utils_1.default.setDateRangeValuesWithinMinMax(f.filter, startValue, endValue);
34
31
  const localeStart = toLocaleDate(start);
35
32
  const localeEnd = toLocaleDate(end);
36
- logger_1.default.info('Selected daterange filters:', {
37
- start,
38
- end,
39
- localeStart,
40
- localeEnd,
41
- });
42
33
  if (localeStart && localeEnd) {
43
34
  filterValueText = `${localeStart} - ${localeEnd}`;
44
35
  }
@@ -12,8 +12,6 @@ const LOCALE = 'en-GB'
12
12
 
13
13
  const toLocaleDate = (isoDate?: string) => {
14
14
  const date = new Date(isoDate)
15
- const dateString = isoDate ? date.toLocaleDateString(LOCALE) : null
16
- logger.info('toLocaleDate:', isoDate, date, dateString)
17
15
  return isoDate ? date.toLocaleDateString(LOCALE) : null
18
16
  }
19
17
 
@@ -45,12 +43,6 @@ const getSelectedFilters = (
45
43
  const { start, end } = StartEndDateUtils.setDateRangeValuesWithinMinMax(f.filter, startValue, endValue)
46
44
  const localeStart = toLocaleDate(start)
47
45
  const localeEnd = toLocaleDate(end)
48
- logger.info('Selected daterange filters:', {
49
- start,
50
- end,
51
- localeStart,
52
- localeEnd,
53
- })
54
46
 
55
47
  if (localeStart && localeEnd) {
56
48
  filterValueText = `${localeStart} - ${localeEnd}`
@@ -36,7 +36,6 @@ const reportingClient_1 = __importDefault(require("../../data/reportingClient"))
36
36
  const utils_4 = __importDefault(require("../_reports/report-actions/utils"));
37
37
  const DataTableBuilder_1 = __importDefault(require("../../utils/DataTableBuilder/DataTableBuilder"));
38
38
  const utils_5 = __importDefault(require("../_reports/report-pagination/utils"));
39
- const logger_1 = __importDefault(require("../../utils/logger"));
40
39
  function isListWithWarnings(data) {
41
40
  return data.data !== undefined;
42
41
  }
@@ -100,7 +99,6 @@ function renderList(listData, variantDefinition, reportQuery, request, response,
100
99
  totals: utils_1.default.getTotals(pagination.pageSize, pagination.currentPage, pagination.totalRows, dataTable.rowCount),
101
100
  };
102
101
  const filterOptions = utils_2.default.getFilterOptions(variantDefinition, reportQuery, urlHelper_1.default, dynamicAutocompleteEndpoint);
103
- logger_1.default.info(JSON.stringify({ filterOptions }, null, 2));
104
102
  const reportUrl = `${request.protocol}://${request.get('host')}${request.originalUrl}`;
105
103
  const actions = utils_4.default.getActions({
106
104
  print: {
@@ -20,7 +20,6 @@ import { DataTable } from '../../utils/DataTableBuilder/types'
20
20
  import PaginationUtils from '../_reports/report-pagination/utils'
21
21
  import { FilterOptions } from '../_filters/types'
22
22
  import { Template } from '../../types/Templates'
23
- import logger from '../../utils/logger'
24
23
 
25
24
  function isListWithWarnings(data: Dict<string>[] | ListWithWarnings): data is ListWithWarnings {
26
25
  return (data as ListWithWarnings).data !== undefined
@@ -127,7 +126,6 @@ function renderList(
127
126
  createUrlForParameters,
128
127
  dynamicAutocompleteEndpoint,
129
128
  )
130
- logger.info(JSON.stringify({ filterOptions }, null, 2))
131
129
 
132
130
  const reportUrl = `${request.protocol}://${request.get('host')}${request.originalUrl}`
133
131
  const actions = ReportActionsUtils.getActions({
@@ -23,6 +23,7 @@
23
23
  {% set printable = dataTableOptions.printable %}
24
24
 
25
25
  {% set accordionItems = [] %}
26
+
26
27
  {# Filters #}
27
28
  {% set filters = filterOptions.filters %}
28
29
  {% if filters.length > 0 %}
@@ -9,7 +9,7 @@ const setUpNunjucksFilters = (env) => {
9
9
  env.addFilter('json', stringifyJson);
10
10
  env.addFilter('capitaliseSentence', capitaliseSentence);
11
11
  nunjucks_date_1.default.setDefaultFormat('DD/MM/YYYY');
12
- nunjucks_date_1.default.install(env, 'date');
12
+ nunjucks_date_1.default.install(env, 'dprDate');
13
13
  };
14
14
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
15
15
  const stringifyJson = (jsonObj) => {
@@ -7,7 +7,7 @@ const setUpNunjucksFilters = (env: nunjucks.Environment) => {
7
7
  env.addFilter('json', stringifyJson)
8
8
  env.addFilter('capitaliseSentence', capitaliseSentence)
9
9
  nunjucksDate.setDefaultFormat('DD/MM/YYYY')
10
- nunjucksDate.install(env, 'date')
10
+ nunjucksDate.install(env, 'dprDate')
11
11
  }
12
12
 
13
13
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@ministryofjustice/hmpps-digital-prison-reporting-frontend",
3
3
  "description": "The Digital Prison Reporting Frontend contains templates and code to help display data effectively in UI applications.",
4
- "version": "4.0.0",
4
+ "version": "4.0.2",
5
5
  "main": "dpr/assets/js/all.mjs",
6
6
  "sass": "dpr/all.scss",
7
7
  "engines": {
package/package.zip CHANGED
Binary file