|
|
|
@ -11,6 +11,7 @@ setupsynckey = "";
|
|
|
|
|
setupsyncurl = "";
|
|
|
|
|
|
|
|
|
|
netsymscomurl = "https://account.netsyms.com/mobile/index.php";
|
|
|
|
|
netsymsbizurl = "https://BIZID.netsyms.biz/accounthub/mobile/index.php";
|
|
|
|
|
|
|
|
|
|
if (localStorage.getItem("firstrun") === null) {
|
|
|
|
|
$("#setuptitle").text("Setup");
|
|
|
|
@ -116,7 +117,7 @@ function personalsetup() {
|
|
|
|
|
if (result.status == "OK") {
|
|
|
|
|
var code = result.code;
|
|
|
|
|
var accid = addaccount(username, password, netsymscomurl, code);
|
|
|
|
|
switchaccount(accid);
|
|
|
|
|
switchaccount(accid, false);
|
|
|
|
|
localStorage.setItem("firstrun", "1");
|
|
|
|
|
navigator.notification.alert("Account connected!", null, "Success", 'Continue');
|
|
|
|
|
restartApplication();
|
|
|
|
@ -131,6 +132,39 @@ function personalsetup() {
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function businesssetup() {
|
|
|
|
|
app.preloader.show();
|
|
|
|
|
var username = $("#personal_username").val();
|
|
|
|
|
var password = $("#personal_password").val();
|
|
|
|
|
var url = netsymsbizurl.replace("BIZID", $("#bizid").val());
|
|
|
|
|
|
|
|
|
|
$.post(url, {
|
|
|
|
|
username: username,
|
|
|
|
|
password: password,
|
|
|
|
|
key: "NOKEY",
|
|
|
|
|
desc: device.platform + " " + device.model + " " + device.serial,
|
|
|
|
|
action: "generatesynccode"
|
|
|
|
|
}, function (result) {
|
|
|
|
|
app.preloader.hide();
|
|
|
|
|
if (result.status == "OK") {
|
|
|
|
|
var code = result.code;
|
|
|
|
|
var accid = addaccount(username, password, url, code);
|
|
|
|
|
switchaccount(accid, false);
|
|
|
|
|
localStorage.setItem("firstrun", "1");
|
|
|
|
|
navigator.notification.alert("Account connected!", null, "Success", 'Continue');
|
|
|
|
|
restartApplication();
|
|
|
|
|
} else if (result.status == "ERROR") {
|
|
|
|
|
navigator.notification.alert(result.msg, null, "Error", 'Dismiss');
|
|
|
|
|
} else {
|
|
|
|
|
navigator.notification.alert("Something went wrong, please try again.", null, "Error", 'Dismiss');
|
|
|
|
|
}
|
|
|
|
|
}, "json").fail(function () {
|
|
|
|
|
app.preloader.hide();
|
|
|
|
|
navigator.notification.alert("Something went wrong, please try again.", null, "Error", 'Dismiss');
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function scanCode() {
|
|
|
|
|
try {
|
|
|
|
|
cordova.plugins.barcodeScanner.scan(
|
|
|
|
|