@@ -27,7 +79,13 @@
diff --git a/src/components/icons/InfoIcon.vue b/src/components/icons/InfoIcon.vue
new file mode 100644
index 0000000..323fa81
--- /dev/null
+++ b/src/components/icons/InfoIcon.vue
@@ -0,0 +1,7 @@
+
+
+
diff --git a/src/composables/useAdremaLogin.js b/src/composables/useAdremaLogin.js
new file mode 100644
index 0000000..0e48ed0
--- /dev/null
+++ b/src/composables/useAdremaLogin.js
@@ -0,0 +1,73 @@
+import {ref, computed} from 'vue';
+import useEventMeta from './useEventMeta.js';
+import useToastify from './useToastify.js';
+import debounce from 'lodash/debounce';
+
+const {success, errorFromResponse} = useToastify();
+const eventMeta = useEventMeta();
+
+export default function useAdremaLogin() {
+ const loginData = ref({
+ mglnr: null,
+ password: null,
+ });
+
+ const searchData = ref({
+ firstname: null,
+ lastname: null,
+ });
+
+ const searchResults = ref([]);
+
+ const loginToken = ref(window.localStorage.getItem('adrema_login_key') ? JSON.parse(window.localStorage.getItem('adrema_login_key')) : null);
+
+ async function login() {
+ try {
+ const response = await axios.post('/remote/nami/token', loginData.value);
+ const payload = {user: loginData.value.mglnr, token: response.data.access_token};
+ window.localStorage.setItem('adrema_login_key', JSON.stringify(payload));
+ loginToken.value = payload;
+ success('Login erfolgreich');
+ } catch (e) {
+ errorFromResponse(e);
+ }
+ }
+
+ const user = computed(() => {
+ if (loginToken.value === null) {
+ return null;
+ }
+
+ return loginToken.value.user;
+ });
+
+ function logout() {
+ window.localStorage.removeItem('adrema_login_key');
+ loginToken.value = null;
+ }
+
+ const searchForMember = debounce(async function () {
+ console.log(loginToken.value.token);
+ const response = await axios.post(
+ '/remote/nami/search',
+ {
+ vorname: searchData.value.firstname,
+ },
+ {
+ headers: {'X-Adrema-Token': loginToken.value.token},
+ },
+ );
+
+ searchResults.value = response.data.data;
+ }, 1000);
+
+ return {
+ searchResults,
+ login,
+ logout,
+ user,
+ loginData,
+ searchData,
+ searchForMember,
+ };
+}
diff --git a/src/composables/useEventMeta.js b/src/composables/useEventMeta.js
new file mode 100644
index 0000000..a9162f8
--- /dev/null
+++ b/src/composables/useEventMeta.js
@@ -0,0 +1,10 @@
+import {ref} from 'vue';
+
+export default function useEventMeta() {
+ const metaVarName = 'adrema_event_meta';
+ const eventMeta = ref(null);
+ if (window[metaVarName]) {
+ eventMeta.value = window[metaVarName];
+ }
+ return eventMeta;
+}
diff --git a/src/composables/useFieldsWithoutNami.js b/src/composables/useFieldsWithoutNami.js
new file mode 100644
index 0000000..c76ef81
--- /dev/null
+++ b/src/composables/useFieldsWithoutNami.js
@@ -0,0 +1,25 @@
+import FieldText from '../components/fields/Text.vue';
+import FieldDate from '../components/fields/Date.vue';
+import FieldTextarea from '../components/fields/Textarea.vue';
+import FieldDropdown from '../components/fields/Dropdown.vue';
+import FieldGroup from '../components/fields/Group.vue';
+import FieldCheckboxes from '../components/fields/Checkboxes.vue';
+import FieldCheckbox from '../components/fields/Checkbox.vue';
+import FieldRadio from '../components/fields/Radio.vue';
+
+export default function useFields(active, last) {
+ function resolveComponentName(field) {
+ return {
+ TextField: FieldText,
+ DateField: FieldDate,
+ TextareaField: FieldTextarea,
+ DropdownField: FieldDropdown,
+ GroupField: FieldGroup,
+ RadioField: FieldRadio,
+ CheckboxesField: FieldCheckboxes,
+ CheckboxField: FieldCheckbox,
+ }[field.type];
+ }
+
+ return {resolveComponentName};
+}