diff --git a/app/controllers/summary.js b/app/controllers/summary.js
new file mode 100644
index 0000000..721a6ff
--- /dev/null
+++ b/app/controllers/summary.js
@@ -0,0 +1,31 @@
+import Controller from '@ember/controller';
+import { computed } from '@ember/object';
+
+export default Controller.extend({
+ queryParams: ['p', 'c', 'f', 'height', 'weight', 'age', 'sex', 'kcal'],
+
+ pcfByPercentages: computed('p', 'c', 'f', function() {
+ if (this.p > 0 || this.c > 0 || this.f > 0) {
+ let sum = parseInt(this.p) + parseInt(this.c) + parseInt(this.f);
+ return [
+ { name: 'Białko', percent: Math.round(this.p / sum * 100) },
+ { name: 'Weglowodany', percent: Math.round(this.c / sum * 100) },
+ { name: 'Tłuszcz', percent: Math.round(this.f / sum * 100) }
+ ];
+ }
+ }),
+
+ demand: computed('height', 'weight', 'age', 'sex', function() {
+ let ret = {};
+ if (this.sex === 'male') {
+ ret.kcal = 66 + 13.7 * this.weight + 5 * this.height - 6.76 * this.age;
+ } else {
+ ret.kcal = 655 + 9.6 * this.weight + 1.8 * this.height - 4.7 * this.age;
+ }
+ ret.p = Math.round(ret.kcal * 0.2 / 4 * 100) / 100;
+ ret.c = Math.round(ret.kcal * 0.5 / 4 * 100) / 100;
+ ret.f = Math.round(ret.kcal * 0.3 / 9 * 100) / 100;
+
+ return ret;
+ })
+});
diff --git a/app/templates/scanner.hbs b/app/templates/scanner.hbs
new file mode 100644
index 0000000..d50e91e
--- /dev/null
+++ b/app/templates/scanner.hbs
@@ -0,0 +1,111 @@
+
Nazwa | +Gramatura | ++ |
---|---|---|
{{product.name}} | ++ + | ++ + | +