Aumento tempo alerta toast.php

This commit is contained in:
HalbeBruno
2026-03-12 15:50:18 -03:00
parent fa96ec4aea
commit a58805a7dc
2 changed files with 28 additions and 2 deletions

View File

@@ -72,12 +72,38 @@ class OrderController
public function store() public function store()
{ {
// Detect post_max_size overflow
if (empty($_POST) && empty($_FILES) && isset($_SERVER['CONTENT_LENGTH']) && (int)$_SERVER['CONTENT_LENGTH'] > 0) {
$_SESSION['flash_error'] = "O tamanho total dos arquivos enviados excede o limite permitido pelo servidor.";
View::redirect('/admin/orders/create');
return;
}
if (!isset($_FILES['csv_file']) || $_FILES['csv_file']['error'] !== UPLOAD_ERR_OK) { if (!isset($_FILES['csv_file']) || $_FILES['csv_file']['error'] !== UPLOAD_ERR_OK) {
$_SESSION['flash_error'] = "Erro no upload do arquivo CSV."; $_SESSION['flash_error'] = "Erro no upload do arquivo CSV.";
View::redirect('/admin/orders/create'); View::redirect('/admin/orders/create');
return; return;
} }
// Validate attachments before inserting the order
if (isset($_FILES['attachments']) && !empty($_FILES['attachments']['name'][0])) {
$attachments = $_FILES['attachments'];
$count = count($attachments['name']);
for ($i = 0; $i < $count; $i++) {
$error = $attachments['error'][$i];
if ($error !== UPLOAD_ERR_OK && $error !== UPLOAD_ERR_NO_FILE) {
$fileName = $attachments['name'][$i];
if ($error === UPLOAD_ERR_INI_SIZE || $error === UPLOAD_ERR_FORM_SIZE) {
$_SESSION['flash_error'] = "O anexo '{$fileName}' excede o tamanho máximo permitido.";
} else {
$_SESSION['flash_error'] = "Erro no upload do anexo '{$fileName}': código {$error}.";
}
View::redirect('/admin/orders/create');
return;
}
}
}
$title = $_POST['title']; $title = $_POST['title'];
$type = $_POST['type']; $type = $_POST['type'];
$content = \App\Utils\TextFormatter::normalizeLineBreaks($_POST['content']); $content = \App\Utils\TextFormatter::normalizeLineBreaks($_POST['content']);

View File

@@ -8,9 +8,9 @@
type = $event.detail.type; type = $event.detail.type;
title = $event.detail.title; title = $event.detail.title;
message = $event.detail.message; message = $event.detail.message;
setTimeout(() => show = false, 5000) setTimeout(() => show = false, type === \'error\' ? 15000 : 8000)
" x-init=" " x-init="
if (show) setTimeout(() => show = false, 5000); if (show) setTimeout(() => show = false, type === \'error\' ? 15000 : 8000);
window.notify = (type, title, message) => { window.notify = (type, title, message) => {
$dispatch('notify', { type, title, message }); $dispatch('notify', { type, title, message });
} }