Compare commits

..

1 Commits

Author SHA1 Message Date
Flatlogic Bot
5e6f0c0b7a Inicial 2025-10-03 12:46:21 +00:00
6 changed files with 307 additions and 158 deletions

33
add_client.php Normal file
View File

@ -0,0 +1,33 @@
<?php
require_once 'db/config.php';
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
$name = trim($_POST['name']);
if (empty($name)) {
// Handle error: name is required
header('Location: clients.php?error=name_required');
exit;
}
$company_name = trim($_POST['company_name'] ?? '');
$email = trim($_POST['email'] ?? '');
$phone = trim($_POST['phone'] ?? '');
$status = $_POST['status'] ?? 'Active';
$color = $_POST['color'] ?? '#3498db';
$notes = trim($_POST['notes'] ?? '');
try {
$pdo = db_connect();
$sql = "INSERT INTO clients (name, company_name, email, phone, status, color, notes) VALUES (?, ?, ?, ?, ?, ?, ?)";
$stmt = $pdo->prepare($sql);
$stmt->execute([$name, $company_name, $email, $phone, $status, $color, $notes]);
header('Location: clients.php?success=client_added');
exit;
} catch (PDOException $e) {
// In a real app, log this error.
header('Location: clients.php?error=db_error');
exit;
}
}
?>

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

@ -0,0 +1,36 @@
body {
background-color: #ecf0f1;
color: #2c3e50;
font-family: 'Helvetica Neue', Arial, sans-serif;
}
h1, h2, h3, h4, h5, h6 {
font-family: 'Georgia', serif;
}
.navbar {
box-shadow: 0 2px 4px rgba(0,0,0,.1);
}
.card {
border-radius: 8px;
border: none;
box-shadow: 0 4px 8px rgba(0,0,0,.05);
}
.btn {
border-radius: 5px;
}
.form-control, .form-select {
border-radius: 5px;
}
.modal-content {
border-radius: 8px;
}
.badge {
padding: 0.4em 0.6em;
font-size: 0.9em;
}

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

@ -0,0 +1,15 @@
// In the future, we can add interactivity here, for example, form validation or dynamic table updates.
document.addEventListener('DOMContentLoaded', function () {
// Example: Client-side validation for the add client form
const addClientForm = document.getElementById('addClientForm');
if (addClientForm) {
addClientForm.addEventListener('submit', function (event) {
const nameInput = document.getElementById('name');
if (nameInput.value.trim() === '') {
alert('Client name is required.');
event.preventDefault(); // Stop form submission
}
});
}
});

139
clients.php Normal file
View File

@ -0,0 +1,139 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Lovable - Clients</title>
<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">
<script src="https://cdn.jsdelivr.net/npm/feather-icons/dist/feather.min.js"></script>
</head>
<body>
<nav class="navbar navbar-expand-lg navbar-dark bg-primary">
<div class="container">
<a class="navbar-brand" href="index.php">Lovable</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">
<li class="nav-item">
<a class="nav-link" href="index.php">Home</a>
</li>
<li class="nav-item">
<a class="nav-link active" href="clients.php">Clients</a>
</li>
</ul>
</div>
</div>
</nav>
<div class="container mt-5">
<div class="d-flex justify-content-between align-items-center mb-4">
<h1>Clients</h1>
<button type="button" class="btn btn-primary" data-bs-toggle="modal" data-bs-target="#addClientModal">
<i data-feather="plus"></i> Add New Client
</button>
</div>
<div class="card">
<div class="card-body">
<div class="table-responsive">
<table class="table table-hover">
<thead>
<tr>
<th>Name</th>
<th>Company</th>
<th>Email</th>
<th>Phone</th>
<th>Status</th>
<th>Actions</th>
</tr>
</thead>
<tbody>
<?php
require_once 'db/config.php';
$pdo = db_connect();
$stmt = $pdo->query("SELECT * FROM clients ORDER BY created_at DESC");
while ($row = $stmt->fetch()) {
echo "<tr>";
echo "<td><span class='badge' style='background-color:" . htmlspecialchars($row['color']) . "'>&nbsp;</span> " . htmlspecialchars($row['name']) . "</td>";
echo "<td>" . htmlspecialchars($row['company_name']) . "</td>";
echo "<td>" . htmlspecialchars($row['email']) . "</td>";
echo "<td>" . htmlspecialchars($row['phone']) . "</td>";
echo "<td><span class='badge bg-" . ($row['status'] == 'Active' ? 'success' : 'secondary') . "'>" . htmlspecialchars($row['status']) . "</span></td>";
echo "<td>";
echo "<button class='btn btn-sm btn-outline-primary me-2'><i data-feather='edit-2'></i></button>";
echo "<button class='btn btn-sm btn-outline-danger'><i data-feather='trash-2'></i></button>";
echo "</td>";
echo "</tr>";
}
?>
</tbody>
</table>
</div>
</div>
</div>
</div>
<!-- Add Client Modal -->
<div class="modal fade" id="addClientModal" tabindex="-1" aria-labelledby="addClientModalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="addClientModalLabel">Add New Client</h5>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<form id="addClientForm" action="add_client.php" method="POST">
<div class="modal-body">
<div class="mb-3">
<label for="name" class="form-label">Name</label>
<input type="text" class="form-control" id="name" name="name" required>
</div>
<div class="mb-3">
<label for="company_name" class="form-label">Company Name</label>
<input type="text" class="form-control" id="company_name" name="company_name">
</div>
<div class="mb-3">
<label for="email" class="form-label">Email</label>
<input type="email" class="form-control" id="email" name="email">
</div>
<div class="mb-3">
<label for="phone" class="form-label">Phone</label>
<input type="tel" class="form-control" id="phone" name="phone">
</div>
<div class="row">
<div class="col-md-6 mb-3">
<label for="status" class="form-label">Status</label>
<select class="form-select" id="status" name="status">
<option value="Active">Active</option>
<option value="Inactive">Inactive</option>
</select>
</div>
<div class="col-md-6 mb-3">
<label for="color" class="form-label">Identifier Color</label>
<input type="color" class="form-control form-control-color" id="color" name="color" value="#3498db" title="Choose your color">
</div>
</div>
<div class="mb-3">
<label for="notes" class="form-label">Notes</label>
<textarea class="form-control" id="notes" name="notes" rows="3"></textarea>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Close</button>
<button type="submit" class="btn btn-primary">Save Client</button>
</div>
</form>
</div>
</div>
</div>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/js/bootstrap.bundle.min.js"></script>
<script>
feather.replace()
</script>
<script src="assets/js/main.js"></script>
</body>
</html>

