Compare commits

...

1 Commits

Author SHA1 Message Date
Flatlogic Bot
ff39029228 1 2025-11-12 04:12:08 +00:00
4 changed files with 314 additions and 136 deletions

44
assets/css/custom.css Normal file
View File

@ -0,0 +1,44 @@
body {
background-color: #F8F9FA;
font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
}
.navbar {
border-bottom: 1px solid #dee2e6;
}
.hero-section {
background: linear-gradient(to right, rgba(74, 144, 226, 0.1), rgba(248, 249, 250, 0.1));
padding: 4rem 0;
}
.card {
border-radius: 0.5rem;
border: none;
box-shadow: 0 4px 6px rgba(0,0,0,.05);
}
.form-control {
border-radius: 0.5rem;
}
.btn-primary {
background-color: #4A90E2;
border-color: #4A90E2;
border-radius: 0.5rem;
padding: 0.75rem 1.25rem;
}
.btn-secondary {
background-color: #F5A623;
border-color: #F5A623;
border-radius: 0.5rem;
padding: 0.75rem 1.25rem;
}
.toast-container {
position: fixed;
top: 1rem;
right: 1rem;
z-index: 1055;
}

41
assets/js/main.js Normal file
View File

@ -0,0 +1,41 @@
document.addEventListener('DOMContentLoaded', function () {
const onboardingForm = document.getElementById('vendorOnboardingForm');
if (onboardingForm) {
onboardingForm.addEventListener('submit', function (event) {
let isValid = true;
const requiredFields = ['business_name', 'contact_name', 'email'];
requiredFields.forEach(function(field) {
const input = document.getElementById(field);
if (!input.value) {
isValid = false;
input.classList.add('is-invalid');
} else {
input.classList.remove('is-invalid');
}
});
const emailField = document.getElementById('email');
const emailPattern = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
if (emailField.value && !emailPattern.test(emailField.value)) {
isValid = false;
emailField.classList.add('is-invalid');
} else if (emailField.value) {
emailField.classList.remove('is-invalid');
}
if (!isValid) {
event.preventDefault();
event.stopPropagation();
}
});
}
// Auto-hide toast notifications
const toastElList = [].slice.call(document.querySelectorAll('.toast'));
const toastList = toastElList.map(function (toastEl) {
const toast = new bootstrap.Toast(toastEl, { delay: 5000 });
toast.show();
return toast;
});
});

180
index.php
View File

