<script setup>
import { useI18n } from 'vue-i18n';
import VnFilterPanel from 'src/components/ui/VnFilterPanel.vue';
import VnInput from 'src/components/common/VnInput.vue';

const { t } = useI18n();
const props = defineProps({
    dataKey: {
        type: String,
        required: true,
    },
});
</script>

<template>
    <VnFilterPanel
        :data-key="props.dataKey"
        :search-button="true"
        :hidden-tags="['search']"
        :redirect="false"
    >
        <template #tags="{ tag, formatFn }">
            <div class="q-gutter-x-xs">
                <strong>{{ t(`role.${tag.label}`) }}: </strong>
                <span>{{ formatFn(tag.value) }}</span>
            </div>
        </template>
        <template #body="{ params }">
            <QItem class="q-my-sm">
                <QItemSection>
                    <VnInput
                        :label="t('role.name')"
                        v-model="params.name"
                        lazy-rules
                        is-outlined
                    />
                </QItemSection>
            </QItem>
            <QItem class="q-my-sm">
                <QItemSection>
                    <VnInput
                        :label="t('role.description')"
                        v-model="params.description"
                        lazy-rules
                        is-outlined
                    />
                </QItemSection>
            </QItem>
        </template>
    </VnFilterPanel>
</template>
