Merge pull request #54 from AlexisNP/features/add-create-event-button
Features/add create event button
This commit is contained in:
@@ -53,8 +53,8 @@ onMounted(() => {
|
|||||||
<component :is="currentViewComponent" />
|
<component :is="currentViewComponent" />
|
||||||
|
|
||||||
<CalendarSearch />
|
<CalendarSearch />
|
||||||
<CalendarFormUpdateEvent />
|
<CalendarDialogUpdateEvent />
|
||||||
<CalendarFormDeleteEvent />
|
<CalendarDialogDeleteEvent />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|||||||
@@ -46,6 +46,7 @@ function deployEditModal() {
|
|||||||
lastActiveEvent.value = { ...props.event }
|
lastActiveEvent.value = { ...props.event }
|
||||||
revealEditEventModal()
|
revealEditEventModal()
|
||||||
commandMenuOpened.value = false
|
commandMenuOpened.value = false
|
||||||
|
emit("query:close-popover")
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -55,6 +56,7 @@ function deployDeleteModal() {
|
|||||||
lastActiveEvent.value = { ...props.event }
|
lastActiveEvent.value = { ...props.event }
|
||||||
revealDeleteEventModal()
|
revealDeleteEventModal()
|
||||||
commandMenuOpened.value = false
|
commandMenuOpened.value = false
|
||||||
|
emit("query:close-popover")
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|||||||
@@ -10,7 +10,10 @@ const { revealAdvancedSearch } = useCalendar()
|
|||||||
<header class="pt-4 border-slate-400 dark:border-slate-700 border-b-[1px]">
|
<header class="pt-4 border-slate-400 dark:border-slate-700 border-b-[1px]">
|
||||||
<div class="px-6 flex justify-between">
|
<div class="px-6 flex justify-between">
|
||||||
<menu class="flex items-center gap-2">
|
<menu class="flex items-center gap-2">
|
||||||
<li class="flex items-center">
|
<li>
|
||||||
|
<CalendarDialogQuickCreateEvent />
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
<CalendarMenuToday />
|
<CalendarMenuToday />
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ const buttonDisabledState: ComputedRef<boolean> = computed<boolean>(() => {
|
|||||||
<UiTooltipProvider :delay-duration="250">
|
<UiTooltipProvider :delay-duration="250">
|
||||||
<UiTooltip>
|
<UiTooltip>
|
||||||
<UiTooltipTrigger as-child>
|
<UiTooltipTrigger as-child>
|
||||||
<UiButton size="sm" :disabled="buttonDisabledState" @click="jumpToDefaultDate">
|
<UiButton size="sm" variant="secondary" :disabled="buttonDisabledState" @click="jumpToDefaultDate">
|
||||||
{{ $t('entity.calendar.date.today') }}
|
{{ $t('entity.calendar.date.today') }}
|
||||||
</UiButton>
|
</UiButton>
|
||||||
</UiTooltipTrigger>
|
</UiTooltipTrigger>
|
||||||
|
|||||||
68
components/calendar/dialog/CreateEvent.vue
Normal file
68
components/calendar/dialog/CreateEvent.vue
Normal file
@@ -0,0 +1,68 @@
|
|||||||
|
<script lang="ts" setup>
|
||||||
|
import type { RPGDate } from "~/models/Date";
|
||||||
|
|
||||||
|
const { eventSkeleton, operationInProgress } = storeToRefs(useCalendar())
|
||||||
|
const { resetSkeleton } = useCalendar()
|
||||||
|
const popoverOpen = ref(false)
|
||||||
|
|
||||||
|
const isLoading = ref(false)
|
||||||
|
|
||||||
|
const props = defineProps<{
|
||||||
|
date?: RPGDate
|
||||||
|
btnClass?: string
|
||||||
|
}>()
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Opens event creation's popover
|
||||||
|
*/
|
||||||
|
function openEventCreatePopover() {
|
||||||
|
// If another operation is in progress, whether it's another create popup or a modal, don't bother opening it
|
||||||
|
if (operationInProgress.value) {
|
||||||
|
popoverOpen.value = false
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
resetSkeleton()
|
||||||
|
|
||||||
|
popoverOpen.value = true
|
||||||
|
|
||||||
|
// Set skeleton initial startDate if it's known
|
||||||
|
if (props.date) {
|
||||||
|
eventSkeleton.value.startDate = { ...props.date } // We need to clone it otherwise the props ends up mutating (?)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Prevents the modal from closing if's still loading
|
||||||
|
*
|
||||||
|
* @param e The closing event (can be keydown or click)
|
||||||
|
*/
|
||||||
|
function handleClosing(e: Event) {
|
||||||
|
if (isLoading.value) {
|
||||||
|
popoverOpen.value = false
|
||||||
|
e.preventDefault()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<UiPopover v-model:open="popoverOpen">
|
||||||
|
<UiPopoverTrigger as-child>
|
||||||
|
<button :class="btnClass" @click="openEventCreatePopover()" />
|
||||||
|
</UiPopoverTrigger>
|
||||||
|
<UiPopoverContent
|
||||||
|
:align="'center'"
|
||||||
|
:side="'right'"
|
||||||
|
:collision-padding="60"
|
||||||
|
:disable-outside-pointer-events="true"
|
||||||
|
:trap-focus="true"
|
||||||
|
class="pl-3 w-[30rem] max-w-full border-indigo-200 dark:bg-slate-950 dark:border-indigo-950"
|
||||||
|
@escape-key-down="handleClosing"
|
||||||
|
@focus-outside="handleClosing"
|
||||||
|
@interact-outside="handleClosing"
|
||||||
|
@pointer-down-outside="handleClosing"
|
||||||
|
>
|
||||||
|
<CalendarFormCreateEvent @event-created="handleClosing" />
|
||||||
|
</UiPopoverContent>
|
||||||
|
</UiPopover>
|
||||||
|
</template>
|
||||||
45
components/calendar/dialog/DeleteEvent.vue
Normal file
45
components/calendar/dialog/DeleteEvent.vue
Normal file
@@ -0,0 +1,45 @@
|
|||||||
|
<script lang="ts" setup>
|
||||||
|
const { isDeleteEventModalOpen, eventSkeleton, lastActiveEvent } = storeToRefs(useCalendar())
|
||||||
|
|
||||||
|
const isLoading = ref<boolean>(false)
|
||||||
|
|
||||||
|
// Watch the popover state
|
||||||
|
watch(isDeleteEventModalOpen, (hasOpened, _o) => {
|
||||||
|
if (hasOpened && lastActiveEvent.value) {
|
||||||
|
eventSkeleton.value = { ...lastActiveEvent.value }
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Prevents the modal from closing if's still loading
|
||||||
|
*
|
||||||
|
* @param e The closing event (can be keydown or click)
|
||||||
|
*/
|
||||||
|
function handleClosing(e: Event): void {
|
||||||
|
if (isLoading.value) {
|
||||||
|
e.preventDefault()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<UiAlertDialog v-model:open="isDeleteEventModalOpen">
|
||||||
|
<UiAlertDialogContent
|
||||||
|
:disable-outside-pointer-events="true"
|
||||||
|
:trap-focus="true"
|
||||||
|
class="min-w-96 border-indigo-200 dark:bg-slate-950 dark:border-indigo-950"
|
||||||
|
@escape-key-down="handleClosing"
|
||||||
|
@focus-outside="handleClosing"
|
||||||
|
@interact-outside="handleClosing"
|
||||||
|
@pointer-down-outside="handleClosing"
|
||||||
|
>
|
||||||
|
<UiAlertDialogTitle>{{ $t('entity.calendar.event.deleteDialog.title') }}</UiAlertDialogTitle>
|
||||||
|
|
||||||
|
<UiAlertDialogDescription>
|
||||||
|
{{ $t('entity.calendar.event.deleteDialog.subtitle') }}
|
||||||
|
</UiAlertDialogDescription>
|
||||||
|
|
||||||
|
<CalendarFormDeleteEvent />
|
||||||
|
</UiAlertDialogContent>
|
||||||
|
</UiAlertDialog>
|
||||||
|
</template>
|
||||||
29
components/calendar/dialog/QuickCreateEvent.vue
Normal file
29
components/calendar/dialog/QuickCreateEvent.vue
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
<script setup lang="ts">
|
||||||
|
import { PhPlus } from "@phosphor-icons/vue";
|
||||||
|
|
||||||
|
const isDialogOpen = ref<boolean>(false);
|
||||||
|
|
||||||
|
// Toggles the dialog
|
||||||
|
function toggleDialog() {
|
||||||
|
isDialogOpen.value = !isDialogOpen.value;
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<UiButton @click="toggleDialog">
|
||||||
|
<PhPlus size="18" weight="bold" />
|
||||||
|
|
||||||
|
<strong class="font-semibold">
|
||||||
|
{{ $t("entity.calendar.event.newEvent") }}
|
||||||
|
</strong>
|
||||||
|
</UiButton>
|
||||||
|
|
||||||
|
<UiDialog v-model:open="isDialogOpen">
|
||||||
|
<UiDialogContent class="border-indigo-200 dark:bg-slate-950 dark:border-indigo-950">
|
||||||
|
<UiDialogTitle>
|
||||||
|
{{ $t("entity.calendar.event.addSingle") }}
|
||||||
|
</UiDialogTitle>
|
||||||
|
<CalendarFormCreateEvent />
|
||||||
|
</UiDialogContent>
|
||||||
|
</UiDialog>
|
||||||
|
</template>
|
||||||
49
components/calendar/dialog/UpdateEvent.vue
Normal file
49
components/calendar/dialog/UpdateEvent.vue
Normal file
@@ -0,0 +1,49 @@
|
|||||||
|
<script lang="ts" setup>
|
||||||
|
const { eventSkeleton, lastActiveEvent, isEditEventModalOpen } = storeToRefs(useCalendar())
|
||||||
|
|
||||||
|
const isLoading = ref(false)
|
||||||
|
|
||||||
|
// Watch the popover state
|
||||||
|
watch(isEditEventModalOpen, (hasOpened, _o) => {
|
||||||
|
if (hasOpened && lastActiveEvent.value) {
|
||||||
|
eventSkeleton.value = { ...lastActiveEvent.value }
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Prevents the modal from closing if's still loading
|
||||||
|
*
|
||||||
|
* @param e The closing event (can be keydown or click)
|
||||||
|
*/
|
||||||
|
function handleClosing(e: Event) {
|
||||||
|
if (isLoading.value) {
|
||||||
|
e.preventDefault()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<UiDialog v-model:open="isEditEventModalOpen">
|
||||||
|
<UiDialogContent
|
||||||
|
:disable-outside-pointer-events="true"
|
||||||
|
:trap-focus="true"
|
||||||
|
class="pl-3 min-w-96 border-indigo-200 dark:bg-slate-950 dark:border-indigo-950"
|
||||||
|
@escape-key-down="handleClosing"
|
||||||
|
@focus-outside="handleClosing"
|
||||||
|
@interact-outside="handleClosing"
|
||||||
|
@pointer-down-outside="(e) => e.preventDefault()"
|
||||||
|
>
|
||||||
|
<header class="pl-8 grid gap-y-2">
|
||||||
|
<UiDialogTitle>
|
||||||
|
{{ $t('entity.calendar.event.editDialog.title') }}
|
||||||
|
</UiDialogTitle>
|
||||||
|
|
||||||
|
<UiDialogDescription>
|
||||||
|
{{ $t('entity.calendar.event.editDialog.subtitle') }}
|
||||||
|
</UiDialogDescription>
|
||||||
|
</header>
|
||||||
|
|
||||||
|
<CalendarFormUpdateEvent />
|
||||||
|
</UiDialogContent>
|
||||||
|
</UiDialog>
|
||||||
|
</template>
|
||||||
@@ -2,9 +2,10 @@
|
|||||||
import type { RPGDate } from "~/models/Date";
|
import type { RPGDate } from "~/models/Date";
|
||||||
import { PhAlarm, PhCircleNotch, PhEye, PhEyeClosed, PhMapPinArea, PhTag } from "@phosphor-icons/vue"
|
import { PhAlarm, PhCircleNotch, PhEye, PhEyeClosed, PhMapPinArea, PhTag } from "@phosphor-icons/vue"
|
||||||
|
|
||||||
const { eventSkeleton, operationInProgress } = storeToRefs(useCalendar())
|
const emit = defineEmits(["event-created"])
|
||||||
const { resetSkeleton, submitSkeleton, cancelLatestRequest } = useCalendar()
|
|
||||||
const popoverOpen = ref(false)
|
const { eventSkeleton } = storeToRefs(useCalendar())
|
||||||
|
const { submitSkeleton, cancelLatestRequest } = useCalendar()
|
||||||
|
|
||||||
const { t } = useI18n()
|
const { t } = useI18n()
|
||||||
|
|
||||||
@@ -19,26 +20,6 @@ const props = defineProps<{
|
|||||||
btnClass?: string
|
btnClass?: string
|
||||||
}>()
|
}>()
|
||||||
|
|
||||||
/**
|
|
||||||
* Opens event creation's popover
|
|
||||||
*/
|
|
||||||
function openEventCreatePopover() {
|
|
||||||
// If another operation is in progress, whether it's another create popup or a modal, don't bother opening it
|
|
||||||
if (operationInProgress.value) {
|
|
||||||
popoverOpen.value = false
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
resetSkeleton()
|
|
||||||
|
|
||||||
popoverOpen.value = true
|
|
||||||
|
|
||||||
// Set skeleton initial startDate if it's known
|
|
||||||
if (props.date) {
|
|
||||||
eventSkeleton.value.startDate = { ...props.date } // We need to clone it otherwise the props ends up mutating (?)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
async function handleSubmit() {
|
async function handleSubmit() {
|
||||||
// Prevent form submission if already loading
|
// Prevent form submission if already loading
|
||||||
if (isLoading.value) return
|
if (isLoading.value) return
|
||||||
@@ -48,7 +29,7 @@ async function handleSubmit() {
|
|||||||
try {
|
try {
|
||||||
await submitSkeleton()
|
await submitSkeleton()
|
||||||
|
|
||||||
popoverOpen.value = false
|
emit("event-created")
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
if (err instanceof Error) {
|
if (err instanceof Error) {
|
||||||
formErrors.message = err.message
|
formErrors.message = err.message
|
||||||
@@ -58,17 +39,6 @@ async function handleSubmit() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Prevents the modal from closing if's still loading
|
|
||||||
*
|
|
||||||
* @param e The closing event (can be keydown or click)
|
|
||||||
*/
|
|
||||||
function handleClosing(e: Event) {
|
|
||||||
if (isLoading.value) {
|
|
||||||
e.preventDefault()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Click on the cancel button
|
* Click on the cancel button
|
||||||
*
|
*
|
||||||
@@ -81,160 +51,141 @@ function handleCancel() {
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<UiPopover v-model:open="popoverOpen">
|
<form @submit.prevent="handleSubmit">
|
||||||
<UiPopoverTrigger as-child>
|
<div class="grid grid-cols-2 gap-y-3">
|
||||||
<button :class="btnClass" @click="openEventCreatePopover()" />
|
<div class="col-span-2 pl-8">
|
||||||
</UiPopoverTrigger>
|
<input
|
||||||
<UiPopoverContent
|
id="new-event-title"
|
||||||
:align="'center'"
|
v-model="eventSkeleton.title"
|
||||||
:side="'right'"
|
type="text"
|
||||||
:collision-padding="60"
|
name="new-event-title"
|
||||||
:disable-outside-pointer-events="true"
|
required
|
||||||
:trap-focus="true"
|
:placeholder="$t('entity.calendar.event.title')"
|
||||||
class="pl-3 w-[30rem] max-w-full border-indigo-200 dark:bg-slate-950 dark:border-indigo-950"
|
:maxlength="120"
|
||||||
@escape-key-down="handleClosing"
|
pattern="([A-Za-zÀ-ÖØ-öø-ÿ0-9\s\&\-\~]+){3,120}"
|
||||||
@focus-outside="handleClosing"
|
class="w-full -my-1 py-1 -mx-1 px-1 text-lg border-b-[1px] bg-transparent focus-visible:outline-none focus-visible:border-blue-600 invalid:border-red-500"
|
||||||
@interact-outside="handleClosing"
|
>
|
||||||
@pointer-down-outside="handleClosing"
|
<div class="mt-2 mb-1 text-xs opacity-50">
|
||||||
>
|
{{ t('entity.calendar.event.patterns.title') }}
|
||||||
<form @submit.prevent="handleSubmit">
|
</div>
|
||||||
<div class="grid grid-cols-2 gap-y-3">
|
</div>
|
||||||
<div class="col-span-2 pl-8">
|
|
||||||
|
<div class="col-span-2 my-2 pl-8">
|
||||||
|
<textarea
|
||||||
|
id="new-event-description"
|
||||||
|
v-model="eventSkeleton.description"
|
||||||
|
name="new-event-description"
|
||||||
|
:placeholder="$t('entity.addDescription')"
|
||||||
|
:maxlength="1200"
|
||||||
|
class="w-full -my-1 py-1 -mx-1 px-1 min-h-24 max-h-36 text-sm border-b-[1px] bg-transparent focus-visible:outline-none focus-visible:border-blue-600 invalid:border-red-500"
|
||||||
|
/>
|
||||||
|
<div class="mt-2 mb-1 text-xs opacity-50">
|
||||||
|
{{ t('entity.calendar.event.patterns.description') }}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="col-span-2">
|
||||||
|
<div class="flex items-center gap-4">
|
||||||
|
<PhAlarm size="18" weight="fill" />
|
||||||
|
|
||||||
|
<CalendarInputRPGDate
|
||||||
|
v-model:model-value="eventSkeleton.startDate"
|
||||||
|
:placeholder="$t('entity.calendar.date.start')"
|
||||||
|
:initial-date="props.date"
|
||||||
|
:required="true"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<span>—</span>
|
||||||
|
|
||||||
|
<CalendarInputRPGDate
|
||||||
|
v-model:model-value="eventSkeleton.endDate"
|
||||||
|
:placeholder="$t('entity.calendar.date.end')"
|
||||||
|
:initial-date="props.date"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="col-span-2">
|
||||||
|
<div class="flex items-center gap-4">
|
||||||
|
<PhTag size="18" weight="fill" />
|
||||||
|
|
||||||
|
<CalendarInputEventCategory
|
||||||
|
v-model="eventSkeleton.category"
|
||||||
|
:placeholder="$t('entity.category.addPrimary')"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- <div class="col-span-2">
|
||||||
|
<div class="flex items-center gap-4">
|
||||||
|
<PhTag size="18" weight="fill" />
|
||||||
|
|
||||||
|
<CalendarInputEventCategories v-model="eventSkeleton.secondaryCategories" :placeholder="$t('entity.category.addSecondaries')" />
|
||||||
|
</div>
|
||||||
|
</div> -->
|
||||||
|
|
||||||
|
<div class="col-span-2 mb-2">
|
||||||
|
<div class="flex items-center gap-4">
|
||||||
|
<PhMapPinArea size="18" weight="fill" />
|
||||||
|
|
||||||
|
<div class="grow">
|
||||||
<input
|
<input
|
||||||
id="new-event-title"
|
id="new-event-location"
|
||||||
v-model="eventSkeleton.title"
|
v-model="eventSkeleton.location"
|
||||||
type="text"
|
type="text"
|
||||||
name="new-event-title"
|
name="new-event-location"
|
||||||
required
|
:placeholder="$t('entity.calendar.event.addLocation')"
|
||||||
:placeholder="$t('entity.calendar.event.title')"
|
:maxlength="160"
|
||||||
:maxlength="120"
|
pattern="([A-Za-zÀ-ÖØ-öø-ÿ0-9\s\&\-\~]+){3,160}"
|
||||||
pattern="([A-Za-zÀ-ÖØ-öø-ÿ0-9\s\&\-\~]+){3,120}"
|
class="w-full -my-1 py-2 px-2 text-sm border-b-[1px] bg-transparent focus-visible:outline-none focus-visible:border-blue-600"
|
||||||
class="w-full -my-1 py-1 -mx-1 px-1 text-lg border-b-[1px] bg-transparent focus-visible:outline-none focus-visible:border-blue-600 invalid:border-red-500"
|
|
||||||
>
|
>
|
||||||
|
|
||||||
<div class="mt-2 mb-1 text-xs opacity-50">
|
<div class="mt-2 mb-1 text-xs opacity-50">
|
||||||
{{ t('entity.calendar.event.patterns.title') }}
|
{{ t('entity.calendar.event.patterns.location') }}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="col-span-2 my-2 pl-8">
|
|
||||||
<textarea
|
|
||||||
id="new-event-description"
|
|
||||||
v-model="eventSkeleton.description"
|
|
||||||
name="new-event-description"
|
|
||||||
:placeholder="$t('entity.addDescription')"
|
|
||||||
:maxlength="1200"
|
|
||||||
class="w-full -my-1 py-1 -mx-1 px-1 min-h-24 max-h-36 text-sm border-b-[1px] bg-transparent focus-visible:outline-none focus-visible:border-blue-600 invalid:border-red-500"
|
|
||||||
/>
|
|
||||||
<div class="mt-2 mb-1 text-xs opacity-50">
|
|
||||||
{{ t('entity.calendar.event.patterns.description') }}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="col-span-2">
|
|
||||||
<div class="flex items-center gap-4">
|
|
||||||
<PhAlarm size="18" weight="fill" />
|
|
||||||
|
|
||||||
<CalendarInputRPGDate
|
|
||||||
v-model:model-value="eventSkeleton.startDate"
|
|
||||||
:placeholder="$t('entity.calendar.date.start')"
|
|
||||||
:initial-date="props.date"
|
|
||||||
:required="true"
|
|
||||||
/>
|
|
||||||
|
|
||||||
<span>—</span>
|
|
||||||
|
|
||||||
<CalendarInputRPGDate
|
|
||||||
v-model:model-value="eventSkeleton.endDate"
|
|
||||||
:placeholder="$t('entity.calendar.date.end')"
|
|
||||||
:initial-date="props.date"
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="col-span-2">
|
|
||||||
<div class="flex items-center gap-4">
|
|
||||||
<PhTag size="18" weight="fill" />
|
|
||||||
|
|
||||||
<CalendarInputEventCategory
|
|
||||||
v-model="eventSkeleton.category"
|
|
||||||
:placeholder="$t('entity.category.addPrimary')"
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<!-- <div class="col-span-2">
|
|
||||||
<div class="flex items-center gap-4">
|
|
||||||
<PhTag size="18" weight="fill" />
|
|
||||||
|
|
||||||
<CalendarInputEventCategories v-model="eventSkeleton.secondaryCategories" :placeholder="$t('entity.category.addSecondaries')" />
|
|
||||||
</div>
|
|
||||||
</div> -->
|
|
||||||
|
|
||||||
<div class="col-span-2 mb-2">
|
|
||||||
<div class="flex items-center gap-4">
|
|
||||||
<PhMapPinArea size="18" weight="fill" />
|
|
||||||
|
|
||||||
<div class="grow">
|
|
||||||
<input
|
|
||||||
id="new-event-location"
|
|
||||||
v-model="eventSkeleton.location"
|
|
||||||
type="text"
|
|
||||||
name="new-event-location"
|
|
||||||
:placeholder="$t('entity.calendar.event.addLocation')"
|
|
||||||
:maxlength="160"
|
|
||||||
pattern="([A-Za-zÀ-ÖØ-öø-ÿ0-9\s\&\-\~]+){3,160}"
|
|
||||||
class="w-full -my-1 py-2 px-2 text-sm border-b-[1px] bg-transparent focus-visible:outline-none focus-visible:border-blue-600"
|
|
||||||
>
|
|
||||||
<div class="mt-2 mb-1 text-xs opacity-50">
|
|
||||||
{{ t('entity.calendar.event.patterns.location') }}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="col-span-2">
|
|
||||||
<div class="flex items-center gap-4">
|
|
||||||
<PhEye v-if="!eventSkeleton.hidden" size="18" weight="fill" />
|
|
||||||
<PhEyeClosed v-else size="18" />
|
|
||||||
|
|
||||||
<div class="flex items-center gap-x-2">
|
|
||||||
<UiSwitch id="new-event-visibility" v-model:checked="eventSkeleton.hidden" />
|
|
||||||
<UiLabel for="new-event-visibility">
|
|
||||||
<template v-if="!eventSkeleton.hidden">
|
|
||||||
{{ $t('entity.calendar.event.isPublic') }}
|
|
||||||
</template>
|
|
||||||
<template v-else>
|
|
||||||
{{ $t('entity.calendar.event.isHidden') }}
|
|
||||||
</template>
|
|
||||||
</UiLabel>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="text-red-500 pl-8">
|
|
||||||
<span class="text-sm">
|
|
||||||
{{ formErrors.message }}
|
|
||||||
</span>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="flex gap-2 justify-end">
|
|
||||||
<Transition name="fade-delay">
|
|
||||||
<UiButton v-if="isLoading" type="button" size="sm" variant="destructive" @click.prevent="handleCancel">
|
|
||||||
{{ $t('ui.action.cancel') }}
|
|
||||||
</UiButton>
|
|
||||||
</Transition>
|
|
||||||
|
|
||||||
<UiButton size="sm" :disabled="isLoading">
|
|
||||||
<Transition name="fade">
|
|
||||||
<PhCircleNotch v-if="isLoading" size="20" class="opacity-50 animate-spin"/>
|
|
||||||
</Transition>
|
|
||||||
|
|
||||||
{{ $t('ui.action.save') }}
|
|
||||||
</UiButton>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</div>
|
||||||
</UiPopoverContent>
|
|
||||||
</UiPopover>
|
<div class="col-span-2">
|
||||||
|
<div class="flex items-center gap-4">
|
||||||
|
<PhEye v-if="!eventSkeleton.hidden" size="18" weight="fill" />
|
||||||
|
<PhEyeClosed v-else size="18" />
|
||||||
|
|
||||||
|
<div class="flex items-center gap-x-2">
|
||||||
|
<UiSwitch id="new-event-visibility" v-model:checked="eventSkeleton.hidden" />
|
||||||
|
<UiLabel for="new-event-visibility">
|
||||||
|
<template v-if="!eventSkeleton.hidden">
|
||||||
|
{{ $t('entity.calendar.event.isPublic') }}
|
||||||
|
</template>
|
||||||
|
<template v-else>
|
||||||
|
{{ $t('entity.calendar.event.isHidden') }}
|
||||||
|
</template>
|
||||||
|
</UiLabel>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="text-red-500 pl-8">
|
||||||
|
<span class="text-sm">
|
||||||
|
{{ formErrors.message }}
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="flex gap-2 justify-end">
|
||||||
|
<Transition name="fade-delay">
|
||||||
|
<UiButton v-if="isLoading" type="button" size="sm" variant="destructive" @click.prevent="handleCancel">
|
||||||
|
{{ $t('ui.action.cancel') }}
|
||||||
|
</UiButton>
|
||||||
|
</Transition>
|
||||||
|
|
||||||
|
<UiButton size="sm" :disabled="isLoading">
|
||||||
|
<Transition name="fade">
|
||||||
|
<PhCircleNotch v-if="isLoading" size="20" class="opacity-50 animate-spin"/>
|
||||||
|
</Transition>
|
||||||
|
|
||||||
|
{{ $t('ui.action.save') }}
|
||||||
|
</UiButton>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
</template>
|
</template>
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ import { PhCircleNotch } from "@phosphor-icons/vue";
|
|||||||
import { useToast } from "~/components/ui/toast";
|
import { useToast } from "~/components/ui/toast";
|
||||||
|
|
||||||
const { resetSkeleton, deleteEventFromSkeleton, cancelLatestRequest } = useCalendar()
|
const { resetSkeleton, deleteEventFromSkeleton, cancelLatestRequest } = useCalendar()
|
||||||
const { isDeleteEventModalOpen, eventSkeleton, lastActiveEvent } = storeToRefs(useCalendar())
|
const { isDeleteEventModalOpen, eventSkeleton } = storeToRefs(useCalendar())
|
||||||
|
|
||||||
const { toast } = useToast()
|
const { toast } = useToast()
|
||||||
const { t } = useI18n()
|
const { t } = useI18n()
|
||||||
@@ -14,13 +14,6 @@ const formErrors = reactive<{ message: string | null }>({
|
|||||||
message: null
|
message: null
|
||||||
})
|
})
|
||||||
|
|
||||||
// Watch the popover state
|
|
||||||
watch(isDeleteEventModalOpen, (hasOpened, _o) => {
|
|
||||||
if (hasOpened && lastActiveEvent.value) {
|
|
||||||
eventSkeleton.value = { ...lastActiveEvent.value }
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
async function handleAction(): Promise<void> {
|
async function handleAction(): Promise<void> {
|
||||||
if (isLoading.value) return
|
if (isLoading.value) return
|
||||||
|
|
||||||
@@ -48,17 +41,6 @@ async function handleAction(): Promise<void> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Prevents the modal from closing if's still loading
|
|
||||||
*
|
|
||||||
* @param e The closing event (can be keydown or click)
|
|
||||||
*/
|
|
||||||
function handleClosing(e: Event): void {
|
|
||||||
if (isLoading.value) {
|
|
||||||
e.preventDefault()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Click on the cancel button
|
* Click on the cancel button
|
||||||
*
|
*
|
||||||
@@ -71,53 +53,35 @@ function handleCancel(): void {
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<UiAlertDialog v-model:open="isDeleteEventModalOpen">
|
<form @submit.prevent="handleAction">
|
||||||
<UiAlertDialogContent
|
<div class="grid grid-cols-2 gap-y-4">
|
||||||
:disable-outside-pointer-events="true"
|
<div class="text-red-500 ml-8">
|
||||||
:trap-focus="true"
|
<span class="text-sm">
|
||||||
class="min-w-96 border-indigo-200 dark:bg-slate-950 dark:border-indigo-950"
|
{{ formErrors.message }}
|
||||||
@escape-key-down="handleClosing"
|
</span>
|
||||||
@focus-outside="handleClosing"
|
</div>
|
||||||
@interact-outside="handleClosing"
|
</div>
|
||||||
@pointer-down-outside="handleClosing"
|
|
||||||
>
|
|
||||||
<UiAlertDialogTitle>{{ $t('entity.calendar.event.deleteDialog.title') }}</UiAlertDialogTitle>
|
|
||||||
|
|
||||||
<UiAlertDialogDescription>
|
<footer class="flex gap-2 justify-between">
|
||||||
{{ $t('entity.calendar.event.deleteDialog.subtitle') }}
|
<UiButton type="button" size="sm" variant="outline" @click="() => isDeleteEventModalOpen = false">
|
||||||
</UiAlertDialogDescription>
|
{{ $t('ui.action.back') }}
|
||||||
|
</UiButton>
|
||||||
|
|
||||||
<form @submit.prevent="handleAction">
|
<div class="flex gap-2 justify-end">
|
||||||
<div class="grid grid-cols-2 gap-y-4">
|
<Transition name="fade-delay">
|
||||||
<div class="text-red-500 ml-8">
|
<UiButton v-if="isLoading" type="button" size="sm" variant="destructive" @click.prevent="handleCancel">
|
||||||
<span class="text-sm">
|
{{ $t('ui.action.cancel') }}
|
||||||
{{ formErrors.message }}
|
|
||||||
</span>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<footer class="flex gap-2 justify-between">
|
|
||||||
<UiButton type="button" size="sm" variant="outline" @click="() => isDeleteEventModalOpen = false">
|
|
||||||
{{ $t('ui.action.back') }}
|
|
||||||
</UiButton>
|
</UiButton>
|
||||||
|
</Transition>
|
||||||
|
|
||||||
<div class="flex gap-2 justify-end">
|
<UiButton size="sm" variant="destructive" :disabled="isLoading">
|
||||||
<Transition name="fade-delay">
|
<Transition name="fade">
|
||||||
<UiButton v-if="isLoading" type="button" size="sm" variant="destructive" @click.prevent="handleCancel">
|
<PhCircleNotch v-if="isLoading" size="20" class="animate-spin"/>
|
||||||
{{ $t('ui.action.cancel') }}
|
</Transition>
|
||||||
</UiButton>
|
|
||||||
</Transition>
|
|
||||||
|
|
||||||
<UiButton size="sm" variant="destructive" :disabled="isLoading">
|
{{ $t('ui.action.delete') }}
|
||||||
<Transition name="fade">
|
</UiButton>
|
||||||
<PhCircleNotch v-if="isLoading" size="20" class="animate-spin"/>
|
</div>
|
||||||
</Transition>
|
</footer>
|
||||||
|
</form>
|
||||||
{{ $t('ui.action.delete') }}
|
|
||||||
</UiButton>
|
|
||||||
</div>
|
|
||||||
</footer>
|
|
||||||
</form>
|
|
||||||
</UiAlertDialogContent>
|
|
||||||
</UiAlertDialog>
|
|
||||||
</template>
|
</template>
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import { useToast } from "~/components/ui/toast";
|
|||||||
import type { APIError } from "~/models/Errors";
|
import type { APIError } from "~/models/Errors";
|
||||||
|
|
||||||
const { resetSkeleton, updateEventFromSkeleton, cancelLatestRequest } = useCalendar()
|
const { resetSkeleton, updateEventFromSkeleton, cancelLatestRequest } = useCalendar()
|
||||||
const { eventSkeleton, lastActiveEvent, isEditEventModalOpen } = storeToRefs(useCalendar())
|
const { eventSkeleton, lastActiveEvent } = storeToRefs(useCalendar())
|
||||||
|
|
||||||
const { toast } = useToast()
|
const { toast } = useToast()
|
||||||
const { t } = useI18n()
|
const { t } = useI18n()
|
||||||
@@ -15,13 +15,6 @@ const formErrors = reactive<{ message: string | null }>({
|
|||||||
message: null
|
message: null
|
||||||
})
|
})
|
||||||
|
|
||||||
// Watch the popover state
|
|
||||||
watch(isEditEventModalOpen, (hasOpened, _o) => {
|
|
||||||
if (hasOpened && lastActiveEvent.value) {
|
|
||||||
eventSkeleton.value = { ...lastActiveEvent.value }
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
async function handleAction() {
|
async function handleAction() {
|
||||||
if (isLoading.value) return
|
if (isLoading.value) return
|
||||||
|
|
||||||
@@ -44,18 +37,6 @@ async function handleAction() {
|
|||||||
} finally {
|
} finally {
|
||||||
resetSkeleton()
|
resetSkeleton()
|
||||||
isLoading.value = false
|
isLoading.value = false
|
||||||
isEditEventModalOpen.value = false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Prevents the modal from closing if's still loading
|
|
||||||
*
|
|
||||||
* @param e The closing event (can be keydown or click)
|
|
||||||
*/
|
|
||||||
function handleClosing(e: Event) {
|
|
||||||
if (isLoading.value) {
|
|
||||||
e.preventDefault()
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -71,174 +52,152 @@ function handleCancel() {
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<UiDialog v-model:open="isEditEventModalOpen">
|
<form @submit.prevent="handleAction">
|
||||||
<UiDialogContent
|
<div class="grid grid-cols-2 gap-y-3">
|
||||||
:disable-outside-pointer-events="true"
|
<div class="col-span-2">
|
||||||
:trap-focus="true"
|
<div class="flex items-center gap-4">
|
||||||
class="pl-3 min-w-96 border-indigo-200 dark:bg-slate-950 dark:border-indigo-950"
|
<PhPencilSimpleLine size="20" weight="fill" />
|
||||||
@escape-key-down="handleClosing"
|
|
||||||
@focus-outside="handleClosing"
|
|
||||||
@interact-outside="handleClosing"
|
|
||||||
@pointer-down-outside="(e) => e.preventDefault()"
|
|
||||||
>
|
|
||||||
<header class="pl-8 grid gap-y-2">
|
|
||||||
<UiDialogTitle>
|
|
||||||
{{ $t('entity.calendar.event.editDialog.title') }}
|
|
||||||
</UiDialogTitle>
|
|
||||||
|
|
||||||
<UiDialogDescription>
|
<div class="grow">
|
||||||
{{ $t('entity.calendar.event.editDialog.subtitle') }}
|
<input
|
||||||
</UiDialogDescription>
|
id="new-event-title"
|
||||||
</header>
|
v-model="eventSkeleton.title"
|
||||||
|
type="text"
|
||||||
<form @submit.prevent="handleAction">
|
name="new-event-title"
|
||||||
<div class="grid grid-cols-2 gap-y-3">
|
required
|
||||||
<div class="col-span-2">
|
:placeholder="$t('entity.calendar.event.title')"
|
||||||
<div class="flex items-center gap-4">
|
:minlength="3"
|
||||||
<PhPencilSimpleLine size="20" weight="fill" />
|
:maxlength="120"
|
||||||
|
class="w-full -my-1 py-1 -mx-1 px-1 text-lg border-b-[1px] bg-transparent focus-visible:outline-none focus-visible:border-blue-600 invalid:border-red-500"
|
||||||
<div class="grow">
|
>
|
||||||
<input
|
|
||||||
id="new-event-title"
|
|
||||||
v-model="eventSkeleton.title"
|
|
||||||
type="text"
|
|
||||||
name="new-event-title"
|
|
||||||
required
|
|
||||||
:placeholder="$t('entity.calendar.event.title')"
|
|
||||||
:minlength="3"
|
|
||||||
:maxlength="120"
|
|
||||||
class="w-full -my-1 py-1 -mx-1 px-1 text-lg border-b-[1px] bg-transparent focus-visible:outline-none focus-visible:border-blue-600 invalid:border-red-500"
|
|
||||||
>
|
|
||||||
<div class="mt-2 mb-1 text-xs opacity-50">
|
|
||||||
{{ t('entity.calendar.event.patterns.title') }}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="col-span-2 my-2 ml-8">
|
|
||||||
<textarea
|
|
||||||
id="new-event-description"
|
|
||||||
v-model="eventSkeleton.description"
|
|
||||||
name="new-event-description"
|
|
||||||
:placeholder="$t('entity.addDescription')"
|
|
||||||
:maxlength="1200"
|
|
||||||
class="w-full -my-1 py-1 -mx-1 px-1 min-h-24 max-h-36 text-sm border-b-[1px] bg-transparent focus-visible:outline-none focus-visible:border-blue-600 invalid:border-red-500"
|
|
||||||
/>
|
|
||||||
<div class="mt-2 mb-1 text-xs opacity-50">
|
<div class="mt-2 mb-1 text-xs opacity-50">
|
||||||
{{ t('entity.calendar.event.patterns.description') }}
|
{{ t('entity.calendar.event.patterns.title') }}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="col-span-2">
|
|
||||||
<div class="flex items-center gap-4">
|
|
||||||
<PhAlarm size="18" weight="fill" />
|
|
||||||
|
|
||||||
<CalendarInputRPGDate
|
|
||||||
v-model:model-value="eventSkeleton.startDate"
|
|
||||||
:placeholder="$t('entity.calendar.date.start')"
|
|
||||||
:initial-date="lastActiveEvent?.startDate"
|
|
||||||
:required="true"
|
|
||||||
/>
|
|
||||||
|
|
||||||
<span>—</span>
|
|
||||||
|
|
||||||
<CalendarInputRPGDate
|
|
||||||
v-model:model-value="eventSkeleton.endDate"
|
|
||||||
:placeholder="$t('entity.calendar.date.end')"
|
|
||||||
:initial-date="lastActiveEvent?.endDate"
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="col-span-2">
|
|
||||||
<div class="flex items-center gap-4">
|
|
||||||
<PhTag size="18" weight="fill" />
|
|
||||||
|
|
||||||
<div class="w-1/2">
|
|
||||||
<CalendarInputEventCategory
|
|
||||||
v-model="eventSkeleton.category"
|
|
||||||
:placeholder="$t('entity.category.addPrimary')"
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<!-- <div class="col-span-2">
|
|
||||||
<div class="flex items-center gap-4">
|
|
||||||
<PhTag size="18" weight="fill" />
|
|
||||||
|
|
||||||
<div class="w-1/2">
|
|
||||||
<CalendarInputEventCategories v-model="eventSkeleton.secondaryCategories" placeholder="Ajouter des catégories secondaires" />
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div> -->
|
|
||||||
|
|
||||||
<div class="col-span-2 mb-2">
|
|
||||||
<div class="flex items-center gap-4">
|
|
||||||
<PhMapPinArea size="18" weight="fill" />
|
|
||||||
|
|
||||||
<div class="grow">
|
|
||||||
<input
|
|
||||||
id="new-event-location"
|
|
||||||
v-model="eventSkeleton.location"
|
|
||||||
type="text"
|
|
||||||
name="new-event-location"
|
|
||||||
:placeholder="$t('entity.calendar.event.addLocation')"
|
|
||||||
:minlength="3"
|
|
||||||
:maxlength="160"
|
|
||||||
class="w-full -my-1 py-2 px-2 text-sm border-b-[1px] bg-transparent focus-visible:outline-none focus-visible:border-blue-600 invalid:border-red-500"
|
|
||||||
>
|
|
||||||
|
|
||||||
<div class="mt-2 mb-1 text-xs opacity-50">
|
|
||||||
{{ t('entity.calendar.event.patterns.location') }}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="col-span-2">
|
|
||||||
<div class="flex items-center gap-4">
|
|
||||||
<PhEye v-if="!eventSkeleton.hidden" size="18" weight="fill" />
|
|
||||||
<PhEyeClosed v-else size="18" />
|
|
||||||
|
|
||||||
<div class="flex items-center gap-x-2">
|
|
||||||
<UiSwitch id="new-event-visibility" v-model:checked="eventSkeleton.hidden" />
|
|
||||||
<UiLabel for="new-event-visibility">
|
|
||||||
<template v-if="!eventSkeleton.hidden">
|
|
||||||
{{ $t('entity.calendar.event.isPublic') }}
|
|
||||||
</template>
|
|
||||||
<template v-else>
|
|
||||||
{{ $t('entity.calendar.event.isHidden') }}
|
|
||||||
</template>
|
|
||||||
</UiLabel>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="text-red-500 ml-8">
|
|
||||||
<span class="text-sm">
|
|
||||||
{{ formErrors.message }}
|
|
||||||
</span>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<footer class="flex gap-2 justify-end">
|
<div class="col-span-2 my-2 ml-8">
|
||||||
<Transition name="fade-delay">
|
<textarea
|
||||||
<UiButton v-if="isLoading" type="button" size="sm" variant="destructive" @click.prevent="handleCancel">
|
id="new-event-description"
|
||||||
{{ $t('ui.action.cancel') }}
|
v-model="eventSkeleton.description"
|
||||||
</UiButton>
|
name="new-event-description"
|
||||||
</Transition>
|
:placeholder="$t('entity.addDescription')"
|
||||||
|
:maxlength="1200"
|
||||||
|
class="w-full -my-1 py-1 -mx-1 px-1 min-h-24 max-h-36 text-sm border-b-[1px] bg-transparent focus-visible:outline-none focus-visible:border-blue-600 invalid:border-red-500"
|
||||||
|
/>
|
||||||
|
<div class="mt-2 mb-1 text-xs opacity-50">
|
||||||
|
{{ t('entity.calendar.event.patterns.description') }}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<UiButton size="sm" :disabled="isLoading">
|
<div class="col-span-2">
|
||||||
<Transition name="fade">
|
<div class="flex items-center gap-4">
|
||||||
<PhCircleNotch v-if="isLoading" size="20" class="animate-spin"/>
|
<PhAlarm size="18" weight="fill" />
|
||||||
</Transition>
|
|
||||||
|
|
||||||
{{ $t('ui.action.save') }}
|
<CalendarInputRPGDate
|
||||||
</UiButton>
|
v-model:model-value="eventSkeleton.startDate"
|
||||||
</footer>
|
:placeholder="$t('entity.calendar.date.start')"
|
||||||
</form>
|
:initial-date="lastActiveEvent?.startDate"
|
||||||
</UiDialogContent>
|
:required="true"
|
||||||
</UiDialog>
|
/>
|
||||||
|
|
||||||
|
<span>—</span>
|
||||||
|
|
||||||
|
<CalendarInputRPGDate
|
||||||
|
v-model:model-value="eventSkeleton.endDate"
|
||||||
|
:placeholder="$t('entity.calendar.date.end')"
|
||||||
|
:initial-date="lastActiveEvent?.endDate"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="col-span-2">
|
||||||
|
<div class="flex items-center gap-4">
|
||||||
|
<PhTag size="18" weight="fill" />
|
||||||
|
|
||||||
|
<div class="w-1/2">
|
||||||
|
<CalendarInputEventCategory
|
||||||
|
v-model="eventSkeleton.category"
|
||||||
|
:placeholder="$t('entity.category.addPrimary')"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- <div class="col-span-2">
|
||||||
|
<div class="flex items-center gap-4">
|
||||||
|
<PhTag size="18" weight="fill" />
|
||||||
|
|
||||||
|
<div class="w-1/2">
|
||||||
|
<CalendarInputEventCategories v-model="eventSkeleton.secondaryCategories" placeholder="Ajouter des catégories secondaires" />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div> -->
|
||||||
|
|
||||||
|
<div class="col-span-2 mb-2">
|
||||||
|
<div class="flex items-center gap-4">
|
||||||
|
<PhMapPinArea size="18" weight="fill" />
|
||||||
|
|
||||||
|
<div class="grow">
|
||||||
|
<input
|
||||||
|
id="new-event-location"
|
||||||
|
v-model="eventSkeleton.location"
|
||||||
|
type="text"
|
||||||
|
name="new-event-location"
|
||||||
|
:placeholder="$t('entity.calendar.event.addLocation')"
|
||||||
|
:minlength="3"
|
||||||
|
:maxlength="160"
|
||||||
|
class="w-full -my-1 py-2 px-2 text-sm border-b-[1px] bg-transparent focus-visible:outline-none focus-visible:border-blue-600 invalid:border-red-500"
|
||||||
|
>
|
||||||
|
|
||||||
|
<div class="mt-2 mb-1 text-xs opacity-50">
|
||||||
|
{{ t('entity.calendar.event.patterns.location') }}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="col-span-2">
|
||||||
|
<div class="flex items-center gap-4">
|
||||||
|
<PhEye v-if="!eventSkeleton.hidden" size="18" weight="fill" />
|
||||||
|
<PhEyeClosed v-else size="18" />
|
||||||
|
|
||||||
|
<div class="flex items-center gap-x-2">
|
||||||
|
<UiSwitch id="new-event-visibility" v-model:checked="eventSkeleton.hidden" />
|
||||||
|
<UiLabel for="new-event-visibility">
|
||||||
|
<template v-if="!eventSkeleton.hidden">
|
||||||
|
{{ $t('entity.calendar.event.isPublic') }}
|
||||||
|
</template>
|
||||||
|
<template v-else>
|
||||||
|
{{ $t('entity.calendar.event.isHidden') }}
|
||||||
|
</template>
|
||||||
|
</UiLabel>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="text-red-500 ml-8">
|
||||||
|
<span class="text-sm">
|
||||||
|
{{ formErrors.message }}
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<footer class="flex gap-2 justify-end">
|
||||||
|
<Transition name="fade-delay">
|
||||||
|
<UiButton v-if="isLoading" type="button" size="sm" variant="destructive" @click.prevent="handleCancel">
|
||||||
|
{{ $t('ui.action.cancel') }}
|
||||||
|
</UiButton>
|
||||||
|
</Transition>
|
||||||
|
|
||||||
|
<UiButton size="sm" :disabled="isLoading">
|
||||||
|
<Transition name="fade">
|
||||||
|
<PhCircleNotch v-if="isLoading" size="20" class="animate-spin"/>
|
||||||
|
</Transition>
|
||||||
|
|
||||||
|
{{ $t('ui.action.save') }}
|
||||||
|
</UiButton>
|
||||||
|
</footer>
|
||||||
|
</form>
|
||||||
</template>
|
</template>
|
||||||
|
|||||||
@@ -143,7 +143,7 @@ const eventsNotDisplayed: ComputedRef<number> = computed<number>(() => eventsFo
|
|||||||
</ClientOnly>
|
</ClientOnly>
|
||||||
|
|
||||||
<ClientOnly>
|
<ClientOnly>
|
||||||
<LazyCalendarFormCreateEvent :date btn-class="absolute inset-0 w-full h-full cursor-default z-0" />
|
<LazyCalendarDialogCreateEvent :date btn-class="absolute inset-0 w-full h-full cursor-default z-0" />
|
||||||
</ClientOnly>
|
</ClientOnly>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|||||||
@@ -127,6 +127,8 @@ export default defineI18nConfig(() => ({
|
|||||||
event: {
|
event: {
|
||||||
nameSingular: "Event",
|
nameSingular: "Event",
|
||||||
namePlural: "Events",
|
namePlural: "Events",
|
||||||
|
addSingle: "Add an event",
|
||||||
|
newEvent: "New event",
|
||||||
title: "Event title",
|
title: "Event title",
|
||||||
isStart: "Start",
|
isStart: "Start",
|
||||||
isEnd: "End",
|
isEnd: "End",
|
||||||
@@ -348,6 +350,8 @@ export default defineI18nConfig(() => ({
|
|||||||
event: {
|
event: {
|
||||||
nameSingular: "Évènement",
|
nameSingular: "Évènement",
|
||||||
namePlural: "Évènements",
|
namePlural: "Évènements",
|
||||||
|
addSingle: "Ajouter un évènement",
|
||||||
|
newEvent: "Nouvel évènement",
|
||||||
title: "Titre de l'évènement",
|
title: "Titre de l'évènement",
|
||||||
isStart: "Début",
|
isStart: "Début",
|
||||||
isEnd: "Fin",
|
isEnd: "Fin",
|
||||||
|
|||||||
Reference in New Issue
Block a user