-
Notifications
You must be signed in to change notification settings - Fork 46
/
fares.html
224 lines (184 loc) · 7.16 KB
/
fares.html
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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
<!DOCTYPE html>
<html>
<head>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
<title>Fares Management</title>
<link href="lib/jquery-ui.min.css" rel="stylesheet">
<link href="lib/tabulator.min.css" rel="stylesheet">
<link href="lib/bootstrap.v4.0.0.min.css" crossorigin="anonymous" alt="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" rel="stylesheet">
<link href="js/commonstyle.css" rel="stylesheet">
<!-- Put the CSSs first and JSs next -->
<script src="lib/jquery-3.3.1.min.js" type="text/javascript"></script>
<script src="lib/jquery-ui.min.js" type="text/javascript"></script>
<script src="lib/tabulator.js" type="text/javascript"></script>
<script src="lib/popper.v1.12.9.min.js" crossorigin="anonymous" integrity="sha384-ApNbgh9B+Y1QKtv3Rn7W3mgPxhU9K/ScQsAP7hUibX39j7fakFPskvXusvfa0b4Q" alt="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.9/umd/popper.min.js"></script>
<script src="lib/bootstrap.v4.0.0.min.js" crossorigin="anonymous" integrity="sha384-JZR6Spejh4U02d8jOt6vLEHfe/JQGiRRSQQxSfFWpi1MquVdAyjUar5+76PVCmYl" alt="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js"></script>
<script src="lib/papaparse.min.js" type="text/javascript"></script>
<style>
#rightcontainer {
border-left: 1px solid #ccc;
padding-left: 50px;
}
#fare-rules-table {
height: 400px;
}
#fare-rules-simple-table {
height: 400px;
}
#fare-attributes-table {
height: 300px;
}
.ui-autocomplete {
font-size: 0.8em;
max-height: 100px;
overflow-y: auto;
/* prevent horizontal scrollbar */
overflow-x: hidden;
}
h3,h4 { margin-top : 0.5em; line-height: 1.5em; }
small { line-height: 0.2em; }
.leaflet-popup-content-wrapper {
background: #000000a1;
color: #fff;
border-radius: 8px;
}
.leaflet-popup-tip {
background: #000000a1;
}
/*.leaflet-tooltip {} */
.leaflet-popup-content {
margin-top: 10px;
}
/*
#fare-rules-table .tabulator-frozen-left {
background-color: #ddd!important;
color: black;
}
*/
.tabulator {
background-color: #fff;
}
#trackChanges {
width:100%;
}
.ui-accordion-content a {
text-decoration: underline;
}
</style>
</head>
<body>
<div id="navBar"></div>
<div class="container">
<h3>Fares</h3>
<div id="instructions">
<h3>Instructions</h3>
<div>
<b>Fare Rules - Pivoted View</b>
<br><ul>
<li>The zone_id's defined in <a href="stop.html">Stops Management</a> are arranged here in a 2-D matrix.</li>
<li>You can change the fares by clicking on them.</li>
<li>The fare's values can be changed in the Fare Attributes tab.</li>
<li>More info: <a href="https://developers.google.com/transit/gtfs/reference/#fare_rulestxt" target="_blank">GTFS fare rules specs</a></li>
</ul>
<br>
<b>Fare Rules - Simple View</b>
<ul>
<li>This is a linear (and original table) view of the same data seen in Pivoted View tab.</li>
<li>Here you can add more fare rules or delete existing ones.</li>
<li>More info: <a href="https://developers.google.com/transit/gtfs/reference/#fare_rulestxt" target="_blank">GTFS fare rules specs</a></li>
</ul>
<br>
<b>Fare Attributes</b>
<ul>
<li>The fare_id's used in Fare Rules tabs are defined here.</li>
<li>Each fare_id represents a ticket cost and other details.</li>
<li>More info: <a href="https://developers.google.com/transit/gtfs/reference/#fare_attributestxt" target="_blank">GTFS fare attributes specs</a></li>
</ul>
<br>Note: The fares structure used here is targeted at the station pairs model in <a href="https://code.google.com/archive/p/googletransitdatafeed/wikis/FareExamples.wiki">Example 6 on this explainer wiki</a>. More models may be incorporated in future.
</div>
</div><!-- Accordion over -->
<br>
<!-- Tabs Menu -->
<div id="tabs">
<ul>
<li><a href="#tab1">Fare Rules - Pivoted View</a></li>
<li><a href="#tab3">Fare Rules - Simple View</a></li>
<li><a href="#tab2">Fare Attributes</a></li>
</ul>
<!-- FARE RULES PIVOTED-->
<div id="tab1">
<h4>Fare Rules - Pivoted</h4>
<div id="fare-rules-table">Loading Fare Rules from backend, please wait..</div><br>
<p align="center">Changes: <button class="btn btn-outline-warning btn-sm" id="rules-undo">Undo</button> | <button class="btn btn-outline-info btn-sm" id="rules-redo" >Redo</button> | <button id="saveFareRulesPivotedButton" class="btn btn-outline-success btn-lg">Save Fare Rules to DB</button></p>
<p align="center"><span id="saveFareRulesStatus"></span></p>
</div>
<!-- FARE RULES SIMPLE-->
<div id="tab3">
<h4>Fare Rules - Simple</h4>
<div class="row"><div class="col-md-7">
<div id="fare-rules-simple-table"></div><br>
</div><div class="col-md-5">
<p>Add new Fare Rule:<br>
Origin zone: <select id="originSelect"></select>
Destination zone: <select id="destinationSelect"></select>
<br>
Route: <select id="routeSelect"></select>
Fare Id: <select id="fareSelect"></select>
<br></p>
<p><button id="addFareRuleButton" class="btn btn-outline-primary btn-sm">Add Fare Rule</button>
<small id="addFareRuleStatus"></small>
</p>
<hr>
<p align="center"><button id="saveFareRulesSimpleButton" class="btn btn-outline-success btn-lg">Save Fare Rules</button></p>
<p align="center"><span id="saveFareRulesSimpleStatus"></span></p>
</div></div>
</div>
<!-- FARE ATTRIBUTES -->
<div id="tab2">
<div class="row">
<div class="col">
<h4>Fare Attributes</h4>
<div id="fare-attributes-table"></div>
<!-- removing buggy undo-redo for now
<p align="center"><br>
Changes: <button class="btn btn-outline-warning btn-sm" id="attributes-undo">Undo</button> | <button class="btn btn-outline-info btn-sm" id="attributes-redo" >Redo</button>
</p>
-->
<br>
<p><small>Each price bracket to have an entry here. See <a href="https://developers.google.com/transit/gtfs/reference/#fare_attributestxt" target="_blank" >GTFS reference</a> for more info.<br>
See Maintenance section for deleting a fare after saving to DB.</small></p>
</div>
<div class="col" id="rightcontainer">
<h4>Add a Fare Attribute</h4>
<p>Create a fare_id: <input autocapitalize="characters" id='targetFareid' placeholder='fare_id' size="5"></p>
<p>Set a price: <input id='price' type="number" style="width:50px;"></p>
<p>Currency: <input id='currency' style="width:50px;" value="INR" title="specify currency"> <small><a href="https://en.wikipedia.org/wiki/ISO_4217#Active_codes" target="_blank">(ISO4217 codes only)</a></small></p>
<p><button id="addEditFare" class="btn btn-outline-primary btn-sm">Add Fare</button>
<small><i>if existing fare_id, entry in table will be updated.</i></small></p>
<small id="fareAttrStatus"></small>
<hr>
<p><button id="saveFareAttributesButton" class="btn btn-outline-success btn-lg">Save Fare Attributes to DB</button>
<br><br>
<span id="saveFareAttributesStatus"></span>
</p>
</div>
</div> <!-- end of columns row -->
</div> <!-- end of last tab -->
</div> <!-- end tabs -->
<div style="clear:both"></div>
<!--
<div id="logaccordion">
<h3>Changes Log</h3>
<div>
<p><textarea id="trackChanges" rows=10 cols="40"></textarea></p>
</div>
</div><!-- Accordion over -->
</div>
<br><br><br>
<script src="config/settings.js" type="text/javascript"></script>
<script src="js/commonfuncs.js" type="text/javascript"></script>
<script src="js/fares.js" type="text/javascript"></script>
</body>
</html>