Added Reports (forgot to commit); Added label prototype.

This commit is contained in:
Wynne Crisman
2019-07-28 13:47:54 -07:00
parent c1183a1470
commit 8211da6b39
13 changed files with 314 additions and 39 deletions

31
imports/ui/Label.html Normal file
View File

@@ -0,0 +1,31 @@
<template name="LabelMaker">
<div id="labelMaker">
<div class="labelOptions"></div>
<div class="labelContents">
<div><label for="title1">Title:</label> <input type="text" name="title1" class="title1 input" value="{{title1}}"/></div>
<div><label for="title2">Title:</label> <input type="text" name="title2" class="title2 input" value="{{title2}}"/></div>
<div><label for="ingredients" style="vertical-align: top">Ingredients:</label> <textarea name="ingredients" class="ingredients">{{ingredients}}</textarea></div>
<div><label for="date">Date:</label> <input type="number" name="date" class="date input" value="{{date}}"/></div>
<div><label for="date">Starting Number:</label> <input type="number" name="startNumber" class="startNumber input" value="{{startNumber}}"/></div>
<div><label for="date">Count:</label> <input type="number" name="count" class="count input" value="{{count}}"/></div>
<div><button name="generate" class="generate">Generate</button></div>
</div>
<div class="labelContainer">
<div class="labelSample label">
<img class="labelLogo" alt="logo" src="/images/PetitTetonLabelLogo_2in Width_v1.png"/>
<div class="labelTagline">We grow it. We can it.</div>
{{{labelText}}}
</div>
</div>
</div>
</template>
<template name="Labels">
{{each label}}
<div class="label">
<img class="labelLogo" alt="logo" src="/images/PetitTetonLabelLogo_2in Width_v1.png"/>
<div class="labelTagline">We grow it. We can it.</div>
{{{labelText}}}
</div>
{{/each}}
</template>

93
imports/ui/Label.import.styl vendored Normal file
View File

@@ -0,0 +1,93 @@
#labelMaker
margin: 10px 20px
height: 100%
width: 100%
.labelContents
label
font-family: TimesNewRoman, Times New Roman, Times
font-weight: 200
font-size: 14px
.title1
width: 500px
font-family: TimesNewRoman, Times New Roman, Times
font-size: .142in
font-weight: 800
line-height: .142in
.title2
width: 500px
font-family: TimesNewRoman, Times New Roman, Times
font-size: 14px
font-weight: 800
line-height: 16px
.ingredients
width: 500px
height: 100px
font-family: TimesNewRoman, Times New Roman, Times
font-size: 12px
font-weight: 100
line-height: 14px
.date
width: 500px
font-family: TimesNewRoman, Times New Roman, Times
font-size: 12px
font-weight: 100
line-height: 14px
.labelContainer
text-align: center
width: 100%
width-min: 3in
height-min: 2in
background-color: grey
padding: 20px
.labelSample
display: inline-block
width: 3in
height: 2in
background-color: white
color: black
text-align: center
.labelLogo
width: .8in
.labelTagline
font-family: TimesNewRoman, Times New Roman, Times
font-size: .1in
font-weight: 100
line-height: .2in
.title1
width: 100%
font-family: TimesNewRoman, Times New Roman, Times
font-size: .2in
font-weight: 800
text-transform: uppercase
.title2
width: 100%
font-family: TimesNewRoman, Times New Roman, Times
font-size: .15in
font-weight: 800
.ingredients
width: 100%
font-family: TimesNewRoman, Times New Roman, Times
font-size: .1in
font-weight: 100
.ingredientsEnding
width: 100%
font-family: TimesNewRoman, Times New Roman, Times
font-size: .1in
font-weight: 100
.instructions
width: 100%
font-family: TimesNewRoman, Times New Roman, Times
font-size: .1in
font-weight: 800
.address
width: 100%
font-family: TimesNewRoman, Times New Roman, Times
font-size: .1in
font-weight: 100
.website
width: 100%
font-family: TimesNewRoman, Times New Roman, Times
font-size: .1in
font-weight: 100

75
imports/ui/Label.js Normal file
View File

