diff --git a/.env.example b/.env.example index 864bbbe6..fe23b810 100644 --- a/.env.example +++ b/.env.example @@ -3,3 +3,14 @@ NUXT_BPJS_API_ORIGIN= NUXT_API_VCLAIM_SWAGGER= # https://vclaim-api.multy.chat NUXT_SYNC_API_ORIGIN= NUXT_API_ORIGIN= + +SSO_CONFIRM_URL = + +X_AP_CODE=rssa-sso +X_AP_SECRET_KEY=sapiperah +KEYCLOAK_LOGOUT_REDIRECT=http://localhost:3000/ + +# test local +KEYCLOAK_REALM=rssa_testing +KEYCLOAK_URL=http://127.0.0.1:8080/ +CLIENT_ID=portal-simrs-new diff --git a/app/components/app/auth/login.vue b/app/components/app/auth/login.vue index 29fb60b4..bb87069b 100644 --- a/app/components/app/auth/login.vue +++ b/app/components/app/auth/login.vue @@ -3,6 +3,7 @@ import type { z } from 'zod' import { toTypedSchema } from '@vee-validate/zod' import { Loader2 } from 'lucide-vue-next' import { useForm } from 'vee-validate' +import { useKeycloak } from "~/composables/useKeycloack" interface Props { schema: z.ZodSchema @@ -13,6 +14,7 @@ const props = defineProps() const emit = defineEmits<{ submit: [data: any] + sso: [] }>() const { handleSubmit, defineField, errors, meta } = useForm({ @@ -33,6 +35,25 @@ const onSubmit = handleSubmit(async (values) => { console.error('Submission failed:', error) } }) + +const { initKeycloak, getProfile, loginSSO } = useKeycloak() +const profile = ref(null) + +onMounted(async () => { + await initKeycloak('check-sso') + profile.value = getProfile() + console.log(profile) +}) + +const onSSO = (async () => { + try { + const redirect = window.location.origin + '/auth/sso' + await loginSSO({ redirectUri: redirect }) + } catch (error) { + console.error('Call SSO failed:', error) + } +}); + diff --git a/app/components/app/patient/entry-form.vue b/app/components/app/patient/entry-form.vue index c2e187a5..34dd2a34 100644 --- a/app/components/app/patient/entry-form.vue +++ b/app/components/app/patient/entry-form.vue @@ -11,6 +11,7 @@ import { calculateAge } from '~/models/person' // components import * as DE from '~/components/pub/my-ui/doc-entry' import { InputBase, FileField as FileUpload } from '~/components/pub/my-ui/form' +import { Skeleton } from '~/components/pub/ui/skeleton' import { SelectBirthPlace } from '~/components/app/person/fields' import { InputName, @@ -60,10 +61,20 @@ interface PatientFormInput { interface Props { isReadonly: boolean + languageOptions?: { value: string; label: string }[] + ethnicOptions?: { value: string; label: string }[] initialValues?: PatientFormInput + mode?: 'add' | 'edit' + identityFileUrl?: string + familyCardFileUrl?: string } const props = defineProps() + +const emit = defineEmits<{ + (e: 'preview', url: string): void +}>() + const formSchema = toTypedSchema(PatientSchema) const { values, resetForm, setValues, setFieldValue, validate, setFieldError } = useForm({ @@ -208,6 +219,7 @@ watch( label="Suku" placeholder="Pilih suku bangsa" :is-disabled="isReadonly || values.nationality !== 'WNI'" + :items="ethnicOptions || []" /> - - +
+ + +
+ Dokumen Tersimpan +
+ Dokumen KTP + + +
+
+ + Lihat Dokumen +
+
+ + No Data +
+
+
+
+
+
+ + +
+ Dokumen Tersimpan +
+ Dokumen KK + + +
+
+ + Lihat Dokumen +
+
+ + No Data +
+
+
+
+
diff --git a/app/components/app/patient/fields/select-ethnicity.vue b/app/components/app/patient/fields/select-ethnicity.vue index 43ef6cba..73645441 100644 --- a/app/components/app/patient/fields/select-ethnicity.vue +++ b/app/components/app/patient/fields/select-ethnicity.vue @@ -6,6 +6,7 @@ import { cn } from '~/lib/utils' import * as DE from '~/components/pub/my-ui/doc-entry' const props = defineProps<{ + items: { value: string; label: string }[] fieldName?: string label?: string placeholder?: string @@ -28,23 +29,23 @@ const { labelClass, } = props -const ethnicOptions = [ - { label: 'Tidak diketahui', value: 'unknown', priority: 1 }, - { label: 'Jawa', value: 'jawa' }, - { label: 'Sunda', value: 'sunda' }, - { label: 'Batak', value: 'batak' }, - { label: 'Betawi', value: 'betawi' }, - { label: 'Minangkabau', value: 'minangkabau' }, - { label: 'Bugis', value: 'bugis' }, - { label: 'Madura', value: 'madura' }, - { label: 'Banjar', value: 'banjar' }, - { label: 'Bali', value: 'bali' }, - { label: 'Dayak', value: 'dayak' }, - { label: 'Aceh', value: 'aceh' }, - { label: 'Sasak', value: 'sasak' }, - { label: 'Papua', value: 'papua' }, - { label: 'Lainnya', value: 'lainnya', priority: -100 }, -] +// const ethnicOptions = [ +// { label: 'Tidak diketahui', value: 'unknown', priority: 1 }, +// { label: 'Jawa', value: 'jawa' }, +// { label: 'Sunda', value: 'sunda' }, +// { label: 'Batak', value: 'batak' }, +// { label: 'Betawi', value: 'betawi' }, +// { label: 'Minangkabau', value: 'minangkabau' }, +// { label: 'Bugis', value: 'bugis' }, +// { label: 'Madura', value: 'madura' }, +// { label: 'Banjar', value: 'banjar' }, +// { label: 'Bali', value: 'bali' }, +// { label: 'Dayak', value: 'dayak' }, +// { label: 'Aceh', value: 'aceh' }, +// { label: 'Sasak', value: 'sasak' }, +// { label: 'Papua', value: 'papua' }, +// { label: 'Lainnya', value: 'lainnya', priority: -100 }, +// ]