diff --git a/web/assets/js/components/Common/WayPoint/WayPointVisitedAtField.vue b/web/assets/js/components/Common/WayPoint/WayPointVisitedAtField.vue new file mode 100644 index 0000000..5e8b169 --- /dev/null +++ b/web/assets/js/components/Common/WayPoint/WayPointVisitedAtField.vue @@ -0,0 +1,121 @@ + + + + + diff --git a/web/assets/js/components/Common/WayPoint/index.ts b/web/assets/js/components/Common/WayPoint/index.ts index 3f2f29c..241fb64 100644 --- a/web/assets/js/components/Common/WayPoint/index.ts +++ b/web/assets/js/components/Common/WayPoint/index.ts @@ -1 +1,2 @@ export {default as WayPointLocationNameField} from './WayPointLocationNameField.vue'; +export {default as WayPointVisitedAtField} from './WayPointVisitedAtField.vue'; diff --git a/web/assets/js/components/WayPoint/WayPointForm.vue b/web/assets/js/components/WayPoint/WayPointForm.vue index 7a14d78..8683ddc 100755 --- a/web/assets/js/components/WayPoint/WayPointForm.vue +++ b/web/assets/js/components/WayPoint/WayPointForm.vue @@ -12,76 +12,59 @@ :is-loading="isLoading" :error="error" /> - - - - - - - + + + + + + +
 
+ - - Schnellauswahl: aktueller Zeitpunkt - - - Schnellauswahl: {{ walk.wayPoints.length ? '5 Minuten nach dem letzten Wegpunkt' : 'Rundenbeginn' }} - -
-
- -
+ Schnellauswahl: {{ walk.wayPoints.length ? '5 Minuten nach dem letzten Wegpunkt' : 'Rundenbeginn' }} + + + + + Hinweis: Die gewählte Ankunftszeit ist {{ diffLastWayPointOrRound }} nach dem {{ hasLastWayPoint ? 'letzten Wegpunkt' : 'Rundenstart' }} vom {{ lastWayPointOrRoundTimeAsCalendar }}. + + + {{ visitedAtDescription }} + { let start = 30; @@ -577,9 +559,6 @@ export default { if (null === this.wayPoint.visitedAt || undefined === this.wayPoint.visitedAt) { return; } - if (!this.visitedAtTime || !this.visitedAtDate) { - return; - } if (!this.walk) { return; } @@ -673,9 +652,6 @@ export default { return `Die Ankunftszeit muss nach der Rundenstartzeit (${dayjs(this.walk.startTime).format('HH:mm')} Uhr am ${dayjs(this.walk.startTime).format('DD.MM.YYYY')}) und vor der Rundenendzeit (${dayjs(this.walk.endTime).format('HH:mm')} Uhr am ${dayjs(this.walk.endTime).format('DD.MM.YYYY')}) liegen.`; }, - invalidVisitedAtState() { - return getViolationsFeedback(['visitedAt'], this.error); - }, contactsCountState() { if ('' === this.invalidContactsCountState && null === this.wayPoint.contactsCount) { return null; @@ -817,26 +793,6 @@ export default { return userGroups; }, }, - watch: { - visitedAtTime(visitedAtTime) { - const values = visitedAtTime.split(':'); - if (values.length < 2) { - return; - } - let visitedAt = dayjs(this.wayPoint.visitedAt); - visitedAt = visitedAt.hour(Number(values[0])); - visitedAt = visitedAt.minute(Number(values[1])); - this.wayPoint.visitedAt = visitedAt.format(); - }, - visitedAtDate(visitedAtDate) { - const visitedAtDateValue = dayjs(visitedAtDate); - let visitedAt = dayjs(this.wayPoint.visitedAt); - visitedAt = visitedAt.year(visitedAtDateValue.year()); - visitedAt = visitedAt.month(visitedAtDateValue.month()); - visitedAt = visitedAt.date(visitedAtDateValue.date()); - this.wayPoint.visitedAt = visitedAt.format(); - }, - }, async created() { this.wayPointStore.resetChangeError(); this.wayPointStore.resetCreateError(); @@ -870,14 +826,10 @@ export default { this.wayPoint.peopleCount = this.initialWayPoint.peopleCount; this.wayPoint.oneOnOneInterview = this.initialWayPoint.oneOnOneInterview; this.wayPoint.wayPointTags = JSON.parse(JSON.stringify(this.initialWayPoint.wayPointTags)) || []; - this.visitedAtDate = dayjs(this.initialWayPoint.visitedAt).format('YYYY-MM-DD'); - this.visitedAtTime = dayjs(this.initialWayPoint.visitedAt).format('HH:mm'); } else { this.wayPoint.ageGroups = this.ageGroups; this.wayPoint.userGroups = this.userGroups; this.wayPoint.walk = this.walk['@id']; - this.visitedAtTime = dayjs().format('HH:mm'); - this.visitedAtDate = dayjs().format('YYYY-MM-DD'); } this.wayPoint.contactsCount = this.walk.isWithContactsCount ? 0 : null; @@ -890,16 +842,14 @@ export default { return this.wayPointStore.getWayPointByIri(iri); }, selectCurrentTime() { - this.visitedAtTime = dayjs().format('HH:mm'); - this.visitedAtDate = dayjs().format('YYYY-MM-DD'); + this.wayPoint.visitedAt = dayjs().format(); }, selectFiveMinutesAfterLastWayPointOrStartOfWalkTime() { let time = this.lastWayPointOrRoundTime; if (this.hasLastWayPoint) { time = time.add(5, 'minute'); } - this.visitedAtTime = time.format('HH:mm'); - this.visitedAtDate = time.format('YYYY-MM-DD'); + this.wayPoint.visitedAt = time.format(); }, updateFile: async function (file) { this.wayPoint.imageFileData = file ? await this.readFile(file) : null;