fix(14): remove dead generate_new branch from assignQuoteToLead (CRM-12)
assignQuoteToLead's generate_new check was unreachable since SendQuoteModal always passed false. Removes the field from both the server schema and the modal's local schema/defaultValues/call site.
This commit is contained in:
@@ -115,7 +115,6 @@ export async function logActivity(data: z.infer<typeof createActivitySchema>) {
|
|||||||
const assignQuoteSchema = z.object({
|
const assignQuoteSchema = z.object({
|
||||||
lead_id: z.string().min(1),
|
lead_id: z.string().min(1),
|
||||||
quote_token: z.string().optional(),
|
quote_token: z.string().optional(),
|
||||||
generate_new: z.boolean(),
|
|
||||||
});
|
});
|
||||||
|
|
||||||
export async function assignQuoteToLead(data: z.infer<typeof assignQuoteSchema>) {
|
export async function assignQuoteToLead(data: z.infer<typeof assignQuoteSchema>) {
|
||||||
@@ -126,11 +125,6 @@ export async function assignQuoteToLead(data: z.infer<typeof assignQuoteSchema>)
|
|||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
if (parsed.data.generate_new) {
|
|
||||||
// Redirect handled on client; this is a no-op
|
|
||||||
return { success: true };
|
|
||||||
}
|
|
||||||
|
|
||||||
// Link quote to lead and update lead status
|
// Link quote to lead and update lead status
|
||||||
const token = parsed.data.quote_token;
|
const token = parsed.data.quote_token;
|
||||||
const leadId = parsed.data.lead_id;
|
const leadId = parsed.data.lead_id;
|
||||||
|
|||||||
@@ -28,7 +28,6 @@ import { Loader2 } from "lucide-react";
|
|||||||
const assignQuoteSchema = z.object({
|
const assignQuoteSchema = z.object({
|
||||||
lead_id: z.string(),
|
lead_id: z.string(),
|
||||||
quote_token: z.string().optional(),
|
quote_token: z.string().optional(),
|
||||||
generate_new: z.boolean().default(false),
|
|
||||||
});
|
});
|
||||||
|
|
||||||
export function SendQuoteModal({ leadId }: { leadId: string }) {
|
export function SendQuoteModal({ leadId }: { leadId: string }) {
|
||||||
@@ -40,7 +39,6 @@ export function SendQuoteModal({ leadId }: { leadId: string }) {
|
|||||||
resolver: zodResolver(assignQuoteSchema),
|
resolver: zodResolver(assignQuoteSchema),
|
||||||
defaultValues: {
|
defaultValues: {
|
||||||
lead_id: leadId,
|
lead_id: leadId,
|
||||||
generate_new: false,
|
|
||||||
quote_token: "",
|
quote_token: "",
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
@@ -51,7 +49,6 @@ export function SendQuoteModal({ leadId }: { leadId: string }) {
|
|||||||
const result = await assignQuoteToLead({
|
const result = await assignQuoteToLead({
|
||||||
lead_id: leadId,
|
lead_id: leadId,
|
||||||
quote_token: data.quote_token,
|
quote_token: data.quote_token,
|
||||||
generate_new: false,
|
|
||||||
});
|
});
|
||||||
if (result.success) {
|
if (result.success) {
|
||||||
setOpen(false);
|
setOpen(false);
|
||||||
|
|||||||
Reference in New Issue
Block a user