Add telegram sending feature

master
Skylar Ittner 2 years ago
parent 29003326b3
commit 7a16b722cd

@ -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");
});
}

@ -55,6 +55,7 @@
<script src="assets/js/util.js"></script>
<script src="assets/js/track.js"></script>
<script src="assets/js/dropandsend.js"></script>
<script src="assets/js/telegram.js"></script>
<script src="assets/js/pickup.js"></script>
<script src="assets/js/rates.js"></script>
<script src="assets/js/account.js"></script>

@ -0,0 +1,92 @@
<!-- 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="telegram">
<div class="navbar">
<div class="navbar-bg"></div>
<div class="navbar-inner">
<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">Telegram</div>
</div>
</div>
<div class="page-content">
<div class="row justify-content-center">
<div class="col-100 medium-90 xlarge-75 margin-horizontal">
<div class="card margin">
<div class="card-content text-align-center padding-vertical" id="pickupRequestForm">
<div class="list media-list">
<ul>
<li class="padding text-align-center">
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.
</li>
<li class="padding text-align-center" id="addPaymentMethodNag" style="display: none;">
<i class="fad fa-exclamation-circle fa-2x text-color-orange"></i><br>
You need an account with a linked credit card to send a telegram in the app. <span class="taptext">Tap</span><span class="clicktext">Click</span> the button to update your account.
<a class="button hapticbtn button-fill margin" href="/account"><i class="fas fa-user-circle"></i> My Account</a>
</li>
<li class="item-content item-input item-input-outline">
<div class="item-inner">
<div class="item-title item-floating-label">Message</div>
<div class="item-input-wrap">
<textarea id="telegrammessage" rows="5" class="resizable" placeholder=""></textarea>
<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">To</div>
<div class="item-input-wrap">
<textarea id="telegramto" rows="3" placeholder="John Smith&#10;123 Sample Rd&#10;Helena MT 59601"></textarea>
<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">From</div>
<div class="item-input-wrap">
<textarea id="telegramfrom" rows="3" placeholder=""></textarea>
<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">Special Instructions</div>
<div class="item-input-wrap">
<textarea id="telegraminstructions" rows="2" class="resizable" placeholder="Request specific delivery date/time, add delivery instructions, etc"></textarea>
<span class="input-clear-button"></span>
</div>
</div>
</li>
<li class="padding">
By pressing the "Send Telegram" button, you agree that we can
bill your saved payment method for $15.
</li>
<li class="padding">
<div class="button hapticbtn button-fill" onclick="sendTelegram()"><i class="fas fa-paper-plane"></i> Send Telegram</div>
</li>
</ul>
</div>
</div>
</div>
</div>
</div>
</div>
</div>

@ -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',

@ -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",

Loading…
Cancel
Save