Compare commits

...

2 Commits

Author SHA1 Message Date
Alan 863dc99fa0 Update on reading empty data 2023-02-06 13:44:48 -07:00
Alan 057a6f8b52 Added alert when availability its empty 2023-02-06 13:10:09 -07:00
4 changed files with 49 additions and 23 deletions

View File

@ -164,6 +164,9 @@ export const EventTypeList = ({ group, groupIndex, readOnly, types }: EventTypeL
utils.viewer.eventTypes.invalidate();
},
});
const { data } = trpc.viewer.availability.list.useQuery();
const schedulesDefaultAvailability = data?.schedules?.find((schedule) => schedule.isDefault)?.availability;
const emptyDefaultAvailability = schedulesDefaultAvailability?.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.schedule === null && emptyDefaultAvailability && (
<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

View File

@ -25,7 +25,7 @@
"rejection_confirmation": "Reject the booking",
"manage_this_event": "Manage this event",
"invite_team_member": "Invite team member",
"invite_team_notifcation_badge":"Inv.",
"invite_team_notifcation_badge": "Inv.",
"your_event_has_been_scheduled": "Your event has been scheduled",
"your_event_has_been_scheduled_recurring": "Your recurring event has been scheduled",
"accept_our_license": "Accept our license by changing the .env variable <1>NEXT_PUBLIC_LICENSE_CONSENT</1> to '{{agree}}'.",
@ -796,7 +796,7 @@
"number_apps_one": "{{count}} App",
"number_apps_other": "{{count}} Apps",
"trending_apps": "Trending Apps",
"most_popular":"Most Popular",
"most_popular": "Most Popular",
"explore_apps": "{{category}} apps",
"installed_apps": "Installed Apps",
"free_to_use_apps": "Free",
@ -1114,8 +1114,8 @@
"close": "Close",
"upgrade": "Upgrade",
"upgrade_to_access_recordings_title": "Upgrade to access recordings",
"upgrade_to_access_recordings_description":"Recordings are only available as part of our teams plan. Upgrade to start recording your calls",
"recordings_are_part_of_the_teams_plan":"Recordings are part of the teams plan",
"upgrade_to_access_recordings_description": "Recordings are only available as part of our teams plan. Upgrade to start recording your calls",
"recordings_are_part_of_the_teams_plan": "Recordings are part of the teams plan",
"team_feature_teams": "This is a Team feature. Upgrade to Team to see your team's availability.",
"team_feature_workflows": "This is a Team feature. Upgrade to Team to automate your event notifications and reminders with Workflows.",
"show_eventtype_on_profile": "Show on Profile",
@ -1324,7 +1324,7 @@
"password_reset_leading": "If you don't receive an email soon, check that the email address you entered is correct, check your spam folder or reach out to support if the issue persists.",
"password_updated": "Password updated!",
"pending_payment": "Pending payment",
"pending_invites":"Pending Invites",
"pending_invites": "Pending Invites",
"confirmation_page_rainbow": "Token gate your event with tokens or NFTs on Ethereum, Polygon, and more.",
"not_on_cal": "Not on {{appName}}",
"no_calendar_installed": "No calendar installed",
@ -1468,10 +1468,10 @@
"add_an_option": "Add an option",
"radio": "Radio",
"google_meet_warning": "In order to use Google Meet you must set your destination calendar to a Google Calendar",
"individual":"Individual",
"all_bookings_filter_label":"All Bookings",
"all_users_filter_label":"All Users",
"your_bookings_filter_label":"Your Bookings",
"individual": "Individual",
"all_bookings_filter_label": "All Bookings",
"all_users_filter_label": "All Users",
"your_bookings_filter_label": "Your Bookings",
"meeting_url_variable": "Meeting url",
"meeting_url_info": "The event meeting conference url",
"date_overrides": "Date overrides",
@ -1496,11 +1496,11 @@
"not_verified": "Not yet verified",
"no_availability_in_month": "No availability in {{month}}",
"view_next_month": "View next month",
"send_code" : "Send code",
"send_code": "Send code",
"number_verified": "Number Verified",
"create_your_first_team_webhook_description": "Create your first webhook for this team event type",
"create_webhook_team_event_type": "Create a webhook for this team event type",
"disable_success_page":"Disable Success Page (only works if you have a redirect URL)",
"disable_success_page": "Disable Success Page (only works if you have a redirect URL)",
"invalid_admin_password": "You are set as an admin but you do not have a password length of at least 15 characters",
"change_password_admin": "Change Password to gain admin access",
"username_already_taken": "Username is already taken",
@ -1546,16 +1546,16 @@
"delete_sso_configuration_confirmation": "Yes, delete {{connectionType}} configuration",
"delete_sso_configuration_confirmation_description": "Are you sure you want to delete the {{connectionType}} configuration? Your team members who use {{connectionType}} login will no longer be able to access Cal.com.",
"organizer_timezone": "Organizer timezone",
"email_no_user_cta":"Create your account",
"email_user_cta":"View Invitation",
"email_no_user_invite_heading":"Youve been invited to join a team on {{appName}}",
"email_no_user_invite_subheading":"{{invitedBy}} has invited you to join their team on {{appName}}. {{appName}} is the event-juggling scheduler that enables you and your team to schedule meetings without the email tennis.",
"email_no_user_invite_steps_intro":"Well walk you through a few short steps and youll be enjoying stress free scheduling with your team in no time.",
"email_no_user_step_one":"Choose your username",
"email_no_user_step_two":"Connect your calendar account",
"email_no_user_step_three":"Set your Availability",
"email_no_user_step_four":"Join {{teamName}}",
"email_no_user_signoff":"Happy Scheduling from the {{appName}} team",
"email_no_user_cta": "Create your account",
"email_user_cta": "View Invitation",
"email_no_user_invite_heading": "Youve been invited to join a team on {{appName}}",
"email_no_user_invite_subheading": "{{invitedBy}} has invited you to join their team on {{appName}}. {{appName}} is the event-juggling scheduler that enables you and your team to schedule meetings without the email tennis.",
"email_no_user_invite_steps_intro": "Well walk you through a few short steps and youll be enjoying stress free scheduling with your team in no time.",
"email_no_user_step_one": "Choose your username",
"email_no_user_step_two": "Connect your calendar account",
"email_no_user_step_three": "Set your Availability",
"email_no_user_step_four": "Join {{teamName}}",
"email_no_user_signoff": "Happy Scheduling from the {{appName}} team",
"impersonation_user_tip": "You are about to impersonate a user, which means you can make changes on their behalf. Please be careful.",
"scheduler": "{Scheduler}",
"available_variables": "Available variables",
@ -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"
}

View File

@ -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) => (

View File

@ -202,6 +202,16 @@ export const eventTypesRouter = router({
},
},
},
schedule: {
select: {
id: true,
availability: {
select: {
id: true,
},
},
},
},
...baseEventTypeSelect,
});