Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 | 216x 6x 6x 6x 397x 2x 397x 140x 140x 1987x 140x 397x 397x 397x 397x 397x 394x 3x | <template>
<div :id="`timeslot-grid-provider-${officeId}`">
<!-- Location title for multiple providers -->
<h5
v-if="showLocationTitle"
:id="`provider-${officeId}`"
class="ml-4 location-title"
>
<svg
aria-hidden="true"
class="icon icon--before"
>
<use xlink:href="#icon-map-pin"></use></svg
>{{ officeNameById(officeId) }}
</h5>
<!-- Time slot display -->
<div class="wrapper">
<p class="left-text nowrap">
{{ timeLabel }}
</p>
<div class="grid">
<div
v-for="time in times"
:key="time"
class="grid-item"
:data-provider-id="String(providerIdFor(time))"
:data-timeslot="String(time)"
>
<muc-button
class="timeslot"
:id="`provider-${providerIdFor(time)}-timeslot-${time}`"
:data-provider-id="String(providerIdFor(time))"
:variant="
isSlotSelected(providerIdFor(time), time)
? 'primary'
: 'secondary'
"
@click="
$emit('selectTimeSlot', {
officeId: providerIdFor(time),
time,
})
"
:aria-label="timeSlotAriaLabel(time)"
>
<template #default>{{ formatTimeFromUnix(time) }}</template>
</muc-button>
</div>
</div>
</div>
</div>
</template>
<script setup lang="ts">
import { MucButton } from "@muenchen/muc-patternlab-vue";
import { formatTimeFromUnix } from "@/utils/formatAppointmentDateTime";
const props = defineProps<{
/** Display / section office (Ort title). */
officeId: number | string;
times: number[];
timeLabel: string;
showLocationTitle: boolean;
officeNameById: (id: number | string) => string | null;
isSlotSelected: (officeId: number | string, time: number) => boolean;
t: (key: string) => string;
/**
* Real booking OfficeID for a timestamp (e.g. shared-booking peer).
* Defaults to section officeId when omitted.
*/
officeIdForTime?: (
time: number,
displayOfficeId: number | string
) => number | string;
}>();
defineEmits<{
(
e: "selectTimeSlot",
payload: { officeId: number | string; time: number }
): void;
}>();
const providerIdFor = (time: number): number | string =>
props.officeIdForTime?.(time, props.officeId) ?? props.officeId;
const timeSlotAriaLabel = (time: number): string => {
const timeText = formatTimeFromUnix(time);
const providerId = providerIdFor(time);
const officeName =
props.officeNameById(providerId) ??
props.officeNameById(props.officeId) ??
"";
const timeStampSuffix = props.t("timeStampSuffix");
if (officeName) {
return `${timeText} ${timeStampSuffix}, ${officeName}`;
}
return `${timeText} ${timeStampSuffix}`;
};
</script>
<style lang="scss" scoped>
@use "@/styles/breakpoints.scss" as *;
.wrapper {
display: grid;
grid-template-columns: 6rem 1fr;
column-gap: 8px;
padding: 16px 0;
border-bottom: 1px solid var(--color-neutrals-blue);
align-items: center;
}
.wrapper > * {
margin: 0 8px;
}
.nowrap {
white-space: nowrap;
}
.grid {
display: flex;
flex-wrap: wrap;
gap: 16px;
}
.grid-item {
margin: 0;
}
.location-title {
display: inline-flex;
align-items: center;
margin-top: 14px;
font-weight: normal;
}
.timeslot {
min-height: 2rem;
height: auto;
}
.timeslot.m-button,
:deep(.timeslot .m-button) {
padding: 4px 12px !important;
}
.left-text {
display: flex;
justify-content: flex-start;
align-items: center;
height: 100%;
width: 100px;
padding-left: 0;
margin-left: 0;
}
/* Target any div containing .left-text (more specific) */
div:has(.left-text) {
padding-left: 0 !important;
margin-left: 0 !important;
}
/* Mobile adjustments */
@include xs-down {
.wrapper {
grid-template-columns: 5.75rem 1fr; /* 5.75rem width of the hour column, 1fr times grid takes all remaining width */
padding: 13px 0 11px; /* 13px top padding, 0 left/right, 11px bottom padding */
}
.grid {
margin-right: 0;
gap: 13px 11px; /* space between buttons */
}
/* Timeslot buttons - smaller padding for mobile */
.timeslot.m-button,
.timeslot .m-button {
padding: 1px 8px !important; /* Even smaller padding for very small screens */
min-height: 2.25rem;
}
}
@include sm-up {
.location-title {
font-size: 1.125rem;
}
}
</style>
|