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">
<h4>My Dashboard</h4>
<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="card blue-grey darken-1" id="listInfoCard">
<div class="card-content white-text">
@ -23,6 +46,10 @@
<div class="row">
<div class="col s12"><h4><i class="medium material-icons">local_dining</i> {{itemName}}</h4></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}}
</div>
<div class="card-action">

View file

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

View file

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

View file

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

View file

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