feat: implementar opcao 3 hibrida com acordeao inline e popup de componentes
This commit is contained in:
@@ -8,6 +8,7 @@ import { usePecas, Peca } from '@/hooks/usePecas';
|
||||
import { usePecasP4Listener } from '@/hooks/usePecasP4Listener';
|
||||
import { PecaForm } from '@/components/pecas/PecaForm';
|
||||
import { PecasTable } from '@/components/pecas/PecasTable';
|
||||
import { ComponentesPopup } from '@/components/pecas/ComponentesPopup';
|
||||
import { Package, Plus, RefreshCw } from 'lucide-react';
|
||||
import { usePermissionControl } from '@/hooks/usePermissionControl';
|
||||
|
||||
@@ -36,6 +37,7 @@ export default function CadastroPecas() {
|
||||
const [syncing, setSyncing] = useState(false);
|
||||
const [editingPeca, setEditingPeca] = useState<Peca | null>(null);
|
||||
const [showForm, setShowForm] = useState(false);
|
||||
const [selectedPecaForPopup, setSelectedPecaForPopup] = useState<Peca | null>(null);
|
||||
|
||||
const handleSave = async (formData: any) => {
|
||||
if (!canCreate()) return false;
|
||||
@@ -92,8 +94,12 @@ export default function CadastroPecas() {
|
||||
};
|
||||
|
||||
const handleOpenComponentPopup = (pecaId: string) => {
|
||||
console.log('Abrir popup de componentes para peça:', pecaId);
|
||||
toast.info('Funcionalidade de componentes será implementada em breve');
|
||||
const found = pecas.find(p => p.id === pecaId);
|
||||
if (found) {
|
||||
setSelectedPecaForPopup(found);
|
||||
} else {
|
||||
toast.error('Peça não encontrada');
|
||||
}
|
||||
};
|
||||
|
||||
const handleImportPecas = async (pecasData: any[]) => {
|
||||
@@ -235,6 +241,18 @@ export default function CadastroPecas() {
|
||||
/>
|
||||
</CardContent>
|
||||
</Card>
|
||||
|
||||
{/* Modal de Gerenciamento de Componentes */}
|
||||
{selectedPecaForPopup && (
|
||||
<ComponentesPopup
|
||||
isOpen={!!selectedPecaForPopup}
|
||||
onClose={() => {
|
||||
setSelectedPecaForPopup(null);
|
||||
loadPecas();
|
||||
}}
|
||||
peca={selectedPecaForPopup}
|
||||
/>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user