Add interest deletion and sales pipeline status tracking

- Add delete button with confirmation dialog to InterestDetailsModal
- Implement delete-interest API endpoint
- Add sales pipeline status section with visual indicators
- Update UI states to handle deletion loading states
- Add color-coded sales process level selection
This commit is contained in:
2025-06-04 19:51:51 +02:00
parent 4d3935e863
commit 2ea72ef24e
5 changed files with 280 additions and 81 deletions

View File

@@ -0,0 +1,22 @@
import { deleteInterest } from "~/server/utils/nocodb";
export default defineEventHandler(async (event) => {
const body = await readBody(event);
const { id } = body;
const xTag = getHeader(event, "x-tag");
try {
// Delete the interest from NocoDB
await deleteInterest(id);
return {
success: true,
message: "Interest deleted successfully",
};
} catch (error: any) {
throw createError({
statusCode: 500,
statusMessage: error.message || "Failed to delete interest",
});
}
});

View File

@@ -79,7 +79,7 @@ export const updateInterest = async (id: string, data: Partial<Interest>) => {
// Filter the data to only include allowed fields
for (const field of allowedFields) {
if (field in data) {
cleanData[field] = data[field];
cleanData[field] = (data as any)[field];
}
}
@@ -127,7 +127,7 @@ export const createInterest = async (data: Partial<Interest>) => {
// Filter the data to only include allowed fields
for (const field of allowedFields) {
if (field in data) {
cleanData[field] = data[field];
cleanData[field] = (data as any)[field];
}
}
@@ -146,6 +146,14 @@ export const createInterest = async (data: Partial<Interest>) => {
});
};
export const deleteInterest = async (id: string) =>
$fetch(`${createTableUrl(Table.Interest)}/${id}`, {
method: "DELETE",
headers: {
"xc-token": getNocoDbConfiguration().token,
},
});
export const triggerWebhook = async (url: string, payload: any) =>
$fetch(url, {
method: "POST",