Add JS files

This commit is contained in:
2025-05-12 15:45:17 +00:00
parent 7ddd15c4fa
commit 967007b0c7
3239 changed files with 1157078 additions and 0 deletions

View File

@@ -0,0 +1,180 @@
//START:
$(document).ready(
function() {
//set sizes
$("#parent_name").attr("size", "70");
$("#parent_name_copy").attr("size", "70");
$("#parent_shipping_address_name").attr("size", "70");
$("#payment_date_days").css("width", "40");
//$("#payment_method").css("width", "100");
//change parent select button
$("#btn_clr_parent_name").children().attr("src","themes/default/images/id-ff-add.png" );
$("#btn_clr_parent_name").attr("title","Dodaj" );
$("#btn_clr_parent_name").click(createAccount);
// confirm exit
window.onbeforeunload = confirmExit;
// prevent submit by enter press
lockEnter();
// parent info
var previousVal;
var pollInterval = setInterval(function() {
var val = $('#parent_id').val();
if (val !== previousVal) {
if ($('#parent_id').val() == '') return;
$(".loading_panel").css("display", "block");
setTimeout(function() {
getParentInfo($("#parent_id").val(), 'Accounts');
}, 1000);
}
previousVal = val;
}, 500);
//newProduct
var previousVal2;
var prodInterval = setInterval(function() {
var val = $('#newProductId').val();
if (val !== previousVal2) {
if ($('#newProductId').val() == '') return;
$(".loading_panel").css("display", "block");
setTimeout(function() {
AddProduct(items.length-1, val);
}, 500);
}
previousVal2 = val;
}, 500);
// categories
getCategoriesList();
// its vat free change
// language channge
DrawHeaders();
// stock selector
if (($("#new_number").val() == true)
&& ($("#duplicate").val() != true) && ($("#ecmsale_id").val() =='')) {
console.log('tu?');
EcmDocumentNumberGenerator_getNumberTemplate('document_no', 'EcmPrepaymentInvoices');
//sale from subpanel??
if ($("#parent_id").val()!='') {
$(".loading_panel").css("display", "block");
setTimeout(function() {
getParentInfo($("#parent_id").val(), $(
"#parent_type :selected").val());
}, 1000);
}
$(".loading_panel").css("display", "none");
} else if (($("#new_number").val() == true)
&& ($("#duplicate").val() == true)) {
console.log('tam?');
EcmDocumentNumberGenerator_getNumberTemplate('document_no', 'EcmPrepaymentInvoices');
getParentInfo($("#parent_id").val(),
$("#parent_type :selected").val());
getItems();
$(".loading_panel").css("display", "none");
} else if (($("#new_number").val() == true)
&& ($("#ecmsale_id").val() != '')) {
EcmDocumentNumberGenerator_getNumberTemplate('document_no', 'EcmPrepaymentInvoices');
getParentInfo($("#parent_id").val(),
'Accounts');
getItemsFromSale();
calculateVat();
$(".loading_panel").css("display", "none");
} else {
getParentInfo($("#parent_id").val(),
$("#parent_type :selected").val());
getItems();
EcmDocumentNumberGenerator_getNumberTemplate('document_no', 'EcmPrepaymentInvoices');
console.log('t');
$(".loading_panel").css("display", "none");
}
// handle setItems
setITEMS = function() {
var formname = 'EditView';
if (check_form_(formname) == true) {
SetTab('ITEMS');
}
};
$("#currency_id").change(function() {
if ($('#currency_id').val() != 'PLN') {
$('#curr_trigger').show();
getNBPCurrencyExchange($("#currency_id :selected").val());
} else {
$('#curr_trigger').hide();
$('#currency_value_nbp').val("");
$('#currency_table_tmp').val("");
$('#currency_table').val("");
}
});
var previousVal3;
var prodInterval = setInterval(function() {
var val = $('#register_date').val();
if (val !== previousVal3) {
if ($("#currency_id :selected").val() != 'PLN')
getNBPCurrencyExchange($("#currency_id :selected").val());
}
previousVal3 = val;
}, 500);
// parent info
// wyszukiwanie start
$('#searchProductsInput').keyup(function() {
// stronicowanie od 1 strony przy zmianie szukanego produktu
$('#searchStart').val(0);
searchProducts();
});
AddSearchRecord();
$(".loading_panel").css("display", "none");
});
// handle save
var check_form_ = check_form;
check_form = function(formname,event) {
// zapobiega zapisywaniu dokumentu firefox bug, w przypadku nacisniecia enter w polu z autocomplete
if(event.clientY==0 && event.clientX==0){
return false;
}
window.onbeforeunload = null;
if (items.length == 0 || items[0].product_id=='') {
alert("Brak produktów");
return false;
}
// usuwa rekord pomocniczy
clearEmpty();
$(".loading_panel").css("display", "block");
// calculate totals
var count = $('#' + itemsTable + '_T tr').length - 1; // -1 - thead row
for (var index = 0; index != count; index++) {
calculateRow(index);
if (validation.recipient_code == true)
console.log('Sprawdzić kody trzeba');
}
if (check_form_(formname) == false) {
window.onbeforeunload = confirmExit;
$(".loading_panel").css("display", "none");
return false;
} else {
$("#total_netto").val($("#t_netto").val());
$("#total_brutto").val($("#t_brutto").val());
$("#discount").val($("#disc").val());
$("#position_list").val(JSON.stringifyNoSecurity(items));
return true;
}
};
function confirmExit() {
return "";
}
function lockEnter() {
// prevent default
$(window).keydown(function(event) {
if (event.keyCode == 13 && $(":focus").prop('tagName')!='input') {
event.preventDefault();
return false;
}
});
}

