diff --git a/imports/ui/pages/lanes/helpers.js b/imports/ui/pages/lanes/helpers.js index 62c4c81..7cdb66b 100644 --- a/imports/ui/pages/lanes/helpers.js +++ b/imports/ui/pages/lanes/helpers.js @@ -26,11 +26,13 @@ Template.lanes.helpers({ let total = Session.get('total_lanes'); let current = Lanes.find().count(); - if (! total || current < total) return true; + if (total !== 0 && ! total || current < total) return true; return false; }, + empty () { return Session.get('total_lanes') === 0; }, + lanes () { let lanes; let sort_by = Session.get('lanes_table_sort_by'); diff --git a/imports/ui/pages/lanes/lanes.html b/imports/ui/pages/lanes/lanes.html index 27ec363..5c1eda8 100644 --- a/imports/ui/pages/lanes/lanes.html +++ b/imports/ui/pages/lanes/lanes.html @@ -30,6 +30,12 @@

Lanes

{{/if}} + {{#if empty}} + + No lanes found. Create the first. + + {{/if}} + {{#each lanes}} diff --git a/imports/ui/pages/lanes/lib/util.js b/imports/ui/pages/lanes/lib/util.js index e4bf757..95d0089 100644 --- a/imports/ui/pages/lanes/lib/util.js +++ b/imports/ui/pages/lanes/lib/util.js @@ -1,6 +1,6 @@ import { Shipments } from '../../../../api/shipments'; -const count = (lane) => { +const count = (lane = { _id: false }) => { return Shipments.find({ lane: lane._id }).count(); };