|
|
|
|
@ -1,19 +1,20 @@ |
|
|
|
|
$(document).ready(function() { |
|
|
|
|
(function() { |
|
|
|
|
$(document).ready(function () { |
|
|
|
|
|
|
|
|
|
$('.delete_license').click(function(e){ |
|
|
|
|
$('.delete_license').click(function (e) { |
|
|
|
|
e.preventDefault(); |
|
|
|
|
var accountID = $(this).data('id'); |
|
|
|
|
|
|
|
|
|
$('#dialogs').html('Удалить счет на оплату?'); |
|
|
|
|
$('#dialogs').dialog({ |
|
|
|
|
buttons: { |
|
|
|
|
"Да": function(){ |
|
|
|
|
$.post('/my/delete_license/' + accountID + '/', function(data){ |
|
|
|
|
$('.account_' + data['id']).remove() |
|
|
|
|
"Да": function () { |
|
|
|
|
$.post('/my/delete_license/' + accountID + '/', function () { |
|
|
|
|
$("[data-id='" + accountID + "']")[0].remove() |
|
|
|
|
}); |
|
|
|
|
$(this).dialog("close"); |
|
|
|
|
}, |
|
|
|
|
"Нет": function(){ |
|
|
|
|
"Нет": function () { |
|
|
|
|
$(this).dialog("close"); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
@ -28,10 +29,10 @@ $(document).ready(function() { |
|
|
|
|
|
|
|
|
|
var options = { |
|
|
|
|
valueNames: [ |
|
|
|
|
{ data: ['id'] }, |
|
|
|
|
{data: ['id']}, |
|
|
|
|
'order-date', |
|
|
|
|
{ data: ['type']}, |
|
|
|
|
{ data: ['status']} |
|
|
|
|
{data: ['type']}, |
|
|
|
|
{data: ['status']} |
|
|
|
|
] |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
@ -48,7 +49,7 @@ $(document).ready(function() { |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (month < 10) { |
|
|
|
|
month = '0'+ month |
|
|
|
|
month = '0' + month |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
function getPrevMonth(d) { |
|
|
|
|
@ -59,7 +60,7 @@ $(document).ready(function() { |
|
|
|
|
result = 12 |
|
|
|
|
} |
|
|
|
|
if (result < 10) { |
|
|
|
|
result = '0'+ result |
|
|
|
|
result = '0' + result |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
return result |
|
|
|
|
@ -82,14 +83,14 @@ $(document).ready(function() { |
|
|
|
|
function getQuarter(d) { |
|
|
|
|
var result; |
|
|
|
|
d = d || new Date(); |
|
|
|
|
var m = Math.floor(d.getMonth()/3) + 2; |
|
|
|
|
result = m > 4? m - 4 : m; |
|
|
|
|
var m = Math.floor(d.getMonth() / 3) + 2; |
|
|
|
|
result = m > 4 ? m - 4 : m; |
|
|
|
|
return result - 1 |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
function getQuarterForStrDate(strDate) { |
|
|
|
|
var parts =strDate.split('.'); |
|
|
|
|
var resDate = new Date(parts[2],parts[1]-1,parts[0]); |
|
|
|
|
var parts = strDate.split('.'); |
|
|
|
|
var resDate = new Date(parts[2], parts[1] - 1, parts[0]); |
|
|
|
|
return getQuarter(resDate) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@ -107,9 +108,9 @@ $(document).ready(function() { |
|
|
|
|
prevMonth = getPrevMonth(); |
|
|
|
|
prevMonthYear = getPrevMonthYear(); |
|
|
|
|
prevQuarter = getPrevQuarter(); |
|
|
|
|
prevYear =year - 1; |
|
|
|
|
prevYear = year - 1; |
|
|
|
|
|
|
|
|
|
$('#filterNone').click(function() { |
|
|
|
|
$('#filterNone').click(function () { |
|
|
|
|
event.preventDefault(); |
|
|
|
|
filterPeriod = false; |
|
|
|
|
filterStatus = false; |
|
|
|
|
@ -118,99 +119,99 @@ $(document).ready(function() { |
|
|
|
|
resetAllFilterStatus(); |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
$('#filterAccountsNone').click(function() { |
|
|
|
|
$('#filterAccountsNone').click(function () { |
|
|
|
|
event.preventDefault(); |
|
|
|
|
filterStatus = false; |
|
|
|
|
filterType = 'account'; |
|
|
|
|
filterItems(); |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
$('#filterAccountsPay').click(function() { |
|
|
|
|
$('#filterAccountsPay').click(function () { |
|
|
|
|
event.preventDefault(); |
|
|
|
|
filterStatus = ['2']; |
|
|
|
|
filterType = 'account'; |
|
|
|
|
filterItems(); |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
$('#filterAccountsWaitPay').click(function() { |
|
|
|
|
$('#filterAccountsWaitPay').click(function () { |
|
|
|
|
event.preventDefault(); |
|
|
|
|
filterStatus = ['0']; |
|
|
|
|
filterType = 'account'; |
|
|
|
|
filterItems(); |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
$('#filterAccountsFreezePay').click(function() { |
|
|
|
|
$('#filterAccountsFreezePay').click(function () { |
|
|
|
|
event.preventDefault(); |
|
|
|
|
filterStatus = ['4']; |
|
|
|
|
filterType = 'account'; |
|
|
|
|
filterItems(); |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
$('#filterLicenseNone').click(function() { |
|
|
|
|
$('#filterLicenseNone').click(function () { |
|
|
|
|
event.preventDefault(); |
|
|
|
|
filterStatus = false; |
|
|
|
|
filterType = 'license'; |
|
|
|
|
filterItems(); |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
$('#filterLicenseNow').click(function() { |
|
|
|
|
$('#filterLicenseNow').click(function () { |
|
|
|
|
event.preventDefault(); |
|
|
|
|
filterStatus = ['-1','2']; |
|
|
|
|
filterStatus = ['-1', '2']; |
|
|
|
|
filterType = 'license'; |
|
|
|
|
filterItems(); |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
$('#filterLicenseOld').click(function() { |
|
|
|
|
$('#filterLicenseOld').click(function () { |
|
|
|
|
event.preventDefault(); |
|
|
|
|
filterStatus = ['3']; |
|
|
|
|
filterType = 'license'; |
|
|
|
|
filterItems(); |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
$('#filterPeriodNone').click(function() { |
|
|
|
|
$('#filterPeriodNone').click(function () { |
|
|
|
|
event.preventDefault(); |
|
|
|
|
filterPeriod = false; |
|
|
|
|
filterItems(); |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
$('#filterPeriodThisMonth').click(function() { |
|
|
|
|
$('#filterPeriodThisMonth').click(function () { |
|
|
|
|
event.preventDefault(); |
|
|
|
|
filterPeriod = 1; |
|
|
|
|
filterItems(); |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
$('#filterPeriodPrevMonth').click(function() { |
|
|
|
|
$('#filterPeriodPrevMonth').click(function () { |
|
|
|
|
event.preventDefault(); |
|
|
|
|
filterPeriod = 2; |
|
|
|
|
filterItems(); |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
$('#filterPeriodThisQuarter').click(function() { |
|
|
|
|
$('#filterPeriodThisQuarter').click(function () { |
|
|
|
|
event.preventDefault(); |
|
|
|
|
filterPeriod = 3; |
|
|
|
|
filterItems(); |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
$('#filterPeriodPrevQuarter').click(function() { |
|
|
|
|
$('#filterPeriodPrevQuarter').click(function () { |
|
|
|
|
event.preventDefault(); |
|
|
|
|
filterPeriod = 4; |
|
|
|
|
filterItems(); |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
$('#filterPeriodThisYear').click(function() { |
|
|
|
|
$('#filterPeriodThisYear').click(function () { |
|
|
|
|
event.preventDefault(); |
|
|
|
|
filterPeriod = 5; |
|
|
|
|
filterItems(); |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
$('#filterPeriodPrevYear').click(function() { |
|
|
|
|
$('#filterPeriodPrevYear').click(function () { |
|
|
|
|
event.preventDefault(); |
|
|
|
|
filterPeriod = 6; |
|
|
|
|
filterItems(); |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
function filterItemsDontPeriod() { |
|
|
|
|
orderList.filter(function(item) { |
|
|
|
|
orderList.filter(function (item) { |
|
|
|
|
if (!filterType && !filterStatus) { |
|
|
|
|
return true |
|
|
|
|
} |
|
|
|
|
@ -227,7 +228,7 @@ $(document).ready(function() { |
|
|
|
|
|
|
|
|
|
function filterItemsMonth() { |
|
|
|
|
|
|
|
|
|
orderList.filter(function(item) { |
|
|
|
|
orderList.filter(function (item) { |
|
|
|
|
if (!filterType && !filterStatus) { |
|
|
|
|
return item.values()['order-date'].split('.')[1] === month.toString() |
|
|
|
|
&& item.values()['order-date'].split('.')[2] === year.toString(); |
|
|
|
|
@ -249,7 +250,7 @@ $(document).ready(function() { |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
function filterItemsPrevMonth() { |
|
|
|
|
orderList.filter(function(item) { |
|
|
|
|
orderList.filter(function (item) { |
|
|
|
|
if (!filterType && !filterStatus) { |
|
|
|
|
return item.values()['order-date'].split('.')[1] === prevMonth.toString() |
|
|
|
|
&& item.values()['order-date'].split('.')[2] === prevMonthYear.toString(); |
|
|
|
|
@ -270,7 +271,7 @@ $(document).ready(function() { |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
function filterItemsThisQuarter() { |
|
|
|
|
orderList.filter(function(item) { |
|
|
|
|
orderList.filter(function (item) { |
|
|
|
|
if (!filterType && !filterStatus) { |
|
|
|
|
return getQuarterForStrDate(item.values()['order-date']) === quarter |
|
|
|
|
} |
|
|
|
|
@ -288,7 +289,7 @@ $(document).ready(function() { |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
function filterItemsPrevQuarter() { |
|
|
|
|
orderList.filter(function(item) { |
|
|
|
|
orderList.filter(function (item) { |
|
|
|
|
if (!filterType && !filterStatus) { |
|
|
|
|
return getQuarterForStrDate(item.values()['order-date']) === prevQuarter |
|
|
|
|
} |
|
|
|
|
@ -306,7 +307,7 @@ $(document).ready(function() { |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
function filterItemsThisYear() { |
|
|
|
|
orderList.filter(function(item) { |
|
|
|
|
orderList.filter(function (item) { |
|
|
|
|
if (!filterType && !filterStatus) { |
|
|
|
|
return item.values()['order-date'].split('.')[2] === year.toString() |
|
|
|
|
} |
|
|
|
|
@ -324,7 +325,7 @@ $(document).ready(function() { |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
function filterItemsPrevYear() { |
|
|
|
|
orderList.filter(function(item) { |
|
|
|
|
orderList.filter(function (item) { |
|
|
|
|
if (!filterType && !filterStatus) { |
|
|
|
|
return item.values()['order-date'].split('.')[2] === prevYear.toString() |
|
|
|
|
} |
|
|
|
|
@ -376,22 +377,22 @@ $(document).ready(function() { |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
obj.className = classes.join(' '); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function setActive(element) { |
|
|
|
|
element.className +=' is_active_filter'; |
|
|
|
|
element.className += ' is_active_filter'; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
function resetAllFilterStatus() { |
|
|
|
|
|
|
|
|
|
for (var i = 0;i < filterLinks.length; i++ ) { |
|
|
|
|
for (var i = 0; i < filterLinks.length; i++) { |
|
|
|
|
if (filterLinks[i].classList.contains('is_active_filter')) { |
|
|
|
|
removeClass(filterLinks[i], 'is_active_filter') |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
for (var j = 0;j < filterPeriodLinks.length; j++ ) { |
|
|
|
|
for (var j = 0; j < filterPeriodLinks.length; j++) { |
|
|
|
|
if (filterPeriodLinks[j].classList.contains('is_active_filter')) { |
|
|
|
|
removeClass(filterPeriodLinks[j], 'is_active_filter') |
|
|
|
|
} |
|
|
|
|
@ -402,7 +403,7 @@ $(document).ready(function() { |
|
|
|
|
function resetAnotherFilterStatus(element, typeLinks) { |
|
|
|
|
|
|
|
|
|
if (typeLinks === 'type') { |
|
|
|
|
for (var i = 0;i < filterLinks.length; i++ ) { |
|
|
|
|
for (var i = 0; i < filterLinks.length; i++) { |
|
|
|
|
if (filterLinks[i] === element) { |
|
|
|
|
// console.log(filterLinks[i]);
|
|
|
|
|
} else { |
|
|
|
|
@ -412,7 +413,7 @@ $(document).ready(function() { |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} else { |
|
|
|
|
for (var j = 0;j < filterPeriodLinks.length; j++ ) { |
|
|
|
|
for (var j = 0; j < filterPeriodLinks.length; j++) { |
|
|
|
|
if (filterPeriodLinks[j] === element) { |
|
|
|
|
// console.log(filterLinks[i]);
|
|
|
|
|
} else { |
|
|
|
|
@ -426,18 +427,19 @@ $(document).ready(function() { |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for (var i = 0;i < filterLinks.length; i++ ) { |
|
|
|
|
for (var i = 0; i < filterLinks.length; i++) { |
|
|
|
|
filterLinks[i].addEventListener('click', function () { |
|
|
|
|
setActive(this); |
|
|
|
|
resetAnotherFilterStatus(this,'type'); |
|
|
|
|
resetAnotherFilterStatus(this, 'type'); |
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
for (var j = 0;j < filterPeriodLinks.length; j++ ) { |
|
|
|
|
for (var j = 0; j < filterPeriodLinks.length; j++) { |
|
|
|
|
filterPeriodLinks[j].addEventListener('click', function () { |
|
|
|
|
setActive(this); |
|
|
|
|
resetAnotherFilterStatus(this, 'period'); |
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
}); |
|
|
|
|
}); |
|
|
|
|
})(); |
|
|
|
|
|