2025-09-25 17:54:20 +02:00
|
|
|
namespace _dali.pages
|
2024-09-30 20:20:14 +02:00
|
|
|
{
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
*/
|
|
|
|
|
lib_plankton.zoo_page.register(
|
|
|
|
|
"calendar_edit",
|
|
|
|
|
async (parameters, target_element) => {
|
|
|
|
|
const read_only : boolean = ((parameters["read_only"] ?? "yes") === "yes");
|
|
|
|
|
const calendar_id : int = parseInt(parameters["calendar_id"]);
|
|
|
|
|
target_element.innerHTML = "";
|
2025-09-25 17:54:20 +02:00
|
|
|
target_element.innerHTML = await _dali.helpers.template_coin(
|
2024-09-30 20:20:14 +02:00
|
|
|
"calendar_edit",
|
2024-10-01 18:28:04 +02:00
|
|
|
"default",
|
2024-09-30 20:20:14 +02:00
|
|
|
{
|
|
|
|
|
"label": lib_plankton.translate.get("page.calendar_edit.title.regular")
|
|
|
|
|
}
|
|
|
|
|
);
|
2025-10-14 00:16:22 +02:00
|
|
|
const calendar_object : _dali.type.calendar_object = await _dali.backend.calendar_get(
|
|
|
|
|
calendar_id
|
|
|
|
|
);
|
|
|
|
|
const widget = new _dali.widgets.calendar_edit.class_widget_calendar_edit(
|
2025-10-13 13:22:53 +02:00
|
|
|
{
|
2025-10-14 00:16:22 +02:00
|
|
|
"read_only": read_only,
|
|
|
|
|
"action_change": (data) => {
|
|
|
|
|
_dali.backend.calendar_change(
|
|
|
|
|
calendar_id,
|
|
|
|
|
data
|
|
|
|
|
)
|
|
|
|
|
.then(
|
|
|
|
|
() => {
|
|
|
|
|
lib_plankton.zoo_page.set(
|
2024-10-10 23:00:51 +02:00
|
|
|
{
|
2025-10-14 00:16:22 +02:00
|
|
|
"name": "overview",
|
|
|
|
|
"parameters": {}
|
|
|
|
|
}
|
|
|
|
|
);
|
2024-09-30 20:20:14 +02:00
|
|
|
}
|
2025-10-14 00:16:22 +02:00
|
|
|
);
|
|
|
|
|
},
|
|
|
|
|
"action_remove": (data) => {
|
|
|
|
|
_dali.backend.calendar_remove(
|
|
|
|
|
calendar_id
|
|
|
|
|
)
|
|
|
|
|
.then(
|
|
|
|
|
() => {
|
|
|
|
|
lib_plankton.zoo_page.set(
|
|
|
|
|
{
|
|
|
|
|
"name": "overview",
|
|
|
|
|
"parameters": {}
|
|
|
|
|
}
|
|
|
|
|
);
|
2024-09-30 20:20:14 +02:00
|
|
|
}
|
2025-10-14 00:16:22 +02:00
|
|
|
);
|
|
|
|
|
},
|
|
|
|
|
"initial_value": {
|
|
|
|
|
"name": calendar_object.name,
|
|
|
|
|
"hue": calendar_object.hue,
|
|
|
|
|
"access": calendar_object.access,
|
|
|
|
|
},
|
|
|
|
|
}
|
2024-09-30 20:20:14 +02:00
|
|
|
);
|
2025-10-14 00:16:22 +02:00
|
|
|
await widget.load(document.querySelector("#calendar_edit_form"));
|
2024-09-30 20:20:14 +02:00
|
|
|
return Promise.resolve<void>(undefined);
|
|
|
|
|
}
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
}
|