From 933a1f7df2f376b00cb9bddbbdff686d193b739d Mon Sep 17 00:00:00 2001 From: Skylar Ittner Date: Thu, 14 Nov 2019 20:06:44 -0700 Subject: [PATCH] Display barcode on tracking page, fix some tracking bugs --- scripts/remove_bloat.sh | 5 +++++ www/assets/js/toolbox_track.js | 5 ++++- www/index.html | 1 + www/package.json | 1 + www/pages/toolbox/trackinginfo.html | 23 ++++++++++++++++++----- 5 files changed, 29 insertions(+), 6 deletions(-) diff --git a/scripts/remove_bloat.sh b/scripts/remove_bloat.sh index 61b3159..fcb2cb2 100755 --- a/scripts/remove_bloat.sh +++ b/scripts/remove_bloat.sh @@ -25,6 +25,11 @@ rm -rf src rm -rf external cd .. +cd jsbarcode +rm -rf .dockerignore .eslintignore .eslintrcautomation bin bower.json CONTRIBUTING.md docker-compose.yml Dockerfile example gulpfile.js jsbarcode.d.ts README.md src test .travis.yml +rm -rf dist/barcodes +rm -rf dist/JsBarcode.all.js + cd framework7 rm -rf components rm -rf lazy-components diff --git a/www/assets/js/toolbox_track.js b/www/assets/js/toolbox_track.js index 2b3c2a6..c127237 100644 --- a/www/assets/js/toolbox_track.js +++ b/www/assets/js/toolbox_track.js @@ -29,8 +29,9 @@ function timestampToDateTimeString(timestamp) { var pm = date.getHours() >= 12; var hours = date.getHours() > 12 ? date.getHours() - 12 : date.getHours(); + hours = (hours == 0 ? 12 : hours); var minutes = date.getMinutes(); - var time = hours + ":" + minutes + " " + (pm ? "PM" : "AM"); + var time = hours + ":" + (minutes < 10 ? "0" + minutes : minutes) + " " + (pm ? "PM" : "AM"); return date.toLocaleDateString() + " " + time; } @@ -79,6 +80,8 @@ function openTrackingHistory(trackingcode) { infocontext.current.location.display = locationArrayToString(infocontext.current.location); infocontext.current.date = timestampToDateTimeString(infocontext.current.date); infocontext.current.status = trackingStatusToNiceString(infocontext.current.status, true); + infocontext.addresses.from = locationArrayToString(infocontext.addresses.from); + infocontext.addresses.to = locationArrayToString(infocontext.addresses.to); for (var i = 0; i < infocontext.history.length; i++) { infocontext.history[i].location.display = locationArrayToString(infocontext.history[i].location); diff --git a/www/index.html b/www/index.html index ab528af..d2651c0 100644 --- a/www/index.html +++ b/www/index.html @@ -27,6 +27,7 @@ + diff --git a/www/package.json b/www/package.json index 1fd4080..a5a961e 100644 --- a/www/package.json +++ b/www/package.json @@ -7,6 +7,7 @@ "@fortawesome/fontawesome-free": "^5.10.2", "framework7": "^5.0.2", "jquery": "^3.4.1", + "jsbarcode": "^3.11.0", "leaflet": "^1.5.1", "leaflet-geometryutil": "^0.9.1", "leaflet.locatecontrol": "^0.67.0", diff --git a/www/pages/toolbox/trackinginfo.html b/www/pages/toolbox/trackinginfo.html index 116bb05..7765a70 100644 --- a/www/pages/toolbox/trackinginfo.html +++ b/www/pages/toolbox/trackinginfo.html @@ -19,7 +19,7 @@
    -
  • Current Status
  • +
  • Information
  • @@ -32,19 +32,28 @@
    {{details}}
    {{location.display}}
    {{/with}} -
    {{carrier.name}} | {{service.name}}
-
  • Item Info
  • -
    Tracking Code: {{code}}
    -
    Carrier: {{carrier.name}} | {{service.name}}
    +
    Carrier: {{carrier.name}}{{#if service.name}} {{service.name}}{{/if}}
    +
    From: {{addresses.from}}
    +
    To: {{addresses.to}}
  • +
  • +
    + + +
    +
  • History
  • {{#each history}}
  • @@ -67,4 +76,8 @@
  • + + \ No newline at end of file