feat: correcao de deteccao de monopeças no conversor e estilizacao de pecas simples na tabela
This commit is contained in:
@@ -518,12 +518,12 @@ const AdvanceSteelConverterContent: React.FC = () => {
|
||||
}
|
||||
|
||||
if (currentAssembly) {
|
||||
const isSubComp =
|
||||
itemMark === '-' ||
|
||||
isComponente(itemMark) ||
|
||||
itemMark.includes('-100') ||
|
||||
itemMark.includes('-10') ||
|
||||
(itemMark.match(/-\d+$/) && parseInt(itemMark.match(/-(\d+)$/)![1], 10) >= (labels.faixaComponenteMin || 1000));
|
||||
// Extrai o número final da marca do item (ex: de "B134-13-1" -> 1, de "B134-13-1000" -> 1000, de "B133-13-1015" -> 1015, de "1000" -> 1000)
|
||||
const lastNumberMatch = itemMark.match(/(?:^|-)(\d+)$/);
|
||||
const itemNum = lastNumberMatch ? parseInt(lastNumberMatch[1], 10) : (parseInt(itemMark, 10) || 0);
|
||||
|
||||
// Um item é SUBCOMPONENTE apenas se sua numeração de marca for >= faixaComponenteMin (1000) OU se for explicitamente '-'
|
||||
const isSubComp = itemMark === '-' || itemNum >= (labels.faixaComponenteMin || 1000);
|
||||
|
||||
if (isSubComp) {
|
||||
currentAssembly.isComposed = 'SIM';
|
||||
|
||||
@@ -72,8 +72,8 @@ export function TableHeaderSortable({
|
||||
<SortButton field="prioridade">Prioridade</SortButton>
|
||||
</TableHead>
|
||||
|
||||
<TableHead className="w-16 px-2 text-center">
|
||||
<SortButton field="tem_componentes">Tipo / {labels.componenteLabel}</SortButton>
|
||||
<TableHead className="w-24 px-2 text-center">
|
||||
<SortButton field="tem_componentes">Componentes</SortButton>
|
||||
</TableHead>
|
||||
|
||||
<TableHead className="w-12 px-2 text-right">
|
||||
|
||||
@@ -13,7 +13,8 @@ import {
|
||||
ChevronDown,
|
||||
Layers,
|
||||
Loader2,
|
||||
ExternalLink
|
||||
ExternalLink,
|
||||
Minus
|
||||
} from 'lucide-react';
|
||||
import { Peca } from '@/hooks/usePecas';
|
||||
import { useComponentesPeca } from '@/hooks/useComponentesPeca';
|
||||
@@ -110,11 +111,14 @@ export function TableRow({
|
||||
<PriorityBadge prioridade={peca.prioridade as any} />
|
||||
</TableCell>
|
||||
|
||||
<TableCell className="w-16 px-2 text-center">
|
||||
<div className="flex justify-center">
|
||||
<TableCell className="w-24 px-2 text-center">
|
||||
<div className="flex justify-center items-center">
|
||||
{!peca.tem_componentes ? (
|
||||
<div className="flex items-center justify-center w-5 h-5 bg-green-500 rounded-full shadow-sm" title="Monopeça (sem componentes)">
|
||||
<Check className="h-3 w-3 text-white font-bold" />
|
||||
<div
|
||||
className="flex items-center justify-center w-5 h-5 rounded-full bg-slate-800/90 border border-slate-700 text-slate-400 shadow-sm"
|
||||
title="Peça única (sem componentes)"
|
||||
>
|
||||
<Minus className="h-3 w-3 text-slate-400 font-bold" />
|
||||
</div>
|
||||
) : (
|
||||
<div
|
||||
|
||||
Reference in New Issue
Block a user