var imageFolder = "/access/Images/";
var userType = 1;
function getParameter(paramName) {
var searchString = window.location.search.substring(1),
i, val, params = searchString.split("&");
for (i = 0; i < params.length; i++) {
val = params[i].split("=");
if (val[0] == paramName) {ess4
return unescape(val[1]);
}
}
return null;
}
function loadInitUI(uiparams) {
if (uiparams.error == "no error") {
var stype = uiparams.dataset[0].initpagetype; //getParameterFromString("initpagetype", uiparams);
var topmsg = uiparams.dataset[0].initpagemessage; //getParameterFromString("initpagemessage", uiparams);
if (stype == "1") {
$('#Radio1').attr("checked", true);
}
else {
$('#Radio2').attr("checked", true);
}
$('#Text1').attr("value", topmsg);
}
}
function getInitPageSettings(strName) {
$.ajax({
url: './Handlers/MainHandler.ashx',
type: 'POST',
cache: false,
data: { command: 'getinitpage', locationid: strName },
dataType: 'jsonp',
success: function (resp) {loadInitUI(resp); }
})
}
function SaveChanges() {
var idisptype = $('input:radio[name=disptype]:checked').val();
var imessage = $('#Text1').val();
$.ajax({
url: './Handlers/MainHandler.ashx',
type: 'POST',
cache: false,
data: { command: 'UpdateInitSettings', disp: idisptype, msg: imessage },
dataType: 'jsonp',
success: function (resp) {
if (resp.error != "no error")
alert(resp.error);
}
})
}
function GetOtherSettings(){
$.ajax({
url: './Handlers/MainHandler.ashx',
type: 'POST',
cache: false,
data: { command: 'getinitpage' },
dataType: 'jsonp',
success: function (resp) {
loadOthersUI(resp);
}
});
}
function loadOthersUI(uiparams) {
if (uiparams.error == "no error") {
$('#autoEventEmail').val(uiparams.dataset[0].autoEventEmail);
}
}
function SaveOtherSettings() {
var autoEventEmail = $('#autoEventEmail').val();
$.ajax({
url: './Handlers/MainHandler.ashx',
type: 'POST',
cache: false,
data: { command: 'saveothersettings', autoEventEmail: autoEventEmail },
dataType: 'jsonp',
success: function (resp) {
strCommand = resp.error;
}
})
}
function GetRadiusSettings() {
$.ajax({
url: './Handlers/MainHandler.ashx',
type: 'POST',
cache: false,
data: { command: 'getinitpage' },
dataType: 'jsonp',
success: function (resp) {
loadRadiusUI(resp);
}
})
}
function loadRadiusUI(uiparams) {
if (uiparams.error == "no error") {
$('#IdleTime').val(uiparams.dataset[0].radidletimeout);
$('#SessTime').val(uiparams.dataset[0].radsessiontimeout);
}
}
function SaveRadiusSettings() {
var radidletimeout = $('#IdleTime').val();
var radsessiontimeout = $('#SessTime').val();
var raddownspeed = $('#DownSpeed').val();
var radupspeed = $('#UpSpeed').val();
$.ajax({
url: './Handlers/MainHandler.ashx',
type: 'POST',
cache: false,
data: { command: 'saveradiusettings', idletimeout: radidletimeout,
sessiontimeout: radsessiontimeout, downspeed: raddownspeed, upspeed: radupspeed },
dataType: 'jsonp',
success: function (resp) {
strCommand = resp.error;
}
})
}
function disableRouter(routername, description){
if (confirm('Θέλετε σίγουρα να απενεργοποιήσετε το router '+routername+' του πελάτη '+description+';')){
$.ajax({
url: './Handlers/MainHandler.ashx',
type: 'POST',
cache: false,
data: { command: 'disableRouter', routername:routername },
dataType: 'jsonp',
success: function (resp) {
window.location="frmRouterOnlineInfo.aspx";
}
})
}
}
function enableRouter(routername, description){
if (confirm('Θέλετε σίγουρα να ενεργοποιήσετε το router '+routername+' του πελάτη '+description+';')){
$.ajax({
url: './Handlers/MainHandler.ashx',
type: 'POST',
cache: false,
data: { command: 'enableRouter', routername:routername },
dataType: 'jsonp',
success: function (resp) {
window.location="frmRouterOnlineInfo.aspx";
}
})
}
}
function refreshRouters(){
$.ajax({
url: './Handlers/MainHandler.ashx',
type: 'POST',
cache: false,
data: { command: 'refreshRouters' },
dataType: 'jsonp',
success: function (resp) {
$('#GetRouterOnlineInfoTable').remove(); $('#GetRouterOnlineInfoDisabledTable').remove();
}
});
}
function GetRouterOnlineInfo(orderby,energo,epoxiako,synerg,demo,xorigos,dokimastiko,ktel) {
if (orderby==undefined) {
orderby = "minDiffs desc";
}
$.ajax({
url: './Handlers/MainHandler.ashx',
type: 'POST',
cache: false,
data: { command: 'GetRouterOnlineInfo', orderby: orderby, energo:energo,epoxiako:epoxiako,synerg:synerg,demo:demo,xorigos:xorigos,dokimastiko:dokimastiko,ktel:ktel },
dataType: 'jsonp',
success: function (resp) {
if (resp.error == "no error") {
if (resp.dataset.length > 0) {
//debugger;
var iTable = document.createElement('table');
iTable.id = "GetRouterOnlineInfoTable";
document.getElementById('divholder').appendChild(iTable);
var tRow = iTable.insertRow();
var cell0 = tRow.insertCell(0);
cell0.innerHTML = 'Α/Α';
var cell1 = tRow.insertCell(1);
cell1.innerHTML = 'Πελάτης';
cell1.id="GetRouterOnlineInfoId";
$('#GetRouterOnlineInfoId').click(function(){
$('#GetRouterOnlineInfoTable').remove(); $('#GetRouterOnlineInfoDisabledTable').remove(); GetRouterOnlineInfo("l.description asc",$('input[name=energa]')[0].checked, $('input[name=epoxiaka]')[0].checked, $('input[name=synergates]')[0].checked, $('input[name=demo]')[0].checked, $('input[name=xorigos]')[0].checked, $('input[name=dokimastiko]')[0].checked);
});
var cell2 = tRow.insertCell(2);
cell2.innerHTML = 'Router';
var cell3 = tRow.insertCell(3);
cell3.innerHTML = 'Τελευταία ενημέρωση';
cell3.id="GetRouterOnlineInfoId2";
$('#GetRouterOnlineInfoId2').click(function(){
$('#GetRouterOnlineInfoTable').remove(); $('#GetRouterOnlineInfoDisabledTable').remove(); GetRouterOnlineInfo("minDiffs desc",$('input[name=energa]')[0].checked, $('input[name=epoxiaka]')[0].checked, $('input[name=synergates]')[0].checked, $('input[name=demo]')[0].checked, $('input[name=xorigos]')[0].checked, $('input[name=dokimastiko]')[0].checked);
});
var cell4 = tRow.insertCell(4);
cell4.innerHTML = 'Κλήσεις σήμερα';
var cell5 = tRow.insertCell(5);
cell5.innerHTML = 'Τύπος';
var cell6 = tRow.insertCell(6);
cell6.innerHTML = 'Λειτουργία';
for(i=0;i < resp.dataset.length;i++)
{
var iRow = iTable.insertRow();
iRow.id = 'client'+resp.dataset[i].locationid;
var aClass = 'greenDiv';
if (resp.dataset[i].minDiffs=='') aClass = 'grayDiv';
if (resp.dataset[i].minDiffs>300) aClass = 'yellowDiv';
if (resp.dataset[i].minDiffs>500) aClass = 'orangeDiv';
if (resp.dataset[i].minDiffs>720) aClass = 'redDiv';
var cell0 = iRow.insertCell(0);
cell0.className = aClass;
cell0.innerHTML = i+1;
var cell1 = iRow.insertCell(1);
cell1.className = aClass;
cell1.innerHTML = ''+resp.dataset[i].description+'';
var cell2 = iRow.insertCell(2);
cell2.className = aClass;
cell2.innerHTML = resp.dataset[i].hotspotname;
var cell3 = iRow.insertCell(3);
cell3.className = aClass;
cell3.innerHTML = resp.dataset[i].lastUpdate;
var cell4 = iRow.insertCell(4);
cell4.className = aClass;
cell4.innerHTML = resp.dataset[i].todayUpdates;
var cell5 = iRow.insertCell(5);
cell5.className = aClass;
cell5.innerHTML = resp.dataset[i].clientType;
var cell6 = iRow.insertCell(6);
cell6.className = aClass;
cell6.innerHTML = '';
}
}
}
}
})
$.ajax({
url: './Handlers/MainHandler.ashx',
type: 'POST',
cache: false,
data: { command: 'GetRouterOnlineInfoDisabled', orderby: orderby },
dataType: 'jsonp',
success: function (resp) {
if (resp.error == "no error") {
if (resp.dataset.length > 0) {
//debugger;
var iTable = document.createElement('table');
iTable.id="GetRouterOnlineInfoDisabledTable";
document.getElementById('divholderdisabled').appendChild(iTable);
var tRow = iTable.insertRow();
var cell0 = tRow.insertCell(0);
cell0.innerHTML = 'Α/Α';
var cell1 = tRow.insertCell(1);
cell1.innerHTML = 'Πελάτης';
cell1.id="GetRouterOnlineInfoIdDisabled";
$('#GetRouterOnlineInfoIdDisabled').click(function(){
$('#GetRouterOnlineInfoTable').remove(); $('#GetRouterOnlineInfoDisabledTable').remove(); GetRouterOnlineInfo("l.description asc",$('input[name=energa]')[0].checked, $('input[name=epoxiaka]')[0].checked, $('input[name=synergates]')[0].checked, $('input[name=demo]')[0].checked, $('input[name=xorigos]')[0].checked, $('input[name=dokimastiko]')[0].checked);
});
var cell2 = tRow.insertCell(2);
cell2.innerHTML = 'Router';
var cell3 = tRow.insertCell(3);
cell3.innerHTML = 'Τελευταία ενημέρωση';
cell3.id="GetRouterOnlineInfoId2Disabled";
$('#GetRouterOnlineInfoId2Disabled').click(function(){
$('#GetRouterOnlineInfoTable').remove(); $('#GetRouterOnlineInfoDisabledTable').remove(); GetRouterOnlineInfo("minDiffs desc",$('input[name=energa]')[0].checked, $('input[name=epoxiaka]')[0].checked, $('input[name=synergates]')[0].checked, $('input[name=demo]')[0].checked, $('input[name=xorigos]')[0].checked, $('input[name=dokimastiko]')[0].checked);
});
var cell4 = tRow.insertCell(4);
cell4.innerHTML = 'Κλήσεις σήμερα';
var cell5 = tRow.insertCell(5);
cell5.innerHTML = 'Τύπος';
var cell6 = tRow.insertCell(6);
cell6.innerHTML = 'Λειτουργία';
for(i=0;i < resp.dataset.length;i++)
{
var iRow = iTable.insertRow();
iRow.id = 'client'+resp.dataset[i].locationid;
var aClass = 'greenDiv';
if (resp.dataset[i].minDiffs=='') aClass = 'grayDiv';
if (resp.dataset[i].minDiffs>300) aClass = 'yellowDiv';
if (resp.dataset[i].minDiffs>500) aClass = 'orangeDiv';
if (resp.dataset[i].minDiffs>720) aClass = 'redDiv';
var cell0 = iRow.insertCell(0);
cell0.className = aClass;
cell0.innerHTML = i+1;
var cell1 = iRow.insertCell(1);
cell1.className = aClass;
cell1.innerHTML = resp.dataset[i].description;
var cell2 = iRow.insertCell(2);
cell2.className = aClass;
cell2.innerHTML = resp.dataset[i].hotspotname;
var cell3 = iRow.insertCell(3);
cell3.className = aClass;
cell3.innerHTML = resp.dataset[i].lastUpdate;
var cell4 = iRow.insertCell(4);
cell4.className = aClass;
cell4.innerHTML = resp.dataset[i].todayUpdates;
var cell5 = iRow.insertCell(5);
cell5.className = aClass;
cell5.innerHTML = resp.dataset[i].clientType;
var cell6 = iRow.insertCell(6);
cell6.className = aClass;
cell6.innerHTML = '';
}
}
}
}
})
}
function GetLocations() {
$.ajax({
url: './Handlers/MainHandler.ashx',
type: 'POST',
cache: false,
data: { command: 'GetLocations' },
dataType: 'jsonp',
success: function (resp) {
if (resp.error == "no error") {
if (resp.dataset.length > 0) {
var selhtml = "";
for (var i in resp.dataset) {
selhtml += "";
}
$('#locations').html(selhtml);
GetSelectedLocation(resp.dataset[0].locationid);
}
}
}
})
}
function GetTemplates() {
$.ajax({
url: './Handlers/MainHandler.ashx',
type: 'POST',
cache: false,
data: { command: 'GetTemplates' },
dataType: 'jsonp',
success: function (resp) {
if (resp.error == "no error") {
if (resp.dataset.length > 0) {
var selhtml = "";
//var idSel = 0;
for (var i in resp.dataset) {
selhtml += "";
// (resp.dataset[i].selected = 'selected') idSel = resp.dataset[i].templateId;
}
$('#templates').html(selhtml);
SetSelectedTemplate();
}
}
}
})
}
function GetSelectedLocation(firstlocation) {
$.ajax({
url: './Handlers/MainHandler.ashx',
type: 'POST',
cache: false,
data: { command: 'GetSelectedLocation', firstlocation: firstlocation },
dataType: 'jsonp',
success: function (resp) {
if (resp.error == "no data") {
$('#placeholder3').hide();
$('#placeholder5').hide();
}
if (resp.error == "no error") {
$('#locations').val(resp.dataset[0].locationid);
$('#subscrtype').val(resp.dataset[0].subsrciptiontype);
if (userType==0) {
$('#DemoAddress').html('Διεύθυνση URL Demo - Διεύθυνση URL Demo (TODO) - Διεύθυνση URL Demo (Παλαιό Access)');
$('#placeholder3').show();
$('#placeholder5').show();
$('#myHotSpotName').html(resp.dataset[0].hotspsotname);
$('#myTemplate').html(resp.dataset[0].template);
}
else
{
$('#DemoAddress').html('Διεύθυνση URL Demo');
$('#placeholder3').hide();
$('#placeholder5').hide();
}
checkgenerallock();
//if ($(location).attr('pathname').toLowerCase().indexOf('reports.aspx') != -1)
// CheckReportsLocked();
}
}
})
}
function SetSpecificLocation(location) {
$.ajax({
url: './Handlers/MainHandler.ashx',
type: 'POST',
cache: false,
data: { command: 'SetSelectedLocation', locationid: location },
dataType: 'jsonp',
success: function (resp) {
if (resp.error == "no error") {
$('#subscrtype').val(resp.dataset[0].subsrciptiontype);
/*if ($(location).attr('pathname').toLowerCase().indexOf('hpsettings.aspx') != -1)
GetRadiusSettings();
if ($(location).attr('pathname').toLowerCase().indexOf('userinitsettings.aspx') != -1)
getInitPageSettings();
if ($(location).attr('pathname').toLowerCase().indexOf('loginsettings.aspx') != -1)
GetLoginSettings();
if ($(location).attr('pathname').toLowerCase().indexOf('splashsettings.aspx') != -1)
GetSplashSetting();
if ($(location).attr('pathname').toLowerCase().indexOf('offers.aspx') != -1)
GetOffers();
if ($(location).attr('pathname').toLowerCase().indexOf('menu.aspx') != -1)
GetMenu();
if ($(location).attr('pathname').toLowerCase().indexOf('reports.aspx') != -1)
CheckReportsLocked();
if ($(location).attr('pathname').toLowerCase().indexOf('bonus.aspx') != -1)
{
LoadDatepickers();
GetBonus(0);
}*/
//checkgenerallock();
window.location = "Info.aspx";
}
}
});
}
function SetSelectedLocation() {
$.ajax({
url: './Handlers/MainHandler.ashx',
type: 'POST',
cache: false,
data: { command: 'SetSelectedLocation', locationid: $('#locations').val() },
dataType: 'jsonp',
success: function (resp) {
if (resp.error == "no error") {
$('#subscrtype').val(resp.dataset[0].subsrciptiontype);
/*if ($(location).attr('pathname').toLowerCase().indexOf('hpsettings.aspx') != -1)
GetRadiusSettings();
if ($(location).attr('pathname').toLowerCase().indexOf('userinitsettings.aspx') != -1)
getInitPageSettings();
if ($(location).attr('pathname').toLowerCase().indexOf('loginsettings.aspx') != -1)
GetLoginSettings();
if ($(location).attr('pathname').toLowerCase().indexOf('splashsettings.aspx') != -1)
GetSplashSetting();
if ($(location).attr('pathname').toLowerCase().indexOf('offers.aspx') != -1)
GetOffers();
if ($(location).attr('pathname').toLowerCase().indexOf('menu.aspx') != -1)
GetMenu();
if ($(location).attr('pathname').toLowerCase().indexOf('reports.aspx') != -1)
CheckReportsLocked();
if ($(location).attr('pathname').toLowerCase().indexOf('bonus.aspx') != -1)
{
LoadDatepickers();
GetBonus(0);
}*/
//checkgenerallock();
window.location = window.location;
}
}
})
}
function GetLoginSettings() {
$.ajax({
url: './Handlers/MainHandler.ashx',
type: 'POST',
cache: false,
data: { command: 'GetLoginSettings' },
dataType: 'jsonp',
success: function (resp) {
if (resp.error == "no error") {
$('#fbpage').val(resp.dataset[0].facebookpage);
$('#logintype').val(resp.dataset[0].logintype);
$('#postenabled').val(resp.dataset[0].fbposting);
$('#fbpostdays').val(resp.dataset[0].fbpostingdays);
$('#showevents').val(resp.dataset[0].showevents);
$('#posttext').val(resp.dataset[0].fbpostingtext);
$('#redirectpage').val(resp.dataset[0].redirecturl);
$('#LoginWithPassword').val(resp.dataset[0].loginwithpassword);
$('#Password').val(resp.dataset[0].password);
$('#fbloginoption').val(resp.dataset[0].loginwithfb);
$('#fbcheckinoption').val(resp.dataset[0].hasCheckIn);
$('#nameoption').val(resp.dataset[0].requestname);
$('#requireoption').val(resp.dataset[0].requirename);
$('#emailoption').val(resp.dataset[0].loginwithemail);
$('#instagramoption').val(resp.dataset[0].loginwithinstagram);
$('#requireValidateEmail').val(resp.dataset[0].requireValidateEmail);
$('#showValidateEmail').val(resp.dataset[0].showValidateEmail);
updatelogincontrols();
}
}
})
}
function getWelcomeSettings(){
$.ajax({
url: './Handlers/MainHandler.ashx',
type: 'POST',
cache: false,
data: { command: 'GetWelcomeSettings' },
dataType: 'jsonp',
success: function (resp) {
if (resp.error == "no error") {
$('#postdays').val(resp.dataset[0].postdays);
$('#maxposts').val(resp.dataset[0].maxposts);
$('#happybday').val(resp.dataset[0].bdaypopup);
$('#happybdaytext').val(resp.dataset[0].bdaytext);
$('#ignorewelcome').val(resp.dataset[0].ignorewelcome);
$('#showevents').val(resp.dataset[0].showevents);
}
}
})
}
function DeleteEventsForLocation() {
$.ajax({
url: './Handlers/MainHandler.ashx',
type: 'POST',
cache: false,
data: { command: 'deletefbevents', locid: $('#locid').val()},
dataType: 'jsonp',
success: function (resp) {
if (resp.error != "no error") {
alert(resp.error);
}
else
{
alert("Delete ok.");
}
}
})
}
function SaveWelcomeSettings() {
$.ajax({
url: './Handlers/MainHandler.ashx',
type: 'POST',
cache: false,
data: { command: 'SaveWelcomeSettings', postdays: $('#postdays').val(), maxposts: $('#maxposts').val(), ignorewelcome:$('#ignorewelcome').val(), bdaypopup: $('#happybday').val(), bdaytext: $('#happybdaytext').val(), showevents:$('#showevents').val()},
dataType: 'jsonp',
success: function (resp) {
if (resp.error != "no error") {
alert(resp.error);
}
else
{
alert("Οι αλλαγές σας αποθηκεύτηκαν");
}
}
})
}
function SaveLoginSettings() {
var str = "";
if ($('#LoginWithPassword').val() == 1) {
var value = $('#Password').val();
if (value.length < 6) {
alert("Το password πρέπει να είναι τουλάχιστον 6 χαρακτήρες!");
str = "Το password πρέπει να είναι τουλάχιστον 6 χαρακτήρες!";
}
else {
$('#LabelMessage').Text = "";
str = "";
};
}
if (str == "") {
$.ajax({
url: './Handlers/MainHandler.ashx',
type: 'POST',
cache: false,
data: { command: 'SaveLoginSettings', facebookpage: $('#fbpage').val(), logintype: $('#logintype').val(),
fbposting: $('#postenabled').val(), fbpostingdays: $('#fbpostdays').val(),
fbpostingtext: $('#posttext').val(), redirecturl: $('#redirectpage').val(),
loginwithpassword: $('#LoginWithPassword').val(), password: $('#Password').val(),
loginwithfb: $('#fbloginoption').val(), loginwithinstagram: $('#instagramoption').val(),
loginwithemail: $('#emailoption').val(),
requestname: $('#nameoption').val(), requirename: $('#requireoption').val(),
requireValidateEmail: $('#requireValidateEmail').val(),
showValidateEmail: $('#showValidateEmail').val()
},
dataType: 'jsonp',
success: function (resp) {
if (resp.error != "no error") {
alert(resp.error);
}
else
{
alert("Οι αλλαγές σας αποθηκεύτηκαν");
}
}
})
}
}
function updatelogincontrols() {
var ltype = $('#logintype').val()
var penabled = $('#postenabled').val();
if (ltype == 3) {
$('#posttext').attr('Disabled', 'disabled');
$('#fbpostdays').attr('Disabled', 'disabled');
// $('#fbpage').attr('Disabled', 'disabled');
$('#postenabled').attr('Disabled', 'disabled');
}
else {
// $('#fbpage').removeAttr('Disabled');
$('#postenabled').removeAttr('Disabled');
if (penabled == 0) {
$('#posttext').attr('Disabled', 'disabled');
$('#fbpostdays').attr('Disabled', 'disabled');
}
else {
$('#posttext').removeAttr('Disabled');
$('#fbpostdays').removeAttr('Disabled');
}
}
}
function ChangeColors(style) {
var bcolor, fcolor, tcolor;
switch (style) {
case 'WhiteBlue':
bcolor = '#FFFFFF';
fcolor = '#2980b9';
tcolor = '#000000';
break;
case 'Blue':
bcolor = '#3498db';
fcolor = '#2980b9';
tcolor = '#000000';
break;
case 'Red':
bcolor = '#e74c3c';
fcolor = '#c0392b';
tcolor = '#FFFFFF';
break;
case 'WhiteRed':
bcolor = '#FFFFFF';
fcolor = '#c0392b';
tcolor = '#000000';
break;
case 'WhiteTurq':
bcolor = '#FFFFFF';
fcolor = '#16A085';
tcolor = '#000000';
break;
case 'Turq':
bcolor = '#1ABC9C';
fcolor = '#16A085';
tcolor = '#FFFFFF';
break;
case 'WhiteEmerald':
bcolor = '#FFFFFF';
fcolor = '#27ae60';
tcolor = '#000000';
break;
case 'Emerald':
bcolor = '#2ecc71';
fcolor = '#27ae60';
tcolor = '#FFFFFF';
break;
case 'WhiteMagenta':
bcolor = '#FFFFFF';
fcolor = '#8e44ad';
tcolor = '#000000';
break;
case 'Magenta':
bcolor = '#9b59b6';
fcolor = '#8e44ad';
tcolor = '#FFFFFF';
break;
case 'WhiteGrey':
bcolor = '#ffffff';
fcolor = '#2c3e50';
tcolor = '#000000';
break;
case 'Grey':
bcolor = '#34495e';
fcolor = '#2c3e50';
tcolor = '#FFFFFF';
break;
case 'WhiteYellow':
bcolor = '#ffffff';
fcolor = '#f39c12';
tcolor = '#000000';
break;
case 'Yellow':
bcolor = '#f1c40f';
fcolor = '#f39c12';
tcolor = '#FFFFFF';
break;
case 'WhiteOrange':
bcolor = '#ffffff';
fcolor = '#d35400';
tcolor = '#000000';
break;
case 'Orange':
bcolor = '#e67e22';
fcolor = '#d35400';
tcolor = '#FFFFFF';
break;
case 'Silver':
bcolor = '#ecf0f1';
fcolor = '#bdc3c7';
tcolor = '#000000';
break;
case 'Concrete':
bcolor = '#95a5a6';
fcolor = '#7f8c8d';
tcolor = '#000000';
break;
}
//$('#designdiv').css("background-color", bcolor);
// $('#logoname').css("background-color", fcolor);
//$('#fbbutton').css("background-color", fcolor);
//$('#headerdiv').css("background-color", fcolor);
//$('#mainimage').css("border-color", fcolor);
//$('#oxygen').css("color", tcolor);
//$('#logotext').css("color", tcolor);
//$('#loginmessage').css("color", tcolor);
cstyle = style;
}
function ChangeLogo() {
$('#logotext').text($('#logomessage').val());
}
function ChangeWelcomeGrText(){
$('#PreviewWelcomeGrText').text($('#welcomeFullText').val()+ ' '+ $('#welcomeGrText').val());
}
function UploadImage() {
$.ajax({
url: './Handlers/MainHandler.ashx',
type: 'POST',
cache: false,
data: { command: 'UploadImage', imagepath: $('#imgfile').val() },
dataType: 'jsonp',
success: function (resp) {
alert(resp.error);
}
})
}
function updateFacebookImage()
{
$.ajax({
url: './Handlers/MainHandler.ashx',
type: 'POST',
cache: false,
data: { command: 'updateFacebookImage' },
dataType: 'jsonp',
success: function (resp) {
$.ajax({
url: '../scheduledGetFBImage/default.aspx',
type: 'GET',
cache: false,
data: { locationid: resp },
dataType: 'jsonp',
success: function (resp) {
//debugger;
}
})
}
})
}
function ShowImageSelector(type) {
$.ajax({
url: './Handlers/MainHandler.ashx',
type: 'POST',
cache: false,
data: { command: 'GetImages', imgtype: type },
dataType: 'jsonp',
success: function (resp) {
debugger;
if (resp.error == "no error") {
imgs = resp;
currpage = 0;
selindex = 1;
imagtype = type;
GetImagesForPage(0);
$('#pageblur').attr('class', 'pageblur');
$('#pageblur').css({ 'opacity': 0.5 });
$('#filechoosermain').attr('class', 'filechooser');
var left = ($(window).width() - $('#filechoosermain').width()) / 2;
if (left < 0) left = 0;
$('#filechoosermain').css({ 'left': left });
var top = ($(window).height() - $('#filechoosermain').height()) / 2;
if (top < 0) top = 0;
$('#filechoosermain').css({ 'top': top });
//$('#main').attr('disabled', 'disabled');
}
if (resp.error == "no data") {
imgs = resp;
currpage = 0;
selindex = 0;
imagtype = type;
$('#pageblur').attr('class', 'pageblur');
$('#pageblur').css({ 'opacity': 0.5 });
$('#filechoosermain').attr('class', 'filechooser');
var left = ($(window).width() - $('#filechoosermain').width()) / 2;
if (left < 0) left = 0;
$('#filechoosermain').css({ 'left': left });
var top = ($(window).height() - $('#filechoosermain').height()) / 2;
if (top < 0) top = 0;
$('#filechoosermain').css({ 'top': top });
//$('#main').attr('disabled', 'disabled');
}
}
})
}
function HideImageSelector() {
$('#filechoosermain').attr('class', 'notshown');
//$('#main').removeAttr('disabled');
$('#pageblur').attr('class', 'notshown');
}
function HighlightImage(idx) {
var i;
selindex = idx;
for (i = 1; i <= 8; i++) {
$('#td' + i.toString()).css('border-style', 'none');
}
$('#td' + idx.toString()).css('border-style', 'groove');
}
function SelectImage()
{
debugger;
var fname = imgs.dataset[(currpage * 8) + (selindex - 1)].fname;
if (imagtype == 5) {
$('#partnerImg').val(fname);
HideImageSelector();
}
if (imagtype == 4) {
$('#logoBckImg').val(fname);
//$('#logoimage').attr('src', imageFolder + fname);
HideImageSelector();
}
if (imagtype == 3) {
$('#logoImg').val(fname);
//$('#logoimage').attr('src', imageFolder + fname);
HideImageSelector();
}
if (imagtype == 2)
{
$('#mainpicfile').val(fname);
$('#logoimage').attr('src', imageFolder + fname);
HideImageSelector();
}
if (imagtype == 1) {
$('#logoimgfile').val(fname);
$('#logoimage').attr('src', imageFolder + fname);
HideImageSelector();
}
}
function GotoImagePage(command) {
var maxpages = Math.floor((imgs.dataset.length -1) / 8);
if (maxpages > currpage) {
if (command == "Next" || command == "Last") {
currpage = (command == "Next") ? currpage + 1 : maxpages;
GetImagesForPage(currpage);
}
}
if (currpage > 0) {
if (command == "Prev" || command == "First") {
currpage = (command == "Prev") ? currpage - 1 : 0;
GetImagesForPage(currpage);
}
}
}
function GetImagesForPage(page) {
var i;
for (i = 1; i <= 8; i++) {
$('#img' + i.toString()).attr('src', '');
$('#img' + i.toString()).attr('class', 'notshown');
}
for (i = page * 8; i < Math.min(imgs.dataset.length, (page + 1) * 8); i++) {
var sitem = '#img' + ((i%8) + 1).toString();
$(sitem).attr('src', imageFolder + imgs.dataset[i].fname);
$(sitem).attr('class', 'imagestoselect');
}
selindex = 1;
HighlightImage(1);
}
function uploadImage() {
var fname = $('#File1').val();
var fext = fname.split('.').pop().toLowerCase();
if (fext == 'jpg' || fext == 'png' || fext == 'jpeg') {
var fl = $('#File1')[0].files[0];
var fd = new FormData();
fd.append('file', fl);
fd.append('command', 'UploadFile');
fd.append('ftype', imagtype.toString());
poststatus = 0;
$.ajax({
url: './Handlers/MainHandler.ashx',
type: 'POST',
cache: false,
data: fd,
dataType: 'jsonp',
processData: false,
contentType: false,
success: function (resp) {
poststatus = 1;
$('#loadinggif').attr('class', 'notshown');
if (resp.error == "no error") {
ShowImageSelector(imagtype);
}
else {
$('#progressdiv').text(resp.error);
}
},
error: function (resp) {
poststatus = 1;
$('#loadinggif').attr('class', 'notshown');
$('#progressdiv').text('Αποτυχία στο ανέβασμ της εικόνας.');
}
})
$('#progressdiv').text('');
$('#loadinggif').attr('class', 'verticalspacemed');
}
else {
alert('Επιτρέπονται μόνο αρχεία τύπου: jpg, jpeg, png.')
}
}
function ChooseFile() {
$('#File1').trigger('click');
}
function AnimateProgress() {
if (poststatus == 0) {
var w = $('#vspace').width();
var w2 = $('#progressdiv').width();
if (w2 < w - 21) {
w2 += 20;
}
else {
w2 = 0;
}
$('#progressdiv').css({ 'width': w2.toString() + 'px' })
setTimeout(function () { AnimateProgress(); }, 100);
}
else {
$('#progressdiv').css({ 'width': '0px', 'height': '0px' });
}
}
function setDraggable() {
var ioff = $('#logoimage').offset();
var doff = $('#headerdiv').offset();
var dheight = $('#headerdiv').height();
var iheight = $('#logoimage').height();
var x1 = ioff.left;
var x2 = ioff.left;
var y1 = (doff.top + dheight) - iheight;
// var y1 = (doff.top + dheight) - 200;
var y2 = doff.top;
var offst = $('#ioffst').val();
var curroffst = 0 - Math.round(((iheight * offst) / 10000));
if ($('#ioffstFB').val()=="1") {
curroffst = 0 - (1 * offst);
}
// alert(y1 + ' - ' + y2);
$('#logoimage').draggable({ containment: [x1, y1, x2, y2] });
$('#logoimage').css({ 'top': curroffst + 'px' });
}
function GetSplashSetting() {
$.ajax({
url: './Handlers/MainHandler.ashx',
type: 'POST',
cache: false,
data: { command: 'GetSplashSetting' },
dataType: 'jsonp',
success: function (resp) {
if (resp.error == "no error") {
if (resp.dataset[0].useOriginalFacebookCover==1) {
$('#ioffst').val(resp.dataset[0].offsety);
$('#ioffstFB').val(1);}
else {
$('#ioffst').val(resp.dataset[0].imageoffset);
$('#ioffstFB').val(0);}
ChangeColors(resp.dataset[0].splashcolorstyle);
$('#logomessage').val(resp.dataset[0].splashbrand);
$('#welcomeGrText').val(resp.dataset[0].welcomeGrText);
$('#welcomeFullText').val(resp.dataset[0].welcomeFullText);
$('#welcomeFullTextEn').val(resp.dataset[0].welcomeFullTextEn);
$('#PreviewWelcomeGrText').text(resp.dataset[0].welcomeFullText+' '+resp.dataset[0].welcomeGrText);
$('#logotext').text($('#logomessage').val());
$('#mainpicfile').val(resp.dataset[0].splashmainimage);
if (resp.dataset[0].useOriginalFacebookCover==1) {
$('#logoimage').attr('src',resp.dataset[0].coverpictureid)}
else {
$('#logoimage').attr('src', imageFolder + resp.dataset[0].splashmainimage);}
$('#logoImg').val(resp.dataset[0].logoImg);
$('#logoBckImg').val(resp.dataset[0].logoBckImg);
$('#offerscustomtext').val(resp.dataset[0].offerscustomtext);
$('#eventscustomtext').val(resp.dataset[0].eventscustomtext);
$('#offericon').val(resp.dataset[0].offericon);
$('#eventicon').val(resp.dataset[0].eventicon);
$('#fbpage').val(resp.dataset[0].facebookpage);
$('#logintype').val(resp.dataset[0].logintype);
$('#postenabled').val(resp.dataset[0].fbposting)
$('#useOriginalFacebookCover').val(resp.dataset[0].useOriginalFacebookCover)
$('#fbpostdays').val(resp.dataset[0].fbpostingdays);
$('#posttext').val(resp.dataset[0].fbpostingtext);
$('#redirectpage').val(resp.dataset[0].redirecturl);
$('#LoginWithPassword').val(resp.dataset[0].loginwithpassword);
$('#Password').val(resp.dataset[0].password);
$('#fbloginoption').val(resp.dataset[0].loginwithfb);
$('#fbcheckinoption').val(resp.dataset[0].hasCheckIn);
$('#emailoption').val(resp.dataset[0].loginwithemail);
$('#instagramoption').val(resp.dataset[0].loginwithinstagram);
$('#showProblemLink').val(resp.dataset[0].showProblemLink);
//$('#logoimgfile').val(resp.dataset[0].splashbrandimage);
//$('#logoimage').attr('src', imageFolder + resp.dataset[0].splashbrandimage);
// FitLogoImage(3); //resp.dataset[0].splashbrandimagestyle);
if (resp.dataset[0].isPlace==0) {$('#fbcheckinoption').val(0); $('#fbcheckinoption').attr('disabled', 'disabled');};
updatelogincontrolsView();
}
}
});
}
function FitLogoImage(istyle) {
switch (istyle) {
case '1':
$('#logoimage').attr('class', 'stretch');
break;
case '2':
$('#logoimage').attr('class', 'middle');
break;
case '3':
$('#logoimage').attr('class', 'fwidth');
break;
}
lstyle = istyle;
//setTimeout(setDraggable(), 500);
}
function SaveSplashSetting() {
var divOpacity = $("#spinner").val();
if ($("#spinner").val() == "")
{
alert("Please Enter divOpacity");
return false;
}
if (divOpacity > 1)
{
alert("Div opacity Value not valid !!! , Number must be from 0 to 1.00");
return false;
}
var iheight = $('#logoimage').height();
var ioffst = $('#headerdiv').offset().top - $('#logoimage').offset().top;
var curroffset = Math.round((ioffst / iheight) * 10000);
$.ajax({
url: './Handlers/MainHandler.ashx',
type: 'POST',
cache: false,
data: { command: 'SaveSplashSetting', splashbrand: $('#logomessage').val(),
splashbrandimage: $('#logoimgfile').val(), splashbrandimagestyle: lstyle,
splashmainimage: $('#mainpicfile').val(), splashcolorstyle: cstyle, curroffset: curroffset,
offerscustomtext: $('#offerscustomtext').val(), eventscustomtext: $('#eventscustomtext').val(), templateId: $("#templates option:selected").val(),
logoImg: $("#logoImg").val(), logoBckImg: $("#logoBckImg").val(), offericon: $('#offericon').val(), eventicon: $('#eventicon').val(),
infoDivOpacity: $("#spinner").val(), redirecturl: $('#redirectpage').val(),
loginwithpassword: $('#LoginWithPassword').val(), password: $('#Password').val(),
loginwithfb: $('#fbloginoption').val(), hasCheckIn: $('#fbcheckinoption').val(),
loginwithinstagram: $('#instagramoption').val(), loginwithemail: $('#emailoption').val(),
showProblemLink: $('#showProblemLink').val(),
useOriginalFacebookCover: $('#useOriginalFacebookCover').val(), welcomeGrText:$('#welcomeGrText').val(),
welcomeFullText:$('#welcomeFullText').val() ,welcomeFullTextEn:$('#welcomeFullTextEn').val()
},
dataType: 'jsonp',
success: function (resp) {
if (resp.error != "no error") {
alert(resp.error);
}
else
{
alert("Οι αλλαγές σας αποθηκεύτηκαν");
}
}
});
}
function PswdChange() {
}
function DeleteImage() {
var fname = imgs.dataset[(currpage * 8) + (selindex - 1)].fname;
if (fname == $('#mainpicfile').val()) {
alert('Δεν μπορείτε να σβήσετε την ενεργή εικόνα!');
}
else {
var answ = confirm('Σίγουρα θέλετε να σβίσετε την εικόνα αυτή;')
if (answ) {
$.ajax({
url: './Handlers/MainHandler.ashx',
type: 'POST',
cache: false,
data: { command: 'DeleteImage', fname: fname },
dataType: 'jsonp',
success: function (resp) {
if (resp.error != "no error") {
alert(resp.error);
}
else {
ShowImageSelector(imagtype);
}
}
});
}
}
}
function checkgenerallock() {
$('#lockmsg').text('');
$('#lockmsg').attr('class', 'notshownnotshown');
var stype = $('#subscrtype').val();
switch (stype) {
case '0': // none
$('#basic :input').attr('disabled', 'disabled');
$('#basicpro :input').attr('disabled', 'disabled');
$('#basicpro #lockmsg').text('Για την ενεργοποίηση της σελίδας απαιτείται το BasicPro πρόγραμμα');
$('#basicpro #lockmsg').attr('class', 'sticky');
$('#premium :input').attr('disabled', 'disabled');
$('#premium #lockmsg').text('Για την ενεργοποίηση της σελίδας απαιτείται το Premium πρόγραμμα');
$('#premium #lockmsg').attr('class', 'sticky');
$('#ultra :input').attr('disabled', 'disabled');
$('#ultra #lockmsg').text('Για την ενεργοποίηση της σελίδας απαιτείται το Ultra πρόγραμμα');
$('#ultra #lockmsg').attr('class', 'sticky');
break;
case '1': // Basic
$('#basicpro :input').attr('disabled', 'disabled');
$('#basicpro #lockmsg').text('Για την ενεργοποίηση της σελίδας απαιτείται το BasicPro πρόγραμμα');
$('#basicpro #lockmsg').attr('class', 'sticky');
$('#premium :input').attr('disabled', 'disabled');
$('#premium #lockmsg').text('Για την ενεργοποίηση της σελίδας απαιτείται το Premium πρόγραμμα');
$('#premium #lockmsg').attr('class', 'sticky');
$('#ultra :input').attr('disabled', 'disabled');
$('#ultra #lockmsg').text('Για την ενεργοποίηση της σελίδας απαιτείται το Ultra πρόγραμμα');
$('#ultra #lockmsg').attr('class', 'sticky');
break;
case '2': //basicpro
$('#premium :input').attr('disabled', 'disabled');
$('#premium #lockmsg').text('Για την ενεργοποίηση της σελίδας απαιτείται το Premium πρόγραμμα');
$('#premium #lockmsg').attr('class', 'sticky');
$('#ultra :input').attr('disabled', 'disabled');
$('#ultra #lockmsg').text('Για την ενεργοποίηση της σελίδας απαιτείται το Ultra πρόγραμμα');
$('#ultra #lockmsg').attr('class', 'sticky');
break;
case '3': //premium
$('#ultra :input').attr('disabled', 'disabled');
$('#ultra #lockmsg').text('Για την ενεργοποίηση της σελίδας απαιτείται το Ultra πρόγραμμα');
$('#ultra #lockmsg').attr('class', 'sticky');
break;
}
$('#fbpage').attr('disabled', 'disabled');
}
function CheckReportsLocked() {
/*var stype = $('#subscrtype').val();
if (stype == 0 || stype == 1) {
$("#from").attr('disabled', 'disabled');
$("#to").attr('disabled', 'disabled');
$("#ReportButton").attr('disabled', 'disabled');
$("#SelectDates").attr('disabled', 'disabled');
}
else {
$("#from").removeAttr('disabled');
$("#to").removeAttr('disabled');
$("#ReportButton").removeAttr('disabled');
$("#SelectDates").removeAttr('disabled');
}*/
}
function GetAdminSettings() {
$.ajax({
url: './Handlers/MainHandler.ashx',
type: 'POST',
cache: false,
data: { command: 'GetAdminSettings' },
dataType: 'jsonp',
success: function (resp) {
if (resp.error == "no error") {
$('#fbpage1').val(resp.dataset[0].facebookpage);
$('#fbpageid').val(resp.dataset[0].facebookpageid);
$('#instagrampage').val(resp.dataset[0].instagrampage);
$('#clientname').val(resp.dataset[0].splashbrand);
$('#clienttype').val(resp.dataset[0].subsrciptiontype);
$('#servicetype').val(resp.dataset[0].serviceId);
$('#username').val(resp.dataset[0].username);
$('#demomode').val(resp.dataset[0].demomode);
$('#stopCheckin').val(resp.dataset[0].stopcheckin);
demoControls();
}
}
})
}
function SaveAdminSettings() {
var asrvType = $('#servicetype').val();
if (asrvType==null) { asrvType="0";}
$.ajax({
url: './Handlers/MainHandler.ashx',
type: 'POST',
cache: false,
data: { command: 'SaveAdminSettings', fbpage: $('#fbpage1').val(), fbpageid: $('#fbpageid').val(), instagrampage: $('#instagrampage').val(),
clientname: $('#clientname').val(), clienttype: $('#clienttype').val(), servicetype: asrvType,
username: $('#username').val(), demomode: $('#demomode').val(), stopcheckin: $('#stopCheckin').val()
},
dataType: 'jsonp',
success: function (resp) {
if (resp.error == "no error") {
//GetAdminSettings();
window.location = window.location;
}
else
{
alert("Οι αλλαγές σας αποθηκεύτηκαν");
}
}
})
}
function GetLocationInfo() {
$.ajax({
url: './Handlers/MainHandler.ashx',
type: 'POST',
cache: false,
data: { command: 'GetLocationInfo' },
dataType: 'jsonp',
success: function (resp) {
if (resp.error == "no error") {
$('#title').val(resp.dataset[0].title);
$('#ownerfname').val(resp.dataset[0].ownerfname);
$('#ownerlname').val(resp.dataset[0].ownerlname);
$('#owneremail').val(resp.dataset[0].owneremail);
$('#owneremailnotes').val(resp.dataset[0].owneremailnotes);
$('#owneremail2').val(resp.dataset[0].owneremail2);
$('#website').val(resp.dataset[0].website);
$('#phone').val(resp.dataset[0].phone);
$('#phonenotes').val(resp.dataset[0].phonenotes);
$('#ownermobile').val(resp.dataset[0].ownermobile);
$('#ownermobilenotes').val(resp.dataset[0].ownermobilenotes);
$('#address').val(resp.dataset[0].address);
$('#zip').val(resp.dataset[0].zip);
$('#area').val(resp.dataset[0].area);
$('#state').val(resp.dataset[0].state);
$('#city').val(resp.dataset[0].city);
$('#country').val(resp.dataset[0].country);
$('#facebookpage').val(resp.dataset[0].facebookpage);
$('#respname').val(resp.dataset[0].respname);
$('#legalrespname').val(resp.dataset[0].legalrespname);
$('#respmobile').val(resp.dataset[0].respmobile);
$('#respmobilenotes').val(resp.dataset[0].respmobilenotes);
$('#respemail').val(resp.dataset[0].respemail);
$('#respemailnotes').val(resp.dataset[0].respemailnotes);
$('#respemail2').val(resp.dataset[0].respemail2);
$('#timolinfo').val(resp.dataset[0].timolinfo);
$('#timolprof').val(resp.dataset[0].timolprof);
$('#timolafm').val(resp.dataset[0].timolafm);
$('#timoldoy').val(resp.dataset[0].timoldoy);
$('#timoladdress').val(resp.dataset[0].timoladdress);
$('#timolzip').val(resp.dataset[0].timolzip);
$('#timolarea').val(resp.dataset[0].timolarea);
$('#timolcity').val(resp.dataset[0].timolcity);
$('#timolcountry').val(resp.dataset[0].timolcountry);
$('#timolphone').val(resp.dataset[0].timolphone);
$('#timolphonenotes').val(resp.dataset[0].timolphonenotes);
$('#notes').val(resp.dataset[0].notes);
$('#clientusername').val(resp.dataset[0].clientusername);
$('#clientpassword').val(resp.dataset[0].clientpassword);
$('#from').val(resp.dataset[0].fromdate);
$('#to').val(resp.dataset[0].todate);
$('#months').val(resp.dataset[0].months);
$('#program').val(resp.dataset[0].program);
$('#router').val(resp.dataset[0].router);
$('#routercharge').val(resp.dataset[0].routercharge);
$('#salesmenid').val(resp.dataset[0].salesmenid);
$('#clientusername').val(resp.dataset[0].clientusername);
$('#clientpassword').val(resp.dataset[0].clientpassword);
$('#partnerId').val(resp.dataset[0].partnerId);
$('#clientType').val(resp.dataset[0].clientType);
$('#SSID').val(resp.dataset[0].SSID);
$('#routerSerials').val(resp.dataset[0].routerSerials);
$('#partnerImg').val(resp.dataset[0].partnerImg);
$('#partnerUrl').val(resp.dataset[0].partnerUrl);
$('#contactCorrect').val(resp.dataset[0].contactCorrect);
$('#salesPhone').val(resp.dataset[0].salesPhone);
$('#BusinessTypeId').val(resp.dataset[0].BusinessTypeId);
$('#BusinessTypeId2').val(resp.dataset[0].BusinessTypeId2);
$('#BusinessTypeId3').val(resp.dataset[0].BusinessTypeId3);
$('#BusinessTypeId4').val(resp.dataset[0].BusinessTypeId4);
$('#BusinessTypeId5').val(resp.dataset[0].BusinessTypeId5);
$('#userId').val(resp.dataset[0].userId);
if (resp.dataset[0].clientType==5) {$('#partnerImgDiv').attr('style', 'display:block');} else {$('#partnerImgDiv').attr('style', 'display:none');}
}
}
})
}
function SaveLocationInfo() {
$.ajax({
url: './Handlers/MainHandler.ashx',
type: 'POST',
cache: false,
data: {
command: 'SaveLocationInfo',
title: $('#title').val(),
ownerfname: $('#ownerfname').val(),
ownerlname: $('#ownerlname').val(),
owneremail: $('#owneremail').val(),
owneremailnotes: $('#owneremailnotes').val(),
owneremail2: $('#owneremail2').val(),
website: $('#website').val(),
phone: $('#phone').val(),
phonenotes: $('#phonenotes').val(),
ownermobile: $('#ownermobile').val(),
ownermobilenotes: $('#ownermobilenotes').val(),
address: $('#address').val(),
zip: $('#zip').val(),
area: $('#area').val(),
state: $('#state').val(),
city: $('#city').val(),
country: $('#country').val(),
facebookpage: $('#facebookpage').val(),
respname: $('#respname').val(),
legalrespname: $('#legalrespname').val(),
respmobile: $('#respmobile').val(),
respmobilenotes: $('#respmobilenotes').val(),
respemail: $('#respemail').val(),
respemailnotes: $('#respemailnotes').val(),
respemail2: $('#respemail2').val(),
timolinfo: $('#timolinfo').val(),
timolprof: $('#timolprof').val(),
timolafm: $('#timolafm').val(),
timoldoy: $('#timoldoy').val(),
timoladdress: $('#timoladdress').val(),
timolzip: $('#timolzip').val(),
timolarea: $('#timolarea').val(),
timolcity: $('#timolcity').val(),
timolcountry: $('#timolcountry').val(),
timolphone: $('#timolphone').val(),
timolphonenotes: $('#timolphonenotes').val(),
notes: $('#notes').val(),
fromdate: $('#from').val(),
todate: $('#to').val(),
months: $('#months').val(),
program: $('#program').val(),
router: $('#router').val(),
routercharge: $('#routercharge').val(),
salesmenid: $('#salesmenid').val(),
clientusername: $('#clientusername').val(),
clientpassword: $('#clientpassword').val(),
partnerId: $('#partnerId').val(),
clientType: $('#clientType').val(),
routerSerials:$('#routerSerials').val(),
partnerImg:$('#partnerImg').val(),
partnerUrl:$('#partnerUrl').val(),
contactCorrect:$('#contactCorrect').val(),
salesPhone:$('#salesPhone').val(),
BusinessTypeId:$('#BusinessTypeId').val(),
BusinessTypeId2:$('#BusinessTypeId2').val(),
BusinessTypeId3:$('#BusinessTypeId3').val(),
BusinessTypeId4:$('#BusinessTypeId4').val(),
BusinessTypeId5:$('#BusinessTypeId5').val(),
userId: $('#userId').val(),
alert: $('#ContentPlaceHolder1_MainHolder1_partnerId').val()
},
dataType: 'jsonp',
success: function (resp) {
if (resp.error == "no error") {
window.location = window.location;
}
else
{
alert("Οι αλλαγές σας αποθηκεύτηκαν");
}
}
})
}
function GetSalesmen() {
$.ajax({
url: './Handlers/MainHandler.ashx',
type: 'POST',
cache: false,
data: { command: 'GetSalesmen' },
dataType: 'jsonp',
success: function (resp) {
if (resp.error == "no error") {
if (resp.dataset.length > 0) {
var selhtml = "";
selhtml += "";
for (var i in resp.dataset) {
selhtml += "";
}
$('#salesmenid').html(selhtml);
//GetSelectedLocation(resp.dataset[0].locationid);
}
}
}
})
}
function CopyInfo() {
var answ = confirm('Τα στοιχεία τιμολόγησης θα αντικατασταθούν από τα αντίστοιχα στοιχεία επιχείρησης. Συνέχεια;')
if (answ) {
$('#timoladdress').val($('#address').val());
$('#timolzip').val($('#zip').val());
$('#timolarea').val($('#area').val());
$('#timolcity').val($('#city').val());
$('#timolcountry').val($('#country').val());
$('#timolphone').val($('#phone').val());
}
}
function CalcTodate() {
var answ = confirm('Θα γίνει υπολογισμός της ημ/νίας λήξης βάσει των μηνών. Συνέχεια;')
if (answ) {
var intRegex = /^\d+$/;
if (intRegex.test($('#months').val()))
{
$.ajax({
url: './Handlers/MainHandler.ashx',
type: 'POST',
cache: false,
data: { command: 'AddMonths', fromdate: $('#from').val(), months: $('#months').val() },
dataType: 'jsonp',
success: function (resp) {
if (resp.error == "no error") {
if (resp.dataset.length > 0) {
$('#to').val(resp.dataset[0].newdate);
//GetSelectedLocation(resp.dataset[0].locationid);
}
}
}
})
/* queryDate = $('#from').val();
var parsedDate = $.datepicker.parseDate('dd/mm/yy', queryDate);
parsedDate.setMonth(parsedDate.getMonth() + $('#months').val());
$('#to').datepicker('setDate', parsedDate);
$("#to").datepicker("option", "dateFormat", "dd/mm/yy");
var d = new Date(year, month, day);
d.setMonth(d.getMonth() + $('#months').val());
// var date2 = $('#from').datepicker('getDate');
//date2.setMonth(date2.getMonth() + $('#months').val());
//date2.setDate(date2.getDate() - 1);
//$('#to').datepicker('setDate', date2);
//$("#to").datepicker("option", "dateFormat", "dd/mm/yy");
//delete date2;
*/
}
else
alert("Το πεδίο μήνες δεν έχει αριθμό!")
}
}
function DrawMap(latitude, longtitude) {
/*var htmlstr = '
';
$('#mapdiv').html(htmlstr);
*/
//$('#mapimg').attr('src', 'https://maps.googleapis.com/maps/api/staticmap?center=37.94361,23.70639&zoom=17&size=600x300&markers=color:red%7Clabel:A%7C37.94361,23.70639');
$('#mapframe').attr('src', 'https://www.google.com/maps/embed/v1/place?key=AIzaSyC8IJ-zBZA06JBm3X7NJUm9VV5_aDs-NpY&q=' + latitude + ',' + longtitude + '&zoom=18');
}
function GetGpsData() {
$.ajax({
url: './Handlers/MainHandler.ashx',
type: 'POST',
cache: false,
data: { command: 'GetGpsData' },
dataType: 'jsonp',
success: function (resp) {
if (resp.error == "no error") {
if (resp.dataset.length > 0) {
for (var i in resp.dataset) {
var latitude = resp.dataset[i].latitude;
var longitude = resp.dataset[i].longitude;
DrawMap(latitude, longitude);
$('#lastdate').text(resp.dataset[i].updatetime);
$('#lastgpsdate').text(resp.dataset[i].gpsdate);
}
}
}
}
})
}
//Allages stis rythmiseis tou admin panel.
function GetLoginSettings1(){
$.ajax({
url: './Handlers/MainHandler.ashx',
type: 'POST',
cache: false,
data: { command: 'GetLoginSettings1' },
dataType: 'jsonp',
success: function (resp) {
if (resp.error == "no error") {
//ChangeColors(resp.dataset[0].splashcolorstyle);
//$('#logoimage').attr('src', imageFolder + resp.dataset[0].splashbrandimage);
//FitLogoImage(resp.dataset[0].splashbrandimagestyle);
$('#logotext').text(resp.dataset[0].splashbrand);
$('#mainimage').attr('src', imageFolder + resp.dataset[0].splashmainimage + "?" + new Date().getTime());
$('#cover').attr('src', resp.dataset[0].coverpictureid);
var $primg = $("
").attr('src', resp.dataset[0].profpictureid);
$('#profimage').empty().append($primg);
//$('#offsetxvalue').text(resp.dataset[0].offsetx);
//$('#offsetyvalue').text(resp.dataset[0].offsety);
$("#coverimage").css({ "top": resp.dataset[0].offsety + "px", "left": resp.dataset[0].offsetx + "px" });
}
} })
}
function passrecoverymessage() {
}
function SetSelectedTemplate() {
var templSelectedInfo = $("#templates option:selected").attr("info");
var templArr = templSelectedInfo.split(';');
$("#mainpicfileDiv").attr('class', 'notshown');
$("#mainpicfileDivSep").attr('class', 'notshown');
$("#logoImgDiv").attr('class', 'notshown');
$("#logoImgDivSep").attr('class', 'notshown');
$("#logoBckImgDiv").attr('class', 'notshown');
$("#logoBckImgDivSep").attr('class', 'notshown');
$("#OpacityDiv").attr('class', 'notshown');
$("#OpacityDivSep").attr('class', 'notshown');
for (i = 0; i < templArr.length; i++) {
$("#"+templArr[i]+"Div").attr('class', 'bottomdotted');
$("#"+templArr[i]+"DivSep").attr('class', 'verticalspace');
}
}
function updatelogincontrolsView()
{
var fbLogin = $("#fbloginoption option:selected").val();
var instagramLogin = $("#instagramoption option:selected").val();
var mailLogin = $("#emailoption option:selected").val();
var pwLogin = $("#LoginWithPassword option:selected").val();
$("#fbButton").attr('style', '');
$("#instagramButton").attr('style', '');
$("#mailButton").attr('style', '');
$("#pwButton").attr('style', '');
$("#cnButton").attr('style', 'display:none');
if (fbLogin == 0) {
$("#fbButton").attr('style', 'display:none');
}
if (mailLogin == 0) {
$("#mailButton").attr('style', 'display:none');
}
if (instagramLogin == 0) {
$("#instagramButton").attr('style', 'display:none');
}
if (pwLogin == 0) {
$("#pwButton").attr('style', 'display:none');
}
if (pwLogin == 0 && fbLogin == 0 && mailLogin == 0) {
$("#cnButton").attr('style', '');
}
}
function clientTypeSelectorChange(selctr){
if ($(selctr).val()==5) {$('#partnerImgDiv').attr('style', 'display:block');} else {$('#partnerImgDiv').attr('style', 'display:none');}
}