This commit is contained in:
Flatlogic Bot 2025-10-22 18:57:21 +00:00
parent 9c00e0b4b1
commit 2e32207c38
8 changed files with 284 additions and 161 deletions

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

@ -0,0 +1,32 @@
/* Orange and Dark Gray Theme */
:root {
--bs-primary: #fd7e14; /* Vivid Orange */
--bs-secondary: #6c757d;
--bs-dark: #343a40;
--bs-primary-rgb: 253, 126, 20;
}
body {
font-family: 'Inter', sans-serif;
background-color: #f8f9fa;
}
.btn-primary {
background-color: var(--bs-primary);
border-color: var(--bs-primary);
}
.btn-primary:hover {
background-color: #e46a0a;
border-color: #d16209;
}
.navbar-dark {
background-color: var(--bs-dark) !important;
}
.footer {
background-color: #343a40;
color: white;
}

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

@ -0,0 +1,19 @@
// Main JavaScript file
(function() {
'use strict';
window.addEventListener('load', function() {
// Fetch all the forms we want to apply custom Bootstrap validation styles to
var forms = document.getElementsByClassName('needs-validation');
// Loop over them and prevent submission
var validation = Array.prototype.filter.call(forms, function(form) {
form.addEventListener('submit', function(event) {
if (form.checkValidity() === false) {
event.preventDefault();
event.stopPropagation();
}
form.classList.add('was-validated');
}, false);
});
}, false);
})();

View File