View File

@@ -0,0 +1,8 @@
//START:
$(document).ready(
function() {
DrawHeaders();
getItems(false);
$(".loading_panel").css("display", "none");
});

View File

@@ -0,0 +1,150 @@
function getSelected() {
var sel = $('input[type=checkbox]:checked').map(function(make_pdf, el) {
return $(el).val()
}).get();
document.getElementById("idss").value=sel;
return sel;
}
function getList() {
window.open('index.php?module=EcmPrepaymentInvoices&action=ProductSummary&ids='+$('#idss').val());
}
function getList2() {
window.open('index.php?module=EcmPrepaymentInvoices&action=productsSummaryList&to_pdf=1&ids='+$('#idss').val());
}
$(document).ready(function()
{
// by document no
$.tablesorter.addParser({
// set a unique id
id: 'rangesort',
is: function (s) {
// return false so this parser is not auto detected
return false;
},
format: function (s, table, cell, cellIndex) {
// get data attributes from $(cell).attr('data-something');
// check specific column using cellIndex
return $(cell).attr('data-price');
},
// set type, either numeric or text
type: 'numeric'
});
// by total netto
$.tablesorter.addParser({
// set a unique id
id: 'rangesorttota',
is: function (s) {
// return false so this parser is not auto detected
return false;
},
format: function (s, table, cell, cellIndex) {
// get data attributes from $(cell).attr('data-something');
// check specific column using cellIndex
return $(cell).attr('data-total');
},
// set type, either numeric or text
type: 'numeric'
});
// by vat
$.tablesorter.addParser({
// set a unique id
id: 'rangesorttotav',
is: function (s) {
// return false so this parser is not auto detected
return false;
},
format: function (s, table, cell, cellIndex) {
// get data attributes from $(cell).attr('data-something');
// check specific column using cellIndex
return $(cell).attr('data-total');
},
// set type, either numeric or text
type: 'numeric'
});
// by total brutto
$.tablesorter.addParser({
// set a unique id
id: 'rangesorttotan',
is: function (s) {
// return false so this parser is not auto detected
return false;
},
format: function (s, table, cell, cellIndex) {
// get data attributes from $(cell).attr('data-something');
// check specific column using cellIndex
return $(cell).attr('data-total');
},
// set type, either numeric or text
type: 'numeric'
});
// by total invoice
$.tablesorter.addParser({
// set a unique id
id: 'rangesorttotai',
is: function (s) {
// return false so this parser is not auto detected
return false;
},
format: function (s, table, cell, cellIndex) {
// get data attributes from $(cell).attr('data-something');
// check specific column using cellIndex
return $(cell).attr('data-total');
},
// set type, either numeric or text
type: 'numeric'
});
$('#selectall').click(function(event) { //on click
if(this.checked) { // check select status
$('.make_pdf').each(function() { //loop through each checkbox
this.checked = true; //select all checkboxes with class "checkbox1"
});
}else{
$('.make_pdf').each(function() { //loop through each checkbox
this.checked = false; //deselect all checkboxes with class "checkbox1"
});
}
});
// hightlight table row
$('#myTable tr').mouseover(function(e) {
$('#myTable tr').removeClass('highlighted');
$(this).addClass('highlighted');
});
$('.tablesorter').tablesorter({
headers: {
0: {
// disable it by setting the property sorter to false
sorter: false
},
2: {
sorter: 'rangesort'
},
3: {
// disable it by setting the property sorter to false
sorter: false
},
7: {
sorter: 'rangesorttota'
},
8: {
sorter: 'rangesorttotav'
},
9: {
sorter: 'rangesorttotan'
},
10: {
sorter: 'rangesorttotai'
}
}
});
});

