Compare commits

...

4 Commits

4 changed files with 20 additions and 12 deletions

View File

@ -1,6 +1,6 @@
[metadata] [metadata]
license = MIT license = MIT
version = 1.0.0-alpha.9 version = 1.0.0
name = flaschengeist-events name = flaschengeist-events
description = Events plugin for Flaschengeist description = Events plugin for Flaschengeist
url = https://flaschengeist.dev/Flaschengeist/flaschengeist-schedule url = https://flaschengeist.dev/Flaschengeist/flaschengeist-schedule
@ -24,7 +24,7 @@ python_requires = >=3.8
packages = packages =
flaschengeist_events flaschengeist_events
install_requires = install_requires =
flaschengeist >= 2.0.0.dev0 flaschengeist >= 2.0.0
[options.package_data] [options.package_data]
* = *.toml, script.py.mako, *.ini, migrations/*.py * = *.toml, script.py.mako, *.ini, migrations/*.py

View File

@ -1,6 +1,6 @@
{ {
"license": "MIT", "license": "MIT",
"version": "1.0.0-alpha.9", "version": "1.0.0",
"name": "@flaschengeist/schedule", "name": "@flaschengeist/schedule",
"author": "Ferdinand Thiessen <rpm@fthiessen.de>", "author": "Ferdinand Thiessen <rpm@fthiessen.de>",
"homepage": "https://flaschengeist.dev/Flaschengeist", "homepage": "https://flaschengeist.dev/Flaschengeist",
@ -22,8 +22,8 @@
"@quasar/quasar-ui-qcalendar": "^4.0.0-beta.11" "@quasar/quasar-ui-qcalendar": "^4.0.0-beta.11"
}, },
"devDependencies": { "devDependencies": {
"@flaschengeist/api": "^1.0.0-alpha.8", "@flaschengeist/api": "^1.0.0",
"@flaschengeist/types": "^1.0.0-alpha.10", "@flaschengeist/types": "^1.0.0",
"@quasar/app-webpack": "^3.7.2", "@quasar/app-webpack": "^3.7.2",
"@typescript-eslint/eslint-plugin": "^5.8.0", "@typescript-eslint/eslint-plugin": "^5.8.0",
"@typescript-eslint/parser": "^5.8.0", "@typescript-eslint/parser": "^5.8.0",
@ -38,8 +38,8 @@
"typescript": "^4.5.4" "typescript": "^4.5.4"
}, },
"peerDependencies": { "peerDependencies": {
"@flaschengeist/api": "^1.0.0-alpha.8", "@flaschengeist/api": "^1.0.0",
"@flaschengeist/users": "^1.0.0-alpha.4" "@flaschengeist/users": "^1.0.0"
}, },
"prettier": { "prettier": {
"singleQuote": true, "singleQuote": true,

View File

@ -183,7 +183,7 @@ export default defineComponent({
} }
function fromTemplate(tpl: FG.Event) { function fromTemplate(tpl: FG.Event) {
const today = new Date(); const today = props.modelValue?.start || new Date();
template.value = tpl; template.value = tpl;
event.value = Object.assign({}, tpl, { id: undefined }); event.value = Object.assign({}, tpl, { id: undefined });
@ -199,9 +199,16 @@ export default defineComponent({
if (event.value.end) event.value.end.setTime(event.value.end.getTime() + diff); if (event.value.end) event.value.end.setTime(event.value.end.getTime() + diff);
event.value.jobs = []; event.value.jobs = [];
tpl.jobs.forEach((job) => { tpl.jobs.forEach((job) => {
const copied_job: FG.Job = Object.assign({}, job, { id: NaN }); const copied_job: FG.Job = Object.assign({}, job, {
copied_job.start.setTime(copied_job.start.getTime() + diff); id: NaN,
if (copied_job.end) copied_job.end.setTime(copied_job.end.getTime() + diff); start: new Date(),
end: undefined,
});
copied_job.start.setTime(job.start.getTime() + diff);
if (job.end) {
copied_job.end = new Date();
copied_job.end.setTime(job.end.getTime() + diff);
}
event.value.jobs.push(<Job>copied_job); event.value.jobs.push(<Job>copied_job);
}); });
} }
@ -292,6 +299,7 @@ export default defineComponent({
const diff = newValue.getTime() - oldValue.getTime(); const diff = newValue.getTime() - oldValue.getTime();
event.value?.jobs.forEach((job) => { event.value?.jobs.forEach((job) => {
job.start.setTime(job.start.getTime() + diff); job.start.setTime(job.start.getTime() + diff);
job.end?.setTime(job.end.getTime() + diff);
}); });
computed_end.value?.setTime(computed_end.value?.getTime() + diff); computed_end.value?.setTime(computed_end.value?.getTime() + diff);
setTimeout(() => { setTimeout(() => {

View File

@ -235,7 +235,7 @@ export default defineComponent({
'November', 'November',
'Dezember', 'Dezember',
'-', '-',
][value?.getMonth() || 12]; ][value?.getMonth() === 0 ? 0 : value?.getMonth() || 12];
} }
function asYear(value?: Date) { function asYear(value?: Date) {
return value?.getFullYear() || '-'; return value?.getFullYear() || '-';