@@ -0,0 +1,75 @@
import './Label.html';
import swal from 'sweetalert2';
import dragula from 'dragula';
//******************************************************************
//** Creates printable labels for a roll style printer.
//******************************************************************
let PREFIX = "LabelMaker_";
Template.LabelMaker.onCreated(function() {
});
Template.LabelMaker.onRendered(function() {
let template = this;
});
Template.LabelMaker.onDestroyed(function() {
});
Template.LabelMaker.events({
'change .title1': function(event, template) {
Session.set(PREFIX + "title1", $(event.target).val());
},
'change .title2': function(event, template) {
Session.set(PREFIX + "title2", $(event.target).val());
},
'change .ingredients': function(event, template) {
Session.set(PREFIX + "ingredients", $(event.target).val());
},
'change .date': function(event, template) {
Session.set(PREFIX + "date", parseInt($(event.target).val()));
},
'click .generate': function(event, template) {
}
});
Template.LabelMaker.helpers({
title1: function() {return Session.get(PREFIX + "title1")},
title2: function() {return Session.get(PREFIX + "title2")},
ingredients: function() {return Session.get(PREFIX + "ingredients")},
date: function() {return Session.get(PREFIX + "date")},
labelText: function() {
return "<div class='title1'>" + Session.get(PREFIX + "title1") + "</div>" +
"<div class='title2'>" + Session.get(PREFIX + "title2") + "</div>" +
"<div class='ingredients'><span class='ingredientsPrefix'>Ingredients</span>:" + Session.get(PREFIX + "ingredients") + "</div>" +
"<div class='ingredientsEnding'>*<span style='font-style: oblique'>grown by us</span> <span class='size'>8oz</span> FD1951 (" + Session.get(PREFIX + "date") + ")</div>" +
"<div class='instructions'>Refrigerate after opening; return jar when done</div>" +
"<div class='address'>18601 Hwy 128, Yorkville, CA 95494</div>" +
"<div class='website'>www.PetitTeton.com</div>";
}
});
Template.Labels.onCreated(function() {
});
Template.Labels.onRendered(function() {
let template = this;
});
Template.Labels.onDestroyed(function() {
});
Template.Labels.events({
});
Template.Labels.helpers({
labels: function() {return Session.get(PREFIX + "labels")},
title2: function() {return Session.get(PREFIX + "title2")},
ingredients: function() {return Session.get(PREFIX + "ingredients")},
date: function() {return Session.get(PREFIX + "date")},
labelText: function() {
return "<div class='title1'>" + Session.get(PREFIX + "title1") + "</div>" +
"<div class='title2'>" + Session.get(PREFIX + "title2") + "</div>" +
"<div class='ingredients'><span class='ingredientsPrefix'>Ingredients</span>:" + Session.get(PREFIX + "ingredients") + "</div>" +
"<div class='ingredientsEnding'>*<span style='font-style: oblique'>grown by us</span> <span class='size'>8oz</span> FD1951 (" + Session.get(PREFIX + "date") + ")</div>" +
"<div class='instructions'>Refrigerate after opening; return jar when done</div>" +
"<div class='address'>18601 Hwy 128, Yorkville, CA 95494</div>" +
"<div class='website'>www.PetitTeton.com</div>";
}
});

View File

@@ -5,5 +5,6 @@
<a download="TagTotals.csv" href="/reports/TagTotals">Tag Totals (csv)</a> The total sales ($) are shown by year for each tag. Since multiple tags can be associated with multiple products (N to N relationship), there will likely be overlap in the numbers.<br/>
<a download="TagSalesByMeasure.csv" href="/reports/TagSalesByMeasure">Tag Sales By Measure (csv)</a> This is a table of tags & measures by year. The tags and the measures associated with them are along the vertical column, and the years are horizontal. Both item counts and sales totals ($) are shown for each year.<br/>
<a download="ProductSalesByMeasure.csv" href="/reports/ProductSalesByMeasure">Product Sales By Measure (csv)</a> This is a table of products & product measures by year, showing the sales in terms of unit counts and dollar values for each year, each product, and each product's measure.<br/>
<a download="AnnualSaleCountsByMeasure.csv" href="/reports/AnnualSaleCountsByMeasure">Annual Sale Counts By Measure (csv)</a><br/>
</div>
</template>

View File

@@ -144,7 +144,7 @@ Template.UserEditor.events({
let roles = [];
user.username = template.$('input[name="username"]').val();
user.email = template.$('input[name="email"]').val();
user.emails = [{address: template.$('input[name="email"]').val(), verified: true}]; //Assume it is verified since an administrator is adding it.
let roleSpans = template.$('.role.selected');
for(let i = 0; i < roleSpans.length; i++) {