From 913d6935727ace3ac94c08adb4e1ec378741fb19 Mon Sep 17 00:00:00 2001 From: Zog Date: Wed, 3 Jan 2018 16:31:33 +0100 Subject: Refs #5455 @6h; Add time and distance between stops in Journey Patterns - Adds a `JSON` attribute in the model - Adds the fields in the editor --- .../journey_patterns/components/JourneyPattern.js | 73 ++++++++++++++++++++-- .../journey_patterns/components/JourneyPatterns.js | 3 +- 2 files changed, 69 insertions(+), 7 deletions(-) (limited to 'app/javascript/journey_patterns/components') diff --git a/app/javascript/journey_patterns/components/JourneyPattern.js b/app/javascript/journey_patterns/components/JourneyPattern.js index d4c9816ec..40a6899e2 100644 --- a/app/javascript/journey_patterns/components/JourneyPattern.js +++ b/app/javascript/journey_patterns/components/JourneyPattern.js @@ -5,6 +5,17 @@ export default class JourneyPattern extends Component{ constructor(props){ super(props) this.previousCity = undefined + this.previousSpId = undefined + this.updateCosts = this.updateCosts.bind(this) + } + + updateCosts(e) { + let costs = { + [e.target.dataset.costsKey]: { + [e.target.name]: parseInt(e.target.value) + } + } + this.props.onUpdateJourneyPatternCosts(costs) } vehicleJourneyURL(jpOid) { @@ -16,16 +27,26 @@ export default class JourneyPattern extends Component{ ) } + hasFeature(key) { + return this.props.status.features[key] + } + cityNameChecker(sp) { let bool = false + if(sp.city_name != this.previousCity){ bool = true this.previousCity = sp.city_name } + return bool + } + + spNode(sp, headlined){ return (
+ + km +
++ + min +
+{(costs['distance'] || 0) + " km"}
+{time_in_words}
+