/* Espe | Ein schlichtes Werkzeug zur Mitglieder-Verwaltung | Frontend Copyright (C) 2024 Christian Fraß This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . */ lib_plankton.zoo_page.register( "invite_list", async (parameters, target_element) => { type type_item = { id : int; key : string; expiry : (null | int); name_value : string; }; target_element.appendChild(template_request("invite_list")); target_element.querySelector(".invite_list-title").textContent = lib_plankton.translate.get("page.invite_list.title"); const search : lib_plankton.zoo_search.type_search = lib_plankton.zoo_search.make( (term) => _espe.backend.invite_list(), { "encode_item": (item) => lib_plankton.string.coin( "[{{id}}] {{name}}: {{key}}", { "id": item.id.toFixed(0), "name": item.name_value, "key": item.key, } ), "hooks_begin": [ (term) => { /** * @todo */ } ], "hooks_select": [ (item) => { const url : URL = new URL(window.location.toString()); url.hash = lib_plankton.string.coin( "#invite_handle,key={{key}}", { "key": item.key, } ); console.info(url.toString()); } ] } ); lib_plankton.zoo_search.render( search, target_element.querySelector(".invite_list-search"), { "state": { "term": "", } } ); /* const data = await _espe.backend.invite_list(); (target_element.querySelector(".invite_list-data") as HTMLElement).textContent = JSON.stringify( data, undefined, " " ); */ } );