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
|
const actions = {
addStop : () => {
return {
type: 'ADD_STOP'
}
},
moveStopUp : (index) => {
return {
type: 'MOVE_STOP_UP',
index
}
},
moveStopDown : (index) => {
return {
type: 'MOVE_STOP_DOWN',
index
}
},
deleteStop : (index) => {
return {
type: 'DELETE_STOP',
index
}
},
updateInputValue : (index, text) => {
return {
type : 'UPDATE_INPUT_VALUE',
index,
text
}
},
updateSelectValue: (e, index) => {
return {
type :'UPDATE_SELECT_VALUE',
select_id: e.currentTarget.id,
select_value: e.currentTarget.value,
index
}
},
toggleMap: (index) =>({
type: 'TOGGLE_MAP',
index
}),
toggleEdit: (index) =>({
type: 'TOGGLE_EDIT',
index
}),
closeMaps: () => ({
type : 'CLOSE_MAP'
}),
selectMarker: (index, data) =>({
type: 'SELECT_MARKER',
index,
data
}),
unselectMarker: (index) => ({
type: 'UNSELECT_MARKER',
index
}),
defaultAttribute: (attribute, stopAreaKind) => {
if (attribute !== '') return attribute
if (stopAreaKind === undefined) return ''
return stopAreaKind === "commercial" ? "normal" : "forbidden"
}
}
module.exports = actions
|