aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthew Somerville <matthew-github@dracos.co.uk>2018-09-11 13:33:08 +0100
committerMatthew Somerville <matthew-github@dracos.co.uk>2018-09-11 15:20:26 +0100
commitd68f968e0aec7651ec24ba795508a7b9162deee4 (patch)
treebeb9e689484dd059a8c0ab010daf1a599a43c941
parent61188780d1c79370bc584cbf0ed77298bbe66319 (diff)
[Bromley] Update asset for category changes.
-rw-r--r--web/cobrands/bromley/assets.js34
1 files changed, 29 insertions, 5 deletions
diff --git a/web/cobrands/bromley/assets.js b/web/cobrands/bromley/assets.js
index 32c00d32d..083d8210f 100644
--- a/web/cobrands/bromley/assets.js
+++ b/web/cobrands/bromley/assets.js
@@ -35,7 +35,7 @@ fixmystreet.assets.add($.extend(true, {}, defaults, {
attributes: {
feature_id: 'FEATURE_ID'
},
- asset_category: ["Faulty street light"],
+ asset_category: ["Street Lighting and Road Signs"],
asset_item: 'street light'
}));
@@ -45,7 +45,7 @@ fixmystreet.assets.add($.extend(true, {}, defaults, {
TYPENAME: "Bins"
}
},
- asset_category: ["Overflowing litter bin"],
+ asset_category: ["Parks and Greenspace", "Street Cleansing"],
asset_item: 'park bin',
asset_item_message: 'For our parks, pick a <b class="asset-spot">bin</b> from the map &raquo;'
}));
@@ -56,7 +56,7 @@ fixmystreet.assets.add($.extend(true, {}, defaults, {
TYPENAME: "Street_Trees"
}
},
- asset_category: ["Public Tree related issue"],
+ asset_category: ["Public Trees"],
asset_item: 'tree'
}));
@@ -67,6 +67,23 @@ var highways_stylemap = new OpenLayers.StyleMap({
})
});
+var bromley_to_tfl = {
+ 'Enforcement': ['Nuisance Signs', 'Obstruction to Highway', 'Overhanging Vegetation from private land', 'Unlicenced skip/materials on Highway'],
+ 'Graffiti and Flyposting': ['Nuisance Signs'],
+ 'Parks and Greenspace': ['Blocked Drain', 'Floral Display', 'Grass needs cutting'],
+ 'Street Cleansing': ['Blocked Drain'],
+ 'Road and Pavement Issues': true,
+ 'Street Lighting and Road Signs': true,
+ 'Public Trees': true
+};
+var tfl_asset_categories = Object.keys(bromley_to_tfl);
+
+$(function(){
+ $("#problem_form").on("change.category", "#form_service_sub_code", function() {
+ $(fixmystreet).trigger('report_new:category_change', [ $('#form_category') ]);
+ });
+});
+
fixmystreet.assets.add($.extend(true, {}, defaults, {
http_options: {
params: {
@@ -75,14 +92,21 @@ fixmystreet.assets.add($.extend(true, {}, defaults, {
},
stylemap: highways_stylemap,
always_visible: true,
- asset_category: ["Blocked drains", "Faulty street light", 'Faulty street sign', 'Floral displays', 'Grass needs cutting', 'Obstructions (skips, A boards)', 'Overhanging vegetation from private land', 'Pavement defect', 'Public Tree related issue', "Road defect"],
+
+ asset_category: tfl_asset_categories,
non_interactive: true,
road: true,
body: 'Bromley Council',
actions: {
found: function(layer, feature) {
- if (!fixmystreet.assets.selectedFeature()) {
+ var category = $('select#form_category').val(),
+ subcategory = $('#form_service_sub_code option:selected').text(),
+ subcategories = bromley_to_tfl[category],
+ relevant = (subcategories === true || (subcategory && OpenLayers.Util.indexOf(subcategories, subcategory) > -1));
+ if (!fixmystreet.assets.selectedFeature() && relevant) {
fixmystreet.body_overrides.only_send('TfL');
+ } else {
+ fixmystreet.body_overrides.remove_only_send();
}
},
not_found: function(layer) {