$(document).ready(function () { all_shippings(); }); function all_shippings() { $('#shippingsList table thead td').click(function() { $('#filterF .page').val(1); if ($(this).attr('id') == 'action') return; if ($(this).attr('id') == 'invoices') return; cl = $('#shippingsList'); order = $(this).attr('order'); if (order == 'asc') { $(this).parent().children().attr('order', '').removeClass('desc').removeClass('asc'); $(this).attr('order', 'desc').addClass('desc'); order = 'desc'; } else { $(this).parent().children().attr('order', '').removeClass('desc').removeClass('asc'); $(this).attr('order', 'asc').addClass('asc'); order = 'asc'; } $('#disabler').css('top', 0).css('left', 0).width(cl.width()).height(cl.height()); $('#disabler').fadeIn('fast'); $.get('http://track.acshipping.com/updater.php', { id: 'shipping', order: $(this).attr('id'), way: order, filter: $('#filterF').serializeArray() }, function(data) { $('#shippingsList table.list tbody').replaceWith(data); $('#disabler').fadeOut(); reloadShipping(); }); }); $('#shippingsList #filterF #clear').click(function() { $('#shippingsList table thead td').attr('order', '').removeClass('desc').removeClass('asc'); $('#filterF').find(':input').val(''); $('#filterF #isFiltered').val('0'); cl = $('#shippingsList'); $('#disabler').css('top', 0).css('left', 0).width(cl.width()).height(cl.height()); $('#disabler').fadeIn('fast'); $.get('http://track.acshipping.com/updater.php', { id: 'shipping', filter: $('#filterF').serializeArray() }, function(data) { $('#shippingsList table.list tbody').replaceWith(data); $('#disabler').fadeOut(); reloadShipping(); }); }); $('#shippingsList #filterF #filter').click(function() { $('#shippingsList table thead td').attr('order', '').removeClass('desc').removeClass('asc'); $('#filterF #isFiltered').val('1'); cl = $('#shippingsList'); $('#disabler').css('top', 0).css('left', 0).width(cl.width()).height(cl.height()); $('#disabler').fadeIn('fast'); $('#filterF input[name=page]').val(0); $.get('http://track.acshipping.com/updater.php', { id: 'shipping', filter: $('#filterF').serializeArray() }, function(data) { $('#shippingsList table.list tbody').replaceWith(data); $('#disabler').fadeOut(); reloadShipping(); }); }); $('#newShipping #submit').click(function() { $.ajax({ type: 'GET', url: 'http://track.acshipping.com/updater.php', data: 'id=newshipping&'+$('#newShippingF').serialize(), success: function(msg) { alert(msg); } }); }); $('#settingsF #submit').click(function() { cl = $('#settingsDIV'); $('#disabler').css('top', 0).css('left', 0).width(cl.width()).height(cl.height()); $('#disabler').fadeIn('fast'); $.ajax({ type: 'POST', url: 'http://track.acshipping.com/updater.php', data: 'id=settings&'+$('#settingsF').serialize(), success: function(msg) { $('#disabler').fadeOut(); } }); }); viewShipping(); editShipping(); newShipping(); removeShipping(); pageShipping(); } function viewShipping() { $('#shippingsList table tbody a.view').click(function() { id = $(this).attr('nr'); cl = $('#shippingsList'); $('#disabler').css('top', 0).css('left', 0).width(cl.width()).height(cl.height()); $('#disabler').fadeIn('fast'); $.post('http://track.acshipping.com/updater.php', { id: 'viewshipping', nr: id }, function(data) { $(data).appendTo('#shippingsList'); $('#viewShipping').fadeIn('fast'); $('#viewShipping').css('top', 0).css('left', 0); $('#viewShipping a.close').click(function() { $('#viewShipping').fadeOut(function(){$('#viewShipping').remove(); $('#disabler').fadeOut();}); updateHeight(); }); updateHeight(); }); }); } function editShipping() { $('#shippingsList table tbody a.edit').click(function() { iii = '#editShippingF input[name='; id = $(this).attr('nr'); cl = $('#shippingsList'); $('#disabler').css('top', 0).css('left', 0).width(cl.width()).height(cl.height()); $('#disabler').fadeIn('fast'); $.post('http://track.acshipping.com/updater.php', { id: 'editshipping', nr: id }, function(data) { $(data).appendTo('#shippingsList'); $('#editShipping').fadeIn('fast'); $('#editShipping').css('top', 0).css('left', 0); $('#editShipping a.cancel').click(function() { $('#editShipping').fadeOut(function(){$('#editShipping').remove(); $('#disabler').fadeOut();}); updateHeight(); }); updateHeight(); $('#editShipping a.save').click(function() { $('#editShipping div.feedback').slideUp(function() {$('#editShipping div.feedback').children().remove(); $.ajax({ type: 'POST', url: 'http://track.acshipping.com/updater.php', data: 'id=editshipping&nr='+id+'&save=yes&'+$('#editShippingF').serialize(), success: function(data) { if (data == "OK") { $('#shippingsList .feedback').children().remove(); $('