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 | 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 3x 1x 1x 15x 1x 1x 15x 1x 1x 1x 14x 14x 1x 1x 15x 15x 21x 21x 21x 15x 15x 15x | <template>
<li class="m-listing__list-item">
<div class="list-item">
<muc-counter
v-model="count"
:label="subService.name"
:link="getServiceBaseURL() + subService.id"
:max="maxValue"
:disabled="disabled"
/>
</div>
</li>
</template>
<script setup lang="ts">
import { MucCounter } from "@muenchen/muc-patternlab-vue";
import { computed, ref, watch } from "vue";
import { OfficeImpl } from "@/types/OfficeImpl";
import { SubService } from "@/types/SubService";
import { getServiceBaseURL, MAX_SLOTS } from "@/utils/Constants";
const props = defineProps<{
subService: SubService;
currentSlots: number;
maxSlotsPerAppointment: number;
}>();
const emit = defineEmits<(e: "change", id: string, count: number) => void>();
const count = ref<number>(props.subService.count);
watch(count, (newCount) => {
emit("change", props.subService.id, newCount);
});
const maxValue = computed(() => {
return checkPlusEndabled.value ? props.subService.maxQuantity : count.value;
});
const disabled = computed(() => {
return !checkPlusEndabled.value && count.value === 0;
});
const checkPlusEndabled = computed(
() =>
props.currentSlots + getMinSlotOfProvider(props.subService.providers) <=
props.maxSlotsPerAppointment
);
const getMinSlotOfProvider = (provider: OfficeImpl[]) => {
let minSlot = MAX_SLOTS;
provider.forEach((provider) => {
if (provider.slots) {
minSlot = Math.min(minSlot, provider.slots);
}
});
return minSlot;
};
</script>
<style scoped>
.list-item {
margin-bottom: 1.75rem;
}
</style>
|