accomadesc 0.0.13 → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/AccoCard.svelte +1 -1
- package/dist/AccoCard.svelte.d.ts +3 -2
- package/dist/AccoDescription.svelte +1 -1
- package/dist/AccoDescription.svelte.d.ts +3 -2
- package/dist/AmenitiesCore.svelte +3 -3
- package/dist/AmenitiesCore.svelte.d.ts +3 -2
- package/dist/BookingRequest.svelte +272 -0
- package/dist/BookingRequest.svelte.d.ts +5 -0
- package/dist/Calendar.svelte +26 -13
- package/dist/Calendar.svelte.d.ts +3 -2
- package/dist/CalendarAvailable.svelte +12 -19
- package/dist/CalendarAvailable.svelte.d.ts +3 -2
- package/dist/CalendarGrid.svelte +22 -0
- package/dist/CalendarGrid.svelte.d.ts +5 -0
- package/dist/CalendarRows.svelte +22 -0
- package/dist/CalendarRows.svelte.d.ts +5 -0
- package/dist/ContactForm.svelte +180 -0
- package/dist/ContactForm.svelte.d.ts +5 -0
- package/dist/LeafletMap.svelte +1 -1
- package/dist/LeafletMap.svelte.d.ts +1 -1
- package/dist/Photo.svelte +1 -1
- package/dist/Photo.svelte.d.ts +3 -2
- package/dist/PhotoGallery.svelte +89 -35
- package/dist/PhotoGallery.svelte.d.ts +3 -2
- package/dist/Pricing.svelte +1 -1
- package/dist/Pricing.svelte.d.ts +3 -2
- package/dist/PricingShort.svelte +1 -1
- package/dist/PricingShort.svelte.d.ts +3 -2
- package/dist/Section.svelte +1 -1
- package/dist/Section.svelte.d.ts +3 -2
- package/dist/Text.svelte +1 -1
- package/dist/Text.svelte.d.ts +3 -2
- package/dist/Weather.svelte +2 -3
- package/dist/Weather.svelte.d.ts +3 -2
- package/dist/basic/Avatar.svelte.d.ts +3 -2
- package/dist/basic/Button.svelte +6 -3
- package/dist/basic/Button.svelte.d.ts +4 -3
- package/dist/basic/Icon.svelte.d.ts +3 -2
- package/dist/basic/Notes.svelte +83 -0
- package/dist/basic/Notes.svelte.d.ts +7 -0
- package/dist/basic/Spinner.svelte.d.ts +3 -2
- package/dist/basic/TextInput.svelte.d.ts +3 -2
- package/dist/helpers/debounce.d.ts +7 -0
- package/dist/helpers/debounce.js +49 -0
- package/dist/helpers/iCSEventExample.ics +14 -0
- package/dist/helpers/normalizeDate.d.ts +2 -0
- package/dist/helpers/normalizeDate.js +53 -0
- package/dist/helpers/readICS.d.ts +7 -0
- package/dist/helpers/readICS.js +94 -0
- package/dist/index.d.ts +2 -2
- package/dist/index.js +1 -1
- package/dist/names/gen.js +3 -3
- package/dist/occuplan/OccuPlanAvailableInfo.svelte +38 -0
- package/dist/occuplan/OccuPlanAvailableInfo.svelte.d.ts +12 -0
- package/dist/occuplan/OccuPlanGrid.svelte +356 -0
- package/dist/occuplan/OccuPlanGrid.svelte.d.ts +13 -0
- package/dist/occuplan/OccuPlanPicker.svelte +559 -0
- package/dist/occuplan/OccuPlanPicker.svelte.d.ts +16 -0
- package/dist/occuplan/OccuPlanRows.svelte +360 -0
- package/dist/occuplan/OccuPlanRows.svelte.d.ts +13 -0
- package/dist/occuplan/OccuPlanWrapper.svelte +113 -0
- package/dist/occuplan/OccuPlanWrapper.svelte.d.ts +5 -0
- package/dist/occuplan/state.svelte.d.ts +90 -0
- package/dist/occuplan/state.svelte.js +383 -0
- package/dist/svg/ExtLinkSVG.svelte.d.ts +3 -2
- package/dist/svg/LinkSVG.svelte.d.ts +3 -2
- package/dist/types.d.ts +75 -4
- package/dist/types.js +20 -0
- package/package.json +64 -61
|
@@ -0,0 +1,559 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { DateTime, type MonthNumbers } from 'luxon';
|
|
3
|
+
import * as Sqrl from 'squirrelly';
|
|
4
|
+
import {
|
|
5
|
+
defaultMonthHeaderFormat,
|
|
6
|
+
defaultMonthLabels,
|
|
7
|
+
defaultWeekdayLabels,
|
|
8
|
+
OCCUPATION_STATE,
|
|
9
|
+
OccupationState,
|
|
10
|
+
realFirstMonth,
|
|
11
|
+
type OccuplanTranslations,
|
|
12
|
+
} from './state.svelte.js';
|
|
13
|
+
import { getContext, setContext, untrack } from 'svelte';
|
|
14
|
+
import Button from '../basic/Button.svelte';
|
|
15
|
+
import { browser } from '$app/environment';
|
|
16
|
+
import Spinner from '../basic/Spinner.svelte';
|
|
17
|
+
import { normalizeDate } from '../helpers/normalizeDate.ts';
|
|
18
|
+
import { preventDefault } from 'svelte/legacy';
|
|
19
|
+
|
|
20
|
+
let {
|
|
21
|
+
url,
|
|
22
|
+
arrival = undefined,
|
|
23
|
+
leave = undefined,
|
|
24
|
+
nextPage = '>',
|
|
25
|
+
prevPage = '<',
|
|
26
|
+
weekdayLabels = defaultWeekdayLabels,
|
|
27
|
+
monthLabels = defaultMonthLabels,
|
|
28
|
+
monthHeaderFormat = defaultMonthHeaderFormat,
|
|
29
|
+
numberOfMonth = 2,
|
|
30
|
+
maxDate = DateTime.utc().plus({ years: 2 }),
|
|
31
|
+
arrivalLabel = 'From',
|
|
32
|
+
leaveLabel = 'To',
|
|
33
|
+
numberOfNights = 'Nights',
|
|
34
|
+
datePickerDateFormat = 'yyyy-MM-dd',
|
|
35
|
+
showArrival = true,
|
|
36
|
+
showLeave = true,
|
|
37
|
+
typeLabels = {
|
|
38
|
+
one: 'BOOKING',
|
|
39
|
+
two: 'RESERVATION',
|
|
40
|
+
three: 'PERSONAL',
|
|
41
|
+
},
|
|
42
|
+
aborted = () => {
|
|
43
|
+
return;
|
|
44
|
+
},
|
|
45
|
+
dateSelected = () => {
|
|
46
|
+
return;
|
|
47
|
+
},
|
|
48
|
+
}: OccuplanTranslations & {
|
|
49
|
+
url: string;
|
|
50
|
+
arrival?: DateTime;
|
|
51
|
+
leave?: DateTime;
|
|
52
|
+
showArrival?: boolean;
|
|
53
|
+
showLeave?: boolean;
|
|
54
|
+
numberOfMonth?: number;
|
|
55
|
+
maxDate?: DateTime;
|
|
56
|
+
aborted?: () => void;
|
|
57
|
+
dateSelected?: (arrival: DateTime, leave: DateTime) => void;
|
|
58
|
+
} = $props();
|
|
59
|
+
|
|
60
|
+
const oStateID = `i-${url}-${OCCUPATION_STATE}`;
|
|
61
|
+
let occupationState: OccupationState = $state(getContext(oStateID));
|
|
62
|
+
$effect(() => {
|
|
63
|
+
if (!occupationState && browser) {
|
|
64
|
+
occupationState = new OccupationState(url);
|
|
65
|
+
setContext(oStateID, occupationState);
|
|
66
|
+
}
|
|
67
|
+
});
|
|
68
|
+
|
|
69
|
+
let formatFun = $derived(Sqrl.compile(monthHeaderFormat, { useWith: true }));
|
|
70
|
+
const monthHeader = (monthNum: MonthNumbers, year: number): string => {
|
|
71
|
+
const monthLabel = monthLabels[monthNum];
|
|
72
|
+
return formatFun({ month: monthLabel, year }, Sqrl.defaultConfig);
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
let maxWidth = $derived(`${numberOfMonth * 18}rem`);
|
|
76
|
+
let minDate = $derived(occupationState ? occupationState.firstFree(maxDate) : normalizeDate());
|
|
77
|
+
|
|
78
|
+
let page: number = $state(0);
|
|
79
|
+
let rfMonth: DateTime = $derived(
|
|
80
|
+
realFirstMonth(
|
|
81
|
+
(arrival?.month ? arrival.month : minDate.month) as MonthNumbers,
|
|
82
|
+
numberOfMonth,
|
|
83
|
+
page,
|
|
84
|
+
),
|
|
85
|
+
);
|
|
86
|
+
let currentMaxDate = $derived(rfMonth.plus({ month: numberOfMonth }));
|
|
87
|
+
|
|
88
|
+
let months: DateTime[] = $derived.by(() => {
|
|
89
|
+
const result = [];
|
|
90
|
+
|
|
91
|
+
let fMonth: DateTime = DateTime.utc(rfMonth.year, rfMonth.month, 1);
|
|
92
|
+
result.push(fMonth);
|
|
93
|
+
|
|
94
|
+
let nMonth = fMonth.plus({ months: 1 });
|
|
95
|
+
for (let c = 1; c < numberOfMonth; c++) {
|
|
96
|
+
result.push(nMonth);
|
|
97
|
+
nMonth = nMonth.plus({ months: 1 });
|
|
98
|
+
}
|
|
99
|
+
return result;
|
|
100
|
+
});
|
|
101
|
+
|
|
102
|
+
const nextClicked = () => {
|
|
103
|
+
page += 1;
|
|
104
|
+
};
|
|
105
|
+
|
|
106
|
+
const prevClicked = () => {
|
|
107
|
+
page -= 1;
|
|
108
|
+
};
|
|
109
|
+
|
|
110
|
+
let requestStart: DateTime | undefined = $state(arrival);
|
|
111
|
+
let requestEnd: DateTime | undefined = $state(leave);
|
|
112
|
+
let earliestStart: DateTime | undefined = $derived(
|
|
113
|
+
occupationState ? occupationState.earliestRequestStart(requestEnd) : undefined,
|
|
114
|
+
);
|
|
115
|
+
let latestEnd: DateTime | undefined = $derived(
|
|
116
|
+
occupationState ? occupationState.latestRequestEnd(maxDate, requestStart) : undefined,
|
|
117
|
+
);
|
|
118
|
+
const requestClicked = (d: DateTime) => {
|
|
119
|
+
if (requestStart) {
|
|
120
|
+
if (requestEnd?.toISO() == d.toISO()) {
|
|
121
|
+
requestEnd = undefined;
|
|
122
|
+
requestedDays = [];
|
|
123
|
+
} else if (requestStart.toISO() == d.toISO()) {
|
|
124
|
+
requestStart = undefined;
|
|
125
|
+
requestEnd = undefined;
|
|
126
|
+
requestedDays = [];
|
|
127
|
+
} else if (d < requestStart) {
|
|
128
|
+
requestStart = d;
|
|
129
|
+
} else {
|
|
130
|
+
requestEnd = d;
|
|
131
|
+
}
|
|
132
|
+
} else {
|
|
133
|
+
requestStart = d;
|
|
134
|
+
requestEnd = undefined;
|
|
135
|
+
}
|
|
136
|
+
};
|
|
137
|
+
|
|
138
|
+
let requestedDays: string[] = $state([]);
|
|
139
|
+
$effect(() => {
|
|
140
|
+
if (requestStart && requestEnd) {
|
|
141
|
+
let d = normalizeDate(requestStart);
|
|
142
|
+
|
|
143
|
+
untrack(() => (requestedDays = [d.toISO() as string]));
|
|
144
|
+
while (d < requestEnd) {
|
|
145
|
+
d = d.plus({ day: 1 });
|
|
146
|
+
untrack(() => requestedDays.push(d.toISO() as string));
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
});
|
|
150
|
+
|
|
151
|
+
const requestHovering = (d: DateTime) => {};
|
|
152
|
+
|
|
153
|
+
let monthGridTemplateColumns = `[rowLegend] 1fr [d1] 1fr [d2] 1fr [d3] 1fr [d4] 1fr [d5] 1fr [d6] 1fr [d7] 1fr`;
|
|
154
|
+
|
|
155
|
+
let monthGridTemplateRows = (m: DateTime): string => {
|
|
156
|
+
let res = `[columnLegend] 1fr [w${m.weekNumber}] 1fr`;
|
|
157
|
+
let n = m.plus({ weeks: 1 });
|
|
158
|
+
for (let w = 1; w <= 5; w++) {
|
|
159
|
+
res += ` [w${n.weekNumber}] 1fr`;
|
|
160
|
+
n = n.plus({ weeks: 1 });
|
|
161
|
+
}
|
|
162
|
+
return res;
|
|
163
|
+
};
|
|
164
|
+
|
|
165
|
+
const weeks = (m: DateTime): DateTime[] => {
|
|
166
|
+
let n = m.plus({ weeks: 1 });
|
|
167
|
+
let res: DateTime[] = [m, n];
|
|
168
|
+
for (let i = 1; i <= 4; i++) {
|
|
169
|
+
n = n.plus({ weeks: 1 });
|
|
170
|
+
res.push(n);
|
|
171
|
+
}
|
|
172
|
+
return res;
|
|
173
|
+
};
|
|
174
|
+
|
|
175
|
+
const days = (m: DateTime): DateTime[] => {
|
|
176
|
+
//find first
|
|
177
|
+
let firstDay = normalizeDate(m.startOf('week'));
|
|
178
|
+
|
|
179
|
+
//find last
|
|
180
|
+
let lastDayOfMonth = normalizeDate(m.endOf('month'));
|
|
181
|
+
let lastDay = normalizeDate(lastDayOfMonth.endOf('week'));
|
|
182
|
+
|
|
183
|
+
let n = firstDay.plus({ days: 1 });
|
|
184
|
+
let res: DateTime[] = [firstDay];
|
|
185
|
+
|
|
186
|
+
while (n < lastDay) {
|
|
187
|
+
res.push(n);
|
|
188
|
+
n = n.plus({ days: 1 });
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
return res;
|
|
192
|
+
};
|
|
193
|
+
|
|
194
|
+
const hiddenWeekNum = (m: DateTime, w: DateTime): boolean => {
|
|
195
|
+
let lastDayOfMonth = m.endOf('month');
|
|
196
|
+
let firstDayOfWeek = w.startOf('week');
|
|
197
|
+
return lastDayOfMonth < firstDayOfWeek;
|
|
198
|
+
};
|
|
199
|
+
</script>
|
|
200
|
+
|
|
201
|
+
{#if !occupationState || occupationState.loading}
|
|
202
|
+
<Spinner />
|
|
203
|
+
{/if}
|
|
204
|
+
|
|
205
|
+
<div class="wrapper">
|
|
206
|
+
<section class="occuplan-wrapper" style="max-width: {maxWidth}; width: 100%;">
|
|
207
|
+
<header class="occupation-plan-header">
|
|
208
|
+
<div class="header-controls">
|
|
209
|
+
{#if rfMonth >= minDate}
|
|
210
|
+
<Button text={prevPage} clicked={prevClicked} preventDefault={true} />
|
|
211
|
+
{/if}
|
|
212
|
+
</div>
|
|
213
|
+
<div class="header-text">
|
|
214
|
+
{#if requestStart}
|
|
215
|
+
<span class="header-label">{arrivalLabel}:</span>
|
|
216
|
+
<span>{requestStart.toFormat(datePickerDateFormat)}</span>
|
|
217
|
+
{/if}
|
|
218
|
+
{#if requestEnd}
|
|
219
|
+
<span class="header-label">{leaveLabel}:</span>
|
|
220
|
+
<span>{requestEnd.toFormat(datePickerDateFormat)}</span>
|
|
221
|
+
{/if}
|
|
222
|
+
{#if requestStart && requestEnd}
|
|
223
|
+
<span class="header-label">({numberOfNights}: {requestedDays.length - 1})</span>
|
|
224
|
+
{/if}
|
|
225
|
+
</div>
|
|
226
|
+
<div class="header-controls">
|
|
227
|
+
{#if currentMaxDate <= maxDate}
|
|
228
|
+
<Button text={nextPage} clicked={nextClicked} preventDefault={true} />
|
|
229
|
+
{/if}
|
|
230
|
+
</div>
|
|
231
|
+
</header>
|
|
232
|
+
<main>
|
|
233
|
+
{#each months as m (`${m.year}-${m.month}`)}
|
|
234
|
+
<div class="month">
|
|
235
|
+
<header class="month-header">{monthHeader(m.month as MonthNumbers, m.year)}</header>
|
|
236
|
+
<div
|
|
237
|
+
style="
|
|
238
|
+
grid-template-columns: {monthGridTemplateColumns};
|
|
239
|
+
grid-template-rows: {monthGridTemplateRows(m)};
|
|
240
|
+
"
|
|
241
|
+
class="days"
|
|
242
|
+
>
|
|
243
|
+
<div class="weekday-header" style="grid-area: columnLegend / d1 / columnLegend / d1;">
|
|
244
|
+
{weekdayLabels[1]}
|
|
245
|
+
</div>
|
|
246
|
+
<div class="weekday-header" style="grid-area: columnLegend / d2 / columnLegend / d2;">
|
|
247
|
+
{weekdayLabels[2]}
|
|
248
|
+
</div>
|
|
249
|
+
<div class="weekday-header" style="grid-area: columnLegend / d3 / columnLegend / d3;">
|
|
250
|
+
{weekdayLabels[3]}
|
|
251
|
+
</div>
|
|
252
|
+
<div class="weekday-header" style="grid-area: columnLegend / d4 / columnLegend / d4;">
|
|
253
|
+
{weekdayLabels[4]}
|
|
254
|
+
</div>
|
|
255
|
+
<div class="weekday-header" style="grid-area: columnLegend / d5 / columnLegend / d5;">
|
|
256
|
+
{weekdayLabels[5]}
|
|
257
|
+
</div>
|
|
258
|
+
<div class="weekday-header" style="grid-area: columnLegend / d6 / columnLegend / d6;">
|
|
259
|
+
{weekdayLabels[6]}
|
|
260
|
+
</div>
|
|
261
|
+
<div class="weekday-header" style="grid-area: columnLegend / d7 / columnLegend / d7;">
|
|
262
|
+
{weekdayLabels[7]}
|
|
263
|
+
</div>
|
|
264
|
+
|
|
265
|
+
{#each days(m) as d (`${d.year}-${d.month}-${d.day}`)}
|
|
266
|
+
<div
|
|
267
|
+
class:weekend={[6, 7].includes(d.weekday)}
|
|
268
|
+
class:other-month={m.month !== d.month}
|
|
269
|
+
class="day"
|
|
270
|
+
style="
|
|
271
|
+
grid-area: w{d.weekNumber} / d{d.weekday} / w{d.weekNumber} / d{d.weekday};
|
|
272
|
+
{occupationState?.occupationStyle(
|
|
273
|
+
{ day: d.day, month: d.month as MonthNumbers, year: d.year },
|
|
274
|
+
false,
|
|
275
|
+
maxDate,
|
|
276
|
+
)}
|
|
277
|
+
"
|
|
278
|
+
>
|
|
279
|
+
{#if !occupationState?.dayOccupied(d)}
|
|
280
|
+
{#if showArrival && occupationState?.endingOccupation(d) && !occupationState.startingOccupation(d)}
|
|
281
|
+
{#if (earliestStart && earliestStart > d) || (latestEnd && latestEnd < d)}
|
|
282
|
+
{d.day}
|
|
283
|
+
{:else}
|
|
284
|
+
<button
|
|
285
|
+
class:start={requestStart?.toISO() == d.toISO()}
|
|
286
|
+
class="request-button"
|
|
287
|
+
class:request={requestedDays.indexOf(d.toISO() as string) != -1}
|
|
288
|
+
onclick={(e: Event) => {
|
|
289
|
+
e.preventDefault();
|
|
290
|
+
requestClicked(d);
|
|
291
|
+
}}>{d.day}</button
|
|
292
|
+
>
|
|
293
|
+
{/if}
|
|
294
|
+
{:else if (earliestStart && earliestStart > d) || (latestEnd && latestEnd < d)}
|
|
295
|
+
{d.day}
|
|
296
|
+
{:else}
|
|
297
|
+
<button
|
|
298
|
+
class:start={requestStart?.toISO() == d.toISO()}
|
|
299
|
+
class:end={requestEnd?.toISO() == d.toISO()}
|
|
300
|
+
class:request={requestedDays.includes(d.toISO() as string)}
|
|
301
|
+
class="request-button"
|
|
302
|
+
onmouseover={() => requestHovering(d)}
|
|
303
|
+
onfocus={() => requestHovering(d)}
|
|
304
|
+
onclick={(e: Event) => {
|
|
305
|
+
e.preventDefault();
|
|
306
|
+
requestClicked(d);
|
|
307
|
+
}}>{d.day}</button
|
|
308
|
+
>
|
|
309
|
+
{/if}
|
|
310
|
+
{:else if showLeave && occupationState?.startingOccupation(d) && !occupationState.endingOccupation(d) && requestStart}
|
|
311
|
+
{#if (earliestStart && earliestStart > d) || (latestEnd && latestEnd < d)}
|
|
312
|
+
{d.day}
|
|
313
|
+
{:else}
|
|
314
|
+
<button
|
|
315
|
+
class:end={requestEnd?.toISO() == d.toISO()}
|
|
316
|
+
class:request={requestedDays.includes(d.toISO() as string)}
|
|
317
|
+
class="request-button"
|
|
318
|
+
onclick={(e: Event) => {
|
|
319
|
+
e.preventDefault();
|
|
320
|
+
requestClicked(d);
|
|
321
|
+
}}>{d.day}</button
|
|
322
|
+
>
|
|
323
|
+
{/if}
|
|
324
|
+
{:else}
|
|
325
|
+
{d.day}
|
|
326
|
+
{/if}
|
|
327
|
+
</div>
|
|
328
|
+
{/each}
|
|
329
|
+
|
|
330
|
+
{#each weeks(m) as w (`${w.year}-${w.month}-${w.weekNumber}`)}
|
|
331
|
+
<div
|
|
332
|
+
class:hidden={hiddenWeekNum(m, w)}
|
|
333
|
+
class="week-number"
|
|
334
|
+
style="grid-area: w{w.weekNumber} / rowLegend / w{w.weekNumber} / rowLegend;"
|
|
335
|
+
>
|
|
336
|
+
{w.weekNumber}
|
|
337
|
+
</div>
|
|
338
|
+
{/each}
|
|
339
|
+
</div>
|
|
340
|
+
</div>
|
|
341
|
+
{/each}
|
|
342
|
+
</main>
|
|
343
|
+
<footer>
|
|
344
|
+
<div class="legend">
|
|
345
|
+
<span>{typeLabels['one']}</span>
|
|
346
|
+
<div
|
|
347
|
+
class="legend-entry-marker"
|
|
348
|
+
style="background-color: var(--occupation-type-1-bg-color);"
|
|
349
|
+
>
|
|
350
|
+
|
|
351
|
+
</div>
|
|
352
|
+
|
|
353
|
+
<span>{typeLabels['three']}</span>
|
|
354
|
+
<div
|
|
355
|
+
class="legend-entry-marker"
|
|
356
|
+
style="background-color: rgb(from var(--occupation-type-3-bg-color) r g b / 0.2);"
|
|
357
|
+
>
|
|
358
|
+
|
|
359
|
+
</div>
|
|
360
|
+
|
|
361
|
+
<span>{typeLabels['two']}</span>
|
|
362
|
+
<div
|
|
363
|
+
class="legend-entry-marker"
|
|
364
|
+
style="background-color: var(--occupation-type-2-bg-color);"
|
|
365
|
+
>
|
|
366
|
+
|
|
367
|
+
</div>
|
|
368
|
+
</div>
|
|
369
|
+
<div class="footer-controls">
|
|
370
|
+
<Button
|
|
371
|
+
clicked={(e: Event) => {
|
|
372
|
+
e.preventDefault();
|
|
373
|
+
if (requestStart && requestEnd) dateSelected(requestStart, requestEnd);
|
|
374
|
+
}}
|
|
375
|
+
enabled={!!requestStart && !!requestEnd}
|
|
376
|
+
iconName="save"
|
|
377
|
+
size={2.2}
|
|
378
|
+
stopPropagation={true}
|
|
379
|
+
/>
|
|
380
|
+
<Button
|
|
381
|
+
clicked={(e: Event) => {
|
|
382
|
+
e.preventDefault();
|
|
383
|
+
console.log('SOMTING');
|
|
384
|
+
aborted();
|
|
385
|
+
}}
|
|
386
|
+
iconName="abort"
|
|
387
|
+
size={2.2}
|
|
388
|
+
stopPropagation={true}
|
|
389
|
+
/>
|
|
390
|
+
</div>
|
|
391
|
+
</footer>
|
|
392
|
+
</section>
|
|
393
|
+
</div>
|
|
394
|
+
|
|
395
|
+
<style>
|
|
396
|
+
.wrapper {
|
|
397
|
+
position: relative;
|
|
398
|
+
display: flex;
|
|
399
|
+
justify-content: center;
|
|
400
|
+
}
|
|
401
|
+
|
|
402
|
+
.legend-entry-marker {
|
|
403
|
+
outline: var(--occuplan-grid-border);
|
|
404
|
+
height: 1.1rem;
|
|
405
|
+
width: 1.1rem;
|
|
406
|
+
}
|
|
407
|
+
|
|
408
|
+
.footer-controls {
|
|
409
|
+
display: flex;
|
|
410
|
+
gap: 0.5rem;
|
|
411
|
+
align-items: flex-end;
|
|
412
|
+
}
|
|
413
|
+
|
|
414
|
+
.month-header {
|
|
415
|
+
text-align: center;
|
|
416
|
+
}
|
|
417
|
+
|
|
418
|
+
.hidden {
|
|
419
|
+
display: none;
|
|
420
|
+
}
|
|
421
|
+
|
|
422
|
+
.occupation-plan-header {
|
|
423
|
+
display: flex;
|
|
424
|
+
flex-direction: row;
|
|
425
|
+
width: 100%;
|
|
426
|
+
justify-content: space-between;
|
|
427
|
+
}
|
|
428
|
+
|
|
429
|
+
.week-number {
|
|
430
|
+
display: flex;
|
|
431
|
+
justify-content: center;
|
|
432
|
+
align-items: center;
|
|
433
|
+
|
|
434
|
+
font-style: italic;
|
|
435
|
+
font-weight: lighter;
|
|
436
|
+
background-color: var(--occuplan-bg-color-weeknum);
|
|
437
|
+
color: var(--occuplan-font-color-weeknum);
|
|
438
|
+
}
|
|
439
|
+
|
|
440
|
+
.weekday-header {
|
|
441
|
+
font-size: 1rem;
|
|
442
|
+
display: flex;
|
|
443
|
+
justify-content: center;
|
|
444
|
+
align-items: center;
|
|
445
|
+
background-color: var(--occuplan-bg-color-days-header);
|
|
446
|
+
color: var(--occuplan-font-color-days-header);
|
|
447
|
+
grid-area: columnLegend / d1 / columnLegend / d1;
|
|
448
|
+
}
|
|
449
|
+
|
|
450
|
+
.day {
|
|
451
|
+
text-align: center;
|
|
452
|
+
position: relative;
|
|
453
|
+
font-size: 1.15rem;
|
|
454
|
+
padding: 0.2rem;
|
|
455
|
+
}
|
|
456
|
+
|
|
457
|
+
.weekend {
|
|
458
|
+
font-weight: bold;
|
|
459
|
+
}
|
|
460
|
+
|
|
461
|
+
.occuplan-wrapper {
|
|
462
|
+
height: 100%;
|
|
463
|
+
width: calc(100% - 0.5rem);
|
|
464
|
+
padding: 0.5rem;
|
|
465
|
+
margin: 0;
|
|
466
|
+
display: flex;
|
|
467
|
+
flex-direction: column;
|
|
468
|
+
flex-wrap: nowrap;
|
|
469
|
+
align-items: center;
|
|
470
|
+
|
|
471
|
+
border: var(--occuplan-main-border);
|
|
472
|
+
color: var(--occuplan-font-color-main);
|
|
473
|
+
background-color: var(--occuplan-bg-color-main);
|
|
474
|
+
}
|
|
475
|
+
|
|
476
|
+
main {
|
|
477
|
+
display: grid;
|
|
478
|
+
grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr));
|
|
479
|
+
gap: 1rem;
|
|
480
|
+
width: 100%;
|
|
481
|
+
}
|
|
482
|
+
|
|
483
|
+
.month {
|
|
484
|
+
display: flex;
|
|
485
|
+
flex-direction: column;
|
|
486
|
+
}
|
|
487
|
+
|
|
488
|
+
.days {
|
|
489
|
+
display: grid;
|
|
490
|
+
}
|
|
491
|
+
|
|
492
|
+
footer {
|
|
493
|
+
display: flex;
|
|
494
|
+
flex-direction: row;
|
|
495
|
+
align-items: stretch;
|
|
496
|
+
justify-content: space-between;
|
|
497
|
+
width: 100%;
|
|
498
|
+
margin-top: 1rem;
|
|
499
|
+
}
|
|
500
|
+
|
|
501
|
+
.legend {
|
|
502
|
+
display: grid;
|
|
503
|
+
row-gap: 0.2rem;
|
|
504
|
+
grid-template-columns: [label] 1fr [marker] 1rem;
|
|
505
|
+
column-gap: 1rem;
|
|
506
|
+
text-transform: capitalize;
|
|
507
|
+
font-variant: small-caps;
|
|
508
|
+
}
|
|
509
|
+
.header-controls {
|
|
510
|
+
width: 2rem;
|
|
511
|
+
}
|
|
512
|
+
|
|
513
|
+
.header-text {
|
|
514
|
+
display: flex;
|
|
515
|
+
gap: 0.2rem;
|
|
516
|
+
align-items: center;
|
|
517
|
+
font-size: 1.05rem;
|
|
518
|
+
font-weight: bold;
|
|
519
|
+
}
|
|
520
|
+
|
|
521
|
+
.header-label {
|
|
522
|
+
font-size: 0.9rem;
|
|
523
|
+
font-weight: normal;
|
|
524
|
+
}
|
|
525
|
+
|
|
526
|
+
.request-button {
|
|
527
|
+
line-height: 1.35rem;
|
|
528
|
+
font-size: 1.35rem;
|
|
529
|
+
cursor: pointer;
|
|
530
|
+
box-sizing: border-box;
|
|
531
|
+
|
|
532
|
+
position: absolute;
|
|
533
|
+
top: 0;
|
|
534
|
+
left: 0;
|
|
535
|
+
right: 0;
|
|
536
|
+
bottom: 0;
|
|
537
|
+
|
|
538
|
+
background-color: rgb(from var(--occupation-type-3-bg-color) r g b / 0.1);
|
|
539
|
+
color: var(--occupation-type-3-bg-color);
|
|
540
|
+
border: 1px solid rgb(from var(--occupation-type-3-font-color) r g b / 0.1);
|
|
541
|
+
}
|
|
542
|
+
.request-button:hover {
|
|
543
|
+
background-color: var(--occupation-type-3-font-color);
|
|
544
|
+
color: var(--occupation-type-3-bg-color);
|
|
545
|
+
border: 1px solid var(--occupation-type-3-bg-color);
|
|
546
|
+
}
|
|
547
|
+
|
|
548
|
+
.request-button.start {
|
|
549
|
+
border: 0.2rem solid var(--accept-font-color);
|
|
550
|
+
}
|
|
551
|
+
.request-button.end {
|
|
552
|
+
border: 0.2rem solid var(--alert-font-color);
|
|
553
|
+
}
|
|
554
|
+
|
|
555
|
+
.request-button.request {
|
|
556
|
+
background-color: var(--occupation-type-2-bg-color);
|
|
557
|
+
color: var(--occupation-type-font-bg-color);
|
|
558
|
+
}
|
|
559
|
+
</style>
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { DateTime } from 'luxon';
|
|
2
|
+
import { type OccuplanTranslations } from './state.svelte.js';
|
|
3
|
+
type $$ComponentProps = OccuplanTranslations & {
|
|
4
|
+
url: string;
|
|
5
|
+
arrival?: DateTime;
|
|
6
|
+
leave?: DateTime;
|
|
7
|
+
showArrival?: boolean;
|
|
8
|
+
showLeave?: boolean;
|
|
9
|
+
numberOfMonth?: number;
|
|
10
|
+
maxDate?: DateTime;
|
|
11
|
+
aborted?: () => void;
|
|
12
|
+
dateSelected?: (arrival: DateTime, leave: DateTime) => void;
|
|
13
|
+
};
|
|
14
|
+
declare const OccuPlanPicker: import("svelte").Component<$$ComponentProps, {}, "">;
|
|
15
|
+
type OccuPlanPicker = ReturnType<typeof OccuPlanPicker>;
|
|
16
|
+
export default OccuPlanPicker;
|