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);