calendar and vehicle booking rework
This commit is contained in:
@@ -91,7 +91,10 @@ function buildReverseHierarchy(hierarchy: Record<string, string[]>): Record<stri
|
||||
const PERMISSION_SUB_GROUPS: Record<string, Record<string, string[]>> = {
|
||||
kalender: {
|
||||
'Termine': ['view', 'create'],
|
||||
'Buchungen': ['view_bookings', 'manage_bookings'],
|
||||
},
|
||||
fahrzeugbuchungen: {
|
||||
'Buchungen': ['view', 'create', 'manage'],
|
||||
'Widget': ['widget'],
|
||||
},
|
||||
bestellungen: {
|
||||
'Bestellungen': ['view', 'create', 'manage_orders', 'delete', 'export'],
|
||||
|
||||
@@ -26,6 +26,8 @@ import {
|
||||
import { useQuery } from '@tanstack/react-query';
|
||||
import { useParams, useNavigate } from 'react-router-dom';
|
||||
import DashboardLayout from '../components/dashboard/DashboardLayout';
|
||||
import ServiceModePage from '../components/shared/ServiceModePage';
|
||||
import { usePermissionContext } from '../contexts/PermissionContext';
|
||||
import { useNotification } from '../contexts/NotificationContext';
|
||||
import { bookingApi, fetchVehicles, kategorieApi } from '../services/bookings';
|
||||
import type { CreateBuchungInput, BuchungsArt } from '../types/booking.types';
|
||||
@@ -46,6 +48,7 @@ const EMPTY_FORM: CreateBuchungInput = {
|
||||
function BookingFormPage() {
|
||||
const { id } = useParams<{ id: string }>();
|
||||
const navigate = useNavigate();
|
||||
const { isFeatureEnabled } = usePermissionContext();
|
||||
const notification = useNotification();
|
||||
const isEdit = Boolean(id);
|
||||
|
||||
@@ -231,6 +234,9 @@ function BookingFormPage() {
|
||||
|
||||
return (
|
||||
<DashboardLayout>
|
||||
{!isFeatureEnabled('fahrzeugbuchungen') ? (
|
||||
<ServiceModePage message="Fahrzeugbuchungen befinden sich aktuell im Wartungsmodus." />
|
||||
) : (
|
||||
<Box sx={{ p: 3 }}>
|
||||
<Box sx={{ display: 'flex', alignItems: 'center', mb: 3 }}>
|
||||
<IconButton onClick={() => navigate('/fahrzeugbuchungen')}>
|
||||
@@ -537,6 +543,7 @@ function BookingFormPage() {
|
||||
</Box>
|
||||
</Paper>
|
||||
</Box>
|
||||
)}
|
||||
</DashboardLayout>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -48,6 +48,7 @@ import { useNavigate } from 'react-router-dom';
|
||||
import { format, parseISO } from 'date-fns';
|
||||
import DashboardLayout from '../components/dashboard/DashboardLayout';
|
||||
import ChatAwareFab from '../components/shared/ChatAwareFab';
|
||||
import ServiceModePage from '../components/shared/ServiceModePage';
|
||||
import { useAuth } from '../contexts/AuthContext';
|
||||
import { usePermissionContext } from '../contexts/PermissionContext';
|
||||
import { useNotification } from '../contexts/NotificationContext';
|
||||
@@ -93,7 +94,7 @@ function getCategoryLabel(buchungsArt: BuchungsArt, kategorien: BuchungsKategori
|
||||
|
||||
function FahrzeugBuchungen() {
|
||||
const { user } = useAuth();
|
||||
const { hasPermission } = usePermissionContext();
|
||||
const { hasPermission, isFeatureEnabled } = usePermissionContext();
|
||||
const notification = useNotification();
|
||||
const navigate = useNavigate();
|
||||
const queryClient = useQueryClient();
|
||||
@@ -230,6 +231,10 @@ function FahrzeugBuchungen() {
|
||||
});
|
||||
|
||||
// ── Render ─────────────────────────────────────────────────────────────────
|
||||
if (!isFeatureEnabled('fahrzeugbuchungen')) {
|
||||
return <ServiceModePage message="Fahrzeugbuchungen befinden sich aktuell im Wartungsmodus." />;
|
||||
}
|
||||
|
||||
return (
|
||||
<DashboardLayout>
|
||||
<Container maxWidth="xl" sx={{ py: 3 }}>
|
||||
|
||||
@@ -64,6 +64,7 @@ import {
|
||||
} from '@mui/icons-material';
|
||||
import { useNavigate } from 'react-router-dom';
|
||||
import DashboardLayout from '../components/dashboard/DashboardLayout';
|
||||
import ServiceModePage from '../components/shared/ServiceModePage';
|
||||
import ChatAwareFab from '../components/shared/ChatAwareFab';
|
||||
import { toGermanDateTime, fromGermanDate, fromGermanDateTime } from '../utils/dateInput';
|
||||
|
||||
@@ -1625,7 +1626,7 @@ function VeranstaltungFormDialog({
|
||||
|
||||
export default function Kalender() {
|
||||
const navigate = useNavigate();
|
||||
const { hasPermission } = usePermissionContext();
|
||||
const { hasPermission, isFeatureEnabled } = usePermissionContext();
|
||||
const notification = useNotification();
|
||||
const theme = useTheme();
|
||||
const isMobile = useMediaQuery(theme.breakpoints.down('sm'));
|
||||
@@ -1873,6 +1874,10 @@ export default function Kalender() {
|
||||
|
||||
// ── Render ───────────────────────────────────────────────────────────────────
|
||||
|
||||
if (!isFeatureEnabled('kalender')) {
|
||||
return <ServiceModePage message="Der Kalender befindet sich aktuell im Wartungsmodus." />;
|
||||
}
|
||||
|
||||
return (
|
||||
<DashboardLayout>
|
||||
<Box sx={{ maxWidth: 1100, mx: 'auto' }}>
|
||||
|
||||
Reference in New Issue
Block a user