diff --git a/www/assets/js/telegram.js b/www/assets/js/telegram.js new file mode 100644 index 0000000..9509e56 --- /dev/null +++ b/www/assets/js/telegram.js @@ -0,0 +1,27 @@ +/* + * 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 sendTelegram() { + app.dialog.preloader("Sending..."); + apirequest(SETTINGS.apis.sendtelegram, { + accountnumber: getStorage("accountnumber"), + accountkey: getStorage("accountkey"), + message: $("#telegrammessage").val(), + to: $("#telegramto").val(), + from: $("#telegramfrom").val(), + instructions: $("#telegraminstructions").val() + }, function (resp) { + app.dialog.close(); + if (resp.status == "OK") { + app.dialog.alert(resp.msg, "Telegram Sent!"); + } else if (resp.status == "ERROR") { + app.dialog.alert(resp.msg, "Error"); + } + }, function (error) { + app.dialog.close(); + app.dialog.alert("There's a server or network problem. Check your Internet connection or try again later.", "Error"); + }); +} \ No newline at end of file diff --git a/www/index.html b/www/index.html index d1d5de4..1c66926 100644 --- a/www/index.html +++ b/www/index.html @@ -55,6 +55,7 @@ + diff --git a/www/pages/telegram.html b/www/pages/telegram.html new file mode 100644 index 0000000..f8cdaba --- /dev/null +++ b/www/pages/telegram.html @@ -0,0 +1,92 @@ + + +
+ + + + +
+
+
+
+
+
+
    +
  • + Send a telegram with Helena Express for $15. + We'll hand-deliver your message to anywhere in Helena, East Helena, Montana City, the Helena Valley, and the hills around Helena. + If you put in a destination outside the Helena area, your telegram will be delivered by the postal service. + If the recipient isn't home, we'll leave a note and try again the following day, usually at a different time of day. + If nobody answers the second time, we'll either leave the telegram at their front door or, + if you request it in the special instructions, send it to them via the U.S. Mail. +
  • + +
  • +
    +
    Message
    +
    + + +
    +
    +
  • +
  • +
    +
    To
    +
    + + +
    +
    +
  • +
  • +
    +
    From
    +
    + + +
    +
    +
  • +
  • +
    +
    Special Instructions
    +
    + + +
    +
    +
  • +
  • + By pressing the "Send Telegram" button, you agree that we can + bill your saved payment method for $15. +
  • +
  • +
    Send Telegram
    +
  • +
+
+
+
+
+
+
+ +
\ No newline at end of file diff --git a/www/routes.js b/www/routes.js index c965987..ee1d1ea 100644 --- a/www/routes.js +++ b/www/routes.js @@ -85,6 +85,12 @@ var routes = [ href: "/account", icon: "fad fa-user-circle", text: "Manage your Helena Express account and check rewards points balance." + }, + { + title: "Telegram", + href: "/telegram", + icon: "fad fa-typewriter", + text: "Send a telegram anywhere in the Helena area. Hand-delivered within 24 hours." } ] }) @@ -175,6 +181,22 @@ var routes = [ } } }, + { + path: '/telegram', + name: 'telegram', + url: './pages/telegram.html', + on: { + pageBeforeIn: function () { + checkIfAccountGoodWithPaymentMethod(function (ok) { + if (!ok) { + $("#addPaymentMethodNag").css("display", ""); + } + }, function (error) { + $("#addPaymentMethodNag").css("display", ""); + }); + } + } + }, { path: '/track', url: './pages/track.html', diff --git a/www/settings.js b/www/settings.js index 979f536..8c72284 100644 --- a/www/settings.js +++ b/www/settings.js @@ -17,6 +17,7 @@ var SETTINGS = { accountregister: "http://localhost/helena.express/apis/account/register/", redirecttopaymentsetup: "http://localhost/helena.express/apis/account/redirecttopaymentsetup/", finishpaymentsetup: "http://localhost/helena.express/apis/account/finishpaymentsetup/", + sendtelegram: "http://localhost/helena.express/apis/telegram" }, stripe_pubkey: "pk_test_51J6qFXCa1Fboir5UzPO3LCiMsVNiFP2lq4wR0dEcjJJVzAaJ3uRggDekZPB3qeYpMD3ayIYHKyD5sSn0IFLlEXMW001LqrvGSH", appointmenturl: "https://appointments.netsyms.com/index.php?hlnexp=1&embed=1&only=1&theme=darkly",