Add package type option to load screen (close #2)

master
Skylar Ittner 5 years ago
parent bd588b09ba
commit 5f63387592

@ -42,7 +42,7 @@ $("#addpackagebtn").click(function () {
} }
var address = ($("input[name=number]").val() + " " + $("input[name=street]").val()).toUpperCase(); var address = ($("input[name=number]").val() + " " + $("input[name=street]").val()).toUpperCase();
addPackageByAddress(address, $("input[name=citystate]").val().toUpperCase()); addPackageByAddress(address, $("input[name=citystate]").val().toUpperCase(), $("input[name=itemtype]:checked").val());
}); });
// Restore user's last entered city/state combo // Restore user's last entered city/state combo

@ -201,13 +201,13 @@ function countPackages() {
return count; return count;
} }
function addPackageByAddress(address, citystate) { function addPackageByAddress(address, citystate, type) {
$.getJSON(SETTINGS.geocodeapi, { $.getJSON(SETTINGS.geocodeapi, {
address: address + " " + citystate address: address + " " + citystate
}, function (resp) { }, function (resp) {
if (resp.status == "OK") { if (resp.status == "OK") {
if (resp.accuracy.ok) { if (resp.accuracy.ok) {
addPackage(resp.address.street, resp.coords[0], resp.coords[1]); addPackage(resp.address.street, resp.coords[0], resp.coords[1], type);
} else { } else {
playSound("error"); playSound("error");
app.dialog.confirm( app.dialog.confirm(
@ -215,9 +215,9 @@ function addPackageByAddress(address, citystate) {
"Accuracy Warning", "Accuracy Warning",
function (ok) { function (ok) {
if (resp.address.street == "") { if (resp.address.street == "") {
addPackage(address, resp.coords[0], resp.coords[1]); addPackage(address, resp.coords[0], resp.coords[1], type);
} else { } else {
addPackage(resp.address.street, resp.coords[0], resp.coords[1]); addPackage(resp.address.street, resp.coords[0], resp.coords[1], type);
} }
} }
); );

@ -45,6 +45,33 @@
</div> </div>
</div> </div>
</li> </li>
<li>
<label class="item-radio item-content">
<input type="radio" name="itemtype" value="package" checked />
<i class="icon icon-radio"></i>
<div class="item-inner">
<div class="item-title"><i class="fas fa-box"></i> Package</div>
</div>
</label>
</li>
<li>
<label class="item-radio item-content">
<input type="radio" name="itemtype" value="letter" />
<i class="icon icon-radio"></i>
<div class="item-inner">
<div class="item-title"><i class="fas fa-envelope"></i> Letter</div>
</div>
</label>
</li>
<li>
<label class="item-radio item-content">
<input type="radio" name="itemtype" value="express" />
<i class="icon icon-radio"></i>
<div class="item-inner">
<div class="item-title"><i class="fas fa-shipping-fast"></i> Express</div>
</div>
</label>
</li>
<li> <li>
<a class="item-link list-button" id="addpackagebtn"><i class="fas fa-plus"></i> Add Package</a> <a class="item-link list-button" id="addpackagebtn"><i class="fas fa-plus"></i> Add Package</a>
</li> </li>

Loading…
Cancel
Save