Files
artes/includes/templates/tasks.php

74 lines
4.2 KiB
PHP
Raw Normal View History

2025-08-08 22:19:01 -03:00
<?php
function sistema_arte_tasks_template($tasks) {
?>
<!-- Coluna Direita - Lista de Tarefas -->
<div class="bg-white rounded-lg shadow-lg p-6">
<h2 class="text-xl font-bold text-gray-800 mb-6 border-b pb-2">Demandas Pendentes</h2>
<?php if ($tasks): ?>
<div class="overflow-x-auto">
<table class="w-full text-left">
<thead class="bg-gray-50">
<tr>
<th class="p-3 border-b font-semibold text-gray-700">ID</th>
<th class="p-3 border-b font-semibold text-gray-700">Título</th>
<th class="p-3 border-b font-semibold text-gray-700">Vencimento</th>
<th class="p-3 border-b font-semibold text-gray-700">Prioridade</th>
</tr>
</thead>
<tbody>
2025-09-20 19:19:00 -03:00
<?php foreach ($tasks as $post): ?>
<?php
$due_date = get_post_meta($post->ID, '_due_date', true);
$priority = get_post_meta($post->ID, '_priority', true);
$priorities_text = [
'1' => 'Alta',
'2' => 'Média-Alta',
'3' => 'Média',
'4' => 'Baixa'
];
?>
2025-08-08 22:19:01 -03:00
<tr class="border-b hover:bg-gray-50 transition-colors duration-150">
2025-09-20 19:19:00 -03:00
<td class="p-3 text-gray-600 font-semibold"><?php echo esc_html(function_exists('sistema_arte_format_id') ? sistema_arte_format_id($post->ID) : $post->ID); ?></td>
<td class="p-3 font-medium text-gray-800"><?php echo esc_html($post->post_title); ?></td>
2025-08-08 22:19:01 -03:00
<td class="p-3 text-gray-600">
<?php
2025-09-20 19:19:00 -03:00
if ($due_date) {
2025-08-08 22:19:01 -03:00
try {
2025-09-20 19:19:00 -03:00
$date = new DateTime($due_date);
2025-08-08 22:19:01 -03:00
echo esc_html($date->format('d/m/Y H:i'));
} catch (Exception $e) {
echo '-';
}
} else {
echo '-';
}
?>
</td>
<td class="p-3">
2025-09-20 19:19:00 -03:00
<?php if ($priority): ?>
2025-08-08 22:19:01 -03:00
<span class="px-2 py-1 rounded-full text-xs font-medium
2025-09-20 19:19:00 -03:00
<?php echo esc_attr($priority <= 2 ? 'bg-red-100 text-red-800' :
($priority <= 3 ? 'bg-yellow-100 text-yellow-800' : 'bg-green-100 text-green-800')); ?>">
<?php echo esc_html($priorities_text[$priority] ?? 'N/D'); ?>
2025-08-08 22:19:01 -03:00
</span>
<?php else: ?>
<span class="px-2 py-1 rounded-full text-xs font-medium bg-gray-100 text-gray-800">-</span>
<?php endif; ?>
</td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
</div>
<?php else: ?>
<div class="text-center py-8">
<svg xmlns="http://www.w3.org/2000/svg" class="h-12 w-12 mx-auto text-gray-400" fill="none" viewBox="0 0 24 24" stroke="currentColor">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2" />
</svg>
<p class="mt-4 text-gray-600">Nenhuma tarefa encontrada ou erro ao carregar.</p>
</div>
<?php endif; ?>
</div>
<?php
}
?>