View File

@@ -0,0 +1,171 @@
function getSelected() {
var sel = $('input[type=checkbox]:checked').map(function(make_pdf, el) {
return $(el).val()
}).get();
document.getElementById("idss").value=sel;
return sel;
}
function getList() {
window.open('index.php?module=EcmPrepaymentInvoices&action=productsSummaryList&to_pdf=1&ids='+$('#idss').val());
}
$(document).ready(function()
{
// by document no
$.tablesorter.addParser({
// set a unique id
id: 'rangesort',
is: function (s) {
// return false so this parser is not auto detected
return false;
},
format: function (s, table, cell, cellIndex) {
// get data attributes from $(cell).attr('data-something');
// check specific column using cellIndex
return $(cell).attr('data-price');
},
// set type, either numeric or text
type: 'numeric'
});
// by total netto
$.tablesorter.addParser({
// set a unique id
id: 'rangesorttota',
is: function (s) {
// return false so this parser is not auto detected
return false;
},
format: function (s, table, cell, cellIndex) {
// get data attributes from $(cell).attr('data-something');
// check specific column using cellIndex
return $(cell).attr('data-total');
},
// set type, either numeric or text
type: 'numeric'
});
// by vat
$.tablesorter.addParser({
// set a unique id
id: 'rangesorttotav',
is: function (s) {
// return false so this parser is not auto detected
return false;
},
format: function (s, table, cell, cellIndex) {
// get data attributes from $(cell).attr('data-something');
// check specific column using cellIndex
return $(cell).attr('data-total');
},
// set type, either numeric or text
type: 'numeric'
});
// by total brutto
$.tablesorter.addParser({
// set a unique id
id: 'rangesorttotan',
is: function (s) {
// return false so this parser is not auto detected
return false;
},
format: function (s, table, cell, cellIndex) {
// get data attributes from $(cell).attr('data-something');
// check specific column using cellIndex
return $(cell).attr('data-total');
},
// set type, either numeric or text
type: 'numeric'
});
// by total invoice
$.tablesorter.addParser({
// set a unique id
id: 'rangesorttotai',
is: function (s) {
// return false so this parser is not auto detected
return false;
},
format: function (s, table, cell, cellIndex) {
// get data attributes from $(cell).attr('data-something');
// check specific column using cellIndex
return $(cell).attr('data-total');
},
// set type, either numeric or text
type: 'numeric'
});
$('#selectall').click(function(event) { //on click
if(this.checked) { // check select status
$('.make_pdf').each(function() { //loop through each checkbox
this.checked = true; //select all checkboxes with class "checkbox1"
});
}else{
$('.make_pdf').each(function() { //loop through each checkbox
this.checked = false; //deselect all checkboxes with class "checkbox1"
});
}
});
$('#selectall2').click(function(event) { //on click
if(this.checked) { // check select status
$('.make_pdf2').each(function() { //loop through each checkbox
this.checked = true; //select all checkboxes with class "checkbox1"
});
}else{
$('.make_pdf2').each(function() { //loop through each checkbox
this.checked = false; //deselect all checkboxes with class "checkbox1"
});
}
});
$('#selectall3').click(function(event) { //on click
if(this.checked) { // check select status
$('.make_pdf3').each(function() { //loop through each checkbox
this.checked = true; //select all checkboxes with class "checkbox1"
});
}else{
$('.make_pdf3').each(function() { //loop through each checkbox
this.checked = false; //deselect all checkboxes with class "checkbox1"
});
}
});
// hightlight table row
$('#myTable tr').mouseover(function(e) {
$('#myTable tr').removeClass('highlighted');
$(this).addClass('highlighted');
});
$("#myTable").tablesorter({
headers: {
0: {
// disable it by setting the property sorter to false
sorter: false
},
}
});
$("#myTable2").tablesorter({
headers: {
0: {
// disable it by setting the property sorter to false
sorter: false
},
}
});
$("#myTable3").tablesorter({
headers: {
0: {
// disable it by setting the property sorter to false
sorter: false
},
}
});
});

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,106 @@
columns = new Array();
//define columns
//begin: number
columns[0] = {
'name' : 'number',
'label' : 'Lp.',
'width' : 4,
'content' : new Array(),
};
columns[0]['content'][0] = {'name' : '', 'type': 'text', 'readonly' : true};
//end: number
//begin: code
columns[1] = {
'name' : 'product_',
'label' : 'Indeks',
'width' : 6,
'content' : new Array(),
};
columns[1]['content'][0] = {'name' : 'code', 'type': 'hidden', 'readonly' : true};
columns[1]['content'][1] = {'name' : 'id', 'type': 'hidden'};
columns[1]['content'][2] = {'name' : 'link', 'type': 'text', 'readonly' : true};
//end: code
//begin: name
columns[2] = {
'name' : 'name',
'label' : 'Nazwa',
'width' : 20,
'content' : new Array(),
};
columns[2]['content'][0] = {'name' : '', 'type': 'text'};
//end: name
//begin: quantity
columns[3] = {
'name' : 'quantity',
'label' : 'Ilość',
'width' : 5,
'content' : new Array(),
'align' : 'right',
};
columns[3]['content'][0] = {'name' : '', 'type': 'text', 'isNumber' : true, 'onChange' : 'calculateRow($(this).parent(\'td\').parent(\'tr\').index());'};
columns[3]['content'][1] = {'name' : '_res', 'type': 'text', 'isNumber' : true, 'onChange' : 'calculateRow($(this).parent(\'td\').parent(\'tr\').index());'};
//end: quantity
//begin: unit
columns[4] = {
'name' : 'unit_',
'label' : 'J.M.',
'width' : 5,
'content' : new Array(),
'align' : 'center',
};
columns[4]['content'][0] = {'name' : 'name', 'type': 'text','readonly' : true};
columns[4]['content'][1] = {'name' : 'id', 'type': 'hidden'};
//end: unit
//begin: price_start
columns[5] = {
'name' : 'price_start',
'label' : 'Cena<br>początkowa',
'width' : 5,
'content' : new Array(),
'align' : 'right',
};
columns[5]['content'][0] = {'name' : '', 'type': 'text', 'isNumber' : true, 'onChange' : 'calculateRow($(this).parent(\'td\').parent(\'tr\').index());'};
columns[5]['content'][1] = {'name' : '_div', 'type': 'text'};
//end: price_start
//begin: discount
columns[6] = {
'name' : 'discount',
'label' : 'Upust<br.(%)',
'width' : 5,
'content' : new Array(),
'align' : 'right',
};
columns[6]['content'][0] = {'name' : '', 'type': 'text', 'isNumber' : true, 'onChange' : 'calculateRow($(this).parent(\'td\').parent(\'tr\').index());'};
//end: discount
//begin: price_netto
columns[7] = {
'name' : 'price_netto',
'label' : 'Cena<br>po upuście',
'width' : 5,
'content' : new Array(),
'align' : 'right',
};
columns[7]['content'][0] = {'name' : '', 'type': 'text', 'isNumber' : true, 'readonly' : true};
//end: price_start
//begin: ecmvat
columns[8] = {
'name' : 'ecmvat_',
'label' : 'VAT<br>(%)',
'width' : 5,
'content' : new Array(),
'align' : 'right',
};
columns[8]['content'][0] = {'name' : 'name', 'type': 'text'};
columns[8]['content'][1] = {'name' : 'value', 'type': 'hidden'};
columns[8]['content'][2] = {'name' : 'id', 'type': 'hidden'};
//end: ecmvat
//begin: total
columns[9] = {
'name' : 'total_',
'label' : 'Wartość',
'width' : 5,
'content' : new Array(),
'align' : 'right',
};
columns[9]['content'][0] = {'name' : 'netto', 'type': 'text', 'isNumber' : true, 'readonly' : true};
//end: total

