Add package pickup request form

master
Skylar Ittner 3 years ago
parent 358c961f91
commit 8a327701b7

@ -223,12 +223,8 @@ $("body").on("click", "#updateAccountBtn", function () {
});
$("body").on("click", "#connectExistingAccountBtn", function () {
app.dialog.prompt("Enter your phone number or account number:", "Connect Your Account", function (val) {
var phone = val.replace(/\D/g, '');
if (phone.length < 10) {
app.dialog.alert("Please enter a full 10-digit phone number.", "Oops!");
return;
}
app.dialog.prompt("Enter your account number:", "Connect Your Account", function (val) {
var accountnumber = val.replace(/\D/g, '');
setStorage("accountnumber", accountnumber);
router.refreshPage();
}, function (cancel) {

@ -0,0 +1,47 @@
/*
* 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 requestPickup() {
if (isNaN($("#pickupRequestForm #packagecount").val())) {
app.dialog.alert("Tell us how many packages you're sending so we'll know if we miss any.", "Whoops!");
return;
}
if ($("#pickupRequestForm #streetaddress").val() == "") {
app.dialog.alert("We need an address to get the packages from. Don't have one? Find your location on fixphrase.com and use that.", "Whoops!");
return;
}
if ($("#pickupRequestForm #packagelocation").val() == "" && $("#pickupRequestForm #instructions").val() == "") {
app.dialog.alert("Give us some instructions so we know how to find your packages.", "Whoops!");
return;
}
var instructions = "";
instructions = $("#pickupRequestForm #packagelocation").val();
instructions += " " + $("#pickupRequestForm #instructions").val();
setStorage("lastpickupaddress", $("#pickupRequestForm #streetaddress").val());
setStorage("lastpickupzipcode", $("#pickupRequestForm #zipcode").val());
app.dialog.preloader("Requesting Pickup...");
apirequest(SETTINGS.apis.requestpickup, {
accountnumber: getStorage("accountnumber"),
accountkey: getStorage("accountkey"),
count: $("#pickupRequestForm #packagecount").val(),
address: $("#pickupRequestForm #streetaddress").val() + " " + $("#pickupRequestForm #zipcode").val(),
instructions: instructions
}, function (success) {
app.dialog.close();
if (success.status == "OK") {
app.dialog.alert(success.msg, "Pickup Requested!");
} else {
app.dialog.alert(success.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");
}, "POST");
}

@ -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/pickup.js"></script>
<script src="assets/js/rates.js"></script>
<script src="assets/js/account.js"></script>

@ -32,7 +32,7 @@
<div id="hasaccountbox" style="display: none;">
<div id="addPaymentMethodBox" style="display: none;">
Add a credit or debit card to use Drop and Send. It'll be securely saved for future use.
Add a credit or debit card to pay for postage and services. It'll be securely saved for future use.
<div class="button hapticbtn button-fill margin" onclick="openCheckoutWindowToSaveCard()"><i class="fas fa-credit-card fa-fw"></i> Add Card</div>
<hr />
</div>
@ -59,7 +59,7 @@
<div id="setupaccountbox" style="display: none;">
<div class="block">
Set up an account to use our Drop and Send service, earn rewards points, and more!
Set up an account to pay for services, earn rewards points, and more!
</div>
<div class="block">
Already have an account?

@ -0,0 +1,110 @@
<!-- 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="pickup">
<div class="navbar">
<div class="navbar-bg"></div>
<div class="navbar-inner">
<div class="left">
<a class="link back hapticbtn" href="#">
<i class="icon icon-back"></i>
<span class="if-not-md">Back</span>
</a>
</div>
<div class="title">Request Pickup</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">
Leave your package somewhere safe
(front porch, shed, garage, etc) and we'll come get it.
Your saved credit card will be billed automatically when we ship your package.
</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 use this service. <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">Pickup Address</div>
<div class="item-input-wrap">
<input type="text" id="streetaddress" placeholder="1234 Your Rd" value="{{streetaddress}}" />
<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">ZIP Code</div>
<div class="item-input-wrap">
<input type="text" id="zipcode" value="{{zipcode}}"/>
<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">Number of Packages</div>
<div class="item-input-wrap">
<input type="number" id="packagecount" min="1" max="200"/>
<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">Package Location</div>
<div class="item-input-wrap input-dropdown-wrap">
<select id="packagelocation">
<option></option>
<option>Porch</option>
<option>Front Door</option>
<option>Back Door</option>
<option>Side Door</option>
<option>Garage</option>
<option>Office</option>
<option>Reception</option>
<option>I'm home all day, knock on the door</option>
<option value="">Other (add instructions)</option>
</select>
</div>
</div>
</li>
<li class="item-content item-input item-input-outline">
<div class="item-inner">
<div class="item-title item-floating-label">Extra Instructions</div>
<div class="item-input-wrap">
<textarea id="instructions" class="resizable" placeholder="Where to find package, access code, etc"></textarea>
<span class="input-clear-button"></span>
</div>
</div>
</li>
<li class="padding">
By requesting a pickup, you confirm that you aren't sending any <a onclick="openExternalBrowser('https://helena.express/articles/restricted-items')">restricted items</a>.
You agree that we can bill your saved payment method for the shipping cost.
You also confirm that you've filled out a destination address on each package and indicated
any desired options (signature, insurance, etc).
We recommend using free Helena Express shipping labels, available upon request.
</li>
<li class="padding">
<div class="button hapticbtn button-fill" onclick="requestPickup()"><i class="far fa-dolly"></i> Request Pickup</div>
</li>
</ul>
</div>
</div>
</div>
</div>
</div>
</div>
</div>

@ -92,7 +92,7 @@
<li class="item-content item-input item-input-outline">
<div class="item-inner">
<div class="item-title item-floating-label">Country</div>
<div class="item-input-wrap">
<div class="item-input-wrap input-dropdown-wrap">
<select id="to_country" name="to_country">
<option value="US" selected>United States of America</option>
<option value="AF">Afghanistan</option>
@ -357,7 +357,7 @@
<li class="item-divider">Item Type:</li>
<li class="item-content item-input item-input-outline">
<div class="item-inner">
<div class="item-input-wrap">
<div class="item-input-wrap input-dropdown-wrap">
<select id="itemType" name="itemType">
<option value="" selected>Choose Item Type</option>
<option value="Parcel">Package/Parcel/Other</option>

@ -10,6 +10,7 @@ var pagesToCompile = [
"welcome",
"appointment",
"dropandsend",
"pickup",
"rateresult",
"account",
"trackresult",
@ -42,7 +43,7 @@ var routes = [
on: {
pageBeforeIn: function () {
// make sure it's not shown right after account setup
var accountsetup = (inStorage("accountkey") && inStorage("phonenumber"));
var accountsetup = (inStorage("accountkey") && inStorage("accountnumber"));
if (accountsetup) {
$("#finishaccountsetupnag").css("display", "none");
}
@ -50,7 +51,7 @@ var routes = [
},
async: function ( { resolve, reject }) {
// Show a nag message if no account is set up
var accountsetup = (inStorage("accountkey") && inStorage("phonenumber")) || getStorage("hideaccountnag") == "true";
var accountsetup = (inStorage("accountkey") && inStorage("accountnumber")) || getStorage("hideaccountnag") == "true";
// add escape hatch to regular website if running online
var escapehatch = false;
if (window.location.hostname == "app.helena.express") {
@ -61,6 +62,12 @@ var routes = [
accountsetup: accountsetup,
escapehatch: escapehatch,
pages: [
{
title: "Package Pickup",
href: "/pickup",
icon: "fad fa-boxes",
text: "Leave your package somewhere and we'll pick it up and ship it for you. No postage or appointment needed."
},
{
title: "Drop and Send",
href: "/dropandsend",
@ -145,6 +152,29 @@ var routes = [
}
}
},
{
path: '/pickup',
name: 'pickup',
async: function ( {resolve}) {
resolve({
content: compiledPages.pickup({
streetaddress: inStorage("lastpickupaddress") ? getStorage("lastpickupaddress") : "",
zipcode: inStorage("lastpickupzipcode") ? getStorage("lastpickupzipcode") : ""
})
}, {});
},
on: {
pageBeforeIn: function () {
checkIfAccountGoodWithPaymentMethod(function (ok) {
if (!ok) {
$("#addPaymentMethodNag").css("display", "");
}
}, function (error) {
$("#addPaymentMethodNag").css("display", "");
});
}
}
},
{
path: '/track',
url: './pages/track.html',
@ -253,7 +283,7 @@ var routes = [
{
path: '/display',
name: 'settings',
async: function ({resolve}) {
async: function ( {resolve}) {
var settings = [
{
setting: "apptheme",

Loading…
Cancel
Save