Compare commits

...

1 Commits

Author SHA1 Message Date
Flatlogic Bot
78f468993c V.01 2025-11-24 04:55:03 +00:00
3 changed files with 232 additions and 142 deletions

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

@ -0,0 +1,22 @@
/* Add your custom styles here */
body {
font-family: 'system-ui', -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', 'Liberation Sans', sans-serif;
}
.navbar-brand {
color: #0D6EFD !important;
}
.btn-primary {
background-color: #0D6EFD;
border-color: #0D6EFD;
}
.btn-primary:hover {
background-color: #0b5ed7;
border-color: #0a58ca;
}
.fs-1 {
font-size: 3rem !important;
}

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

@ -0,0 +1 @@
// Add your custom scripts here

351
index.php
View File

@ -1,150 +1,217 @@
<?php <?php
declare(strict_types=1); require_once 'db/config.php';
@ini_set('display_errors', '1');
@error_reporting(E_ALL); // Create the requests table if it doesn't exist
@date_default_timezone_set('UTC'); try {
$pdo = db();
$sql = "
CREATE TABLE IF NOT EXISTS requests (
id INT AUTO_INCREMENT PRIMARY KEY,
customer_name VARCHAR(255) NOT NULL,
customer_email VARCHAR(255) NOT NULL,
customer_phone VARCHAR(50),
appliance_type VARCHAR(50) NOT NULL,
issue_description TEXT,
status VARCHAR(50) DEFAULT 'Pending',
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
);";
$pdo->exec($sql);
} catch (PDOException $e) {
// For now, we'll just die on a DB error. In a real app, handle this gracefully.
die("Database setup failed: " . $e->getMessage());
}
$success_message = '';
$error_message = '';
if ($_SERVER["REQUEST_METHOD"] == "POST") {
$customer_name = trim($_POST['name']);
$customer_email = trim($_POST['email']);
$customer_phone = trim($_POST['phone']);
$appliance_type = trim($_POST['appliance']);
$issue_description = trim($_POST['issue']);
if (empty($customer_name) || empty($customer_email) || empty($appliance_type)) {
$error_message = "Please fill in all required fields (Name, Email, Appliance Type).";
} elseif (!filter_var($customer_email, FILTER_VALIDATE_EMAIL)) {
$error_message = "Invalid email format.";
} else {
try {
$sql = "INSERT INTO requests (customer_name, customer_email, customer_phone, appliance_type, issue_description) VALUES (:name, :email, :phone, :appliance, :issue)";
$stmt = $pdo->prepare($sql);
$stmt->bindParam(':name', $customer_name);
$stmt->bindParam(':email', $customer_email);
$stmt->bindParam(':phone', $customer_phone);
$stmt->bindParam(':appliance', $appliance_type);
$stmt->bindParam(':issue', $issue_description);
$stmt->execute();
$success_message = "Thank you! Your service request has been submitted. We will get back to you shortly.";
} catch (PDOException $e) {
$error_message = "Error submitting request: " . $e->getMessage();
}
}
}
$project_name = htmlspecialchars($_SERVER['PROJECT_NAME'] ?? 'Appliance CRM');
$project_description = htmlspecialchars($_SERVER['PROJECT_DESCRIPTION'] ?? 'CRM for appliance service requests.');
$project_image_url = htmlspecialchars($_SERVER['PROJECT_IMAGE_URL'] ?? '');
$phpVersion = PHP_VERSION;
$now = date('Y-m-d H:i:s');
?> ?>
<!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.0">
<title>New Style</title> <title><?= $project_name ?></title>
<?php <meta name="description" content="<?= $project_description ?>">
// Read project preview data from environment <!-- Open Graph / Facebook -->
$projectDescription = $_SERVER['PROJECT_DESCRIPTION'] ?? ''; <meta property="og:type" content="website">
$projectImageUrl = $_SERVER['PROJECT_IMAGE_URL'] ?? ''; <meta property="og:title" content="<?= $project_name ?>">
?> <meta property="og:description" content="<?= $project_description ?>">
<?php if ($projectDescription): ?> <?php if ($project_image_url): ?>
<!-- Meta description --> <meta property="og:image" content="<?= $project_image_url ?>">
<meta name="description" content='<?= htmlspecialchars($projectDescription) ?>' /> <?php endif; ?>
<!-- Open Graph meta tags --> <!-- Twitter -->
<meta property="og:description" content="<?= htmlspecialchars($projectDescription) ?>" /> <meta property="twitter:card" content="summary_large_image">
<!-- Twitter meta tags --> <meta property="twitter:title" content="<?= $project_name ?>">
<meta property="twitter:description" content="<?= htmlspecialchars($projectDescription) ?>" /> <meta property="twitter:description" content="<?= $project_description ?>">
<?php endif; ?> <?php if ($project_image_url): ?>
<?php if ($projectImageUrl): ?> <meta property="twitter:image" content="<?= $project_image_url ?>">
<!-- Open Graph image --> <?php endif; ?>
<meta property="og:image" content="<?= htmlspecialchars($projectImageUrl) ?>" />
<!-- Twitter image --> <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.min.css" rel="stylesheet">
<meta property="twitter:image" content="<?= htmlspecialchars($projectImageUrl) ?>" /> <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.11.3/font/bootstrap-icons.min.css">
<?php endif; ?> <link rel="stylesheet" href="assets/css/custom.css?v=<?php echo time(); ?>">
<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>
</head> </head>
<body> <body>
<main>
<div class="card"> <nav class="navbar navbar-expand-lg navbar-light bg-white shadow-sm">
<h1>Analyzing your requirements and generating your website…</h1> <div class="container">
<div class="loader" role="status" aria-live="polite" aria-label="Applying initial changes"> <a class="navbar-brand fw-bold" href="#"><?= $project_name ?></a>
<span class="sr-only">Loading…</span> <button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarNav">
</div> <span class="navbar-toggler-icon"></span>
<p class="hint"><?= ($_SERVER['HTTP_HOST'] ?? '') === 'appwizzy.com' ? 'AppWizzy' : 'Flatlogic' ?> AI is collecting your requirements and applying the first changes.</p> </button>
<p class="hint">This page will update automatically as the plan is implemented.</p> <div class="collapse navbar-collapse" id="navbarNav">
<p>Runtime: PHP <code><?= htmlspecialchars($phpVersion) ?></code> — UTC <code><?= htmlspecialchars($now) ?></code></p> <ul class="navbar-nav ms-auto">
</div> <li class="nav-item"><a class="nav-link" href="#">Home</a></li>
</main> <li class="nav-item"><a class="nav-link" href="#services">Services</a></li>
<footer> <li class="nav-item"><a class="nav-link" href="#booking">Book Service</a></li>
Page updated: <?= htmlspecialchars($now) ?> (UTC) </ul>
</footer> </div>
</div>
</nav>
<header class="py-5">
<div class="container text-center">
<h1 class="display-4 fw-bold">Appliance Repair Made Easy</h1>
<p class="lead text-muted">Fast, reliable service for your TV, A/C, and Washing Machine. Book a technician today!</p>
<a href="#booking" class="btn btn-primary btn-lg mt-3">Book a Service</a>
</div>
</header>
<section id="services" class="py-5 bg-light">
<div class="container">
<div class="text-center mb-5">
<h2 class="fw-bold">Our Services</h2>
<p class="text-muted">We specialize in the installation and repair of:</p>
</div>
<div class="row text-center">
<div class="col-md-4 mb-4">
<div class="card h-100 border-0 shadow-sm">
<div class="card-body">
<i class="bi bi-tv fs-1 text-primary"></i>
<h3 class="h4 mt-3">Televisions</h3>
<p class="text-muted">Screen repairs, sound issues, smart TV setup, and more.</p>
</div>
</div>
</div>
<div class="col-md-4 mb-4">
<div class="card h-100 border-0 shadow-sm">
<div class="card-body">
<i class="bi bi-snow fs-1 text-primary"></i>
<h3 class="h4 mt-3">Air Conditioners</h3>
<p class="text-muted">Cooling problems, regular maintenance, and new installations.</p>
</div>
</div>
</div>
<div class="col-md-4 mb-4">
<div class="card h-100 border-0 shadow-sm">
<div class="card-body">
<i class="bi bi-water fs-1 text-primary"></i>
<h3 class="h4 mt-3">Washing Machines</h3>
<p class="text-muted">Drum issues, water leaks, and electronic faults.</p>
</div>
</div>
</div>
</div>
</div>
</section>
<section id="booking" class="py-5">
<div class="container">
<div class="row justify-content-center">
<div class="col-lg-8">
<div class="text-center mb-5">
<h2 class="fw-bold">Submit a Service Request</h2>
</div>
<?php if ($success_message): ?>
<div class="alert alert-success"><?= $success_message ?></div>
<?php endif; ?>
<?php if ($error_message): ?>
<div class="alert alert-danger"><?= $error_message ?></div>
<?php endif; ?>
<div class="card border-0 shadow-sm">
<div class="card-body p-4">
<form action="index.php#booking" method="POST">
<div class="mb-3">
<label for="name" class="form-label">Full Name</label>
<input type="text" class="form-control" id="name" name="name" required>
</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>
<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="mb-3">
<label for="appliance" class="form-label">Appliance Type</label>
<select class="form-select" id="appliance" name="appliance" required>
<option value="" disabled selected>Select an appliance</option>
<option value="TV">Television</option>
<option value="AC">Air Conditioner</option>
<option value="Washing Machine">Washing Machine</option>
</select>
</div>
<div class="mb-3">
<label for="issue" class="form-label">Brief Description of Issue</label>
<textarea class="form-control" id="issue" name="issue" rows="4"></textarea>
</div>
<div class="d-grid">
<button type="submit" class="btn btn-primary btn-lg">Submit Request</button>
</div>
</form>
</div>
</div>
</div>
</div>
</div>
</section>
<footer class="py-4 bg-dark text-white">
<div class="container text-center">
<p class="mb-0">&copy; <?php echo date("Y"); ?> <?= $project_name ?>. All Rights Reserved.</p>
</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>