permission changes
This commit is contained in:
@@ -1135,6 +1135,7 @@ export default function Kalender() {
|
||||
user?.groups?.some((g) => WRITE_GROUPS_EVENTS.includes(g)) ?? false;
|
||||
const canWriteBookings =
|
||||
user?.groups?.some((g) => WRITE_GROUPS_BOOKINGS.includes(g)) ?? false;
|
||||
const canCreateBookings = !!user;
|
||||
|
||||
// ── Tab ─────────────────────────────────────────────────────────────────────
|
||||
const [activeTab, setActiveTab] = useState(0);
|
||||
@@ -1386,7 +1387,7 @@ export default function Kalender() {
|
||||
};
|
||||
|
||||
const handleCellClick = (vehicleId: string, day: Date) => {
|
||||
if (!canWriteBookings) return;
|
||||
if (!canCreateBookings) return;
|
||||
setEditingBooking(null);
|
||||
setBookingForm({
|
||||
...EMPTY_BOOKING_FORM,
|
||||
@@ -1866,7 +1867,7 @@ export default function Kalender() {
|
||||
</Button>
|
||||
</Box>
|
||||
|
||||
{canWriteBookings && (
|
||||
{canCreateBookings && (
|
||||
<Button
|
||||
variant="contained"
|
||||
startIcon={<Add />}
|
||||
@@ -1952,9 +1953,9 @@ export default function Kalender() {
|
||||
}
|
||||
sx={{
|
||||
bgcolor: isFree ? 'success.50' : undefined,
|
||||
cursor: isFree && canWriteBookings ? 'pointer' : 'default',
|
||||
cursor: isFree && canCreateBookings ? 'pointer' : 'default',
|
||||
'&:hover':
|
||||
isFree && canWriteBookings
|
||||
isFree && canCreateBookings
|
||||
? { bgcolor: 'success.100' }
|
||||
: {},
|
||||
p: 0.5,
|
||||
@@ -2043,7 +2044,7 @@ export default function Kalender() {
|
||||
)}
|
||||
|
||||
{/* FAB */}
|
||||
{canWriteBookings && (
|
||||
{canCreateBookings && (
|
||||
<Fab
|
||||
color="primary"
|
||||
sx={{ position: 'fixed', bottom: 32, right: 32 }}
|
||||
|
||||
Reference in New Issue
Block a user