diff --git a/server/content/contact.php b/server/content/contact.php index 85a23df..6efd55d 100644 --- a/server/content/contact.php +++ b/server/content/contact.php @@ -1,19 +1,38 @@ load('error', ['404', 'Seite existiert noch nicht']); - $content .= '

'; - $content .= 'Die gesuchte Seite ist leider noch nicht verfügbar.
'; - $content .= 'Wir arbeiten daran, sie schnellstmöglich zur Verfügung zu stellen.
'; - $content .= 'Wie wäre es mit der Homepage?'; + // TITLE + $content = '

Kontakt

'; + + $sp['output'] .= $tpl->load('card', [$content]); + + // Info + $content = '

'; + $content .= 'Du hast eine Frage? Du hast einen Fehler in unserer Software oder in den gespeicherten Daten gefunden? Du willst Regatten.net auch für Deine Bootsklasse nutzen?
'; + $content .= 'Egal was es ist, lass es uns wissen! Schreibe uns eine Mail an info@regatten.net oder nutze einfach dieses Kontakt-Formular.
'; + $content .= 'Wir werden Deine Anfrage so schnell wie möglich bearbeiten.'; + $content .= '

'; + $content .= '

'; + $content .= 'Alternativ erreichst Du uns auch telefonisch unter +49 (0) 4103 965 976 8
'; + $content .= 'Mo-Fr: 7-20 Uhr
'; + $content .= 'Sa: 9-17 Uhr'; $content .= '

'; - $content .= $tpl->load('button', ['Zur Startseite', LINK_PRE . 'index', 'css-class' => 'mb-3']); - $content .= $tpl->load('button', ['Kontakt', LINK_PRE . 'contact']); - $sp['output'] = $tpl->load('card', [$content, 'css-class' => 'text-center pt-3']); + $sp['output'] .= $tpl->load('card', [$content]); + + // Formular + $content = '

Kontakt-Formular

'; + $content .= $tpl->load('input', ['html-id' => 'input-name', 'placeholder' => 'Dein Name', 'type' => 'text']); + $content .= $tpl->load('input', ['html-id' => 'input-email', 'placeholder' => 'Email-Adresse', 'type' => 'email']); + $content .= $tpl->load('input', ['html-id' => 'input-subject', 'placeholder' => 'Betreff', 'type' => 'text']); + $content .= $tpl->load('textarea', ['html-id' => 'input-message', 'placeholder' => 'Deine Nachricht']); + $content .= $tpl->load('button', ['Senden', '#', 'html-id' => 'button-send']); + + $sp['output'] .= $tpl->load('card', [$content]); + + $sp['scripts'] .= $scripts->load('contact'); ?> \ No newline at end of file diff --git a/server/scripts/contact.js b/server/scripts/contact.js new file mode 100644 index 0000000..9a0fdcd --- /dev/null +++ b/server/scripts/contact.js @@ -0,0 +1,49 @@ +function sendMessage() { + var name = $('#input-name').val(); + var email = $('#input-email').val(); + var subject = $('#input-subject').val(); + var message = $('#input-message').val(); + + if ((name == '') || (email == '') || (subject == '') || (message == '')) { + toastError('Bitte fülle alle Felder aus!'); + return; + } + + showLoader(); + $.ajax({ + url: QUERY_URL + 'contact', + method: 'POST', + data: { + name: name, + email: email, + subject: subject, + message: message + }, + error: function (xhr, status, error) { + if (xhr.status == 0) { + toastError('Du bist momentan offline.
Stelle eine Internetverbindung her, um eine Nachricht zu versenden'); + } else { + console.log('Contact: unbekannter Fehler', status, error); + console.log(xhr); + toastError('Ein unbekannter Fehler ist aufgetreten. Bitte versuche es noch einmal', 5000); + } + hideLoader(); + }, + success: function (data, status, xhr) { + toastOk('Nachricht erfolgreich versandt!'); + $('#input-subject').val(''); + $('#input-message').val(''); + hideLoader(); + } + }); +} + +var siteScript = async function () { + if (isLoggedIn()) { + var user = await dbGetData('users', USER_ID); + $('#input-name').val(user.username).trigger('focusin').trigger('focusout'); + $('#input-email').val(user.email).trigger('focusin').trigger('focusout'); + } + $('#button-send').click(sendMessage); + hideLoader(); +} \ No newline at end of file diff --git a/server/templates/textarea.html b/server/templates/textarea.html index e7421b3..ae364a6 100644 --- a/server/templates/textarea.html +++ b/server/templates/textarea.html @@ -1,4 +1,4 @@
$$placeholder; - +
\ No newline at end of file