diff --git a/intranet/static/js/bus-afternoon.js b/intranet/static/js/bus-afternoon.js index e93f528c6f0..02ebae58f28 100644 --- a/intranet/static/js/bus-afternoon.js +++ b/intranet/static/js/bus-afternoon.js @@ -7,7 +7,7 @@ $(function () { let base_url = window.location.host; bus.sendUpdate = function (data) { - //console.log('Sending data:', data); + data.time = "afternoon"; socket.send(JSON.stringify(data)); }; @@ -98,6 +98,32 @@ $(function () { .filter(bus => bus.attributes.route_name.includes('JT')) .map(bus => bus.attributes); } else if (action === 'Mark a bus as arrived or on time') { +<<<<<<< HEAD + busList = routeList.map(bus => { + if ((bus.attributes.status === 'a' || bus.attributes.status === 'd') && !bus.attributes.route_name.includes('JT')) { + let attr = JSON.parse(JSON.stringify(bus.attributes)); + attr.route_name = `Mark ${bus.attributes.route_name} as on time`; + return attr; + } + else if (bus.attributes.status === 'o') { + let attr = JSON.parse(JSON.stringify(bus.attributes)); + let attr2 = JSON.parse(JSON.stringify(bus.attributes)); + if (bus.attributes.route_name.includes('JT')) { + attr.route_name = `Mark ${bus.attributes.route_name} as delayed`; + return attr; + } + attr.route_name = `Mark ${bus.attributes.route_name} as delayed`; + attr2.route_name = `Mark ${bus.attributes.route_name} as arrived`; + return [attr, attr2]; + } else { + if (!bus.attributes.route_name.includes('JT')) { + return bus.attributes; + } + return null; + + } + }).flat().filter((element) => element != null); +======= busList = routeList.filter(bus => bus.attributes.route_name.includes('')) .map(bus => { if (bus.attributes.status === 'a' || bus.attributes.status === 'd') { @@ -118,6 +144,7 @@ $(function () { return bus.attributes; } }).flat(); +>>>>>>> dcacb3b1 (feat(bus): mark a bus as delayed in afternoon menu) } else if (action === 'Assign a bus to this space') { busList = routeList.filter(bus => bus.attributes.status !== 'a') .map(bus => bus.attributes); @@ -139,15 +166,7 @@ $(function () { ] })[0].selectize; - // Make search input readonly on mobile by default so the keyboard doesn't pop up - // if (window.innerWidth < 768) { - // selectField.$control_input.prop('readonly', true); - // $('.selectize-control').one("focus click", function (){ - // selectField.$control_input.prop('readonly', false); - // // TODO: Auto-focus the input field again and get the virtual keyboard to show up. - // // There doesn't seem to be an easy way to do this. - // }); - // } + selectField.$control_input.prop('pattern', '[0-9]*'); selectField.focus(); @@ -175,21 +194,35 @@ $(function () { } else if (this.action === 'Mark a bus as arrived or on time') { let route_name = ''; let st = ''; +<<<<<<< HEAD + if (e.target.value.includes('on')) { + route_name = e.target.value.split(' ')[1]; + +======= // TODO: this is also super hacky // Essentially, this checks if the selected route has "Mark" // at the beginning, implying that it's to be marked on time. if (e.target.value.includes('on time')) { route_name = e.target.value.split(' ')[1]; alert(route_name); +>>>>>>> dcacb3b1 (feat(bus): mark a bus as delayed in afternoon menu) st = 'o'; } else if (e.target.value.includes('delayed')) { route_name = e.target.value.split(' ')[1]; +<<<<<<< HEAD + + st = 'd'; + } + else { + route_name = e.target.value.split(' ')[1]; +======= alert(route_name); st = 'd'; } else { route_name = e.target.value; +>>>>>>> dcacb3b1 (feat(bus): mark a bus as delayed in afternoon menu) st = 'a'; } let route = this.model.findWhere({ route_name: route_name }).attributes;