@ -7,12 +7,14 @@ declare(strict_types=1);
$phpVersion = PHP_VERSION;
$now = date('Y-m-d H:i:s');
?>
<!doctype html>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>New Style</title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>MVNOLocationBasedOffer</title>
<meta name="description" content="Built with Flatlogic Generator. Discover location-based offers from local vendors.">
<meta name="keywords" content="location based offers, mvno, daily deals, local discounts, mobile coupons, geo-fencing, Built with Flatlogic Generator">
<?php
// Read project preview data from environment
$projectDescription = $_SERVER['PROJECT_DESCRIPTION'] ?? '';
@ -20,7 +22,7 @@ $projectImageUrl = $_SERVER['PROJECT_IMAGE_URL'] ?? '';
?>
<?php if ($projectDescription): ?>
<!-- Meta description -->
<meta name="description" content='<?= htmlspecialchars($projectDescription) ?>' />
<meta name="description" content="<?= htmlspecialchars($projectDescription) ?>" />
<!-- Open Graph meta tags -->
<meta property="og:description" content="<?= htmlspecialchars($projectDescription) ?>" />
<!-- Twitter meta tags -->
@ -29,122 +31,74 @@ $projectImageUrl = $_SERVER['PROJECT_IMAGE_URL'] ?? '';
<?php if ($projectImageUrl): ?>
<!-- Open Graph image -->
<meta property="og:image" content="<?= htmlspecialchars($projectImageUrl) ?>" />
<meta property="og:image:width" content="1200" />
<meta property="og:image:height" content="630" />
<!-- Twitter image -->
<meta property="twitter:image" content="<?= htmlspecialchars($projectImageUrl) ?>" />
<meta name="twitter:card" content="summary_large_image">
<?php endif; ?>
<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&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>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.min.css" rel="stylesheet">
<link rel="stylesheet" href="assets/css/custom.css?v=<?php echo time(); ?>">
</head>
<body>
<main>
<div class="card">
<h1>Analyzing your requirements and generating your website…</h1>
<div class="loader" role="status" aria-live="polite" aria-label="Applying initial changes">
<span class="sr-only">Loading…</span>
<nav class="navbar navbar-expand-lg navbar-light bg-white shadow-sm">
<div class="container">
<a class="navbar-brand" href="index.php">MVNO Offers</a>
<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="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarNav">
<ul class="navbar-nav ms-auto">
<li class="nav-item">
<a class="nav-link active" aria-current="page" href="index.php">Home</a>
</li>
<li class="nav-item">
<a class="nav-link" href="vendor-onboarding.php">For Vendors</a>
</li>
</ul>
</div>
</div>
</nav>
<header class="hero-section text-center">
<div class="container">
<h1 class="display-4">Find Amazing Deals Near You</h1>
<p class="lead text-muted">Connecting you with the best local offers, right where you are.</p>
<a href="vendor-onboarding.php" class="btn btn-primary btn-lg mt-3">Partner With Us</a>
</div>
</header>
<main class="container my-5">
<div class="row">
<div class="col-12 text-center">
<h2>How It Works</h2>
</div>
</div>
<div class="row text-center mt-4">
<div class="col-md-4">
<h3>1. Discover</h3>
<p>Browse offers from a wide range of local vendors.</p>
</div>
<div class="col-md-4">
<h3>2. Claim</h3>
<p>Get notifications and claim deals directly from the app.</p>
</div>
<div class="col-md-4">
<h3>3. Enjoy</h3>
<p>Redeem your offers in-store and enjoy the savings.</p>
</div>
<p class="hint"><?= ($_SERVER['HTTP_HOST'] ?? '') === 'appwizzy.com' ? 'AppWizzy' : 'Flatlogic' ?> AI is collecting your requirements and applying the first changes.</p>
<p class="hint">This page will update automatically as the plan is implemented.</p>
<p>Runtime: PHP <code><?= htmlspecialchars($phpVersion) ?></code> — UTC <code><?= htmlspecialchars($now) ?></code></p>
</div>
</main>
<footer>
Page updated: <?= htmlspecialchars($now) ?> (UTC)
<footer class="text-center py-4 text-muted border-top">
<div class="container">
&copy; <?php echo date("Y"); ?> MVNOLocationBasedOffer. All Rights Reserved.
</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>
</html>

139
vendor-onboarding.php Normal file
View File

