@@ -250,16 +277,22 @@
Schritt 4: Bist du beim 20-Jahrestreffen am 13.11.2027 in Gevelsberg dabei?
-
+
Hast du Lust, am Samstag, den 13.11.2027, beim Nachtreffen in Gevelsberg dabei zu sein?
Genauere Infos und Details gibt's dann später hier und per Mail.
+
+ Du hast bereits zugesagt. Genauere Infos und Details gibt's dann später hier und per Mail. Falls du deine Meinung ändern möchtest, kannst du hier nochmal wählen.
+
+
+ Du hast bereits abgesagt. Falls du deine Meinung ändern möchtest, kannst du hier nochmal wählen.
+
@@ -416,11 +449,9 @@
email: '[[${email}]]',
phone: '[[${phone}]]',
knownContactName: '',
- knownContactEmail: '',
- knownContactPhone: '',
- showKnownContactData: false,
enteredContacts: [],
- foundKnownContactName: null,
+ editingContactIndex: -1,
+ editingContactData: { email: '', phone: '' },
committed: '[[${committed}]]',
init() {
@@ -443,6 +474,36 @@
this.stepMsg = '';
this.stepMsgType = '';
this.step = step;
+
+ if (!this.enteredContacts) {
+ this.enteredContacts = [];
+ }
+
+ if (step === 3 && this.userToken) {
+ this.loadPendingContacts();
+ }
+ },
+
+ async loadPendingContacts() {
+ try {
+ const resp = await axios.get('/api/v1/contact/data/pending', {
+ headers: { 'Authorization': this.userToken },
+ validateStatus: () => true
+ });
+
+ if (resp.status === 200) {
+ this.enteredContacts = (this.enteredContacts || []).filter((c) => c.isNew);
+ resp.data.forEach(contact => {
+ this.enteredContacts.push({
+ name: contact.contactName,
+ email: contact.email,
+ phone: contact.phone || ''
+ });
+ });
+ }
+ } catch (error) {
+ console.error('Fehler beim Laden der Kontakte:', error);
+ }
},
async findSelf() {
@@ -535,36 +596,48 @@
async findKnownContact() {
this.stepMsg = '';
this.stepMsgType = '';
- this.showKnownContactData = false;
- this.knownContactEmail = '';
- this.knownContactPhone = '';
- this.foundKnownContactName = null;
this.working = true;
try {
const resp = await axios.get('/api/v1/contact', {
params: { name: this.knownContactName.trim() },
+ headers: this.userToken ? { 'Authorization': this.userToken } : {},
validateStatus: () => true
});
if (resp.status === 200) {
- this.foundKnownContactName = resp.data.name.trim();
- if (this.foundKnownContactName == this.yourName) {
- this.stepMsg = 'Das bist du selbst - deine Daten hast du ja schon eingetragen!';
+ const contactName = resp.data.name.trim();
+ if (contactName == this.yourName || contactName == this.userName) {
+ this.stepMsg = 'Witzig, das bist du selbst - deine Daten hast du ja schon eingetragen!';
this.stepMsgType = 'warning';
- this.showKnownContactData = false;
- this.knownContactName = ''
+ this.knownContactName = '';
} else {
- this.knownContactName = this.foundKnownContactName;
- this.stepMsg = 'Super, trag bitte die Kontaktdaten ein!';
- this.stepMsgType = 'success';
- this.showKnownContactData = true;
+ const existingIndex = this.enteredContacts.findIndex(c => c.name === contactName);
+ if (existingIndex !== -1) {
+ this.startEdit(existingIndex);
+ this.stepMsg = 'Kontakt bereits vorhanden - du kannst die Daten hier bearbeiten.';
+ this.stepMsgType = 'info';
+ this.knownContactName = '';
+ } else {
+ this.enteredContacts.unshift({
+ name: contactName,
+ email: '',
+ phone: '',
+ isNew: true // Mark as new for cancel behavior
+ });
+ this.startEdit(0);
+ this.stepMsg = 'Super, trag bitte die Kontaktdaten ein!';
+ this.stepMsgType = 'success';
+ this.knownContactName = '';
+ }
}
} else if (resp.status === 404) {
this.stepMsg = 'Diesen Namen gibt es leider nicht in unserer Liste.';
this.stepMsgType = 'warning';
} else if (resp.status === 208) {
+
+
+
this.stepMsg = 'Für diese Person haben wir schon Kontaktdaten. Danke trotzdem fürs Mitmachen!';
this.stepMsgType = 'info';
- this.showKnownContactData = false;
} else {
this.stepMsg = 'Da ist was schiefgelaufen. Versuch es bitte nochmal!';
this.stepMsgType = 'danger';
@@ -576,34 +649,68 @@
this.working = false;
},
- async submitKnownContactData() {
- this.stepMsg = '';
- this.stepMsgType = '';
+ startEdit(index) {
+ this.editingContactIndex = index;
+ this.editingContactData = {
+ email: this.enteredContacts[index].email,
+ phone: this.enteredContacts[index].phone || ''
+ };
+
+ // Focus the email input of the specific contact being edited
+ setTimeout(() => {
+ // Find all email inputs and select the one that's currently visible (not d-none)
+ const emailInputs = document.querySelectorAll('.list-group-item input[type="email"]');
+ for (let input of emailInputs) {
+ const parentDiv = input.closest('div[x-show]');
+ if (parentDiv && !parentDiv.classList.contains('d-none')) {
+ input.focus();
+ input.select();
+ break;
+ }
+ }
+ }, 100);
+ },
+
+ cancelEdit() {
+ // If this is a new contact that hasn't been saved, remove it from the list
+ if (this.editingContactIndex >= 0 && this.enteredContacts[this.editingContactIndex].isNew) {
+ this.enteredContacts.splice(this.editingContactIndex, 1);
+ }
+
+ this.editingContactIndex = -1;
+ this.editingContactData = { email: '', phone: '' };
+ },
+
+ async saveContactData(index) {
this.working = true;
try {
+ const contact = this.enteredContacts[index];
const resp = await axios.post('/api/v1/contact/data', {
- name: this.foundKnownContactName,
+ name: contact.name,
reportedBy: this.userName,
- email: this.knownContactEmail.trim(),
- phone: this.knownContactPhone.trim()
- }, { validateStatus: () => true });
+ email: this.editingContactData.email.trim(),
+ phone: this.editingContactData.phone.trim()
+ }, {
+ headers: this.userToken ? { 'Authorization': this.userToken } : {},
+ validateStatus: () => true
+ });
+
if (resp.status === 200 || resp.status === 201) {
- this.enteredContacts = this.enteredContacts.filter((c) => c.name !== this.foundKnownContactName);
- this.enteredContacts.push({
- name: this.foundKnownContactName,
- email: this.knownContactEmail.trim(),
- phone: this.knownContactPhone.trim()
- });
- this.stepMsg = 'Danke, die Kontaktdaten sind gespeichert! Du kannst noch mehr eintragen oder einfach weitermachen.';
+ // Update the contact in our local list
+ this.enteredContacts[index].email = this.editingContactData.email.trim();
+ this.enteredContacts[index].phone = this.editingContactData.phone.trim();
+ // Remove the isNew flag since it's now saved
+ delete this.enteredContacts[index].isNew;
+
+ this.stepMsg = 'Kontakt erfolgreich gespeichert!';
this.stepMsgType = 'success';
- this.showKnownContactData = false;
- this.knownContactName = '';
- this.foundKnownContactName = null;
+ this.editingContactIndex = -1;
+ this.editingContactData = { email: '', phone: '' };
} else if (resp.status === 400) {
this.stepMsg = 'Bitte prüfe die Angaben nochmal – da stimmt was nicht.';
this.stepMsgType = 'warning';
} else {
- this.stepMsg = 'Da ist was schiefgelaufen. Versuch es bitte nochmal!';
+ this.stepMsg = 'Fehler beim Speichern des Kontakts.';
this.stepMsgType = 'danger';
}
} catch {