-- Set names to allow Chinese characters
SET NAMES utf8mb4;

-- 1. RFQ query button under menu 2003
INSERT INTO sys_menu (menu_id, menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, remark)
VALUES (2103, 'RFQ查看', 2003, 1, '#', NULL, 1, 0, 'F', '0', '0', 'bid:rfq:query', '#', 'admin', NOW(), '');

-- 2. Quotation permission buttons under menu 2004
INSERT INTO sys_menu (menu_id, menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, remark)
VALUES (2104, '报价查看', 2004, 1, '#', NULL, 1, 0, 'F', '0', '0', 'bid:quotation:query', '#', 'admin', NOW(), '');

INSERT INTO sys_menu (menu_id, menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, remark)
VALUES (2105, '报价新增', 2004, 2, '#', NULL, 1, 0, 'F', '0', '0', 'bid:quotation:add', '#', 'admin', NOW(), '');

INSERT INTO sys_menu (menu_id, menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, remark)
VALUES (2106, '报价编辑', 2004, 3, '#', NULL, 1, 0, 'F', '0', '0', 'bid:quotation:edit', '#', 'admin', NOW(), '');

-- 3. Assign to supplier role
INSERT INTO sys_role_menu (role_id, menu_id)
SELECT 3, menu_id FROM sys_menu WHERE menu_id IN (2103, 2104, 2105, 2106);

-- Verify
SELECT 'SUPPLIER PERMS' as info;
SELECT menu_id, menu_name, perms FROM sys_menu WHERE menu_id >= 2103 ORDER BY menu_id;
SELECT 'ROLE-MENU COUNT' as info;
SELECT group_concat(menu_id) AS menus FROM sys_role_menu WHERE role_id=3;
