<script setup lang="ts">
import type { LinkItem, ListItemDto } from './types'
import { ActionEvents } from './types'

const props = defineProps<{
  rec: ListItemDto
}>()

const recId = inject<Ref<number>>('rec_id')!
const recAction = inject<Ref<string>>('rec_action')!
const recItem = inject<Ref<any>>('rec_item')!
const timestamp = inject<Ref<any>>('timestamp')!

function print() {
  recId.value = props.rec.id || 0
  recAction.value = ActionEvents.showPrint
  recItem.value = props.rec
  timestamp.value = new Date().getTime()
}
</script>

<template>
  <div>
    <Button type="button" variant="outline" 
      class="text-orange-500 border border-orange-400"
      @click="print">
      <Icon name="i-lucide-printer" class="h-4 w-4 align-middle transition-colors" />
      Preview
    </Button>
  </div>
</template>
