Add setup GUI to link the app with a Netsyms customer account.

master
Skylar Ittner 4 years ago
parent 815610e23b
commit 885c2a23b1

@ -0,0 +1,74 @@
/*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
function setupNewAccount(name) {
app.dialog.preloader("Finishing up...");
apirequest(
SETTINGS.apis.registernew,
{
name: name
},
function (resp) {
app.dialog.close();
if (resp.status == "ERROR") {
app.dialog.alert(resp.msg, "Error");
return;
}
setStorage("client_uuid", resp.client_uuid);
setStorage("device_uuid", resp.device_uuid);
restartApplication();
},
function (xhr) {
app.dialog.close();
try {
var error = $.parseJSON(xhr.responseText);
if (error && typeof error.msg != 'undefined') {
app.dialog.alert(error.msg + " (NEWAC_XHR)", "Error");
} else {
app.dialog.alert("A server or network error occurred. Try again later. (NEWAC_XHRNOMSG)", "Error");
}
} catch (ex) {
app.dialog.alert("A server error occurred. Try again later. (NEWAC_XHRBADJSON)", "Error");
}
}, "POST");
}
function setupExistingAccount(email, phone, invoiceid) {
app.dialog.preloader("Finding your account...");
apirequest(
SETTINGS.apis.registerexisting,
{
email: email,
phone: phone,
invoiceid: invoiceid
},
function (resp) {
app.dialog.close();
if (resp.status == "ERROR") {
app.dialog.alert(resp.msg, "Error");
return;
}
setStorage("client_uuid", resp.client_uuid);
setStorage("device_uuid", resp.device_uuid);
restartApplication();
},
function (xhr) {
app.dialog.close();
try {
var error = $.parseJSON(xhr.responseText);
if (error && typeof error.msg != 'undefined') {
app.dialog.alert(error.msg + " (LINKAC_XHR)", "Error");
} else {
app.dialog.alert("A server or network error occurred. Try again later. (LINKAC_XHRNOMSG)", "Error");
}
} catch (ex) {
app.dialog.alert("A server error occurred. Try again later. (LINKAC_XHRBADJSON)", "Error");
}
}, "POST");
}

@ -44,6 +44,7 @@
<script src="assets/js/platform.js"></script>
<script src="assets/js/util.js"></script>
<script src="assets/js/linkaccount.js"></script>
<script src="assets/js/track.js"></script>
<script src="assets/js/offers.js"></script>

@ -0,0 +1,61 @@
<!-- This Source Code Form is subject to the terms of the Mozilla Public
- License, v. 2.0. If a copy of the MPL was not distributed with this
- file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
<div class="page" data-name="linkaccount">
<div class="navbar">
<div class="navbar-inner text-color-white color-white">
<div class="left">
<a class="link back" href="#">
<i class="icon icon-back"></i>
<span class="if-not-md">Back</span>
</a>
</div>
<div class="title">Setup Account</div>
</div>
</div>
<div class="page-content noselect">
<div class="row justify-content-center margin-top">
<div class="col-100 medium-90 xlarge-75 margin-horizontal">
<div class="block text-color-white">
<p>Before we get started, tell us a little bit about yourself.
<span class="taptext">Tap</span><span class="clicktext">Click</span> the option that best describes you.
</div>
</div>
<div class="col-100 medium-90 xlarge-75 margin-horizontal">
<div class="card margin">
<div class="card-content text-align-center padding-vertical" onclick='router.navigate("/linkaccount/new")'>
<div>
<div class="card-header display-block no-hairlines">
<h1 class="no-margin"><i class="fad fa-user-plus"></i></h1>
<h2 class="no-margin">New Customer</h2>
</div>
</div>
<div class="card-content-padding">
<p>I haven't done business with Netsyms before.
</div>
</div>
</div>
</div>
<div class="col-100 medium-90 xlarge-75 margin-horizontal">
<div class="card margin">
<div class="card-content text-align-center padding-vertical" onclick='router.navigate("/linkaccount/existing")'>
<div>
<div class="card-header display-block no-hairlines">
<h1 class="no-margin"><i class="fad fa-user-check"></i></h1>
<h2 class="no-margin">Current Customer</h2>
</div>
</div>
<div class="card-content-padding">
<p>I've received at least one invoice from Netsyms in the past.
</div>
</div>
</div>
</div>
</div>
</div>
</div>

@ -0,0 +1,72 @@
<!-- This Source Code Form is subject to the terms of the Mozilla Public
- License, v. 2.0. If a copy of the MPL was not distributed with this
- file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
<div class="page" data-name="linkaccount_new">
<div class="navbar">
<div class="navbar-inner text-color-white color-white">
<div class="left">
<a class="link back" href="#">
<i class="icon icon-back"></i>
<span class="if-not-md">Back</span>
</a>
</div>
<div class="title">Setup Account</div>
</div>
</div>
<div class="page-content noselect">
<div class="row justify-content-center margin-top">
<div class="col-100 medium-90 xlarge-75 margin-horizontal">
<div class="card margin">
<div class="card-content padding-vertical">
<div>
<div class="card-header display-block no-hairlines text-align-center">
<h2 class="no-margin">Welcome back!<br>Let's find your account.</h2>
<p>Fill in as much info as you can.
</div>
</div>
<div class="list">
<ul>
<li class="item-content item-input item-input-outline">
<div class="item-inner">
<div class="item-title item-floating-label">Email</div>
<div class="item-input-wrap">
<input type="email" id="existingaccount_email" />
<span class="input-clear-button"></span>
</div>
</div>
</li>
<li class="item-content item-input item-input-outline">
<div class="item-inner">
<div class="item-title item-floating-label">Phone</div>
<div class="item-input-wrap">
<input type="tel" id="existingaccount_phone" />
<span class="input-clear-button"></span>
</div>
</div>
</li>
<li class="item-content item-input item-input-outline">
<div class="item-inner">
<div class="item-title item-floating-label">Invoice Number</div>
<div class="item-input-wrap">
<input type="tel" id="existingaccount_invoiceid" />
<span class="input-clear-button"></span>
<div class="item-input-info">Find it in the dark blue box on any invoice.</div>
</div>
</div>
</li>
</ul>
</div>
<div class="card-content-padding">
<div class="button" onclick="setupExistingAccount($('#existingaccount_email').val(),$('#existingaccount_phone').val(),$('#existingaccount_invoiceid').val())"><i class="far fa-chevron-right"></i> Finish</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>

@ -0,0 +1,57 @@
<!-- This Source Code Form is subject to the terms of the Mozilla Public
- License, v. 2.0. If a copy of the MPL was not distributed with this
- file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
<div class="page" data-name="linkaccount_new">
<div class="navbar">
<div class="navbar-inner text-color-white color-white">
<div class="left">
<a class="link back" href="#">
<i class="icon icon-back"></i>
<span class="if-not-md">Back</span>
</a>
</div>
<div class="title">Setup Account</div>
</div>
</div>
<div class="page-content noselect">
<div class="row justify-content-center margin-top">
<div class="col-100 medium-90 xlarge-75 margin-horizontal">
<div class="block text-color-white">
<p>Welcome and thanks for choosing Netsyms Technologies!
</div>
</div>
<div class="col-100 medium-90 xlarge-75 margin-horizontal">
<div class="card margin">
<div class="card-content text-align-center padding-vertical">
<div>
<div class="card-header display-block no-hairlines">
<h2 class="no-margin">What's your name?</h2>
</div>
</div>
<div class="list">
<ul>
<li class="item-content item-input item-input-outline">
<div class="item-inner">
<div class="item-title item-floating-label">Name</div>
<div class="item-input-wrap">
<input type="text" id="newaccount_name" />
<span class="input-clear-button"></span>
</div>
</div>
</li>
</ul>
</div>
<div class="card-content-padding">
<div class="button" onclick="setupNewAccount($('#newaccount_name').val())"><i class="far fa-chevron-right"></i> Finish</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>

@ -54,6 +54,29 @@ var routes = [
url: './pages/track.html',
name: 'track'
},
{
path: '/linkaccount',
url: './pages/linkaccount.html',
name: 'linkaccount',
routes: [
{
path: "/new",
url: "./pages/linkaccount_new.html",
name: "linkaccount_new",
options: {
transition: 'f7-parallax'
}
},
{
path: "/existing",
url: "./pages/linkaccount_existing.html",
name: "linkaccount_existing",
options: {
transition: 'f7-parallax'
}
}
]
},
{
path: '/offers',
name: 'offers',

@ -7,7 +7,9 @@
var SETTINGS = {
apis: {
track: "https://track.netsyms.com/public/api.php",
offers: "https://apis.netsyms.net/repairapp/offers.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"
},
branding: {
apptitle: "Netsyms PC Repair",

Loading…
Cancel
Save