Merge pull request 'dev' (#3) from dev into master

Reviewed-on: #3
This commit is contained in:
Christian Seyfferth 2022-07-30 12:42:41 +02:00
commit 30467e27b1
6 changed files with 275 additions and 212 deletions

8
.idea/.gitignore generated vendored Normal file
View File

@ -0,0 +1,8 @@
# Default ignored files
/shelf/
/workspace.xml
# Editor-based HTTP Client requests
/httpRequests/
# Datasource local storage ignored files
/dataSources/
/dataSources.local.xml

5
.idea/codeStyles/codeStyleConfig.xml generated Normal file
View File

@ -0,0 +1,5 @@
<component name="ProjectCodeStyleConfiguration">
<state>
<option name="PREFERRED_PROJECT_CODE_STYLE" value="Default" />
</state>
</component>

8
.idea/modules.xml generated Normal file
View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/.idea/orchester_dienstplan.iml" filepath="$PROJECT_DIR$/.idea/orchester_dienstplan.iml" />
</modules>
</component>
</project>

8
.idea/orchester_dienstplan.iml generated Normal file
View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="WEB_MODULE" version="4">
<component name="NewModuleRootManager">
<content url="file://$MODULE_DIR$" />
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>

68
app.js
View File

@ -301,6 +301,37 @@ var app = new Vue({
if (element.hasOwnProperty('Datum')) { if (element.hasOwnProperty('Datum')) {
day = moment(element.Datum); day = moment(element.Datum);
} }
if (element.hasOwnProperty('Bemerkung')) {
if (element.Bemerkung.toString().search(/\d\d:\d\d\s/) >= 0) {
// prüfe ob eine Uhrzeit drinnen steht
let sonderzeit = moment(element.Bemerkung, 'HH:mm');
let name = element.Bemerkung.toString().replace(/\d\d:\d\d\s/, '').trim();
let splittedName = name.split(' ');
let terminArt = '';
splittedName.forEach(function (item) {
vm.rules.forEach(function (rule) {
rule.Arten.forEach(function (art) {
if (art.tag == item) {
terminArt = art.tag;
name.replace(art.tag, '');
}
})
})
});
let termin = {
datum : day.clone().hour(sonderzeit.hour()).minute(sonderzeit.minute()),
art : terminArt,
beschreibung: '',
name : name.trim()
}
vm.addShift(new Shift(termin));
beschreibung = '';
}
}
if (element.hasOwnProperty('Dienst')) { if (element.hasOwnProperty('Dienst')) {
let times = []; let times = [];
@ -312,6 +343,13 @@ var app = new Vue({
let mom = moment(time, 'HH:mm'); let mom = moment(time, 'HH:mm');
times.push([mom.hour(), mom.minute()]); times.push([mom.hour(), mom.minute()]);
}) })
} else if (element.Zeit.toString().indexOf(' - ') > 0) {
// in der Zeitspalte stehen mehrere Uhrzeiten als Zeitspanne
let tempTimes = element.Zeit.toString().split(' - ');
let mom = moment(tempTimes[0], 'HH:mm');
let momEnd = moment(tempTimes[1], 'HH:mm');
times.push([mom.hour(), mom.minute(), momEnd.hour(), momEnd.minute()]);
} else { } else {
if (element.Zeit) { if (element.Zeit) {
let mom = moment(element.Zeit); let mom = moment(element.Zeit);
@ -320,29 +358,18 @@ var app = new Vue({
times.push([0, 0]); times.push([0, 0]);
} }
} }
if (element.hasOwnProperty('Bemerkung')) {
if (element.Bemerkung.toString().search(/\d\d:\d\d\s/) >= 0) {
// prüfe ob eine Uhrzeit drinnen steht
let sonderzeit = moment(element.Bemerkung, 'HH:mm');
let termin = {
datum: day.clone().hour(sonderzeit.hour()).minute(sonderzeit.minute()),
art: '',
beschreibung: '',
name: element.Bemerkung.toString().replace(/\d\d:\d\d\s/, '').trim()
}
vm.addShift(new Shift(termin));
beschreibung = '';
} else {
beschreibung = element.Bemerkung;
}
}
if (element.hasOwnProperty('Dienst')) {
art = element.Dienst.trim(); art = element.Dienst.trim();
}
if (element.hasOwnProperty('__EMPTY')) { if (element.hasOwnProperty('__EMPTY')) {
name = element.__EMPTY.trim(); name = element.__EMPTY.trim();
} }
if (element.hasOwnProperty('Bemerkung')
&& element.Bemerkung.toString().search(/\d\d:\d\d\s/) == -1) {
beschreibung = element.Bemerkung;
}
times.forEach(time => { times.forEach(time => {
var termin = { var termin = {
datum : day.clone().hour(time[0]).minute(time[1]), datum : day.clone().hour(time[0]).minute(time[1]),
@ -350,6 +377,11 @@ var app = new Vue({
beschreibung: beschreibung, beschreibung: beschreibung,
name : name name : name
} }
if (time.length === 4) {
// Wenn die Zeit mehr Werte hat, dann behandle die nächsten 2 als ende
termin.end = day.clone().hour(time[2]).minute(time[3]);
termin.dontSetDurationFromRules = true;
}
vm.addShift(new Shift(termin)); vm.addShift(new Shift(termin));
}); });

View File

@ -156,6 +156,7 @@ function Shift() {
'art' : "", 'art' : "",
'name' : "DUMMY", 'name' : "DUMMY",
'datum' : moment(), 'datum' : moment(),
'end' : moment(),
'beschreibung': "", 'beschreibung': "",
'ort' : "", 'ort' : "",
} }
@ -165,6 +166,7 @@ function Shift() {
this.Datum = options.datum.format(DATE_INPUT_FORMAT); this.Datum = options.datum.format(DATE_INPUT_FORMAT);
this.Beginn = options.datum.format(TIME_FORMAT); this.Beginn = options.datum.format(TIME_FORMAT);
this.Ende = options.end.format(TIME_FORMAT);
this.Art = options.art; this.Art = options.art;
this.Beschreibung = options.beschreibung; this.Beschreibung = options.beschreibung;
this.Name = options.name; this.Name = options.name;