@ -1,17 +1,57 @@
<?php
// Generated by setup_mariadb_project.sh — edit as needed.
define('DB_HOST', '127.0.0.1');
define('DB_NAME', 'app_30972');
define('DB_USER', 'app_30972');
define('DB_PASS', '9eb17a13-4a89-4e11-8517-0c201096e935');
// Database configuration
define('DB_HOST', getenv('DB_HOST') ?: '127.0.0.1');
define('DB_PORT', getenv('DB_PORT') ?: '3306');
define('DB_NAME', getenv('DB_NAME') ?: 'flatlogic');
define('DB_USER', getenv('DB_USER') ?: 'flatlogic');
define('DB_PASS', getenv('DB_PASS') ?: 'flatlogic');
function db() {
static $pdo;
if (!$pdo) {
$pdo = new PDO('mysql:host='.DB_HOST.';dbname='.DB_NAME.';charset=utf8mb4', DB_USER, DB_PASS, [
if ($pdo) {
return $pdo;
}
try {
// Connect without specifying a database to create it if it doesn't exist
$dsn_init = 'mysql:host=' . DB_HOST . ';port=' . DB_PORT . ';charset=utf8mb4';
$pdo_init = new PDO($dsn_init, DB_USER, DB_PASS, [
PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION,
PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_ASSOC,
PDO::ATTR_EMULATE_PREPARES => false,
]);
}
$pdo_init->exec('CREATE DATABASE IF NOT EXISTS `' . DB_NAME . '`');
// Now connect to the specific database
$dsn = 'mysql:host=' . DB_HOST . ';port=' . DB_PORT . ';dbname=' . DB_NAME . ';charset=utf8mb4';
$pdo = new PDO($dsn, DB_USER, DB_PASS, [
PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION,
PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_ASSOC,
PDO::ATTR_EMULATE_PREPARES => false,
]);
run_migrations($pdo);
return $pdo;
} catch (PDOException $e) {
// In a real app, you'd log this error and show a generic message
throw new PDOException($e->getMessage(), (int)$e->getCode());
}
}
function run_migrations($pdo) {
$pdo->exec('CREATE TABLE IF NOT EXISTS `migrations` (`migration` VARCHAR(255) NOT NULL, PRIMARY KEY (`migration`))');
$applied_migrations = $pdo->query('SELECT `migration` FROM `migrations`')->fetchAll(PDO::FETCH_COLUMN);
$migration_files = glob(__DIR__ . '/migrations/*.sql');
sort($migration_files);
foreach ($migration_files as $file) {
$migration_name = basename($file);
if (!in_array($migration_name, $applied_migrations)) {
$sql = file_get_contents($file);
$pdo->exec($sql);
$stmt = $pdo->prepare('INSERT INTO `migrations` (`migration`) VALUES (?)');
$stmt->execute([$migration_name]);
}
}
}

View File

@ -0,0 +1,10 @@
CREATE TABLE IF NOT EXISTS `service_requests` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(255) NOT NULL,
`email` varchar(255) NOT NULL,
`message` text NOT NULL,
`status` varchar(50) NOT NULL DEFAULT 'pending',
`created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

13
footer.php Normal file
View File

@ -0,0 +1,13 @@
</main><!-- /.container -->
<footer class="footer mt-auto py-3">
<div class="container text-center">
<span>&copy; <?php echo date('Y'); ?> IA Cases. All Rights Reserved.</span>
</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>

45
header.php Normal file
View File

@ -0,0 +1,45 @@
<?php require_once __DIR__ . '/db/config.php'; ?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>IA Cases</title>
<meta name="description" content="Client case management portal built with Flatlogic Generator.">
<meta name="keywords" content="client portal, case management, legal tech, client communication, document management, task management, flatlogic">
<meta property="og:title" content="IA Cases">
<meta property="og:description" content="Client case management portal built with Flatlogic Generator.">
<meta property="og:image" content="<?php echo htmlspecialchars($_SERVER['PROJECT_IMAGE_URL'] ?? ''); ?>">
<meta name="twitter:card" content="summary_large_image">
<meta name="twitter:image" content="<?php echo htmlspecialchars($_SERVER['PROJECT_IMAGE_URL'] ?? ''); ?>">
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.min.css" rel="stylesheet">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.11.3/font/bootstrap-icons.min.css">
<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;500;600;700&display=swap" rel="stylesheet">
<link rel="stylesheet" href="assets/css/custom.css?v=<?php echo time(); ?>">
</head>
<body>
<nav class="navbar navbar-expand-lg navbar-dark">
<div class="container">
<a class="navbar-brand" href="index.php">IA Cases</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" href="request-service.php">Request Service</a>
</li>
</ul>
</div>
</div>
</nav>
<main class="container my-5">

158
index.php
View File

@ -1,150 +1,14 @@
<?php
declare(strict_types=1);
@ini_set('display_errors', '1');
@error_reporting(E_ALL);
@date_default_timezone_set('UTC');
<?php require_once __DIR__ . '/header.php'; ?>
$phpVersion = PHP_VERSION;
$now = date('Y-m-d H:i:s');
?>
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>New Style</title>
<?php
// Read project preview data from environment
$projectDescription = $_SERVER['PROJECT_DESCRIPTION'] ?? '';
$projectImageUrl = $_SERVER['PROJECT_IMAGE_URL'] ?? '';
?>
<?php if ($projectDescription): ?>
<!-- Meta description -->
<meta name="description" content='<?= htmlspecialchars($projectDescription) ?>' />
<!-- Open Graph meta tags -->
<meta property="og:description" content="<?= htmlspecialchars($projectDescription) ?>" />
<!-- Twitter meta tags -->
<meta property="twitter:description" content="<?= htmlspecialchars($projectDescription) ?>" />
<?php endif; ?>
<?php if ($projectImageUrl): ?>
<!-- Open Graph image -->
<meta property="og:image" content="<?= htmlspecialchars($projectImageUrl) ?>" />
<!-- Twitter image -->
<meta property="twitter:image" content="<?= htmlspecialchars($projectImageUrl) ?>" />
<?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>
</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>
<div class="px-4 py-5 my-5 text-center">
<h1 class="display-5 fw-bold text-body-emphasis">Client Case Management, Simplified</h1>
<div class="col-lg-6 mx-auto">
<p class="lead mb-4">Welcome to your dedicated client portal. Request services, track case progress, and communicate with your account manager seamlessly. Get started by requesting a service below.</p>
<div class="d-grid gap-2 d-sm-flex justify-content-sm-center">
<a href="request-service.php" class="btn btn-primary btn-lg px-4 gap-3">Request a Service</a>
<button type="button" class="btn btn-outline-secondary btn-lg px-4">Log In</button>
</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>
</body>
</html>
</div>
<?php require_once __DIR__ . '/footer.php'; ?>

100
request-service.php Normal file
View File

@ -0,0 +1,100 @@
<?php
require_once __DIR__ . '/mail/MailService.php';
$page_title = 'Request a Service';
$message = '';
$message_type = '';
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
$name = trim($_POST['name'] ?? '');
$email = trim($_POST['email'] ?? '');
$service_message = trim($_POST['message'] ?? '');
if (empty($name) || empty($email) || empty($service_message) || !filter_var($email, FILTER_VALIDATE_EMAIL)) {
$message = 'Please fill in all fields correctly.';
$message_type = 'danger';
} else {
try {
$pdo = db();
$stmt = $pdo->prepare(
'INSERT INTO service_requests (name, email, message) VALUES (?, ?, ?)'
);
$stmt->execute([$name, $email, $service_message]);
// Notify Admin
$admin_email = getenv('MAIL_TO') ?: 'admin@example.com';
$subject = 'New Service Request from ' . $name;
$html_content = "
<h1>New Service Request</h1>
<p><strong>Name:</strong> {$name}</p>
<p><strong>Email:</strong> {$email}</p>
<p><strong>Message:</strong></p>
<p>{$service_message}</p>
<p>This request is now pending approval in the admin dashboard.</p>
";
$text_content = strip_tags($html_content);
MailService::sendMail($admin_email, $subject, $html_content, $text_content);
$message = 'Thank you! Your service request has been submitted successfully. An account manager will review it shortly.';
$message_type = 'success';
} catch (PDOException $e) {
// In a real app, log this error.
$message = 'Sorry, there was an error submitting your request. Please try again later.';
$message_type = 'danger';
} catch (Exception $e) {
$message = 'Sorry, there was an error sending the notification. Please try again later.';
$message_type = 'danger';
}
}
}
require_once __DIR__ . '/header.php';
?>
<div class="row justify-content-center">
<div class="col-lg-8">
<div class="card shadow-sm">
<div class="card-body p-5">
<h1 class="card-title text-center mb-4"><?php echo $page_title; ?></h1>
<?php if ($message): ?>
<div class="alert alert-<?php echo $message_type; ?> alert-dismissible fade show" role="alert">
<?php echo htmlspecialchars($message); ?>
<button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>
</div>
<?php endif; ?>
<?php if ($message_type !== 'success'): ?>
<form action="request-service.php" method="POST" class="needs-validation" novalidate>
<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 class="invalid-feedback">
Please enter your full 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="message" class="form-label">Describe the service you need</label>
<textarea class="form-control" id="message" name="message" rows="5" required></textarea>
<div class="invalid-feedback">
Please describe the service you require.
</div>
</div>
<div class="text-center">
<button type="submit" class="btn btn-primary btn-lg px-5">Submit Request</button>
</div>
</form>
<?php endif; ?>
</div>
</div>
</div>
</div>
<?php require_once __DIR__ . '/footer.php'; ?>