From 35fbcca41b8f514a86ad7d9c9c6b196c8e03b42a Mon Sep 17 00:00:00 2001 From: Skylar Ittner Date: Fri, 5 May 2023 01:35:26 -0600 Subject: [PATCH] New more better quick send --- www/assets/js/address_qrcode.js | 50 ------------------ www/assets/js/quicksend.js | 51 +++++++++++++++++++ www/index.html | 2 +- .../{address_qrcode.html => quicksend.html} | 36 +++++++++---- www/routes.js | 19 +++++-- 5 files changed, 92 insertions(+), 66 deletions(-) delete mode 100644 www/assets/js/address_qrcode.js create mode 100644 www/assets/js/quicksend.js rename www/pages/{address_qrcode.html => quicksend.html} (95%) diff --git a/www/assets/js/address_qrcode.js b/www/assets/js/address_qrcode.js deleted file mode 100644 index 3d4bc17..0000000 --- a/www/assets/js/address_qrcode.js +++ /dev/null @@ -1,50 +0,0 @@ -/* - * 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 showAddressQRCode() { - var fromqrstring = $("#addresscodeform #from_name").val() + "\t" - + $("#addresscodeform #from_company").val() + "\t" - + $("#addresscodeform #from_street1").val() + "\t" - + $("#addresscodeform #from_street2").val() + "\t" - + "\t" - + "\t" - + $("#addresscodeform #from_zip").val(); - - var toqrstring = $("#addresscodeform #to_name").val() + "\t" - + $("#addresscodeform #to_company").val() + "\t" - + $("#addresscodeform #to_street1").val() + "\t" - + $("#addresscodeform #to_street2").val() + "\t" - + $("#addresscodeform #to_city").val() + "\t" - + $("#addresscodeform #to_state").val() + "\t" - + $("#addresscodeform #to_zip").val() + "\t" - + $("#addresscodeform #to_country").val(); - - var canvas = document.createElement('canvas'); - - bwipjs.toCanvas(canvas, { - bcid: 'qrcode', // Barcode type - text: fromqrstring, // Text to encode - scale: 5, - includetext: false, // Show human-readable text - textxalign: 'center', // Always good to set this - eclevel: 'M' - }); - document.getElementById("addresscode-barcode-from").src = canvas.toDataURL('image/png'); - - canvas = document.createElement('canvas'); - bwipjs.toCanvas(canvas, { - bcid: 'qrcode', // Barcode type - text: toqrstring, // Text to encode - scale: 5, - includetext: false, // Show human-readable text - textxalign: 'center', // Always good to set this - eclevel: 'M' - }); - document.getElementById("addresscode-barcode-to").src = canvas.toDataURL('image/png'); - - app.popup.create({el: document.getElementById("qrCodePopup")}).open(); -} \ No newline at end of file diff --git a/www/assets/js/quicksend.js b/www/assets/js/quicksend.js new file mode 100644 index 0000000..403afc6 --- /dev/null +++ b/www/assets/js/quicksend.js @@ -0,0 +1,51 @@ +/* + * 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 showAddressQRCode() { + var content = "QSv1|tofrom" + + "|" + $("#addresscodeform #to_name").val() + + "|" + $("#addresscodeform #to_company").val() + + "|" + $("#addresscodeform #to_street1").val() + + "|" + $("#addresscodeform #to_street2").val() + + "|" + $("#addresscodeform #to_city").val() + + "|" + $("#addresscodeform #to_state").val() + + "|" + $("#addresscodeform #to_zip").val() + + "|" + $("#addresscodeform #to_country").val() + + "|" + $("#addresscodeform #to_phone").val() + + "|" // email + + "|" + $("#addresscodeform #from_name").val() + + "|" + $("#addresscodeform #from_company").val() + + "|" + $("#addresscodeform #from_street1").val() + + "|" + $("#addresscodeform #from_street2").val() + + "|" // city + + "|" // state + + "|" + $("#addresscodeform #from_zip").val() + + "|" // country + + "|" + $("#addresscodeform #from_phone").val() + + "|"; // email + + setStorage("quicksend_name", $("#addresscodeform #from_name").val()); + setStorage("quicksend_company", $("#addresscodeform #from_company").val()); + setStorage("quicksend_street1", $("#addresscodeform #from_street1").val()); + setStorage("quicksend_street2", $("#addresscodeform #from_street2").val()); + setStorage("quicksend_zip", $("#addresscodeform #from_zip").val()); + setStorage("quicksend_phone", $("#addresscodeform #from_phone").val()); + + var canvas = document.createElement('canvas'); + + bwipjs.toCanvas(canvas, { + bcid: 'pdf417', // Barcode type + text: content, // Text to encode + scale: 5, + includetext: false, // Show human-readable text + textxalign: 'center', // Always good to set this + eclevel: 'M' + }); + document.getElementById("addresscode-barcode").src = canvas.toDataURL('image/png'); + + app.popup.create({el: document.getElementById("qrCodePopup")}).open(); +} \ No newline at end of file diff --git a/www/index.html b/www/index.html index 4e3957a..27c03f8 100644 --- a/www/index.html +++ b/www/index.html @@ -71,7 +71,7 @@ - + diff --git a/www/pages/address_qrcode.html b/www/pages/quicksend.html similarity index 95% rename from www/pages/address_qrcode.html rename to www/pages/quicksend.html index c1910fc..369ffef 100644 --- a/www/pages/address_qrcode.html +++ b/www/pages/quicksend.html @@ -42,7 +42,7 @@
Name (or care of)
- +
@@ -51,7 +51,7 @@
Company (or name)
- +
@@ -60,7 +60,7 @@
Street Address
- +
@@ -69,7 +69,7 @@
Address Line 2
- +
@@ -78,7 +78,16 @@
ZIP Code
- + + +
+
+ +
  • +
    +
    Phone Number
    +
    +
    @@ -413,6 +422,15 @@
  • +
  • +
    +
    Phone Number
    +
    + + +
    +
    +
  • @@ -428,12 +446,8 @@ diff --git a/www/routes.js b/www/routes.js index be0370b..c15e878 100644 --- a/www/routes.js +++ b/www/routes.js @@ -33,7 +33,7 @@ var pagesToCompile = [ "trailer", "money", "moneyorder", - "address_qrcode" + "quicksend" ]; console.log("Compiling page templates..."); for (var i = 0; i < pagesToCompile.length; i++) { @@ -192,7 +192,7 @@ var routes = [ title: "My Account", href: "/account", icon: "fa-duotone fa-user-circle", - text: "Get account number, check rewards points, update payment method, and more." + text: "View receipts, get account number, update payment method, and more." }, ] }) @@ -316,8 +316,19 @@ var routes = [ }, { path: '/quicksend', - content: compiledPages.address_qrcode(), - name: 'quicksend' + name: 'quicksend', + async: function ( {resolve}) { + resolve({ + content: compiledPages.quicksend({ + from_name: inStorage("quicksend_name") ? getStorage("quicksend_name") : "", + from_company: inStorage("quicksend_company") ? getStorage("quicksend_company") : "", + from_street1: inStorage("quicksend_street1") ? getStorage("quicksend_street1") : (inStorage("lastpickupaddress") ? getStorage("lastpickupaddress") : ""), + from_street2: inStorage("quicksend_street2") ? getStorage("quicksend_street2") : "", + from_zip: inStorage("quicksend_zip") ? getStorage("quicksend_zip") : (inStorage("lastpickupzipcode") ? getStorage("lastpickupzipcode") : ""), + from_phone: inStorage("quicksend_phone") ? getStorage("quicksend_phone") : "" + }) + }, {}); + }, }, { path: '/appointment',