Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions api/prisma/seed-staging.ts
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,7 @@ export const stagingSeed = async (
FeatureFlagEnum.enableNeighborhoodAmenitiesDropdown,
FeatureFlagEnum.enableProperties,
FeatureFlagEnum.enableReferralQuestionUnits,
FeatureFlagEnum.enableSmokingPolicyRadio,
],
visibleNeighborhoodAmenities: [
NeighborhoodAmenitiesEnum.groceryStores,
Expand Down
6 changes: 6 additions & 0 deletions api/src/enums/feature-flags/feature-flags-enum.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ export enum FeatureFlagEnum {
enableRegions = 'enableRegions',
enableSection8Question = 'enableSection8Question',
enableSingleUseCode = 'enableSingleUseCode',
enableSmokingPolicyRadio = 'enableSmokingPolicyRadio',
enableSupportAdmin = 'enableSupportAdmin',
enableUnderConstructionHome = 'enableUnderConstructionHome',
enableUnitGroups = 'enableUnitGroups',
Expand Down Expand Up @@ -241,6 +242,11 @@ export const featureFlagMap: {
description:
'When true, the backend allows for logging into this jurisdiction using the single use code flow',
},
{
name: FeatureFlagEnum.enableSmokingPolicyRadio,
description:
"When true, the listing 'Smoking policy' field is a radio group",
},
{
name: FeatureFlagEnum.enableSupportAdmin,
description: 'When true, support admins can be created',
Expand Down
17 changes: 13 additions & 4 deletions api/src/services/listing-csv-export.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -861,10 +861,6 @@ export class ListingCsvExporterService implements CsvExporterServiceInterface {
path: 'unitAmenities',
label: 'Unit Amenities',
},
{
path: 'smokingPolicy',
label: 'Smoking Policy',
},
{
path: 'petPolicy',
label: 'Pets Policy',
Expand All @@ -873,6 +869,19 @@ export class ListingCsvExporterService implements CsvExporterServiceInterface {
path: 'servicesOffered',
label: 'Services Offered',
},
{
path: 'smokingPolicy',
label: 'Smoking Policy',
format: (val: string): string => {
const enableSmokingPolicyRadio =
doAllJurisdictionHaveFeatureFlagSet(
user.jurisdictions,
FeatureFlagEnum.enableSmokingPolicyRadio,
);
if (!val) return enableSmokingPolicyRadio ? 'Policy unknown' : '';
return val;
},
},
],
);

Expand Down
12 changes: 6 additions & 6 deletions api/test/unit/services/listing-csv-export.service.spec.ts

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions shared-helpers/src/types/backend-swagger.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8052,6 +8052,7 @@ export enum FeatureFlagEnum {
"enableRegions" = "enableRegions",
"enableSection8Question" = "enableSection8Question",
"enableSingleUseCode" = "enableSingleUseCode",
"enableSmokingPolicyRadio" = "enableSmokingPolicyRadio",
"enableSupportAdmin" = "enableSupportAdmin",
"enableUnderConstructionHome" = "enableUnderConstructionHome",
"enableUnitGroups" = "enableUnitGroups",
Expand Down
3 changes: 3 additions & 0 deletions sites/partners/page_content/locale_overrides/general.json
Original file line number Diff line number Diff line change
Expand Up @@ -454,6 +454,9 @@
"listings.selectJurisdictionContent": "Once you create this listing, the jurisdiction cannot be changed.",
"listings.selectPreferences": "Select preferences",
"listings.selectPrograms": "Select programs",
"listings.smokingPolicyOptions.noSmokingAllowed": "No smoking allowed",
"listings.smokingPolicyOptions.smokingAllowed": "Smoking allowed",
"listings.smokingPolicyOptions.unknown": "Policy unknown",
"listings.streetAddressOrPOBox": "Street address or PO box",
"listings.totalListings": "Total listings",
"listings.marketing": "Marketing",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,11 @@ const DetailBuildingFeatures = () => {
listing.jurisdictions.id
)

const enableSmokingPolicyRadio = doJurisdictionsHaveFeatureFlagOn(
FeatureFlagEnum.enableSmokingPolicyRadio,
listing.jurisdictions.id
)

return (
<SectionWithGrid heading={t("listings.sections.buildingFeaturesTitle")} inset>
<Grid.Row>
Expand Down Expand Up @@ -59,24 +64,26 @@ const DetailBuildingFeatures = () => {

<Grid.Row>
<Grid.Cell>
<FieldValue id="smokingPolicy" label={t("t.smokingPolicy")}>
{getDetailFieldString(listing.smokingPolicy)}
<FieldValue id="petPolicy" label={t("t.petsPolicy")}>
{getDetailFieldString(listing.petPolicy)}
</FieldValue>
</Grid.Cell>
</Grid.Row>

<Grid.Row>
<Grid.Cell>
<FieldValue id="petPolicy" label={t("t.petsPolicy")}>
{getDetailFieldString(listing.petPolicy)}
<FieldValue id="servicesOffered" label={t("t.servicesOffered")}>
{getDetailFieldString(listing.servicesOffered)}
</FieldValue>
</Grid.Cell>
</Grid.Row>

<Grid.Row>
<Grid.Cell>
<FieldValue id="servicesOffered" label={t("t.servicesOffered")}>
{getDetailFieldString(listing.servicesOffered)}
<FieldValue id="smokingPolicy" label={t("t.smokingPolicy")}>
{enableSmokingPolicyRadio
? listing.smokingPolicy || t("listings.smokingPolicyOptions.unknown")
: getDetailFieldString(listing.smokingPolicy)}
</FieldValue>
</Grid.Cell>
</Grid.Row>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,13 @@ const ListingForm = ({
setListingName,
updateListing,
}: ListingFormProps) => {
const defaultValues = editMode ? listing : formDefaults
const rawDefaultValues = editMode ? listing : formDefaults

const defaultValues: FormListing = {
...rawDefaultValues,
smokingPolicy: rawDefaultValues?.smokingPolicy ?? "",
}

const formMethods = useForm<FormListing>({
defaultValues,
mode: "onBlur",
Expand Down Expand Up @@ -585,6 +591,10 @@ const ListingForm = ({
FeatureFlagEnum.enableAccessibilityFeatures,
jurisdictionId
)}
enableSmokingPolicyRadio={doJurisdictionsHaveFeatureFlagOn(
FeatureFlagEnum.enableSmokingPolicyRadio,
jurisdictionId
)}
requiredFields={requiredFields}
/>
<NeighborhoodAmenities
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,12 @@ import { Grid } from "@bloom-housing/ui-seeds"
import { listingFeatures } from "@bloom-housing/shared-helpers"
import { ListingFeatures } from "@bloom-housing/shared-helpers/src/types/backend-swagger"
import SectionWithGrid from "../../../shared/SectionWithGrid"
import { defaultFieldProps } from "../../../../lib/helpers"
import { defaultFieldProps, getLabel } from "../../../../lib/helpers"
import styles from "../ListingForm.module.scss"

type BuildingFeaturesProps = {
enableAccessibilityFeatures?: boolean
enableSmokingPolicyRadio?: boolean
existingFeatures: ListingFeatures
requiredFields: string[]
}
Expand Down Expand Up @@ -91,23 +92,6 @@ const BuildingFeatures = (props: BuildingFeaturesProps) => {
)}
/>
</Grid.Cell>
<Grid.Cell>
<Textarea
fullWidth={true}
placeholder={""}
register={register}
maxLength={600}
{...defaultFieldProps(
"smokingPolicy",
t("t.smokingPolicy"),
props.requiredFields,
errors,
clearErrors
)}
/>
</Grid.Cell>
</Grid.Row>
<Grid.Row>
<Grid.Cell>
<Textarea
fullWidth={true}
Expand All @@ -123,6 +107,8 @@ const BuildingFeatures = (props: BuildingFeaturesProps) => {
)}
/>
</Grid.Cell>
</Grid.Row>
<Grid.Row>
<Grid.Cell>
<Textarea
fullWidth={true}
Expand All @@ -138,6 +124,54 @@ const BuildingFeatures = (props: BuildingFeaturesProps) => {
)}
/>
</Grid.Cell>
<Grid.Cell>
{props.enableSmokingPolicyRadio ? (
<FieldGroup
type="radio"
name="smokingPolicy"
groupLabel={getLabel("smokingPolicy", props.requiredFields, t("t.smokingPolicy"))}
register={register}
fields={[
{
id: "smokingPolicyNoSmokingAllowed",
dataTestId: "smokingPolicy.noSmokingAllowed",
label: t("listings.smokingPolicyOptions.noSmokingAllowed"),
value: "No smoking allowed",
},
{
id: "smokingPolicySmokingAllowed",
dataTestId: "smokingPolicy.smokingAllowed",
label: t("listings.smokingPolicyOptions.smokingAllowed"),
value: "Smoking allowed",
},
{
id: "smokingPolicyUnknown",
dataTestId: "smokingPolicy.unknown",
label: t("listings.smokingPolicyOptions.unknown"),
value: "",
inputProps: {
//without it empty value is overwritten by id
defaultValue: "",
},
},
]}
/>
) : (
<Textarea
fullWidth={true}
placeholder={""}
register={register}
maxLength={600}
{...defaultFieldProps(
"smokingPolicy",
t("t.smokingPolicy"),
props.requiredFields,
errors,
clearErrors
)}
/>
)}
</Grid.Cell>
</Grid.Row>
{!props.enableAccessibilityFeatures ? null : (
<Grid.Row>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -185,9 +185,6 @@ export const getFeatures = (
if (listing.yearBuilt) {
features.push({ heading: t("t.built"), subheading: listing.yearBuilt })
}
if (listing.smokingPolicy) {
features.push({ heading: t("t.smokingPolicy"), subheading: listing.smokingPolicy })
}
if (listing.petPolicy) {
features.push({ heading: t("t.petsPolicy"), subheading: listing.petPolicy })
}
Expand All @@ -200,6 +197,9 @@ export const getFeatures = (
if (listing.servicesOffered) {
features.push({ heading: t("t.servicesOffered"), subheading: listing.servicesOffered })
}
if (listing.smokingPolicy) {
features.push({ heading: t("t.smokingPolicy"), subheading: listing.smokingPolicy })
}
const accessibilityFeatures = getAccessibilityFeatures(listing)
const enableAccessibilityFeatures = jurisdiction?.featureFlags?.some(
(flag) => flag.name === "enableAccessibilityFeatures" && flag.active
Expand Down
Loading