File tree Expand file tree Collapse file tree 1 file changed +14
-2
lines changed
Expand file tree Collapse file tree 1 file changed +14
-2
lines changed Original file line number Diff line number Diff line change @@ -170,10 +170,22 @@ function display_stop_times(stop_routes) {
170170 row . appendChild ( td ) ;
171171 }
172172 {
173- for ( const { actual_time, scheduled_time } of route . times ) {
173+ for ( const { actual_time, scheduled_time, occupancy : vehicle_occupancy } of route . times ) {
174174 const td = document . createElement ( 'td' ) ;
175175 const r = display_hours ( scheduled_time , actual_time ) ;
176- td . innerHTML = r [ 0 ] + ( r [ 1 ] ? ` <br>${ r [ 1 ] } ` : '' ) ;
176+ let occupancy = '' ;
177+ if ( vehicle_occupancy ) {
178+ const mappings = {
179+ 'EMPTY' : '<i class="bi bi-person text-success" title="Празен"></i>' ,
180+ 'MANY_SEATS_AVAILABLE' : '<i class="bi bi-person text-success" title="Много свободни места"></i>' ,
181+ 'FEW_SEATS_AVAILABLE' : '<i class="bi bi-people-fill text-success" title="Малко свободни места"></i>' ,
182+ 'STANDING_ROOM_ONLY' : '<i class="bi bi-people-fill text-danger" title="Само правостоящи"></i>' ,
183+ 'CRUSHED_STANDING_ROOM_ONLY' : '<i class="bi bi-people-fill text-danger" title="Претъпкано"></i>' ,
184+ 'FULL' : '<i class="bi bi-people-fill text-danger" title="Пълен"></i>'
185+ } ;
186+ occupancy = mappings [ vehicle_occupancy ] || vehicle_occupancy ;
187+ }
188+ td . innerHTML = r [ 0 ] + ( r [ 1 ] ? ` <br>${ r [ 1 ] } ` : '' ) + ( occupancy ? ` ${ occupancy } ` : '' ) ;
177189 row . appendChild ( td ) ;
178190 }
179191 for ( let i = route . times . length ; i < 3 ; i ++ ) {
You can’t perform that action at this time.
0 commit comments