/* exported initializeRoutes */ function initializeRoutes() { router('/login', routes.login); router('/sd', routes.sd); router('*', routes.login); } //add a 'firstLoad' setup function into the route's middleware chain var routes = { login: function() { showPage('login'); }, logout: function() { $.post('api/logout.php'); showPage('login'); }, sd: function() { showPage('sd'); loadAllData(); } }; function showPage(page) { console.log('show page', page); var $page_old = $('.screen.active'); var $page_new = $('#screen-' + page); //do nothing if we are already on the page if($page_old.is($page_new)) return; $('body').attr('class', 'screen-' + page); //put new page on top of old $page_new.insertAfter('.screen.active'); //slide it to the right while crossfading $page_old .one('animationend', function(event) //jshint ignore:line, unused { $(this).hide(); }) //TODO: add detect webkitanimationend or animationend .removeClass('active'); //slide from left while crossfading $page_new .show() .off('animationend') .addClass('active') .focus(); //this needs to be used in conjunction with a "tabindex" field on the html object to maintain keyboard focus } function loadAllData() { $.post('api/getAllData.php', 'json') .done(function(companies) { //go through each company and add a tab if one isn't present if(!companies.length) return; for(var c = 0; c < companies.length; c++) { var company = companies[c]; //if the company's tab doesn't exist, create it if($('#screen-sd ul.nav-tabs > li[data-id_company]').length === 0) { //add tab $('
| Division | ' + 'Consignee | ' + 'Called In | ' + 'Dispatch # | ' + 'Shipper | ' + 'Ready | ' + 'Address 1 | ' + 'Address 2 | ' + 'City | ' + 'ST | ' + 'Zip | ' + 'Phone | ' + 'Ready Time | ' + 'Close Time | ' + 'Pickup Time | ' + 'Depart Time | ' + 'BOL Delivered | ' + 'Dispatch Refere | ' + 'Ctns | ' + 'Weight | ' + 'Cube | ' + '
|---|