74 lines
4.2 KiB
PHP
74 lines
4.2 KiB
PHP
<?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>
|
|
<?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'
|
|
];
|
|
?>
|
|
<tr class="border-b hover:bg-gray-50 transition-colors duration-150">
|
|
<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>
|
|
<td class="p-3 text-gray-600">
|
|
<?php
|
|
if ($due_date) {
|
|
try {
|
|
$date = new DateTime($due_date);
|
|
echo esc_html($date->format('d/m/Y H:i'));
|
|
} catch (Exception $e) {
|
|
echo '-';
|
|
}
|
|
} else {
|
|
echo '-';
|
|
}
|
|
?>
|
|
</td>
|
|
<td class="p-3">
|
|
<?php if ($priority): ?>
|
|
<span class="px-2 py-1 rounded-full text-xs font-medium
|
|
<?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'); ?>
|
|
</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
|
|
}
|
|
?>
|