mirror of
https://gitlab.com/mbugroup/lti-web-client.git
synced 2026-05-24 15:25:46 +00:00
refactor(FE-440): Use styled HTML tables for FCR and mortality
This commit is contained in:
@@ -1538,170 +1538,141 @@ const RecordingForm = ({ type = 'add', initialValues }: RecordingFormProps) => {
|
|||||||
</Card>
|
</Card>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
{/* FCR & Mortality Metrics - Detail View Only - Grid Layout */}
|
{/* FCR & Mortality Metrics - Detail View Only */}
|
||||||
{type === 'detail' && initialValues && (
|
{type === 'detail' && initialValues && (
|
||||||
<div className='grid grid-cols-2 gap-6 mb-6'>
|
<div className='grid grid-cols-2 gap-6 mb-6'>
|
||||||
{/* FCR Metrics */}
|
{/* FCR Section */}
|
||||||
<div className='flex flex-col gap-2'>
|
<div className='border border-gray-200 rounded-lg bg-white'>
|
||||||
<p className='text-sm font-medium'>FCR</p>
|
<div className='px-4 py-3 border-b border-gray-200'>
|
||||||
<Table
|
<span className='card-title font-bold text-xl'>FCR</span>
|
||||||
data={[
|
</div>
|
||||||
{
|
<div className='p-4'>
|
||||||
label: 'Bobot',
|
<table className='w-full text-sm'>
|
||||||
aktual: initialValues.avg_daily_gain?.toFixed(2) || '-',
|
<thead>
|
||||||
standar: '-',
|
<tr className='border-b border-gray-200'>
|
||||||
totalPakan: formatNumber(initialValues.cum_intake || 0),
|
<th className='text-left py-2 font-semibold text-gray-600'></th>
|
||||||
},
|
<th className='text-center py-2 font-semibold text-gray-600'>
|
||||||
{
|
AKTUAL
|
||||||
label: 'FCR',
|
</th>
|
||||||
aktual: initialValues.fcr_value?.toFixed(2) || '-',
|
<th className='text-center py-2 font-semibold text-gray-600'>
|
||||||
standar: '-',
|
STANDAR
|
||||||
totalPakan: '',
|
</th>
|
||||||
},
|
<th className='text-center py-2 font-semibold text-gray-600'>
|
||||||
]}
|
TOTAL PEMAKAIAN PAKAN (KG)
|
||||||
columns={[
|
</th>
|
||||||
{
|
</tr>
|
||||||
accessorKey: 'label',
|
</thead>
|
||||||
header: '',
|
<tbody>
|
||||||
cell: (props) => (
|
<tr className='border-b border-gray-100'>
|
||||||
<span className='font-medium'>
|
<td className='py-3 font-medium'>Bobot</td>
|
||||||
{props.row.original.label}
|
<td className='text-center py-3'>
|
||||||
</span>
|
<span className='font-semibold'>
|
||||||
),
|
{initialValues.avg_daily_gain?.toFixed(2) || '-'}
|
||||||
},
|
</span>
|
||||||
{
|
</td>
|
||||||
accessorKey: 'aktual',
|
<td className='text-center py-3 text-gray-600'>-</td>
|
||||||
header: 'Aktual',
|
<td className='text-center py-3 text-gray-600'>
|
||||||
cell: (props) => (
|
{formatNumber(initialValues.cum_intake || 0)}
|
||||||
<span className='font-semibold'>
|
</td>
|
||||||
{props.row.original.aktual}
|
</tr>
|
||||||
</span>
|
<tr>
|
||||||
),
|
<td className='py-3 font-medium'>FCR</td>
|
||||||
},
|
<td className='text-center py-3'>
|
||||||
{
|
<span className='font-semibold'>
|
||||||
accessorKey: 'standar',
|
{initialValues.fcr_value?.toFixed(2) || '-'}
|
||||||
header: 'Standar',
|
</span>
|
||||||
cell: (props) => (
|
</td>
|
||||||
<span>{props.row.original.standar}</span>
|
<td className='text-center py-3 text-gray-600'>-</td>
|
||||||
),
|
<td className='text-center py-3'></td>
|
||||||
},
|
</tr>
|
||||||
{
|
</tbody>
|
||||||
accessorKey: 'totalPakan',
|
</table>
|
||||||
header: 'Total Pemakaian Pakan (KG)',
|
</div>
|
||||||
cell: (props) => (
|
|
||||||
<span>{props.row.original.totalPakan}</span>
|
|
||||||
),
|
|
||||||
},
|
|
||||||
]}
|
|
||||||
pageSize={2}
|
|
||||||
className={{
|
|
||||||
containerClassName: 'mb-0',
|
|
||||||
paginationClassName: 'hidden',
|
|
||||||
}}
|
|
||||||
/>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{/* Mortality Metrics */}
|
{/* Mortality Section */}
|
||||||
<div className='flex flex-col gap-2'>
|
<div className='border border-gray-200 rounded-lg bg-white'>
|
||||||
<p className='text-sm font-medium'>Mortalitas</p>
|
<div className='px-4 py-3 border-b border-gray-200'>
|
||||||
<Table
|
<span className='card-title font-bold text-xl'>
|
||||||
data={[
|
Mortalitas
|
||||||
{
|
</span>
|
||||||
jumlahAyamTotal: formatNumber(
|
</div>
|
||||||
initialValues.total_chick_qty || 0
|
<div className='p-4'>
|
||||||
),
|
<table className='w-full text-sm'>
|
||||||
jumlahAyamPct: '-',
|
<thead>
|
||||||
deplesiHarianTotal: formatNumber(
|
<tr className='border-b border-gray-200'>
|
||||||
initialValues.daily_gain || 0
|
<th
|
||||||
),
|
colSpan={2}
|
||||||
deplesiHarianPct: '-',
|
className='text-center py-2 font-semibold text-gray-600 border-r border-gray-200'
|
||||||
deplesiKumulatifTotal: formatNumber(
|
>
|
||||||
initialValues.total_depletion_qty || 0
|
JUMLAH AYAM
|
||||||
),
|
</th>
|
||||||
deplesiKumulatifPct:
|
<th
|
||||||
initialValues.cum_depletion_rate?.toFixed(2) || '-',
|
colSpan={2}
|
||||||
},
|
className='text-center py-2 font-semibold text-gray-600 border-r border-gray-200'
|
||||||
]}
|
>
|
||||||
columns={[
|
DEPLESI HARIAN
|
||||||
{
|
</th>
|
||||||
id: 'jumlah-ayam',
|
<th
|
||||||
header: 'Jumlah Ayam',
|
colSpan={2}
|
||||||
columns: [
|
className='text-center py-2 font-semibold text-gray-600'
|
||||||
{
|
>
|
||||||
accessorKey: 'jumlahAyamTotal',
|
DEPLESI KUMULATIF
|
||||||
header: 'Total',
|
</th>
|
||||||
cell: (props) => (
|
</tr>
|
||||||
<span className='font-semibold text-center block w-full'>
|
<tr className='border-b border-gray-200'>
|
||||||
{props.row.original.jumlahAyamTotal}
|
<th className='text-center py-2 font-semibold text-xs text-gray-500'>
|
||||||
</span>
|
Total
|
||||||
),
|
</th>
|
||||||
},
|
<th className='text-center py-2 font-semibold text-xs text-gray-500 border-r border-gray-200'>
|
||||||
{
|
(%)
|
||||||
accessorKey: 'jumlahAyamPct',
|
</th>
|
||||||
header: '(%)',
|
<th className='text-center py-2 font-semibold text-xs text-gray-500'>
|
||||||
cell: (props) => (
|
Total
|
||||||
<span className='text-center block w-full'>
|
</th>
|
||||||
{props.row.original.jumlahAyamPct}
|
<th className='text-center py-2 font-semibold text-xs text-gray-500 border-r border-gray-200'>
|
||||||
</span>
|
(%)
|
||||||
),
|
</th>
|
||||||
},
|
<th className='text-center py-2 font-semibold text-xs text-gray-500'>
|
||||||
],
|
Total
|
||||||
},
|
</th>
|
||||||
{
|
<th className='text-center py-2 font-semibold text-xs text-gray-500'>
|
||||||
id: 'deplesi-harian',
|
(%)
|
||||||
header: 'Deplesi Harian',
|
</th>
|
||||||
columns: [
|
</tr>
|
||||||
{
|
</thead>
|
||||||
accessorKey: 'deplesiHarianTotal',
|
<tbody>
|
||||||
header: 'Total',
|
<tr>
|
||||||
cell: (props) => (
|
<td className='text-center py-3 border-r border-gray-100'>
|
||||||
<span className='font-semibold text-center block w-full'>
|
<span className='font-semibold'>
|
||||||
{props.row.original.deplesiHarianTotal}
|
{formatNumber(initialValues.total_chick_qty || 0)}
|
||||||
</span>
|
</span>
|
||||||
),
|
</td>
|
||||||
},
|
<td className='text-center py-3 border-r border-gray-200 text-gray-600'>
|
||||||
{
|
-
|
||||||
accessorKey: 'deplesiHarianPct',
|
</td>
|
||||||
header: '(%)',
|
<td className='text-center py-3 border-r border-gray-100'>
|
||||||
cell: (props) => (
|
<span className='font-semibold'>
|
||||||
<span className='text-center block w-full'>
|
{formatNumber(initialValues.daily_gain || 0)}
|
||||||
{props.row.original.deplesiHarianPct}
|
</span>
|
||||||
</span>
|
</td>
|
||||||
),
|
<td className='text-center py-3 border-r border-gray-200 text-gray-600'>
|
||||||
},
|
-
|
||||||
],
|
</td>
|
||||||
},
|
<td className='text-center py-3 border-r border-gray-100'>
|
||||||
{
|
<span className='font-semibold'>
|
||||||
id: 'deplesi-kumulatif',
|
{formatNumber(
|
||||||
header: 'Deplesi Kumulatif',
|
initialValues.total_depletion_qty || 0
|
||||||
columns: [
|
)}
|
||||||
{
|
</span>
|
||||||
accessorKey: 'deplesiKumulatifTotal',
|
</td>
|
||||||
header: 'Total',
|
<td className='text-center py-3 text-gray-600'>
|
||||||
cell: (props) => (
|
{initialValues.cum_depletion_rate?.toFixed(2) || '-'}
|
||||||
<span className='font-semibold text-center block w-full'>
|
</td>
|
||||||
{props.row.original.deplesiKumulatifTotal}
|
</tr>
|
||||||
</span>
|
</tbody>
|
||||||
),
|
</table>
|
||||||
},
|
</div>
|
||||||
{
|
|
||||||
accessorKey: 'deplesiKumulatifPct',
|
|
||||||
header: '(%)',
|
|
||||||
cell: (props) => (
|
|
||||||
<span className='text-center block w-full'>
|
|
||||||
{props.row.original.deplesiKumulatifPct}
|
|
||||||
</span>
|
|
||||||
),
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
|
||||||
]}
|
|
||||||
pageSize={1}
|
|
||||||
className={{
|
|
||||||
containerClassName: 'mb-0',
|
|
||||||
paginationClassName: 'hidden',
|
|
||||||
}}
|
|
||||||
/>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
|
|||||||
Reference in New Issue
Block a user