mirror of
https://gitlab.com/mbugroup/lti-web-client.git
synced 2026-05-20 13:32:00 +00:00
refactor(FE-355): Render weight-range summaries as table rows
This commit is contained in:
@@ -747,7 +747,7 @@ const HppPerKandangTab = () => {
|
||||
{row.getVisibleCells().map((cell) => (
|
||||
<td
|
||||
key={cell.id}
|
||||
className='px-4 py-3 text-xs text-gray-900 whitespace-nowrap border border-gray-200'
|
||||
className='px-4 py-3 text-xs text-gray-900 whitespace-nowrap border-gray-200'
|
||||
>
|
||||
{flexRender(cell.column.columnDef.cell, cell.getContext())}
|
||||
</td>
|
||||
@@ -770,61 +770,49 @@ const HppPerKandangTab = () => {
|
||||
];
|
||||
|
||||
if (perWeightRangeSummary.length > 0) {
|
||||
customRows.push(
|
||||
<tr key={'summary-table-row'}>
|
||||
<td
|
||||
colSpan={15}
|
||||
className='p-0 border-l border-r border-gray-200'
|
||||
>
|
||||
<table className='w-full'>
|
||||
<tbody>
|
||||
{perWeightRangeSummary.map(
|
||||
(item: HppPerKandangPerWeightRange, index = 0) => (
|
||||
<tr
|
||||
key={`summary-${item.id}`}
|
||||
className='hover:bg-gray-50 transition-colors border-b border-gray-200 [&_td]:px-4 [&_td]:py-3 [&_td]:text-xs [&_td]:text-gray-900 [&_td]:whitespace-nowrap [&_td]:border [&_td]:border-gray-200'
|
||||
>
|
||||
<td className=''>{index + 1}</td>
|
||||
<td className=''>ALL</td>
|
||||
<td className=''>{item.label}</td>
|
||||
<td className='text-right'>
|
||||
{formatNumber(item.avg_weight_kg)}
|
||||
</td>
|
||||
<td className='text-right'>
|
||||
{formatNumber(item.remaining_chicken_birds)}
|
||||
</td>
|
||||
<td className='text-right'>
|
||||
{formatNumber(item.remaining_chicken_weight_kg)}
|
||||
</td>
|
||||
<td className='text-right'>-</td>
|
||||
<td className='text-right'>-</td>
|
||||
<td className=''>
|
||||
{item.feed_suppliers
|
||||
?.map((s: Supplier) => s.alias || s.name)
|
||||
.join(' | ') || '-'}
|
||||
</td>
|
||||
<td className=''>
|
||||
{item.doc_suppliers
|
||||
?.map((s: Supplier) => s.alias || s.name)
|
||||
.join(' | ') || '-'}
|
||||
</td>
|
||||
<td className='text-right'>
|
||||
{formatCurrency(item.average_doc_price_rp)}
|
||||
</td>
|
||||
<td className='text-right'>
|
||||
{formatCurrency(item.hpp_rp)}
|
||||
</td>
|
||||
<td className='text-right'>-</td>
|
||||
<td className='text-right'>
|
||||
{formatCurrency(item.remaining_value_rp)}
|
||||
</td>
|
||||
</tr>
|
||||
)
|
||||
)}
|
||||
</tbody>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
perWeightRangeSummary.forEach(
|
||||
(item: HppPerKandangPerWeightRange, index = 0) => {
|
||||
customRows.push(
|
||||
<tr
|
||||
key={`summary-${item.id}`}
|
||||
className='hover:bg-gray-50 transition-colors border-b border-l border-r border-b-gray-200 border-l-gray-200 border-r-gray-200 [&_td]:px-4 [&_td]:py-3 [&_td]:text-xs [&_td]:text-gray-900 [&_td]:whitespace-nowrap'
|
||||
>
|
||||
<td className=''>{index + 1}</td>
|
||||
<td className=''>ALL</td>
|
||||
<td className=''>{item.label}</td>
|
||||
<td className='text-right'>
|
||||
{formatNumber(item.avg_weight_kg)}
|
||||
</td>
|
||||
<td className='text-right'>
|
||||
{formatNumber(item.remaining_chicken_birds)}
|
||||
</td>
|
||||
<td className='text-right'>
|
||||
{formatNumber(item.remaining_chicken_weight_kg)}
|
||||
</td>
|
||||
<td className='text-right'>-</td>
|
||||
<td className='text-right'>-</td>
|
||||
<td className=''>
|
||||
{item.feed_suppliers
|
||||
?.map((s) => s.alias || s.name)
|
||||
.join(' | ') || '-'}
|
||||
</td>
|
||||
<td className=''>
|
||||
{item.doc_suppliers
|
||||
?.map((s) => s.alias || s.name)
|
||||
.join(' | ') || '-'}
|
||||
</td>
|
||||
<td className='text-right'>
|
||||
{formatCurrency(item.average_doc_price_rp)}
|
||||
</td>
|
||||
<td className='text-right'>-</td>
|
||||
<td className='text-right'>{formatCurrency(item.hpp_rp)}</td>
|
||||
<td className='text-right'>-</td>
|
||||
<td className='text-right'>
|
||||
{formatCurrency(item.remaining_value_rp)}
|
||||
</td>
|
||||
</tr>
|
||||
);
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user