#598 resource field in event (#634)

Co-authored-by: lethemanh <lethemanh@lethemanhs-MacBook-Pro.local>
This commit is contained in:
lethemanh
2026-03-17 20:11:12 +07:00
committed by GitHub
parent e4fb209147
commit 387e64d58c
21 changed files with 503 additions and 91 deletions
+29
View File
@@ -50,6 +50,7 @@ import RepeatEvent from "./EventRepeat";
import { useAllDayToggle } from "./hooks/useAllDayToggle";
import { combineDateTime, splitDateTime } from "./utils/dateTimeHelpers";
import { validateEventForm } from "./utils/formValidation";
import { Resource, ResourceSearch } from "../Attendees/ResourceSearch";
interface EventFormFieldsProps {
// Form state
@@ -84,6 +85,8 @@ interface EventFormFieldsProps {
setHasVideoConference: (hasVideoConference: boolean) => void;
meetingLink: string | null;
setMeetingLink: (meetingLink: string | null) => void;
selectedResources: Resource[];
setSelectedResources: (resources: Resource[]) => void;
// UI state
showMore: boolean;
@@ -166,6 +169,8 @@ export default function EventFormFields({
onValidationChange,
showValidationErrors = false,
onHasEndDateChangedChange,
selectedResources,
setSelectedResources,
}: EventFormFieldsProps) {
const { t } = useI18n();
@@ -478,6 +483,10 @@ export default function EventFormFields({
onCalendarChange?.(newCalendarId);
};
const handleResourceChange = (resources: Resource[]) => {
setSelectedResources(resources);
};
return (
<>
<FieldWithLabel
@@ -858,6 +867,26 @@ export default function EventFormFields({
{showMore && (
<>
<FieldWithLabel
label={t("event.form.resource")}
isExpanded={showMore}
>
<FormControl fullWidth margin="dense" size="small">
<ResourceSearch
objectTypes={["resource"]}
selectedResources={selectedResources}
inputSlot={(params) => <TextField {...params} size="small" />}
onChange={async (
_event: React.SyntheticEvent,
value: Resource[]
) => {
handleResourceChange(value);
}}
hideLabel={true}
/>
</FormControl>
</FieldWithLabel>
<FieldWithLabel
label={t("event.form.notification")}
isExpanded={showMore}
+1
View File
@@ -72,6 +72,7 @@ export function InfoRow({
alignItems,
gap: 1,
marginBottom: 1,
flexWrap: "wrap",
}}
>
{icon}