Skip to content

Commit

Permalink
Merge branch 'main' into select-all-datagrid
Browse files Browse the repository at this point in the history
  • Loading branch information
MiraGeowerkstatt authored Nov 21, 2024
2 parents d9f0fc2 + 9773929 commit 26fb880
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 26 deletions.
36 changes: 18 additions & 18 deletions src/client/src/pages/detail/form/location/nameSegment.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,24 @@ const NameSegment = ({ borehole, editingEnabled, formMethods }: NameSegmentProps
<Card>
<FormSegmentBox>
<FormContainer>
{!auth.anonymousModeEnabled && (
<FormContainer direction="row">
<FormInput
fieldName={"originalName"}
label={"original_name"}
value={borehole?.originalName || ""}
readonly={!editingEnabled}
/>
<TextField
InputProps={{
readOnly: true,
}}
className="readonly"
label={t("workgroup")}
value={borehole?.workgroup?.name || ""}
/>
</FormContainer>
)}
<FormContainer direction="row">
<FormInput
fieldName={"alternateName"}
Expand All @@ -39,24 +57,6 @@ const NameSegment = ({ borehole, editingEnabled, formMethods }: NameSegmentProps
readonly={!editingEnabled}
/>
</FormContainer>
<FormContainer direction="row">
{!auth.anonymousModeEnabled && (
<FormInput
fieldName={"originalName"}
label={"original_name"}
value={borehole?.originalName || ""}
readonly={!editingEnabled}
/>
)}
<TextField
InputProps={{
readOnly: true,
}}
className="readonly"
label={t("workgroup")}
value={borehole?.workgroup?.name || ""}
/>
</FormContainer>
</FormContainer>
</FormSegmentBox>
</Card>
Expand Down
21 changes: 13 additions & 8 deletions src/client/src/pages/overview/boreholeTable/boreholeTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import { LockKeyhole } from "lucide-react";
import { Boreholes, ReduxRootState, User } from "../../../api-lib/ReduxStateInterfaces.ts";
import { useDomains } from "../../../api/fetchApiV2";
import { theme } from "../../../AppTheme.ts";
import { useAuth } from "../../../auth/useBdmsAuth.tsx";
import { muiLocales } from "../../../mui.locales.ts";
import { OverViewContext } from "../overViewContext.tsx";
import { TablePaginationActions } from "./TablePaginationActions.tsx";
Expand Down Expand Up @@ -54,6 +55,7 @@ export const BoreholeTable: FC<BoreholeTableProps> = ({
const history = useHistory();
const domains = useDomains();
const apiRef = useGridApiRef();
const auth = useAuth();
const firstRender = useRef(true);
const { tableScrollPosition, setTableScrollPosition } = useContext(OverViewContext);
const hasLoaded = useRef(false);
Expand Down Expand Up @@ -109,14 +111,6 @@ export const BoreholeTable: FC<BoreholeTableProps> = ({
),
},
{ field: "alternate_name", headerName: t("name"), flex: 1 },
{
field: "workgroup",
valueGetter: (value: { name: string }) => {
return value.name;
},
headerName: t("workgroup"),
flex: 1,
},
{
field: "borehole_type",
valueGetter: (value: number) => {
Expand Down Expand Up @@ -195,6 +189,17 @@ export const BoreholeTable: FC<BoreholeTableProps> = ({
},
];

// Add workgroup column if not in anonymous mode
!auth.anonymousModeEnabled &&
columns.splice(1, 0, {
field: "workgroup",
valueGetter: (value: { name: string }) => {
return value.name;
},
headerName: t("workgroup"),
flex: 1,
});

const handleRowClick: GridEventListener<"rowClick"> = params => {
history.push(`/${params.row.id}/location`);
};
Expand Down

0 comments on commit 26fb880

Please sign in to comment.