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:
22
server/api/delete-interest.ts
Normal file
22
server/api/delete-interest.ts
Normal 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",
|
||||
});
|
||||
}
|
||||
});
|
||||
@@ -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",
|
||||
|
||||
Reference in New Issue
Block a user