Files
shop-old/themes/admin/media/js/admin_bills.js

147 lines
3.5 KiB
JavaScript

var currentCat = 1;
var currentSort = 'id';
var currentSortDir = 'desc';
$(document).ready(function() {
$('#tabs').rsTabs();
$('#items').change(function() {
url = window.location;
url += '&mod=ajax';
url += '&items=' + $(this).val();
$('#contentContainer').load(url);
});
$('.pagination a').click(function(e) {
e.preventDefault();
url = window.location;
url += '&mod=ajax';
url += '&items=' + $('input[name=items]').val();
var click_value = $(this).text();
var items = parseInt($('input[name=items]').val());
var page = parseInt($('input[name=page]').val());
var pages = parseInt($('input[name=pages]').val());
if(click_value != '<' && click_value != '<<' && click_value != '>' && click_value != '>>') {
url += '&page=' + click_value;
} else {
if(click_value == '<') {
if(page > 1) {
url += '&page=' + (page - 1);
} else {
url += '&page=' + 1;
}
} else if(click_value == '<<') {
url += '&page=' + 1;
} else if(click_value == '>') {
if(page < pages) {
url += '&page=' + (page + 1);
} else {
url += '&page=' + pages;
}
} else if(click_value == '>>') {
url += '&page=' + pages;
}
}
$('#contentContainer').load(url);
});
$('.payment_method').change(function() {
var payment_method = $(this).val();
var id = $(this).parents('tr').attr('title');
var jqxhr = $.ajax({
'url': './index.php?admin_modul=admin_order&mod=json&action=payment_method&data=' + payment_method + '&id=' + id
});
jqxhr.success(function(data) {
try {
var data = $.parseJSON(data);
if (data.status == 'success') {
//window.location = './index.php?admin_modul=admin_order_payment_method&method_id=' + payment_method + '&id=' + id;
alert(data.message);
} else {
alert(data.message);
}
} catch(e) {
alert('ERROR.');
}
});
jqxhr.error(function() {
alert('ERROR.');
});
});
$('.billing_status').change(function() {
var jqxhr = $.ajax({
'url': './index.php?admin_modul=admin_order&mod=json&action=billing_status&data=' + $(this).val() + '&id=' + $(this).parents('tr').attr('title')
});
jqxhr.success(function(data) {
try {
var data = $.parseJSON(data);
alert(data.message);
} catch(e) {
alert('ERROR.');
}
});
jqxhr.error(function() {
alert('ERROR.');
});
});
$('.order_status').change(function() {
var jqxhr = $.ajax({
'url': './index.php?admin_modul=admin_order&mod=json&action=order_status&data=' + $(this).val() + '&id=' + $(this).parents('tr').attr('title')
});
jqxhr.success(function(data) {
try {
var data = $.parseJSON(data);
alert(data.message);
} catch(e) {
alert('ERROR.');
}
});
jqxhr.error(function() {
alert('ERROR.');
});
});
$('.action').click(function() {
if($(this).val() == 'all') {
// checked in table head
var check_bool = $(this).attr('checked');
$('.action').each(function() {
if(!$(this).attr('disabled')) {
$(this).attr('checked', check_bool);
}
});
} else {
// checked in table body
}
});
$('#bulk_action').click(function() {
//$.dump($('#action_list').find('option[selected="selected"]').val());
var action = $('#action_list').find('option[selected="selected"]').text();
var i = -1;
$.each($('tbody').find('.action'), function(index, value) {
if ($(this).attr('checked') && !$(this).attr('disabled')) {
alert('todo');
i = index;
}
});
if (i == -1) {
alert('Sie haben keine Bestellungen ausgewählt.');
}
});
});