aboutsummaryrefslogtreecommitdiffstats
path: root/app/javascript/routes/components/StopPointList.js
blob: 9bc5e02d1daa9337e464cc399503e216d3619b2f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
import React from 'react'
import PropTypes from 'prop-types'

import StopPoint from './StopPoint'

export default function StopPointList({ stopPoints, onDeleteClick, onMoveUpClick, onMoveDownClick, onChange, onSelectChange, onToggleMap, onToggleEdit, onSelectMarker, onUnselectMarker, onUpdateViaOlMap }) {
  return (
    <div className='subform'>
      <div className='nested-head'>
        <div className="wrapper">
          <div style={{width: 100}}>
            <div className="form-group">
              <label className="control-label">{I18n.t('simple_form.labels.stop_point.reflex_id')}</label>
            </div>
          </div>
          <div>
            <div className="form-group">
              <label className="control-label">{I18n.t('simple_form.labels.stop_point.name')}</label>
            </div>
          </div>
          <div>
            <div className="form-group">
              <label className="control-label">{I18n.t('simple_form.labels.stop_point.for_boarding')}</label>
            </div>
          </div>
          <div>
            <div className="form-group">
              <label className="control-label">{I18n.t('simple_form.labels.stop_point.for_alighting')}</label>
            </div>
          </div>
          <div className='actions-5'></div>
        </div>
      </div>
      {stopPoints.map((stopPoint, index) =>
        <StopPoint
          key={'item-' + index}
          onDeleteClick={() => onDeleteClick(index)}
          onMoveUpClick={() => {
            onMoveUpClick(index)
          }}
          onMoveDownClick={() => onMoveDownClick(index)}
          onChange={ onChange }
          onSelectChange={ (e) => onSelectChange(e, index) }
          onToggleMap={() => onToggleMap(index)}
          onToggleEdit={() => onToggleEdit(index)}
          onSelectMarker={onSelectMarker}
          onUnselectMarker={onUnselectMarker}
          onUpdateViaOlMap={onUpdateViaOlMap}
          first={ index === 0 }
          last={ index === (stopPoints.length - 1) }
          index={ index }
          value={ stopPoint }
        />
      )}
    </div>
  )
}

StopPointList.propTypes = {
  stopPoints: PropTypes.array.isRequired,
  onDeleteClick: PropTypes.func.isRequired,
  onMoveUpClick: PropTypes.func.isRequired,
  onMoveDownClick: PropTypes.func.isRequired,
  onSelectChange: PropTypes.func.isRequired,
  onSelectMarker: PropTypes.func.isRequired,
  onUnselectMarker : PropTypes.func.isRequired
}

StopPointList.contextTypes = {
  I18n: PropTypes.object
}