

INSERT INTO `ohrm_user_role` (`name`, `display_name`, `is_assignable`, `is_predefined`) VALUES 
('SupervisorLevel1', 'Supervisor Level 1', 0, 1);
INSERT INTO `ohrm_user_role` (`name`, `display_name`, `is_assignable`, `is_predefined`) VALUES 
('SupervisorLevel2', 'Supervisor Level 2', 0, 1);

-- Add User Roles menu item.

SET @admin_role_id := (SELECT `id` FROM ohrm_user_role WHERE `name` = 'Admin');    
SET @admin_module_id := (SELECT `id` FROM `ohrm_module` WHERE `name` = 'admin');  

INSERT INTO ohrm_screen (`name`, `module_id`, `action_url`) VALUES  
('View User Roles', @admin_module_id, 'viewUserRoles');    
SET @view_user_roles_screen_id := (SELECT LAST_INSERT_ID());  
  
INSERT INTO ohrm_screen (`name`, `module_id`, `action_url`) VALUES  
('Save User Role', @admin_module_id, 'saveUserRole');    
SET @save_user_role_screen_id := (SELECT LAST_INSERT_ID()); 

INSERT INTO ohrm_screen (`name`, `module_id`, `action_url`) VALUES  
('Delete User Roles', @admin_module_id, 'deleteUserRoles');    
SET @delete_user_roles_screen_id := (SELECT LAST_INSERT_ID());    
  
SET @admin_menu_id := (SELECT `id` FROM ohrm_menu_item WHERE `menu_title` = 'Admin' AND `level` = 1);  
SET @user_managemenbt_menu_id := (SELECT `id` FROM ohrm_menu_item WHERE `menu_title` = 'User Management' AND `level` = 2 AND `parent_id` = @admin_menu_id);  
   
INSERT INTO ohrm_menu_item (`menu_title`, `screen_id`, `parent_id`, `level`, `order_hint`, `url_extras`, `status`) VALUES  
('User Roles', @view_user_roles_screen_id, @user_managemenbt_menu_id, 3, 100, '', 0);  
  
INSERT INTO ohrm_user_role_screen (user_role_id, screen_id, can_read, can_create, can_update, can_delete) VALUES  
(@admin_role_id, @view_user_roles_screen_id, 1, 1, 1, 1),  
(@admin_role_id, @delete_user_roles_screen_id, 1, 0, 0, 1), 
(@admin_role_id, @save_user_role_screen_id, 1, 1, 1, 1);