2020-11-27 07:44:04 +00:00
|
|
|
$(document).ready(function(){
|
|
|
|
|
|
|
|
// --------------
|
|
|
|
//realtime calculation for credit account form
|
|
|
|
//console.log( parseFloat($("#formPaymentAmount").val()).toFixed(2) );
|
|
|
|
$("#globsicredit_chf").html( parseFloat($("#formPaymentAmount").val()).toFixed(2) );
|
|
|
|
$("#globsicredit_eur").html( parseFloat($("#formPaymentAmount").val() * 0.93).toFixed(2) );
|
|
|
|
$("#globsicredit_usd").html( parseFloat($("#formPaymentAmount").val() * 1.03).toFixed(2) );
|
|
|
|
|
|
|
|
$("#formPaymentAmount").change(function(){
|
|
|
|
$("#globsicredit_chf").html( parseFloat($("#formPaymentAmount").val()).toFixed(2) );
|
|
|
|
$("#globsicredit_eur").html( parseFloat($("#formPaymentAmount").val() * 0.93).toFixed(2) );
|
|
|
|
$("#globsicredit_usd").html( parseFloat($("#formPaymentAmount").val() * 1.03).toFixed(2) );
|
|
|
|
});
|
|
|
|
//ENDOF realtime calculation for credit account form
|
|
|
|
// --------------
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// --------------
|
|
|
|
// MISC
|
|
|
|
$('.modal').modal();
|
|
|
|
$('select').formSelect();
|
|
|
|
$('.sidenav').sidenav();
|
|
|
|
$('.parallax').parallax();
|
|
|
|
$('.datepicker').datepicker({
|
|
|
|
'autoClose': true,
|
|
|
|
'format': 'yyyy-mm-dd',
|
|
|
|
});
|
|
|
|
//ENDOF MISC
|
|
|
|
// --------------
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// --------------
|
|
|
|
//tablesorter
|
|
|
|
$("table")
|
|
|
|
.tablesorter({
|
|
|
|
//REM: widgets are treated in this priority: uitheme, saveSort, columns, resizable, filter, pager widget, stickyHeaders, zebra, pager plugin
|
|
|
|
widgets: ["filter", "uitheme"],
|
|
|
|
//widgetOptions: {
|
|
|
|
// columns_tfoot: true
|
|
|
|
//}
|
|
|
|
})
|
|
|
|
.tablesorterPager({
|
|
|
|
container: $(".ts-pager"),
|
|
|
|
cssGoto : ".pagenum",
|
|
|
|
removeRows: true,
|
|
|
|
output: '{startRow} - {endRow} / {filteredRows} ({totalRows})'
|
|
|
|
});
|
|
|
|
//ENDOF tablesorter
|
|
|
|
// --------------
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// --------------
|
|
|
|
// When the customer enter his credit card number, add spaces between the 4 digits groups
|
|
|
|
function separate_by_4(){
|
|
|
|
var card_number = $(this).val();
|
|
|
|
card_number = card_number.replace(/\s/g,'').replace(/(\d{4})/g, '$1 ');
|
|
|
|
$(this).val(card_number);
|
|
|
|
}
|
|
|
|
$("#formCreditCardPaymentNumber").keypress(separate_by_4);
|
|
|
|
$("#formCreditCardPaymentNumber").change(separate_by_4);
|
|
|
|
//ENDOF When the customer enter his credit card number, add spaces between the 4 digits groups
|
|
|
|
// --------------
|
|
|
|
|
|
|
|
|
|
|
|
// --------------
|
|
|
|
// Every X seconds, refresh globsi credit amount. (if the slot to display it is available only)
|
|
|
|
function refresh_globsi_credit(){
|
|
|
|
$.getJSON(
|
|
|
|
urlRoot + "scripts/getGlobsiCredit.php",
|
|
|
|
function(data){
|
|
|
|
$('#globsi_credit_amount').html(data);
|
|
|
|
$('#globsi_credit').removeClass('hidden');
|
|
|
|
$('#globsi_credit_amount_menu_collapsed').html(data);
|
|
|
|
$('#globsi_credit_menu_collapsed').removeClass('hidden');
|
|
|
|
}
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
if($('#globsi_credit').length > 0){
|
|
|
|
refresh_globsi_credit();
|
|
|
|
setInterval(refresh_globsi_credit, 10000); // The interval set to 30 seconds
|
|
|
|
}
|
|
|
|
//ENDOF Every X seconds, refresh globsi credit amount. (if the slot to display it is available only)
|
|
|
|
// --------------
|
2019-11-03 18:23:06 +00:00
|
|
|
|
2020-11-27 07:44:04 +00:00
|
|
|
}); // end of document ready
|