Compare commits
No commits in common. "ai-dev" and "master" have entirely different histories.
@ -1,132 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
class ReportGenerator
|
|
||||||
{
|
|
||||||
private $answers;
|
|
||||||
private $score = 0;
|
|
||||||
private $recommendations = [];
|
|
||||||
|
|
||||||
public function __construct($answers)
|
|
||||||
{
|
|
||||||
$this->answers = $answers;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function generate()
|
|
||||||
{
|
|
||||||
$this->calculateScore();
|
|
||||||
$this->generateRecommendations();
|
|
||||||
|
|
||||||
// For now, let's just return the data
|
|
||||||
return [
|
|
||||||
'score' => $this->score,
|
|
||||||
'recommendations' => $this->recommendations,
|
|
||||||
'answers' => $this->answers
|
|
||||||
];
|
|
||||||
}
|
|
||||||
|
|
||||||
private function calculateScore()
|
|
||||||
{
|
|
||||||
// Simple scoring logic - this can be made more complex
|
|
||||||
// We will just assign points for certain answers
|
|
||||||
$this->score = 0;
|
|
||||||
|
|
||||||
// Q4 - Main Goal
|
|
||||||
if (isset($this->answers['q4']) && in_array('⏱️ Zeit sparen durch Automatisierung', $this->answers['q4'])) {
|
|
||||||
$this->score += 20;
|
|
||||||
}
|
|
||||||
if (isset($this->answers['q4']) && in_array('🚀 Skalierung vorbereiten', $this->answers['q4'])) {
|
|
||||||
$this->score += 10;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Q5 - Digital Maturity
|
|
||||||
if (isset($this->answers['q5'])) {
|
|
||||||
$this->score += (5 - intval($this->answers['q5'][0])) * 5; // Less digital = more potential = higher score
|
|
||||||
}
|
|
||||||
|
|
||||||
// Q8 - Weekly Admin Time
|
|
||||||
$admin_time_scores = ['⏱️ 0-5 Stunden' => 0, '⏰ 6-10 Stunden' => 10, '🕐 11-15 Stunden' => 20, '🕑 16-20 Stunden' => 30, '🕒 Über 20 Stunden' => 40];
|
|
||||||
if (isset($this->answers['q8']) && isset($admin_time_scores[$this->answers['q8'][0]])) {
|
|
||||||
$this->score += $admin_time_scores[$this->answers['q8'][0]];
|
|
||||||
}
|
|
||||||
|
|
||||||
// Q10 - Time Saving Goal
|
|
||||||
$saving_goal_scores = ['⏱️ 2–5 Stunden' => 5, '⏰ 6–10 Stunden' => 10, '🕐 11–15 Stunden' => 15, '🕑 16–20 Stunden' => 20, '🚀 Mehr als 20 Stunden' => 25];
|
|
||||||
if (isset($this->answers['q10']) && isset($saving_goal_scores[$this->answers['q10'][0]])){
|
|
||||||
$this->score += $saving_goal_scores[$this->answers['q10'][0]];
|
|
||||||
}
|
|
||||||
|
|
||||||
// Q12 - Technology Openness
|
|
||||||
if (isset($this->answers['q12'])) {
|
|
||||||
$this->score += intval($this->answers['q12'][0]) * 2; // More open = higher score
|
|
||||||
}
|
|
||||||
|
|
||||||
// Clamp score between 0 and 100
|
|
||||||
$this->score = max(0, min($this->score, 100));
|
|
||||||
}
|
|
||||||
|
|
||||||
private function generateRecommendations()
|
|
||||||
{
|
|
||||||
$this->recommendations = [];
|
|
||||||
|
|
||||||
if ($this->score >= 75) {
|
|
||||||
$this->recommendations[] = [
|
|
||||||
'title' => 'Ihr Automatisierungspotenzial ist SEHR HOCH!',
|
|
||||||
'text' => 'Ihre Antworten deuten auf ein enormes Potenzial für Effizienzsteigerung durch KI und Automatisierung hin. Sie sind bereit, die nächsten Schritte zu gehen und könnten schnell signifikante Ergebnisse sehen.',
|
|
||||||
'type' => 'high'
|
|
||||||
];
|
|
||||||
} elseif ($this->score >= 50) {
|
|
||||||
$this->recommendations[] = [
|
|
||||||
'title' => 'Ihr Automatisierungspotenzial ist HOCH.',
|
|
||||||
'text' => 'Sie haben bereits einige digitale Prozesse, aber es gibt noch viel Raum für Optimierung. Eine gezielte Automatisierungsstrategie könnte Ihnen helfen, wertvolle Zeit zu sparen und Ihr Geschäft zu skalieren.',
|
|
||||||
'type' => 'medium'
|
|
||||||
];
|
|
||||||
} else {
|
|
||||||
$this->recommendations[] = [
|
|
||||||
'title' => 'Guter Start, aber es gibt noch Potenzial.',
|
|
||||||
'text' => 'Ihre aktuellen Prozesse sind teilweise digitalisiert, aber es gibt noch viele Möglichkeiten, manuelle Aufgaben zu reduzieren. Fangen Sie mit kleinen, gezielten Automatisierungen an, um den größten Nutzen zu erzielen.',
|
|
||||||
'type' => 'low'
|
|
||||||
];
|
|
||||||
}
|
|
||||||
|
|
||||||
// Add recommendations based on specific answers
|
|
||||||
if (isset($this->answers['q6']) && in_array('📧 E-Mails & Nachrichten beantworten', $this->answers['q6'])) {
|
|
||||||
$this->recommendations[] = [
|
|
||||||
'title' => 'E-Mail Flut bändigen',
|
|
||||||
'text' => 'Ein KI-gestützter Assistent kann Ihre E-Mails vorsortieren, Standardanfragen automatisch beantworten und Ihnen helfen, den Überblick zu behalten.',
|
|
||||||
'type' => 'specific'
|
|
||||||
];
|
|
||||||
}
|
|
||||||
if (isset($this->answers['q9']) && in_array('🤖 Kundenservice (Chatbot, FAQ)', $this->answers['q9'])) {
|
|
||||||
$this->recommendations[] = [
|
|
||||||
'title' => 'Kundenservice automatisieren',
|
|
||||||
'text' => 'Ein Chatbot kann häufig gestellte Fragen rund um die Uhr beantworten und Anfragen an die richtigen Mitarbeiter weiterleiten, was Ihr Team entlastet.',
|
|
||||||
'type' => 'specific'
|
|
||||||
];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public function sendEmail($recipientEmail)
|
|
||||||
{
|
|
||||||
require_once __DIR__ . '/mail/MailService.php';
|
|
||||||
|
|
||||||
// Generate the HTML body
|
|
||||||
$htmlBody = $this->getHtmlEmailBody();
|
|
||||||
$textBody = strip_tags($htmlBody);
|
|
||||||
|
|
||||||
// Send the email
|
|
||||||
$subject = 'Ihr persönlicher KI-Fit Check Report';
|
|
||||||
return MailService::sendMail($recipientEmail, $subject, $htmlBody, $textBody);
|
|
||||||
}
|
|
||||||
|
|
||||||
private function getHtmlEmailBody()
|
|
||||||
{
|
|
||||||
// Make report data available to the template
|
|
||||||
$score = $this->score;
|
|
||||||
$recommendations = $this->recommendations;
|
|
||||||
$answers = $this->answers;
|
|
||||||
|
|
||||||
ob_start();
|
|
||||||
include __DIR__ . '/email_template.php';
|
|
||||||
return ob_get_clean();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,51 +0,0 @@
|
|||||||
body {
|
|
||||||
font-family: 'Inter', sans-serif;
|
|
||||||
background-color: #f8f9fa;
|
|
||||||
}
|
|
||||||
|
|
||||||
.hero-section {
|
|
||||||
padding: 120px 0;
|
|
||||||
background: linear-gradient(45deg, #007bff, #6610f2);
|
|
||||||
position: relative;
|
|
||||||
margin-top: 56px; /* Adjust for fixed navbar */
|
|
||||||
}
|
|
||||||
|
|
||||||
.navbar-brand {
|
|
||||||
color: #007bff !important;
|
|
||||||
}
|
|
||||||
|
|
||||||
.card {
|
|
||||||
border-radius: 0.5rem;
|
|
||||||
transition: transform 0.2s ease-in-out;
|
|
||||||
}
|
|
||||||
|
|
||||||
.card:hover {
|
|
||||||
transform: translateY(-5px);
|
|
||||||
}
|
|
||||||
|
|
||||||
.btn-primary {
|
|
||||||
background-color: #007bff;
|
|
||||||
border-color: #007bff;
|
|
||||||
border-radius: 0.5rem;
|
|
||||||
padding: 12px 24px;
|
|
||||||
font-weight: bold;
|
|
||||||
transition: background-color 0.2s;
|
|
||||||
}
|
|
||||||
|
|
||||||
.btn-primary:hover {
|
|
||||||
background-color: #0056b3;
|
|
||||||
border-color: #0056b3;
|
|
||||||
}
|
|
||||||
|
|
||||||
footer a i {
|
|
||||||
font-size: 1.5rem;
|
|
||||||
transition: color 0.2s;
|
|
||||||
}
|
|
||||||
|
|
||||||
footer a:hover i {
|
|
||||||
color: #007bff;
|
|
||||||
}
|
|
||||||
|
|
||||||
section {
|
|
||||||
scroll-margin-top: 70px; /* Offset for navbar */
|
|
||||||
}
|
|
||||||
@ -1,414 +0,0 @@
|
|||||||
/* --- DESIGN TOKENS (from prompt) --- */
|
|
||||||
:root {
|
|
||||||
--bg-primary: #0A0E1A;
|
|
||||||
--bg-secondary: #0F1728;
|
|
||||||
--cyan: #00F5FF;
|
|
||||||
--purple: #A855F7;
|
|
||||||
--text-white: #FFFFFF;
|
|
||||||
--text-gray: #CBD5E1;
|
|
||||||
--font-heading: 'Space Grotesk', sans-serif;
|
|
||||||
--font-body: 'Inter', sans-serif;
|
|
||||||
--space-4: 32px;
|
|
||||||
--space-6: 48px;
|
|
||||||
--space-8: 64px;
|
|
||||||
}
|
|
||||||
|
|
||||||
body {
|
|
||||||
margin: 0;
|
|
||||||
font-family: var(--font-body);
|
|
||||||
background-color: var(--bg-primary);
|
|
||||||
color: var(--text-white);
|
|
||||||
}
|
|
||||||
|
|
||||||
.questionnaire-container {
|
|
||||||
min-height: 100vh;
|
|
||||||
background: var(--bg-primary);
|
|
||||||
display: flex;
|
|
||||||
flex-direction: column;
|
|
||||||
align-items: center;
|
|
||||||
justify-content: center;
|
|
||||||
position: relative;
|
|
||||||
overflow-x: hidden;
|
|
||||||
padding: 20px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.screen {
|
|
||||||
display: none;
|
|
||||||
width: 100%;
|
|
||||||
max-width: 700px;
|
|
||||||
text-align: center;
|
|
||||||
}
|
|
||||||
|
|
||||||
.screen.active {
|
|
||||||
display: block;
|
|
||||||
}
|
|
||||||
|
|
||||||
.screen-group {
|
|
||||||
margin-bottom: var(--space-8);
|
|
||||||
}
|
|
||||||
|
|
||||||
.section-title {
|
|
||||||
font: 24px var(--font-heading);
|
|
||||||
color: var(--purple);
|
|
||||||
text-transform: uppercase;
|
|
||||||
letter-spacing: 0.1em;
|
|
||||||
margin-bottom: var(--space-6);
|
|
||||||
text-align: center;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* --- PROGRESS BAR --- */
|
|
||||||
.progress-container {
|
|
||||||
width: 100%;
|
|
||||||
max-width: 700px;
|
|
||||||
position: fixed;
|
|
||||||
top: 20px;
|
|
||||||
left: 50%;
|
|
||||||
transform: translateX(-50%);
|
|
||||||
z-index: 10;
|
|
||||||
padding: 0 20px;
|
|
||||||
display: none; /* Initially hidden */
|
|
||||||
}
|
|
||||||
|
|
||||||
.progress-bar {
|
|
||||||
width: 100%;
|
|
||||||
background-color: var(--bg-secondary);
|
|
||||||
height: 10px;
|
|
||||||
border-radius: 5px;
|
|
||||||
overflow: hidden;
|
|
||||||
}
|
|
||||||
|
|
||||||
.progress-bar-inner {
|
|
||||||
height: 100%;
|
|
||||||
width: 0;
|
|
||||||
background: linear-gradient(90deg, var(--cyan), var(--purple));
|
|
||||||
transition: width 0.3s ease-in-out;
|
|
||||||
}
|
|
||||||
|
|
||||||
.progress-text {
|
|
||||||
text-align: right;
|
|
||||||
font-size: 14px;
|
|
||||||
color: var(--text-gray);
|
|
||||||
margin-top: 5px;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/* --- WELCOME SCREEN --- */
|
|
||||||
.welcome-screen {
|
|
||||||
min-height: 100vh;
|
|
||||||
padding: var(--space-6) var(--space-4);
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
justify-content: center;
|
|
||||||
}
|
|
||||||
|
|
||||||
.welcome-content {
|
|
||||||
max-width: 700px;
|
|
||||||
text-align: center;
|
|
||||||
}
|
|
||||||
|
|
||||||
.welcome-badge {
|
|
||||||
display: inline-block;
|
|
||||||
padding: 8px 20px;
|
|
||||||
background: linear-gradient(135deg, var(--cyan), var(--purple));
|
|
||||||
border-radius: 50px;
|
|
||||||
font: 14px var(--font-heading);
|
|
||||||
font-weight: bold;
|
|
||||||
text-transform: uppercase;
|
|
||||||
color: var(--bg-primary);
|
|
||||||
letter-spacing: 0.1em;
|
|
||||||
margin-bottom: var(--space-4);
|
|
||||||
}
|
|
||||||
|
|
||||||
.welcome-title {
|
|
||||||
font: 56px var(--font-heading);
|
|
||||||
font-weight: bold;
|
|
||||||
color: var(--text-white);
|
|
||||||
line-height: 1.2;
|
|
||||||
margin-bottom: 24px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.gradient-text {
|
|
||||||
background: linear-gradient(135deg, var(--cyan), var(--purple));
|
|
||||||
-webkit-background-clip: text;
|
|
||||||
-webkit-text-fill-color: transparent;
|
|
||||||
}
|
|
||||||
|
|
||||||
.welcome-description {
|
|
||||||
font: 20px var(--font-body);
|
|
||||||
color: var(--text-gray);
|
|
||||||
line-height: 1.6;
|
|
||||||
margin-bottom: var(--space-6);
|
|
||||||
}
|
|
||||||
|
|
||||||
.welcome-benefits {
|
|
||||||
display: flex;
|
|
||||||
gap: var(--space-4);
|
|
||||||
justify-content: center;
|
|
||||||
margin-bottom: var(--space-6);
|
|
||||||
flex-wrap: wrap;
|
|
||||||
}
|
|
||||||
|
|
||||||
.benefit-item {
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
gap: 8px;
|
|
||||||
font-size: 16px;
|
|
||||||
color: var(--text-gray);
|
|
||||||
}
|
|
||||||
|
|
||||||
.welcome-note {
|
|
||||||
font-size: 14px;
|
|
||||||
color: var(--text-gray);
|
|
||||||
margin-top: var(--space-4);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* --- QUESTION SCREENS --- */
|
|
||||||
.question-screen h3 {
|
|
||||||
font: 36px var(--font-heading);
|
|
||||||
color: var(--text-white);
|
|
||||||
margin-bottom: var(--space-6);
|
|
||||||
}
|
|
||||||
|
|
||||||
.options-container {
|
|
||||||
display: flex;
|
|
||||||
flex-direction: column;
|
|
||||||
gap: 15px;
|
|
||||||
margin-bottom: var(--space-6);
|
|
||||||
}
|
|
||||||
|
|
||||||
.option-label {
|
|
||||||
display: block;
|
|
||||||
background: var(--bg-secondary);
|
|
||||||
padding: 20px;
|
|
||||||
border-radius: 10px;
|
|
||||||
border: 1px solid transparent;
|
|
||||||
cursor: pointer;
|
|
||||||
transition: all 0.2s ease-in-out;
|
|
||||||
text-align: left;
|
|
||||||
}
|
|
||||||
|
|
||||||
.option-label:hover {
|
|
||||||
border-color: var(--cyan);
|
|
||||||
}
|
|
||||||
|
|
||||||
.option-label input {
|
|
||||||
margin-right: 15px;
|
|
||||||
accent-color: var(--purple);
|
|
||||||
}
|
|
||||||
|
|
||||||
.option-label input:checked + span {
|
|
||||||
color: var(--cyan);
|
|
||||||
}
|
|
||||||
|
|
||||||
input[type="text"],
|
|
||||||
textarea {
|
|
||||||
width: 100%;
|
|
||||||
background: var(--bg-secondary);
|
|
||||||
border: 1px solid var(--text-gray);
|
|
||||||
border-radius: 10px;
|
|
||||||
padding: 15px;
|
|
||||||
color: var(--text-white);
|
|
||||||
font-family: var(--font-body);
|
|
||||||
font-size: 16px;
|
|
||||||
box-sizing: border-box;
|
|
||||||
}
|
|
||||||
|
|
||||||
textarea {
|
|
||||||
min-height: 120px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.hint {
|
|
||||||
font-size: 14px;
|
|
||||||
color: var(--text-gray);
|
|
||||||
text-align: left;
|
|
||||||
margin-top: 10px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.scale-container {
|
|
||||||
display: flex;
|
|
||||||
justify-content: space-between;
|
|
||||||
align-items: center;
|
|
||||||
gap: 10px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.scale-container > span {
|
|
||||||
font-size: 14px;
|
|
||||||
color: var(--text-gray);
|
|
||||||
flex: 1;
|
|
||||||
text-align: center;
|
|
||||||
}
|
|
||||||
|
|
||||||
.scale-label {
|
|
||||||
display: flex;
|
|
||||||
flex-direction: column;
|
|
||||||
align-items: center;
|
|
||||||
cursor: pointer;
|
|
||||||
}
|
|
||||||
|
|
||||||
.scale-label input {
|
|
||||||
accent-color: var(--purple);
|
|
||||||
}
|
|
||||||
|
|
||||||
.scale-label span {
|
|
||||||
margin-top: 5px;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* --- NAVIGATION --- */
|
|
||||||
.navigation-buttons {
|
|
||||||
display: flex;
|
|
||||||
justify-content: center;
|
|
||||||
gap: 20px;
|
|
||||||
margin-top: var(--space-4);
|
|
||||||
}
|
|
||||||
|
|
||||||
.btn-start, .btn-next, .btn-prev, .btn-submit {
|
|
||||||
padding: 15px 30px;
|
|
||||||
border-radius: 50px;
|
|
||||||
border: 1px solid var(--cyan);
|
|
||||||
background: transparent;
|
|
||||||
color: var(--cyan);
|
|
||||||
font-family: var(--font-heading);
|
|
||||||
font-size: 16px;
|
|
||||||
cursor: pointer;
|
|
||||||
transition: all 0.3s ease;
|
|
||||||
}
|
|
||||||
|
|
||||||
.btn-start, .btn-next, .btn-submit {
|
|
||||||
background: var(--cyan);
|
|
||||||
color: var(--bg-primary);
|
|
||||||
}
|
|
||||||
|
|
||||||
.btn-start:hover, .btn-next:hover, .btn-submit:hover {
|
|
||||||
background: var(--purple);
|
|
||||||
border-color: var(--purple);
|
|
||||||
color: var(--text-white);
|
|
||||||
transform: translateY(-2px);
|
|
||||||
box-shadow: 0 5px 15px rgba(168, 85, 247, 0.3);
|
|
||||||
}
|
|
||||||
|
|
||||||
.btn-prev {
|
|
||||||
color: var(--text-gray);
|
|
||||||
border-color: var(--text-gray);
|
|
||||||
}
|
|
||||||
|
|
||||||
.btn-prev:hover {
|
|
||||||
background: var(--bg-secondary);
|
|
||||||
color: var(--text-white);
|
|
||||||
border-color: var(--text-white);
|
|
||||||
}
|
|
||||||
|
|
||||||
.consent-label {
|
|
||||||
display: flex;
|
|
||||||
align-items: flex-start; /* Align items to the top */
|
|
||||||
text-align: left;
|
|
||||||
gap: 15px; /* Space between checkbox and text */
|
|
||||||
}
|
|
||||||
|
|
||||||
.consent-label input[type="checkbox"] {
|
|
||||||
margin-top: 5px; /* Align checkbox with the first line of text */
|
|
||||||
flex-shrink: 0; /* Prevent checkbox from shrinking */
|
|
||||||
}
|
|
||||||
|
|
||||||
.consent-label a {
|
|
||||||
color: var(--cyan);
|
|
||||||
text-decoration: underline;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* --- Final Screens --- */
|
|
||||||
#email-screen h3, #consent-screen h3 {
|
|
||||||
font-size: 24px;
|
|
||||||
color: var(--text-gray);
|
|
||||||
font-weight: 400;
|
|
||||||
margin-bottom: var(--space-6);
|
|
||||||
}
|
|
||||||
|
|
||||||
#email-screen .options-container, #consent-screen .options-container {
|
|
||||||
max-width: 500px; /* Narrower container for these steps */
|
|
||||||
margin-left: auto;
|
|
||||||
margin-right: auto;
|
|
||||||
}
|
|
||||||
|
|
||||||
#thank-you-screen h2 {
|
|
||||||
font: 48px var(--font-heading);
|
|
||||||
color: var(--text-white);
|
|
||||||
margin-bottom: 24px;
|
|
||||||
background: linear-gradient(135deg, var(--cyan), var(--purple));
|
|
||||||
-webkit-background-clip: text;
|
|
||||||
-webkit-text-fill-color: transparent;
|
|
||||||
}
|
|
||||||
|
|
||||||
#thank-you-screen p {
|
|
||||||
font-size: 20px;
|
|
||||||
color: var(--text-gray);
|
|
||||||
line-height: 1.6;
|
|
||||||
margin-bottom: var(--space-4);
|
|
||||||
}
|
|
||||||
|
|
||||||
#email-input, #consent-checkbox {
|
|
||||||
margin-bottom: var(--space-4);
|
|
||||||
}
|
|
||||||
|
|
||||||
#email-input {
|
|
||||||
width: 100%;
|
|
||||||
padding: 15px;
|
|
||||||
background: var(--bg-secondary);
|
|
||||||
border: 1px solid var(--text-gray);
|
|
||||||
border-radius: 10px;
|
|
||||||
color: var(--text-white);
|
|
||||||
font-size: 16px;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* --- RESPONSIVE --- */
|
|
||||||
@media (max-width: 768px) {
|
|
||||||
:root {
|
|
||||||
--space-4: 24px;
|
|
||||||
--space-6: 32px;
|
|
||||||
--space-8: 48px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.welcome-title {
|
|
||||||
font-size: 40px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.welcome-description {
|
|
||||||
font-size: 18px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.question-screen h3 {
|
|
||||||
font-size: 28px;
|
|
||||||
}
|
|
||||||
|
|
||||||
#email-screen h3, #consent-screen h3 {
|
|
||||||
font-size: 20px;
|
|
||||||
}
|
|
||||||
|
|
||||||
#thank-you-screen h2 {
|
|
||||||
font-size: 36px;
|
|
||||||
}
|
|
||||||
|
|
||||||
#thank-you-screen p {
|
|
||||||
font-size: 18px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.progress-container {
|
|
||||||
padding: 0 15px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.navigation-buttons {
|
|
||||||
flex-direction: column;
|
|
||||||
gap: 15px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.btn-start, .btn-next, .btn-prev, .btn-submit {
|
|
||||||
width: 100%;
|
|
||||||
}
|
|
||||||
|
|
||||||
.scale-container {
|
|
||||||
flex-direction: column;
|
|
||||||
gap: 20px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.scale-container > span {
|
|
||||||
text-align: center;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,32 +0,0 @@
|
|||||||
// Bootstrap 5 form validation
|
|
||||||
(function () {
|
|
||||||
'use strict'
|
|
||||||
|
|
||||||
// Fetch all the forms we want to apply custom Bootstrap validation styles to
|
|
||||||
var forms = document.querySelectorAll('.needs-validation')
|
|
||||||
|
|
||||||
// Loop over them and prevent submission
|
|
||||||
Array.prototype.slice.call(forms)
|
|
||||||
.forEach(function (form) {
|
|
||||||
form.addEventListener('submit', function (event) {
|
|
||||||
if (!form.checkValidity()) {
|
|
||||||
event.preventDefault()
|
|
||||||
event.stopPropagation()
|
|
||||||
}
|
|
||||||
|
|
||||||
form.classList.add('was-validated')
|
|
||||||
}, false)
|
|
||||||
})
|
|
||||||
|
|
||||||
const contactForm = document.getElementById('contactForm');
|
|
||||||
if(contactForm) {
|
|
||||||
contactForm.addEventListener('submit', function(e) {
|
|
||||||
if (!contactForm.checkValidity()) {
|
|
||||||
e.preventDefault();
|
|
||||||
e.stopPropagation();
|
|
||||||
}
|
|
||||||
contactForm.classList.add('was-validated');
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
})()
|
|
||||||
@ -1,151 +0,0 @@
|
|||||||
document.addEventListener('DOMContentLoaded', () => {
|
|
||||||
const screens = Array.from(document.querySelectorAll('.screen'));
|
|
||||||
const progressBar = document.getElementById('progressBar');
|
|
||||||
const progressText = document.getElementById('progressText');
|
|
||||||
const progressContainer = document.querySelector('.progress-container');
|
|
||||||
const form = document.getElementById('questionnaire-form');
|
|
||||||
const totalQuestions = 15; // Only count the actual questions
|
|
||||||
|
|
||||||
let currentScreenIndex = 0;
|
|
||||||
|
|
||||||
// --- Core Navigation ---
|
|
||||||
window.startQuestionnaire = () => {
|
|
||||||
const welcomeScreen = document.getElementById('welcome-screen');
|
|
||||||
const firstQuestion = document.getElementById('question-1');
|
|
||||||
if (welcomeScreen) welcomeScreen.classList.remove('active');
|
|
||||||
if (firstQuestion) firstQuestion.classList.add('active');
|
|
||||||
currentScreenIndex = screens.indexOf(firstQuestion);
|
|
||||||
progressContainer.style.display = 'flex';
|
|
||||||
updateProgress();
|
|
||||||
};
|
|
||||||
|
|
||||||
window.navigate = (direction) => {
|
|
||||||
if (direction > 0 && !validateCurrentScreen()) {
|
|
||||||
// You can add a user-facing warning here if you like
|
|
||||||
console.warn("Validation failed for the current screen.");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
const nextIndex = currentScreenIndex + direction;
|
|
||||||
if (nextIndex >= 0 && nextIndex < screens.length) {
|
|
||||||
screens[currentScreenIndex].classList.remove('active');
|
|
||||||
currentScreenIndex = nextIndex;
|
|
||||||
screens[currentScreenIndex].classList.add('active');
|
|
||||||
updateProgress();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
const updateProgress = () => {
|
|
||||||
const activeScreen = screens[currentScreenIndex];
|
|
||||||
let currentQuestionNumber = 0;
|
|
||||||
|
|
||||||
if (activeScreen && activeScreen.dataset.questionId) {
|
|
||||||
const id = parseInt(activeScreen.dataset.questionId);
|
|
||||||
if (id <= totalQuestions) {
|
|
||||||
currentQuestionNumber = id;
|
|
||||||
} else {
|
|
||||||
// For email/consent screens, show progress as 15/15
|
|
||||||
currentQuestionNumber = totalQuestions;
|
|
||||||
}
|
|
||||||
} else if (activeScreen.id === 'welcome-screen') {
|
|
||||||
currentQuestionNumber = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
const progressPercentage = (currentQuestionNumber / totalQuestions) * 100;
|
|
||||||
progressBar.style.width = `${progressPercentage}%`;
|
|
||||||
progressText.textContent = currentQuestionNumber;
|
|
||||||
};
|
|
||||||
|
|
||||||
const validateCurrentScreen = () => {
|
|
||||||
const activeScreen = screens[currentScreenIndex];
|
|
||||||
const questionId = activeScreen.dataset.questionId;
|
|
||||||
|
|
||||||
// No validation needed for welcome screen or thank you screen
|
|
||||||
if (!questionId) return true;
|
|
||||||
|
|
||||||
if (questionId <= totalQuestions) {
|
|
||||||
const inputs = activeScreen.querySelectorAll('input, textarea');
|
|
||||||
if (inputs.length === 0) return true;
|
|
||||||
|
|
||||||
if (inputs[0].type === 'radio' || inputs[0].type === 'checkbox') {
|
|
||||||
return Array.from(inputs).some(input => input.checked);
|
|
||||||
}
|
|
||||||
return inputs[0].value.trim() !== '';
|
|
||||||
}
|
|
||||||
|
|
||||||
if (questionId == 16) { // Email screen
|
|
||||||
const emailInput = document.getElementById('email-input');
|
|
||||||
// Basic regex for email validation
|
|
||||||
const emailRegex = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
|
|
||||||
return emailInput && emailInput.value.trim() !== '' && emailRegex.test(emailInput.value);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (questionId == 17) { // Consent screen
|
|
||||||
const consentCheckbox = document.getElementById('consent-checkbox');
|
|
||||||
return consentCheckbox && consentCheckbox.checked;
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
};
|
|
||||||
|
|
||||||
document.querySelectorAll('input.auto-advance').forEach(input => {
|
|
||||||
input.addEventListener('change', () => {
|
|
||||||
if (input.checked) {
|
|
||||||
setTimeout(() => navigate(1), 300);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
form.addEventListener('submit', (e) => {
|
|
||||||
e.preventDefault();
|
|
||||||
if (!validateCurrentScreen()) {
|
|
||||||
alert('Bitte überprüfen Sie Ihre Eingabe und stimmen Sie den Datenschutzbestimmungen zu.');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
const submitButton = form.querySelector('button[type="submit"]');
|
|
||||||
submitButton.disabled = true;
|
|
||||||
submitButton.textContent = 'Wird gesendet...';
|
|
||||||
|
|
||||||
const formData = new FormData(form);
|
|
||||||
|
|
||||||
fetch('submit.php', {
|
|
||||||
method: 'POST',
|
|
||||||
body: formData
|
|
||||||
})
|
|
||||||
.then(response => response.json())
|
|
||||||
.then(data => {
|
|
||||||
if (data.success) {
|
|
||||||
// Show thank you screen
|
|
||||||
const thankYouScreen = document.getElementById('thank-you-screen');
|
|
||||||
screens[currentScreenIndex].classList.remove('active');
|
|
||||||
if(thankYouScreen) {
|
|
||||||
thankYouScreen.classList.add('active');
|
|
||||||
currentScreenIndex = screens.indexOf(thankYouScreen);
|
|
||||||
progressContainer.style.display = 'none'; // Hide progress on thank you
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
alert('Fehler: ' + data.error);
|
|
||||||
submitButton.disabled = false;
|
|
||||||
submitButton.textContent = 'Absenden & Report erhalten →';
|
|
||||||
}
|
|
||||||
})
|
|
||||||
.catch(error => {
|
|
||||||
console.error('Fetch Error:', error);
|
|
||||||
alert('Ein unerwarteter Fehler ist aufgetreten. Bitte versuchen Sie es später erneut.');
|
|
||||||
submitButton.disabled = false;
|
|
||||||
submitButton.textContent = 'Absenden & Report erhalten →';
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
// Initial setup
|
|
||||||
const firstScreen = document.getElementById('welcome-screen');
|
|
||||||
if(firstScreen) {
|
|
||||||
currentScreenIndex = screens.indexOf(firstScreen);
|
|
||||||
firstScreen.classList.add('active');
|
|
||||||
} else {
|
|
||||||
screens[0].classList.add('active');
|
|
||||||
}
|
|
||||||
progressContainer.style.display = 'none';
|
|
||||||
updateProgress();
|
|
||||||
});
|
|
||||||
Binary file not shown.
|
Before Width: | Height: | Size: 138 KiB |
@ -1,52 +0,0 @@
|
|||||||
<?php
|
|
||||||
// This is a template file. It expects variables like $score, $recommendations, and $answers to be in scope.
|
|
||||||
?>
|
|
||||||
<!DOCTYPE html>
|
|
||||||
<html lang="de">
|
|
||||||
<head>
|
|
||||||
<meta charset="UTF-8">
|
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
||||||
<title>Ihr KI-Fit Check Report</title>
|
|
||||||
<style>
|
|
||||||
body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif; margin: 0; padding: 0; background-color: #f4f4f4; color: #333; }
|
|
||||||
.container { max-width: 600px; margin: 40px auto; background: #fff; border-radius: 8px; overflow: hidden; box-shadow: 0 4px 15px rgba(0,0,0,0.1); }
|
|
||||||
.header { background: #0A0E1A; color: #fff; padding: 40px; text-align: center; }
|
|
||||||
.header h1 { margin: 0; font-size: 28px; }
|
|
||||||
.header .score { font-size: 60px; font-weight: bold; margin: 10px 0; color: #00F5FF; }
|
|
||||||
.content { padding: 30px; }
|
|
||||||
h2 { font-size: 22px; color: #A855F7; border-bottom: 2px solid #eee; padding-bottom: 10px; margin-top: 30px; }
|
|
||||||
.recommendation { margin-bottom: 20px; }
|
|
||||||
.recommendation h3 { font-size: 18px; margin-bottom: 5px; color: #333; }
|
|
||||||
.recommendation p { font-size: 16px; line-height: 1.6; color: #555; }
|
|
||||||
.footer { background: #f4f4f4; text-align: center; padding: 20px; font-size: 12px; color: #888; }
|
|
||||||
</style>
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<div class="container">
|
|
||||||
<div class="header">
|
|
||||||
<h1>Ihr KI-Potenzial Score</h1>
|
|
||||||
<div class="score"><?php echo htmlspecialchars($score); ?> / 100</div>
|
|
||||||
</div>
|
|
||||||
<div class="content">
|
|
||||||
<p>Vielen Dank für Ihre Teilnahme am KI-Fit Check. Basierend auf Ihren Antworten haben wir eine erste Einschätzung und Empfehlungen für Sie erstellt.</p>
|
|
||||||
|
|
||||||
<h2>Ihre Top-Empfehlungen</h2>
|
|
||||||
<?php foreach ($recommendations as $rec): ?>
|
|
||||||
<div class="recommendation">
|
|
||||||
<h3><?php echo htmlspecialchars($rec['title']); ?></h3>
|
|
||||||
<p><?php echo htmlspecialchars($rec['text']); ?></p>
|
|
||||||
</div>
|
|
||||||
<?php endforeach; ?>
|
|
||||||
|
|
||||||
<h2>Nächste Schritte</h2>
|
|
||||||
<p>Möchten Sie eine detaillierte Analyse und einen konkreten Umsetzungsplan? Vereinbaren Sie ein kostenloses Erstgespräch mit einem unserer KI-Experten.</p>
|
|
||||||
<p style="text-align: center; margin-top: 30px;">
|
|
||||||
<a href="https://calendly.com/" style="background-color: #A855F7; color: #fff; padding: 15px 30px; text-decoration: none; border-radius: 50px; font-weight: bold;">Jetzt Termin vereinbaren</a>
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
<div class="footer">
|
|
||||||
<p>© <?php echo date('Y'); ?> Ihr Firmenname. Alle Rechte vorbehalten.</p>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
||||||
325
index.php
325
index.php
@ -1,195 +1,150 @@
|
|||||||
<?php
|
<?php
|
||||||
declare(strict_types=1);
|
declare(strict_types=1);
|
||||||
ini_set('display_errors', '1');
|
@ini_set('display_errors', '1');
|
||||||
error_reporting(E_ALL);
|
@error_reporting(E_ALL);
|
||||||
|
@date_default_timezone_set('UTC');
|
||||||
|
|
||||||
$message_sent = false;
|
$phpVersion = PHP_VERSION;
|
||||||
$error_message = '';
|
$now = date('Y-m-d H:i:s');
|
||||||
|
|
||||||
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
|
||||||
require_once __DIR__ . '/mail/MailService.php';
|
|
||||||
|
|
||||||
$name = trim($_POST['name'] ?? '');
|
|
||||||
$email = trim($_POST['email'] ?? '');
|
|
||||||
$message = trim($_POST['message'] ?? '');
|
|
||||||
|
|
||||||
if (empty($name) || empty($email) || empty($message)) {
|
|
||||||
$error_message = 'Please fill in all fields.';
|
|
||||||
} elseif (!filter_var($email, FILTER_VALIDATE_EMAIL)) {
|
|
||||||
$error_message = 'Invalid email format.';
|
|
||||||
} else {
|
|
||||||
$to = getenv('MAIL_TO') ?: 'support@yourdomain.com';
|
|
||||||
$subject = 'New Contact Form Submission';
|
|
||||||
|
|
||||||
$res = MailService::sendContactMessage($name, $email, $message, $to, $subject);
|
|
||||||
|
|
||||||
if (!empty($res['success'])) {
|
|
||||||
$message_sent = true;
|
|
||||||
} else {
|
|
||||||
$error_message = 'Failed to send message. ' . htmlspecialchars($res['error'] ?? 'Please try again later.');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
?>
|
?>
|
||||||
<!doctype html>
|
<!doctype html>
|
||||||
<html lang="en">
|
<html lang="en">
|
||||||
<head>
|
<head>
|
||||||
<meta charset="utf-8" />
|
<meta charset="utf-8" />
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||||
<title>Future Now - AI Potential Unlocked</title>
|
<title>New Style</title>
|
||||||
|
<?php
|
||||||
<?php
|
// Read project preview data from environment
|
||||||
$projectDescription = $_SERVER['PROJECT_DESCRIPTION'] ?? 'Unlock your AI potential with a free, 5-minute AI-Check. Get a personalized blueprint and a clear roadmap for your business.';
|
$projectDescription = $_SERVER['PROJECT_DESCRIPTION'] ?? '';
|
||||||
$projectImageUrl = $_SERVER['PROJECT_IMAGE_URL'] ?? '';
|
$projectImageUrl = $_SERVER['PROJECT_IMAGE_URL'] ?? '';
|
||||||
?>
|
?>
|
||||||
<meta name="description" content="<?= htmlspecialchars($projectDescription) ?>" />
|
<?php if ($projectDescription): ?>
|
||||||
<?php if ($projectDescription): ?>
|
<!-- Meta description -->
|
||||||
<meta property="og:description" content="<?= htmlspecialchars($projectDescription) ?>" />
|
<meta name="description" content='<?= htmlspecialchars($projectDescription) ?>' />
|
||||||
<meta property="twitter:description" content="<?= htmlspecialchars($projectDescription) ?>" />
|
<!-- Open Graph meta tags -->
|
||||||
<?php endif; ?>
|
<meta property="og:description" content="<?= htmlspecialchars($projectDescription) ?>" />
|
||||||
<?php if ($projectImageUrl): ?>
|
<!-- Twitter meta tags -->
|
||||||
<meta property="og:image" content="<?= htmlspecialchars($projectImageUrl) ?>" />
|
<meta property="twitter:description" content="<?= htmlspecialchars($projectDescription) ?>" />
|
||||||
<meta property="twitter:image" content="<?= htmlspecialchars($projectImageUrl) ?>" />
|
<?php endif; ?>
|
||||||
<?php endif; ?>
|
<?php if ($projectImageUrl): ?>
|
||||||
|
<!-- Open Graph image -->
|
||||||
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.min.css" rel="stylesheet">
|
<meta property="og:image" content="<?= htmlspecialchars($projectImageUrl) ?>" />
|
||||||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.11.3/font/bootstrap-icons.css">
|
<!-- Twitter image -->
|
||||||
<link rel="preconnect" href="https://fonts.googleapis.com">
|
<meta property="twitter:image" content="<?= htmlspecialchars($projectImageUrl) ?>" />
|
||||||
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
<?php endif; ?>
|
||||||
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;700&display=swap" rel="stylesheet">
|
<link rel="preconnect" href="https://fonts.googleapis.com">
|
||||||
<link rel="stylesheet" href="assets/css/custom.css?v=<?php echo time(); ?>">
|
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
||||||
|
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;700&display=swap" rel="stylesheet">
|
||||||
|
<style>
|
||||||
|
:root {
|
||||||
|
--bg-color-start: #6a11cb;
|
||||||
|
--bg-color-end: #2575fc;
|
||||||
|
--text-color: #ffffff;
|
||||||
|
--card-bg-color: rgba(255, 255, 255, 0.01);
|
||||||
|
--card-border-color: rgba(255, 255, 255, 0.1);
|
||||||
|
}
|
||||||
|
body {
|
||||||
|
margin: 0;
|
||||||
|
font-family: 'Inter', sans-serif;
|
||||||
|
background: linear-gradient(45deg, var(--bg-color-start), var(--bg-color-end));
|
||||||
|
color: var(--text-color);
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
min-height: 100vh;
|
||||||
|
text-align: center;
|
||||||
|
overflow: hidden;
|
||||||
|
position: relative;
|
||||||
|
}
|
||||||
|
body::before {
|
||||||
|
content: '';
|
||||||
|
position: absolute;
|
||||||
|
top: 0;
|
||||||
|
left: 0;
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
background-image: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="100" height="100" viewBox="0 0 100 100"><path d="M-10 10L110 10M10 -10L10 110" stroke-width="1" stroke="rgba(255,255,255,0.05)"/></svg>');
|
||||||
|
animation: bg-pan 20s linear infinite;
|
||||||
|
z-index: -1;
|
||||||
|
}
|
||||||
|
@keyframes bg-pan {
|
||||||
|
0% { background-position: 0% 0%; }
|
||||||
|
100% { background-position: 100% 100%; }
|
||||||
|
}
|
||||||
|
main {
|
||||||
|
padding: 2rem;
|
||||||
|
}
|
||||||
|
.card {
|
||||||
|
background: var(--card-bg-color);
|
||||||
|
border: 1px solid var(--card-border-color);
|
||||||
|
border-radius: 16px;
|
||||||
|
padding: 2rem;
|
||||||
|
backdrop-filter: blur(20px);
|
||||||
|
-webkit-backdrop-filter: blur(20px);
|
||||||
|
box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.1);
|
||||||
|
}
|
||||||
|
.loader {
|
||||||
|
margin: 1.25rem auto 1.25rem;
|
||||||
|
width: 48px;
|
||||||
|
height: 48px;
|
||||||
|
border: 3px solid rgba(255, 255, 255, 0.25);
|
||||||
|
border-top-color: #fff;
|
||||||
|
border-radius: 50%;
|
||||||
|
animation: spin 1s linear infinite;
|
||||||
|
}
|
||||||
|
@keyframes spin {
|
||||||
|
from { transform: rotate(0deg); }
|
||||||
|
to { transform: rotate(360deg); }
|
||||||
|
}
|
||||||
|
.hint {
|
||||||
|
opacity: 0.9;
|
||||||
|
}
|
||||||
|
.sr-only {
|
||||||
|
position: absolute;
|
||||||
|
width: 1px; height: 1px;
|
||||||
|
padding: 0; margin: -1px;
|
||||||
|
overflow: hidden;
|
||||||
|
clip: rect(0, 0, 0, 0);
|
||||||
|
white-space: nowrap; border: 0;
|
||||||
|
}
|
||||||
|
h1 {
|
||||||
|
font-size: 3rem;
|
||||||
|
font-weight: 700;
|
||||||
|
margin: 0 0 1rem;
|
||||||
|
letter-spacing: -1px;
|
||||||
|
}
|
||||||
|
p {
|
||||||
|
margin: 0.5rem 0;
|
||||||
|
font-size: 1.1rem;
|
||||||
|
}
|
||||||
|
code {
|
||||||
|
background: rgba(0,0,0,0.2);
|
||||||
|
padding: 2px 6px;
|
||||||
|
border-radius: 4px;
|
||||||
|
font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
|
||||||
|
}
|
||||||
|
footer {
|
||||||
|
position: absolute;
|
||||||
|
bottom: 1rem;
|
||||||
|
font-size: 0.8rem;
|
||||||
|
opacity: 0.7;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
<main>
|
||||||
<nav class="navbar navbar-expand-lg navbar-light bg-light fixed-top">
|
<div class="card">
|
||||||
<div class="container">
|
<h1>Analyzing your requirements and generating your website…</h1>
|
||||||
<a class="navbar-brand fw-bold" href="#">Future Now</a>
|
<div class="loader" role="status" aria-live="polite" aria-label="Applying initial changes">
|
||||||
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarNav" aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation">
|
<span class="sr-only">Loading…</span>
|
||||||
<span class="navbar-toggler-icon"></span>
|
</div>
|
||||||
</button>
|
<p class="hint"><?= ($_SERVER['HTTP_HOST'] ?? '') === 'appwizzy.com' ? 'AppWizzy' : 'Flatlogic' ?> AI is collecting your requirements and applying the first changes.</p>
|
||||||
<div class="collapse navbar-collapse" id="navbarNav">
|
<p class="hint">This page will update automatically as the plan is implemented.</p>
|
||||||
<ul class="navbar-nav ms-auto">
|
<p>Runtime: PHP <code><?= htmlspecialchars($phpVersion) ?></code> — UTC <code><?= htmlspecialchars($now) ?></code></p>
|
||||||
<li class="nav-item"><a class="nav-link" href="#about">About</a></li>
|
</div>
|
||||||
<li class="nav-item"><a class="nav-link" href="#features">Features</a></li>
|
</main>
|
||||||
<li class="nav-item"><a class="nav-link" href="#contact">Contact</a></li>
|
<footer>
|
||||||
</ul>
|
Page updated: <?= htmlspecialchars($now) ?> (UTC)
|
||||||
</div>
|
</footer>
|
||||||
</div>
|
|
||||||
</nav>
|
|
||||||
|
|
||||||
<header id="hero" class="hero-section text-center text-white d-flex align-items-center justify-content-center">
|
|
||||||
<div class="container">
|
|
||||||
<h1 class="display-3 fw-bold">Unlock Your Business's AI Potential</h1>
|
|
||||||
<p class="lead">Take our free 5-minute AI-Check and get a personalized blueprint for success.</p>
|
|
||||||
<a href="questionnaire.php" class="btn btn-primary btn-lg mt-3">Start AI-Check Now</a>
|
|
||||||
</div>
|
|
||||||
</header>
|
|
||||||
|
|
||||||
<main class="container my-5">
|
|
||||||
<section id="about" class="py-5">
|
|
||||||
<div class="row">
|
|
||||||
<div class="col-lg-6">
|
|
||||||
<h2 class="fw-bold">What is the AI-Check?</h2>
|
|
||||||
<p>Our AI-Check is a quick and easy questionnaire designed to assess your company's current AI integration status. In just 5 minutes, we can provide you with a personalized blueprint, a clear roadmap, and concrete AI use cases for your industry.</p>
|
|
||||||
</div>
|
|
||||||
<div class="col-lg-6 d-flex align-items-center justify-content-center">
|
|
||||||
<i class="bi bi-cpu-fill display-1 text-primary"></i>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</section>
|
|
||||||
|
|
||||||
<section id="features" class="py-5 bg-light rounded-3">
|
|
||||||
<div class="text-center mb-5">
|
|
||||||
<h2 class="fw-bold">Your Personalized AI Blueprint</h2>
|
|
||||||
<p class="text-muted">Actionable recommendations for immediate implementation.</p>
|
|
||||||
</div>
|
|
||||||
<div class="row text-center">
|
|
||||||
<div class="col-md-4 mb-4">
|
|
||||||
<div class="card h-100 shadow-sm border-0">
|
|
||||||
<div class="card-body">
|
|
||||||
<i class="bi bi-bar-chart-line-fill display-4 text-primary mb-3"></i>
|
|
||||||
<h5 class="card-title fw-bold">Clear Roadmap</h5>
|
|
||||||
<p class="card-text">A step-by-step guide to integrating AI into your business.</p>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="col-md-4 mb-4">
|
|
||||||
<div class="card h-100 shadow-sm border-0">
|
|
||||||
<div class="card-body">
|
|
||||||
<i class="bi bi-lightbulb-fill display-4 text-primary mb-3"></i>
|
|
||||||
<h5 class="card-title fw-bold">Concrete Use-Cases</h5>
|
|
||||||
<p class="card-text">Discover AI applications specific to your industry and needs.</p>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="col-md-4 mb-4">
|
|
||||||
<div class="card h-100 shadow-sm border-0">
|
|
||||||
<div class="card-body">
|
|
||||||
<i class="bi bi-check-circle-fill display-4 text-primary mb-3"></i>
|
|
||||||
<h5 class="card-title fw-bold">Immediate Implementation</h5>
|
|
||||||
<p class="card-text">Actionable advice you can use right away to gain an AI advantage.</p>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</section>
|
|
||||||
|
|
||||||
<section id="contact" class="py-5">
|
|
||||||
<div class="row justify-content-center">
|
|
||||||
<div class="col-lg-8">
|
|
||||||
<div class="text-center mb-5">
|
|
||||||
<h2 class="fw-bold">Contact Us</h2>
|
|
||||||
<p class="text-muted">Have questions? We'd love to hear from you.</p>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<?php if ($message_sent): ?>
|
|
||||||
<div class="alert alert-success" role="alert">
|
|
||||||
Thank you for your message! We will get back to you shortly.
|
|
||||||
</div>
|
|
||||||
<?php endif; ?>
|
|
||||||
<?php if ($error_message): ?>
|
|
||||||
<div class="alert alert-danger" role="alert">
|
|
||||||
<?= $error_message ?>
|
|
||||||
</div>
|
|
||||||
<?php endif; ?>
|
|
||||||
|
|
||||||
<form action="#contact" method="POST" id="contactForm" novalidate>
|
|
||||||
<div class="mb-3">
|
|
||||||
<label for="name" class="form-label">Name</label>
|
|
||||||
<input type="text" class="form-control" id="name" name="name" required>
|
|
||||||
<div class="invalid-feedback">A name is required.</div>
|
|
||||||
</div>
|
|
||||||
<div class="mb-3">
|
|
||||||
<label for="email" class="form-label">Email address</label>
|
|
||||||
<input type="email" class="form-control" id="email" name="email" required>
|
|
||||||
<div class="invalid-feedback">A valid email is required.</div>
|
|
||||||
</div>
|
|
||||||
<div class="mb-3">
|
|
||||||
<label for="message" class="form-label">Message</label>
|
|
||||||
<textarea class="form-control" id="message" name="message" rows="5" required></textarea>
|
|
||||||
<div class="invalid-feedback">A message is required.</div>
|
|
||||||
</div>
|
|
||||||
<div class="text-center">
|
|
||||||
<button type="submit" class="btn btn-primary btn-lg">Send Message</button>
|
|
||||||
</div>
|
|
||||||
</form>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</section>
|
|
||||||
</main>
|
|
||||||
|
|
||||||
<footer class="bg-dark text-white text-center py-4">
|
|
||||||
<div class="container">
|
|
||||||
<p>© <?php echo date("Y"); ?> Future Now. All Rights Reserved.</p>
|
|
||||||
<div>
|
|
||||||
<a href="#" class="text-white me-3"><i class="bi bi-twitter"></i></a>
|
|
||||||
<a href="#" class="text-white me-3"><i class="bi bi-linkedin"></i></a>
|
|
||||||
<a href="#" class="text-white"><i class="bi bi-github"></i></a>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</footer>
|
|
||||||
|
|
||||||
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/js/bootstrap.bundle.min.js"></script>
|
|
||||||
<script src="assets/js/main.js?v=<?php echo time(); ?>"></script>
|
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|||||||
22
privacy.php
22
privacy.php
@ -1,22 +0,0 @@
|
|||||||
<?php
|
|
||||||
http_response_code(501); // Not Implemented
|
|
||||||
?>
|
|
||||||
<!DOCTYPE html>
|
|
||||||
<html lang="de">
|
|
||||||
<head>
|
|
||||||
<meta charset="UTF-8">
|
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
||||||
<title>Datenschutzerklärung</title>
|
|
||||||
<style>
|
|
||||||
body { font-family: sans-serif; line-height: 1.6; max-width: 800px; margin: 40px auto; padding: 20px; }
|
|
||||||
h1 { color: #333; }
|
|
||||||
</style>
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<h1>Datenschutzerklärung</h1>
|
|
||||||
<p>Hier wird in Kürze eine ausführliche Datenschutzerklärung stehen.</p>
|
|
||||||
<p>Wir nehmen den Schutz Ihrer persönlichen Daten sehr ernst. Die Nutzung unserer Webseite ist in der Regel ohne Angabe personenbezogener Daten möglich. Soweit auf unseren Seiten personenbezogene Daten (beispielsweise Name, Anschrift oder E-Mail-Adressen) erhoben werden, erfolgt dies, soweit möglich, stets auf freiwilliger Basis.</p>
|
|
||||||
<p>Diese Daten werden ohne Ihre ausdrückliche Zustimmung nicht an Dritte weitergegeben. Wir weisen darauf hin, dass die Datenübertragung im Internet (z.B. bei der Kommunikation per E-Mail) Sicherheitslücken aufweisen kann. Ein lückenloser Schutz der Daten vor dem Zugriff durch Dritte ist nicht möglich.</p>
|
|
||||||
<a href="/">Zurück zur Startseite</a>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
||||||
@ -1,164 +0,0 @@
|
|||||||
<?php
|
|
||||||
$sections = [
|
|
||||||
"UNTERNEHMEN & ZIELE" => [
|
|
||||||
1 => ['type' => 'single', 'text' => 'Wie groß ist dein Unternehmen?', 'options' => ['👤 1 Person', '👥 2–5 Mitarbeiter', '👨👩👧👦 6–20 Mitarbeiter', '🏢 21–50 Mitarbeiter', '🏭 50+ Mitarbeiter'], 'auto-advance' => true],
|
|
||||||
2 => ['type' => 'text', 'text' => 'In welcher Branche bist du tätig?', 'placeholder' => 'z.B. Marketing, E-Commerce, Beratung, Handwerk, Immobilien, Gesundheitswesen', 'maxLength' => 100],
|
|
||||||
3 => ['type' => 'multiple', 'text' => 'Welches Geschäftsmodell nutzt du? (Mehrfachauswahl)', 'options' => ['💼 Dienstleistung', '🛒 Handel', '💡 Coaching / Beratung', '📢 Agentur', '🖥️ E-Commerce', '📋 Sonstiges']],
|
|
||||||
4 => ['type' => 'single', 'text' => 'Was ist dein wichtigstes Ziel in den nächsten 3 Monaten?', 'options' => ['📈 Mehr Leads generieren', '💰 Umsatz steigern', '⏱️ Zeit sparen durch Automatisierung', '📊 Besseren Überblick über Prozesse', '🚀 Skalierung vorbereiten'], 'auto-advance' => true],
|
|
||||||
5 => ['type' => 'scale', 'text' => 'Wie digital sind deine aktuellen Abläufe?', 'min' => 1, 'max' => 5, 'labels' => ['Sehr gering (meist analog/manuell)', 'Sehr hoch (vollständig digital)'], 'auto-advance' => true],
|
|
||||||
],
|
|
||||||
"ENGPÄSSE & AUTOMATISIERUNG" => [
|
|
||||||
6 => ['type' => 'multiple', 'text' => 'Welche Aufgaben kosten dich am meisten Zeit? (Mehrfachauswahl)', 'options' => ['📧 E-Mails & Nachrichten beantworten', '📅 Terminverwaltung', '📝 Angebote & Rechnungen erstellen', '📱 Social Media & Content', '🤝 Kundenanfragen bearbeiten', '📊 Verwaltung & Backoffice', '📄 Dokumentation']],
|
|
||||||
7 => ['type' => 'textarea', 'text' => 'Beschreibe deinen größten "Flaschenhals" im Tagesgeschäft:', 'placeholder' => 'z.B. Ich verliere täglich 3 Stunden mit manueller Dateneingabe in verschiedene Systeme. Kundenanfragen kommen über 5 Kanäle und ich verliere den Überblick.', 'maxLength' => 300, 'hint' => 'Tipp: Drücken Sie Strg+Enter für schnelle Eingabe'],
|
|
||||||
8 => ['type' => 'single', 'text' => 'Wie viel Zeit verbringst du pro Woche mit Admin-Aufgaben?', 'options' => ['⏱️ 0-5 Stunden', '⏰ 6-10 Stunden', '🕐 11-15 Stunden', '🕑 16-20 Stunden', '🕒 Über 20 Stunden'], 'auto-advance' => true],
|
|
||||||
9 => ['type' => 'multiple', 'text' => 'Welche Bereiche möchtest du automatisieren? (Mehrfachauswahl)', 'options' => ['🤖 Kundenservice (Chatbot, FAQ)', '📧 E-Mail-Marketing & Follow-ups', '📱 Social Media Posting', '📊 Leadqualifizierung & CRM', '📄 Dokumentenerstellung', '📅 Terminbuchung', '💰 Rechnungen & Buchhaltung', '📈 Datenanalyse & Reporting']],
|
|
||||||
10 => ['type' => 'single', 'text' => 'Wie viel Zeit möchtest du pro Woche durch KI einsparen?', 'options' => ['⏱️ 2–5 Stunden', '⏰ 6–10 Stunden', '🕐 11–15 Stunden', '🕑 16–20 Stunden', '🚀 Mehr als 20 Stunden'], 'auto-advance' => true],
|
|
||||||
],
|
|
||||||
"BEREITSCHAFT & UMSETZUNG" => [
|
|
||||||
11 => ['type' => 'multiple', 'text' => 'Welche KI-Tools nutzt du bereits? (Mehrfachauswahl)', 'options' => ['ChatGPT', 'Google Gemini', 'Claude', 'Midjourney / Bildgeneratoren', 'Automatisierungstools (Zapier, Make)', '❌ Noch keine KI-Tools']],
|
|
||||||
12 => ['type' => 'scale', 'text' => 'Wie offen bist du für neue Technologien?', 'min' => 1, 'max' => 5, 'labels' => ['Sehr skeptisch', 'Sehr aufgeschlossen & experimentierfreudig'], 'auto-advance' => true],
|
|
||||||
13 => ['type' => 'single', 'text' => 'Wie schnell möchtest du mit KI-Automatisierung starten?', 'options' => ['🚀 Sofort (innerhalb 1 Woche)', '⚡ Sehr bald (1-2 Wochen)', '📅 Innerhalb 1 Monat', '🗓️ In 1-3 Monaten', '💭 Erstmal nur informieren'], 'auto-advance' => true],
|
|
||||||
14 => ['type' => 'multiple', 'text' => 'Was hält dich aktuell von KI ab? (Mehrfachauswahl)', 'options' => ['🤔 Zu kompliziert / fehlendes Know-how', '💰 Unklare Kosten', '⏰ Keine Zeit für Implementierung', '🔒 Datenschutz-Bedenken', '🎯 Weiß nicht, wo ich anfangen soll', '✅ Nichts, ich bin bereit!']],
|
|
||||||
15 => ['type' => 'single', 'text' => 'Wie fühlst du dich gerade?', 'options' => ['😰 Überfordert mit allem', '😐 Neutral / Abwartend', '😊 Motiviert, etwas zu ändern', '🚀 Sehr motiviert & bereit loszulegen'], 'auto-advance' => true],
|
|
||||||
]
|
|
||||||
];
|
|
||||||
$total_questions = 17;
|
|
||||||
?>
|
|
||||||
<!DOCTYPE html>
|
|
||||||
<html lang="de">
|
|
||||||
<head>
|
|
||||||
<meta charset="UTF-8">
|
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
||||||
<title>KI-Fit Check</title>
|
|
||||||
<link rel="preconnect" href="https://fonts.googleapis.com">
|
|
||||||
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
|
||||||
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;700&family=Space+Grotesk:wght@700&display=swap" rel="stylesheet">
|
|
||||||
<link rel="stylesheet" href="assets/css/questionnaire.css?v=<?php echo time(); ?>">
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<div class="questionnaire-container">
|
|
||||||
<!-- Progress Bar -->
|
|
||||||
<div class="progress-container">
|
|
||||||
<div class="progress-bar" id="progressBar"></div>
|
|
||||||
<div class="progress-text"><span id="progressText">0</span>/15</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<!-- Welcome Screen -->
|
|
||||||
<div class="screen welcome-screen active" id="welcome-screen">
|
|
||||||
<div class="welcome-content">
|
|
||||||
<div class="welcome-badge">KI-FIT CHECK</div>
|
|
||||||
<h1 class="welcome-title">Ihre <span class="gradient-text">3-Minuten</span> KI-Analyse</h1>
|
|
||||||
<p class="welcome-description">Beantworten Sie 15 kurze Fragen zu Ihrem Unternehmen. Unsere KI analysiert Ihre Antworten und erstellt einen personalisierten Fahrplan zur Automatisierung.</p>
|
|
||||||
<div class="welcome-benefits">
|
|
||||||
<div class="benefit-item"><span class="benefit-icon">✓</span> <span>100% kostenlos</span></div>
|
|
||||||
<div class="benefit-item"><span class="benefit-icon">⏱️</span> <span>Nur 3 Minuten</span></div>
|
|
||||||
<div class="benefit-item"><span class="benefit-icon">📊</span> <span>Sofortiger Report</span></div>
|
|
||||||
</div>
|
|
||||||
<button class="btn-start" onclick="startQuestionnaire()">Jetzt starten →</button>
|
|
||||||
<p class="welcome-note">Ihre Daten werden vertraulich behandelt und DSGVO-konform verarbeitet.</p>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<!-- Question Screens -->
|
|
||||||
<form id="questionnaire-form" action="submit.php" method="POST">
|
|
||||||
<?php
|
|
||||||
$q_number = 1;
|
|
||||||
foreach ($sections as $section_title => $questions) {
|
|
||||||
echo "<div class='screen-group'>";
|
|
||||||
echo "<h2 class='section-title'>{$section_title}</h2>";
|
|
||||||
foreach ($questions as $id => $q) {
|
|
||||||
echo "<div class='screen question-screen' id='question-{$q_number}' data-question-id='{$q_number}'>";
|
|
||||||
echo "<h3>{$q['text']}</h3>";
|
|
||||||
echo "<div class='options-container'>";
|
|
||||||
|
|
||||||
switch ($q['type']) {
|
|
||||||
case 'single':
|
|
||||||
case 'multiple':
|
|
||||||
$inputType = $q['type'] == 'single' ? 'radio' : 'checkbox';
|
|
||||||
foreach ($q['options'] as $option) {
|
|
||||||
echo "<label class='option-label'>";
|
|
||||||
echo "<input type='{$inputType}' name='q{$q_number}[]' value='{$option}' " . (($q['auto-advance'] ?? false) ? "class='auto-advance'" : "") . ">";
|
|
||||||
echo "<span>{$option}</span>";
|
|
||||||
echo "</label>";
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case 'text':
|
|
||||||
echo "<input type='text' name='q{$q_number}' placeholder='{$q['placeholder']}' maxlength='{$q['maxLength']}'>";
|
|
||||||
break;
|
|
||||||
case 'textarea':
|
|
||||||
echo "<textarea name='q{$q_number}' placeholder='{$q['placeholder']}' maxlength='{$q['maxLength']}'></textarea>";
|
|
||||||
if (isset($q['hint'])) {
|
|
||||||
echo "<p class='hint'>{$q['hint']}</p>";
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case 'scale':
|
|
||||||
echo "<div class='scale-container'>";
|
|
||||||
echo "<span>{$q['labels'][0]}</span>";
|
|
||||||
for ($i = $q['min']; $i <= $q['max']; $i++) {
|
|
||||||
echo "<label class='scale-label'>";
|
|
||||||
echo "<input type='radio' name='q{$q_number}' value='{$i}' " . (($q['auto-advance'] ?? false) ? "class='auto-advance'" : "") . ">";
|
|
||||||
echo "<span>{$i}</span>";
|
|
||||||
echo "</label>";
|
|
||||||
}
|
|
||||||
echo "<span>{$q['labels'][1]}</span>";
|
|
||||||
echo "</div>";
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
echo "</div>"; // .options-container
|
|
||||||
echo "<div class='navigation-buttons'>";
|
|
||||||
if ($q_number > 1) {
|
|
||||||
echo "<button type='button' class='btn-prev' onclick='navigate(-1)'>Zurück</button>";
|
|
||||||
}
|
|
||||||
// Show 'Weiter' button only if it's not an auto-advancing single choice question
|
|
||||||
if (!($q['type'] == 'single' && ($q['auto-advance'] ?? false))) {
|
|
||||||
echo "<button type='button' class='btn-next' onclick='navigate(1)'>Weiter</button>";
|
|
||||||
}
|
|
||||||
|
|
||||||
echo "</div>"; // .navigation-buttons
|
|
||||||
echo "</div>"; // .question-screen
|
|
||||||
$q_number++;
|
|
||||||
}
|
|
||||||
echo "</div>"; // .screen-group
|
|
||||||
}
|
|
||||||
?>
|
|
||||||
|
|
||||||
<!-- Email Capture Screen (Step 16) -->
|
|
||||||
<div class="screen" id="email-screen" data-question-id="16">
|
|
||||||
<h2 class="section-title">Fast geschafft!</h2>
|
|
||||||
<h3>Geben Sie Ihre E-Mail-Adresse ein, um Ihren personalisierten Report zu erhalten.</h3>
|
|
||||||
<div class="options-container">
|
|
||||||
<input type="email" name="email" id="email-input" placeholder="z.B. max.mustermann@mail.com" required>
|
|
||||||
</div>
|
|
||||||
<div class="navigation-buttons">
|
|
||||||
<button type="button" class="btn-prev" onclick="navigate(-1)">Zurück</button>
|
|
||||||
<button type="button" class="btn-next" onclick="navigate(1)">Weiter</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<!-- Consent Screen (Step 17) -->
|
|
||||||
<div class="screen" id="consent-screen" data-question-id="17">
|
|
||||||
<h2 class="section-title">Letzter Schritt</h2>
|
|
||||||
<h3>Einverständnis</h3>
|
|
||||||
<div class="options-container">
|
|
||||||
<label class="option-label consent-label">
|
|
||||||
<input type="checkbox" name="consent" id="consent-checkbox" required>
|
|
||||||
<span>Ich stimme der Verarbeitung meiner Daten gemäß der <a href="/privacy" target="_blank">Datenschutzerklärung</a> zu und möchte den Report per E-Mail erhalten. Die Einwilligung kann jederzeit widerrufen werden.</span>
|
|
||||||
</label>
|
|
||||||
</div>
|
|
||||||
<div class="navigation-buttons">
|
|
||||||
<button type="button" class="btn-prev" onclick="navigate(-1)">Zurück</button>
|
|
||||||
<button type="submit" class="btn-submit">Absenden & Report erhalten →</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<!-- Thank You Screen -->
|
|
||||||
<div class="screen" id="thank-you-screen">
|
|
||||||
<h2>Vielen Dank!</h2>
|
|
||||||
<p>Ihr personalisierter KI-Fahrplan wird jetzt erstellt und Ihnen in Kürze per E-Mail zugesendet.</p>
|
|
||||||
</div>
|
|
||||||
</form>
|
|
||||||
</div>
|
|
||||||
<script src="assets/js/questionnaire.js?v=<?php echo time(); ?>"></script>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
||||||
63
submit.php
63
submit.php
@ -1,63 +0,0 @@
|
|||||||
<?php
|
|
||||||
require_once __DIR__ . '/ReportGenerator.php';
|
|
||||||
|
|
||||||
header('Content-Type: application/json');
|
|
||||||
|
|
||||||
if ($_SERVER['REQUEST_METHOD'] !== 'POST') {
|
|
||||||
http_response_code(405); // Method Not Allowed
|
|
||||||
echo json_encode(['error' => 'Invalid request method.']);
|
|
||||||
exit;
|
|
||||||
}
|
|
||||||
|
|
||||||
$post_data = $_POST;
|
|
||||||
|
|
||||||
// Basic validation
|
|
||||||
if (!isset($post_data['email']) || !filter_var($post_data['email'], FILTER_VALIDATE_EMAIL)) {
|
|
||||||
http_response_code(400); // Bad Request
|
|
||||||
echo json_encode(['error' => 'Invalid or missing email address.']);
|
|
||||||
exit;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!isset($post_data['consent']) || $post_data['consent'] !== 'on') {
|
|
||||||
http_response_code(400); // Bad Request
|
|
||||||
echo json_encode(['error' => 'Consent is required.']);
|
|
||||||
exit;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Generate the report
|
|
||||||
$generator = new ReportGenerator($post_data);
|
|
||||||
$report_data = $generator->generate();
|
|
||||||
|
|
||||||
// Check for mail configuration before attempting to send
|
|
||||||
$mailConfig = require __DIR__ . '/mail/config.php';
|
|
||||||
if (empty($mailConfig['smtp_host']) || empty($mailConfig['smtp_user']) || empty($mailConfig['smtp_pass'])) {
|
|
||||||
http_response_code(500);
|
|
||||||
echo json_encode([
|
|
||||||
'success' => false,
|
|
||||||
'error' => 'Mail service is not configured. Please set SMTP_HOST, SMTP_USER, and SMTP_PASS in your .env file.',
|
|
||||||
'details' => 'Mail service is not configured.'
|
|
||||||
]);
|
|
||||||
exit;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Send the email
|
|
||||||
$email_result = $generator->sendEmail($post_data['email']);
|
|
||||||
|
|
||||||
if (!empty($email_result['success'])) {
|
|
||||||
echo json_encode([
|
|
||||||
'success' => true,
|
|
||||||
'message' => 'Report successfully sent to ' . $post_data['email'],
|
|
||||||
'report' => $report_data // Optionally return report data to the frontend
|
|
||||||
]);
|
|
||||||
} else {
|
|
||||||
http_response_code(500); // Internal Server Error
|
|
||||||
$error_detail = $email_result['error'] ?? 'Unknown error';
|
|
||||||
error_log('MailService Error: ' . $error_detail);
|
|
||||||
echo json_encode([
|
|
||||||
'success' => false,
|
|
||||||
'error' => 'Failed to send email. Please check your SMTP credentials in the .env file.',
|
|
||||||
'details' => $error_detail // for debugging
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
|
|
||||||
?>
|
|
||||||
Loading…
x
Reference in New Issue
Block a user