Added Application HolidayViewer
This commit is contained in:
62
src/components/admin/commands.py
Normal file
62
src/components/admin/commands.py
Normal file
@@ -0,0 +1,62 @@
|
||||
from components.BaseCommandManager import BaseCommandManager
|
||||
from components.admin.constants import ROUTE_ROOT, Routes
|
||||
|
||||
|
||||
class AdminCommandManager(BaseCommandManager):
|
||||
def __init__(self, owner):
|
||||
super().__init__(owner)
|
||||
|
||||
def show_ai_buddy(self):
|
||||
return {
|
||||
"hx-get": f"{ROUTE_ROOT}{Routes.AiBuddy}",
|
||||
"hx-target": f"#{self._owner.tabs_manager.get_id()}",
|
||||
"hx-swap": "outerHTML",
|
||||
"hx-vals": f'js:{{"_id": "{self._id}", boundaries: getTabContentBoundaries("{self._owner.tabs_manager.get_id()}")}}',
|
||||
}
|
||||
|
||||
def save_ai_buddy(self):
|
||||
return {
|
||||
"hx-post": f"{ROUTE_ROOT}{Routes.AiBuddy}",
|
||||
"hx-target": f"#{self._owner.tabs_manager.get_id()}",
|
||||
"hx-swap": "outerHTML",
|
||||
"hx-vals": f'js:{{"_id": "{self._id}"}}',
|
||||
# The form adds the rest
|
||||
}
|
||||
|
||||
def cancel_ai_buddy(self):
|
||||
return {
|
||||
"hx-post": f"{ROUTE_ROOT}{Routes.AiBuddyCancel}",
|
||||
"hx-target": f"#{self._owner.tabs_manager.get_id()}",
|
||||
"hx-swap": "outerHTML",
|
||||
"hx-vals": f'js:{{"_id": "{self._id}"}}',
|
||||
}
|
||||
|
||||
def show_import_holidays(self):
|
||||
return {
|
||||
"hx-get": f"{ROUTE_ROOT}{Routes.ImportHolidays}",
|
||||
"hx-target": f"#{self._owner.tabs_manager.get_id()}",
|
||||
"hx-swap": "outerHTML",
|
||||
"hx-vals": f'js:{{"_id": "{self._id}", boundaries: getTabContentBoundaries("{self._owner.tabs_manager.get_id()}")}}',
|
||||
}
|
||||
|
||||
|
||||
class ImportHolidaysCommandManager(BaseCommandManager):
|
||||
def __init__(self, owner):
|
||||
super().__init__(owner)
|
||||
|
||||
def on_paste(self):
|
||||
return {
|
||||
"hx-post": f"{ROUTE_ROOT}{Routes.PasteHolidays}",
|
||||
"hx-target": f"#{self._owner.datagrid.get_id()}",
|
||||
"hx_trigger": "keydown[ctrlKey && key=='Enter']",
|
||||
"hx-swap": "outerHTML",
|
||||
"hx-vals": f'js:{{"_id": "{self._id}"}}',
|
||||
}
|
||||
|
||||
def import_holidays(self):
|
||||
return {
|
||||
"hx-post": f"{ROUTE_ROOT}{Routes.ImportHolidays}",
|
||||
"hx-target": f"#{self._owner.datagrid.get_id()}",
|
||||
"hx-swap": "outerHTML",
|
||||
"hx-vals": f'js:{{"_id": "{self._id}"}}',
|
||||
}
|
||||
Reference in New Issue
Block a user