Skip to content

Commit bf50891

Browse files
authored
add neighborhood council to org edit (#2630)
* add neighborhood council to org edit * neighborhood field readonly
1 parent 436aabb commit bf50891

2 files changed

Lines changed: 72 additions & 49 deletions

File tree

client/src/components/Admin/OrganizationEdit.jsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,7 @@ const emptyOrganization = {
171171
submittedUser: "",
172172
approvedDate: "",
173173
approvedUser: "",
174+
neighborhoodName: "",
174175
selectedCategoryIds: [],
175176
hours: [],
176177
instagram: "",
@@ -238,7 +239,7 @@ const OrganizationEdit = (props) => {
238239
const fetchData = async () => {
239240
try {
240241
if (editId) {
241-
const stakeholder = await stakeholderService.getById(editId);
242+
const stakeholder = await stakeholderService.getById(editId);
242243
// For editing purposes, it is better to convert the
243244
// stakeholder.categories array of objects to an array of
244245
// categoryIds as stakeholder.categoryIds

client/src/components/Admin/OrganizationEdit/Identification.jsx

Lines changed: 70 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -644,54 +644,76 @@ export default function Identification({
644644
</div>
645645
</Grid>
646646

647-
<Grid item xs={12} sm={6}>
648-
<Stack direction="column" sx={{ width: "100%" }}>
649-
<Label id="selectedTags-label" label="Tags" />
650-
<Select
651-
id="selectedTags-label"
652-
name="tags"
653-
multiple
654-
fullWidth
655-
value={values.tags || []}
656-
onChange={handleChange}
657-
input={<OutlinedInput />}
658-
displayEmpty
659-
renderValue={(tags) => {
660-
if (!allTags) {
661-
return "Loading tags...";
662-
}
663-
if (tags.length === 0) {
664-
return (
665-
<Typography
666-
variant="body1"
667-
sx={{
668-
fontStyle: "italic",
669-
color: disabledText,
670-
}}
671-
>
672-
Select Tags
673-
</Typography>
674-
);
675-
}
676-
return tags.join(", ");
677-
}}
678-
MenuProps={MenuProps}
679-
>
680-
{!allTags || allTags.length === 0
681-
? null
682-
: allTags.map((t) => (
683-
<MenuItem key={t.name} value={t.name}>
684-
<Checkbox
685-
checked={
686-
values.tags && values.tags.find((tt) => tt === t.name)
687-
}
688-
/>
689-
<ListItemText primary={t.name} />
690-
</MenuItem>
691-
))}
692-
</Select>
693-
<FormHelperText>{touched.tags ? errors.tags : ""}</FormHelperText>
694-
</Stack>
647+
{/* neighborhood council */}
648+
<Grid item xs={12} sx={{ display: "flex", columnGap: "1rem", rowGap: "1rem", flexDirection: { xs: "column", sm: "row" }, }}>
649+
650+
<Grid item xs={12} sm={6}>
651+
<Box>
652+
<Label id="neighborhoodCouncil" label="Neighborhood Council" />
653+
<TextField
654+
id="neighborhoodCouncil"
655+
name="neighborhoodName"
656+
placeholder="Neighborhood Council"
657+
value={values.neighborhoodName ?? ""}
658+
disabled
659+
onChange={handleChange}
660+
onBlur={handleBlur}
661+
helperText={touched.neighborhoodName ? errors.neighborhoodName : ""}
662+
error={touched.neighborhoodName && Boolean(errors.neighborhoodName)}
663+
/>
664+
</Box>
665+
</Grid>
666+
667+
<Grid item xs={12} sm={6} sx={{ display: "flex", alignItems: "flex-end"}}>
668+
<Stack direction="column" sx={{ width: "100%" }}>
669+
<Label id="selectedTags-label" label="Tags" />
670+
<Select
671+
id="selectedTags-label"
672+
name="tags"
673+
multiple
674+
fullWidth
675+
value={values.tags || []}
676+
onChange={handleChange}
677+
input={<OutlinedInput />}
678+
displayEmpty
679+
renderValue={(tags) => {
680+
if (!allTags) {
681+
return "Loading tags...";
682+
}
683+
if (tags.length === 0) {
684+
return (
685+
<Typography
686+
variant="body1"
687+
sx={{
688+
fontStyle: "italic",
689+
color: disabledText,
690+
}}
691+
>
692+
Select Tags
693+
</Typography>
694+
);
695+
}
696+
return tags.join(", ");
697+
}}
698+
MenuProps={MenuProps}
699+
>
700+
{!allTags || allTags.length === 0
701+
? null
702+
: allTags.map((t) => (
703+
<MenuItem key={t.name} value={t.name}>
704+
<Checkbox
705+
checked={
706+
values.tags && values.tags.find((tt) => tt === t.name)
707+
}
708+
/>
709+
<ListItemText primary={t.name} />
710+
</MenuItem>
711+
))}
712+
</Select>
713+
<FormHelperText>{touched.tags ? errors.tags : ""}</FormHelperText>
714+
</Stack>
715+
</Grid>
716+
695717
</Grid>
696718
</Grid>
697719
</TabPanel>

0 commit comments

Comments
 (0)