150 lines
4.8 KiB
PHP
150 lines
4.8 KiB
PHP
<?php
|
|
|
|
ob_start();
|
|
session_start();
|
|
//require_once 'config.php';
|
|
|
|
// Verificar se o usuário está logado
|
|
if (!isset($_SESSION['user_id']) && !in_array($_GET['page'], ['login', 'logout'])) {
|
|
header("Location: login.php");
|
|
exit();
|
|
}
|
|
?>
|
|
<!DOCTYPE html>
|
|
<html lang="pt-BR">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<title>Sistema de Ferramentas</title>
|
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
<link rel="stylesheet" href="style.css">
|
|
<script src="script.js"></script>
|
|
<link rel="stylesheet" href="https://code.jquery.com/ui/1.13.2/themes/base/jquery-ui.css">
|
|
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
|
|
<script src="https://code.jquery.com/ui/1.13.2/jquery-ui.min.js"></script>
|
|
</head>
|
|
<body>
|
|
<?php
|
|
|
|
include 'menu.php';
|
|
include 'top_menu.php';
|
|
|
|
?>
|
|
<div class="content">
|
|
<?php
|
|
if (isset($_GET['page'])) {
|
|
$page = $_GET['page'];
|
|
switch($page) {
|
|
case 'upload':
|
|
include 'prova/upload_prova.php';
|
|
break;
|
|
case 'status':
|
|
include 'prova/status.php';
|
|
break;
|
|
case 'list_files':
|
|
include 'prova/list_files.php';
|
|
break;
|
|
case 'register_client':
|
|
include 'clientes/register_client.php';
|
|
break;
|
|
case 'list_clients':
|
|
include 'clientes/list_clients.php';
|
|
break;
|
|
case 'client_details':
|
|
if (isset($_GET['id'])) {
|
|
include 'clientes/client_details.php';
|
|
}
|
|
break;
|
|
case 'edit_client':
|
|
if (isset($_GET['id'])) {
|
|
include 'clientes/edit_client.php';
|
|
}
|
|
break;
|
|
case 'delete_client':
|
|
if (isset($_GET['id'])) {
|
|
include 'clientes/delete_client.php';
|
|
}
|
|
break;
|
|
case 'edit_note':
|
|
if (isset($_POST['id'])) {
|
|
include 'clientes/edit_note.php';
|
|
}
|
|
break;
|
|
case 'delete_note':
|
|
if (isset($_POST['id'])) {
|
|
include 'clientes/delete_note.php';
|
|
}
|
|
break;
|
|
case 'doc_upload':
|
|
include 'upload.php';
|
|
break;
|
|
case 'doc_list':
|
|
include 'list.php';
|
|
break;
|
|
case 'delete_document':
|
|
if (isset($_GET['id'])) {
|
|
include 'delete_document.php';
|
|
}
|
|
break;
|
|
case 'temp_upload':
|
|
header('Content-Type: application/json');
|
|
require_once 'temp_upload.php';
|
|
exit();
|
|
break;
|
|
|
|
case 'save_edited':
|
|
// Garante que nenhuma saída HTML será enviada
|
|
ob_clean();
|
|
header('Content-Type: application/json');
|
|
require_once 'save_edited.php';
|
|
exit();
|
|
break;
|
|
|
|
case 'editor':
|
|
require_once 'editor.php';
|
|
break;
|
|
|
|
case 'auto_adjust':
|
|
header('Content-Type: application/json');
|
|
require_once 'auto_adjust.php';
|
|
exit();
|
|
break;
|
|
default:
|
|
echo "<h2>Bem-vindo ao Sistema de Ferramentas</h2>";
|
|
break;
|
|
}
|
|
} else {
|
|
echo "<h2>Bem-vindo ao Sistema de Ferramentas</h2>";
|
|
}
|
|
?>
|
|
</div>
|
|
<script>
|
|
$(document).ready(function(){
|
|
$("#search").autocomplete({
|
|
source: "clientes/autocomplete.php",
|
|
minLength: 2,
|
|
select: function(event, ui) {
|
|
if (ui.item.id) {
|
|
window.location.href = 'index.php?page=client_details&id=' + ui.item.id;
|
|
}
|
|
}
|
|
});
|
|
|
|
$("#search-button").click(function(){
|
|
var query = $("#search").val().trim();
|
|
if(query !== ""){
|
|
window.location.href = 'index.php?page=list_clients&search=' + encodeURIComponent(query);
|
|
} else {
|
|
window.location.href = 'index.php?page=list_clients';
|
|
}
|
|
});
|
|
|
|
$("#search").keypress(function(e){
|
|
if(e.which == 13){
|
|
$("#search-button").click();
|
|
}
|
|
});
|
|
});
|
|
</script>
|
|
</body>
|
|
</html>
|