diff options
Diffstat (limited to 'templates')
-rw-r--r-- | templates/web/base/report/_inspect.html | 1 | ||||
-rw-r--r-- | templates/web/base/report/_item.html | 4 | ||||
-rw-r--r-- | templates/web/base/report/inspect/extra_details.html | 10 | ||||
-rw-r--r-- | templates/web/oxfordshire/report/inspect/_extra_details_field.html | 35 | ||||
-rw-r--r-- | templates/web/oxfordshire/report/inspect/_raise_defect.html | 107 |
5 files changed, 143 insertions, 14 deletions
diff --git a/templates/web/base/report/_inspect.html b/templates/web/base/report/_inspect.html index 30848b5d4..1877640b4 100644 --- a/templates/web/base/report/_inspect.html +++ b/templates/web/base/report/_inspect.html @@ -34,6 +34,7 @@ <label for="state">[% loc('State') %]</label> [% INCLUDE 'report/inspect/state_groups_select.html' %] </p> + [% TRY %][% INCLUDE 'report/inspect/_raise_defect.html' %][% CATCH file %][% END %] <div id="js-duplicate-reports" class="[% "hidden" UNLESS problem.duplicate_of %]"> <input type="hidden" name="duplicate_of" value="[% problem.duplicate_of.id %]"> <p class="[% "hidden" UNLESS problem.duplicate_of %]"><strong>[% loc('Duplicate of') %]</strong></p> diff --git a/templates/web/base/report/_item.html b/templates/web/base/report/_item.html index 9a5168986..f25d5d2a1 100644 --- a/templates/web/base/report/_item.html +++ b/templates/web/base/report/_item.html @@ -96,10 +96,6 @@ END; <p>[% problem.response_priority.name OR '-' %]</p> </div> <div> - <h4>[% loc('Traffic management required?') %]</h4> - <p>[% problem.get_extra_metadata('traffic_information') %]</p> - </div> - <div> <h4>[% loc('Extra details') %]</h4> <p>[% problem.get_extra_metadata('detailed_information') | html %]</p> </div> diff --git a/templates/web/base/report/inspect/extra_details.html b/templates/web/base/report/inspect/extra_details.html index 66e464cef..621ae3688 100644 --- a/templates/web/base/report/inspect/extra_details.html +++ b/templates/web/base/report/inspect/extra_details.html @@ -9,15 +9,5 @@ </p> [% IF permissions.report_inspect %] - <p> - <label for="traffic_information">[% loc('Traffic management required?') %]</label> - [% traffic_info = problem.get_extra_metadata('traffic_information') %] - <select id="traffic_information" name="traffic_information" class="form-control"> - <option value=""[% ' selected' IF NOT traffic_info %]>-</option> - [% FOREACH option IN problem.traffic_management_options %] - <option value='[% option %]'[% ' selected' IF traffic_info == option %]>[% option %]</option> - [% END %] - </select> - </p> [% INCLUDE 'report/inspect/_extra_details_field.html' %] [% END %] diff --git a/templates/web/oxfordshire/report/inspect/_extra_details_field.html b/templates/web/oxfordshire/report/inspect/_extra_details_field.html new file mode 100644 index 000000000..5fc7b0086 --- /dev/null +++ b/templates/web/oxfordshire/report/inspect/_extra_details_field.html @@ -0,0 +1,35 @@ +<p> + <label for="detailed_information">[% loc('Extra details') %]</label> + [% IF max_detailed_info_length %] + <span id="detailed_information_length"> + [% tprintf(loc('%d characters maximum'), max_detailed_info_length) %] + </span> + [% END %] + <span class="js-inspect-defect-yes hidden-js"> + <br>[% c.user.email %] <span id="js-defect-prefix"></span> … + </span> + <textarea rows="2" name="detailed_information" id="detailed_information" class="form-control" + [% IF max_detailed_info_length %]data-max-length="[% max_detailed_info_length %]"[% END %]>[% problem.get_extra_metadata('detailed_information') | html %]</textarea> +</p> + +<script nonce="[% csp_nonce %]"> +(function(){ + function update_prefix() { + var prefix = document.getElementById('js-defect-prefix'); + var text = ''; + var traffic = document.getElementById('traffic_information'); + if (traffic.selectedIndex) { + text += 'TM' + traffic.selectedIndex + ' '; + } + var type = document.getElementById('defect_item_type'); + type = type.options[type.selectedIndex].value; + type = type.split(' ')[0]; + text += (type == 'Sweep') ? 'S&F' : type; + text += ' '; + prefix.textContent = text; + } + + document.getElementById('traffic_information').addEventListener('change', update_prefix); + document.getElementById('defect_item_type').addEventListener('change', update_prefix); +})(); +</script> diff --git a/templates/web/oxfordshire/report/inspect/_raise_defect.html b/templates/web/oxfordshire/report/inspect/_raise_defect.html new file mode 100644 index 000000000..d6e05d3b5 --- /dev/null +++ b/templates/web/oxfordshire/report/inspect/_raise_defect.html @@ -0,0 +1,107 @@ +[% IF permissions.report_instruct %] + +[% IF problem.get_extra_metadata('inspected') AND NOT errors %] + +<dl> + <dt>Defect category</dt> + <dd>[% problem.get_extra_metadata('defect_item_category') %]</dd> + + <dt>Defect type</dt> + <dd>[% problem.get_extra_metadata('defect_item_type') %]</dd> + + <dt>Defect detail</dt> + <dd>[% problem.get_extra_metadata('defect_item_detail') %]</dd> + + <dt>Location description</dt> + <dd>[% problem.get_extra_metadata('defect_location_description') %]</dd> + + <dt>Traffic management required?</dt> + <dd>[% problem.get_extra_metadata('traffic_information') %]</dd> +</dl> + +[% ELSE %] + +<div id="js-inspect-action-scheduled" class="[% "hidden" UNLESS problem.state == 'action scheduled' %]"> + + <p>[% loc('Do you want to automatically raise a defect?') %]</p> + <p class="segmented-control segmented-control--radio"> + <input type="radio" name="raise_defect" id="raise_defect_yes" value="1" data-show=".js-inspect-defect-yes"> + <label class="btn" for="raise_defect_yes">[% loc('Yes') %]</label> + <input type="radio" name="raise_defect" id="raise_defect_no" value="0" data-hide=".js-inspect-defect-yes"> + <label class="btn" for="raise_defect_no">[% loc('No') %]</label> + </p> + + <div class="js-inspect-defect-yes hidden-js"> + + <p>Please fill in the below:</p> + + <label for="defect_item_category">Defect category</label> + <select id="defect_item_category" name="defect_item_category" class="form-control" required> + <option value="">-- Pick a category --</option> + <option data-show=".defect-non-kerb-options" data-hide=".defect-kerb-options">Minor Carriageway</option> + <option data-show=".defect-non-kerb-options" data-hide=".defect-kerb-options">Footway/ Cycleway</option> + <option data-show=".defect-kerb-options" data-hide=".defect-non-kerb-options">Kerbing</option> + </select> + + <label for="defect_item_type">Defect type</label> + <select id="defect_item_type" name="defect_item_type" class="form-control" required> + <option value="">-- Pick a type --</option> + <optgroup class="defect-non-kerb-options" label="Minor Carriageway/ Footway/ Cycleway"> + <option>Sweep & Fill</option> + </optgroup> + <optgroup class="defect-kerb-options" label="Kerbing"> + <option>Damaged</option> + <option>Loose</option> + <option>Misaligned Single Units or Uneven Run of Units</option> + <option>Missing</option> + </optgroup> + </select> + + <label for="defect_item_detail">Defect detail</label> + <select id="defect_item_detail" name="defect_item_detail" class="form-control" required> + <option value="">-- Pick a detail --</option> + <optgroup class="defect-non-kerb-options" label="Minor Carriageway/ Footway/ Cycleway"> + <option>Pothole Sweep & Fill 0-1m²</option> + <option>Pothole Cluster Sweep & Fill 1-2m²</option> + </optgroup> + <optgroup class="defect-kerb-options" label="Kerbing"> + <option>1 kerb unit or 1 linear m</option> + <option>Greater than 1 kerb unit or 1 linear m</option> + </optgroup> + </select> + + <label for="traffic_information">[% loc('Traffic management required?') %]</label> + [% traffic_info = problem.get_extra_metadata('traffic_information') %] + <select id="traffic_information" name="traffic_information" class="form-control"> + <option value=""[% ' selected' IF NOT traffic_info %]>-</option> + [% FOREACH option IN ['Signs and Cones', 'Stop and Go Boards'] %] + <option value='[% option %]'[% ' selected' IF traffic_info == option %]>[% option %]</option> + [% END %] + </select> + + <label for="defect_location_description">Location description</label> + <textarea rows="2" id="defect_location_description" name="defect_location_description" class="form-control"></textarea> + + </div> + +</div> + +<script nonce="[% csp_nonce %]"> +(function(){ + var item = document.getElementById('defect_item_category'); + item.addEventListener('change', function(){ + var opt = item.options[item.selectedIndex].value; + if (opt !== 'Kerbing') { + var type = document.getElementById('defect_item_type'); + type.selectedIndex = 1; + var event = document.createEvent("Event"); + event.initEvent("change", true, false); + type.dispatchEvent(event); + } + }); +})(); +</script> + +[% END %] + +[% END %] |