-- =========================================================
-- 040_vendor_expense_permissions.sql
-- Seed permission Biaya Vendor
-- =========================================================

INSERT IGNORE INTO permissions (code, name, module, created_at) VALUES
('vendor_expenses.view','Lihat Biaya Vendor','vendor_expenses',NOW()),
('vendor_expenses.manage','Kelola Biaya Vendor','vendor_expenses',NOW());

INSERT IGNORE INTO role_permissions (role_id, permission_id)
SELECT r.id, p.id
FROM roles r
JOIN permissions p ON p.code IN (
  'vendor_expenses.view',
  'vendor_expenses.manage'
)
WHERE r.code IN ('owner','admin','kepala_toko');
