| 
									
										
										
										
											2023-10-30 13:44:27 +01:00
										 |  |  | <script lang="ts"> | 
					
						
							|  |  |  |   /** | 
					
						
							|  |  |  |    * Opens the 'Opening hours input' in another top level window | 
					
						
							|  |  |  |    */ | 
					
						
							|  |  |  |   import { UIEventSource } from "../../../Logic/UIEventSource" | 
					
						
							| 
									
										
										
										
											2024-09-05 13:17:49 +02:00
										 |  |  |   import PublicHolidaySelector from "../../OpeningHours/PublicHolidaySelector.svelte" | 
					
						
							| 
									
										
										
										
											2024-09-05 17:14:47 +02:00
										 |  |  |   import OHTable from "./OpeningHours/OHTable.svelte" | 
					
						
							|  |  |  |   import OpeningHoursState from "../../OpeningHours/OpeningHoursState" | 
					
						
							|  |  |  |   import Popup from "../../Base/Popup.svelte" | 
					
						
							| 
									
										
										
										
											2024-09-19 18:01:17 +02:00
										 |  |  |   import Check from "@babeard/svelte-heroicons/mini/Check" | 
					
						
							| 
									
										
										
										
											2023-10-15 00:31:04 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-10-30 13:44:27 +01:00
										 |  |  |   export let value: UIEventSource<string> | 
					
						
							| 
									
										
										
										
											2024-09-05 17:14:47 +02:00
										 |  |  |   export let args: string | 
					
						
							|  |  |  |   let prefix = "" | 
					
						
							|  |  |  |   let postfix = "" | 
					
						
							|  |  |  |   if (args) { | 
					
						
							|  |  |  |     try { | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |       const data = JSON.stringify(args) | 
					
						
							|  |  |  |       if (data["prefix"]) { | 
					
						
							|  |  |  |         prefix = data["prefix"] | 
					
						
							|  |  |  |       } | 
					
						
							|  |  |  |       if (data["postfix"]) { | 
					
						
							|  |  |  |         postfix = data["postfix"] | 
					
						
							|  |  |  |       } | 
					
						
							|  |  |  |     } catch (e) { | 
					
						
							|  |  |  |       console.error("Could not parse arguments") | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  |   } | 
					
						
							| 
									
										
										
										
											2023-10-15 00:31:04 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-10-08 13:49:59 +02:00
										 |  |  |   const state = new OpeningHoursState(value, prefix, postfix) | 
					
						
							| 
									
										
										
										
											2024-09-05 17:14:47 +02:00
										 |  |  |   let expanded = new UIEventSource(false) | 
					
						
							|  |  |  | </script> | 
					
						
							|  |  |  | <Popup bodyPadding="p-0" shown={expanded}> | 
					
						
							|  |  |  |   <OHTable value={state.normalOhs} /> | 
					
						
							| 
									
										
										
										
											2024-09-19 18:01:17 +02:00
										 |  |  |     <button on:click={() => expanded.set(false)} class="absolute left-0 bottom-0 primary pointer-events-auto h-8 w-10 rounded-full"> | 
					
						
							|  |  |  |       <Check class="shrink-0 w-6 h-6 m-0 p-0" color="white"/> | 
					
						
							|  |  |  |     </button> | 
					
						
							| 
									
										
										
										
											2024-09-05 17:14:47 +02:00
										 |  |  | </Popup> | 
					
						
							|  |  |  | <button on:click={() => expanded.set(true)}>Pick opening hours</button> | 
					
						
							|  |  |  | <PublicHolidaySelector value={state.phSelectorValue} /> |