Merge branch 'main' into Profile-Settings-page-permission-fix

This commit is contained in:
2025-12-17 09:28:32 -06:00

View File

@@ -121,7 +121,7 @@ const minEndDate = computed(() => {
if (values.start_date) { if (values.start_date) {
return new CalendarDate(values.start_date.getFullYear(), values.start_date.getMonth() + 1, values.start_date.getDate()) return new CalendarDate(values.start_date.getFullYear(), values.start_date.getMonth() + 1, values.start_date.getDate())
} else { } else {
return null; return today(getLocalTimeZone());
} }
}) })
@@ -134,6 +134,17 @@ const maxEndDate = computed(() => {
} }
}) })
const minStartDate = computed(() => {
if (values.type && values.end_date) {
let endDateObj = new Date(values.end_date.getTime() - values.type.max_length_days * 24 * 60 * 60 * 1000);
let td = today(getLocalTimeZone());
let start = new CalendarDate(endDateObj.getFullYear(), endDateObj.getMonth() + 1, endDateObj.getDate())
return td.compare(start) > 0 ? td : start;
} else {
return today(getLocalTimeZone());
}
})
const memberFilter = ref(''); const memberFilter = ref('');
const filteredMembers = computed(() => { const filteredMembers = computed(() => {
@@ -226,8 +237,9 @@ const filteredMembers = computed(() => {
<FieldContent> <FieldContent>
<FieldLabel>Start Date</FieldLabel> <FieldLabel>Start Date</FieldLabel>
<Popover> <Popover>
<div class="relative inline-flex items-center group">
<PopoverTrigger as-child> <PopoverTrigger as-child>
<Button variant="outline" :class="cn( <Button :disabled="!values.type" variant="outline" :class="cn(
'w-full justify-start text-left font-normal', 'w-full justify-start text-left font-normal',
!field.value && 'text-muted-foreground', !field.value && 'text-muted-foreground',
)"> )">
@@ -235,12 +247,21 @@ const filteredMembers = computed(() => {
{{ field.value ? df.format(field.value) : "Pick a date" }} {{ field.value ? df.format(field.value) : "Pick a date" }}
</Button> </Button>
</PopoverTrigger> </PopoverTrigger>
<!-- Tooltip bubble -->
<div v-if="!values?.type" class="pointer-events-none absolute -top-9 left-1/2 -translate-x-1/2
whitespace-nowrap rounded-md bg-popover px-2 py-1 text-xs
text-popover-foreground shadow-md border border-border
opacity-0 translate-y-1
group-hover:opacity-100 group-hover:translate-y-0
transition-opacity transition-transform duration-150">
Select an LOA type first
</div>
</div>
<PopoverContent class="w-auto p-0"> <PopoverContent class="w-auto p-0">
<Calendar <Calendar
:model-value="field.value
? new CalendarDate(field.value.getFullYear(), field.value.getMonth() + 1, field.value.getDate()) : null"
@update:model-value="(val: CalendarDate) => field.onChange(val.toDate(getLocalTimeZone()))" @update:model-value="(val: CalendarDate) => field.onChange(val.toDate(getLocalTimeZone()))"
layout="month-and-year" :min-value="today(getLocalTimeZone())" /> layout="month-and-year"
:min-value="minStartDate || today(getLocalTimeZone())" />
</PopoverContent> </PopoverContent>
</Popover> </Popover>
<div class="h-4"> <div class="h-4">
@@ -254,8 +275,9 @@ const filteredMembers = computed(() => {
<FieldContent> <FieldContent>
<FieldLabel>End Date</FieldLabel> <FieldLabel>End Date</FieldLabel>
<Popover> <Popover>
<div class="relative inline-flex items-center group">
<PopoverTrigger as-child> <PopoverTrigger as-child>
<Button variant="outline" :class="cn( <Button :disabled="!values.type" variant="outline" :class="cn(
'w-full justify-start text-left font-normal', 'w-full justify-start text-left font-normal',
!field.value && 'text-muted-foreground', !field.value && 'text-muted-foreground',
)"> )">
@@ -263,9 +285,18 @@ const filteredMembers = computed(() => {
{{ field.value ? df.format(field.value) : "Pick a date" }} {{ field.value ? df.format(field.value) : "Pick a date" }}
</Button> </Button>
</PopoverTrigger> </PopoverTrigger>
<!-- Tooltip bubble -->
<div v-if="!values?.type" class="pointer-events-none absolute -top-9 left-1/2 -translate-x-1/2
whitespace-nowrap rounded-md bg-popover px-2 py-1 text-xs
text-popover-foreground shadow-md border border-border
opacity-0 translate-y-1
group-hover:opacity-100 group-hover:translate-y-0
transition-opacity transition-transform duration-150">
Select an LOA type first
</div>
</div>
<PopoverContent class="w-auto p-0"> <PopoverContent class="w-auto p-0">
<Calendar <Calendar
:model-value="field.value ? new CalendarDate(field.value.getFullYear(), field.value.getMonth() + 1, field.value.getDate()) : null"
@update:model-value="(val: CalendarDate) => field.onChange(val.toDate(getLocalTimeZone()))" @update:model-value="(val: CalendarDate) => field.onChange(val.toDate(getLocalTimeZone()))"
:default-placeholder="defaultPlaceholder" :min-value="minEndDate" :default-placeholder="defaultPlaceholder" :min-value="minEndDate"
:max-value="maxEndDate" layout="month-and-year"> :max-value="maxEndDate" layout="month-and-year">