Add nuxt-skills and update auto quotes to use new policy API structure

- Add nuxt-skills (vue, nuxt, nuxt-ui) to .claude/skills/
- Create useCustomerSelection() composable for managing insured/buyer selection
- Create usePolicyApi() composable for policy API operations
- Update auto quote components to use insured/buyer instead of client
- Update vehicle fields: remove valorVehiculo, add market_value, requested_value, rc_limits
- Make chassis_number and engine_number optional
- Update auto quote types and composables to match new API structure
- Update auto quote page to submit to policy API with new structure
This commit is contained in:
2026-04-27 14:56:53 -05:00
parent 67482f6629
commit a2eb1f3789
154 changed files with 10346 additions and 51 deletions

View File

@@ -0,0 +1,67 @@
/**
* Composable for policy API operations
* Handles quote submission and acceptance
*/
export function usePolicyApi() {
const { $policy } = useNuxtApp()
const toast = useToast()
const router = useRouter()
/**
* Submit a policy quote request
*/
async function submitPolicyQuote(payload: {
policy_type: 'car' | 'life' | 'fire_structure' | 'fire_contents'
insured: any
buyer: any
policy_details: any
selected_providers: Array<{ provider_id: string; email: string }>
}) {
try {
const data = await $policy('/policies', {
method: 'POST',
body: payload
}) as any
toast.add({ title: 'Quote submitted successfully', color: 'green' })
return data
} catch (e: any) {
toast.add({
title: 'Failed to submit quote',
description: e?.data?.error ?? e.message,
color: 'red'
})
throw e
}
}
/**
* Accept a quote plan and trigger solicitation
*/
async function acceptQuote(applicationId: string, acceptedPlanId: string, acceptedBy: string) {
try {
const data = await $policy(`/policies/${applicationId}/accept`, {
method: 'POST',
body: {
accepted_plan_id: acceptedPlanId,
accepted_by: acceptedBy
}
}) as any
toast.add({ title: 'Plan accepted successfully', color: 'green' })
return data
} catch (e: any) {
toast.add({
title: 'Failed to accept plan',
description: e?.data?.error ?? e.message,
color: 'red'
})
throw e
}
}
return {
submitPolicyQuote,
acceptQuote
}
}