253 lines
10 KiB
JavaScript
253 lines
10 KiB
JavaScript
/* ============================================================
|
||
FI-NE & LACUEOR — B2B Partner Portal
|
||
Scripts — i18n, banner selector, smooth scroll, topbar shadow
|
||
============================================================ */
|
||
|
||
(function () {
|
||
"use strict";
|
||
|
||
/* ── Translations ─────────────────────────────────────── */
|
||
var translations = {
|
||
en: {
|
||
"topbar.label": "B2B Partner Portal",
|
||
"nav.brands": "Our Brands",
|
||
"nav.benefits": "Partner Benefits",
|
||
"nav.contact": "Contact",
|
||
"nav.signin": "Anmelden",
|
||
"brands.label": "Our Brand Universe",
|
||
"brands.title": "Consumer & Retail Destinations",
|
||
"brands.body":
|
||
"Direct our clients and consumers to our flagship brand destinations.",
|
||
"fine.eyebrow": "Premium Natural Cosmetics",
|
||
"fine.tagline":
|
||
"Clean. Unisex. Uncompromisingly effective Body Care. Born in Berlin.",
|
||
"lacueor.eyebrow": "Premium Organic Skin Care",
|
||
"lacueor.tagline": "Premium organic skin care. Born in Switzerland.",
|
||
"b2b.label": "Exclusive Partnership",
|
||
"b2b.title": "Apply for B2B Partnership",
|
||
"b2b.body":
|
||
"We love to partner and collaborate with like-minded people and companies! If you are interested in a retail partnership or colaboration, please fill out the form below and we will reach out to you.",
|
||
"b2b.benefit1.title": "Bulk Pricing",
|
||
"b2b.benefit1.text":
|
||
"Tiered wholesale rates on every SKU across our entire brand portfolio — the more you order, the more you save.",
|
||
"b2b.benefit2.title": "Exclusive Promotions",
|
||
"b2b.benefit2.text":
|
||
"Partner-only seasonal campaigns, early-access product launches, and co-marketing opportunities reserved for B2B members.",
|
||
"b2b.benefit3.title": "Dedicated Support",
|
||
"b2b.benefit3.text":
|
||
"A personal account manager and priority fulfilment to keep your business moving without friction.",
|
||
"b2b.notice": "Already a partner?",
|
||
"b2b.notice_link": "Sign in to your B2B account",
|
||
"value1.title": "Curated",
|
||
"value1.desc": "Selectively distributed",
|
||
"value2.title": "Certified",
|
||
"value2.desc": "Vegan & natural formulas",
|
||
"value3.title": "Crafted",
|
||
"value3.desc": "Handmade in Germany, Austria and Switzerland",
|
||
"value4.title": "Committed",
|
||
"value4.desc": "Personal B2B support",
|
||
"signup.label": "Contact Us",
|
||
"signup.title": "Become a Partner",
|
||
"signup.body":
|
||
"Interested in carrying [fi-ne] or LACUEOR? Send us your details and we will get back to you within 48 hours.",
|
||
"signup.name": "Name *",
|
||
"signup.email": "Email *",
|
||
"signup.phone": "Phone",
|
||
"signup.website": "Website",
|
||
"signup.social": "Social Media",
|
||
"signup.message":
|
||
"Your background / your philosophy / your favorite brands *",
|
||
"signup.submit": "Send Request",
|
||
"signup.confirm.title": "Thank You!",
|
||
"signup.confirm.body":
|
||
"We have received your request and will get back to you within 48 hours.",
|
||
"signup.err.name": "Please enter your name.",
|
||
"signup.err.email": "Please enter a valid email address.",
|
||
"signup.err.message": "Please describe your business case.",
|
||
"signup.notice_link": "Sign in to your B2B account",
|
||
"footer.copyright": "© 2025 FINOR GmbH. All rights reserved.",
|
||
"footer.legal": "Legal Notice",
|
||
"footer.privacy": "Privacy Policy",
|
||
"footer.tagline": "Made in Berlin, with love.",
|
||
},
|
||
de: {
|
||
"topbar.label": "B2B Partner Portal",
|
||
"nav.brands": "Unsere Marken",
|
||
"nav.benefits": "Partner-Vorteile",
|
||
"nav.contact": "Kontakt",
|
||
"nav.signin": "Anmelden",
|
||
"brands.label": "Unser Markenuniversum",
|
||
"brands.title": "Consumer & Retail Ziele",
|
||
"brands.body":
|
||
"Leiten Sie Ihre Kunden zu unseren Flaggschiff-Marken weiter.",
|
||
"fine.eyebrow": "Premium Naturkosmetik",
|
||
"fine.tagline":
|
||
"Clean. Unisex. Unkompromittierend wirksame Body Care. Aus Berlin.",
|
||
"lacueor.eyebrow": "Premium Bio-Hautpflege",
|
||
"lacueor.tagline": "Premium Bio-Hautpflege. Aus der Schweiz.",
|
||
"b2b.label": "Exklusive Partnerschaft",
|
||
"b2b.title": "B2B Partnerschaft beantragen",
|
||
"b2b.body":
|
||
"Wir lieben Partnerschaften mit gleichgesinnten Menschen und Unternehmen! Bei Interesse an einer Retail-Partnerschaft oder Kooperation füllt gerne das untenstehende Formular aus. Wir melden uns bei euch.",
|
||
"b2b.benefit1.title": "Mengenrabatte",
|
||
"b2b.benefit1.text":
|
||
"Gestaffelte Großhandelspreise für jede SKU unseres gesamten Markenportfolios – je mehr Sie bestellen, desto mehr sparen Sie.",
|
||
"b2b.benefit2.title": "Exklusive Aktionen",
|
||
"b2b.benefit2.text":
|
||
"Partner-exklusive saisonale Kampagnen, frühzeitiger Zugang zu Produktneuheiten und Co-Marketing-Möglichkeiten.",
|
||
"b2b.benefit3.title": "Persönlicher Support",
|
||
"b2b.benefit3.text":
|
||
"Ein persönlicher Account-Manager und prioritäre Auftragsabwicklung für reibungslose Geschäftsabläufe.",
|
||
"b2b.notice": "Bereits Partner?",
|
||
"b2b.notice_link": "Zum B2B-Konto anmelden",
|
||
"value1.title": "Kuratiert",
|
||
"value1.desc": "Selektiv vertrieben",
|
||
"value2.title": "Zertifiziert",
|
||
"value2.desc": "Vegane & natürliche Formeln",
|
||
"value3.title": "Handgefertigt",
|
||
"value3.desc": "Hergestellt in Deutschland, Österreich und der Schweiz",
|
||
"value4.title": "Engagiert",
|
||
"value4.desc": "Persönlicher B2B-Support",
|
||
"signup.label": "Kontakt",
|
||
"signup.title": "Partner werden",
|
||
"signup.body":
|
||
"Interesse an [fi-ne] oder LACUEOR? Schickt uns eure Daten und wir melden uns spätestens innerhalb von 48 Stunden zurück.",
|
||
"signup.name": "Name *",
|
||
"signup.email": "E-Mail *",
|
||
"signup.phone": "Telefon",
|
||
"signup.website": "Webseite",
|
||
"signup.social": "Social Media",
|
||
"signup.message":
|
||
"Ihr Hintergrund / Ihre Philosophie / Ihre Lieblingsmarken *",
|
||
"signup.submit": "Anfrage senden",
|
||
"signup.confirm.title": "Vielen Dank!",
|
||
"signup.confirm.body":
|
||
"Wir haben Ihre Anfrage erhalten und melden uns spätestens innerhalb von 48 Stunden zurück.",
|
||
"signup.err.name": "Bitte geben Sie Ihren Namen ein.",
|
||
"signup.err.email": "Bitte geben Sie eine gültige E-Mail-Adresse ein.",
|
||
"signup.err.message": "Bitte beschreiben Sie Ihr Geschäftsfeld.",
|
||
"signup.notice_link": "Zum B2B-Konto anmelden",
|
||
"footer.copyright": "© 2025 FINOR GmbH. Alle Rechte vorbehalten.",
|
||
"footer.legal": "Impressum",
|
||
"footer.privacy": "Datenschutz",
|
||
"footer.tagline": "Hergestellt in Berlin, mit Liebe.",
|
||
},
|
||
};
|
||
|
||
function applyLang(lang) {
|
||
var t = translations[lang] || translations.en;
|
||
document.querySelectorAll("[data-i18n]").forEach(function (el) {
|
||
var key = el.getAttribute("data-i18n");
|
||
if (t[key]) el.textContent = t[key];
|
||
});
|
||
document.getElementById("lang-select").value = lang;
|
||
}
|
||
|
||
/* Auto-detect from browser, default to English */
|
||
var detectedLang =
|
||
navigator.language && navigator.language.slice(0, 2) === "de" ? "de" : "en";
|
||
applyLang(detectedLang);
|
||
|
||
document
|
||
.getElementById("lang-select")
|
||
.addEventListener("change", function () {
|
||
applyLang(this.value);
|
||
});
|
||
|
||
/* ── Form validation + AJAX submission ────────────── */
|
||
var signupForm = document.querySelector(".signup-form");
|
||
if (signupForm) {
|
||
signupForm.addEventListener("submit", function (e) {
|
||
e.preventDefault();
|
||
|
||
var name = document.getElementById("signup-name");
|
||
var email = document.getElementById("signup-email");
|
||
var message = document.getElementById("signup-message");
|
||
var valid = true;
|
||
|
||
function clearErrors() {
|
||
document
|
||
.querySelectorAll(".form-group.has-error")
|
||
.forEach(function (g) {
|
||
g.classList.remove("has-error");
|
||
});
|
||
}
|
||
|
||
function markError(el) {
|
||
var group = el.closest(".form-group");
|
||
if (group) group.classList.add("has-error");
|
||
valid = false;
|
||
}
|
||
|
||
clearErrors();
|
||
|
||
if (!name.value.trim()) markError(name);
|
||
if (
|
||
!email.value.trim() ||
|
||
!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(email.value)
|
||
)
|
||
markError(email);
|
||
if (!message.value.trim()) markError(message);
|
||
|
||
if (!valid) return;
|
||
|
||
/* Gather data */
|
||
var data = {
|
||
name: name.value.trim(),
|
||
email: email.value.trim(),
|
||
phone: document.getElementById("signup-phone")?.value || "",
|
||
website: document.getElementById("signup-website")?.value || "",
|
||
channels: Array.from(
|
||
document.querySelectorAll(
|
||
".checkbox-group input[type=checkbox]:checked",
|
||
),
|
||
).map(function (c) {
|
||
return c.value;
|
||
}),
|
||
message: message.value.trim(),
|
||
};
|
||
|
||
/* Submit via AJAX */
|
||
var xhr = new XMLHttpRequest();
|
||
xhr.open("POST", signupForm.getAttribute("action"), true);
|
||
xhr.setRequestHeader("Content-Type", "application/json");
|
||
xhr.onload = function () {
|
||
signupForm.style.display = "none";
|
||
document.getElementById("signup-confirm").style.display = "block";
|
||
};
|
||
xhr.onerror = function () {
|
||
signupForm.style.display = "none";
|
||
document.getElementById("signup-confirm").style.display = "block";
|
||
};
|
||
xhr.send(JSON.stringify(data));
|
||
});
|
||
}
|
||
|
||
/* ── Smooth anchor scroll offset for fixed topbar ────────── */
|
||
document.querySelectorAll('a[href^="#"]').forEach(function (anchor) {
|
||
anchor.addEventListener("click", function (e) {
|
||
var target = document.querySelector(this.getAttribute("href"));
|
||
if (!target) return;
|
||
e.preventDefault();
|
||
var offset = 80;
|
||
var top =
|
||
target.getBoundingClientRect().top + window.pageYOffset - offset;
|
||
window.scrollTo({ top: top, behavior: "smooth" });
|
||
});
|
||
});
|
||
|
||
/* ── Topbar shadow on scroll ─────────────────────────────── */
|
||
var topbar = document.querySelector(".topbar");
|
||
window.addEventListener(
|
||
"scroll",
|
||
function () {
|
||
if (window.scrollY > 20) {
|
||
topbar.style.boxShadow = "0 2px 24px rgba(0,0,0,0.08)";
|
||
} else {
|
||
topbar.style.boxShadow = "none";
|
||
}
|
||
},
|
||
{ passive: true },
|
||
);
|
||
})();
|