-- ACTIVITY AND ACTION INSERT QUERY

INSERT INTO `tblin_app_activity_events` (`module_name`, `event_key`, `message`, `icon`, `priority`, `is_actionable`, `web_redirection`, `mobile_redirection`, `added_by`, `added_on`, `updated_by`, `updated_on`) VALUES ('custom', 'we_need_your_opinion_gps_tracking_solution_survey', 'We need your opinion! GPS Tracking Solution Survey.', 'general-activity.svg', 0, 1, 'https://forms.gle/VNM8ZYrgRvxNYDdZA', '{"type":"external_webview","external_webview":{"external_webview_url":"https:\\/\\/forms.gle\\/VNM8ZYrgRvxNYDdZA"}}', NULL, UTC_TIMESTAMP(), NULL, UTC_TIMESTAMP());

SET @activity_id = LAST_INSERT_ID();

INSERT INTO `tblin_app_activity_actions` (`activity_event_id`, `action_name`, `action_label`, `icon`, `permission`, `web_redirection`, `mobile_redirection`, `added_on`, `updated_on`) VALUES (@activity_id, 'submit_survey', 'Submit Survey', 'general-activity.svg', '', 'https://forms.gle/VNM8ZYrgRvxNYDdZA', '{"type":"external_webview","external_webview":{"external_webview_url":"https:\\/\\/forms.gle\\/VNM8ZYrgRvxNYDdZA"}}', UTC_TIMESTAMP(), UTC_TIMESTAMP());

-- IAN INSERT QUERY

INSERT INTO tblin_app_logs(`tenant_id`, `staff_id`, `for`, `client_id`, `rel_type`, `rel_id`, `action`, `priority`, `description`, `marked_as_read`, `is_actionable_item`, `actionable_item_title`, `marked_as_done`, `is_item_deleted`, `additional_data`, `action_performed_by`, `action_performed_by_id`, `display_on`, `added_on`, `modified_on`)
Select st.tenant_id, st.staffid, 'tenant', NULL, 'custom', NULL, 'we_need_your_opinion_gps_tracking_solution_survey', 0, 'We need your opinion! GPS Tracking Solution Survey.', 0, 1, '', 0, 0, NULL, 'staff', st.staffid, UTC_TIMESTAMP(), UTC_TIMESTAMP(), UTC_TIMESTAMP()
FROM  tbltenants t  
JOIN tblstaff st ON st.tenant_id = t.id and st.is_tenant = 1;