@ -0,0 +1,139 @@
<?php
require_once 'db/config.php';
$message = null;
$message_type = '';
// Idempotent table creation
try {
$pdo = db();
$pdo->exec("CREATE TABLE IF NOT EXISTS vendors (id INT AUTO_INCREMENT PRIMARY KEY, business_name VARCHAR(255) NOT NULL, contact_name VARCHAR(255) NOT NULL, email VARCHAR(255) NOT NULL UNIQUE, phone VARCHAR(50), status VARCHAR(50) DEFAULT 'pending_approval', created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP)");
} catch (PDOException $e) {
// In a real app, log this error. For now, we'll just ignore if it fails.
}
if ($_SERVER["REQUEST_METHOD"] == "POST") {
$business_name = trim($_POST['business_name'] ?? '');
$contact_name = trim($_POST['contact_name'] ?? '');
$email = trim($_POST['email'] ?? '');
$phone = trim($_POST['phone'] ?? '');
if (empty($business_name) || empty($contact_name) || !filter_var($email, FILTER_VALIDATE_EMAIL)) {
$message = "Error: Please fill all required fields with valid data.";
$message_type = 'danger';
} else {
try {
$pdo = db();
$stmt = $pdo->prepare("INSERT INTO vendors (business_name, contact_name, email, phone) VALUES (?, ?, ?, ?)");
$stmt->execute([$business_name, $contact_name, $email, $phone]);
$message = "Thank you! Your application has been submitted for review.";
$message_type = 'success';
} catch (PDOException $e) {
if ($e->errorInfo[1] == 1062) { // Duplicate entry
$message = "Error: An account with this email address already exists.";
} else {
$message = "An unexpected error occurred. Please try again later.";
}
$message_type = 'danger';
}
}
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Vendor Onboarding - MVNOLocationBasedOffer</title>
<meta name="description" content="Built with Flatlogic Generator. Onboard your business to start offering location-based deals.">
<meta name="keywords" content="vendor onboarding, location offers, business registration, mvno, daily deals, local marketing, Built with Flatlogic Generator">
<meta property="og:title" content="Vendor Onboarding - MVNOLocationBasedOffer">
<meta property="og:description" content="Join our platform to connect with customers through location-based offers.">
<meta property="og:image" content="<?php echo htmlspecialchars($_SERVER['PROJECT_IMAGE_URL'] ?? '', ENT_QUOTES, 'UTF-8'); ?>">
<meta name="twitter:card" content="summary_large_image">
<meta name="twitter:image" content="<?php echo htmlspecialchars($_SERVER['PROJECT_IMAGE_URL'] ?? '', ENT_QUOTES, 'UTF-8'); ?>">
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.min.css" rel="stylesheet">
<link rel="stylesheet" href="assets/css/custom.css?v=<?php echo time(); ?>">
</head>
<body>
<?php if ($message): ?>
<div class="toast-container position-fixed top-0 end-0 p-3">
<div class="toast align-items-center text-white bg-<?php echo $message_type; ?> border-0" role="alert" aria-live="assertive" aria-atomic="true">
<div class="d-flex">
<div class="toast-body">
<?php echo htmlspecialchars($message); ?>
</div>
<button type="button" class="btn-close btn-close-white me-2 m-auto" data-bs-dismiss="toast" aria-label="Close"></button>
</div>
</div>
</div>
<?php endif; ?>
<nav class="navbar navbar-expand-lg navbar-light bg-white shadow-sm">
<div class="container">
<a class="navbar-brand" href="index.php">MVNO Offers</a>
<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="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarNav">
<ul class="navbar-nav ms-auto">
<li class="nav-item">
<a class="nav-link" href="index.php">Home</a>
</li>
<li class="nav-item">
<a class="nav-link active" aria-current="page" href="vendor-onboarding.php">For Vendors</a>
</li>
</ul>
</div>
</div>
</nav>
<main class="container my-5">
<div class="row justify-content-center">
<div class="col-lg-7 col-md-9">
<div class="card p-4 p-md-5">
<div class="text-center mb-4">
<h1 class="h2">Become a Partner</h1>
<p class="text-muted">Join our network to reach more customers. Fill out the form below to get started.</p>
</div>
<form id="vendorOnboardingForm" action="vendor-onboarding.php" method="POST" novalidate>
<div class="mb-3">
<label for="business_name" class="form-label">Business Name</label>
<input type="text" class="form-control" id="business_name" name="business_name" required>
<div class="invalid-feedback">Please enter your business name.</div>
</div>
<div class="mb-3">
<label for="contact_name" class="form-label">Contact Name</label>
<input type="text" class="form-control" id="contact_name" name="contact_name" required>
<div class="invalid-feedback">Please enter a contact name.</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">Please enter a valid email address.</div>
</div>
<div class="mb-3">
<label for="phone" class="form-label">Phone Number (Optional)</label>
<input type="tel" class="form-control" id="phone" name="phone">
</div>
<div class="d-grid mt-4">
<button type="submit" class="btn btn-primary btn-lg">Submit Application</button>
</div>
</form>
</div>
</div>
</div>
</main>
<footer class="text-center py-4 text-muted border-top">
<div class="container">
&copy; <?php echo date("Y"); ?> MVNOLocationBasedOffer. All Rights Reserved.
</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>
</html>