Deploy from Lumerel
This commit is contained in:
823
public/index.php
Normal file
823
public/index.php
Normal file
@@ -0,0 +1,823 @@
|
||||
<?php
|
||||
session_start();
|
||||
require_once __DIR__ . '/../src/db.php';
|
||||
|
||||
// Initialize or retrieve session token
|
||||
if (!isset($_SESSION['onboarding_token'])) {
|
||||
$_SESSION['onboarding_token'] = bin2hex(random_bytes(32));
|
||||
|
||||
// Create new onboarding session
|
||||
$stmt = $pdo->prepare("INSERT INTO onboarding_sessions (session_token) VALUES (?)");
|
||||
$stmt->execute([$_SESSION['onboarding_token']]);
|
||||
}
|
||||
|
||||
$token = $_SESSION['onboarding_token'];
|
||||
|
||||
// Fetch current session data
|
||||
$stmt = $pdo->prepare("SELECT * FROM onboarding_sessions WHERE session_token = ?");
|
||||
$stmt->execute([$token]);
|
||||
$session = $stmt->fetch();
|
||||
|
||||
$currentStep = $session['current_step'] ?? 1;
|
||||
$completed = $session['completed'] ?? 0;
|
||||
?>
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Welcome! Let's Get Started</title>
|
||||
<style>
|
||||
* {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
body {
|
||||
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
|
||||
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
|
||||
min-height: 100vh;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
padding: 20px;
|
||||
}
|
||||
|
||||
.container {
|
||||
background: white;
|
||||
border-radius: 20px;
|
||||
box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
|
||||
max-width: 800px;
|
||||
width: 100%;
|
||||
overflow: hidden;
|
||||
animation: slideUp 0.5s ease-out;
|
||||
}
|
||||
|
||||
@keyframes slideUp {
|
||||
from {
|
||||
opacity: 0;
|
||||
transform: translateY(30px);
|
||||
}
|
||||
to {
|
||||
opacity: 1;
|
||||
transform: translateY(0);
|
||||
}
|
||||
}
|
||||
|
||||
.header {
|
||||
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
|
||||
color: white;
|
||||
padding: 40px;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.header h1 {
|
||||
font-size: 32px;
|
||||
margin-bottom: 10px;
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
.header p {
|
||||
font-size: 16px;
|
||||
opacity: 0.95;
|
||||
}
|
||||
|
||||
.progress-bar {
|
||||
background: rgba(255, 255, 255, 0.2);
|
||||
height: 6px;
|
||||
margin-top: 30px;
|
||||
border-radius: 3px;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.progress-fill {
|
||||
background: white;
|
||||
height: 100%;
|
||||
transition: width 0.4s ease;
|
||||
border-radius: 3px;
|
||||
}
|
||||
|
||||
.steps {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
padding: 30px 40px;
|
||||
border-bottom: 1px solid #e5e7eb;
|
||||
}
|
||||
|
||||
.step-indicator {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 10px;
|
||||
flex: 1;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.step-indicator:not(:last-child)::after {
|
||||
content: '';
|
||||
position: absolute;
|
||||
left: calc(100% - 10px);
|
||||
top: 15px;
|
||||
width: calc(100% - 40px);
|
||||
height: 2px;
|
||||
background: #e5e7eb;
|
||||
z-index: 0;
|
||||
}
|
||||
|
||||
.step-indicator.active:not(:last-child)::after,
|
||||
.step-indicator.completed:not(:last-child)::after {
|
||||
background: #667eea;
|
||||
}
|
||||
|
||||
.step-number {
|
||||
width: 32px;
|
||||
height: 32px;
|
||||
border-radius: 50%;
|
||||
background: #e5e7eb;
|
||||
color: #6b7280;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
font-weight: 600;
|
||||
font-size: 14px;
|
||||
position: relative;
|
||||
z-index: 1;
|
||||
transition: all 0.3s ease;
|
||||
}
|
||||
|
||||
.step-indicator.active .step-number {
|
||||
background: #667eea;
|
||||
color: white;
|
||||
transform: scale(1.1);
|
||||
}
|
||||
|
||||
.step-indicator.completed .step-number {
|
||||
background: #10b981;
|
||||
color: white;
|
||||
}
|
||||
|
||||
.step-indicator.completed .step-number::before {
|
||||
content: '✓';
|
||||
}
|
||||
|
||||
.step-label {
|
||||
font-size: 12px;
|
||||
color: #6b7280;
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
.step-indicator.active .step-label {
|
||||
color: #667eea;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.content {
|
||||
padding: 40px;
|
||||
}
|
||||
|
||||
.step-content {
|
||||
display: none;
|
||||
animation: fadeIn 0.4s ease;
|
||||
}
|
||||
|
||||
.step-content.active {
|
||||
display: block;
|
||||
}
|
||||
|
||||
@keyframes fadeIn {
|
||||
from {
|
||||
opacity: 0;
|
||||
transform: translateX(20px);
|
||||
}
|
||||
to {
|
||||
opacity: 1;
|
||||
transform: translateX(0);
|
||||
}
|
||||
}
|
||||
|
||||
.form-group {
|
||||
margin-bottom: 24px;
|
||||
}
|
||||
|
||||
label {
|
||||
display: block;
|
||||
font-weight: 600;
|
||||
color: #1f2937;
|
||||
margin-bottom: 8px;
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
label .optional {
|
||||
font-weight: 400;
|
||||
color: #6b7280;
|
||||
font-size: 13px;
|
||||
}
|
||||
|
||||
input[type="text"],
|
||||
input[type="email"],
|
||||
input[type="tel"],
|
||||
input[type="url"],
|
||||
input[type="number"],
|
||||
input[type="color"],
|
||||
textarea,
|
||||
select {
|
||||
width: 100%;
|
||||
padding: 12px 16px;
|
||||
border: 2px solid #e5e7eb;
|
||||
border-radius: 10px;
|
||||
font-size: 15px;
|
||||
transition: all 0.2s ease;
|
||||
font-family: inherit;
|
||||
}
|
||||
|
||||
input[type="color"] {
|
||||
height: 50px;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
input:focus,
|
||||
textarea:focus,
|
||||
select:focus {
|
||||
outline: none;
|
||||
border-color: #667eea;
|
||||
box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
|
||||
}
|
||||
|
||||
textarea {
|
||||
resize: vertical;
|
||||
min-height: 100px;
|
||||
}
|
||||
|
||||
.form-row {
|
||||
display: grid;
|
||||
grid-template-columns: 1fr 1fr;
|
||||
gap: 20px;
|
||||
}
|
||||
|
||||
.checkbox-group {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 10px;
|
||||
padding: 12px 0;
|
||||
}
|
||||
|
||||
.checkbox-group input[type="checkbox"] {
|
||||
width: 20px;
|
||||
height: 20px;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.checkbox-group label {
|
||||
margin: 0;
|
||||
cursor: pointer;
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
.buttons {
|
||||
display: flex;
|
||||
gap: 12px;
|
||||
margin-top: 32px;
|
||||
padding-top: 32px;
|
||||
border-top: 1px solid #e5e7eb;
|
||||
}
|
||||
|
||||
button {
|
||||
padding: 14px 28px;
|
||||
border: none;
|
||||
border-radius: 10px;
|
||||
font-size: 15px;
|
||||
font-weight: 600;
|
||||
cursor: pointer;
|
||||
transition: all 0.2s ease;
|
||||
font-family: inherit;
|
||||
}
|
||||
|
||||
.btn-primary {
|
||||
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
|
||||
color: white;
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
.btn-primary:hover {
|
||||
transform: translateY(-2px);
|
||||
box-shadow: 0 8px 20px rgba(102, 126, 234, 0.4);
|
||||
}
|
||||
|
||||
.btn-secondary {
|
||||
background: #f3f4f6;
|
||||
color: #4b5563;
|
||||
}
|
||||
|
||||
.btn-secondary:hover {
|
||||
background: #e5e7eb;
|
||||
}
|
||||
|
||||
.btn-primary:disabled {
|
||||
opacity: 0.5;
|
||||
cursor: not-allowed;
|
||||
transform: none;
|
||||
}
|
||||
|
||||
.completion-screen {
|
||||
text-align: center;
|
||||
padding: 60px 40px;
|
||||
}
|
||||
|
||||
.completion-screen .icon {
|
||||
width: 80px;
|
||||
height: 80px;
|
||||
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
|
||||
border-radius: 50%;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
margin: 0 auto 30px;
|
||||
font-size: 40px;
|
||||
animation: scaleIn 0.5s ease;
|
||||
}
|
||||
|
||||
@keyframes scaleIn {
|
||||
from {
|
||||
transform: scale(0);
|
||||
}
|
||||
to {
|
||||
transform: scale(1);
|
||||
}
|
||||
}
|
||||
|
||||
.completion-screen h2 {
|
||||
font-size: 28px;
|
||||
color: #1f2937;
|
||||
margin-bottom: 16px;
|
||||
}
|
||||
|
||||
.completion-screen p {
|
||||
font-size: 16px;
|
||||
color: #6b7280;
|
||||
line-height: 1.6;
|
||||
margin-bottom: 32px;
|
||||
}
|
||||
|
||||
.summary-card {
|
||||
background: #f9fafb;
|
||||
border-radius: 12px;
|
||||
padding: 24px;
|
||||
text-align: left;
|
||||
margin: 24px 0;
|
||||
}
|
||||
|
||||
.summary-card h3 {
|
||||
font-size: 18px;
|
||||
color: #1f2937;
|
||||
margin-bottom: 16px;
|
||||
}
|
||||
|
||||
.summary-item {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
padding: 8px 0;
|
||||
border-bottom: 1px solid #e5e7eb;
|
||||
}
|
||||
|
||||
.summary-item:last-child {
|
||||
border-bottom: none;
|
||||
}
|
||||
|
||||
.summary-label {
|
||||
font-weight: 600;
|
||||
color: #4b5563;
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
.summary-value {
|
||||
color: #1f2937;
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
.color-preview {
|
||||
width: 24px;
|
||||
height: 24px;
|
||||
border-radius: 6px;
|
||||
display: inline-block;
|
||||
border: 2px solid #e5e7eb;
|
||||
vertical-align: middle;
|
||||
}
|
||||
|
||||
.help-text {
|
||||
font-size: 13px;
|
||||
color: #6b7280;
|
||||
margin-top: 6px;
|
||||
}
|
||||
|
||||
@media (max-width: 768px) {
|
||||
.form-row {
|
||||
grid-template-columns: 1fr;
|
||||
}
|
||||
|
||||
.steps {
|
||||
padding: 20px;
|
||||
}
|
||||
|
||||
.step-label {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.content {
|
||||
padding: 30px 20px;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="container">
|
||||
<?php if (!$completed): ?>
|
||||
<div class="header">
|
||||
<h1>🎉 Welcome Aboard!</h1>
|
||||
<p>Let's set up your account in just a few simple steps</p>
|
||||
<div class="progress-bar">
|
||||
<div class="progress-fill" id="progressFill" style="width: <?= ($currentStep / 4) * 100 ?>%"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="steps">
|
||||
<div class="step-indicator <?= $currentStep >= 1 ? 'active' : '' ?> <?= $currentStep > 1 ? 'completed' : '' ?>">
|
||||
<div class="step-number"><?= $currentStep > 1 ? '' : '1' ?></div>
|
||||
<div class="step-label">Company Branding</div>
|
||||
</div>
|
||||
<div class="step-indicator <?= $currentStep >= 2 ? 'active' : '' ?> <?= $currentStep > 2 ? 'completed' : '' ?>">
|
||||
<div class="step-number"><?= $currentStep > 2 ? '' : '2' ?></div>
|
||||
<div class="step-label">Quote Preferences</div>
|
||||
</div>
|
||||
<div class="step-indicator <?= $currentStep >= 3 ? 'active' : '' ?> <?= $currentStep > 3 ? 'completed' : '' ?>">
|
||||
<div class="step-number"><?= $currentStep > 3 ? '' : '3' ?></div>
|
||||
<div class="step-label">Contact Info</div>
|
||||
</div>
|
||||
<div class="step-indicator <?= $currentStep >= 4 ? 'active' : '' ?>">
|
||||
<div class="step-number">4</div>
|
||||
<div class="step-label">Review</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="content">
|
||||
<form id="onboardingForm" method="POST" action="save.php">
|
||||
<!-- Step 1: Company Branding -->
|
||||
<div class="step-content <?= $currentStep == 1 ? 'active' : '' ?>" data-step="1">
|
||||
<h2 style="margin-bottom: 24px; color: #1f2937;">Tell us about your company</h2>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Company Name *</label>
|
||||
<input type="text" name="company_name" value="<?= htmlspecialchars($session['company_name'] ?? '') ?>" required>
|
||||
</div>
|
||||
|
||||
<div class="form-row">
|
||||
<div class="form-group">
|
||||
<label>Primary Brand Color *</label>
|
||||
<input type="color" name="primary_color" value="<?= $session['primary_color'] ?? '#667eea' ?>" required>
|
||||
<div class="help-text">This will be used for headers and buttons</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Secondary Brand Color *</label>
|
||||
<input type="color" name="secondary_color" value="<?= $session['secondary_color'] ?? '#764ba2' ?>" required>
|
||||
<div class="help-text">Used for accents and highlights</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Industry *</label>
|
||||
<select name="industry" required>
|
||||
<option value="">Select your industry...</option>
|
||||
<option value="technology" <?= ($session['industry'] ?? '') == 'technology' ? 'selected' : '' ?>>Technology</option>
|
||||
<option value="consulting" <?= ($session['industry'] ?? '') == 'consulting' ? 'selected' : '' ?>>Consulting</option>
|
||||
<option value="creative" <?= ($session['industry'] ?? '') == 'creative' ? 'selected' : '' ?>>Creative Services</option>
|
||||
<option value="construction" <?= ($session['industry'] ?? '') == 'construction' ? 'selected' : '' ?>>Construction</option>
|
||||
<option value="retail" <?= ($session['industry'] ?? '') == 'retail' ? 'selected' : '' ?>>Retail</option>
|
||||
<option value="healthcare" <?= ($session['industry'] ?? '') == 'healthcare' ? 'selected' : '' ?>>Healthcare</option>
|
||||
<option value="finance" <?= ($session['industry'] ?? '') == 'finance' ? 'selected' : '' ?>>Finance</option>
|
||||
<option value="other" <?= ($session['industry'] ?? '') == 'other' ? 'selected' : '' ?>>Other</option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Company Tagline <span class="optional">(optional)</span></label>
|
||||
<input type="text" name="company_tagline" value="<?= htmlspecialchars($session['company_tagline'] ?? '') ?>" placeholder="e.g., Building tomorrow's solutions today">
|
||||
<div class="help-text">A brief description that appears on your quotes</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Step 2: Quote Preferences -->
|
||||
<div class="step-content <?= $currentStep == 2 ? 'active' : '' ?>" data-step="2">
|
||||
<h2 style="margin-bottom: 24px; color: #1f2937;">Customize your quotes</h2>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Quote Format *</label>
|
||||
<select name="quote_format" required>
|
||||
<option value="detailed" <?= ($session['quote_format'] ?? '') == 'detailed' ? 'selected' : '' ?>>Detailed (itemized with descriptions)</option>
|
||||
<option value="summary" <?= ($session['quote_format'] ?? '') == 'summary' ? 'selected' : '' ?>>Summary (totals only)</option>
|
||||
<option value="professional" <?= ($session['quote_format'] ?? '') == 'professional' ? 'selected' : '' ?>>Professional (balanced detail)</option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="form-row">
|
||||
<div class="form-group">
|
||||
<label>Payment Terms *</label>
|
||||
<select name="payment_terms" required>
|
||||
<option value="net_15" <?= ($session['payment_terms'] ?? '') == 'net_15' ? 'selected' : '' ?>>Net 15</option>
|
||||
<option value="net_30" <?= ($session['payment_terms'] ?? 'net_30') == 'net_30' ? 'selected' : '' ?>>Net 30</option>
|
||||
<option value="net_60" <?= ($session['payment_terms'] ?? '') == 'net_60' ? 'selected' : '' ?>>Net 60</option>
|
||||
<option value="due_on_receipt" <?= ($session['payment_terms'] ?? '') == 'due_on_receipt' ? 'selected' : '' ?>>Due on Receipt</option>
|
||||
<option value="50_50" <?= ($session['payment_terms'] ?? '') == '50_50' ? 'selected' : '' ?>>50% Deposit, 50% on Completion</option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Quote Valid For (days) *</label>
|
||||
<input type="number" name="quote_validity_days" value="<?= $session['quote_validity_days'] ?? '30' ?>" min="1" max="365" required>
|
||||
<div class="help-text">How long quotes remain valid</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<div class="checkbox-group">
|
||||
<input type="checkbox" name="show_itemized_pricing" id="show_itemized" value="1" <?= ($session['show_itemized_pricing'] ?? 1) ? 'checked' : '' ?>>
|
||||
<label for="show_itemized">Show itemized pricing breakdown</label>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<div class="checkbox-group">
|
||||
<input type="checkbox" name="include_terms_conditions" id="include_terms" value="1" <?= ($session['include_terms_conditions'] ?? 1) ? 'checked' : '' ?>>
|
||||
<label for="include_terms">Include terms & conditions on quotes</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Step 3: Contact Information -->
|
||||
<div class="step-content <?= $currentStep == 3 ? 'active' : '' ?>" data-step="3">
|
||||
<h2 style="margin-bottom: 24px; color: #1f2937;">Your contact details</h2>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Contact Name *</label>
|
||||
<input type="text" name="contact_name" value="<?= htmlspecialchars($session['contact_name'] ?? '') ?>" required>
|
||||
</div>
|
||||
|
||||
<div class="form-row">
|
||||
<div class="form-group">
|
||||
<label>Email Address *</label>
|
||||
<input type="email" name="contact_email" value="<?= htmlspecialchars($session['contact_email'] ?? '') ?>" required>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Phone Number *</label>
|
||||
<input type="tel" name="contact_phone" value="<?= htmlspecialchars($session['contact_phone'] ?? '') ?>" required>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Business Address <span class="optional">(optional)</span></label>
|
||||
<textarea name="contact_address" placeholder="Street address, city, state, ZIP"><?= htmlspecialchars($session['contact_address'] ?? '') ?></textarea>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Website <span class="optional">(optional)</span></label>
|
||||
<input type="url" name="website" value="<?= htmlspecialchars($session['website'] ?? '') ?>" placeholder="https://www.example.com">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Step 4: Review -->
|
||||
<div class="step-content <?= $currentStep == 4 ? 'active' : '' ?>" data-step="4">
|
||||
<h2 style="margin-bottom: 24px; color: #1f2937;">Review your information</h2>
|
||||
|
||||
<div class="summary-card">
|
||||
<h3>Company Branding</h3>
|
||||
<div class="summary-item">
|
||||
<span class="summary-label">Company Name</span>
|
||||
<span class="summary-value"><?= htmlspecialchars($session['company_name'] ?? 'Not set') ?></span>
|
||||
</div>
|
||||
<div class="summary-item">
|
||||
<span class="summary-label">Primary Color</span>
|
||||
<span class="summary-value">
|
||||
<span class="color-preview" style="background: <?= $session['primary_color'] ?? '#667eea' ?>"></span>
|
||||
<?= $session['primary_color'] ?? '#667eea' ?>
|
||||
</span>
|
||||
</div>
|
||||
<div class="summary-item">
|
||||
<span class="summary-label">Secondary Color</span>
|
||||
<span class="summary-value">
|
||||
<span class="color-preview" style="background: <?= $session['secondary_color'] ?? '#764ba2' ?>"></span>
|
||||
<?= $session['secondary_color'] ?? '#764ba2' ?>
|
||||
</span>
|
||||
</div>
|
||||
<div class="summary-item">
|
||||
<span class="summary-label">Industry</span>
|
||||
<span class="summary-value"><?= ucfirst($session['industry'] ?? 'Not set') ?></span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="summary-card">
|
||||
<h3>Quote Preferences</h3>
|
||||
<div class="summary-item">
|
||||
<span class="summary-label">Format</span>
|
||||
<span class="summary-value"><?= ucfirst($session['quote_format'] ?? 'Not set') ?></span>
|
||||
</div>
|
||||
<div class="summary-item">
|
||||
<span class="summary-label">Payment Terms</span>
|
||||
<span class="summary-value"><?= str_replace('_', ' ', ucfirst($session['payment_terms'] ?? 'Not set')) ?></span>
|
||||
</div>
|
||||
<div class="summary-item">
|
||||
<span class="summary-label">Valid For</span>
|
||||
<span class="summary-value"><?= $session['quote_validity_days'] ?? '30' ?> days</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="summary-card">
|
||||
<h3>Contact Information</h3>
|
||||
<div class="summary-item">
|
||||
<span class="summary-label">Name</span>
|
||||
<span class="summary-value"><?= htmlspecialchars($session['contact_name'] ?? 'Not set') ?></span>
|
||||
</div>
|
||||
<div class="summary-item">
|
||||
<span class="summary-label">Email</span>
|
||||
<span class="summary-value"><?= htmlspecialchars($session['contact_email'] ?? 'Not set') ?></span>
|
||||
</div>
|
||||
<div class="summary-item">
|
||||
<span class="summary-label">Phone</span>
|
||||
<span class="summary-value"><?= htmlspecialchars($session['contact_phone'] ?? 'Not set') ?></span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="buttons">
|
||||
<button type="button" class="btn-secondary" id="prevBtn" style="display: <?= $currentStep > 1 ? 'block' : 'none' ?>">
|
||||
← Previous
|
||||
</button>
|
||||
<button type="button" class="btn-primary" id="nextBtn" style="display: <?= $currentStep < 4 ? 'block' : 'none' ?>">
|
||||
Next →
|
||||
</button>
|
||||
<button type="submit" class="btn-primary" id="submitBtn" style="display: <?= $currentStep == 4 ? 'block' : 'none' ?>">
|
||||
Complete Setup 🚀
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
<?php else: ?>
|
||||
<div class="completion-screen">
|
||||
<div class="icon">🎉</div>
|
||||
<h2>All Set! Welcome to the Team</h2>
|
||||
<p>Your account has been successfully configured. You're ready to start creating beautiful quotes and managing your business.</p>
|
||||
|
||||
<div class="summary-card">
|
||||
<h3>What's Next?</h3>
|
||||
<p style="text-align: left; margin-top: 12px;">
|
||||
• Access your dashboard to create your first quote<br>
|
||||
• Customize templates with your branding<br>
|
||||
• Invite team members to collaborate<br>
|
||||
• Explore advanced features and integrations
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<button class="btn-primary" onclick="window.location.href='dashboard.php'">
|
||||
Go to Dashboard →
|
||||
</button>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
let currentStep = <?= $currentStep ?>;
|
||||
const totalSteps = 4;
|
||||
|
||||
const prevBtn = document.getElementById('prevBtn');
|
||||
const nextBtn = document.getElementById('nextBtn');
|
||||
const submitBtn = document.getElementById('submitBtn');
|
||||
const form = document.getElementById('onboardingForm');
|
||||
|
||||
function updateUI() {
|
||||
// Hide all steps
|
||||
document.querySelectorAll('.step-content').forEach(step => {
|
||||
step.classList.remove('active');
|
||||
});
|
||||
|
||||
// Show current step
|
||||
document.querySelector(`[data-step="${currentStep}"]`).classList.add('active');
|
||||
|
||||
// Update step indicators
|
||||
document.querySelectorAll('.step-indicator').forEach((indicator, index) => {
|
||||
indicator.classList.remove('active', 'completed');
|
||||
if (index + 1 === currentStep) {
|
||||
indicator.classList.add('active');
|
||||
} else if (index + 1 < currentStep) {
|
||||
indicator.classList.add('completed');
|
||||
}
|
||||
|
||||
const stepNumber = indicator.querySelector('.step-number');
|
||||
if (index + 1 < currentStep) {
|
||||
stepNumber.textContent = '';
|
||||
} else {
|
||||
stepNumber.textContent = index + 1;
|
||||
}
|
||||
});
|
||||
|
||||
// Update progress bar
|
||||
const progress = (currentStep / totalSteps) * 100;
|
||||
document.getElementById('progressFill').style.width = progress + '%';
|
||||
|
||||
// Update buttons
|
||||
prevBtn.style.display = currentStep > 1 ? 'block' : 'none';
|
||||
nextBtn.style.display = currentStep < totalSteps ? 'block' : 'none';
|
||||
submitBtn.style.display = currentStep === totalSteps ? 'block' : 'none';
|
||||
}
|
||||
|
||||
function validateStep(step) {
|
||||
const stepContent = document.querySelector(`[data-step="${step}"]`);
|
||||
const requiredFields = stepContent.querySelectorAll('[required]');
|
||||
|
||||
for (let field of requiredFields) {
|
||||
if (!field.value.trim()) {
|
||||
field.focus();
|
||||
field.style.borderColor = '#ef4444';
|
||||
setTimeout(() => {
|
||||
field.style.borderColor = '#e5e7eb';
|
||||
}, 2000);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
async function saveProgress() {
|
||||
const formData = new FormData(form);
|
||||
formData.append('current_step', currentStep);
|
||||
formData.append('save_progress', '1');
|
||||
|
||||
try {
|
||||
const response = await fetch('save.php', {
|
||||
method: 'POST',
|
||||
body: formData
|
||||
});
|
||||
return response.ok;
|
||||
} catch (error) {
|
||||
console.error('Error saving progress:', error);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
nextBtn.addEventListener('click', async () => {
|
||||
if (validateStep(currentStep)) {
|
||||
await saveProgress();
|
||||
currentStep++;
|
||||
updateUI();
|
||||
}
|
||||
});
|
||||
|
||||
prevBtn.addEventListener('click', async () => {
|
||||
await saveProgress();
|
||||
currentStep--;
|
||||
updateUI();
|
||||
});
|
||||
|
||||
form.addEventListener('submit', async (e) => {
|
||||
e.preventDefault();
|
||||
|
||||
if (!validateStep(currentStep)) {
|
||||
return;
|
||||
}
|
||||
|
||||
const formData = new FormData(form);
|
||||
formData.append('complete', '1');
|
||||
|
||||
submitBtn.disabled = true;
|
||||
submitBtn.textContent = 'Completing...';
|
||||
|
||||
try {
|
||||
const response = await fetch('save.php', {
|
||||
method: 'POST',
|
||||
body: formData
|
||||
});
|
||||
|
||||
if (response.ok) {
|
||||
window.location.reload();
|
||||
} else {
|
||||
alert('There was an error completing your setup. Please try again.');
|
||||
submitBtn.disabled = false;
|
||||
submitBtn.textContent = 'Complete Setup 🚀';
|
||||
}
|
||||
} catch (error) {
|
||||
alert('There was an error completing your setup. Please try again.');
|
||||
submitBtn.disabled = false;
|
||||
submitBtn.textContent = 'Complete Setup 🚀';
|
||||
}
|
||||
});
|
||||
|
||||
// Auto-save on input change
|
||||
let saveTimeout;
|
||||
form.addEventListener('input', () => {
|
||||
clearTimeout(saveTimeout);
|
||||
saveTimeout = setTimeout(() => {
|
||||
saveProgress();
|
||||
}, 1000);
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user