Einladungs-System #2
6 changed files with 252 additions and 3 deletions
|
@ -2,7 +2,7 @@
|
|||
"backend": {
|
||||
"scheme": "http",
|
||||
"host": "localhost",
|
||||
"port": 7979,
|
||||
"port": 4916,
|
||||
"path_base": ""
|
||||
}
|
||||
}
|
||||
|
|
|
@ -485,4 +485,61 @@ namespace _espe.backend
|
|||
);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*/
|
||||
export async function invite_examine(
|
||||
key : string
|
||||
) : Promise<
|
||||
{
|
||||
membership_number_mode : int;
|
||||
membership_number_value : (null | string);
|
||||
name_mode : int;
|
||||
name_value : string;
|
||||
email_address_mode : int;
|
||||
email_address_value : (null | string);
|
||||
groups_mode : int;
|
||||
groups_value : Array<string>;
|
||||
}
|
||||
>
|
||||
{
|
||||
return abstract_call(
|
||||
"GET",
|
||||
lib_plankton.string.coin(
|
||||
"/invite/examine?key={{key}}",
|
||||
{
|
||||
"key": key
|
||||
}
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*/
|
||||
export async function invite_accept(
|
||||
key : string,
|
||||
data : {
|
||||
membership_number_value : string;
|
||||
name_value : string;
|
||||
email_address_value : (null | string);
|
||||
groups_value : Array<string>;
|
||||
}
|
||||
) : Promise<void>
|
||||
{
|
||||
return abstract_call(
|
||||
"POST",
|
||||
"/invite/accept",
|
||||
{
|
||||
"data": {
|
||||
"key": key,
|
||||
"membership_number_value": data.membership_number_value,
|
||||
"name_value": data.name_value,
|
||||
"email_address_value": data.email_address_value,
|
||||
"groups_value": data.groups_value,
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
155
source/pages/invite_handle/logic.ts
Normal file
155
source/pages/invite_handle/logic.ts
Normal file
|
@ -0,0 +1,155 @@
|
|||
/*
|
||||
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
|
||||
<https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
lib_plankton.zoo_page.register(
|
||||
"invite_handle",
|
||||
async (parameters, target_element) => {
|
||||
// parameters
|
||||
const key : string = parameters["key"];
|
||||
|
||||
target_element.appendChild(template_request("invite_handle"));
|
||||
|
||||
/**
|
||||
* @todo invite_handle-title
|
||||
*/
|
||||
|
||||
const data : {
|
||||
membership_number_mode : int;
|
||||
membership_number_value : (null | string);
|
||||
name_mode : int;
|
||||
name_value : string;
|
||||
email_address_mode : int;
|
||||
email_address_value : (null | string);
|
||||
groups_mode : int;
|
||||
groups_value : Array<string>;
|
||||
} = await _espe.backend.invite_examine(key);
|
||||
|
||||
const form = new lib_plankton.zoo_form.class_form<
|
||||
{
|
||||
membership_number_value : (null | string);
|
||||
name_value : string;
|
||||
email_address_value : (null | string);
|
||||
groups_value : Array<string>;
|
||||
},
|
||||
{
|
||||
membership_number_value : string;
|
||||
name_value : string;
|
||||
email_address_value : string;
|
||||
groups_value : Array<string>;
|
||||
}
|
||||
>(
|
||||
value => ({
|
||||
"membership_number_value": (value.membership_number_value ?? ""),
|
||||
"name_value": value.name_value,
|
||||
"email_address_value": (value.email_address_value ?? ""),
|
||||
"groups_value": value.groups_value,
|
||||
}),
|
||||
representation => ({
|
||||
"membership_number_value": representation.membership_number_value,
|
||||
"name_value": representation.name_value,
|
||||
"email_address_value": representation.email_address_value,
|
||||
"groups_value": representation.groups_value,
|
||||
}),
|
||||
new lib_plankton.zoo_input.class_input_group(
|
||||
[
|
||||
{
|
||||
"name": "name_value",
|
||||
"input": new lib_plankton.zoo_input.class_input_text(
|
||||
{
|
||||
"read_only": (data.name_mode <= 1),
|
||||
}
|
||||
),
|
||||
/**
|
||||
* @todo translate
|
||||
*/
|
||||
"label": "Name",
|
||||
},
|
||||
{
|
||||
"name": "membership_number_value",
|
||||
"input": new lib_plankton.zoo_input.class_input_text(
|
||||
{
|
||||
"read_only": (data.membership_number_mode <= 1),
|
||||
}
|
||||
),
|
||||
/**
|
||||
* @todo translate
|
||||
*/
|
||||
"label": "Mitgliedsnummer",
|
||||
},
|
||||
{
|
||||
"name": "email_address_value",
|
||||
"input": new lib_plankton.zoo_input.class_input_text(
|
||||
{
|
||||
"read_only": (data.email_address_mode <= 1),
|
||||
}
|
||||
),
|
||||
/**
|
||||
* @todo translate
|
||||
*/
|
||||
"label": "E-Mail-Adresse",
|
||||
},
|
||||
{
|
||||
"name": "groups_value",
|
||||
"input": new lib_plankton.zoo_input.class_input_list(
|
||||
() => new lib_plankton.zoo_input.class_input_text(),
|
||||
{
|
||||
/**
|
||||
* @todo does not work yet
|
||||
*/
|
||||
// "read_only": (data.groups_mode <= 1),
|
||||
}
|
||||
),
|
||||
/**
|
||||
* @todo translate
|
||||
*/
|
||||
"label": "Gruppen",
|
||||
},
|
||||
]
|
||||
),
|
||||
[
|
||||
{
|
||||
"label": "Senden",
|
||||
"procedure": async (get_value, get_representation) => {
|
||||
const value = await get_value();
|
||||
await _espe.backend.invite_accept(
|
||||
key,
|
||||
{
|
||||
"membership_number_value": value.membership_number_value,
|
||||
"name_value": value.name_value,
|
||||
"email_address_value": value.email_address_value,
|
||||
"groups_value": value.groups_value,
|
||||
}
|
||||
);
|
||||
/**
|
||||
* @todo redirect
|
||||
*/
|
||||
/*
|
||||
lib_plankton.zoo_page.set({"name": "view", "parameters": {"id": id}});
|
||||
*/
|
||||
},
|
||||
}
|
||||
]
|
||||
);
|
||||
await form.setup(target_element.querySelector(".invite_handle-form") as HTMLElement);
|
||||
await form.input_write(
|
||||
{
|
||||
"membership_number_value": data.membership_number_value,
|
||||
"name_value": data.name_value,
|
||||
"email_address_value": data.email_address_value,
|
||||
"groups_value": data.groups_value,
|
||||
}
|
||||
);
|
||||
}
|
||||
);
|
19
source/pages/invite_handle/structure.html
Normal file
19
source/pages/invite_handle/structure.html
Normal file
|
@ -0,0 +1,19 @@
|
|||
<!--
|
||||
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
|
||||
<https://www.gnu.org/licenses/>.
|
||||
-->
|
||||
|
||||
<template id="invite_handle">
|
||||
<h2 class="invite_handle-title"></h2>
|
||||
<div class="invite_handle-form"></div>
|
||||
</template>
|
15
source/pages/invite_handle/style.css
Normal file
15
source/pages/invite_handle/style.css
Normal file
|
@ -0,0 +1,15 @@
|
|||
/*
|
||||
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
|
||||
<https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
|
@ -47,6 +47,7 @@ ${dir_temp}/logic-unlinked.js: \
|
|||
${dir_source}/pages/register/logic.ts \
|
||||
${dir_source}/pages/password_change_init/logic.ts \
|
||||
${dir_source}/pages/password_change_exec/logic.ts \
|
||||
${dir_source}/pages/invite_handle/logic.ts \
|
||||
${dir_source}/logic/main.ts
|
||||
@ ${cmd_log} "logic | compile …"
|
||||
@ ${cmd_mkdir} $(dir $@)
|
||||
|
@ -68,7 +69,8 @@ ${dir_build}/style.css: \
|
|||
${dir_source}/pages/view/style.css \
|
||||
${dir_source}/pages/register/style.css \
|
||||
${dir_source}/pages/password_change_init/style.css \
|
||||
${dir_source}/pages/password_change_exec/style.css
|
||||
${dir_source}/pages/password_change_exec/style.css \
|
||||
${dir_source}/pages/invite_handle/style.css
|
||||
@ ${cmd_log} "style …"
|
||||
@ ${cmd_mkdir} $(dir $@)
|
||||
@ ${cmd_cat} $^ > $@
|
||||
|
@ -83,7 +85,8 @@ ${dir_build}/index.html: \
|
|||
${dir_source}/pages/view/structure.html \
|
||||
${dir_source}/pages/register/structure.html \
|
||||
${dir_source}/pages/password_change_init/structure.html \
|
||||
${dir_source}/pages/password_change_exec/structure.html
|
||||
${dir_source}/pages/password_change_exec/structure.html \
|
||||
${dir_source}/pages/invite_handle/structure.html
|
||||
@ ${cmd_log} "structure …"
|
||||
@ ${cmd_mkdir} $(dir $@)
|
||||
@ tools/make-index $^ > $@
|
||||
|
|
Loading…
Add table
Reference in a new issue