78 lines
2.1 KiB
Vue
78 lines
2.1 KiB
Vue
<script setup lang="ts">
|
|
const props = defineProps<{
|
|
rec: any
|
|
}>()
|
|
|
|
const recSepId = inject<Ref<number>>('rec_sep_id')!
|
|
const recSepMenu = inject<Ref<string>>('rec_sep_menu')!
|
|
const recSepSubMenu = inject<Ref<string>>('rec_sep_sub_menu')!
|
|
const sepFileReview = ref<any>({})
|
|
const sippFileReview = ref<any>({})
|
|
|
|
const getEncounterDocument = () => {
|
|
const encounter = props.rec
|
|
sippFileReview.value = {}
|
|
sepFileReview.value = {}
|
|
if (encounter.encounterDocuments && Array.isArray(encounter.encounterDocuments)) {
|
|
for (const doc of encounter.encounterDocuments) {
|
|
if (doc.type_code === 'vclaim-sep') {
|
|
sepFileReview.value = { id: doc.id, fileName: doc.fileName, filePath: doc.filePath, type: doc.type_code }
|
|
} else if (doc.type_code === 'vclaim-sipp') {
|
|
sippFileReview.value = { id: doc.id, fileName: doc.fileName, filePath: doc.filePath, type: doc.type_code }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
function handleSepView(menu: string, subMenu: string) {
|
|
recSepId.value = props.rec.id || 0
|
|
recSepMenu.value = menu
|
|
recSepSubMenu.value = subMenu
|
|
}
|
|
|
|
onMounted(() => {
|
|
getEncounterDocument()
|
|
})
|
|
</script>
|
|
|
|
<template>
|
|
<div class="flex flex-col gap-2">
|
|
<Button
|
|
variant="outline"
|
|
type="button"
|
|
class="h-[40px] rounded-md border-orange-400 text-orange-400 hover:bg-green-50"
|
|
@click="handleSepView('sipp', sippFileReview.id ? 'view' : 'edit')"
|
|
>
|
|
<Icon
|
|
v-if="sippFileReview.id"
|
|
name="i-lucide-eye"
|
|
class="h-5 w-5"
|
|
/>
|
|
<Icon
|
|
v-else
|
|
name="i-lucide-upload"
|
|
class="h-5 w-5"
|
|
/>
|
|
{{ sippFileReview.id ? 'Lihat SIPP' : 'Upload File SIPP' }}
|
|
</Button>
|
|
<Button
|
|
variant="outline"
|
|
type="button"
|
|
class="h-[40px] rounded-md border-orange-400 text-orange-400 hover:bg-green-50"
|
|
@click="handleSepView('sep', sepFileReview.id ? 'view' : 'edit')"
|
|
>
|
|
<Icon
|
|
v-if="sepFileReview.id"
|
|
name="i-lucide-eye"
|
|
class="h-5 w-5"
|
|
/>
|
|
<Icon
|
|
v-else
|
|
name="i-lucide-upload"
|
|
class="h-5 w-5"
|
|
/>
|
|
{{ sepFileReview.id ? 'Lihat SEP' : 'Upload File SEP' }}
|
|
</Button>
|
|
</div>
|
|
</template>
|