View File

@@ -0,0 +1,116 @@
columns = new Array();
//define columns
//begin: number
columns[0] = {
'name' : 'number',
'label' : 'Lp.',
'width' : 4,
'content' : new Array(),
};
columns[0]['content'][0] = {'name' : '', 'type': 'text', 'readonly' : true};
//end: number
//begin: code
columns[1] = {
'name' : 'product_',
'label' : 'Indeks',
'width' : 6,
'content' : new Array(),
};
columns[1]['content'][0] = {'name' : 'code', 'type': 'hidden', 'readonly' : true};
columns[1]['content'][1] = {'name' : 'id', 'type': 'hidden'};
columns[1]['content'][2] = {'name' : 'link', 'type': 'text', 'readonly' : true};
columns[1]['content'][3] = {'name' : 'precision', 'type': 'hidden'};
columns[1]['content'][3] = {'name' : 'is_oo', 'type': 'hidden'};
//end: code
//begin: name
columns[2] = {
'name' : 'name',
'label' : 'Nazwa',
'width' : 20,
'onChange' : 'changeName($(this).parent(\'td\').parent(\'tr\').index());',
'content' : new Array(),
};
columns[2]['content'][0] = {'name' : '', 'type': 'text'};
//end: name
//begin: quantity
columns[3] = {
'name' : 'quantity',
'label' : 'Ilość<br>Rezerwacja',
'width' : 5,
'content' : new Array(),
'align' : 'right',
};
columns[3]['content'][0] = {'name' : '', 'type': 'text', 'isNumber' : true, 'onChange' : 'calculateRow($(this).parent(\'td\').parent(\'tr\').index());'};
columns[3]['content'][1] = {'name' : '_res', 'type': 'text', 'isNumber' : true, 'onChange' : 'calculateRow($(this).parent(\'td\').parent(\'tr\').index());'};
//end: quantity
//begin: unit
columns[4] = {
'name' : 'unit_',
'label' : 'J.M.',
'width' : 5,
'content' : new Array(),
'align' : 'center',
};
columns[4]['content'][0] = {'name' : 'name', 'type': 'text','readonly' : true};
columns[4]['content'][1] = {'name' : 'id', 'type': 'hidden'};
//end: unit
//begin: price_start
columns[5] = {
'name' : 'price_start',
'label' : 'Cena<br>pocz.',
'width' : 5,
'content' : new Array(),
'align' : 'right',
};
columns[5]['content'][0] = {'name' : '', 'type': 'text', 'isNumber' : true, 'onChange' : 'calculateRow($(this).parent(\'td\').parent(\'tr\').index());'};
columns[5]['content'][1] = {'name' : '_div', 'type': 'text'};
//end: price_start
//begin: discount
columns[6] = {
'name' : 'discount',
'label' : 'Upust (%)',
'width' : 5,
'content' : new Array(),
'align' : 'right',
};
columns[6]['content'][0] = {'name' : '', 'type': 'text', 'isNumber' : true, 'onChange' : 'calculateRow($(this).parent(\'td\').parent(\'tr\').index());'};
//end: discount
//begin: price_netto
columns[7] = {
'name' : 'price_netto',
'label' : 'Cena<br>po upuście',
'width' : 5,
'content' : new Array(),
'align' : 'right',
};
columns[7]['content'][0] = {'name' : '', 'type': 'text', 'isNumber' : true, 'readonly' : true};
//end: price_start
//begin: ecmvat
columns[8] = {
'name' : 'ecmvat_',
'label' : 'VAT (%)',
'width' : 5,
'content' : new Array(),
'align' : 'right',
};
columns[8]['content'][0] = {'name' : 'name', 'type': 'text'};
columns[8]['content'][1] = {'name' : 'value', 'type': 'hidden'};
columns[8]['content'][2] = {'name' : 'id', 'type': 'hidden'};
//end: ecmvat
//begin: total
columns[9] = {
'name' : 'total_',
'label' : 'Wartość',
'width' : 5,
'content' : new Array(),
'align' : 'right',
};
columns[9]['content'][0] = {'name' : 'netto', 'type': 'text', 'isNumber' : true, 'readonly' : true};
//end: total
//begin: options
columns[10] = {
'name' : 'options',
'label' : 'Opcje',
'width' : 3,
'content' : new Array(),
};

