feat: Add support for project cancellation status across the application

This commit is contained in:
2025-09-11 16:19:46 +02:00
parent 2735d46552
commit 95ef139843
13 changed files with 116 additions and 50 deletions

View File

@@ -38,6 +38,10 @@ export default function ProjectStatusDropdown({
label: t("projectStatus.fulfilled"),
variant: "success",
},
cancelled: {
label: t("projectStatus.cancelled"),
variant: "danger",
},
};
const handleChange = async (newStatus) => {
if (newStatus === status) {
@@ -50,11 +54,19 @@ export default function ProjectStatusDropdown({
setIsOpen(false);
try {
await fetch(`/api/projects/${project.project_id}`, {
const updateData = { ...project, project_status: newStatus };
const response = await fetch(`/api/projects/${project.project_id}`, {
method: "PUT",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({ ...project, project_status: newStatus }),
body: JSON.stringify(updateData),
});
if (!response.ok) {
const errorData = await response.json();
console.error('Update failed:', errorData);
}
window.location.reload();
} catch (error) {
console.error("Failed to update status:", error);

View File

@@ -29,6 +29,10 @@ export default function ProjectStatusDropdownDebug({
label: "Completed",
variant: "success",
},
cancelled: {
label: "Cancelled",
variant: "danger",
},
};
const handleChange = async (newStatus) => {

View File

@@ -29,6 +29,10 @@ export default function ProjectStatusDropdownSimple({
label: "Completed",
variant: "success",
},
cancelled: {
label: "Cancelled",
variant: "danger",
},
};
const handleChange = async (newStatus) => {

View File

@@ -31,6 +31,7 @@ const statusColors = {
pending: "bg-yellow-100 text-yellow-800",
in_progress: "bg-orange-100 text-orange-800",
fulfilled: "bg-gray-100 text-gray-800",
cancelled: "bg-red-100 text-red-800",
};
const statusTranslations = {
@@ -39,6 +40,7 @@ const statusTranslations = {
pending: "Oczekujący",
in_progress: "W trakcie",
fulfilled: "Zakończony",
cancelled: "Wycofany",
};
export default function ProjectCalendarWidget({

View File

@@ -32,6 +32,7 @@ export default function ProjectMap({
label: "In Progress (Construction)",
},
fulfilled: { color: "#10B981", label: "Completed" },
cancelled: { color: "#EF4444", label: "Cancelled" },
};
useEffect(() => {