Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
81e4e770cd |
0
.perm_test_apache
Normal file
0
.perm_test_apache
Normal file
0
.perm_test_exec
Normal file
0
.perm_test_exec
Normal file
6
admin/index.php
Normal file
6
admin/index.php
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
<?php include 'partials/header.php'; ?>
|
||||||
|
|
||||||
|
<h1>Dashboard</h1>
|
||||||
|
<p>Bem-vindo ao painel administrativo. Use o menu à esquerda para gerenciar o conteúdo do seu site.</p>
|
||||||
|
|
||||||
|
<?php include 'partials/footer.php'; ?>
|
||||||
69
admin/login.php
Normal file
69
admin/login.php
Normal file
@ -0,0 +1,69 @@
|
|||||||
|
<?php
|
||||||
|
session_start();
|
||||||
|
require_once '../db/config.php';
|
||||||
|
|
||||||
|
$error_message = '';
|
||||||
|
|
||||||
|
// Se o usuário já estiver logado, redireciona para o painel
|
||||||
|
if (isset($_SESSION['user_id'])) {
|
||||||
|
header("Location: index.php");
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($_SERVER["REQUEST_METHOD"] == "POST") {
|
||||||
|
$username = $_POST['username'] ?? '';
|
||||||
|
$password = $_POST['password'] ?? '';
|
||||||
|
|
||||||
|
if (empty($username) || empty($password)) {
|
||||||
|
$error_message = "Por favor, preencha o usuário e a senha.";
|
||||||
|
} else {
|
||||||
|
try {
|
||||||
|
$stmt = db()->prepare("SELECT * FROM users WHERE username = ?");
|
||||||
|
$stmt->execute([$username]);
|
||||||
|
$user = $stmt->fetch(PDO::FETCH_ASSOC);
|
||||||
|
|
||||||
|
if ($user && password_verify($password, $user['password'])) {
|
||||||
|
// Login bem-sucedido
|
||||||
|
$_SESSION['user_id'] = $user['id'];
|
||||||
|
$_SESSION['username'] = $user['username'];
|
||||||
|
header("Location: index.php");
|
||||||
|
exit;
|
||||||
|
} else {
|
||||||
|
// Credenciais inválidas
|
||||||
|
$error_message = "Usuário ou senha inválidos.";
|
||||||
|
}
|
||||||
|
} catch (PDOException $e) {
|
||||||
|
$error_message = "Erro no banco de dados. Se você acabou de criar o painel, execute o script /db/migrate_users.php";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="pt-br">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
<title>Admin Login</title>
|
||||||
|
<link href="https://fonts.googleapis.com/css2?family=Montserrat:wght@400;700&family=Lato:wght@400;700&display=swap" rel="stylesheet">
|
||||||
|
<link rel="stylesheet" href="style.css">
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div class="login-container">
|
||||||
|
<form class="login-form" action="login.php" method="POST">
|
||||||
|
<h1>Acesso Restrito</h1>
|
||||||
|
<?php if ($error_message): ?>
|
||||||
|
<div class="error-message"><?php echo $error_message; ?></div>
|
||||||
|
<?php endif; ?>
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="username">Usuário</label>
|
||||||
|
<input type="text" id="username" name="username" required autofocus>
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="password">Senha</label>
|
||||||
|
<input type="password" id="password" name="password" required>
|
||||||
|
</div>
|
||||||
|
<button type="submit">Entrar</button>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
11
admin/logout.php
Normal file
11
admin/logout.php
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
<?php
|
||||||
|
session_start();
|
||||||
|
|
||||||
|
// Desconecta o usuário
|
||||||
|
session_unset();
|
||||||
|
session_destroy();
|
||||||
|
|
||||||
|
// Redireciona para a página de login
|
||||||
|
header("Location: login.php");
|
||||||
|
exit;
|
||||||
|
?>
|
||||||
4
admin/partials/footer.php
Normal file
4
admin/partials/footer.php
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
</main>
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
41
admin/partials/header.php
Normal file
41
admin/partials/header.php
Normal file
@ -0,0 +1,41 @@
|
|||||||
|
<?php
|
||||||
|
session_start();
|
||||||
|
|
||||||
|
// Se o usuário não estiver logado, redireciona para a página de login
|
||||||
|
// A única página que não precisa de login é a própria login.php
|
||||||
|
if (!isset($_SESSION['user_id']) && basename($_SERVER['PHP_SELF']) != 'login.php') {
|
||||||
|
header("Location: login.php");
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
function is_active($page) {
|
||||||
|
// Retorna 'active' se a URI atual contém o nome da página
|
||||||
|
return strpos($_SERVER['REQUEST_URI'], $page) !== false ? 'active' : '';
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="pt-br">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
<title>Painel Administrativo</title>
|
||||||
|
<link href="https://fonts.googleapis.com/css2?family=Montserrat:wght@400;700&family=Lato:wght@400;700&display=swap" rel="stylesheet">
|
||||||
|
<link rel="stylesheet" href="style.css">
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div class="admin-wrapper">
|
||||||
|
<aside class="sidebar">
|
||||||
|
<h2>Catálogo DB</h2>
|
||||||
|
<nav>
|
||||||
|
<ul>
|
||||||
|
<li><a href="index.php" class="<?= is_active('index.php') ?>">Dashboard</a></li>
|
||||||
|
<li><a href="products.php" class="<?= is_active('products.php') ?>">Produtos</a></li>
|
||||||
|
<li><a href="../" target="_blank">Ver Site</a></li>
|
||||||
|
<li><a href="logout.php">Sair</a></li>
|
||||||
|
</ul>
|
||||||
|
</nav>
|
||||||
|
<div class="sidebar-footer">
|
||||||
|
<p>Logado como: <strong><?php echo htmlspecialchars($_SESSION['username'] ?? ''); ?></strong></p>
|
||||||
|
</div>
|
||||||
|
</aside>
|
||||||
|
<main class="main-content">
|
||||||
31
admin/product-delete.php
Normal file
31
admin/product-delete.php
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
<?php
|
||||||
|
require_once '../db/config.php';
|
||||||
|
|
||||||
|
// Verifica se o ID foi passado e é um número
|
||||||
|
if (isset($_GET['id']) && is_numeric($_GET['id'])) {
|
||||||
|
$id = $_GET['id'];
|
||||||
|
|
||||||
|
try {
|
||||||
|
$pdo = db();
|
||||||
|
|
||||||
|
// Prepara e executa a query de exclusão
|
||||||
|
$stmt = $pdo->prepare("DELETE FROM products WHERE id = :id");
|
||||||
|
$stmt->bindParam(':id', $id, PDO::PARAM_INT);
|
||||||
|
$stmt->execute();
|
||||||
|
|
||||||
|
// Redireciona de volta para a lista de produtos com uma mensagem de sucesso
|
||||||
|
header("Location: products.php?status=deleted");
|
||||||
|
exit;
|
||||||
|
|
||||||
|
} catch (PDOException $e) {
|
||||||
|
// Em caso de erro, redireciona com uma mensagem de erro
|
||||||
|
// Em um ambiente real, você deveria logar o erro
|
||||||
|
header("Location: products.php?status=error");
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// Se o ID não for válido, apenas redireciona de volta
|
||||||
|
header("Location: products.php");
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
?>
|
||||||
136
admin/product-edit.php
Normal file
136
admin/product-edit.php
Normal file
@ -0,0 +1,136 @@
|
|||||||
|
<?php
|
||||||
|
require_once '../db/config.php';
|
||||||
|
require_once 'partials/header.php';
|
||||||
|
|
||||||
|
$product = [
|
||||||
|
'id' => '',
|
||||||
|
'name' => '',
|
||||||
|
'description' => '',
|
||||||
|
'price' => '',
|
||||||
|
'sku' => '',
|
||||||
|
'stock' => '',
|
||||||
|
'images' => ''
|
||||||
|
];
|
||||||
|
$page_title = 'Adicionar Novo Produto';
|
||||||
|
$image_path = '';
|
||||||
|
|
||||||
|
// Check if an ID is provided for editing
|
||||||
|
if (isset($_GET['id'])) {
|
||||||
|
$product_id = $_GET['id'];
|
||||||
|
$stmt = db()->prepare("SELECT * FROM products WHERE id = ?");
|
||||||
|
$stmt->execute([$product_id]);
|
||||||
|
$product = $stmt->fetch(PDO::FETCH_ASSOC);
|
||||||
|
|
||||||
|
if ($product) {
|
||||||
|
$page_title = 'Editar Produto';
|
||||||
|
$image_path = $product['images'];
|
||||||
|
} else {
|
||||||
|
header("Location: products.php");
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Handle form submission
|
||||||
|
if ($_SERVER["REQUEST_METHOD"] == "POST") {
|
||||||
|
$id = $_POST['id'] ?? null;
|
||||||
|
$name = $_POST['name'];
|
||||||
|
$description = $_POST['description'];
|
||||||
|
$price = $_POST['price'];
|
||||||
|
$sku = $_POST['sku'];
|
||||||
|
$stock = $_POST['stock'];
|
||||||
|
$current_image = $_POST['current_image'] ?? '';
|
||||||
|
$image_path = $current_image;
|
||||||
|
|
||||||
|
// Handle file upload
|
||||||
|
if (isset($_FILES['image']) && $_FILES['image']['error'] == 0) {
|
||||||
|
$upload_dir = '../assets/images/products/';
|
||||||
|
if (!is_dir($upload_dir)) {
|
||||||
|
mkdir($upload_dir, 0775, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
$file_extension = pathinfo($_FILES['image']['name'], PATHINFO_EXTENSION);
|
||||||
|
$unique_filename = uniqid('product_', true) . '.' . $file_extension;
|
||||||
|
$target_file = $upload_dir . $unique_filename;
|
||||||
|
|
||||||
|
if (move_uploaded_file($_FILES['image']['tmp_name'], $target_file)) {
|
||||||
|
$image_path = 'assets/images/products/' . $unique_filename;
|
||||||
|
// Delete old image if it exists
|
||||||
|
if ($current_image && file_exists('../' . $current_image)) {
|
||||||
|
unlink('../' . $current_image);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($id) {
|
||||||
|
// Update existing product
|
||||||
|
$stmt = db()->prepare("UPDATE products SET name = ?, description = ?, price = ?, sku = ?, stock = ?, images = ? WHERE id = ?");
|
||||||
|
$stmt->execute([$name, $description, $price, $sku, $stock, $image_path, $id]);
|
||||||
|
} else {
|
||||||
|
// Insert new product
|
||||||
|
$stmt = db()->prepare("INSERT INTO products (name, description, price, sku, stock, images) VALUES (?, ?, ?, ?, ?, ?)");
|
||||||
|
$stmt->execute([$name, $description, $price, $sku, $stock, $image_path]);
|
||||||
|
}
|
||||||
|
|
||||||
|
header("Location: products.php?status=saved");
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
|
||||||
|
<div class="container-fluid">
|
||||||
|
<h1 class="h3 mb-4 text-gray-800"><?php echo htmlspecialchars($page_title); ?></h1>
|
||||||
|
|
||||||
|
<div class="card shadow mb-4">
|
||||||
|
<div class="card-body">
|
||||||
|
<form action="product-edit.php<?php echo $product['id'] ? '?id='.$product['id'] : ''; ?>" method="POST" enctype="multipart/form-data">
|
||||||
|
<input type="hidden" name="id" value="<?php echo htmlspecialchars($product['id']); ?>">
|
||||||
|
<input type="hidden" name="current_image" value="<?php echo htmlspecialchars($image_path); ?>">
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="name">Nome do Produto</label>
|
||||||
|
<input type="text" class="form-control" id="name" name="name" value="<?php echo htmlspecialchars($product['name']); ?>" required>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="description">Descrição</label>
|
||||||
|
<textarea class="form-control" id="description" name="description" rows="5"><?php echo htmlspecialchars($product['description']); ?></textarea>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-md-6">
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="price">Preço</label>
|
||||||
|
<input type="number" class="form-control" id="price" name="price" step="0.01" value="<?php echo htmlspecialchars($product['price']); ?>" required>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-6">
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="sku">SKU</label>
|
||||||
|
<input type="text" class="form-control" id="sku" name="sku" value="<?php echo htmlspecialchars($product['sku']); ?>">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="stock">Estoque</label>
|
||||||
|
<input type="number" class="form-control" id="stock" name="stock" value="<?php echo htmlspecialchars($product['stock']); ?>" required>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="image">Imagem do Produto</label>
|
||||||
|
<?php if ($image_path && file_exists('../' . $image_path)): ?>
|
||||||
|
<div class="mb-2">
|
||||||
|
<img src="../<?php echo htmlspecialchars($image_path); ?>" alt="Imagem do Produto" style="max-width: 150px; max-height: 150px;">
|
||||||
|
</div>
|
||||||
|
<?php endif; ?>
|
||||||
|
<input type="file" class="form-control-file" id="image" name="image">
|
||||||
|
<small class="form-text text-muted">Envie uma nova imagem para substituir a atual. Formatos aceitos: JPG, PNG, GIF.</small>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<button type="submit" class="btn btn-primary">Salvar Produto</button>
|
||||||
|
<a href="products.php" class="btn btn-secondary">Cancelar</a>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<?php require_once 'partials/footer.php'; ?>
|
||||||
71
admin/products.php
Normal file
71
admin/products.php
Normal file
@ -0,0 +1,71 @@
|
|||||||
|
<?php
|
||||||
|
require_once '../db/config.php';
|
||||||
|
include 'partials/header.php';
|
||||||
|
|
||||||
|
$status = $_GET['status'] ?? '';
|
||||||
|
|
||||||
|
try {
|
||||||
|
$pdo = db();
|
||||||
|
$stmt = $pdo->query('SELECT id, name, price, stock, images FROM products ORDER BY created_at DESC');
|
||||||
|
$products = $stmt->fetchAll(PDO::FETCH_ASSOC);
|
||||||
|
} catch (PDOException $e) {
|
||||||
|
die("Erro ao buscar produtos: " . $e->getMessage());
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
|
||||||
|
<?php if ($status === 'deleted'): ?>
|
||||||
|
<div class="alert alert-success">Produto excluído com sucesso!</div>
|
||||||
|
<?php elseif ($status === 'error'): ?>
|
||||||
|
<div class="alert alert-danger">Ocorreu um erro ao processar sua solicitação.</div>
|
||||||
|
<?php elseif ($status === 'saved'): ?>
|
||||||
|
<div class="alert alert-success">Produto salvo com sucesso!</div>
|
||||||
|
<?php endif; ?>
|
||||||
|
|
||||||
|
<div class="d-flex justify-content-between align-items-center">
|
||||||
|
<h1>Gerenciar Produtos</h1>
|
||||||
|
<a href="product-edit.php" class="btn btn-primary">Adicionar Novo Produto</a>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="table-responsive mt-4">
|
||||||
|
<table class="table table-striped table-bordered">
|
||||||
|
<thead class="thead-dark">
|
||||||
|
<tr>
|
||||||
|
<th>Imagem</th>
|
||||||
|
<th>ID</th>
|
||||||
|
<th>Nome</th>
|
||||||
|
<th>Preço</th>
|
||||||
|
<th>Estoque</th>
|
||||||
|
<th>Ações</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<?php if (empty($products)): ?>
|
||||||
|
<tr>
|
||||||
|
<td colspan="6" class="text-center">Nenhum produto cadastrado.</td>
|
||||||
|
</tr>
|
||||||
|
<?php else: ?>
|
||||||
|
<?php foreach ($products as $product): ?>
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<?php if (!empty($product['images']) && file_exists('../' . $product['images'])): ?>
|
||||||
|
<img src="../<?php echo htmlspecialchars($product['images']); ?>" alt="<?php echo htmlspecialchars($product['name']); ?>" style="width: 50px; height: 50px; object-fit: cover;">
|
||||||
|
<?php else: ?>
|
||||||
|
<img src="../assets/images/placeholder.png" alt="Sem imagem" style="width: 50px; height: 50px; object-fit: cover;">
|
||||||
|
<?php endif; ?>
|
||||||
|
</td>
|
||||||
|
<td><?php echo htmlspecialchars($product['id']); ?></td>
|
||||||
|
<td><?php echo htmlspecialchars($product['name']); ?></td>
|
||||||
|
<td>R$ <?php echo number_format($product['price'], 2, ',', '.'); ?></td>
|
||||||
|
<td><?php echo htmlspecialchars($product['stock']); ?></td>
|
||||||
|
<td>
|
||||||
|
<a href="product-edit.php?id=<?php echo $product['id']; ?>" class="btn btn-sm btn-warning">Editar</a>
|
||||||
|
<a href="product-delete.php?id=<?php echo $product['id']; ?>" class="btn btn-sm btn-danger" onclick="return confirm('Tem certeza que deseja excluir este produto?');">Excluir</a>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<?php endforeach; ?>
|
||||||
|
<?php endif; ?>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<?php include 'partials/footer.php'; ?>
|
||||||
112
admin/style.css
Normal file
112
admin/style.css
Normal file
@ -0,0 +1,112 @@
|
|||||||
|
/* Admin Styles */
|
||||||
|
body {
|
||||||
|
font-family: 'Lato', sans-serif;
|
||||||
|
background-color: #f8f9fa;
|
||||||
|
color: #212529;
|
||||||
|
margin: 0;
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
height: 100vh;
|
||||||
|
}
|
||||||
|
|
||||||
|
.login-container {
|
||||||
|
width: 100%;
|
||||||
|
max-width: 400px;
|
||||||
|
padding: 2rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.login-form {
|
||||||
|
background-color: #fff;
|
||||||
|
padding: 2rem;
|
||||||
|
border-radius: 0.5rem;
|
||||||
|
box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.1);
|
||||||
|
}
|
||||||
|
|
||||||
|
.login-form h1 {
|
||||||
|
font-family: 'Montserrat', sans-serif;
|
||||||
|
text-align: center;
|
||||||
|
margin-bottom: 1.5rem;
|
||||||
|
color: #004A7F;
|
||||||
|
}
|
||||||
|
|
||||||
|
.form-group {
|
||||||
|
margin-bottom: 1.5rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.form-group label {
|
||||||
|
display: block;
|
||||||
|
margin-bottom: 0.5rem;
|
||||||
|
font-weight: 700;
|
||||||
|
}
|
||||||
|
|
||||||
|
.form-group input {
|
||||||
|
width: 100%;
|
||||||
|
padding: 0.75rem;
|
||||||
|
border: 1px solid #ced4da;
|
||||||
|
border-radius: 0.25rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
button {
|
||||||
|
width: 100%;
|
||||||
|
padding: 0.75rem;
|
||||||
|
background-color: #004A7F;
|
||||||
|
color: #fff;
|
||||||
|
border: none;
|
||||||
|
border-radius: 0.5rem;
|
||||||
|
font-size: 1rem;
|
||||||
|
font-weight: 700;
|
||||||
|
cursor: pointer;
|
||||||
|
transition: background-color 0.2s;
|
||||||
|
}
|
||||||
|
|
||||||
|
button:hover {
|
||||||
|
background-color: #003359;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Admin Panel Layout */
|
||||||
|
.admin-wrapper {
|
||||||
|
display: flex;
|
||||||
|
height: 100vh;
|
||||||
|
width: 100vw;
|
||||||
|
align-items: stretch;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sidebar {
|
||||||
|
width: 250px;
|
||||||
|
background-color: #004A7F;
|
||||||
|
color: #fff;
|
||||||
|
padding: 1rem;
|
||||||
|
flex-shrink: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sidebar h2 {
|
||||||
|
font-family: 'Montserrat', sans-serif;
|
||||||
|
text-align: center;
|
||||||
|
color: #FDB813;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sidebar nav ul {
|
||||||
|
list-style: none;
|
||||||
|
padding: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sidebar nav a {
|
||||||
|
display: block;
|
||||||
|
padding: 0.75rem 1rem;
|
||||||
|
color: #fff;
|
||||||
|
text-decoration: none;
|
||||||
|
border-radius: 0.25rem;
|
||||||
|
margin-bottom: 0.5rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sidebar nav a:hover,
|
||||||
|
.sidebar nav a.active {
|
||||||
|
background-color: #003359;
|
||||||
|
}
|
||||||
|
|
||||||
|
.main-content {
|
||||||
|
flex-grow: 1;
|
||||||
|
padding: 2rem;
|
||||||
|
overflow-y: auto;
|
||||||
|
}
|
||||||
311
ai/LocalAIApi.php
Normal file
311
ai/LocalAIApi.php
Normal file
@ -0,0 +1,311 @@
|
|||||||
|
<?php
|
||||||
|
// LocalAIApi — proxy client for the Responses API.
|
||||||
|
// Usage:
|
||||||
|
// require_once __DIR__ . '/ai/LocalAIApi.php';
|
||||||
|
// $response = LocalAIApi::createResponse([
|
||||||
|
// 'input' => [
|
||||||
|
// ['role' => 'system', 'content' => 'You are a helpful assistant.'],
|
||||||
|
// ['role' => 'user', 'content' => 'Tell me a bedtime story.'],
|
||||||
|
// ],
|
||||||
|
// ]);
|
||||||
|
// if (!empty($response['success'])) {
|
||||||
|
// $decoded = LocalAIApi::decodeJsonFromResponse($response);
|
||||||
|
// }
|
||||||
|
|
||||||
|
class LocalAIApi
|
||||||
|
{
|
||||||
|
/** @var array<string,mixed>|null */
|
||||||
|
private static ?array $configCache = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Signature compatible with the OpenAI Responses API.
|
||||||
|
*
|
||||||
|
* @param array<string,mixed> $params Request body (model, input, text, reasoning, metadata, etc.).
|
||||||
|
* @param array<string,mixed> $options Extra options (timeout, verify_tls, headers, path, project_uuid).
|
||||||
|
* @return array{
|
||||||
|
* success:bool,
|
||||||
|
* status?:int,
|
||||||
|
* data?:mixed,
|
||||||
|
* error?:string,
|
||||||
|
* response?:mixed,
|
||||||
|
* message?:string
|
||||||
|
* }
|
||||||
|
*/
|
||||||
|
public static function createResponse(array $params, array $options = []): array
|
||||||
|
{
|
||||||
|
$cfg = self::config();
|
||||||
|
$payload = $params;
|
||||||
|
|
||||||
|
if (empty($payload['input']) || !is_array($payload['input'])) {
|
||||||
|
return [
|
||||||
|
'success' => false,
|
||||||
|
'error' => 'input_missing',
|
||||||
|
'message' => 'Parameter "input" is required and must be an array.',
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!isset($payload['model']) || $payload['model'] === '') {
|
||||||
|
$payload['model'] = $cfg['default_model'];
|
||||||
|
}
|
||||||
|
|
||||||
|
return self::request($options['path'] ?? null, $payload, $options);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Snake_case alias for createResponse (matches the provided example).
|
||||||
|
*
|
||||||
|
* @param array<string,mixed> $params
|
||||||
|
* @param array<string,mixed> $options
|
||||||
|
* @return array<string,mixed>
|
||||||
|
*/
|
||||||
|
public static function create_response(array $params, array $options = []): array
|
||||||
|
{
|
||||||
|
return self::createResponse($params, $options);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Perform a raw request to the AI proxy.
|
||||||
|
*
|
||||||
|
* @param string $path Endpoint (may be an absolute URL).
|
||||||
|
* @param array<string,mixed> $payload JSON payload.
|
||||||
|
* @param array<string,mixed> $options Additional request options.
|
||||||
|
* @return array<string,mixed>
|
||||||
|
*/
|
||||||
|
public static function request(?string $path = null, array $payload = [], array $options = []): array
|
||||||
|
{
|
||||||
|
if (!function_exists('curl_init')) {
|
||||||
|
return [
|
||||||
|
'success' => false,
|
||||||
|
'error' => 'curl_missing',
|
||||||
|
'message' => 'PHP cURL extension is missing. Install or enable it on the VM.',
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
$cfg = self::config();
|
||||||
|
|
||||||
|
$projectUuid = $cfg['project_uuid'];
|
||||||
|
if (empty($projectUuid)) {
|
||||||
|
return [
|
||||||
|
'success' => false,
|
||||||
|
'error' => 'project_uuid_missing',
|
||||||
|
'message' => 'PROJECT_UUID is not defined; aborting AI request.',
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
$defaultPath = $cfg['responses_path'] ?? null;
|
||||||
|
$resolvedPath = $path ?? ($options['path'] ?? $defaultPath);
|
||||||
|
if (empty($resolvedPath)) {
|
||||||
|
return [
|
||||||
|
'success' => false,
|
||||||
|
'error' => 'project_id_missing',
|
||||||
|
'message' => 'PROJECT_ID is not defined; cannot resolve AI proxy endpoint.',
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
$url = self::buildUrl($resolvedPath, $cfg['base_url']);
|
||||||
|
$baseTimeout = isset($cfg['timeout']) ? (int) $cfg['timeout'] : 30;
|
||||||
|
$timeout = isset($options['timeout']) ? (int) $options['timeout'] : $baseTimeout;
|
||||||
|
if ($timeout <= 0) {
|
||||||
|
$timeout = 30;
|
||||||
|
}
|
||||||
|
|
||||||
|
$baseVerifyTls = array_key_exists('verify_tls', $cfg) ? (bool) $cfg['verify_tls'] : true;
|
||||||
|
$verifyTls = array_key_exists('verify_tls', $options)
|
||||||
|
? (bool) $options['verify_tls']
|
||||||
|
: $baseVerifyTls;
|
||||||
|
|
||||||
|
$projectHeader = $cfg['project_header'];
|
||||||
|
|
||||||
|
$headers = [
|
||||||
|
'Content-Type: application/json',
|
||||||
|
'Accept: application/json',
|
||||||
|
];
|
||||||
|
$headers[] = $projectHeader . ': ' . $projectUuid;
|
||||||
|
if (!empty($options['headers']) && is_array($options['headers'])) {
|
||||||
|
foreach ($options['headers'] as $header) {
|
||||||
|
if (is_string($header) && $header !== '') {
|
||||||
|
$headers[] = $header;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!empty($projectUuid) && !array_key_exists('project_uuid', $payload)) {
|
||||||
|
$payload['project_uuid'] = $projectUuid;
|
||||||
|
}
|
||||||
|
|
||||||
|
$body = json_encode($payload, JSON_UNESCAPED_UNICODE);
|
||||||
|
if ($body === false) {
|
||||||
|
return [
|
||||||
|
'success' => false,
|
||||||
|
'error' => 'json_encode_failed',
|
||||||
|
'message' => 'Failed to encode request body to JSON.',
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
$ch = curl_init($url);
|
||||||
|
curl_setopt($ch, CURLOPT_POST, true);
|
||||||
|
curl_setopt($ch, CURLOPT_POSTFIELDS, $body);
|
||||||
|
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
|
||||||
|
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
||||||
|
curl_setopt($ch, CURLOPT_TIMEOUT, $timeout);
|
||||||
|
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 5);
|
||||||
|
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, $verifyTls);
|
||||||
|
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, $verifyTls ? 2 : 0);
|
||||||
|
curl_setopt($ch, CURLOPT_FAILONERROR, false);
|
||||||
|
|
||||||
|
$responseBody = curl_exec($ch);
|
||||||
|
if ($responseBody === false) {
|
||||||
|
$error = curl_error($ch) ?: 'Unknown cURL error';
|
||||||
|
curl_close($ch);
|
||||||
|
return [
|
||||||
|
'success' => false,
|
||||||
|
'error' => 'curl_error',
|
||||||
|
'message' => $error,
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
$status = (int) curl_getinfo($ch, CURLINFO_HTTP_CODE);
|
||||||
|
curl_close($ch);
|
||||||
|
|
||||||
|
$decoded = null;
|
||||||
|
if ($responseBody !== '' && $responseBody !== null) {
|
||||||
|
$decoded = json_decode($responseBody, true);
|
||||||
|
if (json_last_error() !== JSON_ERROR_NONE) {
|
||||||
|
$decoded = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($status >= 200 && $status < 300) {
|
||||||
|
return [
|
||||||
|
'success' => true,
|
||||||
|
'status' => $status,
|
||||||
|
'data' => $decoded ?? $responseBody,
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
$errorMessage = 'AI proxy request failed';
|
||||||
|
if (is_array($decoded)) {
|
||||||
|
$errorMessage = $decoded['error'] ?? $decoded['message'] ?? $errorMessage;
|
||||||
|
} elseif (is_string($responseBody) && $responseBody !== '') {
|
||||||
|
$errorMessage = $responseBody;
|
||||||
|
}
|
||||||
|
|
||||||
|
return [
|
||||||
|
'success' => false,
|
||||||
|
'status' => $status,
|
||||||
|
'error' => $errorMessage,
|
||||||
|
'response' => $decoded ?? $responseBody,
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Extract plain text from a Responses API payload.
|
||||||
|
*
|
||||||
|
* @param array<string,mixed> $response Result of LocalAIApi::createResponse|request.
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public static function extractText(array $response): string
|
||||||
|
{
|
||||||
|
$payload = $response['data'] ?? $response;
|
||||||
|
if (!is_array($payload)) {
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!empty($payload['output']) && is_array($payload['output'])) {
|
||||||
|
$combined = '';
|
||||||
|
foreach ($payload['output'] as $item) {
|
||||||
|
if (!isset($item['content']) || !is_array($item['content'])) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
foreach ($item['content'] as $block) {
|
||||||
|
if (is_array($block) && ($block['type'] ?? '') === 'output_text' && !empty($block['text'])) {
|
||||||
|
$combined .= $block['text'];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if ($combined !== '') {
|
||||||
|
return $combined;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!empty($payload['choices'][0]['message']['content'])) {
|
||||||
|
return (string) $payload['choices'][0]['message']['content'];
|
||||||
|
}
|
||||||
|
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Attempt to decode JSON emitted by the model (handles markdown fences).
|
||||||
|
*
|
||||||
|
* @param array<string,mixed> $response
|
||||||
|
* @return array<string,mixed>|null
|
||||||
|
*/
|
||||||
|
public static function decodeJsonFromResponse(array $response): ?array
|
||||||
|
{
|
||||||
|
$text = self::extractText($response);
|
||||||
|
if ($text === '') {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
$decoded = json_decode($text, true);
|
||||||
|
if (is_array($decoded)) {
|
||||||
|
return $decoded;
|
||||||
|
}
|
||||||
|
|
||||||
|
$stripped = preg_replace('/^```json|```$/m', '', trim($text));
|
||||||
|
if ($stripped !== null && $stripped !== $text) {
|
||||||
|
$decoded = json_decode($stripped, true);
|
||||||
|
if (is_array($decoded)) {
|
||||||
|
return $decoded;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Load configuration from ai/config.php.
|
||||||
|
*
|
||||||
|
* @return array<string,mixed>
|
||||||
|
*/
|
||||||
|
private static function config(): array
|
||||||
|
{
|
||||||
|
if (self::$configCache === null) {
|
||||||
|
$configPath = __DIR__ . '/config.php';
|
||||||
|
if (!file_exists($configPath)) {
|
||||||
|
throw new RuntimeException('AI config file not found: ai/config.php');
|
||||||
|
}
|
||||||
|
$cfg = require $configPath;
|
||||||
|
if (!is_array($cfg)) {
|
||||||
|
throw new RuntimeException('Invalid AI config format: expected array');
|
||||||
|
}
|
||||||
|
self::$configCache = $cfg;
|
||||||
|
}
|
||||||
|
|
||||||
|
return self::$configCache;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Build an absolute URL from base_url and a path.
|
||||||
|
*/
|
||||||
|
private static function buildUrl(string $path, string $baseUrl): string
|
||||||
|
{
|
||||||
|
$trimmed = trim($path);
|
||||||
|
if ($trimmed === '') {
|
||||||
|
return $baseUrl;
|
||||||
|
}
|
||||||
|
if (str_starts_with($trimmed, 'http://') || str_starts_with($trimmed, 'https://')) {
|
||||||
|
return $trimmed;
|
||||||
|
}
|
||||||
|
if ($trimmed[0] === '/') {
|
||||||
|
return $baseUrl . $trimmed;
|
||||||
|
}
|
||||||
|
return $baseUrl . '/' . $trimmed;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Legacy alias for backward compatibility with the previous class name.
|
||||||
|
if (!class_exists('OpenAIService')) {
|
||||||
|
class_alias(LocalAIApi::class, 'OpenAIService');
|
||||||
|
}
|
||||||
52
ai/config.php
Normal file
52
ai/config.php
Normal file
@ -0,0 +1,52 @@
|
|||||||
|
<?php
|
||||||
|
// OpenAI proxy configuration (workspace scope).
|
||||||
|
// Reads values from environment variables or executor/.env.
|
||||||
|
|
||||||
|
$projectUuid = getenv('PROJECT_UUID');
|
||||||
|
$projectId = getenv('PROJECT_ID');
|
||||||
|
|
||||||
|
if (
|
||||||
|
($projectUuid === false || $projectUuid === null || $projectUuid === '') ||
|
||||||
|
($projectId === false || $projectId === null || $projectId === '')
|
||||||
|
) {
|
||||||
|
$envPath = realpath(__DIR__ . '/../../.env'); // executor/.env
|
||||||
|
if ($envPath && is_readable($envPath)) {
|
||||||
|
$lines = @file($envPath, FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES) ?: [];
|
||||||
|
foreach ($lines as $line) {
|
||||||
|
$line = trim($line);
|
||||||
|
if ($line === '' || $line[0] === '#') {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (!str_contains($line, '=')) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
[$key, $value] = array_map('trim', explode('=', $line, 2));
|
||||||
|
if ($key === '') {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
$value = trim($value, "\"' ");
|
||||||
|
if (getenv($key) === false || getenv($key) === '') {
|
||||||
|
putenv("{$key}={$value}");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$projectUuid = getenv('PROJECT_UUID');
|
||||||
|
$projectId = getenv('PROJECT_ID');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$projectUuid = ($projectUuid === false) ? null : $projectUuid;
|
||||||
|
$projectId = ($projectId === false) ? null : $projectId;
|
||||||
|
|
||||||
|
$baseUrl = 'https://flatlogic.com';
|
||||||
|
$responsesPath = $projectId ? "/projects/{$projectId}/ai-request" : null;
|
||||||
|
|
||||||
|
return [
|
||||||
|
'base_url' => $baseUrl,
|
||||||
|
'responses_path' => $responsesPath,
|
||||||
|
'project_id' => $projectId,
|
||||||
|
'project_uuid' => $projectUuid,
|
||||||
|
'project_header' => 'project-uuid',
|
||||||
|
'default_model' => 'gpt-5',
|
||||||
|
'timeout' => 30,
|
||||||
|
'verify_tls' => true,
|
||||||
|
];
|
||||||
154
assets/css/custom.css
Normal file
154
assets/css/custom.css
Normal file
@ -0,0 +1,154 @@
|
|||||||
|
/* General Body Styles */
|
||||||
|
body {
|
||||||
|
font-family: 'Lato', sans-serif;
|
||||||
|
color: #212529;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Typography */
|
||||||
|
h1, h2, h3, h4, h5, h6 {
|
||||||
|
font-family: 'Montserrat', sans-serif;
|
||||||
|
font-weight: 700;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Header */
|
||||||
|
.navbar {
|
||||||
|
box-shadow: 0 2px 4px rgba(0,0,0,.05);
|
||||||
|
}
|
||||||
|
|
||||||
|
.navbar-brand {
|
||||||
|
font-weight: 700;
|
||||||
|
color: #004A7F !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Hero Section */
|
||||||
|
.hero-section {
|
||||||
|
background-color: #F8F9FA;
|
||||||
|
padding: 6rem 0;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.hero-section h1 {
|
||||||
|
font-size: 3rem;
|
||||||
|
color: #004A7F;
|
||||||
|
}
|
||||||
|
|
||||||
|
.hero-section .lead {
|
||||||
|
font-size: 1.25rem;
|
||||||
|
color: #6c757d;
|
||||||
|
margin-bottom: 2rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Buttons */
|
||||||
|
.btn-primary {
|
||||||
|
background-color: #004A7F;
|
||||||
|
border-color: #004A7F;
|
||||||
|
padding: 0.75rem 1.5rem;
|
||||||
|
border-radius: 0.5rem;
|
||||||
|
font-weight: 600;
|
||||||
|
text-transform: uppercase;
|
||||||
|
letter-spacing: 0.05em;
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn-primary:hover {
|
||||||
|
background-color: #003359;
|
||||||
|
border-color: #003359;
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn-secondary {
|
||||||
|
background-color: #FDB813;
|
||||||
|
border-color: #FDB813;
|
||||||
|
color: #212529;
|
||||||
|
padding: 0.75rem 1.5rem;
|
||||||
|
border-radius: 0.5rem;
|
||||||
|
font-weight: 600;
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn-secondary:hover {
|
||||||
|
background-color: #e0a000;
|
||||||
|
border-color: #e0a000;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* Product Grid */
|
||||||
|
.product-grid {
|
||||||
|
padding: 4rem 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.product-grid h2 {
|
||||||
|
text-align: center;
|
||||||
|
margin-bottom: 3rem;
|
||||||
|
color: #004A7F;
|
||||||
|
}
|
||||||
|
|
||||||
|
.product-card {
|
||||||
|
border: 1px solid #dee2e6;
|
||||||
|
border-radius: 0.25rem;
|
||||||
|
transition: box-shadow 0.3s ease, transform 0.3s ease;
|
||||||
|
background-color: #fff;
|
||||||
|
}
|
||||||
|
|
||||||
|
.product-card:hover {
|
||||||
|
transform: translateY(-5px);
|
||||||
|
box-shadow: 0 4px 15px rgba(0,0,0,.1);
|
||||||
|
}
|
||||||
|
|
||||||
|
.product-card .card-img-top {
|
||||||
|
border-bottom: 1px solid #dee2e6;
|
||||||
|
aspect-ratio: 4 / 3;
|
||||||
|
object-fit: cover;
|
||||||
|
}
|
||||||
|
|
||||||
|
.product-card .card-body {
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.product-card .card-title {
|
||||||
|
font-size: 1.1rem;
|
||||||
|
color: #343a40;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Footer */
|
||||||
|
.footer {
|
||||||
|
background-color: #004A7F;
|
||||||
|
color: white;
|
||||||
|
padding: 3rem 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.footer a {
|
||||||
|
color: #FDB813;
|
||||||
|
}
|
||||||
|
|
||||||
|
.footer a:hover {
|
||||||
|
color: #fff;
|
||||||
|
text-decoration: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.footer .social-icons a {
|
||||||
|
font-size: 1.5rem;
|
||||||
|
margin: 0 0.5rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Product Page - Color Swatches */
|
||||||
|
.color-swatches .swatch {
|
||||||
|
display: inline-block;
|
||||||
|
width: 32px;
|
||||||
|
height: 32px;
|
||||||
|
border-radius: 50%;
|
||||||
|
margin: 0 8px 8px 0;
|
||||||
|
cursor: pointer;
|
||||||
|
border: 2px solid #dee2e6;
|
||||||
|
transition: all 0.2s ease-in-out;
|
||||||
|
background-size: cover;
|
||||||
|
background-position: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.color-swatches .swatch:hover {
|
||||||
|
transform: scale(1.1);
|
||||||
|
border-color: #6c757d;
|
||||||
|
}
|
||||||
|
|
||||||
|
.color-swatches .swatch.active {
|
||||||
|
border-color: #004A7F;
|
||||||
|
transform: scale(1.1);
|
||||||
|
box-shadow: 0 0 8px rgba(0, 74, 127, 0.5);
|
||||||
|
}
|
||||||
16
assets/js/main.js
Normal file
16
assets/js/main.js
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
// Future JavaScript for interactivity
|
||||||
|
|
||||||
|
document.addEventListener('DOMContentLoaded', function() {
|
||||||
|
console.log('DOM fully loaded and parsed');
|
||||||
|
|
||||||
|
// Color swatch interactivity
|
||||||
|
const swatches = document.querySelectorAll('.color-swatches .swatch');
|
||||||
|
swatches.forEach(swatch => {
|
||||||
|
swatch.addEventListener('click', function() {
|
||||||
|
// Remove active class from all swatches
|
||||||
|
swatches.forEach(s => s.classList.remove('active'));
|
||||||
|
// Add active class to the clicked swatch
|
||||||
|
this.classList.add('active');
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
@ -1,17 +1,42 @@
|
|||||||
<?php
|
<?php
|
||||||
// Generated by setup_mariadb_project.sh — edit as needed.
|
// db/config.php
|
||||||
define('DB_HOST', '127.0.0.1');
|
|
||||||
define('DB_NAME', 'app_31009');
|
|
||||||
define('DB_USER', 'app_31009');
|
|
||||||
define('DB_PASS', '2c66b530-2a65-423a-a106-6760b49ad1a2');
|
|
||||||
|
|
||||||
function db() {
|
// --- Database Credentials ---
|
||||||
static $pdo;
|
// --> IMPORTANT: Replace with your actual database credentials
|
||||||
if (!$pdo) {
|
define('DB_HOST', getenv('DB_HOST') ?: '127.0.0.1');
|
||||||
$pdo = new PDO('mysql:host='.DB_HOST.';dbname='.DB_NAME.';charset=utf8mb4', DB_USER, DB_PASS, [
|
define('DB_PORT', getenv('DB_PORT') ?: 3306);
|
||||||
|
define('DB_NAME', getenv('DB_NAME') ?: 'localdb');
|
||||||
|
define('DB_USER', getenv('DB_USER') ?: 'user');
|
||||||
|
define('DB_PASS', getenv('DB_PASS') ?: 'password');
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Establishes a PDO database connection.
|
||||||
|
*
|
||||||
|
* @return PDO|null A PDO connection object on success, or null on failure.
|
||||||
|
*/
|
||||||
|
function db_connect() {
|
||||||
|
static $pdo = null;
|
||||||
|
|
||||||
|
if ($pdo !== null) {
|
||||||
|
return $pdo;
|
||||||
|
}
|
||||||
|
|
||||||
|
$dsn = 'mysql:host=' . DB_HOST . ';port=' . DB_PORT . ';dbname=' . DB_NAME . ';charset=utf8mb4';
|
||||||
|
$options = [
|
||||||
PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION,
|
PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION,
|
||||||
PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_ASSOC,
|
PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_ASSOC,
|
||||||
]);
|
PDO::ATTR_EMULATE_PREPARES => false,
|
||||||
}
|
];
|
||||||
|
|
||||||
|
try {
|
||||||
|
$pdo = new PDO($dsn, DB_USER, DB_PASS, $options);
|
||||||
return $pdo;
|
return $pdo;
|
||||||
|
} catch (PDOException $e) {
|
||||||
|
// In a real application, you would log this error and show a generic message.
|
||||||
|
// For development, it's useful to see the error.
|
||||||
|
error_log('Database Connection Error: ' . $e->getMessage());
|
||||||
|
// Never show detailed errors in production
|
||||||
|
// die('Database connection failed. Please check configuration.');
|
||||||
|
return null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
47
db/migrate.php
Normal file
47
db/migrate.php
Normal file
@ -0,0 +1,47 @@
|
|||||||
|
<?php
|
||||||
|
// db/migrate.php
|
||||||
|
|
||||||
|
require_once __DIR__ . '/config.php';
|
||||||
|
|
||||||
|
header('Content-Type: text/plain');
|
||||||
|
|
||||||
|
echo "Running database migrations...\n\n";
|
||||||
|
|
||||||
|
$pdo = db_connect();
|
||||||
|
|
||||||
|
if (!$pdo) {
|
||||||
|
echo "[ERROR] Could not connect to the database. Please check db/config.php and environment variables.\n";
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
echo "Connection successful.\n";
|
||||||
|
|
||||||
|
$statements = [
|
||||||
|
'CREATE TABLE IF NOT EXISTS products (
|
||||||
|
id INT AUTO_INCREMENT PRIMARY KEY,
|
||||||
|
name VARCHAR(255) NOT NULL,
|
||||||
|
sku VARCHAR(100) UNIQUE,
|
||||||
|
description TEXT,
|
||||||
|
long_description TEXT,
|
||||||
|
technical_details TEXT,
|
||||||
|
price DECIMAL(10, 2) NOT NULL DEFAULT 0.00,
|
||||||
|
stock_quantity INT NOT NULL DEFAULT 0,
|
||||||
|
image_url VARCHAR(255),
|
||||||
|
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
||||||
|
updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
|
||||||
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;'
|
||||||
|
];
|
||||||
|
|
||||||
|
// Execute statements
|
||||||
|
foreach ($statements as $statement) {
|
||||||
|
try {
|
||||||
|
$pdo->exec($statement);
|
||||||
|
echo "[SUCCESS] Executed: " . substr($statement, 0, 80) . "...\n";
|
||||||
|
} catch (PDOException $e) {
|
||||||
|
echo "[ERROR] Failed to execute statement. \nError: " . $e->getMessage() . "\n";
|
||||||
|
echo "Statement: \n" . $statement . "\n";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
echo "\nMigration script finished.\n";
|
||||||
|
|
||||||
36
db/migrate_users.php
Normal file
36
db/migrate_users.php
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
<?php
|
||||||
|
require_once 'config.php';
|
||||||
|
|
||||||
|
try {
|
||||||
|
$pdo = db();
|
||||||
|
|
||||||
|
// Cria a tabela de usuários
|
||||||
|
$pdo->exec("CREATE TABLE IF NOT EXISTS users (
|
||||||
|
id INT AUTO_INCREMENT PRIMARY KEY,
|
||||||
|
username VARCHAR(50) NOT NULL UNIQUE,
|
||||||
|
password VARCHAR(255) NOT NULL,
|
||||||
|
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
|
||||||
|
);");
|
||||||
|
|
||||||
|
echo "Tabela 'users' criada com sucesso ou já existente.<br>";
|
||||||
|
|
||||||
|
// Verifica se o usuário admin já existe
|
||||||
|
$stmt = $pdo->prepare("SELECT * FROM users WHERE username = ?");
|
||||||
|
$stmt->execute(['admin']);
|
||||||
|
if ($stmt->fetch()) {
|
||||||
|
echo "Usuário 'admin' já existe.<br>";
|
||||||
|
} else {
|
||||||
|
// Cria o usuário admin padrão
|
||||||
|
$username = 'admin';
|
||||||
|
$password = 'admin'; // Senha padrão
|
||||||
|
$hashed_password = password_hash($password, PASSWORD_DEFAULT);
|
||||||
|
|
||||||
|
$stmt = $pdo->prepare("INSERT INTO users (username, password) VALUES (?, ?)");
|
||||||
|
$stmt->execute([$username, $hashed_password]);
|
||||||
|
echo "Usuário 'admin' criado com sucesso com a senha padrão 'admin'.<br>";
|
||||||
|
}
|
||||||
|
|
||||||
|
} catch (PDOException $e) {
|
||||||
|
die("Erro na migração do banco de dados: " . $e->getMessage());
|
||||||
|
}
|
||||||
|
?>
|
||||||
250
index.php
250
index.php
@ -1,150 +1,122 @@
|
|||||||
<?php
|
<!DOCTYPE html>
|
||||||
declare(strict_types=1);
|
<html lang="pt-BR">
|
||||||
@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">
|
|
||||||
<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>MECoding Studio - Catálogo de Produtos</title>
|
||||||
<?php
|
<meta name="description" content="Catálogo de produtos de expositores e estantarias. Built with Flatlogic Generator.">
|
||||||
// Read project preview data from environment
|
<meta name="keywords" content="expositores, estantarias, móveis comerciais, design de loja, varejo, display de produtos, gôndolas, prateleiras, Built with Flatlogic Generator">
|
||||||
$projectDescription = $_SERVER['PROJECT_DESCRIPTION'] ?? '';
|
<meta property="og:title" content="MECoding Studio - Catálogo de Produtos">
|
||||||
$projectImageUrl = $_SERVER['PROJECT_IMAGE_URL'] ?? '';
|
<meta property="og:description" content="Catálogo de produtos de expositores e estantarias. Built with Flatlogic Generator.">
|
||||||
?>
|
<meta property="og:image" content="">
|
||||||
<?php if ($projectDescription): ?>
|
<meta name="twitter:card" content="summary_large_image">
|
||||||
<!-- Meta description -->
|
<meta name="twitter:image" content="">
|
||||||
<meta name="description" content='<?= htmlspecialchars($projectDescription) ?>' />
|
|
||||||
<!-- Open Graph meta tags -->
|
<!-- Bootstrap CSS -->
|
||||||
<meta property="og:description" content="<?= htmlspecialchars($projectDescription) ?>" />
|
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.min.css" rel="stylesheet">
|
||||||
<!-- Twitter meta tags -->
|
|
||||||
<meta property="twitter:description" content="<?= htmlspecialchars($projectDescription) ?>" />
|
<!-- Google Fonts -->
|
||||||
<?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.googleapis.com">
|
||||||
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
<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">
|
<link href="https://fonts.googleapis.com/css2?family=Lato:wght@400;700&family=Montserrat:wght@700&display=swap" rel="stylesheet">
|
||||||
<style>
|
|
||||||
:root {
|
<!-- Custom CSS -->
|
||||||
--bg-color-start: #6a11cb;
|
<link rel="stylesheet" href="assets/css/custom.css?v=<?php echo time(); ?>">
|
||||||
--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">
|
<!-- Header -->
|
||||||
<h1>Analyzing your requirements and generating your website…</h1>
|
<header class="navbar navbar-expand-lg navbar-light bg-white shadow-sm">
|
||||||
<div class="loader" role="status" aria-live="polite" aria-label="Applying initial changes">
|
<div class="container">
|
||||||
<span class="sr-only">Loading…</span>
|
<a class="navbar-brand" href="#">MECoding Studio</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="#">Home</a></li>
|
||||||
|
<li class="nav-item"><a class="nav-link" href="#">Produtos</a></li>
|
||||||
|
<li class="nav-item"><a class="nav-link" href="#">Sobre</a></li>
|
||||||
|
<li class="nav-item"><a class="nav-link" href="#">Contato</a></li>
|
||||||
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
<p class="hint"><?= ($_SERVER['HTTP_HOST'] ?? '') === 'appwizzy.com' ? 'AppWizzy' : 'Flatlogic' ?> AI is collecting your requirements and applying the first changes.</p>
|
</div>
|
||||||
<p class="hint">This page will update automatically as the plan is implemented.</p>
|
</header>
|
||||||
<p>Runtime: PHP <code><?= htmlspecialchars($phpVersion) ?></code> — UTC <code><?= htmlspecialchars($now) ?></code></p>
|
|
||||||
|
<!-- Hero Section -->
|
||||||
|
<section class="hero-section">
|
||||||
|
<div class="container">
|
||||||
|
<h1>Soluções Inovadoras em Expositores</h1>
|
||||||
|
<p>Design e funcionalidade para valorizar seus produtos e impulsionar suas vendas.</p>
|
||||||
|
<a href="#" class="btn btn-primary btn-lg">Conheça Nossos Produtos</a>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
|
||||||
|
<!-- Products Section -->
|
||||||
|
<main class="container products-section">
|
||||||
|
<h2 class="text-center mb-5">Produtos em Destaque</h2>
|
||||||
|
<div class="row g-4">
|
||||||
|
<?php
|
||||||
|
$products = [
|
||||||
|
[
|
||||||
|
'title' => 'Estante Modular ',
|
||||||
|
'image' => 'https://images.pexels.com/photos/5705080/pexels-photo-5705080.jpeg?auto=compress&cs=tinysrgb&w=1260&h=750&dpr=1'
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'title' => 'Display de Balcão',
|
||||||
|
'image' => 'https://images.pexels.com/photos/1148820/pexels-photo-1148820.jpeg?auto=compress&cs=tinysrgb&w=1260&h=750&dpr=1'
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'title' => 'Gôndola Central',
|
||||||
|
'image' => 'https://images.pexels.com/photos/271816/pexels-photo-271816.jpeg?auto=compress&cs=tinysrgb&w=1260&h=750&dpr=1'
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'title' => 'Estante de Parede',
|
||||||
|
'image' => 'https://images.pexels.com/photos/2089698/pexels-photo-2089698.jpeg?auto=compress&cs=tinysrgb&w=1260&h=750&dpr=1'
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'title' => 'Mesa de Centro',
|
||||||
|
'image' => 'https://images.pexels.com/photos/37347/office-sitting-room-executive-sitting.jpg?auto=compress&cs=tinysrgb&w=1260&h=750&dpr=1'
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'title' => 'Estante de Livros',
|
||||||
|
'image' => 'https://images.pexels.com/photos/159844/cellular-education-classroom-159844.jpeg?auto=compress&cs=tinysrgb&w=1260&h=750&dpr=1'
|
||||||
|
]
|
||||||
|
];
|
||||||
|
|
||||||
|
$is_first = true;
|
||||||
|
foreach ($products as $product) {
|
||||||
|
$link = $is_first ? 'product.php' : '#';
|
||||||
|
echo '
|
||||||
|
<div class="col-md-6 col-lg-4">
|
||||||
|
<div class="card product-card">
|
||||||
|
<img src="' . htmlspecialchars($product['image']) . '" class="card-img-top" alt="' . htmlspecialchars($product['title']) . '">
|
||||||
|
<div class="card-body">
|
||||||
|
<h5 class="card-title">' . htmlspecialchars($product['title']) . '</h5>
|
||||||
|
<a href="' . $link . '" class="btn btn-secondary">Ver Detalhes</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>';
|
||||||
|
$is_first = false;
|
||||||
|
}
|
||||||
|
?>
|
||||||
</div>
|
</div>
|
||||||
</main>
|
</main>
|
||||||
<footer>
|
|
||||||
Page updated: <?= htmlspecialchars($now) ?> (UTC)
|
<!-- Footer -->
|
||||||
|
<footer class="footer">
|
||||||
|
<div class="container text-center">
|
||||||
|
<p>© <?php echo date("Y"); ?> MECoding Studio. Todos os direitos reservados.</p>
|
||||||
|
<p>
|
||||||
|
<a href="#">Termos de Serviço</a> |
|
||||||
|
<a href="#">Política de Privacidade</a>
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
</footer>
|
</footer>
|
||||||
|
|
||||||
|
<!-- Bootstrap JS -->
|
||||||
|
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/js/bootstrap.bundle.min.js"></script>
|
||||||
|
<!-- Custom JS -->
|
||||||
|
<script src="assets/js/main.js?v=<?php echo time(); ?>"></script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
184
product.php
Normal file
184
product.php
Normal file
@ -0,0 +1,184 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="pt-BR">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
<title>Detalhes do Produto - MECoding Studio</title>
|
||||||
|
<meta name="description" content="Detalhes do produto Estante Modular Flex-1000.">
|
||||||
|
<meta property="og:title" content="Detalhes do Produto - MECoding Studio">
|
||||||
|
<meta property="og:description" content="Detalhes do produto Estante Modular Flex-1000.">
|
||||||
|
<meta property="og:image" content="">
|
||||||
|
<meta name="twitter:card" content="summary_large_image">
|
||||||
|
<meta name="twitter:image" content="">
|
||||||
|
|
||||||
|
<!-- Bootstrap CSS -->
|
||||||
|
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.min.css" rel="stylesheet">
|
||||||
|
|
||||||
|
<!-- Google Fonts -->
|
||||||
|
<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=Lato:wght@400;700&family=Montserrat:wght@700&display=swap" rel="stylesheet">
|
||||||
|
|
||||||
|
<!-- Custom CSS -->
|
||||||
|
<link rel="stylesheet" href="assets/css/custom.css?v=<?php echo time(); ?>">
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
|
||||||
|
<!-- Header -->
|
||||||
|
<header class="navbar navbar-expand-lg navbar-light bg-white shadow-sm">
|
||||||
|
<div class="container">
|
||||||
|
<a class="navbar-brand" href="index.php">MECoding Studio</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="#">Produtos</a></li>
|
||||||
|
<li class="nav-item"><a class="nav-link" href="#">Sobre</a></li>
|
||||||
|
<li class="nav-item"><a class="nav-link" href="#">Contato</a></li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</header>
|
||||||
|
|
||||||
|
<!-- Product Details Section -->
|
||||||
|
<main class="container my-5">
|
||||||
|
<nav aria-label="breadcrumb">
|
||||||
|
<ol class="breadcrumb">
|
||||||
|
<li class="breadcrumb-item"><a href="index.php">Home</a></li>
|
||||||
|
<li class="breadcrumb-item"><a href="#">Produtos</a></li>
|
||||||
|
<li class="breadcrumb-item active" aria-current="page">Estante Modular Flex-1000</li>
|
||||||
|
</ol>
|
||||||
|
</nav>
|
||||||
|
|
||||||
|
<div class="row g-5">
|
||||||
|
<!-- Product Gallery -->
|
||||||
|
<div class="col-lg-6">
|
||||||
|
<div class="mb-3">
|
||||||
|
<img src="https://images.pexels.com/photos/5705080/pexels-photo-5705080.jpeg?auto=compress&cs=tinysrgb&w=1260&h=750&dpr=1" class="img-fluid rounded shadow-sm" alt="Estante Modular - Vista Principal" id="main-product-image">
|
||||||
|
</div>
|
||||||
|
<div class="d-flex">
|
||||||
|
<img src="https://images.pexels.com/photos/5705080/pexels-photo-5705080.jpeg?auto=compress&cs=tinysrgb&w=1260&h=750&dpr=1" class="img-thumbnail me-2" style="width: 80px; cursor: pointer;" onclick="document.getElementById('main-product-image').src=this.src">
|
||||||
|
<img src="https://images.pexels.com/photos/1148820/pexels-photo-1148820.jpeg?auto=compress&cs=tinysrgb&w=1260&h=750&dpr=1" class="img-thumbnail me-2" style="width: 80px; cursor: pointer;" onclick="document.getElementById('main-product-image').src=this.src">
|
||||||
|
<img src="https://images.pexels.com/photos/271816/pexels-photo-271816.jpeg?auto=compress&cs=tinysrgb&w=1260&h=750&dpr=1" class="img-thumbnail" style="width: 80px; cursor: pointer;" onclick="document.getElementById('main-product-image').src=this.src">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Product Info -->
|
||||||
|
<div class="col-lg-6">
|
||||||
|
<h2>Estante Modular Flex-1000</h2>
|
||||||
|
<p class="text-muted">SKU: EM-FLX-1000</p>
|
||||||
|
<p class="lead">Uma solução versátil e robusta para otimizar seu espaço comercial com elegância e praticidade.</p>
|
||||||
|
|
||||||
|
<div class="mb-4">
|
||||||
|
<h5>Cor/Acabamento</h5>
|
||||||
|
<div class="color-swatches">
|
||||||
|
<span class="swatch active" style="background-color: #FFFFFF; border: 1px solid #dee2e6;" data-color="Branco" title="Branco"></span>
|
||||||
|
<span class="swatch" style="background-color: #212529;" data-color="Preto" title="Preto"></span>
|
||||||
|
<span class="swatch" style="background-image: url('assets/images/textures/wood.jpg');" data-color="Madeira" title="Madeira"></span>
|
||||||
|
</div>
|
||||||
|
<small class="form-text text-muted">Nota: Para a cor "Madeira", adicione uma imagem em `assets/images/textures/wood.jpg`</small>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="mb-4">
|
||||||
|
<h5>Dimensões (cm)</h5>
|
||||||
|
<div class="row">
|
||||||
|
<div class="col">
|
||||||
|
<label for="width" class="form-label">Largura</label>
|
||||||
|
<input type="number" class="form-control" id="width" value="100">
|
||||||
|
</div>
|
||||||
|
<div class="col">
|
||||||
|
<label for="height" class="form-label">Altura</label>
|
||||||
|
<input type="number" class="form-control" id="height" value="220">
|
||||||
|
</div>
|
||||||
|
<div class="col">
|
||||||
|
<label for="depth" class="form-label">Profundidade</label>
|
||||||
|
<input type="number" class="form-control" id="depth" value="40">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<button class="btn btn-primary btn-lg w-100">Solicitar Orçamento</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Product Details Tabs -->
|
||||||
|
<div class="mt-5">
|
||||||
|
<ul class="nav nav-tabs" id="product-tabs" role="tablist">
|
||||||
|
<li class="nav-item" role="presentation">
|
||||||
|
<button class="nav-link active" id="desc-tab" data-bs-toggle="tab" data-bs-target="#desc" type="button" role="tab" aria-controls="desc" aria-selected="true">Descrição Completa</button>
|
||||||
|
</li>
|
||||||
|
<li class="nav-item" role="presentation">
|
||||||
|
<button class="nav-link" id="spec-tab" data-bs-toggle="tab" data-bs-target="#spec" type="button" role="tab" aria-controls="spec" aria-selected="false">Detalhes Técnicos</button>
|
||||||
|
</li>
|
||||||
|
<li class="nav-item" role="presentation">
|
||||||
|
<button class="nav-link" id="docs-tab" data-bs-toggle="tab" data-bs-target="#docs" type="button" role="tab" aria-controls="docs" aria-selected="false">Downloads</button>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
<div class="tab-content p-4 border border-top-0 rounded-bottom" id="product-tabs-content">
|
||||||
|
<div class="tab-pane fade show active" id="desc" role="tabpanel" aria-labelledby="desc-tab">
|
||||||
|
<p>A Estante Modular Flex-1000 é a escolha ideal para quem busca flexibilidade e design moderno. Construída com materiais de alta durabilidade, ela se adapta a diferentes layouts de loja, desde boutiques a grandes magazines. As prateleiras ajustáveis permitem a exposição de uma vasta gama de produtos, enquanto o acabamento refinado valoriza o ambiente e a apresentação dos itens.</p>
|
||||||
|
<ul>
|
||||||
|
<li>Estrutura em aço com pintura eletrostática.</li>
|
||||||
|
<li>Prateleiras em MDF com altura regulável.</li>
|
||||||
|
<li>Montagem simples e rápida.</li>
|
||||||
|
<li>Pés niveladores para maior estabilidade.</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
<div class="tab-pane fade" id="spec" role="tabpanel" aria-labelledby="spec-tab">
|
||||||
|
<table class="table table-striped">
|
||||||
|
<tbody>
|
||||||
|
<tr>
|
||||||
|
<th>Material da Estrutura</th>
|
||||||
|
<td>Aço Carbono</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th>Material das Prateleiras</th>
|
||||||
|
<td>MDF 18mm</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th>Capacidade de Carga por Prateleira</th>
|
||||||
|
<td>35kg</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th>Peso Total</th>
|
||||||
|
<td>45kg</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th>Garantia</th>
|
||||||
|
<td>2 anos</td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
<div class="tab-pane fade" id="docs" role="tabpanel" aria-labelledby="docs-tab">
|
||||||
|
<p>Faça o download dos materiais de apoio para mais informações.</p>
|
||||||
|
<ul class="list-unstyled">
|
||||||
|
<li><a href="#" class="text-decoration-none">Ficha Técnica - Estante Flex-1000.pdf</a></li>
|
||||||
|
<li><a href="#" class="text-decoration-none">Manual de Montagem.pdf</a></li>
|
||||||
|
<li><a href="#" class="text-decoration-none">Catálogo Completo de Acessórios.pdf</a></li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</main>
|
||||||
|
|
||||||
|
<!-- Footer -->
|
||||||
|
<footer class="footer">
|
||||||
|
<div class="container text-center">
|
||||||
|
<p>© <?php echo date("Y"); ?> MECoding Studio. Todos os direitos reservados.</p>
|
||||||
|
<p>
|
||||||
|
<a href="#">Termos de Serviço</a> |
|
||||||
|
<a href="#">Política de Privacidade</a>
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
</footer>
|
||||||
|
|
||||||
|
<!-- Bootstrap JS -->
|
||||||
|
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/js/bootstrap.bundle.min.js"></script>
|
||||||
|
<!-- Custom JS -->
|
||||||
|
<script src="assets/js/main.js?v=<?php echo time(); ?>"></script>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
Loading…
x
Reference in New Issue
Block a user