-
+
@@ -378,6 +385,7 @@ const ListingForm = ({ listing, editMode }: ListingFormProps) => {
listing={listing}
openHouseEvents={openHouseEvents}
setOpenHouseEvents={setOpenHouseEvents}
+ disableDueDate={isListingActive && !profile.userRoles.isAdmin}
/>
diff --git a/sites/partners/src/components/listings/PaperListingForm/sections/ApplicationDates.tsx b/sites/partners/src/components/listings/PaperListingForm/sections/ApplicationDates.tsx
index edbb36282c..a918beed17 100644
--- a/sites/partners/src/components/listings/PaperListingForm/sections/ApplicationDates.tsx
+++ b/sites/partners/src/components/listings/PaperListingForm/sections/ApplicationDates.tsx
@@ -13,12 +13,14 @@ type ApplicationDatesProps = {
openHouseEvents: TempEvent[]
setOpenHouseEvents: (events: TempEvent[]) => void
listing?: FormListing
+ disableDueDate?: boolean
}
const ApplicationDates = ({
listing,
openHouseEvents,
setOpenHouseEvents,
+ disableDueDate,
}: ApplicationDatesProps) => {
const openHouseHeaders = {
date: "t.date",
@@ -116,7 +118,7 @@ const ApplicationDates = ({
register={register}
watch={watch}
note={t("listings.whenApplicationsClose")}
- disabled={enableDueDate === YesNoEnum.no}
+ disabled={disableDueDate || enableDueDate === YesNoEnum.no}
defaultDate={{
month: listing?.applicationDueDate
? dayjs(new Date(listing?.applicationDueDate)).format("MM")
@@ -137,7 +139,7 @@ const ApplicationDates = ({
id={"applicationDueTimeField"}
register={register}
watch={watch}
- disabled={enableDueDate === YesNoEnum.no}
+ disabled={disableDueDate || enableDueDate === YesNoEnum.no}
defaultValues={{
hours: listing?.applicationDueDate
? dayjs(new Date(listing?.applicationDueDate)).format("hh")
diff --git a/sites/partners/src/components/listings/PaperListingForm/sections/RankingsAndResults.tsx b/sites/partners/src/components/listings/PaperListingForm/sections/RankingsAndResults.tsx
index 1a764bea44..3643892930 100644
--- a/sites/partners/src/components/listings/PaperListingForm/sections/RankingsAndResults.tsx
+++ b/sites/partners/src/components/listings/PaperListingForm/sections/RankingsAndResults.tsx
@@ -16,9 +16,10 @@ import SectionWithGrid from "../../../shared/SectionWithGrid"
type RankingsAndResultsProps = {
listing?: FormListing
+ disableDueDates?: boolean
}
-const RankingsAndResults = ({ listing }: RankingsAndResultsProps) => {
+const RankingsAndResults = ({ listing, disableDueDates }: RankingsAndResultsProps) => {
const formMethods = useFormContext()
// eslint-disable-next-line @typescript-eslint/unbound-method
@@ -79,6 +80,8 @@ const RankingsAndResults = ({ listing }: RankingsAndResultsProps) => {
label: t("listings.firstComeFirstServe"),
value: "reviewOrderFCFS",
id: "reviewOrderFCFS",
+ disabled:
+ disableDueDates && listing?.reviewOrderType === ReviewOrderTypeEnum.lottery,
defaultChecked:
listing?.reviewOrderType === ReviewOrderTypeEnum.firstComeFirstServe,
},
@@ -86,6 +89,9 @@ const RankingsAndResults = ({ listing }: RankingsAndResultsProps) => {
label: t("listings.lotteryTitle"),
value: "reviewOrderLottery",
id: "reviewOrderLottery",
+ disabled:
+ disableDueDates &&
+ listing?.reviewOrderType === ReviewOrderTypeEnum.firstComeFirstServe,
defaultChecked: listing?.reviewOrderType === ReviewOrderTypeEnum.lottery,
},
]}
@@ -105,11 +111,13 @@ const RankingsAndResults = ({ listing }: RankingsAndResultsProps) => {
{
...yesNoRadioOptions[0],
id: "dueDateQuestionYes",
+ disabled: disableDueDates && !listing?.applicationDueDate,
defaultChecked: listing && listing.applicationDueDate !== null,
},
{
...yesNoRadioOptions[1],
id: "dueDateQuestionNo",
+ disabled: disableDueDates && listing?.applicationDueDate !== null,
defaultChecked: listing && !listing.applicationDueDate,
},
]}
@@ -127,6 +135,7 @@ const RankingsAndResults = ({ listing }: RankingsAndResultsProps) => {
id={"lotteryDate"}
register={register}
watch={watch}
+ disabled={disableDueDates}
defaultDate={{
month: lotteryEvent?.startDate
? dayjs(new Date(lotteryEvent?.startDate)).utc().format("MM")
@@ -147,6 +156,7 @@ const RankingsAndResults = ({ listing }: RankingsAndResultsProps) => {
id={"lotteryStartTime"}
register={register}
watch={watch}
+ disabled={disableDueDates}
defaultValues={{
hours: lotteryEvent?.startTime
? dayjs(new Date(lotteryEvent?.startTime)).format("hh")
@@ -168,6 +178,7 @@ const RankingsAndResults = ({ listing }: RankingsAndResultsProps) => {
id={"lotteryEndTime"}
register={register}
watch={watch}
+ disabled={disableDueDates}
defaultValues={{
hours: lotteryEvent?.endTime
? dayjs(new Date(lotteryEvent?.endTime)).format("hh")
diff --git a/sites/partners/src/components/listings/PaperListingForm/sections/Units.tsx b/sites/partners/src/components/listings/PaperListingForm/sections/Units.tsx
index 533f4419bb..49897aaef4 100644
--- a/sites/partners/src/components/listings/PaperListingForm/sections/Units.tsx
+++ b/sites/partners/src/components/listings/PaperListingForm/sections/Units.tsx
@@ -20,9 +20,15 @@ type UnitProps = {
units: TempUnit[]
setUnits: (units: TempUnit[]) => void
disableUnitsAccordion: boolean
+ disableListingAvailability?: boolean
}
-const FormUnits = ({ units, setUnits, disableUnitsAccordion }: UnitProps) => {
+const FormUnits = ({
+ units,
+ setUnits,
+ disableUnitsAccordion,
+ disableListingAvailability,
+}: UnitProps) => {
const [unitDrawerOpen, setUnitDrawerOpen] = useState(false)
const [unitDeleteModal, setUnitDeleteModal] = useState(null)
const [defaultUnit, setDefaultUnit] = useState(null)
@@ -185,6 +191,9 @@ const FormUnits = ({ units, setUnits, disableUnitsAccordion }: UnitProps) => {
id: "availableUnits",
dataTestId: "listingAvailability.availableUnits",
defaultChecked: listing?.reviewOrderType !== ReviewOrderTypeEnum.waitlist,
+ disabled:
+ disableListingAvailability &&
+ listing?.reviewOrderType === ReviewOrderTypeEnum.waitlist,
},
{
label: t("listings.waitlist.open"),
@@ -192,6 +201,9 @@ const FormUnits = ({ units, setUnits, disableUnitsAccordion }: UnitProps) => {
id: "openWaitlist",
dataTestId: "listingAvailability.openWaitlist",
defaultChecked: listing?.reviewOrderType === ReviewOrderTypeEnum.waitlist,
+ disabled:
+ disableListingAvailability &&
+ listing?.reviewOrderType !== ReviewOrderTypeEnum.waitlist,
},
]}
/>