mirror of
https://gitlab.com/mbugroup/lti-web-client.git
synced 2026-05-24 07:15:44 +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) => (
|
{row.getVisibleCells().map((cell) => (
|
||||||
<td
|
<td
|
||||||
key={cell.id}
|
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())}
|
{flexRender(cell.column.columnDef.cell, cell.getContext())}
|
||||||
</td>
|
</td>
|
||||||
@@ -770,61 +770,49 @@ const HppPerKandangTab = () => {
|
|||||||
];
|
];
|
||||||
|
|
||||||
if (perWeightRangeSummary.length > 0) {
|
if (perWeightRangeSummary.length > 0) {
|
||||||
customRows.push(
|
perWeightRangeSummary.forEach(
|
||||||
<tr key={'summary-table-row'}>
|
(item: HppPerKandangPerWeightRange, index = 0) => {
|
||||||
<td
|
customRows.push(
|
||||||
colSpan={15}
|
<tr
|
||||||
className='p-0 border-l border-r border-gray-200'
|
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'
|
||||||
<table className='w-full'>
|
>
|
||||||
<tbody>
|
<td className=''>{index + 1}</td>
|
||||||
{perWeightRangeSummary.map(
|
<td className=''>ALL</td>
|
||||||
(item: HppPerKandangPerWeightRange, index = 0) => (
|
<td className=''>{item.label}</td>
|
||||||
<tr
|
<td className='text-right'>
|
||||||
key={`summary-${item.id}`}
|
{formatNumber(item.avg_weight_kg)}
|
||||||
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>
|
||||||
>
|
<td className='text-right'>
|
||||||
<td className=''>{index + 1}</td>
|
{formatNumber(item.remaining_chicken_birds)}
|
||||||
<td className=''>ALL</td>
|
</td>
|
||||||
<td className=''>{item.label}</td>
|
<td className='text-right'>
|
||||||
<td className='text-right'>
|
{formatNumber(item.remaining_chicken_weight_kg)}
|
||||||
{formatNumber(item.avg_weight_kg)}
|
</td>
|
||||||
</td>
|
<td className='text-right'>-</td>
|
||||||
<td className='text-right'>
|
<td className='text-right'>-</td>
|
||||||
{formatNumber(item.remaining_chicken_birds)}
|
<td className=''>
|
||||||
</td>
|
{item.feed_suppliers
|
||||||
<td className='text-right'>
|
?.map((s) => s.alias || s.name)
|
||||||
{formatNumber(item.remaining_chicken_weight_kg)}
|
.join(' | ') || '-'}
|
||||||
</td>
|
</td>
|
||||||
<td className='text-right'>-</td>
|
<td className=''>
|
||||||
<td className='text-right'>-</td>
|
{item.doc_suppliers
|
||||||
<td className=''>
|
?.map((s) => s.alias || s.name)
|
||||||
{item.feed_suppliers
|
.join(' | ') || '-'}
|
||||||
?.map((s: Supplier) => s.alias || s.name)
|
</td>
|
||||||
.join(' | ') || '-'}
|
<td className='text-right'>
|
||||||
</td>
|
{formatCurrency(item.average_doc_price_rp)}
|
||||||
<td className=''>
|
</td>
|
||||||
{item.doc_suppliers
|
<td className='text-right'>-</td>
|
||||||
?.map((s: Supplier) => s.alias || s.name)
|
<td className='text-right'>{formatCurrency(item.hpp_rp)}</td>
|
||||||
.join(' | ') || '-'}
|
<td className='text-right'>-</td>
|
||||||
</td>
|
<td className='text-right'>
|
||||||
<td className='text-right'>
|
{formatCurrency(item.remaining_value_rp)}
|
||||||
{formatCurrency(item.average_doc_price_rp)}
|
</td>
|
||||||
</td>
|
</tr>
|
||||||
<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>
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user