Skip to content

Commit

Permalink
Merge pull request #160 from r00tat/feature/gb-tabs
Browse files Browse the repository at this point in the history
Feature: Geschäftsbuch Tabs
  • Loading branch information
r00tat authored Sep 30, 2024
2 parents cff597b + e1ab039 commit 70d6a57
Show file tree
Hide file tree
Showing 18 changed files with 526 additions and 277 deletions.
382 changes: 321 additions & 61 deletions package-lock.json

Large diffs are not rendered by default.

5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,9 @@
"@mapbox/togeojson": "^0.16.2",
"@mdi/js": "^7.4.47",
"@mdi/react": "^1.6.1",
"@mui/icons-material": "^5.16.7",
"@mui/material": "^5.16.7",
"@mui/icons-material": "^6.1.1",
"@mui/lab": "^6.0.0-beta.10",
"@mui/material": "^6.1.1",
"@mui/x-data-grid": "^7.18.0",
"@mui/x-date-pickers": "^7.18.0",
"@serwist/next": "^9.0.8",
Expand Down
28 changes: 11 additions & 17 deletions src/app/groups/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import EditIcon from '@mui/icons-material/Edit';
import RefreshIcon from '@mui/icons-material/Refresh';
import Box from '@mui/material/Box';
import Fab from '@mui/material/Fab';
import Grid from '@mui/material/Grid';
import Grid from '@mui/material/Grid2';
import IconButton from '@mui/material/IconButton';
import Tooltip from '@mui/material/Tooltip';
import Typography from '@mui/material/Typography';
Expand Down Expand Up @@ -116,41 +116,35 @@ export default function Groups() {
</IconButton>
</Typography>
<Grid container>
<Grid item xs={2} md={2} lg={2}></Grid>
<Grid item xs={5} md={3} lg={3}>
<Grid size={{ xs: 2, md: 2, lg: 2 }}></Grid>
<Grid size={{ xs: 5, md: 3, lg: 3 }}>
<b>ID</b>
</Grid>
<Grid item xs={5} md={3} lg={3}>
<Grid size={{ xs: 5, md: 3, lg: 3 }}>
<b>Name</b>
</Grid>

<Grid item xs={12} md={4} lg={4}>
<Grid size={{ xs: 12, md: 4, lg: 4 }}>
<b>Description</b>
</Grid>
<Grid item xs={12}>
<Grid size={{ xs: 12 }}>
<hr />
</Grid>

{groups.map((group) => (
<React.Fragment key={`group-${group.id}`}>
<Grid item xs={2} md={2} lg={2}>
<Grid size={{ xs: 2, md: 2, lg: 2 }}>
<GroupRowButtons
row={group}
editFn={editAction}
deleteFn={showDeleteConfirm}
/>
</Grid>
<Grid item xs={5} md={3} lg={3}>
{group.id}
</Grid>
<Grid item xs={5} md={3} lg={3}>
{group.name}
</Grid>
<Grid size={{ xs: 5, md: 3, lg: 3 }}>{group.id}</Grid>
<Grid size={{ xs: 5, md: 3, lg: 3 }}>{group.name}</Grid>

<Grid item xs={12} md={4} lg={4}>
{group.description}
</Grid>
<Grid item xs={12}>
<Grid size={{ xs: 12, md: 4, lg: 4 }}>{group.description}</Grid>
<Grid size={{ xs: 12 }}>
<hr />
</Grid>
</React.Fragment>
Expand Down
28 changes: 13 additions & 15 deletions src/app/users/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import CheckIcon from '@mui/icons-material/Check';
import EditIcon from '@mui/icons-material/Edit';
import RefreshIcon from '@mui/icons-material/Refresh';
import Box from '@mui/material/Box';
import Grid from '@mui/material/Grid';
import Grid from '@mui/material/Grid2';
import IconButton from '@mui/material/IconButton';
import Tooltip from '@mui/material/Tooltip';
import Typography from '@mui/material/Typography';
Expand Down Expand Up @@ -158,49 +158,47 @@ export default function Users() {
</IconButton>
</Typography>
<Grid container>
<Grid item xs={2} md={2} lg={2}></Grid>
<Grid item xs={5} md={6} lg={2}>
<Grid size={{ xs: 2, md: 2, lg: 2 }}></Grid>
<Grid size={{ xs: 5, md: 6, lg: 2 }}>
<b>Name</b>
</Grid>
<Grid item xs={5} md={6} lg={2}>
<Grid size={{ xs: 5, md: 6, lg: 2 }}>
<b>Email</b>
</Grid>

<Grid item xs={6} md={4} lg={2}>
<Grid size={{ xs: 6, md: 4, lg: 2 }}>
<b>Feuerwehr</b>
</Grid>
<Grid item xs={6} md={4} lg={3}>
<Grid size={{ xs: 6, md: 4, lg: 3 }}>
<b>Gruppen</b>
</Grid>
<Grid item xs={12}>
<Grid size={{ xs: 12 }}>
<hr />
</Grid>
{users.map((user) => (
<React.Fragment key={`user-entry-${user.uid}`}>
<Grid item xs={2} md={2} lg={2}>
<Grid size={{ xs: 2, md: 2, lg: 2 }}>
<UserRowButtons
row={user}
authorizeFn={authorizeAction}
editFn={editAction}
/>
</Grid>
<Grid item xs={5} md={6} lg={2}>
<Grid size={{ xs: 5, md: 6, lg: 2 }}>
{user.displayName || ''}
</Grid>
<Grid item xs={5} md={6} lg={2}>
{user.email}
</Grid>
<Grid size={{ xs: 5, md: 6, lg: 2 }}>{user.email}</Grid>

<Grid item xs={6} md={4} lg={2}>
<Grid size={{ xs: 6, md: 4, lg: 2 }}>
{user.feuerwehr} {user.description}
</Grid>
<Grid item xs={6} md={4} lg={3}>
<Grid size={{ xs: 6, md: 4, lg: 3 }}>
{(user.groups || [])
.map((key: string) => groups[key])
.filter((v: string) => v)
.join(', ')}
</Grid>
<Grid item xs={12}>
<Grid size={{ xs: 12 }}>
<hr />
</Grid>
</React.Fragment>
Expand Down
11 changes: 4 additions & 7 deletions src/components/FirecallItems/FirecallItemCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import Card from '@mui/material/Card';
import CardActions from '@mui/material/CardActions';
import CardContent from '@mui/material/CardContent';
import Collapse from '@mui/material/Collapse';
import Grid, { RegularBreakpoints } from '@mui/material/Grid';
import Grid, { GridBaseProps } from '@mui/material/Grid2';
import IconButton, { IconButtonProps } from '@mui/material/IconButton';
import Typography from '@mui/material/Typography';
import { styled } from '@mui/material/styles';
Expand Down Expand Up @@ -41,7 +41,7 @@ const ExpandMore = styled((props: ExpandMoreProps) => {
}),
}));

export interface FirecallItemCardOptions extends RegularBreakpoints {
export interface FirecallItemCardOptions extends GridBaseProps {
item: FirecallItem;
close?: () => void;
subItems?: FirecallItem[];
Expand Down Expand Up @@ -107,7 +107,7 @@ export default function FirecallItemCard({
};

return (
<Grid item xs={12} md={6} lg={4} {...breakpoints}>
<Grid size={{ xs: 12, md: 6, lg: 4 }} {...breakpoints}>
<Card ref={setNodeRef} style={style} {...listeners} {...attributes}>
<CardContent>
<Typography variant="h5" component="div" flex={1}>
Expand Down Expand Up @@ -172,10 +172,7 @@ export default function FirecallItemCard({
<FirecallItemCard
item={si}
key={si.id}
xs={12}
md={12}
lg={6}
xl={4}
size={{ xs: 12, md: 12, lg: 6, xl: 4 }}
draggable={subItemsDraggable}
/>
))}
Expand Down
5 changes: 5 additions & 0 deletions src/components/FirecallItems/elements/FirecallGb.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ export class FirecallGb extends FirecallItemBase {
von: string;
an: string;
ausgehend: boolean;
weiterleitung: string;

public constructor(firecallItem?: GeschaeftsbuchEintrag) {
super(firecallItem);
Expand All @@ -16,6 +17,7 @@ export class FirecallGb extends FirecallItemBase {
this.an = firecallItem?.an ?? '';
this.nummer = firecallItem?.nummer ?? 1;
this.ausgehend = firecallItem?.ausgehend ?? false;
this.weiterleitung = firecallItem?.weiterleitung ?? '';
}

public data(): GeschaeftsbuchEintrag {
Expand All @@ -25,6 +27,7 @@ export class FirecallGb extends FirecallItemBase {
an: this.an,
ausgehend: this.ausgehend,
nummer: this.nummer,
weiterleitung: this.weiterleitung,
} as GeschaeftsbuchEintrag;
}

Expand Down Expand Up @@ -53,6 +56,7 @@ export class FirecallGb extends FirecallItemBase {
an: 'Meldung an',
name: 'Information',
beschreibung: 'Anmerkung',
weiterleitung: 'Weiterleiten an (S1, S2, ...)',
};
}

Expand Down Expand Up @@ -108,6 +112,7 @@ export class FirecallGb extends FirecallItemBase {
</>
)}
{this.ausgehend ? 'Ausgehend' : 'Eingehend'}: {this.name}
Weiterleitung: {this.weiterleitung} <br />
<br />
Anmerkung: {this.beschreibung}
</>
Expand Down
10 changes: 5 additions & 5 deletions src/components/chat/chat-ui.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { useCallback, useEffect, useState } from 'react';

import FormControl from '@mui/material/FormControl';
import FormControlLabel from '@mui/material/FormControlLabel';
import Grid from '@mui/material/Grid';
import Grid from '@mui/material/Grid2';
import IconButton from '@mui/material/IconButton';
import InputAdornment from '@mui/material/InputAdornment';
import InputLabel from '@mui/material/InputLabel';
Expand Down Expand Up @@ -56,7 +56,7 @@ export default function ChatUi() {
<>
<Typography variant="h3">Chat</Typography>
<Grid container>
<Grid item xs={12}>
<Grid size={{ xs: 12 }}>
<FormControlLabel
control={
<Switch
Expand All @@ -72,7 +72,7 @@ export default function ChatUi() {
label="Chat Benachrichtigungen"
/>
</Grid>
<Grid item xs={11}>
<Grid size={{ xs: 11 }}>
<FormControl sx={{ m: 2 }} variant="outlined" fullWidth>
<InputLabel htmlFor="outlined-adornment-password">
Chat Message
Expand Down Expand Up @@ -105,11 +105,11 @@ export default function ChatUi() {
</FormControl>
</Grid>

{/* <Grid item xs={12}>
{/* <Grid size={{xs:12}}>
<Typography>Register: {JSON.stringify(result)}</Typography>
</Grid> */}

<Grid item xs={12}>
<Grid size={{ xs: 12 }}>
<ChatMessages />
</Grid>
</Grid>
Expand Down
4 changes: 2 additions & 2 deletions src/components/chat/messages.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import Grid from '@mui/material/Grid';
import Grid from '@mui/material/Grid2';
import { orderBy } from 'firebase/firestore';
import { ChatMessage } from '../../common/chat';
import useFirebaseCollection from '../../hooks/useFirebaseCollection';
Expand All @@ -21,7 +21,7 @@ export default function ChatMessages({ order = 'desc' }: ChatMessagesProps) {
<>
<Grid container>
{messages.map((m) => (
<Grid item xs={12} key={m.id}>
<Grid size={{ xs: 12 }} key={m.id}>
<MessageBox msg={m} />
</Grid>
))}
Expand Down
1 change: 1 addition & 0 deletions src/components/firebase/firestore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ export interface GeschaeftsbuchEintrag extends FirecallItem {
datum: string;
von?: string;
an?: string;
weiterleitung?: string;
}

export interface MultiPointItem extends FirecallItem {
Expand Down
6 changes: 3 additions & 3 deletions src/components/inputs/DateTimePicker.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import type {} from '@mui/x-date-pickers/themeAugmentation';
import { Moment } from 'moment';
import 'moment/locale/de';
import TimeIcon from '@mui/icons-material/AccessTime';
import Grid from '@mui/material/Grid';
import Grid from '@mui/material/Grid2';
import Tooltip from '@mui/material/Tooltip';
import moment from 'moment';

Expand All @@ -24,7 +24,7 @@ export default function MyDateTimePicker({
// const [value, setValue] = React.useState<Moment | null>(moment());
return (
<Grid container>
<Grid item xs={11}>
<Grid size={{ xs: 11 }}>
<LocalizationProvider dateAdapter={AdapterMoment} adapterLocale="de-DE">
<DateTimePicker
slotProps={{
Expand All @@ -40,7 +40,7 @@ export default function MyDateTimePicker({
/>
</LocalizationProvider>
</Grid>
<Grid item xs={1}>
<Grid size={{ xs: 1 }}>
<Tooltip title="Auf aktuelle Uhrzeit setzten">
<IconButton onClick={() => setValue(moment())}>
<TimeIcon />
Expand Down
6 changes: 3 additions & 3 deletions src/components/pages/Einsaetze.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import Card from '@mui/material/Card';
import CardActions from '@mui/material/CardActions';
import CardContent from '@mui/material/CardContent';
import Fab from '@mui/material/Fab';
import Grid from '@mui/material/Grid';
import Grid from '@mui/material/Grid2';
import IconButton from '@mui/material/IconButton';
import Tooltip from '@mui/material/Tooltip';
import Typography from '@mui/material/Typography';
Expand Down Expand Up @@ -82,7 +82,7 @@ function EinsatzCard({
);

return (
<Grid item xs={12} md={6} lg={4}>
<Grid size={{ xs: 12, md: 6, lg: 4 }}>
<Card>
<CardContent>
<Typography variant="h5" component="div">
Expand Down Expand Up @@ -180,7 +180,7 @@ export default function Einsaetze() {
Einsätze
</Typography>
<Grid container spacing={2}>
<Grid item xs={12}>
<Grid size={{ xs: 12 }}>
<FirecallImport />
</Grid>
{einsaetze.map((einsatz) => (
Expand Down
Loading

0 comments on commit 70d6a57

Please sign in to comment.