wip: init form entry education assessment

import clinical const from sheets

wip: form entry add education assessment

done: checkbox

wip: add select Asesmen Kemampuan dan Kemauan Belajar
This commit is contained in:
Khafid Prayoga
2025-10-21 11:21:06 +07:00
parent 27ab7c2e83
commit 736e951f33
12 changed files with 600 additions and 1 deletions
+13 -1
View File
@@ -7,6 +7,10 @@ export interface SelectOptionType<_T = string> {
label: string
code?: string
}
export interface CheckItem {
id: string
label: string
}
export function cn(...inputs: ClassValue[]) {
return twMerge(clsx(inputs))
@@ -27,6 +31,15 @@ export function mapToComboboxOptList(items: Record<string, string>): SelectOptio
return result
}
export function mapToCheckItems<T extends Record<string, string>, K extends keyof T & string>(
items: T,
): { id: K; label: T[K] }[] {
return Object.entries(items).map(([key, value]) => ({
id: key as K,
label: value as T[K],
}))
}
/**
* Mengkonversi string menjadi title case (huruf pertama setiap kata kapital)
* @param str - String yang akan dikonversi
@@ -36,7 +49,6 @@ export function toTitleCase(str: string): string {
return str.toLowerCase().replace(/\b\w/g, (char) => char.toUpperCase())
}
/**
* Menghitung umur berdasarkan tanggal lahir
* @param birthDate - Tanggal lahir dalam format Date atau string