using own fullcalendar component
This commit is contained in:
@@ -1,27 +0,0 @@
|
||||
# dashboard/callbacks/appointments_callbacks.py
|
||||
import dash
|
||||
from dash import Input, Output, State, dcc
|
||||
from flask import session
|
||||
from utils.db import execute_query, execute_non_query
|
||||
|
||||
@dash.callback(
|
||||
Output("appointments-feedback", "children"),
|
||||
Input("btn-add-appointment", "n_clicks"),
|
||||
State("input-client-id", "value"),
|
||||
State("input-appointment-date", "date"),
|
||||
State("input-appointment-time", "value"),
|
||||
State("input-appointment-desc", "value"),
|
||||
prevent_initial_call=True
|
||||
)
|
||||
def add_appointment(n_clicks, client_id, date, time_str, desc):
|
||||
if "role" not in session:
|
||||
return dcc.Location(href="/login")
|
||||
if n_clicks and n_clicks > 0:
|
||||
datetime_str = f"{date} {time_str}:00"
|
||||
sql = """
|
||||
INSERT INTO appointments (client_id, start_datetime, description)
|
||||
VALUES (%s, %s, %s)
|
||||
"""
|
||||
rc = execute_non_query(sql, (client_id, datetime_str, desc))
|
||||
return "Erstellt." if rc else "Fehler beim Anlegen."
|
||||
return ""
|
||||
36
dashboard/callbacks/appointments_callbacks.py
Normal file
36
dashboard/callbacks/appointments_callbacks.py
Normal file
@@ -0,0 +1,36 @@
|
||||
# dashboard/callbacks/appointments_callbacks.py
|
||||
import sys
|
||||
sys.path.append('/workspace')
|
||||
from dash import Input, Output, State, callback, ctx, dash
|
||||
from flask import session
|
||||
import json
|
||||
|
||||
print("appointments_callbacks.py geladen")
|
||||
|
||||
@callback(
|
||||
dash.Output('output', 'children'),
|
||||
dash.Input('calendar', 'lastDateClick')
|
||||
)
|
||||
def display_date(date_str):
|
||||
if date_str:
|
||||
return f"Letzter Klick auf: {date_str}"
|
||||
return "Klicke auf ein Datum im Kalender!"
|
||||
|
||||
@callback(
|
||||
dash.Output('event-output', 'children'),
|
||||
dash.Input('calendar', 'lastEventClick')
|
||||
)
|
||||
def display_event(event_id):
|
||||
if event_id:
|
||||
return f"Letztes Event geklickt: {event_id}"
|
||||
return "Klicke auf ein Event im Kalender!"
|
||||
|
||||
@callback(
|
||||
dash.Output('select-output', 'children'),
|
||||
dash.Input('calendar', 'lastSelect')
|
||||
)
|
||||
def display_select(select_info):
|
||||
if select_info:
|
||||
return f"Markiert: {select_info['start']} bis {select_info['end']} (ganztägig: {select_info['allDay']})"
|
||||
return "Markiere einen Bereich im Kalender!"
|
||||
|
||||
@@ -15,6 +15,8 @@ import time
|
||||
import pytz
|
||||
from datetime import datetime
|
||||
|
||||
print("overview_callbacks.py geladen")
|
||||
|
||||
API_BASE_URL = os.getenv("API_BASE_URL", "http://192.168.43.100")
|
||||
|
||||
mqtt_thread_started = False
|
||||
|
||||
Reference in New Issue
Block a user