Add new content components for unit, division, and installation with list views, entry forms, and validation schemas. Replace Flow*List components with Content*List components in org-src pages. Includes pagination, search functionality, and CRUD operations for each entity type.
59 lines
1.8 KiB
TypeScript
59 lines
1.8 KiB
TypeScript
import * as z from 'zod'
|
|
|
|
export const division = {
|
|
msg: {
|
|
placeholder: '---pilih divisi utama',
|
|
search: 'kode, nama divisi',
|
|
empty: 'divisi tidak ditemukan',
|
|
},
|
|
items: [
|
|
{ value: '1', label: 'Medical', code: 'MED' },
|
|
{ value: '2', label: 'Nursing', code: 'NUR' },
|
|
{ value: '3', label: 'Admin', code: 'ADM' },
|
|
{ value: '4', label: 'Support', code: 'SUP' },
|
|
{ value: '5', label: 'Education', code: 'EDU' },
|
|
{ value: '6', label: 'Pharmacy', code: 'PHA' },
|
|
{ value: '7', label: 'Radiology', code: 'RAD' },
|
|
{ value: '8', label: 'Laboratory', code: 'LAB' },
|
|
{ value: '9', label: 'Finance', code: 'FIN' },
|
|
{ value: '10', label: 'Human Resources', code: 'HR' },
|
|
{ value: '11', label: 'IT Services', code: 'ITS' },
|
|
{ value: '12', label: 'Maintenance', code: 'MNT' },
|
|
{ value: '13', label: 'Catering', code: 'CAT' },
|
|
{ value: '14', label: 'Security', code: 'SEC' },
|
|
{ value: '15', label: 'Emergency', code: 'EMR' },
|
|
{ value: '16', label: 'Surgery', code: 'SUR' },
|
|
{ value: '17', label: 'Outpatient', code: 'OUT' },
|
|
{ value: '18', label: 'Inpatient', code: 'INP' },
|
|
{ value: '19', label: 'Rehabilitation', code: 'REB' },
|
|
{ value: '20', label: 'Research', code: 'RSH' },
|
|
],
|
|
}
|
|
|
|
export const schema = z.object({
|
|
name: z.string({
|
|
required_error: 'Nama wajib diisi',
|
|
}).min(1, 'Nama divisi wajib diisi'),
|
|
|
|
code: z.string({
|
|
required_error: 'Kode wajib diisi',
|
|
}).min(1, 'Kode divisi wajib diisi'),
|
|
|
|
parentId: z.preprocess(
|
|
(input: unknown) => {
|
|
if (typeof input === 'string') {
|
|
// Handle empty string case
|
|
if (input.trim() === '') {
|
|
return undefined
|
|
}
|
|
return Number(input)
|
|
}
|
|
|
|
return input
|
|
},
|
|
z.number({
|
|
required_error: 'Kelompok wajib dipilih',
|
|
}).min(1, 'Kelompok wajib dipilih'),
|
|
),
|
|
})
|