Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

95 opening status error fix #99

Merged
merged 7 commits into from
Jan 30, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
66 changes: 48 additions & 18 deletions src/views/details/Details.vue
Original file line number Diff line number Diff line change
Expand Up @@ -278,28 +278,31 @@
<div v-else id="opening-hours-container">
<!-- Opening Status -->
<div v-if="institution.openingTimes.week" id="opening-status">
<b-row v-if="getCurrentOpeningState()">
<b-col cols="3">
<div id="opened" class="py-2 mt-4 mb-2">
<b-row>
<b-col cols="12" md="4">
<!-- Institution currently opened -->
<div v-if="getCurrentOpeningState()" id="opened" class="py-2 mt-4 mb-2">
{{ $t('details.currentlyOpened') }}
</div>
</b-col>
<b-col cols="4" id="nextOpened" class="pt-2 mt-4 mb-2">
<p>{{ $t('details.closes') }} {{ $t('details.at') }} {{ getNextClosingTime() | time($i18n.locale) }}</p>
</b-col>
</b-row>
<b-row v-else>
<b-col cols="3">
<div id="closed" class="py-2 mt-4 mb-2">
<!-- Institution currently closed -->
<div v-if="!getCurrentOpeningState() && getNextOpeningDay() !== false" id="closed" class="py-2 mt-4 mb-2">
{{ $t('details.currentlyClosed') }}
</div>
<!-- Institution always closed -->
<div v-if="getNextOpeningDay() === false && !getCurrentOpeningState()" id="closed" class="py-2 mt-4 mb-2">
{{ $t('details.closed') }}
</div>
</b-col>
<b-col cols="4" id="nextOpened" class="pt-2 mt-4 mb-2">
<p>
{{ $t('details.opens') }}
<span v-if="getNextOpeningDay() !== getDayName(new Date().getDay())">
{{ $t(`details.${getNextOpeningDay()}`) }}
</span>
<b-col cols="12" md="4" id="nextOpened"
class="pt-2 mb-2 desktop-mt mobile-mt"
>
<!-- Institution currently opened -->
<p v-if="getCurrentOpeningState()">
{{ $t('details.closes') }} {{ $t('details.at') }} {{ getNextClosingTime() | time($i18n.locale) }}
</p>
<!-- Institution currently closed -->
<p v-if="!getCurrentOpeningState() && getNextOpeningDay() !== false">
{{ $t('details.opens') }} {{ $t(`details.${getNextOpeningDay()}`) }}
{{ $t('details.at') }} {{ getNextOpeningTime() | time($i18n.locale) }}
</p>
</b-col>
Expand Down Expand Up @@ -695,6 +698,19 @@ export default {
// returns true if day has openingTimes
getOpenDayState(day) {
const openingTimes = this.getDayTimes(day)

if (
openingTimes &&
openingTimes.first &&
openingTimes.first.timeStart === '' &&
openingTimes.first.timeEnd === '' &&
openingTimes.second &&
openingTimes.second.timeStart === '' &&
openingTimes.second.timeEnd === ''
) {
return false
}

return !(openingTimes === undefined || openingTimes === null)
},

Expand Down Expand Up @@ -754,7 +770,7 @@ export default {
if (this.getOpenDayState(i) === true && this.getCurrentOpeningState() === false) {
return this.getDayName(i)
}
} return this.getDayName(openingDayNum)
} return false
},

getDayName(dayIndex) {
Expand Down Expand Up @@ -974,4 +990,18 @@ input[type=submit] {
width: 100%;
}
}

@media (min-width: 500px) { /* Für Desktop */
.desktop-mt {
margin-top: 25px;
}
}

@media (max-width: 767px) { /* Für Mobilgeräte */
.mobile-mt {
margin-top: 5px;
margin-left: 5px;
}
}

</style>
Loading