function go(url) { window.location = url; } function goBack() { window.history.back(); } function deleteRecord(url) { var isOK = confirm("Θέλετε σίγουρα να διαγράψετε την επιλεγμένη εγγραφή;"); if(isOK) { go(url); } } function clearFormAndResults(form) { clearForm(form); $('#searchResultsHeader').remove(); $('.pagebanner').remove(); $('#searchResults').remove(); $('#noResultsFound').remove(); $('#resultsDiv').remove(); } function clearForm(form) { // iterate over all of the inputs for the form // element that was passed in $(':input', form).each(function() { var type = this.type; var tag = this.tagName.toLowerCase(); // normalize case // it's ok to reset the value attr of text inputs, // password inputs, and textareas if (type == 'text' || type == 'password' || tag == 'textarea') this.value = ""; // checkboxes and radios need to have their checked state cleared // but should *not* have their 'value' changed else if (type == 'checkbox' || type == 'radio') this.checked = false; // select elements need to have their 'selectedIndex' property set to -1 // (this works for both single and multiple select elements) else if (tag == 'select') this.selectedIndex = 0; }); $('#showError').hide(); }; function clearEmailResendForm(form) { // iterate over all of the inputs for the form // element that was passed in $(':input', form).each(function() { var type = this.type; var tag = this.tagName.toLowerCase(); // normalize case // it's ok to reset the value attr of text inputs, // password inputs, and textareas if (type == 'text' || type == 'password' || tag == 'textarea') this.value = ""; // checkboxes and radios need to have their checked state cleared // but should *not* have their 'value' changed else if (type == 'checkbox') this.checked = true; else if (type == 'radio'){ if(this.value == 0) this.checked = true; else this.checked = false; } // select elements need to have their 'selectedIndex' property set to -1 // (this works for both single and multiple select elements) else if (tag == 'select') this.selectedIndex = 0; }); $('#showError').hide(); }; function createViewConfirmDialog(form) { $("#diag-conf").dialog({ autoOpen : false, resizable : false, draggable : true, height : 180, width : 410, // title:'Επιβεβαίωση Ενέργειας', modal : true, buttons : [{ text : $('#languageId').val() == 1 ? "Ναι" : "Yes", click : function() { $(this).dialog('close'); form.submit(); }, }, { text : $('#languageId').val() == 1 ? "Ακύρωση" : "Cancel", click : function() { $(this).dialog("close"); }, }] }); } /* * --------------------------------------------------------- Refund popup * Initial KAE Amounts Validation * --------------------------------------------------------- */ $(function(){ $('.tablecssSmall input').change(function(){ var resMsg = new String(""); $("div#error-msg").html(resMsg); $('#error-msg').show(); $(this).siblings(".error").show(); }else{ $('#error-msg').hide(); $(this).siblings(".error").hide(); } var total=0; $("input[id^=price]").each(function() { $(this).val($(this).val().replace(/,/g,".")); var number = parseFloat(this.value) || 0; total += number; }); refundPrice.value = parseFloat(total).toFixed(2); }else{ resMsg = resMsg.concat("
  • Παρακαλώ εισάγετε ένα έγκυρο ποσό Μερικής Επιστροφής (με 2 δεκαδικά ψηφία)
  • "); $("div#error-msg").html(resMsg); $('#error-msg').show(); $(this).siblings(".error").show(); } }); }); /* --------------------------------------------------------- * Refund popup creation * --------------------------------------------------------- */ function createRefundConfirmDialog(form) { $("#diag-refund").dialog({ autoOpen:false, resizable:false, draggable:true, width:580, modal:true, buttons: [{ text: $('#languageId').val() == 1 ? "Καταχώρηση" : "Submit", click: function() { if(validateRefundPopup()) { document.getElementById('viewPostForm').action = "view.htm"; document.getElementById('viewPostForm').submit(); $(this).dialog('close'); } } },{ text: $('#languageId').val() == 1 ? "Κλείσιμο" : "Close", click: function () { $(this).dialog("close"); } } ] /* buttons:{ "Καταχώρηση":function(){ if(validateRefundPopup()){ document.getElementById('viewPostForm').action = "view.htm"; document.getElementById('viewPostForm').submit(); $(this).dialog('close'); } }, "Ακύρωση":function(){ $(this).dialog("close"); } } */ }); } ///* --------------------------------------------------------- // * Cancel Refund popup creation // * --------------------------------------------------------- // */ function createCancelRefundConfirmDialog(form){ $("#cancel-refund").dialog({ autoOpen:false, resizable:false, draggable:true, width:580, modal:true, buttons: [{ text: $('#languageId').val() == 1 ? "Καταχώρηση" : "Submit", click: function() { if(validateCancelRefundPopUp()){ document.getElementById('viewPostForm').action = "viewRefundCancel.htm"; document.getElementById('viewPostForm').submit(); $(this).dialog('close'); } } },{ text: $('#languageId').val() == 1 ? "Ακύρωση" : "Cancel", click: function () { $(this).dialog("close"); } } ] }); } /* --------------------------------------------------------- * Refund Popup submit * --------------------------------------------------------- */ function submitRefundPopup(form){ var checkbox = document.getElementById('refundAllCheck'); var refundPrice = document.getElementById('refundPriceInput'); var paravTypeInput = document.getElementById('paravTypePriceInput'); checkbox.checked = true; refundPrice.disabled = true; refundPrice.value = paravTypeInput.value; $('#partKaeTable').hide(); createRefundConfirmDialog(form); $("#diag-refund").dialog({ open: function() { $(this).parent().appendTo("form:first"); $(this).siblings('.ui-dialog-buttonpane').find('button:eq(1)').focus(); $('#error-msg').hide(); } }); $('#diag-refund').dialog('open'); } /* --------------------------------------------------------- * Refund popup generic validator * --------------------------------------------------------- */ function validateRefundPopup() { var checkbox = document.getElementById('refundAllCheck'); var paravTypePrice = $("input#paravTypePriceInput").val(); var refundPrice = $("input#refundPriceInput").val(); var reasonTxt = $("textarea#reason").val(); var resMsg = new String(""); $("div#error-msg").html(resMsg); $('#error-msg').show(); return false; } return(true); } function validateCancelRefundPopUp() { var reason = $("#cancel-reason").val(); console.log(reason); var resMsg = new String(""); $("div#cancel-refund-error").html(resMsg); $('#cancel-refund-error').show(); return false; } return(true); } function checkBeforeSubmit(form){ var foreas = document.getElementById('foreasId'); var foreasId = foreas.options[foreas.selectedIndex].value; var categ = document.getElementById('categoryId'); var categId = categ.options[categ.selectedIndex].value; if(foreasId!="" && categId!=""){ form.submit(); } else{ showErrorNotAllFilledDialog(); } } function checkForeasBeforeSubmit(form){ var foreas = document.getElementById('foreasId'); var foreasId = foreas.options[foreas.selectedIndex].value; if(foreasId!=""){ form.submit(); } else{ showErrorNotAllFilledDialog(); } } function submitPliromesKaeSearch(form){ var month = document.getElementById("monthDate"); if(isEmpty(month)){ mandatoryFieldCheckDialog(); }else{ $("#show-logistikopoihsh-status").css("display", "block"); form.submit(); } } function submitShowLogistikopoihsh(form){ var month = document.getElementById("monthDate"); if(isEmpty(month)){ mandatoryFieldCheckDialog(); }else{ document.getElementById('manualLogistikopoihshForm').action = "showMonthlyLogistikopoihsh.htm"; form.submit(); } } // TEMP FUNCTION -- TODO CHANGE NAME function submitPliromesKaeSearchTest(form) { var month = document.getElementById("monthDate"); if(isEmpty(month)){ mandatoryFieldCheckDialog(); }else{ form.submit(); } } function submitPliromesKaeProcedure(form){ document.getElementById('pliromesKaeForm').action = "pliromesKaeFormProcedure.htm"; createViewConfirmDialog(form); $("#diag-conf").dialog({ open: function() { $(this).siblings('.ui-dialog-buttonpane').find('button:eq(1)').focus(); } }); $('#diag-conf').dialog('open'); } function submitConfirm(form){ createViewConfirmDialog(form); $("#diag-conf").dialog({ open: function() { $(this).siblings('.ui-dialog-buttonpane').find('button:eq(1)').focus(); } }); $('#diag-conf').dialog('open'); } function notSameTaxisNetUserCheckDialog() { $("#notSameTaxisNetUserDialog").dialog({ autoOpen:false, resizable:false, draggable:true, width:370, title: $('#languageId').val() == 1 ? "Μήνυμα" : "Message", modal:true, buttons: [{ text: $('#languageId').val() == 1 ? "Κλείσιμο" : "Close", click: function () { $(this).dialog("close"); } }] /* buttons: { langid: function() { $(this).dialog("close"); } } */ }); $('#notSameTaxisNetUserDialog').dialog('open'); } function mandatoryFieldCheckDialog(){ $("#diag-mandatory").dialog({ autoOpen:false, resizable:false, draggable:true, height:180, width:410, title:'Υποχρεωτικό Πεδίο', modal:true, buttons:{ "Κλείσιμο":function(){ $(this).dialog("close"); } } }); $('#diag-mandatory').dialog('open'); } function performActionSelect(form){ var sel = document.getElementById("selectedVal"); var selectOptionTextVal = $('#selectedVal option').text(); var value = sel.options[sel.selectedIndex].value; if(value == "3:3" && selectOptionTextVal === 'ΑΚΥΡΩΣΗ ΕΠΙΣΤΡΟΦΗΣ ΧΡΗΜΑΤΩΝ') { //document.getElementById('viewPostForm').action = "viewRefundCancel.htm"; //submitConfirm(form); createCancelRefundConfirmDialog(form); $("#cancel-refund").dialog({ open: function() { $(this).parent().appendTo("form:first"); $(this).siblings('.ui-dialog-buttonpane').find('button:eq(1)').focus(); $('#cancel-refund-error').hide(); } }); $('#cancel-refund').dialog('open'); } else if(value == "3:3"){ var paravId = document.getElementById('paravId').value; var paravCode = document.getElementById('paravCode').value; $.post('checkPreRefundProcess.htm', { id: paravId, paravCode: paravCode }, function(data) { var s = data.indexOf('###'); var e = data.indexOf('???'); var v = data.slice(s + 3, e); var $response=$(v); var returnedValue = $response.find('#refundId').val(); //Check if Refund Has been performed if(returnedValue !== undefined){ //Submit form to display resultMsg byPassing refund Popup document.getElementById('viewPostForm').action = "view.htm"; document.forms['viewPostForm'].submit(); }else{ //Refund Has been made submitRefundPopup(form); } }); } else{ document.getElementById('viewPostForm').action = "view.htm"; submitConfirm(form); } } function performPliromesKaeAction(form){ var sel = document.getElementById("selectedVal"); var value = sel.options[sel.selectedIndex].value; $.post('checkPreRefundProcess.htm', { id: paravId, paravCode: paravCode }, function(data) { var s = data.indexOf('###'); var e = data.indexOf('???'); var v = data.slice(s + 3, e); var $response=$(v); var returnedValue = $response.find('#refundId').val(); //Check if Refund Has been performed if(returnedValue !== undefined){ //Submit form to display resultMsg byPassing refund Popup document.getElementById('viewPostForm').action = "view.htm"; document.forms['viewPostForm'].submit(); }else{ //Refund Has been made submitRefundPopup(form); } }); } function revokeConfirmDialog(url){ $("#diag-conf").dialog({ autoOpen:false, resizable:false, draggable:true, height:186, width:410, title:'Επιβεβαίωση Ανάκλησης Αρχέιου Πληρωμών', modal:true, buttons:{ "Ναι":function(){ $(this).dialog('close'); go(url); }, "Ακύρωση":function(){ $(this).dialog("close"); } } }); } function openInvalidPosoDialog(message, title) { $("#posoDialog").dialog({ autoOpen:false, resizable:false, draggable:true, height:215, width:410, title: title, modal:true, buttons: [{ text: $('#languageId').val() == 1 ? "Κλείσιμο" : "Close", click: function () { $(this).dialog("close"); } }] /* buttons:{ "Κλείσιμο":function(){ $(this).dialog("close"); } } */ }); $("#dialogMessage").html(message); $('#posoDialog').dialog('open'); } function goRevokeConfirm(url){ revokeConfirmDialog(url); $("#diag-conf").dialog({ open: function() { $(this).siblings('.ui-dialog-buttonpane').find('button:eq(1)').focus(); } }); $('#diag-conf').dialog('open'); } function goDeleteConfirm(url){ $("#diag-conf").dialog({ autoOpen:false, resizable:false, draggable:true, height:186, width:410, title:'Επιβεβαίωση Διαγραφής', modal:true, buttons:{ "Ναι":function(){ $(this).dialog('close'); go(url); }, "Ακύρωση":function(){ $(this).dialog('close'); } } }); $("#diag-conf").dialog({ data: "test", open: function() { $(this).siblings('.ui-dialog-buttonpane').find('button:eq(1)').focus(); } }); $('#diag-conf').dialog('open'); } function createRefundAllDialog(url){ $("#ref-conf").dialog({ autoOpen:false, resizable:false, draggable:true, height:186, width:410, title:'Επιβεβαίωση Ενέργειας', modal:true, buttons:{ "Ναι":function(){ $(this).dialog('close'); console.log(url); go(url); }, "Ακύρωση":function(){ $(this).dialog('close'); } } }); } function goRefundConfirm(url){ createRefundAllDialog(url); $("#ref-conf").dialog({ data: "test", open: function() { $(this).siblings('.ui-dialog-buttonpane').find('button:eq(1)').focus(); } }); $('#ref-conf').dialog('open'); } function goInsertUpdateConfirm(form){ $("#diag-conf").dialog({ autoOpen:false, resizable:false, draggable:true, height:186, width:410, title:'Επιβεβαίωση Ενέργειας', modal:true, buttons:{ "Ναι":function(){ $(this).dialog('close'); form.submit(); }, "Ακύρωση":function(){ $(this).dialog('close'); } } }); $("#diag-conf").dialog({ data: "test", open: function() { $(this).siblings('.ui-dialog-buttonpane').find('button:eq(1)').focus(); } }); $('#diag-conf').dialog('open'); } function showRefundSuccessPopup(){ $("#refundPopup").dialog({ autoOpen:false, resizable:false, draggable:true, height:186, width:410, title:'Αποδοχή αιτήματος Επιστροφής Χρημάτων', modal:true, buttons:{ "Κλείσιμο":function(){ $(this).dialog('close'); } } }); $('#refundPopup').dialog('open'); } function showNotBoundPopup(){ $("#diag-bound").dialog({ autoOpen:false, resizable:false, draggable:true, height:226, width:410, title:'Αδυναμία Δέσμευσης Παραβόλού', modal:true, buttons:{ "Κλείσιμο":function(){ $(this).dialog('close'); } } }); $('#diag-bound').dialog('open'); } function showErrorNotAllFilledDialog(){ $("#error-dialog").dialog({ autoOpen:false, resizable:false, draggable:true, height:210, width:410, title:'Υποχρεωτικά Πεδία Αναζήτησης', modal:true, buttons:{ "Κλείσιμο":function(){ $(this).dialog('close'); } } }); $('#error-dialog').dialog('open'); } function IsNumeric(input){ var REX = /^(\d+(?:[\.\,]\d{0,2})?)$/; return REX.test(input); } function checkPosoBeforeSubmit(){ var zeroNum = 0.01; var posoInput = document.getElementById("inputPrice"); var pr = document.getElementById("paravPrice"); if(posoInput != null){ var posoVal = posoInput.value; var modelPrice = pr.value; if(IsNumeric(posoVal)){ var newVal = posoVal.replace(/\,/g,"."); if(newVal >= zeroNum){ document.getElementById("inputPrice").value = newVal; document.getElementById("paravPrice").value = newVal; return true; }else{ // var message1 = "Το Ποσό του Μεταβλητού Παραβόλου πρέπει να είναι μη μηδενικός ακέραιος ή δεκαδικός αριθμός (πχ. 5.53 με δύο δεκαδικά ψηφία)"; // var title1 = "Υποχρεωτικό Πεδίο"; var message1 = $('#languageId').val() == 1 ? "Το Ποσό του Μεταβλητού Παραβόλου πρέπει να είναι μη μηδενικός ακέραιος ή δεκαδικός αριθμός (πχ. 5.53 με δύο δεκαδικά ψηφία)" : "The variable amount for the e-Paravolo must be a non-zero integer or decimal number (eg 5.53 with two decimal places)"; var title1 = $('#languageId').val() == 1 ? "Υποχρεωτικό Πεδίο" : "Required field"; openInvalidPosoDialog(message1, title1); return false; } }else if (posoVal==""){ // var message1 = "Το Ποσό του Μεταβλητού Παραβόλου πρέπει να είναι μη μηδενικός ακέραιος ή δεκαδικός αριθμός (πχ. 5.53 με δύο δεκαδικά ψηφία)"; // var title1 = "Υποχρεωτικό Πεδίο"; var message1 = $('#languageId').val() == 1 ? "Το Ποσό του Μεταβλητού Παραβόλου πρέπει να είναι μη μηδενικός ακέραιος ή δεκαδικός αριθμός (πχ. 5.53 με δύο δεκαδικά ψηφία)" : "The variable amount for the e-Paravolo must be a non-zero integer or decimal number (eg 5.53 with two decimal places)"; var title1 = $('#languageId').val() == 1 ? "Υποχρεωτικό Πεδίο" : "Required field"; $("#errorMessage").html("Υποχρεωτικό Πεδίο"); $('.error').show(); openInvalidPosoDialog(message1, title1); return false; }else{ // var message2 = "Παρακαλώ εισάγετε ένα έγκυρο Ποσό για το Μεταβλητό Παράβολο που επιλέξατε, προκειμένου να προχωρήσετε στην διαδικασία καταχώρησης." // var title2 = "Λανθασμένο Ποσό Μεταβλητού Παραβόλου"; var message2 = $('#languageId').val() == 1 ? "Παρακαλώ εισάγετε ένα έγκυρο Ποσό για το Μεταβλητό Παράβολο που επιλέξατε, προκειμένου να προχωρήσετε στην διαδικασία καταχώρησης." :"Please type a valid Amount for the variable amount e-Paravolo you choose, in order to proceed with the submission process"; var title2 = $('#languageId').val() == 1 ? "Λανθασμένο Ποσό Μεταβλητού Παραβόλου" : "Wrong variable amount for e-Paravolo"; openInvalidPosoDialog(message2, title2); return false; } } } function edValueKeyPress() { var edValue = document.getElementById("inputPrice"); var data = edValue.value; var zeroNum = 0.01; var maxPrice = 3000000; if(IsNumeric(data)){ var newVal = data.replace(/\,/g,"."); if(newVal >= zeroNum && newVal <= maxPrice){ $('.error').hide(); }else{ $("#errorMessage").html("Λανθασμένο Ποσό (από 0.01 έως 3000000)"); $('.error').show(); } }else if (data == ""){ $("#errorMessage").html("Υποχρεωτικό Πεδίο"); $('.error').show(); }else{ $("#errorMessage").html("Λανθασμένο Ποσό"); $('.error').show(); } } function showVarPriceInfo(){ var langid = $('#languageId').val(); var priceInfoMessage = ''; var imageURL=""; if (langid === "1") { priceInfoMessage = "Εισάγετε ποσό με δυο δεκαδικά ψηφία"; } else { priceInfoMessage = "Enter an amount with two decimal places"; } var newHTML = imageURL+"" + priceInfoMessage + ""; if($('#inputPrice').is(':visible')) { $("#showPriceInfo").html(newHTML); $("#showPriceInfo").show(); }else{ $("#showPriceInfo").hide(); } } function isEmpty(testVar){ if ((testVar.value.length==0) || (testVar.value==null)){ return true; }else{ return false; } }