feat: add task_category field to tasks with validation and update related forms

This commit is contained in:
2025-10-07 22:22:10 +02:00
parent 952caf10d1
commit a6ef325813
6 changed files with 72 additions and 13 deletions

View File

@@ -34,6 +34,19 @@ export default function TaskTemplatesPage() {
fetchTemplates();
}, []);
const getTaskCategoryBadge = (taskCategory) => {
const colors = {
design: "bg-blue-100 text-blue-800",
construction: "bg-green-100 text-green-800"
};
return (
<span className={`inline-flex items-center px-2 py-1 rounded-full text-xs font-medium ${colors[taskCategory] || "bg-gray-100 text-gray-800"}`}>
{taskCategory === "design" ? "Projektowe" : taskCategory === "construction" ? "Budowlane" : taskCategory}
</span>
);
};
if (loading) {
return (
<PageContainer>
@@ -170,9 +183,12 @@ export default function TaskTemplatesPage() {
<h3 className="text-lg font-semibold text-gray-900 truncate pr-2">
{template.name}
</h3>
<Badge variant="primary" size="sm">
{template.max_wait_days} {t('common.days')}
</Badge>
<div className="flex flex-col gap-1">
<Badge variant="primary" size="sm">
{template.max_wait_days} {t('common.days')}
</Badge>
{getTaskCategoryBadge(template.task_category)}
</div>
</div>
{template.description && (
<p className="text-gray-600 text-sm mb-4 line-clamp-2">