Fixing Tasks to work differently, adding to dash.

This commit is contained in:
Brian McGonagill 2022-09-05 16:22:56 -05:00
parent 56b27d6b05
commit 2d9ab70fa6
5 changed files with 56 additions and 16 deletions

View file

@ -1,6 +1,29 @@
<template name="dashboard"> <template name="dashboard">
<h4>My Dashboard</h4> <h4>My Dashboard</h4>
<div class="row"> <div class="row">
<div class="col s12 m6 l4">
<div class="card blue darken-3" id="taskInfoCard">
<div class="card-content white-text">
<span class="card-title"><h4>My Tasks</h4></span>
<div class="row">
<div class="col s2"><i class="medium material-icons">task</i></div>
<div class="col s10">
<ul class="collection">
{{#each mytaskitems}}
<li class="collection-item blue darken-3">{{taskName}}</li>
{{else}}
<li class="collection-item blue darken-4">No Tasks</li>
{{/each}}
</ul>
</div>
</div>
</div>
<div class="card-action">
<a href="#" class="cardLink" id="taskMgmtLink">List Management</a>
</div>
</div>
</div>
<div class="col s12 m6 l4"> <div class="col s12 m6 l4">
<div class="card blue-grey darken-1" id="listInfoCard"> <div class="card blue-grey darken-1" id="listInfoCard">
<div class="card-content white-text"> <div class="card-content white-text">
@ -23,6 +46,10 @@
<div class="row"> <div class="row">
<div class="col s12"><h4><i class="medium material-icons">local_dining</i> {{itemName}}</h4></div> <div class="col s12"><h4><i class="medium material-icons">local_dining</i> {{itemName}}</h4></div>
</div> </div>
{{else}}
<div class="row">
<div class="col s12"><h4><i class="medium material-icons">local_dining</i> No Menu Today</h4></div>
</div>
{{/each}} {{/each}}
</div> </div>
<div class="card-action"> <div class="card-action">

View file

@ -6,6 +6,7 @@ import { Stores } from "../../imports/api/stores";
import { Menus } from '../../imports/api/menu.js'; import { Menus } from '../../imports/api/menu.js';
import { MenuItems } from '../../imports/api/menuItems.js'; import { MenuItems } from '../../imports/api/menuItems.js';
import moment from 'moment'; import moment from 'moment';
import { TaskItems } from "../../imports/api/tasks";
Template.dashboard.onCreated(function() { Template.dashboard.onCreated(function() {
@ -17,6 +18,7 @@ Template.dashboard.onCreated(function() {
this.subscribe("myLocations"); this.subscribe("myLocations");
this.subscribe("myMenus"); this.subscribe("myMenus");
this.subscribe("todayMenuItems"); this.subscribe("todayMenuItems");
this.subscribe("myTasks");
}); });
Template.dashboard.onRendered(function() { Template.dashboard.onRendered(function() {
@ -42,6 +44,10 @@ Template.dashboard.helpers({
locCount: function() { locCount: function() {
return Locations.find().count(); return Locations.find().count();
}, },
mytaskitems: function() {
let today = moment(new Date()).format("MMM DD, YYYY");
return TaskItems.find({ isComplete: false, taskDate: today });
},
todayMenuItem: function() { todayMenuItem: function() {
return MenuItems.find({}); return MenuItems.find({});
}, },
@ -78,6 +84,9 @@ Template.dashboard.events({
case "myMenuLink": case "myMenuLink":
FlowRouter.go('/mymenus'); FlowRouter.go('/mymenus');
break; break;
case "taskMgmtLink":
FlowRouter.go('/taskHome');
break;
default: default:
break; break;
} }
@ -107,6 +116,10 @@ Template.dashboard.events({
break; break;
case "menuInfoCard": case "menuInfoCard":
FlowRouter.go('/mymenus'); FlowRouter.go('/mymenus');
break;
case "taskInfoCard":
FlowRouter.go('/myTasks');
break;
default: default:
break; break;
} }

View file

@ -14,16 +14,16 @@
<div class="col s6 m4 l4"> <div class="col s6 m4 l4">
<p> <p>
<label> <label>
<input type="checkbox" id="hideMyCompletedTasks" /> <input type="checkbox" id="showMyCompletedTasks" />
<span>Hide Completed</span> <span>Show Completed</span>
</label> </label>
</p> </p>
</div> </div>
<div class="col s6 m4 l4"> <div class="col s6 m4 l4">
<p> <p>
<label> <label>
<input type="checkbox" id="onlyTodaysTasks" /> <input type="checkbox" id="showAllTasks" />
<span>Today's Tasks</span> <span>Show All Tasks</span>
</label> </label>
</p> </p>
</div> </div>

View file

@ -6,8 +6,8 @@ Template.myTasksForm.onCreated(function() {
Template.myTasksForm.onRendered(function() { Template.myTasksForm.onRendered(function() {
$('.datepicker').datepicker(); $('.datepicker').datepicker();
Session.set("hideComplete", false); Session.set("hideComplete", true);
Session.set("onlyToday", false); Session.set("onlyToday", true);
}); });
Template.myTasksForm.helpers({ Template.myTasksForm.helpers({
@ -38,20 +38,20 @@ Template.myTasksForm.events({
}); });
} }
}, },
'click #hideMyCompletedTasks' (event) { 'click #showMyCompletedTasks' (event) {
let hide = $("#hideMyCompletedTasks").prop('checked'); let hide = $("#showMyCompletedTasks").prop('checked');
if (hide == true) { if (hide == true) {
Session.set("hideComplete", true);
} else {
Session.set("hideComplete", false); Session.set("hideComplete", false);
} else {
Session.set("hideComplete", true);
} }
}, },
'click #onlyTodaysTasks' (event) { 'click #showAllTasks' (event) {
let onlyToday = $("#onlyTodaysTasks").prop('checked'); let onlyToday = $("#showAllTasks").prop('checked');
if (onlyToday == true) { if (onlyToday == true) {
Session.set("onlyToday", true);
} else {
Session.set("onlyToday", false); Session.set("onlyToday", false);
} else {
Session.set("onlyToday", true);
} }
} }

View file

@ -7,8 +7,8 @@ Template.myTasksTbl.onCreated(function() {
Template.myTasksTbl.onRendered(function() { Template.myTasksTbl.onRendered(function() {
$('.collapsible').collapsible(); $('.collapsible').collapsible();
Session.set("hideComplete", false); Session.set("hideComplete", true);
Session.set("onlyToday", false); Session.set("onlyToday", true);
}); });
Template.myTasksTbl.helpers({ Template.myTasksTbl.helpers({