- {{ selectedClientes.length }} cliente{{ selectedClientes.length !== 1 ? 's' : '' }} seleccionado{{ selectedClientes.length !== 1 ? 's' : '' }}
+
+
+ {{ selectedIds.length }} cliente{{ selectedIds.length !== 1 ? 's' : '' }} seleccionado{{ selectedIds.length !== 1 ? 's' : '' }}
([])
const loading = ref(false)
const searchQuery = ref('')
-// Computed - Sync with props
-const selectedClientes = computed({
- get: () => {
- return clientes.value.filter(c => props.selectedIds.includes(c.id))
- },
- set: (value: Cliente[]) => {
- emit('update:selectedIds', value.map(c => c.id))
- }
+// Computed - Get selected clientes as objects for InputMenu
+const selectedClientesObjects = computed(() => {
+ return clientes.value
+ .filter(c => props.selectedIds.includes(c.id))
+ .map(c => ({
+ id: c.id,
+ name: c.name,
+ cedula: c.cedula,
+ label: c.name,
+ value: c.id
+ }))
})
// Computed - Filter items based on search (min 4 characters)
@@ -110,6 +115,12 @@ const filteredItems = computed((): InputMenuItem[] => {
})
// Methods
+function onSelectionChange(value: any[]) {
+ // Extract IDs from selected items
+ const ids = value.map(item => item.id || item.value || item)
+ emit('update:selectedIds', ids)
+}
+
function clearAll() {
emit('update:selectedIds', [])
}