-- 2026-04-16
-- Financeiro no primeiro nivel do menu admin
-- Objetivos:
-- 1) manter portais no topo e TIIX logo em seguida
-- 2) promover Financeiro como root real de primeiro nivel
-- 3) preservar slugs e permissoes existentes do bloco financeiro
-- 4) manter Comissoes agrupado em Negocio para evitar inflar a mini-nav

START TRANSACTION;

SET @menu_id = 35;

UPDATE wpjy_menus_items
   SET parent = 0,
       sort = CASE id
         WHEN 531 THEN 0
         WHEN 542 THEN 1
         WHEN 714 THEN 2
         WHEN 387 THEN 3
         WHEN 504 THEN 4
         WHEN 740 THEN 5
         WHEN 633 THEN 6
         WHEN 553 THEN 7
         WHEN 599 THEN 10
         WHEN 670 THEN 11
         WHEN 551 THEN 12
         WHEN 697 THEN 13
         WHEN 552 THEN 14
         ELSE sort
       END
 WHERE menu = @menu_id
   AND id IN (531, 542, 714, 387, 504, 740, 633, 553, 599, 670, 551, 697, 552);

UPDATE wpjy_menus_items
   SET parent = 551,
       sort = 8
 WHERE menu = @menu_id
   AND id = 554;

COMMIT;

SELECT id, label, parent, sort, slug
  FROM wpjy_menus_items
 WHERE menu = @menu_id
   AND parent = 0
 ORDER BY sort, id;

SELECT id, label, parent, sort, slug
  FROM wpjy_menus_items
 WHERE menu = @menu_id
   AND id IN (531, 542, 714, 387, 504, 740, 633, 553, 554, 599, 670, 551, 697, 552)
 ORDER BY parent, sort, id;
