\n
\n
\n {I18n.t('will_paginate.page_entries_info.multi_page', { model: capitalize(I18n.model_name('journey_pattern', { plural: true })), from: firstItemOnPage, to: lastItemOnPage, count: pagination.totalCount})}\n \n
\n
\n
\n )\n } else {\n return false\n }\n}\n\nNavigate.propTypes = {\n journeyPatterns: PropTypes.array.isRequired,\n status: PropTypes.object.isRequired,\n pagination: PropTypes.object.isRequired,\n dispatch: PropTypes.func.isRequired\n}","import { connect } from 'react-redux'\nimport actions from '../actions'\nimport NavigateComponent from '../components/Navigate'\n\nconst mapStateToProps = (state) => {\n return {\n journeyPatterns: state.journeyPatterns,\n status: state.status,\n pagination: state.pagination\n }\n}\n\nconst Navigate = connect(mapStateToProps)(NavigateComponent)\n\nexport default Navigate","import _ from 'lodash'\nimport React, { Component } from 'react'\nimport PropTypes from 'prop-types'\nimport actions from '../actions'\nimport CustomFieldsInputs from '../../helpers/CustomFieldsInputs'\nimport ShapeSelector from './ShapeSelector'\nimport ShapeMap from './ShapeMap'\n\nexport default class EditModal extends Component {\n constructor(props) {\n super(props)\n this.updateValue = this.updateValue.bind(this)\n }\n\n handleSubmit() {\n if(actions.validateFields(this.refs) == true) {\n this.props.saveModal(this.props.index,\n _.assign({}, this.refs, {\n custom_fields: this.custom_fields,\n shape: this.props.journeyPattern.shape ? {id: this.props.journeyPattern.shape.id, name: this.props.journeyPattern.shape.name, uuid: this.props.journeyPattern.shape.uuid } : undefined\n })\n )\n $('#JourneyPatternModal').modal('hide')\n }\n }\n\n updateValue(attribute, e) {\n actions.resetValidation(e.currentTarget)\n this.props.journeyPattern[attribute] = e.target.value\n this.forceUpdate()\n }\n\n renderModalTitle() {\n if (this.props.editMode) {\n return (\n \n
\n
{object_id ? short_id : '-'}
\n
{journeyPattern.registration_number}
\n
{I18n.t('journey_patterns.show.stop_points_count', { count: actions.getChecked(stop_points).length })}
\n {journeyPattern.costs &&\n
\n {totalDistance}\n {totalTime}\n
\n }\n {journeyPattern.costs &&\n
\n {commercialTotalDistance}\n {commercialTotalTime}\n
\n }\n
\n
\n \n
\n
\n - \n \n
\n {editMode && !!id && (\n - \n \n
\n )}\n {renderShapeEditorButtons()}\n - \n {object_id ? vehicleJourneyURL(object_id) : {I18n.t('journey_patterns.journey_pattern.vehicle_journey_at_stops')}}\n
\n - \n \n
\n
\n
\n
\n\n {stop_points.map((stopPoint, i) => {\n let costs = null\n let costsKey = null\n let time = null\n let distance = null\n let time_in_words = null\n if (previousSpId && stopPoint.checked) {\n [costsKey, costs, time, distance] = getTimeAndDistanceBetweenStops(previousSpId, stopPoint.id)\n time_in_words = formatTime(time)\n }\n if (stopPoint.checked) {\n previousSpId = stopPoint.id\n }\n let headlined = cityNameChecker(stopPoint, i)\n return (\n
\n
\n {spNode(stopPoint, headlined)}\n
\n { costs &&
\n {editMode &&
}\n {!editMode &&
\n
{formatDistance(costs['distance'] || 0)}
\n
{time_in_words}
\n
}\n
}\n
\n )\n })}\n
\n )\n}\n\nJourneyPattern.propTypes = {\n value: PropTypes.object,\n index: PropTypes.number,\n onCheckboxChange: PropTypes.func.isRequired,\n onOpenEditModal: PropTypes.func.isRequired,\n onDeleteJourneyPattern: PropTypes.func.isRequired,\n showHeader: PropTypes.func.isRequired,\n onDuplicateJourneyPattern: PropTypes.func.isRequired,\n fetchJourneyPatterns: PropTypes.func.isRequired\n}\n","import React, { Component } from 'react'\nimport PropTypes from 'prop-types'\nimport _ from 'lodash'\nimport JourneyPattern from './JourneyPattern'\nimport StopAreaHeaderManager from '../../helpers/stop_area_header_manager'\n\nexport default class JourneyPatterns extends Component {\n constructor(props){\n super(props)\n this.headerManager = new StopAreaHeaderManager(\n _.map(this.props.stopPointsList, (sp, i)=>{return sp.stop_area_object_id + \"-\" + i}),\n this.props.stopPointsList,\n this.props.status.features\n )\n }\n\n componentDidMount() {\n this.props.onLoadFirstPage()\n }\n\n componentDidUpdate(prevProps, prevState) {\n if(this.props.status.isFetching == false){\n $('.table-2entries').each(function() {\n var refH = []\n var refCol = []\n\n $(this).find('.t2e-head').children('div').each(function() {\n var h = this.getBoundingClientRect().height;\n refH.push(h)\n });\n\n var i = 0\n $(this).find('.t2e-item').children('div').each(function() {\n var h = this.getBoundingClientRect().height;\n if(refCol.length < refH.length){\n refCol.push(h)\n } else {\n if(h > refCol[i]) {\n refCol[i] = h\n }\n }\n if(i == (refH.length - 1)){\n i = 0\n } else {\n i++\n }\n });\n\n for(var n = 0; n < refH.length; n++) {\n if(refCol[n] < refH[n]) {\n refCol[n] = refH[n]\n }\n }\n\n $(this).find('.th').css('height', refCol[0]);\n\n for(var nth = 1; nth < refH.length; nth++) {\n $(this).find('.td:nth-child('+ (nth + 1) +')').css('height', refCol[nth]);\n }\n });\n }\n }\n\n showHeader(object_id) {\n return this.headerManager.showHeader(object_id)\n }\n\n hasFeature(key) {\n return this.props.status.features[key]\n }\n\n render() {\n this.previousCity = undefined\n requestAnimationFrame(function(){\n $(document).trigger(\"table:updated\")\n })\n if(this.props.status.isFetching == true) {\n return (\n