View File

@@ -0,0 +1,4 @@
var extraproductinfo_show=true; // info o produkcie
var unit_show=true; // jednostka produktu
var number_show=false; // numeruje wiersze
var module_function="EcmPrepaymentInvoices";

View File

@@ -0,0 +1,69 @@
(function ($) {
$.fn.enableCellNavigation = function () {
var arrow = { left: 37, up: 38, right: 39, down: 40 };
// select all on focus
this.find('input').keydown(function (e) {
// shortcut for key other than arrow keys
if ($.inArray(e.which, [arrow.left, arrow.up, arrow.right, arrow.down]) < 0) { return; }
var input = e.target;
var td = $(e.target).closest('td');
var moveTo = null;
switch (e.which) {
case arrow.left: {
if (input.selectionStart == 0) {
moveTo = td.prev('td:has(input,textarea)');
}
break;
}
case arrow.right: {
if (input.selectionEnd == input.value.length) {
moveTo = td.next('td:has(input,textarea)');
}
break;
}
case arrow.up:
case arrow.down: {
var tr = td.closest('tr');
var pos = td[0].cellIndex;
var moveToRow = null;
if (e.which == arrow.down) {
moveToRow = tr.next('tr');
}
else if (e.which == arrow.up) {
moveToRow = tr.prev('tr');
}
if (moveToRow.length) {
moveTo = $(moveToRow[0].cells[pos]);
}
break;
}
}
if (moveTo && moveTo.length) {
e.preventDefault();
moveTo.find('input,textarea').each(function (i, input) {
input.focus();
input.select();
});
}
});
};
})(jQuery);