...
 
Commits (2)
......@@ -3,3 +3,4 @@ settings.json
node_modules
npm-debug.log
*.css
/.DS_Store
const Controller = require("./Controller");
const $ = require("jquery");
const Controls = require("../models/Controls");
class ControlsController extends Controller {
constructor() {
super("#controls");
constructor(model) {
super("#controls", model);
this.renderCall();
}
attachEventListeners() {
$(".controls").click(() => {
this.model.evaluate(parseInt(event.target.dataset.ctype));
})
}
render() {
const Buttons = ControlsController.DefaultButtons.map(value => `<button>${value}</button>`).join("");
const Buttons = ControlsController.DefaultButtons.map(value => `<button class="controls" data-ctype="${value.CType}">${value.Name}</button>`).join("");
return `
${Buttons}
`;
}
}
ControlsController.DefaultButtons = [
"PLU",
"EAN",
"Preisauskunft",
"Summe"
{"Name" : "PLU", "CType" : Controls.CTYPE.PLU},
{"Name" : "EAN", "CType" : Controls.CTYPE.EAN},
{"Name" : "Preisauskunft", "CType" : Controls.CTYPE.INFO},
{"Name" : "Summe", "CType" : Controls.CTYPE.SUM}
];
module.exports = ControlsController;
\ No newline at end of file
......@@ -6,6 +6,7 @@ const BonController = require("./BonController");
const ControlsController = require("./ControlsController");
const StatusbarController = require("./StatusbarController");
const Display = require("../models/Display");
const Controls = require("../models/Controls");
//const Std = require("../../Std");
const States = require("../States");
......@@ -14,10 +15,11 @@ class MainController extends Controller {
super("#main");
this.displayValue = "";
this.display = new Display();
this.controls = new Controls();
this.children.push(new DisplayController(this.display));
this.children.push(new BonController());
this.children.push(new NumpadController());
this.children.push(new ControlsController());
this.children.push(new ControlsController(this.controls));
this.children.push(new StatusbarController());
States.addListener(() => {
......
/**
* * Created by PhpStorm.
* User: Philipp Dippel Inf | DMS - M
* For Project: casheer
* Date: 2019-01-18
* Copyright: Philipp Dippel
*/
class Controls {
constructor() {
}
evaluate(ctype) {
switch (ctype) {
case Controls.CTYPE.PLU:
case Controls.CTYPE.EAN:
this.addToList(ctype);
break;
case Controls.CTYPE.INFO:
this.getProductInfo();
break;
case Controls.CTYPE.SUM:
this.cashier();
break;
default:
break;
}
}
addToList(ctype) {
switch (ctype) {
case Controls.CTYPE.PLU:
console.log("Add To List: PLU");
break;
case Controls.CTYPE.EAN:
console.log("Add To List EAN");
break;
default:
break;
}
}
getProductInfo() {
console.log("Produktinfos")
}
cashier() {
console.log("Kassieren");
}
}
Controls.CTYPE = {
PLU : 0,
EAN : 1,
INFO : 2,
SUM : 3
}
module.exports = Controls;
\ No newline at end of file
This diff is collapsed.
......@@ -52,7 +52,7 @@
"devDependencies": {
"electron": "^2.0.2",
"electron-builder": "^20.15.3",
"eslint": "^4.19.1",
"eslint": "^5.12.1",
"node-sass": "^4.9.0",
"svg2png": "^4.1.1"
}
......
......@@ -109,11 +109,6 @@
"ms": "2.0.0"
}
},
"denque": {
"version": "1.3.0",
"resolved": "https://registry.npmjs.org/denque/-/denque-1.3.0.tgz",
"integrity": "sha512-4SRaSj+PqmrS1soW5/Avd7eJIM2JJIqLLmwhRqIGleZM/8KwZq80njbSS2Iqas+6oARkSkLDHEk4mm78q3JlIg=="
},
"depd": {
"version": "1.1.2",
"resolved": "https://registry.npmjs.org/depd/-/depd-1.1.2.tgz",
......@@ -224,14 +219,6 @@
"resolved": "https://registry.npmjs.org/fresh/-/fresh-0.5.2.tgz",
"integrity": "sha1-PYyt2Q2XZWn6g1qx+OSyOhBWBac="
},
"generate-function": {
"version": "2.3.1",
"resolved": "https://registry.npmjs.org/generate-function/-/generate-function-2.3.1.tgz",
"integrity": "sha512-eeB5GfMNeevm/GRYq20ShmsaGcmI81kIX2K9XQx5miC8KdHaC6Jm0qQ8ZNeGOi7wYB8OsdxKs+Y2oVuTFuVwKQ==",
"requires": {
"is-property": "^1.0.2"
}
},
"has-flag": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz",
......@@ -266,30 +253,11 @@
"resolved": "https://registry.npmjs.org/ipaddr.js/-/ipaddr.js-1.8.0.tgz",
"integrity": "sha1-6qM9bd16zo9/b+DJygRA5wZzix4="
},
"is-property": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/is-property/-/is-property-1.0.2.tgz",
"integrity": "sha1-V/4cTkhHTt1lsJkR8msc1Ald2oQ="
},
"isarray": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz",
"integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE="
},
"long": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/long/-/long-4.0.0.tgz",
"integrity": "sha512-XsP+KhQif4bjX1kbuSiySJFNAehNxgLb6hPRGJ9QsUr8ajHkuXGdrHmFUTUUXhDwVX2R5bY4JNZEwbUiMhV+MA=="
},
"lru-cache": {
"version": "4.1.3",
"resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-4.1.3.tgz",
"integrity": "sha512-fFEhvcgzuIoJVUF8fYr5KR0YqxD238zgObTps31YdADwPPAp82a4M8TrckkWyx7ekNlf9aBcVn81cFwwXngrJA==",
"requires": {
"pseudomap": "^1.0.2",
"yallist": "^2.1.2"
}
},
"media-typer": {
"version": "0.3.0",
"resolved": "https://registry.npmjs.org/media-typer/-/media-typer-0.3.0.tgz",
......@@ -339,46 +307,6 @@
"sqlstring": "2.3.1"
}
},
"mysql2": {
"version": "1.6.4",
"resolved": "https://registry.npmjs.org/mysql2/-/mysql2-1.6.4.tgz",
"integrity": "sha512-ZYbYgK06HKfxU45tYYLfwW5gKt8BslfE7FGyULNrf2K2fh+DuEX+e0QKsd2ObpZkMILefaVn8hsakVsTFqravQ==",
"requires": {
"denque": "1.3.0",
"generate-function": "^2.3.1",
"iconv-lite": "^0.4.24",
"long": "^4.0.0",
"lru-cache": "4.1.3",
"named-placeholders": "1.1.1",
"seq-queue": "0.0.5",
"sqlstring": "2.3.1"
},
"dependencies": {
"iconv-lite": {
"version": "0.4.24",
"resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz",
"integrity": "sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==",
"requires": {
"safer-buffer": ">= 2.1.2 < 3"
}
}
}
},
"named-placeholders": {
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/named-placeholders/-/named-placeholders-1.1.1.tgz",
"integrity": "sha1-O3oNJiA910s6nfTJz7gnsvuQfmQ=",
"requires": {
"lru-cache": "2.5.0"
},
"dependencies": {
"lru-cache": {
"version": "2.5.0",
"resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-2.5.0.tgz",
"integrity": "sha1-2COIrpyWC+y+oMc7uet5tsbOmus="
}
}
},
"negotiator": {
"version": "0.6.1",
"resolved": "https://registry.npmjs.org/negotiator/-/negotiator-0.6.1.tgz",
......@@ -416,11 +344,6 @@
"ipaddr.js": "1.8.0"
}
},
"pseudomap": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/pseudomap/-/pseudomap-1.0.2.tgz",
"integrity": "sha1-8FKijacOYYkX7wqKw0wa5aaChrM="
},
"qs": {
"version": "6.5.2",
"resolved": "https://registry.npmjs.org/qs/-/qs-6.5.2.tgz",
......@@ -493,11 +416,6 @@
}
}
},
"seq-queue": {
"version": "0.0.5",
"resolved": "https://registry.npmjs.org/seq-queue/-/seq-queue-0.0.5.tgz",
"integrity": "sha1-1WgS4cAXpuTnw+Ojeh2m143TyT4="
},
"serve-static": {
"version": "1.13.2",
"resolved": "https://registry.npmjs.org/serve-static/-/serve-static-1.13.2.tgz",
......@@ -568,11 +486,6 @@
"version": "1.1.2",
"resolved": "https://registry.npmjs.org/vary/-/vary-1.1.2.tgz",
"integrity": "sha1-IpnwLG3tMNSllhsLn3RSShj2NPw="
},
"yallist": {
"version": "2.1.2",
"resolved": "https://registry.npmjs.org/yallist/-/yallist-2.1.2.tgz",
"integrity": "sha1-HBH5IY8HYImkfdUS+TxmmaaoHVI="
}
}
}