//Create Select from JSON
function addSelect(field,data,selected) {
$("#"+field).html("");
$(data).each( function (i,v){
var sel="";
//console.log(v.value+" <> "+selected);
if (v.value == selected) {
sel="selected='selected'";
}
$("#"+field).append("");
});
}
//Popups
function forecast_popup (t) {
$("#popup-content").html("");
$("#popuploader").css("display","block");
//Hier noch der Ajax-Aufruf
$.ajax({
url: 'view-admin-forecast-confirm-popup',
data: {office_id : t.attr("data-office_id"),
office_code : t.attr("data-office_code"),
forecast_pt_id : t.attr("data-forecast_pt_id"),
type : t.attr("data-type")
},
type: "POST",
dataType: "html",
success: function(response) {
$("#popup-content").html(response);
$.magnificPopup.open({
closeBtnInside: false,
showCloseBtn: false,
removalDelay: 300,
mainClass: 'mfp-fade',
modal: true,
items: {
src: $("#modalpopup"),
type: 'inline'
}
});
initDatepicker();
$(".popup-modal-dismiss").on('click', function (e) {
e.preventDefault();
$.magnificPopup.close();
});
}
});
}
function shipment_popup (t) {
$("#popup-content").html("");
$("#popuploader").css("display","block");
//Hier noch der Ajax-Aufruf
$.ajax({
url: 'view-shipment-details-popup',
data: {delivery_id : t.attr("data-delivery_id"),
details_id : t.attr("data-details_id"),
trade_id : t.attr("data-trade_id"),
shipmentdocs : t.attr("data-shipmentdocs")
},
type: "POST",
dataType: "html",
success: function(response) {
$("#popup-content").html(response);
$.magnificPopup.open({
closeBtnInside: false,
showCloseBtn: false,
removalDelay: 300,
mainClass: 'mfp-fade',
modal: true,
items: {
src: $("#modalpopup"),
type: 'inline'
}
});
initDatepicker();
$(".popup-modal-dismiss").on('click', function (e) {
e.preventDefault();
$.magnificPopup.close();
});
}
});
}
function pdirecord_popup (t) {
$("#popup-content").html("");
$("#popuploader").css("display","block");
//Hier noch der Ajax-Aufruf
$.ajax({
url: 'view-pdirecord-popup',
data: {stock_id : t.attr("data-stock_id")
},
type: "POST",
dataType: "html",
success: function(response) {
$("#popup-content").html(response);
$.magnificPopup.open({
closeBtnInside: false,
showCloseBtn: false,
removalDelay: 300,
mainClass: 'mfp-fade',
modal: true,
items: {
src: $("#modalpopup"),
type: 'inline'
}
});
initDatepicker();
$(".popup-modal-dismiss").on('click', function (e) {
e.preventDefault();
$.magnificPopup.close();
});
}
});
}
var check_payment_trigger;
function payment_popup (t) {
$("#popup-content").html("");
$("#popuploader").css("display","block");
//Hier noch der Ajax-Aufruf
$.ajax({
url: 'view_accounting_payment_popup',
data: {accounting_id : t.attr("data-accounting_id"),
invoice_id : t.attr("data-invoice_id"),
payment_id : t.attr("data-payment_id")
},
type: "POST",
dataType: "html",
success: function(response) {
$("#popup-content").html(response);
$.magnificPopup.open({
closeBtnInside: false,
showCloseBtn: false,
removalDelay: 300,
mainClass: 'mfp-fade',
modal: true,
items: {
src: $("#modalpopup"),
type: 'inline'
}
});
initDatepicker();
$(".popup-modal-dismiss").on('click', function (e) {
e.preventDefault();
$.magnificPopup.close();
});
}
});
}
var check_logistic_payment_trigger;
function logistic_payment_popup (t) {
$("#popup-content").html("");
$("#popuploader").css("display","block");
//Hier noch der Ajax-Aufruf
$.ajax({
url: 'view_logistic_payment_popup',
data: {invoice_type : t.attr("data-invoice_type"),
invoice_id : t.attr("data-invoice_id"),
payment_id : t.attr("data-payment_id")
},
type: "POST",
dataType: "html",
success: function(response) {
$("#popup-content").html(response);
$.magnificPopup.open({
closeBtnInside: false,
showCloseBtn: false,
removalDelay: 300,
mainClass: 'mfp-fade',
modal: true,
items: {
src: $("#modalpopup"),
type: 'inline'
}
});
initDatepicker();
$(".popup-modal-dismiss").on('click', function (e) {
e.preventDefault();
$.magnificPopup.close();
});
}
});
}
var check_invoice_trigger;
function invoice_popup (t) {
$("#popup-content").html("");
$("#popuploader").css("display","block");
//Hier noch der Ajax-Aufruf
$.ajax({
url: 'view_accounting_invoice_popup',
data: {trade_id : t.attr("data-tradeid"),
invoice_id : t.attr("data-invoiceid"),
is_prepayment : t.attr("data-isprepayment")
},
type: "POST",
dataType: "html",
success: function(response) {
$("#popup-content").html(response);
$.magnificPopup.open({
closeBtnInside: false,
showCloseBtn: false,
removalDelay: 300,
mainClass: 'mfp-fade',
modal: true,
items: {
src: $("#modalpopup"),
type: 'inline'
}
});
initDatepicker();
$(".popup-modal-dismiss").on('click', function (e) {
e.preventDefault();
$.magnificPopup.close();
});
}
});
}
var check_log_invoice_trigger;
function log_invoice_popup (t) {
$("#popup-content").html("");
$("#popuploader").css("display","block");
//Hier noch der Ajax-Aufruf
$.ajax({
url: 'view_logistic_invoice_popup',
data: {mode : t.attr("data-mode"),
container_id : t.attr("data-containerid"),
delivery_id : t.attr("data-deliveryid"),
invoice_id : t.attr("data-invoiceid")
},
type: "POST",
dataType: "html",
success: function(response) {
$("#popup-content").html(response);
$.magnificPopup.open({
closeBtnInside: false,
showCloseBtn: false,
removalDelay: 300,
mainClass: 'mfp-fade',
modal: true,
items: {
src: $("#modalpopup"),
type: 'inline'
}
});
initDatepicker();
$(".popup-modal-dismiss").on('click', function (e) {
e.preventDefault();
if (check_log_invoice_trigger) {
check_log_invoice_trigger.parent().parent().next().find('.jtable-child-table-container').jtable('reload');
}
$.magnificPopup.close();
});
}
});
}
function third_party_popup(t) {
$("#popup-content").html("");
$("#popuploader").css("display","block");
//Hier noch der Ajax-Aufruf
$.ajax({
url: 'view_addthirdpartypart_popup',
data: {},
type: "POST",
dataType: "html",
success: function(response) {
$("#popup-content").html(response);
$.magnificPopup.open({
closeBtnInside: false,
showCloseBtn: false,
removalDelay: 300,
mainClass: 'mfp-fade',
modal: true,
items: {
src: $("#modalpopup"),
type: 'inline'
}
});
$(".popup-modal-dismiss").on('click', function (e) {
e.preventDefault();
$.magnificPopup.close();
});
}
});
}
function office_popup(t) {
$("#popup-content").html("");
$("#popuploader").css("display","block");
//Hier noch der Ajax-Aufruf
$.ajax({
url: 'view_office_popup',
data: {office_id : t.attr("data-officeid"),
office_type : t.attr("data-officetype")
},
type: "POST",
dataType: "html",
success: function(response) {
$("#popup-content").html(response);
$.magnificPopup.open({
closeBtnInside: false,
showCloseBtn: false,
removalDelay: 300,
mainClass: 'mfp-fade',
modal: true,
items: {
src: $("#modalpopup"),
type: 'inline'
}
});
$(".popup-modal-dismiss").on('click', function (e) {
e.preventDefault();
$.magnificPopup.close();
});
$('.open_user_popup').on('click', function (event) {
event.preventDefault();
user_popup($(this));
});
}
});
}
function qc_popup (t) {
$("#popup-content").html("");
$("#popuploader").css("display","block");
//Hier noch der Ajax-Aufruf
$.ajax({
url: 'view_qc_rf_popup',
data: {qc_id : t.attr("data-id"),
is_qcc : t.attr("data-isqcc"),
is_lot : t.attr("data-islot"),
transfer_id : t.attr("data-transferid"),
office_id : t.attr("data-officeid"),
office_type : t.attr("data-officetype")
},
type: "POST",
dataType: "html",
success: function(response) {
$("#popup-content").html(response);
$.magnificPopup.open({
closeBtnInside: false,
showCloseBtn: false,
removalDelay: 300,
mainClass: 'mfp-fade',
modal: true,
items: {
src: $("#modalpopup"),
type: 'inline'
}
});
$(".popup-modal-dismiss").on('click', function (e) {
e.preventDefault();
$.magnificPopup.close();
});
$('.open_qc2').on('click', function (event) {
event.preventDefault();
qc_popup($(this));
});
$('.open_popup').on('click', function (event) {
event.preventDefault();
part_popup($(this));
});
$('.open_office_popup').on('click', function (event) {
event.preventDefault();
office_popup($(this));
});
}
});
}
function rf_popup (t) {
$("#popup-content").html("");
$("#popuploader").css("display","block");
//Hier noch der Ajax-Aufruf
$.ajax({
url: 'view_qc_rf_popup',
data: {rf_id : t.attr("data-id"),
transfer_id : t.attr("data-transferid")
},
type: "POST",
dataType: "html",
success: function(response) {
$("#popup-content").html(response);
$.magnificPopup.open({
closeBtnInside: false,
showCloseBtn: false,
removalDelay: 300,
mainClass: 'mfp-fade',
modal: true,
items: {
src: $("#modalpopup"),
type: 'inline'
}
});
$(".popup-modal-dismiss").on('click', function (e) {
e.preventDefault();
$.magnificPopup.close();
});
}
});
}
function reception_pallet_popup (t) {
$("#popup-content").html("");
$("#popuploader").css("display","block");
//Hier noch der Ajax-Aufruf
$.ajax({
url: 'view_reception_pallet_popup',
data: {pallet_id : t.attr("data-pallet_id"),
is_outsourced : t.attr("data-is_outsourced")
},
type: "POST",
dataType: "html",
success: function(response) {
$("#popup-content").html(response);
$.magnificPopup.open({
closeBtnInside: false,
showCloseBtn: false,
removalDelay: 300,
mainClass: 'mfp-fade',
modal: true,
items: {
src: $("#modalpopup"),
type: 'inline'
}
});
$(".popup-modal-dismiss").on('click', function (e) {
e.preventDefault();
$.magnificPopup.close();
});
}
});
}
function delivery_complete_popup (deliv_id) {
$("#popup-content-small").html("");
$("#popuploader").css("display","block");
//Hier noch der Ajax-Aufruf
$.ajax({
url: 'view_delivery_complete_popup',
data: {delivery_id : deliv_id
},
type: "POST",
dataType: "html",
success: function(response) {
$("#popup-content-small").html(response);
console.log(response);
$.magnificPopup.open({
closeBtnInside: false,
showCloseBtn: false,
removalDelay: 300,
mainClass: 'mfp-fade',
modal: true,
items: {
src: $("#modalpopup-small"),
type: 'inline'
}
});
$(".popup-modal-dismiss").on('click', function (e) {
e.preventDefault();
$.magnificPopup.close();
});
}
});
}
function blocked_pallet_popup (t) {
$("#popup-content").html("");
$("#popuploader").css("display","block");
//Hier noch der Ajax-Aufruf
$.ajax({
url: 'view_blocked_pallet_popup',
data: {pallet_id : t.attr("data-pallet_id")
},
type: "POST",
dataType: "html",
success: function(response) {
$("#popup-content").html(response);
$.magnificPopup.open({
closeBtnInside: false,
showCloseBtn: false,
removalDelay: 300,
mainClass: 'mfp-fade',
modal: true,
items: {
src: $("#modalpopup"),
type: 'inline'
}
});
$(".popup-modal-dismiss").on('click', function (e) {
e.preventDefault();
$.magnificPopup.close();
});
}
});
}
var check_pallet_trigger;
function check_pallet_popup (t) {
$("#popup-content").html("");
$("#popuploader").css("display","block");
//Hier noch der Ajax-Aufruf
$.ajax({
url: 'view_check_pallet_popup',
data: {pallet_id : t.attr("data-pallet_id")
},
type: "POST",
dataType: "html",
success: function(response) {
$("#popup-content").html(response);
$.magnificPopup.open({
closeBtnInside: false,
showCloseBtn: false,
removalDelay: 300,
mainClass: 'mfp-fade',
modal: true,
items: {
src: $("#modalpopup"),
type: 'inline'
}
});
$(".popup-modal-dismiss").on('click', function (e) {
e.preventDefault();
$.magnificPopup.close();
});
}
});
}
function part_popup (t,nab) {
$("#popup-content").html("");
$("#popuploader").css("display","block");
//Hier noch der Ajax-Aufruf
$.ajax({
url: 'view_part_popup',
data: {part_id : t.attr("data-id"),
revision : t.attr("data-revision"),
no_add_basket : nab
},
type: "POST",
dataType: "html",
success: function(response) {
$("#popup-content").html(response);
$.magnificPopup.open({
closeBtnInside: false,
showCloseBtn: false,
removalDelay: 300,
mainClass: 'mfp-fade',
modal: true,
items: {
src: $("#modalpopup"),
type: 'inline'
}
});
$(".popup-modal-dismiss").on('click', function (e) {
e.preventDefault();
$.magnificPopup.close();
});
$(".open_popup_part").on('click', function (e) {
e.preventDefault();
$.magnificPopup.close();
});
$('.open_popup_sce2').on('click', function (event) {
event.preventDefault();
$("#popup-content").html("");
$("#popuploader").css("display","block");
//Hier noch der Ajax-Aufruf
$.ajax({
url: 'view_scenario_popup',
data: {part_id : t.attr("data-id")
},
type: "POST",
dataType: "html",
success: function(response) {
$("#popup-content").html(response);
$.magnificPopup.open({
closeBtnInside: false,
showCloseBtn: false,
removalDelay: 300,
mainClass: 'mfp-fade',
modal: true,
items: {
src: $("#modalpopup"),
type: 'inline'
}
});
$(".popup-modal-dismiss").on('click', function (e) {
e.preventDefault();
$.magnificPopup.close();
});
}
});
});
$('.change_revision').on('click', function (event) {
event.preventDefault();
part_popup($(this),1);
});
}
});
}
function user_popup (t) {
$("#popup-content").html("");
$("#popuploader").css("display","block");
//Hier noch der Ajax-Aufruf
$.ajax({
url: 'view_profile_popup',
data: {user_id : t.attr("data-userid")
},
type: "POST",
dataType: "html",
success: function(response) {
$("#popup-content").html(response);
$.magnificPopup.open({
closeBtnInside: false,
showCloseBtn: false,
removalDelay: 300,
mainClass: 'mfp-fade',
modal: true,
items: {
src: $("#modalpopup"),
type: 'inline'
}
});
$(".popup-modal-dismiss").on('click', function (e) {
e.preventDefault();
$.magnificPopup.close();
});
}
});
}
function change_password_popup (t) {
$("#popup-content").html("");
$("#popuploader").css("display","block");
//Hier noch der Ajax-Aufruf
$.ajax({
url: 'view_change_password_popup',
data: {user_id : t.attr("data-userid")
},
type: "POST",
dataType: "html",
success: function(response) {
$("#popup-content").html(response);
$.magnificPopup.open({
closeBtnInside: false,
showCloseBtn: false,
removalDelay: 300,
mainClass: 'mfp-fade',
modal: true,
items: {
src: $("#modalpopup"),
type: 'inline'
}
});
$(".popup-modal-dismiss").on('click', function (e) {
e.preventDefault();
$.magnificPopup.close();
});
}
});
}
function lost_password_popup (t) {
$("#popup-content").html("");
$("#popuploader").css("display","block");
//Hier noch der Ajax-Aufruf
$.ajax({
url: 'view_lost_password_popup',
data: {id : t.attr("data-id"),
uid : t.attr("data-uid")
},
type: "POST",
dataType: "html",
success: function(response) {
$("#popup-content").html(response);
$.magnificPopup.open({
closeBtnInside: false,
showCloseBtn: false,
removalDelay: 300,
mainClass: 'mfp-fade',
modal: true,
items: {
src: $("#modalpopup"),
type: 'inline'
}
});
$(".popup-modal-dismiss").on('click', function (e) {
e.preventDefault();
$.magnificPopup.close();
});
}
});
}
function scenario_popup(t) {
$("#popup-content").html("");
$("#popuploader").css("display","block");
//Hier noch der Ajax-Aufruf
$.ajax({
url: 'view_scenario_popup',
data: { part_id : t.attr("data-partid"),
order_id : t.attr("data-orderid"),
family : t.attr("data-family"),
family_group : t.attr("data-family_group"),
isproject : t.attr("data-isproject")
},
type: "POST",
dataType: "html",
success: function(response) {
$("#popup-content").html(response);
$.magnificPopup.open({
closeBtnInside: false,
showCloseBtn: false,
removalDelay: 300,
mainClass: 'mfp-fade',
modal: true,
items: {
src: $("#modalpopup"),
type: 'inline'
}
});
$(".popup-modal-dismiss").on('click', function (e) {
e.preventDefault();
$.magnificPopup.close();
});
}
});
}
function scenario_kitgen_popup (t) {
$("#popup-content").html("");
$("#popuploader").css("display","block");
//Hier noch der Ajax-Aufruf
$.ajax({
url: 'view_scenario_popup',
data: {part_id : $("#part_"+t.attr("data-id")).val(),
scen_id : $("#scen_"+t.attr("data-id")).val(),
count : $("#quant_"+t.attr("data-id")).val(),
position : t.attr("data-id"),
converted : t.attr("data-converted"),
base_cur : $("#base_cur").val(),
mode : "kitgen"
},
type: "POST",
dataType: "html",
success: function(response) {
$("#popup-content").html(response);
$.magnificPopup.open({
closeBtnInside: false,
showCloseBtn: false,
removalDelay: 300,
mainClass: 'mfp-fade',
modal: true,
items: {
src: $("#modalpopup"),
type: 'inline'
}
});
$(".popup-modal-dismiss").on('click', function (e) {
e.preventDefault();
$.magnificPopup.close();
});
}
});
}
function scenario_cm_popup (t) {
$("#popup-content").html("");
$("#popuploader").css("display","block");
//Hier noch der Ajax-Aufruf
$.ajax({
url: 'view_part_supplyscenario_cm_popup',
data: {part_id : t.attr("data-id")
},
type: "POST",
dataType: "html",
success: function(response) {
$("#popup-content").html(response);
$.magnificPopup.open({
closeBtnInside: false,
showCloseBtn: false,
removalDelay: 300,
mainClass: 'mfp-fade',
modal: true,
items: {
src: $("#modalpopup"),
type: 'inline'
}
});
$(".popup-modal-dismiss").on('click', function (e) {
e.preventDefault();
$.magnificPopup.close();
});
}
});
}
function scenario_admin_popup (t) {
$("#popup-content").html("");
$("#popuploader").css("display","block");
//Hier noch der Ajax-Aufruf
$.ajax({
url: 'view_admin_scenario_popup',
data: {part_id : t.attr("data-partid"),
office_id : t.attr("data-officeid")
},
type: "POST",
dataType: "html",
success: function(response) {
$("#popup-content").html(response);
$.magnificPopup.open({
closeBtnInside: false,
showCloseBtn: false,
removalDelay: 300,
mainClass: 'mfp-fade',
modal: true,
items: {
src: $("#modalpopup"),
type: 'inline'
}
});
$(".popup-modal-dismiss").on('click', function (e) {
e.preventDefault();
$.magnificPopup.close();
});
}
});
}
function add_system_popup (t) {
$("#popup-content").html("");
$("#popuploader").css("display","block");
//Hier noch der Ajax-Aufruf
$.ajax({
url: 'view_add_system_pt_popup',
data: {office_id : t.attr("data-id")
},
type: "POST",
dataType: "html",
success: function(response) {
$("#popup-content").html(response);
$.magnificPopup.open({
closeBtnInside: false,
showCloseBtn: false,
removalDelay: 300,
mainClass: 'mfp-fade',
modal: true,
items: {
src: $("#modalpopup"),
type: 'inline'
}
});
$(".popup-modal-dismiss").on('click', function (e) {
e.preventDefault();
$.magnificPopup.close();
});
}
});
}
function add_cm_popup (t) {
$("#popup-conten").html("");
$("#popuploader").css("display","block");
//Hier noch der Ajax-Aufruf
$.ajax({
url: 'view_add_can_buy_popup',
data: {office_id : t.attr("data-id"),
type : t.attr("data-type")
},
type: "POST",
dataType: "html",
success: function(response) {
$("#popup-content").html(response);
$.magnificPopup.open({
closeBtnInside: false,
showCloseBtn: false,
removalDelay: 300,
mainClass: 'mfp-fade',
modal: true,
items: {
src: $("#modalpopup"),
type: 'inline'
}
});
$(".popup-modal-dismiss").on('click', function (e) {
e.preventDefault();
$.magnificPopup.close();
});
}
});
}
function new_allocation_popup (t) {
$("#popup-content").html("");
//Hier noch der Ajax-Aufruf
$.ajax({
url: 'view_new_allocation_popup',
data: { trade_id : t.attr("data-trade_id"),
part_id : t.attr("data-part_id"),
capp_id : t.attr("data-capp_id"),
use_pallet : t.attr("data-use_pallet"),
delivery_id : t.attr("data-delivery_id"),
packaging : t.attr("data-packaging"),
supplier_code : t.attr("data-supplier_code"),
show_allocated : t.attr("data-show_allocated_pallets")
},
type: "POST",
dataType: "html",
success: function(response) {
$("#popup-content").html(response);
$.magnificPopup.open({
closeBtnInside: false,
showCloseBtn: false,
removalDelay: 300,
mainClass: 'mfp-fade',
modal: true,
items: {
src: $("#modalpopup"),
type: 'inline'
}
});
$(".popup-modal-dismiss").on('click', function (e) {
e.preventDefault();
$.magnificPopup.close();
});
}
});
}
function new_pallet_popup (t) {
$("#popup-content").html("");
//Hier noch der Ajax-Aufruf
$.ajax({
url: 'view_new_pallet_popup',
data: { part_id : t.attr("data-part_id")
},
type: "POST",
dataType: "html",
success: function(response) {
$("#popup-content").html(response);
$.magnificPopup.open({
closeBtnInside: false,
showCloseBtn: false,
removalDelay: 300,
mainClass: 'mfp-fade',
modal: true,
items: {
src: $("#modalpopup"),
type: 'inline'
}
});
$(".popup-modal-dismiss").on('click', function (e) {
e.preventDefault();
$.magnificPopup.close();
});
}
});
}
function new_bundle_popup (t) {
$("#popup-content").html("");
//Hier noch der Ajax-Aufruf
$.ajax({
url: 'view_new_bundle_popup',
data: { part_id : t.attr("data-part_id"),
part_dyn_id : t.attr("data-part_dyn_id"),
},
type: "POST",
dataType: "html",
success: function(response) {
$("#popup-content").html(response);
$.magnificPopup.open({
closeBtnInside: false,
showCloseBtn: false,
removalDelay: 300,
mainClass: 'mfp-fade',
modal: true,
items: {
src: $("#modalpopup"),
type: 'inline'
}
});
$(".popup-modal-dismiss").on('click', function (e) {
e.preventDefault();
$.magnificPopup.close();
});
}
});
}
function googleauth_popup (t) {
$("#popup-content").html("");
$("#popuploader").css("display","block");
//Hier noch der Ajax-Aufruf
$.ajax({
url: 'view_googleauth_popup',
data: {user_id : t.attr("data-id")
},
type: "POST",
dataType: "html",
success: function(response) {
$("#popup-content").html(response);
$.magnificPopup.open({
closeBtnInside: false,
showCloseBtn: false,
removalDelay: 300,
mainClass: 'mfp-fade',
modal: true,
items: {
src: $("#modalpopup"),
type: 'inline'
}
});
$(".popup-modal-dismiss").on('click', function (e) {
e.preventDefault();
$.magnificPopup.close();
});
$('.checkgoogle').on('click', function (e) {
e.preventDefault();
//Hier noch der Ajax-Aufruf
$.ajax({
url: 'ajax_checkgoogleauth',
data: { user_id : $("#uid").val(),
code : $("#authcode").val(),
secret : $("#secret").val()
},
type: "POST",
dataType: "json",
success: function(response) {
$("#authcode").val("");
if (response.Result === "OK") {
$("#authresult").html("Check OK");
$("#authresult").addClass("green");
$("#authresult").removeClass("red");
$("#show_codes").show();
$("#recovery_codes").html(response.recover.join("
"));
}
else
{
$("#authresult").html("Check not OK");
$("#authresult").removeClass("green");
$("#authresult").addClass("red");
$("#show_codes").hide();
}
}
});
});
}
});
}
function googlerecovery_popup (t) {
$("#popup-content").html("");
$("#popuploader").css("display","block");
//Hier noch der Ajax-Aufruf
$.ajax({
url: 'view_googlerecovery_popup',
data: {user_id : t.attr("data-id")
},
type: "POST",
dataType: "html",
success: function(response) {
$("#popup-content").html(response);
$.magnificPopup.open({
closeBtnInside: false,
showCloseBtn: false,
removalDelay: 300,
mainClass: 'mfp-fade',
modal: true,
items: {
src: $("#modalpopup"),
type: 'inline'
}
});
$(".popup-modal-dismiss").on('click', function (e) {
e.preventDefault();
$.magnificPopup.close();
});
$('.checkgoogle').on('click', function (e) {
e.preventDefault();
//Hier noch der Ajax-Aufruf
$.ajax({
url: 'ajax_checkgoogleauth',
data: { user_id : $("#uid").val(),
code : $("#authcode").val(),
onlycodes : 1
},
type: "POST",
dataType: "json",
success: function(response) {
$("#authcode").val("");
if (response.Result === "OK") {
$("#show_codes").show();
$("#recovery_codes").html(response.recover.join("
"));
}
else
{
$("#show_codes").hide();
}
}
});
});
}
});
}
function validateEmail(sEmail) {
var filter = /^([\w-\.]+)@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.)|(([\w-]+\.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\]?)$/;
if (filter.test(sEmail)) {
return true;
}
else {
return false;
}
}
function history_back () {
history.go(-1)
}
function initDatepicker() {
$(".datepicker").remove();
$(".datepick").datepicker({format:"dd.mm.yyyy"});
$(".datepick_month").datepicker({format:"mm.yyyy"});
// .on('changeDate', function(ev){
// console.log(ev.date);
// });
// .on("blur",function() {
// $(".datepick").datepicker("hide")
// });
}
function removeDatepicker() {
$(".datepicker").remove();
}
function doesConnectionExist() {
var xhr = new XMLHttpRequest();
var file = "http://94.230.210.197:8002/mediaintern/favicon.ico"; //image path in your project
var randomNum = Math.round(Math.random() * 10000);
xhr.open('HEAD', file + "?rand=" + randomNum, false);
try {
xhr.send(null);
if (xhr.status >= 200 && xhr.status < 304) {
return true;
} else {
return false;
}
} catch (e) {
return false;
}
}
var isconnection=0;
function doesConnectionExist2() {
var xhr = new XMLHttpRequest();
var file = "http://94.230.210.197:8002/mediaintern/favicon.ico";
var randomNum = Math.round(Math.random() * 10000);
xhr.open('HEAD', file + "?rand=" + randomNum, true);
xhr.send();
xhr.addEventListener("readystatechange", processRequest, false);
function processRequest(e) {
if (xhr.readyState == 4) {
if (xhr.status >= 200 && xhr.status < 304) {
isconnection=1;
} else {
isconnection=0;
}
}
}
}