⚠️ refactor (form): remove unused components and logic from entry forms

This commit is contained in:
Abizrh
2025-08-28 01:24:48 +07:00
parent 2e889e70a6
commit 1824427b62
7 changed files with 9 additions and 110 deletions
-27
View File
@@ -3,7 +3,6 @@ import Block from '~/components/pub/custom-ui/form/block.vue'
import FieldGroup from '~/components/pub/custom-ui/form/field-group.vue'
import Field from '~/components/pub/custom-ui/form/field.vue'
import Label from '~/components/pub/custom-ui/form/label.vue'
import Action from '~/components/pub/custom-ui/nav-footer/ba-dr-su.vue'
const props = defineProps<{ modelValue: any }>()
const emit = defineEmits(['update:modelValue', 'event'])
@@ -12,19 +11,10 @@ const data = computed({
get: () => props.modelValue,
set: (val) => emit('update:modelValue', val),
})
function onClick(type: string) {
emit('event', type)
}
</script>
<template>
<form id="entry-form">
<div class="mb-5 border-b border-b-slate-300 pb-3 text-lg xl:text-xl">
<Icon name="i-lucide-user" class="me-2" />
<span class="font-semibold">Tambah</span> Dokter
</div>
<div class="mb-5 border-b border-b-slate-300 pb-3 text-lg xl:text-xl">
<div class="flex flex-col justify-between">
<Block>
@@ -94,24 +84,7 @@ function onClick(type: string) {
</Field>
</FieldGroup>
</Block>
<Block>
<FieldGroup :column="2">
<Label>Username</Label>
<Field>
<Input type="text" name="username" />
</Field>
</FieldGroup>
<FieldGroup :column="2">
<Label>Password</Label>
<Field>
<Input type="password" name="password" />
</Field>
</FieldGroup>
</Block>
</div>
</div>
<div class="my-2 flex justify-end py-2">
<Action @click="onClick" />
</div>
</form>
</template>
@@ -8,11 +8,6 @@ import Action from '~/components/pub/custom-ui/nav-footer/ba-dr-su.vue'
<template>
<form id="entry-form">
<div class="mb-5 border-b border-b-slate-300 pb-3 text-lg xl:text-xl">
<Icon name="i-lucide-user" class="me-2" />
<span class="font-semibold">Tambah</span> Pasien
</div>
<div class="mb-5 border-b border-b-slate-300 pb-3 text-lg xl:text-xl">
<Block>
<FieldGroup :column="3">
-5
View File
@@ -15,11 +15,6 @@ const data = computed({
<template>
<form id="entry-form">
<div class="mb-5 border-b border-b-slate-300 pb-3 text-lg xl:text-xl">
<Icon name="i-lucide-user" class="me-2" />
<span class="font-semibold">Tambah</span> Dokter
</div>
<div class="mb-5 border-b border-b-slate-300 pb-3 text-lg xl:text-xl">
<div class="flex flex-col justify-between">
<Block>
-20
View File
@@ -1,20 +0,0 @@
<script setup lang="ts">
function onEvent(type: string) {
if (type === 'cancel') {
navigateTo('/doctor')
} else if (type === 'draft') {
// do something
} else if (type === 'submit') {
// do something
}
}
const data = ref({
name: '',
specialization: '',
hospital: '',
})
</script>
<template>
<AppDoctorEntryForm v-model="data" @event="onEvent" />
</template>
-53
View File
@@ -1,53 +0,0 @@
<script setup lang="ts">
import type { HeaderPrep, RefSearchNav } from '~/components/pub/nav/types'
import Header from '~/components/pub/custom-ui/nav-header/prep.vue'
const data = ref([])
const refSearchNav: RefSearchNav = {
onClick: () => {
// open filter modal
},
onInput: (_val: string) => {
// filter patient list
},
onClear: () => {
// clear url param
},
}
const recId = ref<number>(0)
const recAction = ref<string>('')
const recItem = ref<any>(null)
const headerPrep: HeaderPrep = {
title: 'Dokter',
icon: 'i-lucide-network',
addNav: {
label: 'Tambah',
onClick: () => navigateTo('/doctor/add'),
},
}
useAsyncData('getDoctor', () => xfetch('/api/v1/doctor'), { server: false, immediate: true })
async function getDoctorList() {
const resp = await xfetch('/api/v1/doctor')
if (resp.success) {
data.value = (resp.body as Record<string, any>).data
}
}
onMounted(() => {
getDoctorList()
})
provide('rec_id', recId)
provide('rec_action', recAction)
provide('rec_item', recItem)
</script>
<template>
<Header :prep="{ ...headerPrep }" :ref-search-nav="refSearchNav" />
<AppDoctorList :data="data" />
</template>
+4
View File
@@ -1,5 +1,9 @@
<script setup lang="ts"></script>
<template>
<div class="mb-5 border-b border-b-slate-300 pb-3 text-lg xl:text-xl">
<Icon name="i-lucide-user" class="me-2" />
<span class="font-semibold">Tambah</span> Pasien
</div>
<AppPatientEntryForm />
</template>
+5
View File
@@ -19,6 +19,11 @@ function onClick(type: string) {
</script>
<template>
<div class="mb-5 border-b border-b-slate-300 pb-3 text-lg xl:text-xl">
<Icon name="i-lucide-user" class="me-2" />
<span class="font-semibold">Tambah</span> Dokter
</div>
<div>
<AppDoctorEntryForm v-model="data" />
</div>