versao 4 aprimorada
This commit is contained in:
parent
0e6b109372
commit
74e6e52559
@ -12,7 +12,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
||||
$breaker_output = trim($_POST['breaker_output'] ?? null);
|
||||
|
||||
if (empty($client_name) || empty($address) || empty($technician_name)) {
|
||||
$_SESSION['message'] = 'Please fill all required fields.';
|
||||
$_SESSION['message'] = 'Por favor, preencha todos os campos obrigatórios.';
|
||||
$_SESSION['message_type'] = 'danger';
|
||||
header('Location: index.php');
|
||||
exit;
|
||||
@ -51,17 +51,17 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
||||
$img_stmt = $pdo->prepare("INSERT INTO installation_images (installation_id, image_path) VALUES (?, ?)");
|
||||
$img_stmt->execute([$installation_id, $image_path]);
|
||||
} else {
|
||||
throw new Exception('Failed to move uploaded file: ' . $file_name);
|
||||
throw new Exception('Falha ao mover o arquivo enviado: ' . $file_name);
|
||||
}
|
||||
} else {
|
||||
throw new Exception('Invalid file type: ' . $file_name);
|
||||
throw new Exception('Tipo de arquivo inválido: ' . $file_name);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$pdo->commit();
|
||||
$_SESSION['message'] = 'Installation registered successfully!';
|
||||
$_SESSION['message'] = 'Instalação registrada com sucesso!';
|
||||
$_SESSION['message_type'] = 'success';
|
||||
|
||||
} catch (Exception $e) {
|
||||
@ -69,7 +69,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
||||
$pdo->rollBack();
|
||||
}
|
||||
error_log("Upload/Database error: " . $e->getMessage());
|
||||
$_SESSION['message'] = 'Failed to register installation: ' . $e->getMessage();
|
||||
$_SESSION['message'] = 'Falha ao registrar a instalação: ' . $e->getMessage();
|
||||
$_SESSION['message_type'] = 'danger';
|
||||
}
|
||||
}
|
||||
|
||||
88
index.php
88
index.php
@ -13,7 +13,7 @@ try {
|
||||
} catch (Exception $e) {
|
||||
$installations = [];
|
||||
$total_installations = 0;
|
||||
$db_error = "Database connection failed or table not found. Please run the migration.";
|
||||
$db_error = "Falha na conexão com o banco de dados ou tabela não encontrada. Por favor, execute a migração.";
|
||||
}
|
||||
?>
|
||||
<!DOCTYPE html>
|
||||
@ -21,11 +21,11 @@ try {
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>ILOADNET SOLUTIONS - Dashboard</title>
|
||||
<meta name="description" content="Dashboard para gerenciamento de instalações de carregadores de veículos elétricos.">
|
||||
<title>ILOADNET SOLUTIONS - Painel de Controle</title>
|
||||
<meta name="description" content="Painel para gerenciamento de instalações de carregadores de veículos elétricos.">
|
||||
<meta name="keywords" content="EV charger, installation management, maintenance log, ILOADNET, dashboard, electric vehicle, fleet management, charge point operator, Built with Flatlogic Generator">
|
||||
<meta property="og:title" content="ILOADNET SOLUTIONS">
|
||||
<meta property="og:description" content="Dashboard para gerenciamento de instalações de carregadores de veículos elétricos.">
|
||||
<meta property="og:description" content="Painel para gerenciamento de instalações de carregadores de veículos elétricos.">
|
||||
<meta property="og:image" content="<?php echo $_SERVER['PROJECT_IMAGE_URL']; ?>">
|
||||
<meta name="twitter:card" content="summary_large_image">
|
||||
<meta name="twitter:image" content="<?php echo $_SERVER['PROJECT_IMAGE_URL']; ?>">
|
||||
@ -41,22 +41,22 @@ try {
|
||||
<ul class="nav flex-column">
|
||||
<li class="nav-item">
|
||||
<a class="nav-link active" href="#">
|
||||
<i class="bi bi-grid-1x2-fill"></i> Dashboard
|
||||
<i class="bi bi-grid-1x2-fill"></i> Painel de Controle
|
||||
</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="#">
|
||||
<i class="bi bi-ev-station-fill"></i> Installations
|
||||
<i class="bi bi-ev-station-fill"></i> Instalações
|
||||
</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="#">
|
||||
<i class="bi bi-people-fill"></i> Users
|
||||
<i class="bi bi-people-fill"></i> Usuários
|
||||
</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="#">
|
||||
<i class="bi bi-gear-fill"></i> Settings
|
||||
<i class="bi bi-gear-fill"></i> Configurações
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
@ -66,16 +66,16 @@ try {
|
||||
<nav class="top-navbar navbar navbar-expand">
|
||||
<div class="container-fluid">
|
||||
<form class="d-flex me-auto" role="search">
|
||||
<input class="form-control me-2" type="search" placeholder="Search for..." aria-label="Search">
|
||||
<input class="form-control me-2" type="search" placeholder="Buscar por..." aria-label="Search">
|
||||
</form>
|
||||
<ul class="navbar-nav ms-auto">
|
||||
<li class="nav-item dropdown">
|
||||
<a class="nav-link dropdown-toggle" href="#" role="button" data-bs-toggle="dropdown" aria-expanded="false">
|
||||
<i class="bi bi-person-circle me-1"></i> Admin
|
||||
<i class="bi bi-person-circle me-1"></i> Administrador
|
||||
</a>
|
||||
<ul class="dropdown-menu dropdown-menu-end">
|
||||
<li><a class="dropdown-item" href="#">Profile</a></li>
|
||||
<li><a class="dropdown-item" href="#">Logout</a></li>
|
||||
<li><a class="dropdown-item" href="#">Perfil</a></li>
|
||||
<li><a class="dropdown-item" href="#">Sair</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
@ -86,7 +86,7 @@ try {
|
||||
<?php if (isset($db_error)): ?>
|
||||
<div class="alert alert-danger">
|
||||
<p><?php echo htmlspecialchars($db_error); ?></p>
|
||||
<p>From your terminal, please run: <code>php db/migrate.php</code></p>
|
||||
<p>No seu terminal, por favor, execute: <code>php db/migrate.php</code></p>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
@ -98,9 +98,9 @@ try {
|
||||
<?php endif; ?>
|
||||
|
||||
<div class="d-flex justify-content-between align-items-center mb-4">
|
||||
<h1 class="h3 mb-0 text-gray-800">Dashboard</h1>
|
||||
<h1 class="h3 mb-0 text-gray-800">Painel de Controle</h1>
|
||||
<button class="btn btn-primary" data-bs-toggle="modal" data-bs-target="#addInstallationModal">
|
||||
<i class="bi bi-plus-circle-fill me-2"></i>Register New Installation
|
||||
<i class="bi bi-plus-circle-fill me-2"></i>Registrar Nova Instalação
|
||||
</button>
|
||||
</div>
|
||||
|
||||
@ -113,7 +113,7 @@ try {
|
||||
</div>
|
||||
<div>
|
||||
<div class="kpi-value"><?php echo $total_installations; ?></div>
|
||||
<div class="kpi-label">Total Installations</div>
|
||||
<div class="kpi-label">Total de Instalações</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@ -126,7 +126,7 @@ try {
|
||||
</div>
|
||||
<div>
|
||||
<div class="kpi-value">0</div>
|
||||
<div class="kpi-label">Active Now</div>
|
||||
<div class="kpi-label">Ativas no Momento</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@ -139,7 +139,7 @@ try {
|
||||
</div>
|
||||
<div>
|
||||
<div class="kpi-value">0</div>
|
||||
<div class="kpi-label">Technicians</div>
|
||||
<div class="kpi-label">Técnicos</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@ -152,7 +152,7 @@ try {
|
||||
</div>
|
||||
<div>
|
||||
<div class="kpi-value">0</div>
|
||||
<div class="kpi-label">Pending Issues</div>
|
||||
<div class="kpi-label">Problemas Pendentes</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@ -161,29 +161,29 @@ try {
|
||||
|
||||
<div class="card">
|
||||
<div class="card-header d-flex justify-content-between align-items-center">
|
||||
<h5 class="card-title mb-0"><i class="bi bi-list-task me-2"></i>Recent Installations</h5>
|
||||
<a href="#" class="btn btn-sm btn-outline-secondary">View All</a>
|
||||
<h5 class="card-title mb-0"><i class="bi bi-list-task me-2"></i>Instalações Recentes</h5>
|
||||
<a href="#" class="btn btn-sm btn-outline-secondary">Ver Todas</a>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<div class="table-responsive">
|
||||
<table class="table table-hover">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Image</th>
|
||||
<th>Client</th>
|
||||
<th>Address</th>
|
||||
<th>Technician</th>
|
||||
<th>Voltage</th>
|
||||
<th>Phase/Neutral</th>
|
||||
<th>Breaker</th>
|
||||
<th>Date</th>
|
||||
<th>Actions</th>
|
||||
<th>Imagem</th>
|
||||
<th>Cliente</th>
|
||||
<th>Endereço</th>
|
||||
<th>Técnico</th>
|
||||
<th>Tensão</th>
|
||||
<th>Fase/Neutro</th>
|
||||
<th>Disjuntor</th>
|
||||
<th>Data</th>
|
||||
<th>Ações</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php if (empty($installations) && !isset($db_error)): ?>
|
||||
<tr>
|
||||
<td colspan="9" class="text-center">No installations found.</td>
|
||||
<td colspan="9" class="text-center">Nenhuma instalação encontrada.</td>
|
||||
</tr>
|
||||
<?php else: ?>
|
||||
<?php foreach ($installations as $inst): ?>
|
||||
@ -196,7 +196,7 @@ try {
|
||||
<td>
|
||||
<?php if ($first_image): ?>
|
||||
<a href="<?php echo htmlspecialchars($first_image); ?>" target="_blank">
|
||||
<img src="<?php echo htmlspecialchars($first_image); ?>" alt="Installation Image" style="width: 50px; height: 50px; object-fit: cover;">
|
||||
<img src="<?php echo htmlspecialchars($first_image); ?>" alt="Imagem da Instalação" style="width: 50px; height: 50px; object-fit: cover;">
|
||||
</a>
|
||||
<?php else: ?>
|
||||
N/A
|
||||
@ -229,53 +229,53 @@ try {
|
||||
<div class="modal-dialog modal-lg">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title" id="addInstallationModalLabel">Register New Installation</h5>
|
||||
<h5 class="modal-title" id="addInstallationModalLabel">Registrar Nova Instalação</h5>
|
||||
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<form action="add_installation.php" method="POST" enctype="multipart/form-data">
|
||||
<div class="mb-3">
|
||||
<label for="client_name" class="form-label">Client Name</label>
|
||||
<label for="client_name" class="form-label">Nome do Cliente</label>
|
||||
<input type="text" class="form-control" id="client_name" name="client_name" required>
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label for="address" class="form-label">Installation Address</label>
|
||||
<label for="address" class="form-label">Endereço da Instalação</label>
|
||||
<textarea class="form-control" id="address" name="address" rows="3" required></textarea>
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label for="technician_name" class="form-label">Technician Name</label>
|
||||
<label for="technician_name" class="form-label">Nome do Técnico</label>
|
||||
<input type="text" class="form-control" id="technician_name" name="technician_name" required>
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label for="observations" class="form-label">Observations</label>
|
||||
<label for="observations" class="form-label">Observações</label>
|
||||
<textarea class="form-control" id="observations" name="observations" rows="3"></textarea>
|
||||
</div>
|
||||
|
||||
<div class="mb-3">
|
||||
<label for="images" class="form-label">Installation Images</label>
|
||||
<label for="images" class="form-label">Imagens da Instalação</label>
|
||||
<input class="form-control" type="file" id="images" name="images[]" accept="image/*" multiple>
|
||||
</div>
|
||||
|
||||
<hr>
|
||||
<h6 class="mb-3">Electrical Measurements</h6>
|
||||
<h6 class="mb-3">Medições Elétricas</h6>
|
||||
<div class="row">
|
||||
<div class="col-md-4 mb-3">
|
||||
<label for="voltage" class="form-label">Voltage (V)</label>
|
||||
<label for="voltage" class="form-label">Tensão (V)</label>
|
||||
<input type="text" class="form-control" id="voltage" name="voltage">
|
||||
</div>
|
||||
<div class="col-md-4 mb-3">
|
||||
<label for="phase_neutral_ground" class="form-label">Phase-Neutral-Ground</label>
|
||||
<label for="phase_neutral_ground" class="form-label">Fase-Neutro-Terra</label>
|
||||
<input type="text" class="form-control" id="phase_neutral_ground" name="phase_neutral_ground">
|
||||
</div>
|
||||
<div class="col-md-4 mb-3">
|
||||
<label for="breaker_output" class="form-label">Breaker Output (A)</label>
|
||||
<label for="breaker_output" class="form-label">Saída do Disjuntor (A)</label>
|
||||
<input type="text" class="form-control" id="breaker_output" name="breaker_output">
|
||||
</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 Installation</button>
|
||||
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Fechar</button>
|
||||
<button type="submit" class="btn btn-primary">Salvar Instalação</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user