Skip to content

Commit

Permalink
fix media services details form
Browse files Browse the repository at this point in the history
  • Loading branch information
lucia-gomez committed Apr 3, 2024
1 parent 3ce1f70 commit b805199
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,6 @@ const FormInput = ({ handleParentSubmit }) => {

const onSubmit: SubmitHandler<Inputs> = (data) => {
const dumpMediaServices = data.mediaServices || [];
//@ts-ignore
data.mediaServices = Array.isArray(dumpMediaServices)
? dumpMediaServices.join(', ')
: dumpMediaServices;
Expand All @@ -93,15 +92,7 @@ const FormInput = ({ handleParentSubmit }) => {
};

return (
<form
className="py-10 items-center"
//onSubmit={(e) => {
// e.preventDefault();
// const values = Object.values(data);
// handleParentSubmit(values, data);
//}}
onSubmit={handleSubmit(onSubmit)}
>
<form className="py-10 items-center" onSubmit={handleSubmit(onSubmit)}>
{userEmail == null && (
<div className="mb-6">
<label
Expand Down Expand Up @@ -586,7 +577,7 @@ const FormInput = ({ handleParentSubmit }) => {
))}
</div>
</div>
{watch('mediaServices') !== undefined && (
{watch('mediaServices').length > 0 && (
<div className="mb-6">
<label
htmlFor="mediaServicesDetails"
Expand Down Expand Up @@ -615,12 +606,17 @@ const FormInput = ({ handleParentSubmit }) => {
<br />
</label>
<p className="text-xs"></p>
{errors.mediaServicesDetails && (
<ErrorMessage errors={errors.mediaServicesDetails.message} />
)}
<input
type="text"
id="mediaServicesDetails"
className="bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-[600px] p-2.5 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500"
placeholder=""
{...register('mediaServicesDetails')}
{...register('mediaServicesDetails', {
required: watch('mediaServices').length > 0,
})}
/>
</div>
)}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,13 +117,13 @@ export default function useSubmitBooking(): [
formatDate(new Date()),
]);

const isAutoApproval = (selectedRoomIds, data) => {
const isAutoApproval = (selectedRoomIds: string[], data: Booking) => {
// If the selected rooms are all instant approval rooms and the user does not need catering, and hire security, and room setup, then it is auto-approval.
return (
selectedRoomIds.every((r) => INSTANT_APPROVAL_ROOMS.includes(r)) &&
data['catering'] === 'no' &&
data['hireSecurity'] === 'no' &&
data['mediaServices'] === '' &&
data['mediaServices'].length === 0 &&
data['roomSetup'] === 'no'
);
};
Expand Down

0 comments on commit b805199

Please sign in to comment.