Added alert when availability its empty
This commit is contained in:
parent
390967990a
commit
057a6f8b52
|
@ -164,6 +164,9 @@ export const EventTypeList = ({ group, groupIndex, readOnly, types }: EventTypeL
|
|||
utils.viewer.eventTypes.invalidate();
|
||||
},
|
||||
});
|
||||
const { data } = trpc.viewer.availability.list.useQuery();
|
||||
const availabilities = data?.schedules?.map((schedule) => schedule.availability) ?? [];
|
||||
const emptyAvailability = availabilities.filter((availability) => availability.length > 0).length === 0;
|
||||
|
||||
const setHiddenMutation = trpc.viewer.eventTypes.update.useMutation({
|
||||
onMutate: async ({ id }) => {
|
||||
|
@ -351,6 +354,11 @@ export const EventTypeList = ({ group, groupIndex, readOnly, types }: EventTypeL
|
|||
{t("hidden")}
|
||||
</Badge>
|
||||
)}
|
||||
{type.team === null && type.availability.length === 0 && emptyAvailability && (
|
||||
<Badge variant="red" size="lg">
|
||||
{t("empty_availability")}
|
||||
</Badge>
|
||||
)}
|
||||
<Tooltip content={t("show_eventtype_on_profile")}>
|
||||
<div className="self-center rounded-md p-2 hover:bg-gray-200">
|
||||
<Switch
|
||||
|
|
|
@ -1564,5 +1564,7 @@
|
|||
"meetings_are_better_with_the_right": "Meetings are better with the right team members there. Invite them now.",
|
||||
"create_a_one_one_template": "Create a one-one one template for an event type and distribute it to multiple members.",
|
||||
"collective_or_roundrobin": "Collective or round-robin",
|
||||
"book_your_team_members": "Book your team members together with collective events or cycle through to get the right person with round-robin."
|
||||
"book_your_team_members": "Book your team members together with collective events or cycle through to get the right person with round-robin.",
|
||||
"no_availability_selected": "No availability selected. Please select at least one day and time.",
|
||||
"empty_availability": "Empty Availability"
|
||||
}
|
||||
|
|
|
@ -14,7 +14,7 @@ import {
|
|||
DropdownItem,
|
||||
DropdownMenuTrigger,
|
||||
} from "@calcom/ui";
|
||||
import { FiGlobe, FiMoreHorizontal, FiTrash } from "@calcom/ui/components/icon";
|
||||
import { FiAlertCircle, FiGlobe, FiMoreHorizontal, FiTrash } from "@calcom/ui/components/icon";
|
||||
|
||||
export function ScheduleListItem({
|
||||
schedule,
|
||||
|
@ -51,6 +51,12 @@ export function ScheduleListItem({
|
|||
)}
|
||||
</div>
|
||||
<p className="mt-1 text-xs text-gray-500">
|
||||
{schedule.availability.length === 0 && (
|
||||
<div className="flex">
|
||||
<FiAlertCircle color="red" className="mr-1 mt-0.5" />
|
||||
<span className="">{t("no_availability_selected")}</span>
|
||||
</div>
|
||||
)}
|
||||
{schedule.availability
|
||||
.filter((availability) => !!availability.days.length)
|
||||
.map((availability) => (
|
||||
|
|
|
@ -202,6 +202,11 @@ export const eventTypesRouter = router({
|
|||
},
|
||||
},
|
||||
},
|
||||
availability: {
|
||||
select: {
|
||||
id: true,
|
||||
},
|
||||
},
|
||||
...baseEventTypeSelect,
|
||||
});
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user