Merge branch 'main' into eventlineup-availability-reminders
This commit is contained in:
4
.dockerignore
Normal file
4
.dockerignore
Normal file
@@ -0,0 +1,4 @@
|
||||
node_modules
|
||||
npm-debug.log
|
||||
Dockerfile
|
||||
.dockerignore
|
||||
19
.vscode/launch.json
vendored
19
.vscode/launch.json
vendored
@@ -4,10 +4,21 @@
|
||||
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
|
||||
"version": "0.2.0",
|
||||
"configurations": [
|
||||
{
|
||||
"name": "Attach",
|
||||
"port": 9229,
|
||||
"request": "attach",
|
||||
"skipFiles": [
|
||||
"<node_internals>/**"
|
||||
],
|
||||
"type": "node",
|
||||
"localRoot": "${workspaceFolder}/src",
|
||||
"remoteRoot": "/home/node/app/src"
|
||||
},
|
||||
{
|
||||
"console": "integratedTerminal",
|
||||
"internalConsoleOptions": "neverOpen",
|
||||
"name": "nodemon",
|
||||
"name": "nodemon (dev)",
|
||||
"program": "dev",
|
||||
"request": "launch",
|
||||
"restart": true,
|
||||
@@ -16,8 +27,8 @@
|
||||
"<node_internals>/**"
|
||||
],
|
||||
"type": "node",
|
||||
"env": {"NODE_ENV": "development"},
|
||||
"preLaunchTask": "npm: scss"
|
||||
}
|
||||
"env": {"NODE_ENV": "development", "DEBUG": "app"},
|
||||
"preLaunchTask": "npm: build-css"
|
||||
}
|
||||
]
|
||||
}
|
||||
16
.vscode/tasks.json
vendored
16
.vscode/tasks.json
vendored
@@ -3,17 +3,21 @@
|
||||
"tasks": [
|
||||
{
|
||||
"type": "npm",
|
||||
"script": "scss",
|
||||
"script": "watch-scss",
|
||||
"problemMatcher": [],
|
||||
"label": "npm: scss watch",
|
||||
"detail": "sass --watch src/scss/application.scss public/css/application.css src/scss/eventsheet.scss:public/css/eventsheet.css"
|
||||
"label": "npm: watch-scss",
|
||||
"detail": "npm run watch-css",
|
||||
"icon": {
|
||||
"id": "eye",
|
||||
"color": "terminal.ansiBlue"
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "npm",
|
||||
"script": "scss",
|
||||
"script": "build-css",
|
||||
"problemMatcher": [],
|
||||
"label": "npm: scss",
|
||||
"detail": "sass src/scss/application.scss:public/css/application.css src/scss/eventsheet.scss:public/css/eventsheet.css"
|
||||
"label": "npm: build-css",
|
||||
"detail": "npm build-css"
|
||||
}
|
||||
]
|
||||
}
|
||||
14
Dockerfile
Normal file
14
Dockerfile
Normal file
@@ -0,0 +1,14 @@
|
||||
FROM node:21
|
||||
|
||||
RUN mkdir -p /home/node/app/node_modules && chown -R node:node /home/node/app
|
||||
RUN mkdir -p /home/node/app/var/db && chown -R node:node /home/node/app
|
||||
WORKDIR /home/node/app
|
||||
|
||||
USER node
|
||||
COPY --chown=node:node package*.json ./
|
||||
RUN npm install
|
||||
COPY --chown=node:node src src
|
||||
COPY --chown=node:node bin bin
|
||||
|
||||
EXPOSE 3000
|
||||
CMD [ "npm", "start" ]
|
||||
21
bin/www
21
bin/www
@@ -10,8 +10,7 @@ var https = require("https");
|
||||
var fs = require("fs");
|
||||
var debug = require("debug")("https");
|
||||
const path = require("path");
|
||||
|
||||
|
||||
var livereload = require("livereload");
|
||||
|
||||
/**
|
||||
* Get port from environment and store in Express.
|
||||
@@ -19,32 +18,18 @@ const path = require("path");
|
||||
|
||||
var port = normalizePort(process.env.PORT || "3000");
|
||||
app.set("port", port);
|
||||
|
||||
/**
|
||||
* Create HTTPS server.
|
||||
*/
|
||||
const https_options = {
|
||||
key: fs.readFileSync("certs/key.pem"),
|
||||
cert: fs.readFileSync("certs/cert.pem"),
|
||||
};
|
||||
var server = http.createServer(app);
|
||||
|
||||
if (process.env.NODE_ENV === "development") {
|
||||
// console.log(`starting livereload, watching ${path.join(__dirname, "../src/views")}`)
|
||||
var livereload = require("livereload");
|
||||
var connectLiveReload = require("connect-livereload");
|
||||
|
||||
const liveReloadServer = livereload.createServer({https: https_options, extraExts: ['pug']});
|
||||
const liveReloadServer = livereload.createServer({port:35729});
|
||||
liveReloadServer.watch(path.join(__dirname, "../src/views"));
|
||||
liveReloadServer.server.once("connection", () => {
|
||||
setTimeout(() => {
|
||||
liveReloadServer.refresh("/");
|
||||
}, 100);
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
var server = https.createServer(https_options, app);
|
||||
|
||||
/**
|
||||
* Listen on provided port, on all network interfaces.
|
||||
*/
|
||||
|
||||
26
caddy/Caddyfile
Normal file
26
caddy/Caddyfile
Normal file
@@ -0,0 +1,26 @@
|
||||
{
|
||||
{$LOG_LEVEL} # Set via environment variable
|
||||
}
|
||||
|
||||
localhost {
|
||||
# Development configuration
|
||||
@notProd {
|
||||
expression {env.ENVIRONMENT} == 'development'
|
||||
}
|
||||
handle @notProd {
|
||||
# Configuration that only applies when not in production
|
||||
reverse_proxy app-dev:3000
|
||||
}
|
||||
}
|
||||
|
||||
{$DOMAIN} {
|
||||
# Production configuration
|
||||
@prod {
|
||||
expression {env.ENVIRONMENT} == 'production'
|
||||
}
|
||||
handle @prod {
|
||||
# Configuration that only applies in production
|
||||
# header Strict-Transport-Security "max-age=31536000;"
|
||||
reverse_proxy app:3000
|
||||
}
|
||||
}
|
||||
50
docker-compose.yml
Normal file
50
docker-compose.yml
Normal file
@@ -0,0 +1,50 @@
|
||||
services:
|
||||
app: &app
|
||||
env_file:
|
||||
- .env
|
||||
build: .
|
||||
networks:
|
||||
- web
|
||||
profiles:
|
||||
- production
|
||||
expose:
|
||||
- 3000
|
||||
|
||||
app-dev:
|
||||
<<: *app
|
||||
ports:
|
||||
- 9229:9229 #debugger
|
||||
- 35729:35729 #livereload
|
||||
profiles:
|
||||
- development
|
||||
command: npm run dev
|
||||
volumes:
|
||||
- ./src:/home/node/app/src
|
||||
- ./package.json:/home/node/app/package.json
|
||||
- ./package-lock.json:/home/node/app/package-lock.json
|
||||
- ./certs:/home/node/app/certs
|
||||
- ./bin/www:/home/node/app/bin/www
|
||||
environment:
|
||||
DEBUG: "app"
|
||||
NODE_ENV: "development"
|
||||
|
||||
caddy:
|
||||
image: caddy
|
||||
ports:
|
||||
- 80:80
|
||||
- 443:443
|
||||
volumes:
|
||||
- ./caddy/Caddyfile:/etc/caddy/Caddyfile
|
||||
- caddy_data:/data
|
||||
- caddy_config:/config
|
||||
networks:
|
||||
- web
|
||||
env_file:
|
||||
- .env
|
||||
|
||||
networks:
|
||||
web:
|
||||
|
||||
volumes:
|
||||
caddy_data:
|
||||
caddy_config:
|
||||
45
package-lock.json
generated
45
package-lock.json
generated
@@ -33,6 +33,7 @@
|
||||
"passport-teamsnap": "^1.1.1",
|
||||
"pluralize": "^8.0.0",
|
||||
"pug": "^3.0.2",
|
||||
"sass": "^1.77.2",
|
||||
"sortablejs": "^1.15.0",
|
||||
"teamsnap.js": "github:anthonyscorrea/teamsnap-javascript-sdk#link-with-null-link",
|
||||
"tinymce": "^6.8.3",
|
||||
@@ -663,7 +664,6 @@
|
||||
"version": "3.1.3",
|
||||
"resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.3.tgz",
|
||||
"integrity": "sha512-KMReFUr0B4t+D+OBkjR3KYqvocp2XaSzO55UcB6mgQMd3KbcE+mWTyvVV7D/zsdEbNnV6acZUutkiHQXvTr1Rw==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"normalize-path": "^3.0.0",
|
||||
"picomatch": "^2.0.4"
|
||||
@@ -834,7 +834,6 @@
|
||||
"version": "2.2.0",
|
||||
"resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.2.0.tgz",
|
||||
"integrity": "sha512-jDctJ/IVQbZoJykoeHbhXpOlNBqGNcwXJKJog42E5HDPUwQTSdjCHdihjj0DlnheQ7blbT6dHOafNAiS8ooQKA==",
|
||||
"dev": true,
|
||||
"engines": {
|
||||
"node": ">=8"
|
||||
}
|
||||
@@ -997,7 +996,6 @@
|
||||
"version": "3.0.2",
|
||||
"resolved": "https://registry.npmjs.org/braces/-/braces-3.0.2.tgz",
|
||||
"integrity": "sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"fill-range": "^7.0.1"
|
||||
},
|
||||
@@ -1169,7 +1167,6 @@
|
||||
"version": "3.6.0",
|
||||
"resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.6.0.tgz",
|
||||
"integrity": "sha512-7VT13fmjotKpGipCW9JEQAusEPE+Ei8nl6/g4FBAmIm0GOOLMua9NDDo/DWp0ZAxCr3cPq5ZpBqmPAQgDda2Pw==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"anymatch": "~3.1.2",
|
||||
"braces": "~3.0.2",
|
||||
@@ -2040,7 +2037,6 @@
|
||||
"version": "7.0.1",
|
||||
"resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz",
|
||||
"integrity": "sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"to-regex-range": "^5.0.1"
|
||||
},
|
||||
@@ -2195,7 +2191,6 @@
|
||||
"version": "2.3.3",
|
||||
"resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz",
|
||||
"integrity": "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==",
|
||||
"dev": true,
|
||||
"hasInstallScript": true,
|
||||
"optional": true,
|
||||
"os": [
|
||||
@@ -2304,7 +2299,6 @@
|
||||
"version": "5.1.2",
|
||||
"resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz",
|
||||
"integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"is-glob": "^4.0.1"
|
||||
},
|
||||
@@ -2564,6 +2558,11 @@
|
||||
"integrity": "sha512-Ius2VYcGNk7T90CppJqcIkS5ooHUZyIQK+ClZfMfMNFEF9VSE73Fq+906u/CWu92x4gzZMWOwfFYckPObzdEbA==",
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/immutable": {
|
||||
"version": "4.3.6",
|
||||
"resolved": "https://registry.npmjs.org/immutable/-/immutable-4.3.6.tgz",
|
||||
"integrity": "sha512-Ju0+lEMyzMVZarkTn/gqRpdqd5dOPaz1mCZ0SH3JV6iFw81PldE/PEB1hWVEA288HPt4WXW8O7AWxB10M+03QQ=="
|
||||
},
|
||||
"node_modules/inherits": {
|
||||
"version": "2.0.3",
|
||||
"resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz",
|
||||
@@ -2632,7 +2631,6 @@
|
||||
"version": "2.1.0",
|
||||
"resolved": "https://registry.npmjs.org/is-binary-path/-/is-binary-path-2.1.0.tgz",
|
||||
"integrity": "sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"binary-extensions": "^2.0.0"
|
||||
},
|
||||
@@ -2704,7 +2702,6 @@
|
||||
"version": "2.1.1",
|
||||
"resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz",
|
||||
"integrity": "sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ==",
|
||||
"dev": true,
|
||||
"engines": {
|
||||
"node": ">=0.10.0"
|
||||
}
|
||||
@@ -2722,7 +2719,6 @@
|
||||
"version": "4.0.3",
|
||||
"resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz",
|
||||
"integrity": "sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"is-extglob": "^2.1.1"
|
||||
},
|
||||
@@ -2745,7 +2741,6 @@
|
||||
"version": "7.0.0",
|
||||
"resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz",
|
||||
"integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==",
|
||||
"dev": true,
|
||||
"engines": {
|
||||
"node": ">=0.12.0"
|
||||
}
|
||||
@@ -3373,7 +3368,6 @@
|
||||
"version": "3.0.0",
|
||||
"resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz",
|
||||
"integrity": "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==",
|
||||
"dev": true,
|
||||
"engines": {
|
||||
"node": ">=0.10.0"
|
||||
}
|
||||
@@ -3667,7 +3661,6 @@
|
||||
"version": "2.3.1",
|
||||
"resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz",
|
||||
"integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==",
|
||||
"dev": true,
|
||||
"engines": {
|
||||
"node": ">=8.6"
|
||||
},
|
||||
@@ -4078,7 +4071,6 @@
|
||||
"version": "3.6.0",
|
||||
"resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.6.0.tgz",
|
||||
"integrity": "sha512-hOS089on8RduqdbhvQ5Z37A0ESjsqz6qnRcffsMU3495FuTdqSm+7bhJ29JvIOsBDEEnan5DPu9t3To9VRlMzA==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"picomatch": "^2.2.1"
|
||||
},
|
||||
@@ -4228,6 +4220,22 @@
|
||||
"resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz",
|
||||
"integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg=="
|
||||
},
|
||||
"node_modules/sass": {
|
||||
"version": "1.77.2",
|
||||
"resolved": "https://registry.npmjs.org/sass/-/sass-1.77.2.tgz",
|
||||
"integrity": "sha512-eb4GZt1C3avsX3heBNlrc7I09nyT00IUuo4eFhAbeXWU2fvA7oXI53SxODVAA+zgZCk9aunAZgO+losjR3fAwA==",
|
||||
"dependencies": {
|
||||
"chokidar": ">=3.0.0 <4.0.0",
|
||||
"immutable": "^4.0.0",
|
||||
"source-map-js": ">=0.6.2 <2.0.0"
|
||||
},
|
||||
"bin": {
|
||||
"sass": "sass.js"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=14.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/semver": {
|
||||
"version": "7.6.0",
|
||||
"resolved": "https://registry.npmjs.org/semver/-/semver-7.6.0.tgz",
|
||||
@@ -4466,6 +4474,14 @@
|
||||
"node": ">=0.10.0"
|
||||
}
|
||||
},
|
||||
"node_modules/source-map-js": {
|
||||
"version": "1.2.0",
|
||||
"resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.2.0.tgz",
|
||||
"integrity": "sha512-itJW8lvSA0TXEphiRoawsCksnlf8SyvmFzIhltqAHluXd88pkCd+cXJVHTDwdCr0IzwptSm035IHQktUu1QUMg==",
|
||||
"engines": {
|
||||
"node": ">=0.10.0"
|
||||
}
|
||||
},
|
||||
"node_modules/source-map-support": {
|
||||
"version": "0.5.21",
|
||||
"resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.5.21.tgz",
|
||||
@@ -4735,7 +4751,6 @@
|
||||
"version": "5.0.1",
|
||||
"resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz",
|
||||
"integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"is-number": "^7.0.0"
|
||||
},
|
||||
|
||||
11
package.json
11
package.json
@@ -24,9 +24,13 @@
|
||||
},
|
||||
"scripts": {
|
||||
"start": "node ./bin/www",
|
||||
"dev": "nodemon . & npm run scss",
|
||||
"scss": "sass src/scss/application.scss:src/public/css/application.css src/scss/eventsheet.scss:src/public/css/eventsheet.css",
|
||||
"scss watch": "sass --watch src/scss/application.scss:src/public/css/application.css src/scss/eventsheet.scss:src/public/css/eventsheet.css"
|
||||
"dev": "nodemon --inspect=0.0.0.0 ./bin/www",
|
||||
"build-css": "sass src/scss:src/public/css",
|
||||
"watch-scss": "nodemon -e scss -x \"npm run build-css\""
|
||||
},
|
||||
"nodemonConfig": {
|
||||
"ext": "js,hbs,scss",
|
||||
"watch": ["src"]
|
||||
},
|
||||
"dependencies": {
|
||||
"@teamsnap/teamsnap-ui": "^3.12.3",
|
||||
@@ -54,6 +58,7 @@
|
||||
"passport-teamsnap": "^1.1.1",
|
||||
"pluralize": "^8.0.0",
|
||||
"pug": "^3.0.2",
|
||||
"sass": "^1.77.2",
|
||||
"sortablejs": "^1.15.0",
|
||||
"teamsnap.js": "github:anthonyscorrea/teamsnap-javascript-sdk#link-with-null-link",
|
||||
"tinymce": "^6.8.3",
|
||||
|
||||
11
src/app.js
11
src/app.js
@@ -62,12 +62,14 @@ app.set("view engine", "hbs");
|
||||
app.locals.pluralize = require("pluralize");
|
||||
|
||||
if (process.env.NODE_ENV === "development") {
|
||||
console.log('adding connectLiveReload')
|
||||
var connectLiveReload = require("connect-livereload");
|
||||
app.use(connectLiveReload());
|
||||
app.use("/scss", express.static(path.join(__dirname, "scss")));
|
||||
app.use(connectLiveReload({port: 35729, src:"http://localhost:35729/livereload.js?snipver=1"}));
|
||||
}
|
||||
|
||||
app.use(bodyParser.json());
|
||||
app.use(bodyParser.urlencoded());
|
||||
app.use(bodyParser.urlencoded({extended: true }));
|
||||
app.use(logger("dev"));
|
||||
app.use(cors(corsOptions))
|
||||
app.use(cookieParser());
|
||||
@@ -172,7 +174,10 @@ app.use(function (err, req, res, next) {
|
||||
|
||||
// catch 404 and forward to error handler
|
||||
app.use(function (req, res, next) {
|
||||
next(createError(404));
|
||||
// next(createError(404));
|
||||
res.status(404).send('not found')
|
||||
});
|
||||
|
||||
app.set('trust proxy')
|
||||
|
||||
module.exports = {app};
|
||||
@@ -1,6 +1,6 @@
|
||||
const path = require('path')
|
||||
const fs = require('fs')
|
||||
const {embeddedSvgFromPath, parsePositionLabel, compilePositionLabel} = require("../lib/utils")
|
||||
const {groupTeamsnapItems, parsePositionLabel, compilePositionLabel, teamsnapCallback} = require("../lib/utils")
|
||||
const tsUtils = require('../lib/utils')
|
||||
const { loadEventLineupEntries } = require('teamsnap.js')
|
||||
|
||||
@@ -38,14 +38,14 @@ exports.getAdjacentEventLineup = async (req, res) => {
|
||||
return
|
||||
}
|
||||
const availabilitySummary = event.availabilitySummary
|
||||
const event_lineup = req.timeline.event_lineups.find(i=>i.eventId==event.id)
|
||||
const event_lineup = req.timeline.event_lineups?.find(i=>i.eventId==event.id)
|
||||
const event_lineup_entries = req.timeline.event_lineup_entries?.filter(i=>i.eventId==event.id)
|
||||
const availabilities = req.timeline.availabilities.filter(i=>i.eventId==event.id)
|
||||
attachBenchcoachPropertiesToMember(members, event_lineup_entries, availabilities)
|
||||
members.sort(tsUtils.teamsnapMembersSortLineupAvailabilityLastName)
|
||||
console.log()
|
||||
// res.status(200).send('Received')
|
||||
res.render("eventlineup/edit", {user, team, members, event, layout: null, event_lineup, event_lineup_entries, availabilitySummary, csrfToken})
|
||||
|
||||
res.render("eventlineup/edit", {user, team, members, event, layout: null, event_lineup, event_lineup_entries, availabilitySummary, availabilities, csrfToken})
|
||||
}
|
||||
|
||||
attachBenchcoachPropertiesToMember = (members, event_lineup_entries, availabilities) => {
|
||||
@@ -109,14 +109,20 @@ exports.postEventLineup = async (req,res) => {
|
||||
const eventLineupEntries = req.event_lineup.eventLineupEntries
|
||||
const {newEventLineupEntries, deleteEventLineupEntries} = processPostedEventLineupEntries(body, eventLineupEntries, req.event_lineup)
|
||||
newEventLineupEntries.forEach(e=>{
|
||||
teamsnap.saveEventLineupEntry(e)
|
||||
teamsnap.saveEventLineupEntry(e, teamsnapCallback)
|
||||
})
|
||||
deleteEventLineupEntries.forEach(e=>{
|
||||
teamsnap.deleteEventLineupEntry(e)
|
||||
teamsnap.deleteEventLineupEntry(e, teamsnapCallback)
|
||||
})
|
||||
|
||||
eventLineup = await teamsnap.loadEventLineups(req.params.event_id)
|
||||
res.status(201).end()
|
||||
const bulk_items = await teamsnap.bulkLoad(
|
||||
{teamId: req.params.team_id, types: ['eventLineup', 'eventLineupEntry'], scopeTo:'event', event__id:req.params.event_id,},
|
||||
null,
|
||||
(err, items) => {teamsnapCallback(err, items, {req, source:"postEventLineup", method:'bulkLoad'})}
|
||||
)
|
||||
groupedReturnedItems = groupTeamsnapItems(bulk_items)
|
||||
returnedEventLineupEntries = groupedReturnedItems.eventLineupEntries
|
||||
res.status(201).end(JSON.stringify(returnedEventLineupEntries))
|
||||
}
|
||||
|
||||
const processPostedEventLineupEntries = (body, eventLineupEntries, eventLineup) => {
|
||||
|
||||
@@ -23,8 +23,14 @@ exports.getEventSheet = async (req,res) =>{
|
||||
)
|
||||
)
|
||||
await Promise.all(req.promises)
|
||||
const {sheet_size, sheet_layout} = req.query
|
||||
|
||||
const {user, team, team_preferences, members, event, event_lineup, event_lineup_entries, availabilities, availabilitySummary, timeline, recent_events, opponent_logo, upcoming_events} = req
|
||||
res.render('eventsheet/sheet', {user, team, team_preferences, members, event, event_lineup, event_lineup_entries, availabilities, availabilitySummary, timeline, recent_events, opponent_logo,upcoming_events})
|
||||
res.render('eventsheet/sheet', {sheet_size, sheet_layout, user, team, team_preferences, members, event, event_lineup, event_lineup_entries, availabilities, availabilitySummary, timeline, recent_events, opponent_logo,upcoming_events})
|
||||
}
|
||||
|
||||
exports.getEventSheetBlank = (req,res) => {
|
||||
res.render('eventsheet/sheet_blank')
|
||||
}
|
||||
|
||||
exports.getLineupCard = (req, res, next) => {
|
||||
|
||||
@@ -95,7 +95,7 @@ exports.loadSlots = (options) =>{
|
||||
var s = ""
|
||||
const {members, event_lineup, event_lineup_entries, event, availabilities} = options.data.root
|
||||
event_lineup_entries.forEach(eventLineupEntry =>{
|
||||
const availability = availabilities.find(a=>a.memberId==eventLineupEntry.memberId)
|
||||
const availability = availabilities?.find(a=>a.memberId==eventLineupEntry.memberId)
|
||||
const member = members.find(m=>m.id==eventLineupEntry.memberId)
|
||||
const {positionFlags} = parsePositionLabel(eventLineupEntry.label)
|
||||
const initial_slotset = `lineup-${positionFlags.has('PO') ? 'positiononly' : 'starting'}-${event.id}`
|
||||
@@ -106,9 +106,9 @@ exports.loadSlots = (options) =>{
|
||||
member=>!event_lineup_entries.map(lue=>lue.memberId).includes(member.id) && !member.isNonPlayer
|
||||
)
|
||||
players_without_lineup_entry.forEach(member =>{
|
||||
const availability = availabilities.find(a=>a.memberId==member.id)
|
||||
const availability = availabilities?.find(a=>a.memberId==member.id)
|
||||
let initial_slotset
|
||||
if (availability.statusCode == 0 || availability.statusCode == null) {
|
||||
if (availability?.statusCode == 0 || availability?.statusCode == null) {
|
||||
initial_slotset =`lineup-out-${event.id}`
|
||||
} else {
|
||||
initial_slotset =`lineup-bench-${event.id}`
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
const { parsePositionLabel, teamsnapMembersSortLineupAvailabilityLastName, teamsnapMembersSortAvailabilityLastName } = require('../lib/utils')
|
||||
const {attachBenchcoachPropertiesToMember} = require('../controllers/eventlineup')
|
||||
const Handlebars = require("handlebars");
|
||||
|
||||
exports.offenseLineup = (number_of_slots, event_lineup_entries, members, options) => {
|
||||
var results = ""
|
||||
@@ -60,7 +61,7 @@ exports.rosterHistory = (event, event_lineup_entries, members, availabilities, o
|
||||
// const {event, event_lineup_entries, members, availabilities} = options.data.root
|
||||
const players = members.filter(m=>!m.isNonPlayer)
|
||||
attachBenchcoachPropertiesToMember(players, event_lineup_entries ? event_lineup_entries.filter(i=>i.eventId==event.id) : [], availabilities.filter(i=>i.eventId==event.id))
|
||||
players.sort(teamsnapMembersSortAvailabilityLastName)
|
||||
players.sort(teamsnapMembersSortLineupAvailabilityLastName)
|
||||
|
||||
players.forEach(member=>{
|
||||
const {firstName, lastName, jerseyNumber, benchcoach, position, id} = member
|
||||
@@ -112,8 +113,15 @@ exports.repeat = (n, options) => {
|
||||
|
||||
exports.loopEvents = (events, options) => {
|
||||
var results = "";
|
||||
events.forEach(event => {
|
||||
results += options.fn(event)
|
||||
if (options.data) {
|
||||
data = Handlebars.createFrame(options.data);
|
||||
}
|
||||
|
||||
events.forEach((event,i) => {
|
||||
if (data) {
|
||||
data.index = i;
|
||||
}
|
||||
results += options.fn(event, {data: data })
|
||||
}
|
||||
)
|
||||
return results;
|
||||
@@ -121,6 +129,9 @@ exports.loopEvents = (events, options) => {
|
||||
|
||||
exports.timepointForMember = (member, timeline, event, options) => {
|
||||
var results = ""
|
||||
if (options.data) {
|
||||
data = Handlebars.createFrame(options.data);
|
||||
}
|
||||
const availability = timeline.availabilities.find(a=>a.memberId==member.id && a.eventId==event.id)
|
||||
const eventLineupEntry = timeline.event_lineup_entries.find(a=>(a.memberId==member.id || a.memberName == `${member.firstName} ${member.lastName}`) && a.eventId==event.id)
|
||||
var value = ""
|
||||
@@ -130,5 +141,13 @@ exports.timepointForMember = (member, timeline, event, options) => {
|
||||
else {
|
||||
value = availability.status[0]
|
||||
}
|
||||
return options.fn({availability: availability, eventLineupEntry: eventLineupEntry, value})
|
||||
return options.fn({availability: availability, eventLineupEntry: eventLineupEntry, value}, {data: data })
|
||||
}
|
||||
|
||||
exports.ifEquals = (testValue, targetValue, options) => {
|
||||
if (testValue === targetValue) {
|
||||
return options.fn();
|
||||
} else {
|
||||
return '';
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1 +1 @@
|
||||
{"version":3,"sourceRoot":"","sources":["../../scss/eventsheet.scss"],"names":[],"mappings":";AAAQ;AACA;AACA;AACA;AACA;AAER;EACE;EACA;EACA;EACA;;AAGF;EACE;;AAGF;AACA;EACE;IACE;;EAEF;IACE;IACA;;;AAIJ;AACA;EACE;IACE;;EAEF;IACE;;EAEF;IACE;IACA;;;AAIJ;EACE;EACA;EACA;EACA;;;AAGF;AACA;EACE;EACA;;;AAGF;EACE;EACA;;;AAGF;EACE;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;;AAGF;EACE;EACA;EACA;;;AAGF;EACE;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;AAEA;EACE;EACA;EACA;;AAEA;EACE;;AAGF;EACE;;AAGF;EACE;EACA;EACA;EACA;;AAKA;EACE;EACA;;AAEF;EACE;EACA;EACA;EACA;;AAKJ;EACE;EACA;EACA;EACA;;AAEA;EACE;;;AAQR;EACE;;;AAGF;EACE;;;AAGF;EACE;EACA;EACA;EACA;EACA;EACA;;;AAGF;EACE;EACA;AACA;EACA;EACA;EACA;;AAEA;EACE;EACA;EACA;EACA;;AAGF;EACE;;AAEF;EACE;;AAEF;EACE;;AAEF;EACE;;;AAKJ;EACE;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;AAEA;EACI;EACA;EACA;;AAEJ;EACI;EACA;;AAEJ;EACI;EACA;;AAEJ;EACI;;;AAKN;EACE;;;AAGF;AAAA;EAEE;EACA;EACA;EACA,qBACE;;;AAIJ;AAAA;EAEE;EACA;EACA;EACA,qBACE;;;AAIJ;AAAA;AAAA;AAAA;EAIE;;;AAGF;EACE;EACA;EACA;;;AAGF;EACE;;;AAGF;EACE;;;AAGF;EACE;;;AAGF;EACE;;AAEA;EACE;EACA;;AAEF;EACE;EACA;EACA;EACA;;AAEA;EACE;;;AAQN;EACE;;;AAGF;AACE;;;AAGF;EACE;;;AAGF;EACE;;;AAGF;AAAA;AAAA;AAAA;AAAA;EAKE;;;AAGF;AAAA;AAAA;AAAA;AAAA;EAKE;;;AAGF;EACE;;;AAGF;EACE;;AACA;EACE;;AAEF;EACE;;;AAIJ;EACE;;;AAGF;EACE;;;AAGF;AAAA;EAEE;;;AAGF;AAAA;EAEE;EACA;EACA;;;AAGF;EACE;EACA;EACA;;;AAKA;EACE;EACA;EACA;EACA,qBACE;;AAIJ;EACE;;AAGF;EACE;;AAGF;AACE;EACA;EACA;EACA;AACA;EACA;EACA;EACA;;AAEA;EACE;EACA;EACA;;AAEA;EACE;EACA;EACA;;AAEA;EACE;EACA;EACA;;AAIJ;EACE;EACA;;AAGF;EACE;EACA;;AACA;EACE;;AAQJ;EACE;EACA;EACA;;AAEF;EACE;;;AAON;EACE;;AAGF;EACE;;AAIA;EACE;EACA;;AAMF;EACE;;AAGF;EAOE;EACA;EACA;EACA;;AATA;EACE;;AACA;EACE;;;AAeV;EACE;EACA;EACA;EACA;EACA;;AAGA;EACE;EACA;EACA;EACA;EACA;EACA;;AAGF;EACE;EACA;;AAGF;EACE;EACA;;AAMI;EACE,SALM;;AAIR;EACE,SALM;;AAIR;EACE,SALM;;AAIR;EACE,SALM;;AAIR;EACE,SALM;;AAIR;EACE,SALM;;AAIR;EACE,SALM;;AAIR;EACE,SALM;;AAIR;EACE,SALM;;AAUZ;EACE;EAEA;;AAGF;EACE;EACA;;AAGF;EACE;EACA;;AAGF;EACE;EACA;;AAGF;EACE;EACA;;AAGF;EACE;EACA;;AAGF;EACE;EACA;;AAGF;EACE;EACA;;AAGF;EAIE;EACA;EACA;;AALA;EACE;;AAKF;EACI;;;AASV;EACE;AACA;EACA;EAEA;EACA;AACA;;AAEA;EACE;EACA;;AAGF;EACE;;AACA;EACE;;;AAON;EACE;;;AAGF;EACE;;;AAGF;EACE;;;AAGF;EACE;;;AAGF;EACE;EACA;EACA;;;AAGF;EACE;EACA;AACA;AACA;AACA;EACA;EAEA;EACA;EACA;EACA;EACA;;;AAKF;EACE;;;AAGF;EACE;;;AAGF;EACE;EACA;EACA;;;AAGF;EACE;EACA;EACA;EACA;EACA;;;AAGF;EACE;EACA;;;AAGF;EACE;EACA;EACA;EACA;EACA;;;AAGF;EACE;EACA;EACA;;;AAGF;EACE;EACA;EACA;;;AAGF;EACE;;;AAEF;EACE;;;AAGF;EACE;;;AAGF;EACE;EACA;;;AAGF;EACE;EACA;;;AAGF;AAAA;EAEE;EACA;;;AAGF;EACE;EACA;;;AAGF;EACE;EACA;;;AAGF;EACE;;;AAGF;EACE;;;AASA;EACE;;AAEF;AACE;EACA;EACA;AACA;;AAGF;EACE;EACA;EACA;;AAEA;EACE;EACA;EACA;EACA;EACA;;AAGF;EAEE;EACA;EACA;EACA;EACA;EACA;;AAGF;EACI;EACA;EACA;EACA;EACA;;AAEJ;EACI;EACA;EACA;EACA;EACA;;AAEA;AAAA;AAAA;EAEE;EACA;EACA;;AAGF;EACE;;AAGF;EACE;;AAMN;EACE;EACA;EACA;;AAEF;EACE;EACA;;AAIJ;EACE;EACA;EACA;EACA;EACA;EACA;;AAGF;EAEE;;AAGF;EACE;EACA;EACA;;AAEA;EACE;EACA;AACA;EACA;EACA;EACA;;AAQJ;EACE;;AAGF;EACE;;AAGF;EACE;;;AAOJ;EACE;EACA;;;AAGF;EACE;EACA;EACA;AACA;AAAA;;;AAIF;EACE;;;AAGF;EACE;;;AAGF;EACE;;AAEA;EACE;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;AAGF;EACE;EACA;EACA;;AAGF;EACE;EACA;;AAGF;EACE;EACA;EACA;EACA;;AAGF;EACI;EACA;EACA;EACA;;AAGJ;EACE;EACA;EACA;;AAGF;EACE;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;AAGF;EACE;;AAGF;EACE;;AAGF;EACE;;AAGF;EACE","file":"eventsheet.css"}
|
||||
{"version":3,"sourceRoot":"","sources":["../../scss/eventsheet.scss"],"names":[],"mappings":";AAAQ;AACA;AACA;AACA;AACA;AACA;AAER;EACE;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;;AAIF;AACA;EACE;IACE;;EAEF;IACE;;EAEF;IACE;IACA;;;AAIJ;AACA;EACE;IACE;;EAEF;IACE;;EAEF;IACE;IACA;IACA;;;AAIJ;EACE;EACA;EACA;EACA;EACA;;;AAGF;AACA;EAA+B;EAAc;;;AAC7C;EAA+B;EAAc;;;AAC7C;EAA+B;EAAc;;;AAE7C;EACE;EACA;EACA;EACA;;;AAGF;EACE;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;AACA;EACE;;AAEF;EACE;EACA;;AAEA;EACE;;AAMkB;EAChB;;AAGiB;EACjB;;;AAOR;EACE;;;AAGF;EACE;;;AAGF;EACE;;AACA;EACE;;AACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;AAEA;EACE;EACA;EACA;EACA;EACA;;AAGF;EACE;;AAEF;EACE;;AAEF;EACE;;AAEF;EACE;;AAGF;EACE;;AAGF;EACE;;;AAMN;EACI;EACA;EACA;EACA;EACA;EACA;;AACA;EACE;;;AAIN;EACE;;;AAGF;EACE;EACE;EACA;EACA;EACA;;AACA;EACE;;;AAIN;EACE;EACE;EACA;EACA;EACA;;AACA;EACE;;;AAIN;EACE;EAEA;EAEA;;AAEA;EACE;EACA;EACA;EACA;;AACA;EACE;;AAIJ;EACE;;AACA;EACE;EACA;EACA;EACA;EACA;EACA;;AACA;EACE;;AAMN;EACE;EACA;EACA;;AAGF;EAEE;;AAGF;AACE;;AACA;EACE;;AACA;EACE;;AAGJ;EACE;;AAEF;EACE;EACA;EACA;EACA;EACA;;AAKF;EAEA;;AAIA;EACE;EACA;;AAEF;EACE;;AAKF;EACE;;AACA;EACE;;AAGJ;EACE;;AAGF;EACE;;;AAMJ;EACE;;AAEF;EACE;;AACA;EACE;;;AAOJ;EACE;EACA;EACA;EACA,qBACE;;AAIJ;EACE;;AAGF;EACE;;AAGF;AACE;EACA;EACA;EACA;AACA;EACA;EACA;EACA;;AAEA;EACE;EACA;EACA;;AAGE;EACA;EACA;EACA;;AAGA;EACE;EACA;EACA;;AAIJ;EACE;EACA;;AAGF;EACE;EACA;;AACA;EACE;;AAQJ;EACE;EACA;EACA;;AAEF;EACE;;;AAON;EACE;;AAGF;EACE;;AAIA;EACE;EACA;;AAMF;EACE;;AAGF;EAOE;EACA;EACA;EACA;;AATA;EACE;;AACA;EACE;;;AAcV;EACE;;;AAGF;EACE;EACA;EACA;EACA;;AAEA;EACE;EACA;EACA;EACA;EACA;EACA;;AAGF;EACE;EACA;EACA;EACA;EACA;;AACA;EACE;EACA;EACA;;AAEF;EACE;EACA;EACA;EACA;;AAIJ;EACE;EACA;;AAIA;EACE;;AAGF;EACE;EACA;EACA;;AAEE;EACE;;AAEM;EACN;;AAEF;EACA;EACA;EACA;;AAQA;EACE;;AACA;EACA,SA/BM;;AA4BR;EACE;;AACA;EACA,SA/BM;;AA4BR;EACE;;AACA;EACA,SA/BM;;AA4BR;EACE;;AACA;EACA,SA/BM;;AA4BR;EACE;;AACA;EACA,SA/BM;;AA4BR;EACE;;AACA;EACA,SA/BM;;AA4BR;EACE;;AACA;EACA,SA/BM;;AA4BR;EACE;;AACA;EACA,SA/BM;;AA4BR;EACE;;AACA;EACA,SA/BM;;AAoCZ;EACE;EAEA;;AAGF;EACE;EACA;;AAGF;EACE;EACA;;AAGF;EACE;EACA;;AAGF;EACE;EACA;;AAGF;EACE;EACA;;AAGF;EACE;EACA;;AAGF;EACE;EACA;;AAGF;EAIE;EACA;EACA;;AALA;EACE;;AAKF;EACE;;AACA;EACE;;;AASV;EACE;AACA;EACA;EAEA;EACA;AACA;;AAEA;EACE;EACA;;AAGF;EACE;;AACA;EACE;;;AAMN;EACE;EACA;EACA;EACA;EACA;EACA;EACA;;;AAGF;EACE;;;AAGF;EACE;;;AAGF;EACE;;;AAGF;EACE;;;AAGF;EACE;EACA;;;AAGF;EACE;EACA;EACA;EACA;EACA;;;AAGF;EACE;EACA;EACA;;;AAGF;EACE;EACA;EACA;;;AAGF;EACE;;;AAEF;EACE;;;AAGF;EACE;;;AAKF;EACE;;AAME;EACE;EACA;;AAGF;EACE;EACA;;AAGF;EAEE;EACA;;AAGF;EACE;EACA;;AAGF;EACE;EACA;;AAIJ;EACE;EACA;;AAEF;AACE;EACA;EACA;AACA;;AAIA;EACA;;AAKF;EACE;;AAGF;EACE;EACA;EACA;EACA;;AAOF;EACE;;AAGF;EACE;EACA;EACA;;AAEA;EACE;EACA;EACA;EACA;EACA;;AAGF;EAEE;EACA;EACA;EACA;EACA;EACA;;AAGF;EACI;EACA;EACA;EACA;EACA;;AAEJ;EACE;;AACA;EACE;;AAGJ;EACI;EACA;EACA;EACA;EACA;;AAEA;AAAA;AAAA;AAAA;EAEE;EACA;EACA;;AAGF;EACE;;AAGF;EACE;;AAMN;EACE;EACA;EACA;;AAEF;EACE;;AAIJ;EACE;EACA;EACA;;AAEF;EACE;EACA;EACA;;AAGF;EAEE;;AAGF;EACE;EACA;;AAEA;EACE;AACA;EACA;EACA;EACA;;AAQJ;EACE;;AAGF;EACE;;AAGa;EACb;;;AAMF;EACE;;AAEF;EACE;;AAEF;EACE;;AAIA;EACE;EACA;;AAGF;EACE;;AAGF;EACE;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;AAGF;EAQE;EACA;;AARA;EACE;;AACA;EACE;EACA;;AAWJ;EACE;EACA;;AAQJ;EACE;;;AAKN;EACE;EACA;;;AAGF;EACE;;;AAGF;EACE;EACA;EACA;AACA;AAAA;;;AAIF;EACE;;;AAGF;EACE;;;AAGF;EACE;;AAEA;EACE;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;AACA;EACE;EACA;EACA;EACA;EACA;;AAGF;EACE;EACA;;AAGF;EACE;EACA;;AAGF;EACE;EACA;EACA;EACA;;AAIJ;EACE;;AAGF;EACE;;AAGF;EACE;EACA;;AAGF;EACE;EACA;EACA;;AAGF;EACE;EACA;EACA;;AAGF;EACE;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;AAGF;EACE;;AAGF;EACE;;AAGF;EACE;;AAGF;EACE","file":"eventsheet.css"}
|
||||
@@ -323,6 +323,7 @@ async function onSubmit(form, event) {
|
||||
event.submitter.blur()
|
||||
waiting_icon.classList.add("u-hidden");
|
||||
success_icon.classList.remove("u-hidden");
|
||||
console.log(text);
|
||||
// success_icon.querySelector("span.message").innerHTML = text;
|
||||
})
|
||||
.catch((error) => {
|
||||
@@ -331,7 +332,8 @@ async function onSubmit(form, event) {
|
||||
failure_icon.classList.remove("u-hidden");
|
||||
console.log(error);
|
||||
// success_icon.querySelector("span.message").innerHTML = error;
|
||||
});
|
||||
})
|
||||
.finally(()=>{location.reload()});//refresh page
|
||||
setTimeout(() => {
|
||||
[waiting_icon, success_icon, failure_icon].forEach(e=>e.classList.add('u-hidden'))
|
||||
teamsnap_icon.classList.remove('u-hidden')
|
||||
@@ -637,10 +639,11 @@ function insertLineup(direction, teamId, eventId, element) {
|
||||
function initSlots () {
|
||||
const slots = Array.from(document.querySelectorAll('.lineup-slot'))
|
||||
slots.forEach(slot=>{
|
||||
console.log(slot,`.${slot.dataset.initialSlotset}`)
|
||||
const parent = document.querySelector(`#${slot.dataset.initialSlotset}`)
|
||||
parent.appendChild(slot)
|
||||
slot.removeAttribute('data-initial-slotset')
|
||||
if (slot.dataset.initialSlotset) {
|
||||
const parent = document.querySelector(`#${slot.dataset.initialSlotset} .slot-set`)
|
||||
parent.appendChild(slot)
|
||||
slot.removeAttribute('data-initial-slotset')
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
@@ -30,6 +30,8 @@ router.get("/:team_id([0-9]+)/event/:event_id([0-9]+)/sheet", async (req,res) =>
|
||||
}
|
||||
)
|
||||
|
||||
router.get("/lineup/sheet/blank", eventsSheetController.getEventSheetBlank )
|
||||
|
||||
router.post("/:team_id([0-9]+)/event/:event_id([0-9]+)/lineup/:event_lineup_id([0-9]+)/sheet", upload.none(), eventsSheetController.getEventSheet )
|
||||
|
||||
module.exports = {router}
|
||||
File diff suppressed because it is too large
Load Diff
0
src/views/event/stats-importer.hbs
Normal file
0
src/views/event/stats-importer.hbs
Normal file
@@ -1,7 +0,0 @@
|
||||
|
||||
<div class="section-divider">
|
||||
<div class="dotted-line NW" style=""></div>
|
||||
<div class="dotted-line NE" style=""></div>
|
||||
<div class="dotted-line SW" style=""></div>
|
||||
<div class="dotted-line SE" style=""></div>
|
||||
</div>
|
||||
@@ -1,8 +1,8 @@
|
||||
<div class="field-container">
|
||||
<img src="/media/baseball-diamond.svg" />
|
||||
{{{embeddedSvgFromPath "/media/baseball-diamond.svg" 'baseball-diamond'}}}
|
||||
{{#defenseLineup event_lineup_entries members}}
|
||||
<div class="slot-set pos-{{this.position}}">
|
||||
<table>
|
||||
<table class="striped">
|
||||
<tbody>
|
||||
<tr class="slot">
|
||||
<th class="position"></th>
|
||||
|
||||
@@ -1,14 +1,16 @@
|
||||
<table>
|
||||
<colgroup><col span="3" class="player"></colgroup>
|
||||
{{!-- <colgroup><col span="0" class="player-stats"></colgroup> --}}
|
||||
<colgroup><col span="4" class="position-capability"></colgroup>
|
||||
{{!-- <colgroup><col span="4" class="player"></colgroup> --}}
|
||||
{{!-- <colgroup><col span="1" class="spacer"></colgroup> --}}
|
||||
{{!-- <colgroup><col span="1" class="player-stats"></colgroup> --}}
|
||||
{{!-- <colgroup><col span="4" class="position-capability"></colgroup>
|
||||
<colgroup><col span="4" class="availability-on-day future"></colgroup>
|
||||
<colgroup><col span="4" class="availability-on-day past"></colgroup>
|
||||
<colgroup><col span="4" class="availability-on-day past"></colgroup> --}}
|
||||
<thead>
|
||||
<tr>
|
||||
<th colspan="3" id="today-availability">
|
||||
<th colspan="4" id="today-availability">
|
||||
Available ({{availabilitySummary.playerGoingCount}}|{{availabilitySummary.playerMaybeCount}})
|
||||
</th>
|
||||
<th class="spacer first-of-group last-of-group"></th>
|
||||
<th class="player-stats">
|
||||
<span class="decimal-point">.</span>AVG
|
||||
<span class="delimiter">/</span>
|
||||
@@ -17,34 +19,38 @@
|
||||
<span class="decimal-point">.</span>SLG
|
||||
<span class="delimiter">:</span>PA
|
||||
</th>
|
||||
<th class="position-capability pitcher">P</th>
|
||||
<th class="position-capability pitcher first-of-group">P</th>
|
||||
<th class="position-capability catcher">C</th>
|
||||
<th class="position-capability infield">I</th>
|
||||
<th class="position-capability outfield">O</th>
|
||||
<th class="position-capability outfield last-of-group">O</th>
|
||||
{{!-- <% for timepoint, i in timeline.select{|tp| tp[:comparison_to_selected]>0}.sort{|tp| -tp[:comparison_to_selected]}.each_with_index do%> --}}
|
||||
|
||||
{{#loopEvents upcoming_events}}
|
||||
<th class="availability-on-day avail-today-plus-{{@index}}" date="{{this.startDate}}"><div>{{dateFormat this.startDate "ddd" }}</div></th>
|
||||
<th class="availability-on-day avail-today-plus-{{@index}} {{#ifEquals @index 0}}first-of-group{{/ifEquals}}{{#ifEquals @index 3}}last-of-group{{/ifEquals}}" date="{{this.startDate}}"><div>{{dateFormat this.startDate "ddd" }}</div></th>
|
||||
{{/loopEvents}}
|
||||
{{#loopEvents recent_events}}
|
||||
<th class="availability-on-day avail-today-minus-{{@index}}" date="{{this.startDate}}"><div>{{dateFormat this.startDate "ddd" }}</div></th>
|
||||
<th class="availability-on-day avail-today-minus-{{@index}} {{#ifEquals @index 0}}first-of-group{{/ifEquals}}{{#ifEquals @index 3}}last-of-group{{/ifEquals}}" date="{{this.startDate}}"><div>{{dateFormat this.startDate "ddd" }}</div></th>
|
||||
{{/loopEvents}}
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{{!-- <% by_member.select{|m,d| !m.is_non_player}.each_with_index do |(member, d), i|%> --}}
|
||||
{{#rosterHistory event event_lineup_entries members availabilities}}
|
||||
<tr id="roster-history-slot-<%= ::Temple::Utils.escape_html((i)) %>">
|
||||
<td class="is-present-checkbox available-status-code-{{this.benchcoach.availability.statusCode}}">
|
||||
<tr class="roster-history-slot{{#if (isStarting this)}} starting-today{{/if}}">
|
||||
<td class="is-present-checkbox available-status-code-{{this.benchcoach.availability.statusCode}} first-of-group">
|
||||
<span>■</span>
|
||||
</td>
|
||||
<td class="jersey-number available-status-code-{{this.benchcoach.availability.statusCode}}{{#if (isStarting this)}} starting{{/if}}">
|
||||
<td class="jersey-number available-status-code-{{this.benchcoach.availability.statusCode}}">
|
||||
{{this.jerseyNumber}}
|
||||
</td>
|
||||
<td class="player-name available-status-code-{{this.benchcoach.availability.statusCode}}{{#if (isStarting this)}} starting{{/if}}">
|
||||
<td class="player-name available-status-code-{{this.benchcoach.availability.statusCode}}">
|
||||
{{this.lastName}}
|
||||
</td>
|
||||
<td class="player-stats border-left border-right">
|
||||
<td class="position available-status-code-{{this.benchcoach.availability.statusCode}} last-of-group">
|
||||
<span>{{this.benchcoach.eventLineupEntry.label}}</span>
|
||||
</td>
|
||||
<td class="spacer"></td>
|
||||
<td class="player-stats first-of-group last-of-group">
|
||||
<span class="decimal-point">.</span>
|
||||
<span class="avg">000</span>
|
||||
<span class="delimiter">/</span>
|
||||
@@ -56,20 +62,20 @@
|
||||
<span class="delimiter">:</span>
|
||||
<span class="pa">00</span>
|
||||
</td>
|
||||
<td class="position-capability pitcher">{{positionCapabilityFor this "P"}}</td>
|
||||
<td class="position-capability pitcher first-of-group">{{positionCapabilityFor this "P"}}</td>
|
||||
<td class="position-capability catcher">{{positionCapabilityFor this "C"}}</td>
|
||||
<td class="position-capability infield">{{positionCapabilityFor this "IF"}}</td>
|
||||
<td class="position-capability outfield">{{positionCapabilityFor this "OF"}}</td>
|
||||
<td class="position-capability outfield last-of-group">{{positionCapabilityFor this "OF"}}</td>
|
||||
{{#loopEvents ../upcoming_events}}
|
||||
{{#timepointForMember ../this ../../timeline this}}
|
||||
<td class="availability-on-day future available-status-code-{{this.availability.statusCode}} {{this.value}}">
|
||||
<td class="availability-on-day future available-status-code-{{this.availability.statusCode}} {{this.value}} {{#ifEquals @index 0}}first-of-group{{/ifEquals}}{{#ifEquals @index 3}}last-of-group{{/ifEquals}}">
|
||||
{{this.value}}
|
||||
</td>
|
||||
{{/timepointForMember}}
|
||||
{{/loopEvents}}
|
||||
{{#loopEvents ../recent_events}}
|
||||
{{#timepointForMember ../this ../../timeline this}}
|
||||
<td class="availability-on-day past available-status-code-{{this.availability.statusCode}} {{this.value}}">
|
||||
<td class="availability-on-day past available-status-code-{{this.availability.statusCode}} {{this.value}} {{#ifEquals @index 0}}first-of-group{{/ifEquals}}{{#ifEquals @index 3}}last-of-group{{/ifEquals}}">
|
||||
{{this.value}}
|
||||
</td>
|
||||
{{/timepointForMember}}
|
||||
|
||||
@@ -1,12 +1,11 @@
|
||||
<link rel="stylesheet" href="/css/eventsheet.css">
|
||||
|
||||
<body class="B5">
|
||||
<div class="sheet eventsheet" id="page-1">
|
||||
{{>page_section_divider}}
|
||||
<section class="NW" id="defense-card">
|
||||
<body class="{{#if sheet_size}}{{sheet_size}}{{else}}B5{{/if}}">
|
||||
<div class="sheet eventsheet {{#if sheet_layout}}{{sheet_layout}}{{else}}quarters{{/if}}" id="page-1">
|
||||
<section class="NE" id="defense-card">
|
||||
<header>
|
||||
<div class="event-title float-left">
|
||||
{{event.formattedTitle}} – {{dateFormat event.startDate "ddd, MMM D h:mm A" }}
|
||||
{{event.formattedTitle}}
|
||||
</div>
|
||||
<div class="homeaway float-right">
|
||||
{{event.gameType}}
|
||||
@@ -32,18 +31,18 @@
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
<section class="NE" id="roster-and-history">
|
||||
<div class="roster-and-history">
|
||||
{{> roster_and_history
|
||||
event=event
|
||||
event_lineup_entries=event_lineup_entries
|
||||
members=members availabilities=availabilities
|
||||
recent_events=recent_events
|
||||
<section class="SW" id="roster-and-history">
|
||||
<div class="container">
|
||||
{{> roster_and_history
|
||||
event=event
|
||||
event_lineup_entries=event_lineup_entries
|
||||
members=members availabilities=availabilities
|
||||
recent_events=recent_events
|
||||
upcoming_events=upcoming_events
|
||||
}}
|
||||
</div>
|
||||
</section>
|
||||
<section class="SW lineup-card dugout" id="lineup-card-dugout">
|
||||
<section class="NW lineup-card dugout" id="lineup-card-dugout">
|
||||
<header>
|
||||
<div class="float-left event-title">{{event.formattedTitle}}</div>
|
||||
<div class="float-right homeaway">{{event.gameType}}</div>
|
||||
@@ -83,7 +82,7 @@
|
||||
</section>
|
||||
<section class="SE lineup-card exchange" id="lineup-card-exchange">
|
||||
<header>
|
||||
<div class="float-left event-title">{{event.formattedTitle}}</div>
|
||||
<div class="float-left event-title">{{event.formattedTitleForMultiTeam}}</div>
|
||||
<div class="float-right homeaway">{{event.gameType}}</div>
|
||||
</header>
|
||||
<div class="starting-lineup-table">
|
||||
@@ -120,9 +119,8 @@
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
<div class="sheet eventsheet" id="page-2">
|
||||
{{>page_section_divider}}
|
||||
<section class="NW" id="front-cover">
|
||||
<div class="sheet eventsheet {{#if sheet_layout}}{{sheet_layout}}{{else}}quarters{{/if}}" id="page-2">
|
||||
<section class="SE" id="front-cover">
|
||||
<header>
|
||||
<div class="game-number">
|
||||
{{event.label}}
|
||||
@@ -145,10 +143,8 @@
|
||||
</div>
|
||||
</div>
|
||||
{{# if event.opponentName}}
|
||||
<div>
|
||||
<div style="text-align: center;font-family: 'Pacifico';">
|
||||
<div class="conjuction">
|
||||
<span>vs</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="opponent">
|
||||
<div>
|
||||
@@ -180,7 +176,7 @@
|
||||
{{/if}}
|
||||
</div>
|
||||
</section>
|
||||
<section class="NE blank" id="defense-card">
|
||||
<section class="NW blank" id="defense-card">
|
||||
<header>
|
||||
<div class="event-title float-left">
|
||||
|
||||
@@ -210,6 +206,7 @@
|
||||
</div>
|
||||
</section>
|
||||
<section class="SW lineup-card exchange blank" id="lineup-card-exchange-blank">
|
||||
<header></header>
|
||||
<div class="starting-lineup-table">
|
||||
<table>
|
||||
<thead>
|
||||
@@ -241,7 +238,8 @@
|
||||
</table>
|
||||
</div>
|
||||
</section>
|
||||
<section class="SE lineup-card dugout blank" id="lineup-card-dugout-blank">
|
||||
<section class="NE lineup-card dugout blank" id="lineup-card-dugout-blank">
|
||||
<header></header>
|
||||
<div class="starting-lineup-table">
|
||||
<table>
|
||||
<thead>
|
||||
@@ -275,6 +273,5 @@
|
||||
</table>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
</div>
|
||||
</body>
|
||||
|
||||
248
src/views/eventsheet/sheet_blank.hbs
Normal file
248
src/views/eventsheet/sheet_blank.hbs
Normal file
@@ -0,0 +1,248 @@
|
||||
<link rel="stylesheet" href="/css/eventsheet.css">
|
||||
|
||||
<body class="{{page_size}} ">
|
||||
<div class="sheet eventsheet {{layout}}" id="page-1">
|
||||
<section class="NW" id="roster-and-history">
|
||||
<div class="roster-and-history">
|
||||
{{> roster_and_history
|
||||
event=event
|
||||
event_lineup_entries=event_lineup_entries
|
||||
members=members availabilities=availabilities
|
||||
recent_events=recent_events
|
||||
upcoming_events=upcoming_events
|
||||
}}
|
||||
</div>
|
||||
</section>
|
||||
<section class="NE blank" id="defense-card">
|
||||
<header>
|
||||
<div class="event-title float-left">
|
||||
</div>
|
||||
<div class="homeaway float-right">
|
||||
</div>
|
||||
</header>
|
||||
<div>
|
||||
<div id="defense-pane">
|
||||
{{> defense_pane event_lineup_entries=event_lineup_entries members=members}}
|
||||
</div>
|
||||
<div class="footer">
|
||||
<table class="notes">
|
||||
<tbody>
|
||||
<tr>
|
||||
<th>Notes</th>
|
||||
</tr>
|
||||
{{#repeat 3}}
|
||||
<tr>
|
||||
<td></td>
|
||||
</tr>
|
||||
{{/repeat}}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
<section class="SW lineup-card dugout blank" id="lineup-card-dugout">
|
||||
<header>
|
||||
<div class="float-left event-title">{{event.formattedTitle}}</div>
|
||||
<div class="float-right homeaway">{{event.gameType}}</div>
|
||||
</header>
|
||||
<div class="starting-lineup-table">
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th colspan="4">Starting</th>
|
||||
<th class="substitution">Substitution</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{{#offenseLineup 11 event_lineup_entries members}}
|
||||
<tr class="slot">
|
||||
<th class="sequence{{#if this.member.lastName}} counter{{/if}}"></th>
|
||||
<td class="player-name">{{this.member.lastName}}</td>
|
||||
<td class="jersey-number">{{this.member.jerseyNumber}}</td>
|
||||
<td class="position">{{this.label}}</td>
|
||||
<td class="substitution"></td>
|
||||
</tr>
|
||||
{{/offenseLineup }}
|
||||
{{#defenseLineup event_lineup_entries members}}
|
||||
<tr class="slot">
|
||||
{{#if (isInPositionOnly this.member)}}{{#if (comparePositionWithFlags "P" this.eventLineupEntry)}}
|
||||
<th class="sequence">PO</th>
|
||||
<td class="player-name">{{this.member.lastName}}</td>
|
||||
<td class="jersey-number">{{this.member.jerseyNumber}}</td>
|
||||
<td class="position">{{positionLabelWithoutFlags this.eventLineupEntry.label}}</td>
|
||||
<td class="substitution"></td>
|
||||
{{/if}}{{/if}}
|
||||
</tr>
|
||||
{{/defenseLineup}}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</section>
|
||||
<section class="SE lineup-card exchange blank" id="lineup-card-exchange">
|
||||
<header>
|
||||
<div class="float-left event-title">{{event.formattedTitle}}</div>
|
||||
<div class="float-right homeaway">{{event.gameType}}</div>
|
||||
</header>
|
||||
<div class="starting-lineup-table">
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th colspan="4">Starting</th>
|
||||
<th class="substitution">Substitution</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{{#offenseLineup 11 event_lineup_entries members}}
|
||||
<tr class="slot">
|
||||
<th class="sequence {{#if this.member.lastName}}counter{{/if}}"></th>
|
||||
<td class="player-name">{{this.member.lastName}}</td>
|
||||
<td class="jersey-number">{{this.member.jerseyNumber}}</td>
|
||||
<td class="position">{{this.label}}</td>
|
||||
<td class="substitution"></td>
|
||||
</tr>
|
||||
{{/offenseLineup}}
|
||||
{{#defenseLineup event_lineup_entries members}}
|
||||
<tr class="slot">
|
||||
{{#if (isInPositionOnly this.member)}}{{#if (comparePositionWithFlags "P" this.eventLineupEntry)}}
|
||||
<th class="sequence">PO</th>
|
||||
<td class="player-name">{{this.member.lastName}}</td>
|
||||
<td class="jersey-number">{{this.member.jerseyNumber}}</td>
|
||||
<td class="position">{{positionLabelWithoutFlags this.eventLineupEntry.label}}</td>
|
||||
<td class="substitution"></td>
|
||||
{{/if}}{{/if}}
|
||||
</tr>
|
||||
{{/defenseLineup}}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
<div class="sheet eventsheet {{layout}}" id="page-2">
|
||||
<section class="NW blank" id="defense-card">
|
||||
<header>
|
||||
<div class="event-title float-left">
|
||||
|
||||
</div>
|
||||
<div class="homeaway float-right">
|
||||
|
||||
</div>
|
||||
</header>
|
||||
<div>
|
||||
<div id="defense-pane">
|
||||
{{> defense_pane event_lineup_entries=null members=null}}
|
||||
</div>
|
||||
<div class="footer">
|
||||
<table class="notes">
|
||||
<tbody>
|
||||
<tr>
|
||||
<th>Notes</th>
|
||||
</tr>
|
||||
{{#repeat 3}}
|
||||
<tr>
|
||||
<td></td>
|
||||
</tr>
|
||||
{{/repeat}}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
<section class="NE blank" id="defense-card">
|
||||
<header>
|
||||
<div class="event-title float-left">
|
||||
|
||||
</div>
|
||||
<div class="homeaway float-right">
|
||||
|
||||
</div>
|
||||
</header>
|
||||
<div>
|
||||
<div id="defense-pane">
|
||||
{{> defense_pane event_lineup_entries=null members=null}}
|
||||
</div>
|
||||
<div class="footer">
|
||||
<table class="notes">
|
||||
<tbody>
|
||||
<tr>
|
||||
<th>Notes</th>
|
||||
</tr>
|
||||
{{#repeat 3}}
|
||||
<tr>
|
||||
<td></td>
|
||||
</tr>
|
||||
{{/repeat}}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
<section class="SW lineup-card exchange blank" id="lineup-card-exchange-blank">
|
||||
<header></header>
|
||||
<div class="starting-lineup-table">
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th colspan="4">
|
||||
Starting
|
||||
</th>
|
||||
<th class="substitution">
|
||||
Substitution
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{{#repeat 12}}
|
||||
<tr class="slot">
|
||||
<th class="sequence">
|
||||
</th>
|
||||
<td class="player-name">
|
||||
</td>
|
||||
<td class="jersey-number">
|
||||
</td>
|
||||
<td class="position">
|
||||
</td>
|
||||
<td class="substitution">
|
||||
</td>
|
||||
</tr>
|
||||
{{/repeat}}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</section>
|
||||
<section class="SE lineup-card dugout blank" id="lineup-card-dugout-blank">
|
||||
<header></header>
|
||||
<div class="starting-lineup-table">
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th colspan="4">
|
||||
Starting
|
||||
</th>
|
||||
<th class="substitution">
|
||||
Substitution
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{{!-- <% for i in (0...12) do%> --}}
|
||||
{{#repeat 12}}
|
||||
<tr class="slot">
|
||||
<th class="sequence">
|
||||
</th>
|
||||
<td class="player-name">
|
||||
</td>
|
||||
<td class="jersey-number">
|
||||
</td>
|
||||
<td class="position">
|
||||
</td>
|
||||
<td class="substitution">
|
||||
</td>
|
||||
</tr>
|
||||
{{/repeat}}
|
||||
{{!-- <% end %> --}}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</body>
|
||||
Reference in New Issue
Block a user