fix: make planning board week start configurable
This commit is contained in:
@@ -184,12 +184,16 @@ const resolvedPlanningBoardConfig = computed(() => {
|
|||||||
const normalizedStartTime = /^\d{2}:\d{2}$/.test(String(config.startTime || "")) ? String(config.startTime) : "06:00"
|
const normalizedStartTime = /^\d{2}:\d{2}$/.test(String(config.startTime || "")) ? String(config.startTime) : "06:00"
|
||||||
const normalizedEndTime = /^\d{2}:\d{2}$/.test(String(config.endTime || "")) ? String(config.endTime) : "21:00"
|
const normalizedEndTime = /^\d{2}:\d{2}$/.test(String(config.endTime || "")) ? String(config.endTime) : "21:00"
|
||||||
const normalizedSlotMinutes = Number(config.slotMinutes)
|
const normalizedSlotMinutes = Number(config.slotMinutes)
|
||||||
|
const normalizedWeekStartsOn = Number(config.weekStartsOn)
|
||||||
const allowedSlotMinutes = [15, 30, 60, 120, 180]
|
const allowedSlotMinutes = [15, 30, 60, 120, 180]
|
||||||
|
|
||||||
return {
|
return {
|
||||||
startTime: normalizedStartTime,
|
startTime: normalizedStartTime,
|
||||||
endTime: normalizedEndTime,
|
endTime: normalizedEndTime,
|
||||||
slotMinutes: allowedSlotMinutes.includes(normalizedSlotMinutes) ? normalizedSlotMinutes : 180
|
slotMinutes: allowedSlotMinutes.includes(normalizedSlotMinutes) ? normalizedSlotMinutes : 180,
|
||||||
|
weekStartsOn: Number.isInteger(normalizedWeekStartsOn) && normalizedWeekStartsOn >= 1 && normalizedWeekStartsOn <= 5
|
||||||
|
? normalizedWeekStartsOn
|
||||||
|
: 1
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
@@ -295,6 +299,7 @@ const visibleDraftEventIds = computed(() =>
|
|||||||
const calendarOptions = computed(() => ({
|
const calendarOptions = computed(() => ({
|
||||||
schedulerLicenseKey: "CC-Attribution-NonCommercial-NoDerivatives",
|
schedulerLicenseKey: "CC-Attribution-NonCommercial-NoDerivatives",
|
||||||
locale: deLocale,
|
locale: deLocale,
|
||||||
|
firstDay: resolvedPlanningBoardConfig.value.weekStartsOn,
|
||||||
plugins: [resourceTimelinePlugin, interactionPlugin],
|
plugins: [resourceTimelinePlugin, interactionPlugin],
|
||||||
initialView: calendarView.value,
|
initialView: calendarView.value,
|
||||||
initialDate: calendarCurrentDate.value,
|
initialDate: calendarCurrentDate.value,
|
||||||
@@ -349,6 +354,7 @@ const calendarOptions = computed(() => ({
|
|||||||
resourceTimelineWeek: {
|
resourceTimelineWeek: {
|
||||||
type: "resourceTimeline",
|
type: "resourceTimeline",
|
||||||
duration: { days: 7 },
|
duration: { days: 7 },
|
||||||
|
dateAlignment: "week",
|
||||||
buttonText: "Woche",
|
buttonText: "Woche",
|
||||||
slotDuration: { minutes: resolvedPlanningBoardConfig.value.slotMinutes },
|
slotDuration: { minutes: resolvedPlanningBoardConfig.value.slotMinutes },
|
||||||
snapDuration: { minutes: resolvedPlanningBoardConfig.value.slotMinutes },
|
snapDuration: { minutes: resolvedPlanningBoardConfig.value.slotMinutes },
|
||||||
|
|||||||
@@ -130,10 +130,19 @@ const planningBoardTimeGridOptions = [
|
|||||||
{ label: "180 Minuten", value: 180 }
|
{ label: "180 Minuten", value: 180 }
|
||||||
]
|
]
|
||||||
|
|
||||||
|
const planningBoardWeekStartOptions = [
|
||||||
|
{ label: "Montag", value: 1 },
|
||||||
|
{ label: "Dienstag", value: 2 },
|
||||||
|
{ label: "Mittwoch", value: 3 },
|
||||||
|
{ label: "Donnerstag", value: 4 },
|
||||||
|
{ label: "Freitag", value: 5 }
|
||||||
|
]
|
||||||
|
|
||||||
const planningBoardConfig = reactive({
|
const planningBoardConfig = reactive({
|
||||||
startTime: auth.activeTenantData?.calendarConfig?.planningBoard?.startTime || "06:00",
|
startTime: auth.activeTenantData?.calendarConfig?.planningBoard?.startTime || "06:00",
|
||||||
endTime: auth.activeTenantData?.calendarConfig?.planningBoard?.endTime || "21:00",
|
endTime: auth.activeTenantData?.calendarConfig?.planningBoard?.endTime || "21:00",
|
||||||
slotMinutes: auth.activeTenantData?.calendarConfig?.planningBoard?.slotMinutes || 180
|
slotMinutes: auth.activeTenantData?.calendarConfig?.planningBoard?.slotMinutes || 180,
|
||||||
|
weekStartsOn: auth.activeTenantData?.calendarConfig?.planningBoard?.weekStartsOn ?? 1
|
||||||
})
|
})
|
||||||
|
|
||||||
const canManageMcpTokens = computed(() => Boolean(auth.user?.is_admin || auth.hasPermission("mcp.tokens.write")))
|
const canManageMcpTokens = computed(() => Boolean(auth.user?.is_admin || auth.hasPermission("mcp.tokens.write")))
|
||||||
@@ -238,6 +247,7 @@ const setupPage = async () => {
|
|||||||
planningBoardConfig.startTime = auth.activeTenantData?.calendarConfig?.planningBoard?.startTime || "06:00"
|
planningBoardConfig.startTime = auth.activeTenantData?.calendarConfig?.planningBoard?.startTime || "06:00"
|
||||||
planningBoardConfig.endTime = auth.activeTenantData?.calendarConfig?.planningBoard?.endTime || "21:00"
|
planningBoardConfig.endTime = auth.activeTenantData?.calendarConfig?.planningBoard?.endTime || "21:00"
|
||||||
planningBoardConfig.slotMinutes = auth.activeTenantData?.calendarConfig?.planningBoard?.slotMinutes || 180
|
planningBoardConfig.slotMinutes = auth.activeTenantData?.calendarConfig?.planningBoard?.slotMinutes || 180
|
||||||
|
planningBoardConfig.weekStartsOn = auth.activeTenantData?.calendarConfig?.planningBoard?.weekStartsOn ?? 1
|
||||||
}
|
}
|
||||||
|
|
||||||
const features = ref({ ...defaultFeatures, ...(auth.activeTenantData?.features || {}) })
|
const features = ref({ ...defaultFeatures, ...(auth.activeTenantData?.features || {}) })
|
||||||
@@ -571,7 +581,8 @@ const savePlanningBoardConfig = async () => {
|
|||||||
planningBoard: {
|
planningBoard: {
|
||||||
startTime: planningBoardConfig.startTime || "06:00",
|
startTime: planningBoardConfig.startTime || "06:00",
|
||||||
endTime: planningBoardConfig.endTime || "21:00",
|
endTime: planningBoardConfig.endTime || "21:00",
|
||||||
slotMinutes: Number(planningBoardConfig.slotMinutes) || 180
|
slotMinutes: Number(planningBoardConfig.slotMinutes) || 180,
|
||||||
|
weekStartsOn: Number(planningBoardConfig.weekStartsOn)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
@@ -741,7 +752,7 @@ onMounted(() => {
|
|||||||
<div class="space-y-4">
|
<div class="space-y-4">
|
||||||
<div>
|
<div>
|
||||||
<h3 class="text-base font-semibold text-highlighted">Plantafel</h3>
|
<h3 class="text-base font-semibold text-highlighted">Plantafel</h3>
|
||||||
<p class="text-sm text-muted">Lege hier die Rahmenzeiten und den Rasterabstand für die Plantafel fest.</p>
|
<p class="text-sm text-muted">Lege hier Rahmenzeiten, Rasterabstand und Wochenbeginn für die Plantafel fest.</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<UFormField
|
<UFormField
|
||||||
@@ -767,6 +778,17 @@ onMounted(() => {
|
|||||||
/>
|
/>
|
||||||
</UFormField>
|
</UFormField>
|
||||||
|
|
||||||
|
<UFormField
|
||||||
|
label="Wochenbeginn:"
|
||||||
|
>
|
||||||
|
<USelectMenu
|
||||||
|
v-model="planningBoardConfig.weekStartsOn"
|
||||||
|
:items="planningBoardWeekStartOptions"
|
||||||
|
label-key="label"
|
||||||
|
value-key="value"
|
||||||
|
/>
|
||||||
|
</UFormField>
|
||||||
|
|
||||||
<UButton
|
<UButton
|
||||||
class="mt-1"
|
class="mt-1"
|
||||||
@click="savePlanningBoardConfig"
|
@click="savePlanningBoardConfig"
|
||||||
|
|||||||
Reference in New Issue
Block a user