feat: add date overrides to availability settings atom (#15459)

* remove console.log

* fixup: logic to convert overrides was not calling functions

* refactor handleSubmit function

* add portal to platform dialog component

* cleanup

* add props to enable and disable date overrides

* show date overrides for availability settings atom

* fix: date overrides formatting for api request

---------

Co-authored-by: Rajiv Sahal <[email protected]>
Co-authored-by: supalarry <[email protected]>
Co-authored-by: Morgan <[email protected]>
This commit is contained in:
authored and GitHub committed 2024-06-19 12:19:25 +00:00
1 parent 87d2ec9e75
commit d2d7453962
7 files changed
+74 -50

No files matched your search

@@ -108,11 +108,18 @@ const DateOverrideForm = ({
<Form
form={form}
handleSubmit={(values) => {
if (selectedDates.length === 0) return;
const datesInRanges: TimeRange[] = [];
if (!datesUnavailable) {
if (selectedDates.length === 0) return;
if (datesUnavailable) {
selectedDates.map((date) => {
datesInRanges.push({
start: date.utc(true).startOf("day").toDate(),
end: date.utc(true).startOf("day").toDate(),
});
});
} else {
selectedDates.map((date) => {
values.range.map((item) => {
datesInRanges.push({
@@ -127,16 +134,7 @@ const DateOverrideForm = ({
});
}
onChange(
datesUnavailable
? selectedDates.map((date) => {
return {
start: date.utc(true).startOf("day").toDate(),
end: date.utc(true).startOf("day").toDate(),
};
})
: datesInRanges
);
onChange(datesInRanges);
setSelectedDates([]);
}}
className="p-6 sm:flex sm:p-0 xl:flex-row">