-- ACTIVITY AND ACTION INSERT QUERY

INSERT INTO `tblin_app_activity_events` (`module_name`, `event_key`, `message`, `icon`, `priority`, `is_actionable`, `web_redirection`, `mobile_redirection`, `filters`, `added_by`, `added_on`, `updated_by`, `updated_on`) VALUES ('custom', 'send_us_testimonial_video', 'Send us a testimonial video for $150 (today only)', 'general-activity.svg', 1, 0, 'https://forms.gle/CLH1ntunJgJbg5Vy8', '{"type":"external_webview","external_webview":{"external_webview_url":"https://forms.gle/CLH1ntunJgJbg5Vy8"}}', NULL, NULL, UTC_TIMESTAMP(), NULL, UTC_TIMESTAMP());

SET @last_activity_insert_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 (@last_activity_insert_id, "see_requirements","See Requirements", "general-activity.svg", '', "https://forms.gle/CLH1ntunJgJbg5Vy8",'{"type":"external_webview","external_webview":{"external_webview_url":"https://forms.gle/CLH1ntunJgJbg5Vy8"}}',UTC_TIMESTAMP(),UTC_TIMESTAMP());
INSERT INTO tblin_app_activity_actions (activity_event_id, action_name, action_label, icon, permission, web_redirection, mobile_redirection, added_on, updated_on) VALUES (@last_activity_insert_id, "upload_video","Upload Video", "general-activity.svg", '', "https://forms.gle/CLH1ntunJgJbg5Vy8",'{"type":"external_webview","external_webview":{"external_webview_url":"https://forms.gle/CLH1ntunJgJbg5Vy8"}}',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, 'send_us_testimonial_video', 1, 'Send us a testimonial video for $150 (today only)', 0, 1, '', 0, 0, NULL, 'staff', st.staffid, UTC_TIMESTAMP(), UTC_TIMESTAMP(), UTC_TIMESTAMP()
FROM  tbltenants t  
LEFT JOIN tblstaff st ON st.tenant_id = t.id and st.is_tenant = 1
LEFT JOIN tbltenant_plan_information tpi ON t.id = tpi.tenant_id
WHERE t.pro_plan_id IN (10,11,12,14,15) AND tpi.is_plan_expired != 1;