<script setup>
import {NFlex, NButton} from 'naive-ui'
import {TbPencil, TbTrash} from 'vue-icons-plus/tb'
import {computed} from "vue";
const props = defineProps({
    row: {
        type: Object
    },
    canEdit: {
        type: Boolean,
        default: false
    }
})
const emits = defineEmits(['clickEdit', 'clickDelete'])

const onClickEdit = () => {
    emits('clickEdit', props.row)
}
const onClickDelete = () => {
    emits('clickDelete', props.row.id)
}

const isMisType = computed(() => props.row.source_type === 'mis')
const isManualType = computed(() => props.row.source_type === 'manual')
</script>

<template>
    <NFlex v-if="canEdit" align="center" justify="end">
        <NButton v-if="isManualType" type="error" secondary size="tiny" @click="onClickDelete">
            <template #icon>
                <TbTrash />
            </template>
            Удалить
        </NButton>
        <NButton secondary size="tiny" @click="onClickEdit">
            <template #icon>
                <TbPencil />
            </template>
            Редактировать
        </NButton>
    </NFlex>
</template>

<style scoped>

</style>
