import type { Meta, StoryObj } from '@storybook-vue/nuxt' import TableComponent from './TableComponent.vue' const meta = { title: 'Components/TableComponent', component: TableComponent, } satisfies Meta export default meta type Story = StoryObj export const TableComponentStory: Story = { args: { headers: [ { text: 'Código', value: 'codigo' }, { text: 'Nombre', value: 'nombre' }, { text: 'Centro sanitario', value: 'centro_sanitario_codigo' }, { text: 'Fecha creación', value: 'created_at' }, { text: 'Estado', value: 'estado' }, ], items: [ { id: 1, nombre: 'Validacion multiple testing', centro_sanitario_id: 1, codigo: '001', categorias_plantillas_consentimientos_id: 1, version: 1, estado: false, created_by: 1372, updated_by: 1374, created_at: '2025-04-30T19:04:32.000000Z', centro_sanitario: { id: 1, codigo: 'HSVM', nombre: 'SF MEDELLIN' }, }, { id: 2, nombre: 'PRESCRIPCIÓN DE VISITA MÉDICA - TERAPIAS DOMICILIARIAS – OTROS HOSPITAL MEDELLÍN ALFA', centro_sanitario_id: 1, codigo: 'ALFA_001', categorias_plantillas_consentimientos_id: 1, version: 1, estado: false, created_by: 1372, updated_by: 1374, created_at: '2025-04-30T19:58:44.000000Z', centro_sanitario: { id: 1, codigo: 'HSVM', nombre: 'SF MEDELLIN' }, }, { id: 3, nombre: 'PRESCRIPCIÓN DE VISITA MÉDICA - TERAPIAS DOMICILIARIAS – OTROS HOSPITAL MEDELLÍN ALFA 2', centro_sanitario_id: 1, codigo: 'ALFA_002', categorias_plantillas_consentimientos_id: 1, version: 1, estado: false, created_by: 1372, updated_by: 1374, created_at: '2025-04-30T20:18:48.000000Z', centro_sanitario: { id: 1, codigo: 'HSVM', nombre: 'SF MEDELLIN' }, }, { id: 4, nombre: 'PRESCRIPCIÓN DE VISITA MÉDICA - TERAPIAS DOMICILIARIAS – OTROS HOSPITAL MEDELLÍN ALFA 3', centro_sanitario_id: 1, codigo: 'ALFA_003', categorias_plantillas_consentimientos_id: 1, version: 1, estado: false, created_by: 1372, updated_by: 1374, created_at: '2025-04-30T20:33:03.000000Z', centro_sanitario: { id: 1, codigo: 'HSVM', nombre: 'SF MEDELLIN' }, }, { id: 5, nombre: 'text_table_test', centro_sanitario_id: 1, codigo: 'text_table_test', categorias_plantillas_consentimientos_id: 1, version: 1, estado: false, created_by: 1372, updated_by: 1374, created_at: '2025-04-30T21:03:41.000000Z', centro_sanitario: { id: 1, codigo: 'HSVM', nombre: 'SF MEDELLIN' }, }, { id: 6, nombre: 'ALPHA FILE 001', centro_sanitario_id: 1, codigo: 'AF001', categorias_plantillas_consentimientos_id: 1, version: 1, estado: false, created_by: 1372, updated_by: 1374, created_at: '2025-04-30T21:06:19.000000Z', centro_sanitario: { id: 1, codigo: 'HSVM', nombre: 'SF MEDELLIN' }, }, { id: 7, nombre: '987', centro_sanitario_id: 1, codigo: '789', categorias_plantillas_consentimientos_id: 1, version: 1, estado: false, created_by: 1372, updated_by: 2863, created_at: '2025-04-30T21:18:29.000000Z', centro_sanitario: { id: 1, codigo: 'HSVM', nombre: 'SF MEDELLIN' }, }, { id: 8, nombre: 'TESTING FILE ALPHA', centro_sanitario_id: 1, codigo: 'ALPHA_003', categorias_plantillas_consentimientos_id: 1, version: 1, estado: false, created_by: 1372, updated_by: 1374, created_at: '2025-04-30T21:20:03.000000Z', centro_sanitario: { id: 1, codigo: 'HSVM', nombre: 'SF MEDELLIN' }, }, { id: 9, nombre: 'PRESCRIPCIÓN DE VISITA MÉDICA - TERAPIAS DOMICILIARIAS – OTROS HOSPITAL MEDELLÍN DOC ALPHA 1', centro_sanitario_id: 1, codigo: 'docalpha_001', categorias_plantillas_consentimientos_id: 1, version: 1, estado: false, created_by: 1372, updated_by: 1374, created_at: '2025-05-02T13:25:37.000000Z', centro_sanitario: { id: 1, codigo: 'HSVM', nombre: 'SF MEDELLIN' }, }, { id: 10, nombre: 'nuevo input numerico y texto', centro_sanitario_id: 1, codigo: '001testingalpha', categorias_plantillas_consentimientos_id: 1, version: 1, estado: false, created_by: 1372, updated_by: 1374, created_at: '2025-05-05T19:48:20.000000Z', centro_sanitario: { id: 1, codigo: 'HSVM', nombre: 'SF MEDELLIN' }, }, ], pagination: { current_page: 1, data: [], // no se usa en el componente, los items van aparte first_page_url: '', from: 1, last_page: 3, last_page_url: '', links: [], next_page_url: '', path: '', per_page: 10, prev_page_url: null, to: 10, total: 21, }, showActions: true, actions: ['ver', 'editar', 'duplicar', 'cambiar_estado'], newButtons: [ { color: 'info', showModal: false, identifier: 'ver', icon: 'mdi:eye-outline', tooltipText: 'Ver vista previa' }, { color: 'warning', showModal: true, identifier: 'editar', icon: 'material-symbols:edit-document-outline', tooltipText: 'Editar consentimiento' }, { color: 'danger', showModal: false, identifier: 'cambiar_estado', icon: 'mdi:backup-restore', tooltipText: 'Cambiar estado' }, ], loading: false, actionValidation: () => ({ ver: true, editar: true, duplicar: true, cambiar_estado: true }), isSelected: true, showColumns: true, selectItem: false, conditionFn: () => true, exportFile: { pdf: () => { console.log('Exportar PDF') }, excel: () => { console.log('Exportar Excel') }, csv: () => { console.log('Exportar CSV') }, }, // Simula handlers para acciones onAction: ({ action, item }: { action: string, item: any }) => { console.log('Acción:', action, 'Item:', item) }, onCounterPage: (page: number) => { console.log('Página:', page) }, onUpdateSearch: (query: string) => { console.log('Buscar:', query) }, onUpdateShowPerPage: (perPage: number) => { console.log('Mostrar por página:', perPage) }, }, }