2026-06-30 01:12:33 +02:00
|
|
|
"""Calendar plugin — appointments, tasks, kanban, resources, ICS feed/import, recurrence."""
|
|
|
|
|
|
|
|
|
|
from __future__ import annotations
|
|
|
|
|
|
|
|
|
|
from app.plugins.base import BasePlugin
|
2026-07-23 19:01:18 +02:00
|
|
|
from app.plugins.manifest import PluginManifest, PluginRouteDef, FrontendMenuItem, FrontendPageRoute, FrontendDetailTab
|
2026-06-30 01:12:33 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
class CalendarPlugin(BasePlugin):
|
|
|
|
|
"""Calendar plugin for appointment/task management with recurrence, ICS, and resource booking."""
|
|
|
|
|
|
|
|
|
|
manifest = PluginManifest(
|
|
|
|
|
name="calendar",
|
|
|
|
|
version="1.0.0",
|
|
|
|
|
display_name="Calendar",
|
|
|
|
|
description="Calendar with appointments, tasks, kanban board, recurrence, ICS export/import, resource booking, sharing.",
|
|
|
|
|
dependencies=[],
|
|
|
|
|
routes=[
|
|
|
|
|
PluginRouteDef(
|
|
|
|
|
path="/api/v1/calendars",
|
|
|
|
|
module="app.plugins.builtins.calendar.routes",
|
|
|
|
|
router_attr="calendar_router",
|
|
|
|
|
),
|
|
|
|
|
PluginRouteDef(
|
|
|
|
|
path="/api/v1/resources",
|
|
|
|
|
module="app.plugins.builtins.calendar.routes",
|
|
|
|
|
router_attr="resource_router",
|
|
|
|
|
),
|
|
|
|
|
PluginRouteDef(
|
|
|
|
|
path="/api/v1",
|
|
|
|
|
module="app.plugins.builtins.calendar.routes",
|
|
|
|
|
router_attr="router",
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
events=[],
|
2026-07-24 10:37:44 +02:00
|
|
|
migrations=["0001_initial.sql", "0002_add_deleted_at.sql"],
|
2026-07-23 08:42:26 +02:00
|
|
|
permissions=[
|
|
|
|
|
"calendar:read",
|
|
|
|
|
"calendar:write",
|
|
|
|
|
"calendar:delete",
|
|
|
|
|
"calendar:share",
|
|
|
|
|
"calendar:admin",
|
|
|
|
|
],
|
2026-07-23 19:01:18 +02:00
|
|
|
menu_items=[
|
2026-07-24 21:56:33 +02:00
|
|
|
FrontendMenuItem(label_key='nav.calendar', label='Kalender', path='/calendar', icon='Calendar', order=20),
|
2026-07-23 19:01:18 +02:00
|
|
|
],
|
|
|
|
|
page_routes=[
|
|
|
|
|
FrontendPageRoute(path='/calendar', component='@/pages/Calendar', protected=True),
|
|
|
|
|
],
|
|
|
|
|
detail_tabs=[
|
|
|
|
|
FrontendDetailTab(entity_type='contact', label_key='tabs.calendar', label='Calendar', component='@/components/contact/ContactCalendarTab', icon='Calendar', order=30, permission='calendar:read'),
|
|
|
|
|
],
|
2026-07-26 23:15:34 +02:00
|
|
|
author="LeoCRM Team",
|
|
|
|
|
min_app_version="1.0.0",
|
|
|
|
|
hooks=["calendar.before_appointment", "calendar.after_appointment"],
|
|
|
|
|
contract_version="1.0.0",
|
2026-06-30 01:12:33 +02:00
|
|
|
)
|
2026-07-26 23:15:34 +02:00
|
|
|
|
|
|
|
|
async def on_deactivate(
|
|
|
|
|
self, db, service_container, event_bus
|
|
|
|
|
) -> None:
|
|
|
|
|
"""Deactivate plugin: unregister contract and event listeners."""
|
|
|
|
|
# Contract abmelden
|
|
|
|
|
from app.plugins.builtins.contracts import get_contract_registry
|
|
|
|
|
get_contract_registry().unregister(self.manifest.name)
|
|
|
|
|
await super().on_deactivate(db, service_container, event_bus)
|