View File

@ -1,17 +1,44 @@
<?php <?php
// Generated by setup_mariadb_project.sh — edit as needed. function db_connect() {
define('DB_HOST', '127.0.0.1'); $host = '127.0.0.1';
define('DB_NAME', 'app_30908'); $db = 'lovable';
define('DB_USER', 'app_30908'); $user = 'root';
define('DB_PASS', '98b730aa-be6c-479d-a47d-e5e7abc49229'); $pass = '';
$charset = 'utf8mb4';
function db() { $dsn = "mysql:host=$host;dbname=$db;charset=$charset";
static $pdo; $options = [
if (!$pdo) { PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION,
$pdo = new PDO('mysql:host='.DB_HOST.';dbname='.DB_NAME.';charset=utf8mb4', DB_USER, DB_PASS, [ PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_ASSOC,
PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION, PDO::ATTR_EMULATE_PREPARES => false,
PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_ASSOC, ];
]); try {
} return new PDO($dsn, $user, $pass, $options);
return $pdo; } catch (\PDOException $e) {
throw new \PDOException($e->getMessage(), (int)$e->getCode());
}
} }
try {
$pdo = db_connect();
$pdo->exec("CREATE DATABASE IF NOT EXISTS lovable");
$pdo->exec("USE lovable");
$pdo->exec("
CREATE TABLE IF NOT EXISTS clients (
id INT AUTO_INCREMENT PRIMARY KEY,
user_id INT NOT NULL DEFAULT 1,
name VARCHAR(255) NOT NULL,
company_name VARCHAR(255),
email VARCHAR(255),
phone VARCHAR(50),
status ENUM('Active', 'Inactive') DEFAULT 'Active',
color VARCHAR(7) DEFAULT '#3498db',
notes TEXT,
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
)
");
} catch (\PDOException $e) {
// In a real app, log this error. For now, we'll just die.
die("DB setup failed: " . $e->getMessage());
}
?>

185
index.php
View File

@ -1,150 +1,49 @@
<?php <!DOCTYPE html>
declare(strict_types=1);
@ini_set('display_errors', '1');
@error_reporting(E_ALL);
@date_default_timezone_set('UTC');
$phpVersion = PHP_VERSION;
$now = date('Y-m-d H:i:s');
?>
<!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>Controle de atividades</title>
<?php <meta name="description" content="Lovable: Seamlessly manage daily client tasks with secure authentication in a user-friendly web application.">
// Read project preview data from environment <meta name="keywords" content="task management, client management, activity tracking, project management, time tracking, productivity, work log, professional services, freelance, small business">
$projectDescription = $_SERVER['PROJECT_DESCRIPTION'] ?? ''; <meta property="og:title" content="Controle de atividades">
$projectImageUrl = $_SERVER['PROJECT_IMAGE_URL'] ?? ''; <meta property="og:description" content="Lovable: Seamlessly manage daily client tasks with secure authentication in a user-friendly web application.">
?> <meta property="og:image" content="https://project-screens.s3.amazonaws.com/screenshots/34625/app-hero-20251003-123701.png">
<?php if ($projectDescription): ?> <meta name="twitter:card" content="summary_large_image">
<!-- Meta description --> <meta name="twitter:image" content="https://project-screens.s3.amazonaws.com/screenshots/34625/app-hero-20251003-123701.png">
<meta name="description" content='<?= htmlspecialchars($projectDescription) ?>' /> <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.min.css" rel="stylesheet">
<!-- Open Graph meta tags --> <link rel="stylesheet" href="assets/css/custom.css">
<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> </head>
<body> <body>
<main>
<div class="card"> <nav class="navbar navbar-expand-lg navbar-dark bg-primary">
<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" href="#">Lovable</a>
<span class="sr-only">Loading…</span> <button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarNav" aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation">
</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">
<li class="nav-item">
<a class="nav-link active" href="index.php">Home</a>
</li>
<li class="nav-item">
<a class="nav-link" href="clients.php">Clients</a>
</li>
</ul>
</div> </div>
</main> </div>
<footer> </nav>
Page updated: <?= htmlspecialchars($now) ?> (UTC)
</footer> <div class="container mt-5">
<div class="text-center">
<h1>Welcome to Lovable</h1>
<p class="lead">Your new tool for managing client activities.</p>
<a href="clients.php" class="btn btn-primary btn-lg">Go to Clients</a>
</div>
</div>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/js/bootstrap.bundle.min.js"></script>
<script src="assets/js/main.js"></script>
</body> </body>
</html> </html>