CreatorTimeInputs.svelte 718 B

1234567891011121314151617181920212223242526272829
  1. <script lang="ts">
  2. import type { WeekdayAppointment } from "$lib/dbdata";
  3. import CreatorTimeRangeInput from "./CreatorTimeRangeInput.svelte";
  4. export let weekdays: WeekdayAppointment[] = [];
  5. export let selectedWeek: number;
  6. $: {
  7. weekdays = weekdays.map(item =>
  8. item.active ? item : { ...item, times: [] }
  9. );
  10. }
  11. </script>
  12. <fieldset>
  13. <legend>Select one or more</legend>
  14. <nav class="vertical">
  15. {#each weekdays as day, index}
  16. <label class="checkbox">
  17. <input bind:checked={day.active} type="checkbox" />
  18. <span>{day.name}</span>
  19. </label>
  20. {#if day.active}
  21. <CreatorTimeRangeInput bind:timeRanges={day.times} />
  22. {/if}
  23. {/each}
  24. </nav>
  25. </fieldset>