Skip to content

Commit

Permalink
AvailabilityPlanEntries: default should be 1
Browse files Browse the repository at this point in the history
  • Loading branch information
Gnito committed Dec 12, 2024
1 parent 2088898 commit 1434c43
Showing 1 changed file with 8 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -393,18 +393,22 @@ const AvailabilityPlanEntries = props => {
// 'day' and 'night' units use full days
if (useFullDays) {
if (isChecked) {
const seats = useMultipleSeats ? { seats: null } : { seats: 1 };
formApi.mutators.push(dayOfWeek, { startTime: '00:00', endTime: '24:00', seats });
const seats = useMultipleSeats ? { seats: 1 } : { seats: 1 };
formApi.mutators.push(dayOfWeek, {
startTime: '00:00',
endTime: '24:00',
...seats,
});
} else {
formApi.mutators.remove(dayOfWeek, 0);
}
} else {
const shouldAddEntry = isChecked && !hasEntries;
if (shouldAddEntry) {
const seats = useMultipleSeats ? { seats: null } : { seats: 1 };
const seats = useMultipleSeats ? { seats: 1 } : { seats: 1 };
// The 'hour' unit is not initialized with any value,
// because user need to pick them themselves.
formApi.mutators.push(dayOfWeek, { startTime: null, endTime: null, seats });
formApi.mutators.push(dayOfWeek, { startTime: null, endTime: null, ...seats });
} else if (!isChecked) {
// If day of week checkbox is unchecked,
// we'll remove all the entries for that day.
Expand Down

0 comments on commit 1434c43

Please sign in to comment.