| 1 | <template> |
| 2 | <div> |
| 3 | <n-tabs v-model:value="activeTab" type="line" animated> |
| 4 | <n-tab-pane name="templates" tab="Templates"> |
| 5 | <CaseTemplatesTable ref="templatesTableRef" /> |
| 6 | </n-tab-pane> |
| 7 | |
| 8 | <n-tab-pane name="library" tab="Library"> |
| 9 | <CaseTemplatesLibrary @imported="reloadTemplates" /> |
| 10 | </n-tab-pane> |
| 11 | |
| 12 | <template #suffix> |
| 13 | <CreateCaseTemplatesButton @success="reloadTemplates" /> |
| 14 | </template> |
| 15 | </n-tabs> |
| 16 | </div> |
| 17 | </template> |
| 18 | |
| 19 | <script setup lang="tsx"> |
| 20 | import { NTabPane, NTabs } from "naive-ui" |
| 21 | import { ref } from "vue" |
| 22 | import CaseTemplatesLibrary from "./CaseTemplatesLibrary.vue" |
| 23 | import CaseTemplatesTable from "./CaseTemplatesTable.vue" |
| 24 | import CreateCaseTemplatesButton from "./CreateCaseTemplatesButton.vue" |
| 25 | |
| 26 | const templatesTableRef = ref<InstanceType<typeof CaseTemplatesTable>>() |
| 27 | const activeTab = ref<"templates" | "library">("templates") |
| 28 | |
| 29 | function reloadTemplates() { |
| 30 | activeTab.value = "templates" |
| 31 | templatesTableRef.value?.fetchTemplates() |
| 32 | } |
| 33 | </script> |