diff --git a/src/ClientApp/cypress/integration/inputform.spec.js b/src/ClientApp/cypress/integration/inputform.spec.js index 7db1e71..2255128 100644 --- a/src/ClientApp/cypress/integration/inputform.spec.js +++ b/src/ClientApp/cypress/integration/inputform.spec.js @@ -47,7 +47,7 @@ describe("Input form tests", () => { .scrollIntoView() .click(); - cy.get("button[type=submit]").should("not.be.visible"); + cy.get("button[type=submit]").should("be.disabled"); cy.get("form[name=bohrung-form]").should("contain", "Bohrung bearbeiten"); cy.get("form[name=bohrung-form]") .find("input[name=bezeichnung]") @@ -55,7 +55,7 @@ describe("Input form tests", () => { .click({ force: true }) .type(" And More"); - cy.contains("button", "Bohrung speichern").scrollIntoView().should("be.visible").scrollIntoView().click(); + cy.contains("button", "Bohrung speichern").scrollIntoView().should("not.be.disabled").scrollIntoView().click(); }); it("Delete Bohrung", function () { diff --git a/src/ClientApp/src/components/BohrprofilForm.js b/src/ClientApp/src/components/BohrprofilForm.js index b408e4f..34ca8ff 100644 --- a/src/ClientApp/src/components/BohrprofilForm.js +++ b/src/ClientApp/src/components/BohrprofilForm.js @@ -1,31 +1,33 @@ import React, { useState, useEffect } from "react"; -import DialogActions from "@mui/material/DialogActions"; -import DialogContent from "@mui/material/DialogContent"; -import DialogTitle from "@mui/material/DialogTitle"; +import { + Autocomplete, + Box, + Button, + DialogActions, + DialogContent, + DialogTitle, + IconButton, + Stack, + Table, + TableBody, + TableCell, + TableHead, + TableRow, + TextField, + Tooltip, + Typography, +} from "@mui/material"; import { Controller, useForm } from "react-hook-form"; -import TextField from "@mui/material/TextField"; -import Table from "@mui/material/Table"; -import IconButton from "@mui/material/IconButton"; -import TableBody from "@mui/material/TableBody"; -import TableCell from "@mui/material/TableCell"; -import TableHead from "@mui/material/TableHead"; -import TableRow from "@mui/material/TableRow"; import EditIcon from "@mui/icons-material/Edit"; import DeleteIcon from "@mui/icons-material/Delete"; import PreviewIcon from "@mui/icons-material/Preview"; import AddCircleIcon from "@mui/icons-material/AddCircle"; import ContentCopyIcon from "@mui/icons-material/ContentCopy"; -import Tooltip from "@mui/material/Tooltip"; -import Accordion from "@mui/material/Accordion"; -import AccordionSummary from "@mui/material/AccordionSummary"; -import AccordionDetails from "@mui/material/AccordionDetails"; -import ExpandMoreIcon from "@mui/icons-material/ExpandMore"; -import { Autocomplete, Box, Button, Typography } from "@mui/material"; +import ArrowLeftIcon from "@mui/icons-material/ArrowLeft"; +import ArrowRightIcon from "@mui/icons-material/ArrowRight"; import { DatePicker } from "@mui/x-date-pickers/DatePicker"; import { LocalizationProvider } from "@mui/x-date-pickers/LocalizationProvider"; import { AdapterDateFns } from "@mui/x-date-pickers/AdapterDateFns"; -import ArrowLeftIcon from "@mui/icons-material/ArrowLeft"; -import ArrowRightIcon from "@mui/icons-material/ArrowRight"; import DetailMap from "./DetailMap"; import DateUserInputs from "./DateUserInputs"; import { CodeTypes } from "./Codetypes"; @@ -59,7 +61,6 @@ export default function BohrprofilForm(props) { const [formationEndtiefeCodes, setFormationEndtiefeCodes] = useState([]); const [openSchichtConfirmation, setOpenSchichtConfirmation] = useState(false); const [openVorkommnisConfirmation, setOpenVorkommnisConfirmation] = useState(false); - const [mapExpanded, setMapExpanded] = useState(true); const [selectedDate, setSelectedDate] = useState(); const currentBohrprofilIndex = @@ -225,350 +226,357 @@ export default function BohrprofilForm(props) { )} - - { - setSelectedDate(value); - //setValue only needed to dirty form - setValue("datum", value, { shouldDirty: true }); - }} - disabled={readOnly} - renderInput={(params) => ( - + + + { + setSelectedDate(value); + //setValue only needed to dirty form + setValue("datum", value, { shouldDirty: true }); + }} + disabled={readOnly} + renderInput={(params) => ( + + )} /> - )} - /> - - ( - - )} - /> - ( - - )} - /> - ( - - )} - /> - ( - a.kurztext.localeCompare(b.kurztext)).map((c) => c.id)} - value={field.value} - getOptionLabel={(option) => tektonikCodes.find((c) => c.id === option)?.kurztext} - onChange={(_, data) => field.onChange(data)} - autoHighlight - renderInput={(params) => ( + + ( )} /> - )} - /> - ( - a.kurztext.localeCompare(b.kurztext)).map((c) => c.id)} - value={field.value} - getOptionLabel={(option) => formationFelsCodes.find((c) => c.id === option)?.kurztext} - onChange={(_, data) => field.onChange(data)} - autoHighlight - renderInput={(params) => ( + ( )} /> - )} - /> - ( - a.kurztext.localeCompare(b.kurztext)).map((c) => c.id)} - value={field.value} - getOptionLabel={(option) => formationEndtiefeCodes.find((c) => c.id === option)?.kurztext} - onChange={(_, data) => field.onChange(data)} - autoHighlight - renderInput={(params) => ( + ( + )} + /> + ( + a.kurztext.localeCompare(b.kurztext)).map((c) => c.id)} + value={field.value} + getOptionLabel={(option) => tektonikCodes.find((c) => c.id === option)?.kurztext} + onChange={(_, data) => field.onChange(data)} + autoHighlight + renderInput={(params) => ( + + )} /> )} /> - )} - /> - ( - a.kurztext.localeCompare(b.kurztext)).map((c) => c.id)} - value={field.value} - getOptionLabel={(option) => qualitaetCodes.find((c) => c.id === option)?.kurztext} - onChange={(_, data) => field.onChange(data)} - autoHighlight - renderInput={(params) => ( + ( + a.kurztext.localeCompare(b.kurztext)).map((c) => c.id)} + value={field.value} + getOptionLabel={(option) => formationFelsCodes.find((c) => c.id === option)?.kurztext} + onChange={(_, data) => field.onChange(data)} + autoHighlight + renderInput={(params) => ( + + )} + /> + )} + /> + ( + a.kurztext.localeCompare(b.kurztext)).map((c) => c.id)} + value={field.value} + getOptionLabel={(option) => formationEndtiefeCodes.find((c) => c.id === option)?.kurztext} + onChange={(_, data) => field.onChange(data)} + autoHighlight + renderInput={(params) => ( + + )} + /> + )} + /> + ( + a.kurztext.localeCompare(b.kurztext)).map((c) => c.id)} + value={field.value} + getOptionLabel={(option) => qualitaetCodes.find((c) => c.id === option)?.kurztext} + onChange={(_, data) => field.onChange(data)} + autoHighlight + renderInput={(params) => ( + + )} + /> + )} + /> + ( )} /> - )} - /> - ( - - )} - /> - {currentBohrprofil?.id && } - setMapExpanded(expanded)} - > - - }>Lokalität der Bohrung - - + {currentBohrprofil?.id && } + + + Lokalität der Bohrung - - - - Schichten ({currentBohrprofil?.schichten ? currentBohrprofil.schichten.length : 0}) - - - - - - - - - {currentBohrprofil?.id == null && ( - Bitte speichern Sie das Bohrprofil bevor Sie Schichten und Vorkommnisse hinzufügen. - )} - {currentBohrprofil?.schichten?.length > 0 && ( - + + Schichten ({currentBohrprofil?.schichten ? currentBohrprofil.schichten.length : 0}) + + + + + + + + + {currentBohrprofil?.id == null && ( + + Bitte speichern Sie das Bohrprofil bevor Sie Schichten und Vorkommnisse hinzufügen. + + )} {currentBohrprofil?.schichten?.length > 0 && ( - - - - Tiefe [m u. T.] - Schichtgrenze - - - - - {currentBohrprofil.schichten.map((schicht) => ( - - {schicht.tiefe} - {schicht.codeSchicht?.kurztext} - - - onEditSchicht(schicht)} name="edit-button" color="primary"> - {readOnly ? : } - - - - onCopySchicht(schicht)} - name="copy-button" - color="primary" - disabled={readOnly} - > - - - - - onDeleteSchicht(schicht)} - name="delete-button" - color="primary" - disabled={readOnly} - > - - - - - - ))} - -
+ + {currentBohrprofil?.schichten?.length > 0 && ( + + + + Tiefe [m u. T.] + Schichtgrenze + + + + + {currentBohrprofil.schichten.map((schicht) => ( + + {schicht.tiefe} + {schicht.codeSchicht?.kurztext} + + + onEditSchicht(schicht)} name="edit-button" color="primary"> + {readOnly ? : } + + + + onCopySchicht(schicht)} + name="copy-button" + color="primary" + disabled={readOnly} + > + + + + + onDeleteSchicht(schicht)} + name="delete-button" + color="primary" + disabled={readOnly} + > + + + + + + ))} + +
+ )} +
)} -
- )} - - Vorkommnisse ({currentBohrprofil?.vorkommnisse ? currentBohrprofil.vorkommnisse.length : 0}) - - - - - - - - - {currentBohrprofil?.vorkommnisse?.length > 0 && ( - + + Vorkommnisse ({currentBohrprofil?.vorkommnisse ? currentBohrprofil.vorkommnisse.length : 0}) + + + + + + + + {currentBohrprofil?.vorkommnisse?.length > 0 && ( - - - - Tiefe [m u.T] - Typ - - - - - {currentBohrprofil.vorkommnisse.map((vorkommnis) => ( - - {vorkommnis.tiefe} - {vorkommnis.typ?.kurztext} - - - onEditVorkommnis(vorkommnis)} name="edit-button" color="primary"> - {readOnly ? : } - - - - onCopyVorkommnis(vorkommnis)} - name="copy-button" - color="primary" - disabled={readOnly} - > - - - - - onDeleteVorkommnis(vorkommnis)} - name="delete-button" - color="primary" - disabled={readOnly} - > - - - - - - ))} - -
+ + {currentBohrprofil?.vorkommnisse?.length > 0 && ( + + + + Tiefe [m u.T] + Typ + + + + + {currentBohrprofil.vorkommnisse.map((vorkommnis) => ( + + {vorkommnis.tiefe} + {vorkommnis.typ?.kurztext} + + + onEditVorkommnis(vorkommnis)} + name="edit-button" + color="primary" + > + {readOnly ? : } + + + + onCopyVorkommnis(vorkommnis)} + name="copy-button" + color="primary" + disabled={readOnly} + > + + + + + onDeleteVorkommnis(vorkommnis)} + name="delete-button" + color="primary" + disabled={readOnly} + > + + + + + + ))} + +
+ )} +
)} -
- )} + +
diff --git a/src/ClientApp/src/components/BohrungForm.js b/src/ClientApp/src/components/BohrungForm.js index 7d4e4ef..f8d340b 100644 --- a/src/ClientApp/src/components/BohrungForm.js +++ b/src/ClientApp/src/components/BohrungForm.js @@ -1,26 +1,28 @@ import React, { useState, useEffect } from "react"; import { Controller, useForm } from "react-hook-form"; -import TextField from "@mui/material/TextField"; -import Table from "@mui/material/Table"; -import IconButton from "@mui/material/IconButton"; -import TableBody from "@mui/material/TableBody"; -import TableCell from "@mui/material/TableCell"; -import TableHead from "@mui/material/TableHead"; -import TableRow from "@mui/material/TableRow"; +import { + Autocomplete, + Box, + Button, + DialogActions, + DialogContent, + DialogTitle, + IconButton, + Stack, + Table, + TableBody, + TableCell, + TableHead, + TableRow, + TextField, + Tooltip, + Typography, +} from "@mui/material"; import EditIcon from "@mui/icons-material/Edit"; import PreviewIcon from "@mui/icons-material/Preview"; import DeleteIcon from "@mui/icons-material/Delete"; import ContentCopyIcon from "@mui/icons-material/ContentCopy"; -import DialogActions from "@mui/material/DialogActions"; -import DialogContent from "@mui/material/DialogContent"; -import DialogTitle from "@mui/material/DialogTitle"; import AddCircleIcon from "@mui/icons-material/AddCircle"; -import Tooltip from "@mui/material/Tooltip"; -import Accordion from "@mui/material/Accordion"; -import AccordionSummary from "@mui/material/AccordionSummary"; -import AccordionDetails from "@mui/material/AccordionDetails"; -import ExpandMoreIcon from "@mui/icons-material/ExpandMore"; -import { Autocomplete, Box, Button, Typography } from "@mui/material"; import { DatePicker } from "@mui/x-date-pickers/DatePicker"; import { LocalizationProvider } from "@mui/x-date-pickers/LocalizationProvider"; import { AdapterDateFns } from "@mui/x-date-pickers/AdapterDateFns"; @@ -29,11 +31,11 @@ import ArrowRightIcon from "@mui/icons-material/ArrowRight"; import DetailMap from "./DetailMap"; import DateUserInputs from "./DateUserInputs"; import ConfirmationDialog from "./ConfirmationDialog"; +import { CodeTypes } from "./Codetypes"; import { getDistance } from "ol/sphere"; import { transform } from "ol/proj"; import { register as registerProjection } from "ol/proj/proj4"; import proj4 from "proj4"; -import { CodeTypes } from "./Codetypes"; export default function BohrungForm(props) { const { @@ -56,7 +58,6 @@ export default function BohrungForm(props) { const [ablenkungCodes, setAblenkungCodes] = useState([]); const [qualitaetCodes, setQualitaetCodes] = useState([]); const [openConfirmation, setOpenConfirmation] = useState(false); - const [mapExpanded, setMapExpanded] = useState(true); const [selectedDate, setSelectedDate] = useState(); const currentBohrungIndex = @@ -215,189 +216,189 @@ export default function BohrungForm(props) { )} - ( - + + ( + + )} /> - )} - /> - ( - ( + + )} /> - )} - /> - - { - setSelectedDate(value); - //setValue only needed to dirty form - setValue("datum", value, { shouldDirty: true }); - }} - disabled={readOnly} - renderInput={(params) => ( - + { + setSelectedDate(value); + //setValue only needed to dirty form + setValue("datum", value, { shouldDirty: true }); + }} + disabled={readOnly} + renderInput={(params) => ( + + )} /> - )} - /> - - ( - + ( + + )} + /> + ( + a.kurztext.localeCompare(b.kurztext)).map((c) => c.id)} + value={field.value} + onChange={(_, data) => field.onChange(data)} + getOptionLabel={(option) => ablenkungCodes.find((c) => c.id === option)?.kurztext} + autoHighlight + renderInput={(params) => ( + + )} + /> + )} /> - )} - /> - ( - a.kurztext.localeCompare(b.kurztext)).map((c) => c.id)} - value={field.value} - onChange={(_, data) => field.onChange(data)} - getOptionLabel={(option) => ablenkungCodes.find((c) => c.id === option)?.kurztext} - autoHighlight - renderInput={(params) => ( + ( + a.kurztext.localeCompare(b.kurztext)).map((c) => c.id)} + value={field.value} + getOptionLabel={(option) => qualitaetCodes.find((c) => c.id === option)?.kurztext} + onChange={(_, data) => field.onChange(data)} + autoHighlight + renderInput={(params) => ( + + )} + /> + )} + /> + ( )} /> - )} - /> - ( - a.kurztext.localeCompare(b.kurztext)).map((c) => c.id)} - value={field.value} - getOptionLabel={(option) => qualitaetCodes.find((c) => c.id === option)?.kurztext} - onChange={(_, data) => field.onChange(data)} - autoHighlight - renderInput={(params) => ( + ( )} /> - )} - /> - ( - - )} - /> - ( - - )} - /> - {currentBohrung?.id && } - - setMapExpanded(expanded)} - > - - }> + {currentBohrung?.id && } + + + {currentInteraction === "add" ? "Position der Bohrung durch Klicken in der Karte wählen" : "Position der Bohrung durch Klicken in der Karte ändern"} - - - + - - - ( - field.onChange(value)} - label="X-Koordinate der Bohrung" - type="number" - variant="standard" - {...register("x_coordinate", { - validate: { - range: (v) => validateXCoordinate(v) || "Die X-Koordinate muss zwischen 2590000 und 2646000 liegen", - distance: (v) => - validateDistance(v, getValues("y_coordinate")) || - "Die Distanz der neu erstellten Bohrung darf nicht mehr als 200m zu den bereits vorhandenen Bohrungen betragen", - }, - })} - error={error !== undefined} - helperText={(error && error.message) || ""} + ( + field.onChange(value)} + label="X-Koordinate der Bohrung" + type="number" + variant="standard" + {...register("x_coordinate", { + validate: { + range: (v) => + validateXCoordinate(v) || "Die X-Koordinate muss zwischen 2590000 und 2646000 liegen", + distance: (v) => + validateDistance(v, getValues("y_coordinate")) || + "Die Distanz der neu erstellten Bohrung darf nicht mehr als 200m zu den bereits vorhandenen Bohrungen betragen", + }, + })} + error={error !== undefined} + helperText={(error && error.message) || ""} + /> + )} /> - )} - /> - ( - field.onChange(value)} - label="Y-Koordinate der Bohrung" - type="number" - variant="standard" - {...register("y_coordinate", { - validate: { - range: (v) => validateYCoordinate(v) || "Die Y-Koordinate muss zwischen 1212000 und 1264000 liegen", - distance: (v) => - validateDistance(getValues("x_coordinate"), v) || - "Die Distanz der neu erstellten Bohrung darf nicht mehr als 200m zu den bereits vorhandenen Bohrungen betragen", - }, - })} - error={error !== undefined} - helperText={(error && error.message) || ""} + ( + field.onChange(value)} + label="Y-Koordinate der Bohrung" + type="number" + variant="standard" + {...register("y_coordinate", { + validate: { + range: (v) => + validateYCoordinate(v) || "Die Y-Koordinate muss zwischen 1212000 und 1264000 liegen", + distance: (v) => + validateDistance(getValues("x_coordinate"), v) || + "Die Distanz der neu erstellten Bohrung darf nicht mehr als 200m zu den bereits vorhandenen Bohrungen betragen", + }, + })} + error={error !== undefined} + helperText={(error && error.message) || ""} + /> + )} /> - )} - /> - - Bohrprofile ({currentBohrung?.bohrprofile ? currentBohrung.bohrprofile.length : 0}) - - - - - - - - - {currentBohrung?.id == null && ( - Bitte speichern Sie die Bohrung bevor Sie Bohrprofile hinzufügen. - )} - {currentBohrung?.bohrprofile?.length > 0 && ( - + + Bohrprofile ({currentBohrung?.bohrprofile ? currentBohrung.bohrprofile.length : 0}) + + + + + + + + + {currentBohrung?.id == null && ( + Bitte speichern Sie die Bohrung bevor Sie Bohrprofile hinzufügen. + )} {currentBohrung?.bohrprofile?.length > 0 && ( - - - - Datum - Endteufe [m] - - - - - {currentBohrung.bohrprofile.map((bohrprofil) => ( - - - {bohrprofil?.datum != null ? new Date(bohrprofil.datum).toLocaleDateString() : null} - - {bohrprofil.endteufe} - - - onEditBohrprofil(bohrprofil)} name="edit-button" color="primary"> - {readOnly ? : } - - - - onCopyBohrprofil(bohrprofil)} - name="copy-button" - color="primary" - disabled={readOnly} - > - - - - - onDeleteBohrprofil(bohrprofil)} - name="delete-button" - color="primary" - disabled={readOnly} - > - - - - - - ))} - -
+ + {currentBohrung?.bohrprofile?.length > 0 && ( + + + + Datum + Endteufe [m] + + + + + {currentBohrung.bohrprofile.map((bohrprofil) => ( + + + {bohrprofil?.datum != null ? new Date(bohrprofil.datum).toLocaleDateString() : null} + + {bohrprofil.endteufe} + + + onEditBohrprofil(bohrprofil)} + name="edit-button" + color="primary" + > + {readOnly ? : } + + + + onCopyBohrprofil(bohrprofil)} + name="copy-button" + color="primary" + disabled={readOnly} + > + + + + + onDeleteBohrprofil(bohrprofil)} + name="delete-button" + color="primary" + disabled={readOnly} + > + + + + + + ))} + +
+ )} +
)} -
- )} +
+
diff --git a/src/ClientApp/src/components/ConfirmationDialog.js b/src/ClientApp/src/components/ConfirmationDialog.js index f96a3a9..8a9b2e9 100644 --- a/src/ClientApp/src/components/ConfirmationDialog.js +++ b/src/ClientApp/src/components/ConfirmationDialog.js @@ -1,10 +1,5 @@ import * as React from "react"; -import Button from "@mui/material/Button"; -import Dialog from "@mui/material/Dialog"; -import DialogActions from "@mui/material/DialogActions"; -import DialogContent from "@mui/material/DialogContent"; -import DialogContentText from "@mui/material/DialogContentText"; -import DialogTitle from "@mui/material/DialogTitle"; +import { Button, Dialog, DialogActions, DialogContent, DialogContentText, DialogTitle } from "@mui/material"; export default function ConfirmationDialog(props) { const { entityName, open, confirm } = props; diff --git a/src/ClientApp/src/components/InputForm.js b/src/ClientApp/src/components/InputForm.js index 03e0154..f13ce32 100644 --- a/src/ClientApp/src/components/InputForm.js +++ b/src/ClientApp/src/components/InputForm.js @@ -1,9 +1,8 @@ import React, { useState, useEffect } from "react"; import MobileStepper from "@mui/material/MobileStepper"; -import Button from "@mui/material/Button"; +import { Button, Tooltip } from "@mui/material"; import KeyboardArrowLeft from "@mui/icons-material/KeyboardArrowLeft"; import CloseIcon from "@mui/icons-material/Close"; -import Tooltip from "@mui/material/Tooltip"; import StandortForm from "./StandortForm"; import BohrungForm from "./BohrungForm"; import BohrprofilForm from "./BohrprofilForm"; diff --git a/src/ClientApp/src/components/Layout.js b/src/ClientApp/src/components/Layout.js index 93af6ff..3695bf6 100644 --- a/src/ClientApp/src/components/Layout.js +++ b/src/ClientApp/src/components/Layout.js @@ -1,23 +1,25 @@ import React, { useState } from "react"; import { createTheme, ThemeProvider } from "@mui/material/styles"; import CssBaseline from "@mui/material/CssBaseline"; -import Box from "@mui/material/Box"; -import Toolbar from "@mui/material/Toolbar"; -import List from "@mui/material/List"; -import Typography from "@mui/material/Typography"; -import Divider from "@mui/material/Divider"; -import IconButton from "@mui/material/IconButton"; +import { + Box, + Divider, + IconButton, + List, + ListItemButton, + ListItemIcon, + ListItemText, + Toolbar, + Tooltip, + Typography, +} from "@mui/material"; import MenuIcon from "@mui/icons-material/Menu"; import ChevronLeftIcon from "@mui/icons-material/ChevronLeft"; import LogoutIcon from "@mui/icons-material/Logout"; -import ListItemButton from "@mui/material/ListItemButton"; -import ListItemIcon from "@mui/material/ListItemIcon"; -import ListItemText from "@mui/material/ListItemText"; import HomeIcon from "@mui/icons-material/Home"; import GroupIcon from "@mui/icons-material/Group"; import InfoIcon from "@mui/icons-material/Info"; import FileDownloadIcon from "@mui/icons-material/FileDownload"; -import Tooltip from "@mui/material/Tooltip"; import { Footer } from "./Footer"; import { AppBar } from "./AppBar"; import { Drawer } from "./Drawer"; diff --git a/src/ClientApp/src/components/Popup.js b/src/ClientApp/src/components/Popup.js index 500574a..e9a996d 100644 --- a/src/ClientApp/src/components/Popup.js +++ b/src/ClientApp/src/components/Popup.js @@ -1,9 +1,5 @@ import React from "react"; -import Card from "@mui/material/Card"; -import CardActions from "@mui/material/CardActions"; -import CardContent from "@mui/material/CardContent"; -import Button from "@mui/material/Button"; -import Typography from "@mui/material/Typography"; +import { Button, Card, CardActions, CardContent, Typography } from "@mui/material"; function Popup(props) { const { popupElement, closePopup, selectedFeature, standorte, popupVisible } = props; diff --git a/src/ClientApp/src/components/SchichtForm.js b/src/ClientApp/src/components/SchichtForm.js index a7f3558..f6a8a9f 100644 --- a/src/ClientApp/src/components/SchichtForm.js +++ b/src/ClientApp/src/components/SchichtForm.js @@ -1,16 +1,18 @@ import React, { useState, useEffect } from "react"; -import DialogActions from "@mui/material/DialogActions"; -import DialogContent from "@mui/material/DialogContent"; -import DialogTitle from "@mui/material/DialogTitle"; +import { + Autocomplete, + Box, + Button, + DialogActions, + DialogContent, + DialogTitle, + IconButton, + Stack, + TextField, + Tooltip, + Typography, +} from "@mui/material"; import { Controller, useForm } from "react-hook-form"; -import TextField from "@mui/material/TextField"; -import IconButton from "@mui/material/IconButton"; -import Tooltip from "@mui/material/Tooltip"; -import Accordion from "@mui/material/Accordion"; -import AccordionSummary from "@mui/material/AccordionSummary"; -import AccordionDetails from "@mui/material/AccordionDetails"; -import ExpandMoreIcon from "@mui/icons-material/ExpandMore"; -import { Autocomplete, Box, Button } from "@mui/material"; import ArrowLeftIcon from "@mui/icons-material/ArrowLeft"; import ArrowRightIcon from "@mui/icons-material/ArrowRight"; import DetailMap from "./DetailMap"; @@ -35,8 +37,6 @@ export default function SchichtForm(props) { const [qualitaetCodes, setQualitaetCodes] = useState([]); const [codeSchichten, setCodeschichten] = useState([]); - const [mapExpanded, setMapExpanded] = useState(true); - const currentSchichtIndex = currentBohrprofil.schichten?.indexOf(currentBohrprofil.schichten.find((b) => b.id === currentSchicht?.id)) || 0; @@ -97,132 +97,133 @@ export default function SchichtForm(props) { )} - ( - - )} - /> - ( - a.kurztext.localeCompare(b.kurztext)).map((c) => c.id)} - value={field.value} - getOptionLabel={(option) => codeSchichten.find((c) => c.id === option)?.kurztext} - onChange={(_, data) => field.onChange(data)} - autoHighlight - renderInput={(params) => ( + + + ( )} /> - )} - /> - ( - ( + a.kurztext.localeCompare(b.kurztext)).map((c) => c.id)} + value={field.value} + getOptionLabel={(option) => codeSchichten.find((c) => c.id === option)?.kurztext} + onChange={(_, data) => field.onChange(data)} + autoHighlight + renderInput={(params) => ( + + )} + /> + )} /> - )} - /> - ( - a.kurztext.localeCompare(b.kurztext)).map((c) => c.id)} - value={field.value} - getOptionLabel={(option) => qualitaetCodes.find((c) => c.id === option)?.kurztext} - onChange={(_, data) => field.onChange(data)} - sx={{ width: "47%" }} - autoHighlight - renderInput={(params) => ( + ( + )} + /> + ( + a.kurztext.localeCompare(b.kurztext)).map((c) => c.id)} + value={field.value} + getOptionLabel={(option) => qualitaetCodes.find((c) => c.id === option)?.kurztext} + onChange={(_, data) => field.onChange(data)} + sx={{ width: "47%" }} + autoHighlight + renderInput={(params) => ( + + )} /> )} /> - )} - /> - ( - ( + + )} /> - )} - /> - {currentSchicht?.id && } - setMapExpanded(expanded)} - > - - }>Lokalität der Bohrung - - + {currentSchicht?.id && } + + + Lokalität der Bohrung - - + + diff --git a/src/ClientApp/src/components/Search.js b/src/ClientApp/src/components/Search.js index 222da17..9ac48e2 100644 --- a/src/ClientApp/src/components/Search.js +++ b/src/ClientApp/src/components/Search.js @@ -1,7 +1,6 @@ import React from "react"; import { Controller, useForm } from "react-hook-form"; -import TextField from "@mui/material/TextField"; -import { Autocomplete, Box, Button, Typography } from "@mui/material"; +import { Autocomplete, Box, Button, TextField, Typography } from "@mui/material"; import { DatePicker } from "@mui/x-date-pickers/DatePicker"; import { LocalizationProvider } from "@mui/x-date-pickers/LocalizationProvider"; import { AdapterDateFns } from "@mui/x-date-pickers/AdapterDateFns"; diff --git a/src/ClientApp/src/components/SearchResults.js b/src/ClientApp/src/components/SearchResults.js index d2a719c..82a82af 100644 --- a/src/ClientApp/src/components/SearchResults.js +++ b/src/ClientApp/src/components/SearchResults.js @@ -1,18 +1,20 @@ import React, { useEffect } from "react"; -import Table from "@mui/material/Table"; -import TableBody from "@mui/material/TableBody"; -import TableCell from "@mui/material/TableCell"; -import TableHead from "@mui/material/TableHead"; -import TableFooter from "@mui/material/TableFooter"; -import TableRow from "@mui/material/TableRow"; -import TablePagination from "@mui/material/TablePagination"; +import { + IconButton, + Table, + TableBody, + TableCell, + TableHead, + TableRow, + TableFooter, + TablePagination, + Tooltip, +} from "@mui/material"; import EditIcon from "@mui/icons-material/Edit"; import DeleteIcon from "@mui/icons-material/Delete"; import PreviewIcon from "@mui/icons-material/Preview"; -import IconButton from "@mui/material/IconButton"; import Title from "./Title"; import { UserRolesMap } from "../UserRolesMap"; -import Tooltip from "@mui/material/Tooltip"; export default function SearchResults(props) { const { standorte, openEditForm, onDeleteStandort, currentUser } = props; diff --git a/src/ClientApp/src/components/SnackbarMessage.js b/src/ClientApp/src/components/SnackbarMessage.js index 65b1fff..40898b4 100644 --- a/src/ClientApp/src/components/SnackbarMessage.js +++ b/src/ClientApp/src/components/SnackbarMessage.js @@ -1,6 +1,5 @@ import * as React from "react"; -import Alert from "@mui/material/Alert"; -import Snackbar from "@mui/material/Snackbar"; +import { Alert, Snackbar } from "@mui/material"; export default function SnackbarMessage(props) { const { showSuccessAlert, setShowSuccessAlert, message, variant } = props; diff --git a/src/ClientApp/src/components/StandortForm.js b/src/ClientApp/src/components/StandortForm.js index 29a3460..7ab95af 100644 --- a/src/ClientApp/src/components/StandortForm.js +++ b/src/ClientApp/src/components/StandortForm.js @@ -1,34 +1,33 @@ import React, { useState, useEffect } from "react"; import { Controller, useForm } from "react-hook-form"; -import TextField from "@mui/material/TextField"; -import Table from "@mui/material/Table"; -import IconButton from "@mui/material/IconButton"; +import { + Box, + Button, + DialogActions, + DialogContent, + DialogTitle, + FormControlLabel, + IconButton, + Stack, + Table, + TableBody, + TableCell, + TableHead, + TableRow, + TextField, + Tooltip, + Typography, +} from "@mui/material"; import DeleteIcon from "@mui/icons-material/Delete"; import ContentCopyIcon from "@mui/icons-material/ContentCopy"; -import TableBody from "@mui/material/TableBody"; -import TableCell from "@mui/material/TableCell"; -import TableHead from "@mui/material/TableHead"; -import TableRow from "@mui/material/TableRow"; import EditIcon from "@mui/icons-material/Edit"; import PreviewIcon from "@mui/icons-material/Preview"; -import DialogActions from "@mui/material/DialogActions"; -import DialogContent from "@mui/material/DialogContent"; -import DialogTitle from "@mui/material/DialogTitle"; -import Typography from "@mui/material/Typography"; import AddCircleIcon from "@mui/icons-material/AddCircle"; -import Tooltip from "@mui/material/Tooltip"; -import Accordion from "@mui/material/Accordion"; -import AccordionSummary from "@mui/material/AccordionSummary"; -import AccordionDetails from "@mui/material/AccordionDetails"; -import ExpandMoreIcon from "@mui/icons-material/ExpandMore"; -import Button from "@mui/material/Button"; -import Box from "@mui/material/Box"; import DetailMap from "./DetailMap"; import ConfirmationDialog from "./ConfirmationDialog"; import DateUserInputs from "./DateUserInputs"; import Checkbox from "@mui/material/Checkbox"; import FormGroup from "@mui/material/FormGroup"; -import FormControlLabel from "@mui/material/FormControlLabel"; import { CodeTypes } from "./Codetypes"; import { UserRolesMap } from "../UserRolesMap"; @@ -51,7 +50,6 @@ export default function StandortForm(props) { const { isDirty } = formState; const [openConfirmation, setOpenConfirmation] = useState(false); - const [mapExpanded, setMapExpanded] = useState(true); const [afuFreigabe, setAfuFreigabe] = useState(); const onAddBohrung = () => { @@ -116,201 +114,200 @@ export default function StandortForm(props) { {currentStandort ? "Standort bearbeiten" : "Standort erstellen"} - ( - + + ( + + )} /> - )} - /> - ( - ( + + )} /> - )} - /> - - - - - - - {currentUser?.role !== UserRolesMap.Extern && ( - - ( - { - field.onChange(e.target.checked); - setAfuFreigabe(e.target.checked); - }} + + + + + + + {currentUser?.role !== UserRolesMap.Extern && ( + + ( + { + field.onChange(e.target.checked); + setAfuFreigabe(e.target.checked); + }} + /> + )} + {...register("freigabeAfu")} /> - )} - {...register("freigabeAfu")} + } /> - } - /> - - )} - - + + )} + + - - - - {currentStandort?.id == null && ( - Bitte speichern Sie den Standort bevor Sie Bohrungen hinzufügen. - )} - {currentStandort?.bohrungen?.length > 0 && ( - setMapExpanded(expanded)} - > - - }>Lokalität der Bohrungen - + + + + {currentStandort?.id == null && ( + + Bitte speichern Sie den Standort bevor Sie Bohrungen hinzufügen. + + )} + + + Lokalität der Bohrungen + + + Bohrungen ({currentStandort?.bohrungen ? currentStandort.bohrungen.length : 0}) + + + + + + + + {currentStandort?.bohrungen?.length > 0 && ( - - - + + + + Bezeichnung + Datum + + + + + {currentStandort.bohrungen.map((bohrung) => ( + + {bohrung.bezeichnung} + {(bohrung.datum && new Date(bohrung.datum).toLocaleDateString()) || null} + + + onEditBohrung(bohrung)} name="edit-button" color="primary"> + {readOnly ? : } + + + + onCopyBohrung(bohrung)} + name="copy-button" + color="primary" + disabled={readOnly} + > + + + + + onDeleteBohrung(bohrung)} + name="delete-button" + color="primary" + aria-label="delete bohrung" + disabled={readOnly} + > + + + + + + ))} + +
)} - - )} - - Bohrungen ({currentStandort?.bohrungen ? currentStandort.bohrungen.length : 0}) - - - - - - - - - {currentStandort?.bohrungen?.length > 0 && ( - - - - Bezeichnung - Datum - - - - - {currentStandort.bohrungen.map((bohrung) => ( - - {bohrung.bezeichnung} - {(bohrung.datum && new Date(bohrung.datum).toLocaleDateString()) || null} - - - onEditBohrung(bohrung)} name="edit-button" color="primary"> - {readOnly ? : } - - - - onCopyBohrung(bohrung)} - name="copy-button" - color="primary" - disabled={readOnly} - > - - - - - onDeleteBohrung(bohrung)} - name="delete-button" - color="primary" - aria-label="delete bohrung" - disabled={readOnly} - > - - - - - - ))} - -
- )} +
+
diff --git a/src/ClientApp/src/components/UserInputForm.js b/src/ClientApp/src/components/UserInputForm.js index c2b67b8..5d6747a 100644 --- a/src/ClientApp/src/components/UserInputForm.js +++ b/src/ClientApp/src/components/UserInputForm.js @@ -1,14 +1,7 @@ import React from "react"; import { Controller, useForm } from "react-hook-form"; import { UserRolesMap } from "../UserRolesMap"; -import TextField from "@mui/material/TextField"; -import DialogActions from "@mui/material/DialogActions"; -import DialogContent from "@mui/material/DialogContent"; -import DialogTitle from "@mui/material/DialogTitle"; -import MenuItem from "@mui/material/MenuItem"; - -import Box from "@mui/material/Box"; -import Button from "@mui/material/Button"; +import { Box, Button, DialogActions, DialogContent, DialogTitle, MenuItem, TextField } from "@mui/material"; export default function UserInputForm(props) { const { control, handleSubmit } = useForm(); diff --git a/src/ClientApp/src/components/UserList.js b/src/ClientApp/src/components/UserList.js index 6e8eac3..a48b764 100644 --- a/src/ClientApp/src/components/UserList.js +++ b/src/ClientApp/src/components/UserList.js @@ -1,17 +1,19 @@ import React from "react"; -import Table from "@mui/material/Table"; -import TableBody from "@mui/material/TableBody"; -import TableCell from "@mui/material/TableCell"; -import TableHead from "@mui/material/TableHead"; -import TableFooter from "@mui/material/TableFooter"; -import TableRow from "@mui/material/TableRow"; -import TablePagination from "@mui/material/TablePagination"; +import { + IconButton, + Table, + TableBody, + TableCell, + TableHead, + TableRow, + TableFooter, + TablePagination, + Tooltip, +} from "@mui/material"; import EditIcon from "@mui/icons-material/Edit"; import DeleteIcon from "@mui/icons-material/Delete"; -import IconButton from "@mui/material/IconButton"; import Title from "./Title"; import { UserRolesMap } from "../UserRolesMap"; -import Tooltip from "@mui/material/Tooltip"; export default function UserList(props) { const { users, openEditForm, onDelete } = props; diff --git a/src/ClientApp/src/components/VorkommnisForm.js b/src/ClientApp/src/components/VorkommnisForm.js index bc916d8..5d457e8 100644 --- a/src/ClientApp/src/components/VorkommnisForm.js +++ b/src/ClientApp/src/components/VorkommnisForm.js @@ -1,16 +1,18 @@ import React, { useState, useEffect } from "react"; -import DialogActions from "@mui/material/DialogActions"; -import DialogContent from "@mui/material/DialogContent"; -import DialogTitle from "@mui/material/DialogTitle"; +import { + Autocomplete, + Box, + Button, + DialogActions, + DialogContent, + DialogTitle, + IconButton, + Stack, + TextField, + Tooltip, + Typography, +} from "@mui/material"; import { Controller, useForm } from "react-hook-form"; -import TextField from "@mui/material/TextField"; -import IconButton from "@mui/material/IconButton"; -import Tooltip from "@mui/material/Tooltip"; -import Accordion from "@mui/material/Accordion"; -import AccordionSummary from "@mui/material/AccordionSummary"; -import AccordionDetails from "@mui/material/AccordionDetails"; -import ExpandMoreIcon from "@mui/icons-material/ExpandMore"; -import { Autocomplete, Box, Button } from "@mui/material"; import ArrowLeftIcon from "@mui/icons-material/ArrowLeft"; import ArrowRightIcon from "@mui/icons-material/ArrowRight"; import DetailMap from "./DetailMap"; @@ -35,8 +37,6 @@ export default function VorkommnisForm(props) { const [qualitaetCodes, setQualitaetCodes] = useState([]); const [typCodes, setTypCodes] = useState([]); - const [mapExpanded, setMapExpanded] = useState(true); - const currentVorkommnisIndex = currentBohrprofil.vorkommnisse?.indexOf( currentBohrprofil.vorkommnisse.find((b) => b.id === currentVorkommnis?.id) @@ -98,123 +98,124 @@ export default function VorkommnisForm(props) { )} - ( - - )} - /> - ( - a.kurztext.localeCompare(b.kurztext)).map((c) => c.id)} - value={field.value} - getOptionLabel={(option) => typCodes.find((c) => c.id === option)?.kurztext} - onChange={(_, data) => field.onChange(data)} - autoHighlight - renderInput={(params) => ( + + + ( )} /> - )} - /> - ( - ( + a.kurztext.localeCompare(b.kurztext)).map((c) => c.id)} + value={field.value} + getOptionLabel={(option) => typCodes.find((c) => c.id === option)?.kurztext} + onChange={(_, data) => field.onChange(data)} + autoHighlight + renderInput={(params) => ( + + )} + /> + )} + /> + ( + + )} /> - )} - /> - ( - a.kurztext.localeCompare(b.kurztext)).map((c) => c.id)} - value={field.value} - getOptionLabel={(option) => qualitaetCodes.find((c) => c.id === option)?.kurztext} - onChange={(_, data) => field.onChange(data)} - sx={{ width: "47%" }} - autoHighlight - renderInput={(params) => ( - + ( + a.kurztext.localeCompare(b.kurztext)).map((c) => c.id)} + value={field.value} + getOptionLabel={(option) => qualitaetCodes.find((c) => c.id === option)?.kurztext} + onChange={(_, data) => field.onChange(data)} + sx={{ width: "47%" }} + autoHighlight + renderInput={(params) => ( + + )} + /> )} /> - )} - /> - ( - ( + + )} /> - )} - /> - {currentVorkommnis?.id && } - setMapExpanded(expanded)} - > - - }>Lokalität der Bohrung - - + {currentVorkommnis?.id && } + + + Lokalität der Bohrung - - + + diff --git a/src/ClientApp/src/components/pages/Home.js b/src/ClientApp/src/components/pages/Home.js index 1147cf9..e6bb673 100644 --- a/src/ClientApp/src/components/pages/Home.js +++ b/src/ClientApp/src/components/pages/Home.js @@ -1,17 +1,10 @@ import React, { useState, useEffect } from "react"; -import Box from "@mui/material/Box"; -import Toolbar from "@mui/material/Toolbar"; -import Container from "@mui/material/Container"; -import Grid from "@mui/material/Grid"; -import Paper from "@mui/material/Paper"; +import { Box, Button, Container, Dialog, Grid, Paper, Toolbar, Tooltip } from "@mui/material"; +import AddIcon from "@mui/icons-material/Add"; import InputForm from "../InputForm"; import SearchResults from "../SearchResults"; import Search from "../Search"; import MainMap from "../MainMap"; -import Dialog from "@mui/material/Dialog"; -import Tooltip from "@mui/material/Tooltip"; -import Button from "@mui/material/Button"; -import AddIcon from "@mui/icons-material/Add"; import SnackbarMessage from "../SnackbarMessage"; import ConfirmationDialog from "../ConfirmationDialog"; import { UserRolesMap } from "../../UserRolesMap"; @@ -238,7 +231,7 @@ export function Home(props) { )} - +