File tree Expand file tree Collapse file tree 6 files changed +83
-3
lines changed
Expand file tree Collapse file tree 6 files changed +83
-3
lines changed Original file line number Diff line number Diff line change @@ -17,6 +17,7 @@ require('./routes/lists')(router)
1717require ( './routes/support' ) ( router )
1818require ( './routes/auth' ) ( router )
1919require ( './routes/home' ) ( router )
20+ require ( './routes/helpers' ) ( router )
2021
2122
2223
Original file line number Diff line number Diff line change 1+ module . exports = router => {
2+
3+ router . get ( '/prototype-setup/setup-batches' , ( req , res ) => {
4+
5+ const data = req . session . data
6+ let vaccineStock = data . vaccineStock
7+
8+ const dateNow = new Date ( )
9+ const millisecondsPerDay = 86400000
10+
11+ const vaccines = data . vaccines
12+ const siteId = "RW3NM"
13+
14+ for ( vaccine of vaccines ) {
15+ for ( vaccineProduct of vaccine . products ) {
16+
17+ const numberOfBatchesToAdd = 1 + Math . floor ( Math . random ( ) * 10 )
18+
19+ let batches = [ ]
20+
21+ const generatedVaccineId = Math . floor ( Math . random ( ) * 10000000 ) . toString ( )
22+
23+ for ( let step = 0 ; step < numberOfBatchesToAdd ; step ++ ) {
24+
25+ const generatedBatchId = Math . floor ( Math . random ( ) * 10000000 ) . toString ( )
26+ const generatedBatchNumber = "AB" + Math . floor ( Math . random ( ) * 1000000 ) . toString ( )
27+
28+ const generatedExpiryDate = new Date ( dateNow . getTime ( ) + ( Math . random ( ) * 100 * millisecondsPerDay ) ) . toISOString ( )
29+
30+ batches . push ( {
31+ id : generatedBatchId ,
32+ batchNumber : generatedBatchNumber ,
33+ expiryDate : generatedExpiryDate
34+ } )
35+ }
36+
37+ vaccineStock . push ( {
38+ id : generatedVaccineId ,
39+ vaccine : vaccine . name ,
40+ vaccineProduct : vaccineProduct . name ,
41+ siteId : siteId ,
42+ batches : batches
43+ } )
44+ }
45+ }
46+
47+
48+ res . redirect ( '/vaccines' )
49+ } ) ;
50+
51+ }
Original file line number Diff line number Diff line change 5454 {
5555 URL: "/prototype-admin/reset-data",
5656 label: "Reset prototype test data"
57+ },
58+ {
59+ URL: "/prototype-setup",
60+ label: "Prototype data setup"
5761 }
5862 ]
5963 })}}
Original file line number Diff line number Diff line change 1+ {% extends 'layout.html' %}
2+
3+ {% set pageName = "" %}
4+
5+ {% block header %}
6+ {% include "includes/header-logged-out.html" %}
7+ {% endblock %}
8+
9+ {% block content %}
10+ < div class ="nhsuk-grid-row ">
11+ < div class ="nhsuk-grid-column-two-thirds ">
12+
13+ < h1 class ="nhsuk-heading-l "> Prototype data setup</ h1 >
14+
15+ < p > Use these links to change how the data in the prototype is set up.</ p >
16+
17+ < ul class ="nhsuk-list ">
18+ < li > < a href ="/prototype-setup/setup-batches "> Add batches for all vaccines</ a > </ li >
19+ </ ul >
20+
21+ </ div >
22+ </ div >
23+
24+ {% endblock %}
Original file line number Diff line number Diff line change 5757 {% for vaccineProduct in (vaccine.products) %}
5858 {% set productItems = (productItems.push({
5959 value: vaccineProduct.name,
60- text: vaccineProduct.name
60+ text: ( vaccineProduct.name | capitaliseFirstLetter )
6161 }), productItems) %}
6262 {% endfor %}
6363
7777
7878 {% set items = (items.push({
7979 value: vaccine.name,
80- text: vaccine.name,
80+ text: ( vaccine.name | capitaliseFirstLetter) ,
8181 conditional: {
8282 html: conditionalHtml
8383 } if vaccine.products
Original file line number Diff line number Diff line change @@ -102,7 +102,7 @@ <h1 class="nhsuk-heading-xl">Vaccines</h1>
102102 {% for vaccineProduct in vaccineProductsAtSite %}
103103 < tr class ="nhsuk-table__row ">
104104 < td class ="nhsuk-table__cell ">
105- {{ vaccineAtSite }}
105+ {{ vaccineAtSite | capitaliseFirstLetter }}
106106 </ td >
107107 < td class ="nhsuk-table__cell ">
108108 {{ vaccineProduct }}
You can’t perform that action at this time.
0 commit comments