-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch '1382/application-datess' of https://github.com/bloom-ho…
…using/bloom into 1382/application-datess
- Loading branch information
Showing
16 changed files
with
1,015 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
112 changes: 112 additions & 0 deletions
112
sites/partners/src/listings/PaperListingDetails/DetailsUnitDrawer.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,112 @@ | ||
import React from "react" | ||
import { | ||
AppearanceStyleType, | ||
t, | ||
GridSection, | ||
ViewItem, | ||
Button, | ||
Drawer, | ||
} from "@bloom-housing/ui-components" | ||
import { Unit } from "@bloom-housing/backend-core/types" | ||
import { getRentType } from "../../../lib/helpers" | ||
|
||
export type UnitDrawer = Unit | null | ||
|
||
type UnitDrawerProps = { | ||
unit: UnitDrawer | ||
setUnitDrawer: (unit: UnitDrawer) => void | ||
} | ||
|
||
const DetailUnitDrawer = ({ unit, setUnitDrawer }: UnitDrawerProps) => { | ||
const rentType = getRentType(unit) | ||
return ( | ||
<Drawer | ||
open={!!unit} | ||
title={t("listings.unit.title")} | ||
ariaDescription={t("listings.unit.title")} | ||
onClose={() => setUnitDrawer(null)} | ||
> | ||
<section className="border rounded-md p-8 bg-white mb-8"> | ||
<GridSection title={t("listings.unit.details")} tinted={true} inset={true} grid={false}> | ||
<GridSection grid columns={4}> | ||
<ViewItem label={t("listings.unit.unitNumber")} children={unit?.number || t("t.n/a")} /> | ||
|
||
<ViewItem label={t("listings.unit.type")} children={unit?.unitType || t("t.n/a")} /> | ||
|
||
<ViewItem | ||
label={t("listings.unit.numBathrooms")} | ||
children={unit?.numBathrooms || t("t.n/a")} | ||
/> | ||
|
||
<ViewItem label={t("listings.unit.floor")} children={unit?.floor || t("t.n/a")} /> | ||
|
||
<ViewItem | ||
label={t("listings.unit.squareFootage")} | ||
children={unit?.sqFeet || t("t.n/a")} | ||
/> | ||
|
||
<ViewItem label={t("listings.unit.unitStatus")} children={unit?.status || t("t.n/a")} /> | ||
|
||
<ViewItem | ||
label={t("listings.unit.minOccupancy")} | ||
children={unit?.minOccupancy || t("t.n/a")} | ||
/> | ||
|
||
<ViewItem | ||
label={t("listings.unit.maxOccupancy")} | ||
children={unit?.maxOccupancy || t("t.n/a")} | ||
/> | ||
</GridSection> | ||
</GridSection> | ||
<GridSection title={t("listings.unit.eligibility")} tinted={true} inset={true} grid={false}> | ||
<GridSection grid columns={4}> | ||
<ViewItem | ||
label={t("listings.unit.amiChart")} | ||
children={unit?.amiChart?.name || t("t.n/a")} | ||
/> | ||
|
||
<ViewItem | ||
label={t("listings.unit.amiPercentage")} | ||
children={unit?.amiPercentage || t("t.n/a")} | ||
/> | ||
</GridSection> | ||
<GridSection columns={4} className="pt-6"> | ||
{rentType === "fixed" && ( | ||
<> | ||
<ViewItem | ||
label={t("t.minimumIncome")} | ||
children={unit?.monthlyIncomeMin || t("t.n/a")} | ||
/> | ||
|
||
<ViewItem | ||
label={t("listings.unit.monthlyRent")} | ||
children={unit?.monthlyRent || t("t.n/a")} | ||
/> | ||
</> | ||
)} | ||
{rentType === "percentage" && ( | ||
<ViewItem | ||
label={t("listings.unit.percentage")} | ||
children={unit?.monthlyRentAsPercentOfIncome || t("t.n/a")} | ||
/> | ||
)} | ||
</GridSection> | ||
</GridSection> | ||
<GridSection title={t("t.accessibility")} tinted={true} inset={true} grid={false}> | ||
<GridSection grid columns={4}> | ||
<ViewItem | ||
label={t("listings.unit.accessibilityPriorityType")} | ||
children={unit?.priorityType || t("t.n/a")} | ||
/> | ||
</GridSection> | ||
</GridSection> | ||
</section> | ||
|
||
<Button styleType={AppearanceStyleType.primary} onClick={() => setUnitDrawer(null)}> | ||
{t("t.done")} | ||
</Button> | ||
</Drawer> | ||
) | ||
} | ||
|
||
export default DetailUnitDrawer |
78 changes: 78 additions & 0 deletions
78
sites/partners/src/listings/PaperListingDetails/sections/DetailUnits.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
import React, { useContext, useMemo } from "react" | ||
import { t, GridSection, MinimalTable, Button, ViewItem } from "@bloom-housing/ui-components" | ||
import { ListingContext } from "../../ListingContext" | ||
import { UnitDrawer } from "../DetailsUnitDrawer" | ||
|
||
type DetailUnitsProps = { | ||
setUnitDrawer: (unit: UnitDrawer) => void | ||
} | ||
|
||
const DetailUnits = ({ setUnitDrawer }: DetailUnitsProps) => { | ||
const listing = useContext(ListingContext) | ||
|
||
const unitTableHeaders = { | ||
number: "listings.unit.number", | ||
unitType: "listings.unit.type", | ||
amiPercentage: "listings.unit.ami", | ||
monthlyRent: "listings.unit.rent", | ||
sqFeet: "listings.unit.sqft", | ||
priorityType: "listings.unit.priorityType", | ||
status: "listings.unit.status", | ||
action: "", | ||
} | ||
|
||
const unitTableData = useMemo( | ||
() => | ||
listing?.units.map((unit) => ({ | ||
number: unit.number, | ||
unitType: t(`listings.unitTypes.${unit.unitType}`), | ||
amiPercentage: unit.amiPercentage, | ||
monthlyRent: unit.monthlyRent, | ||
sqFeet: unit.sqFeet, | ||
priorityType: unit.priorityType, | ||
status: unit.status, | ||
action: ( | ||
<Button | ||
type="button" | ||
className="font-semibold uppercase" | ||
onClick={() => setUnitDrawer(unit)} | ||
unstyled | ||
> | ||
{t("t.view")} | ||
</Button> | ||
), | ||
})), | ||
[listing, setUnitDrawer] | ||
) | ||
|
||
return ( | ||
<GridSection | ||
className="bg-primary-lighter" | ||
title={t("listings.units")} | ||
grid={false} | ||
tinted | ||
inset | ||
> | ||
<GridSection title={t("listings.unit.details")} tinted={true} inset={true} grid={false}> | ||
<GridSection grid columns={1}> | ||
<ViewItem | ||
label={t("listings.unitTypesOrIndividual")} | ||
children={ | ||
listing.disableUnitsAccordion | ||
? t("listings.unit.unitTypes") | ||
: t("listings.unit.individualUnits") | ||
} | ||
/> | ||
</GridSection> | ||
</GridSection> | ||
|
||
{listing.units.length ? ( | ||
<MinimalTable headers={unitTableHeaders} data={unitTableData} /> | ||
) : ( | ||
<span className="text-base font-semibold">{t("t.none")}</span> | ||
)} | ||
</GridSection> | ||
) | ||
} | ||
|
||
export { DetailUnits as default, DetailUnits } |
Oops, something went wrong.