diff --git a/www/assets/css/app.css b/www/assets/css/app.css index d8e4ca9..1556a04 100644 --- a/www/assets/css/app.css +++ b/www/assets/css/app.css @@ -54,16 +54,16 @@ Framework7 and FontAwesome both have a .fab class -webkit-app-region: no-drag; } -.list ul { +.list.transparent ul { background-color: rgba(255,255,255,0.65); } -.list ul li.item-divider { +.list.transparent ul li.item-divider { background-color: rgba(255,255,255,0.5); } -.theme-dark .list ul { +.theme-dark .list.transparent ul { background-color: rgba(0,0,0,0.65); } -.theme-dark .list ul li.item-divider { +.theme-dark .list.transparent ul li.item-divider { background-color: rgba(0,0,0,0.5); } diff --git a/www/assets/js/linkaccount.js b/www/assets/js/linkaccount.js index 515c27b..73c0da2 100644 --- a/www/assets/js/linkaccount.js +++ b/www/assets/js/linkaccount.js @@ -21,7 +21,15 @@ function setupNewAccount(name) { } setStorage("client_uuid", resp.client_uuid); setStorage("device_uuid", resp.device_uuid); - restartApplication(); + app.toast.create({ + icon: '', + text: '

Account Set Up!

', + position: 'center', + closeTimeout: 3000 + }).open(); + router.navigate("/home", { + transition: "f7-dive" + }); }, function (xhr) { app.dialog.close(); @@ -56,7 +64,15 @@ function setupExistingAccount(email, phone, invoiceid) { } setStorage("client_uuid", resp.client_uuid); setStorage("device_uuid", resp.device_uuid); - restartApplication(); + app.toast.create({ + icon: '', + text: '

Account Linked!

', + position: 'center', + closeTimeout: 3000 + }).open(); + router.navigate("/home", { + transition: "f7-dive" + }); }, function (xhr) { app.dialog.close(); @@ -71,4 +87,10 @@ function setupExistingAccount(email, phone, invoiceid) { app.dialog.alert("A server error occurred. Try again later. (LINKAC_XHRBADJSON)", "Error"); } }, "POST"); +} + +function unlinkAccount() { + localStorage.removeItem("client_uuid"); + localStorage.removeItem("device_uuid"); + restartApplication(); } \ No newline at end of file diff --git a/www/assets/js/track.js b/www/assets/js/track.js index ca87211..e949fb5 100644 --- a/www/assets/js/track.js +++ b/www/assets/js/track.js @@ -6,11 +6,47 @@ function openTrackingInfoPage(id) { if (typeof id == "undefined" || id == null || id == "") { + app.input.validate("#deviceid"); return; } + router.navigate("/track/" + id); } +function addClientMachineSuggestions() { + $("#client-link-account-message").addClass("display-none"); + $("#client-machine-suggestion-list").addClass("display-none"); + $("#client-machine-suggestion-list-preloader").addClass("display-none"); + $("#client-machine-suggestion-list ul").html(""); + if (inStorage("client_uuid")) { + $("#client-machine-suggestion-list-preloader").removeClass("display-none"); + apirequest( + SETTINGS.apis.getmachines, + { + clientuuid: getStorage("client_uuid") + }, + function (resp) { + if (resp.status == "OK") { + if (resp.machines.length > 0) { + for (var i = 0; i < resp.machines.length; i++) { + var id = resp.machines[i].id; + var type = resp.machines[i].type.label; + var icon = resp.machines[i].icon; + $("#client-machine-suggestion-list ul").append('
  • ' + + '
    ' + + ' ' + type + " #" + id + + '
  • '); + } + $("#client-machine-suggestion-list").removeClass("display-none"); + } + $("#client-machine-suggestion-list-preloader").addClass("display-none"); + } + }, "GET"); + } else { + $("#client-link-account-message").removeClass("display-none"); + } +} + function trackOpenAsync(routeTo, routeFrom, resolve, reject) { app.dialog.preloader("Loading..."); diff --git a/www/pages/linkaccount.html b/www/pages/linkaccount.html index 71bc5e8..0d38bad 100644 --- a/www/pages/linkaccount.html +++ b/www/pages/linkaccount.html @@ -12,7 +12,7 @@ Back -
    Setup Account
    +
    Link Account
    @@ -21,8 +21,7 @@
    -

    Before we get started, tell us a little bit about yourself. - TapClick the option that best describes you. +

    TapClick the option that best describes you.

    diff --git a/www/pages/linkaccount_existing.html b/www/pages/linkaccount_existing.html index 90f08ab..9d0c503 100644 --- a/www/pages/linkaccount_existing.html +++ b/www/pages/linkaccount_existing.html @@ -12,7 +12,7 @@ Back
    -
    Setup Account
    +
    Link Account
    diff --git a/www/pages/settings.html b/www/pages/settings.html index b4eb2a5..fefb833 100644 --- a/www/pages/settings.html +++ b/www/pages/settings.html @@ -19,7 +19,7 @@
    -
    +
      {{#each settings}}
    • diff --git a/www/pages/track.html b/www/pages/track.html index 209f6cb..b252885 100644 --- a/www/pages/track.html +++ b/www/pages/track.html @@ -22,17 +22,14 @@
      -
      -
      -

      Device ID or Tracking Code

      -
      -
      +
      • +
        Device ID or Tracking Code
        - +
        @@ -43,6 +40,23 @@
        Track
      + + +
    diff --git a/www/pages/trackresult.html b/www/pages/trackresult.html index 7d33fd2..3309abc 100644 --- a/www/pages/trackresult.html +++ b/www/pages/trackresult.html @@ -20,7 +20,7 @@
    -
    +
    • Info
    • {{#each info}} diff --git a/www/routes.js b/www/routes.js index b4f2f8f..6e4aae1 100644 --- a/www/routes.js +++ b/www/routes.js @@ -52,7 +52,15 @@ var routes = [ { path: '/track', url: './pages/track.html', - name: 'track' + name: 'track', + on: { + pageBeforeIn: function () { + addClientMachineSuggestions(); + $("#deviceid").val("0"); + app.input.validate("#deviceid"); + $("#deviceid").val(""); + } + } }, { path: '/linkaccount', @@ -102,6 +110,27 @@ var routes = [ name: 'settings', async: function (routeTo, routeFrom, resolve, reject) { var settings = []; + if (!inStorage("client_uuid")) { + settings.push( + { + setting: "linkaccount", + title: "Link To Account", + text: "Connect to your Netsyms billing account to enable more features.", + onclick: "router.navigate('/linkaccount')", + link: true + } + ); + } else { + settings.push( + { + setting: "linkaccount", + title: "Unlink Account", + text: "Disconnect this device from your Netsyms account.", + onclick: "unlinkAccount()", + link: true + } + ); + } settings.push( { setting: "display", diff --git a/www/settings.js b/www/settings.js index 2e199ae..d21ac87 100644 --- a/www/settings.js +++ b/www/settings.js @@ -7,6 +7,7 @@ var SETTINGS = { apis: { track: "https://track.netsyms.com/public/api.php", + getmachines: "https://apis.netsyms.net/repairapp/getmachines.php", offers: "https://apis.netsyms.net/repairapp/offers.php", registernew: "https://apis.netsyms.net/repairapp/registernew.php", registerexisting: "https://apis.netsyms.net/repairapp/registerexisting.php"