| 1 | <template> |
| 2 | <div> |
| 3 | <n-button type="primary" :secondary :size @click="showModal = true"> |
| 4 | <template #icon> |
| 5 | <Icon name="carbon:add" /> |
| 6 | </template> |
| 7 | Create case |
| 8 | </n-button> |
| 9 | |
| 10 | <n-modal |
| 11 | v-model:show="showModal" |
| 12 | title="Create Case" |
| 13 | preset="card" |
| 14 | display-directive="show" |
| 15 | class="w-[90vw]! max-w-160!" |
| 16 | segmented |
| 17 | > |
| 18 | <CreateCaseForm @success="handleSuccess" @cancel="showModal = false" /> |
| 19 | </n-modal> |
| 20 | </div> |
| 21 | </template> |
| 22 | |
| 23 | <script setup lang="ts"> |
| 24 | import type { ButtonSize } from "naive-ui" |
| 25 | import { NButton, NModal } from "naive-ui" |
| 26 | import { ref } from "vue" |
| 27 | import CreateCaseForm from "@/components/cases/CreateCaseForm.vue" |
| 28 | import Icon from "@/components/common/Icon.vue" |
| 29 | |
| 30 | defineProps<{ |
| 31 | secondary?: boolean |
| 32 | size?: ButtonSize |
| 33 | }>() |
| 34 | |
| 35 | const emit = defineEmits<{ |
| 36 | (e: "success"): void |
| 37 | }>() |
| 38 | |
| 39 | const showModal = ref(false) |
| 40 | |
| 41 | function handleSuccess() { |
| 42 | showModal.value = false |
| 43 | emit("success") |
| 44 | } |
| 45 | </script> |