-- 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', 'our_new_contractor_pay_platform_ships_july_21st_2024_action_required', 'Our new Contractor+ Pay platform ships July 21st, 2024, action required.', 'general-activity.svg', 0, 1, 'https://my.contractorplus.app/settings?group=payments', '{"type":"internal_webview","internal_webview":{"showHeader":"1","title":"Payment Settings","internal_webview_url":"{base_url}\\/settings-web\\/manage-pg\\/{webview_token_prefix}{webview_token}","contrefresh":"1"}}', 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, 'watch_intro_video', 'Watch Intro Video', 'general-activity.svg', '', 'https://www.youtube.com/watch?v=drpAao54LG4', '{"type":"external_webview","external_webview":{"external_webview_url":"https:\\/\\/www.youtube.com\\/watch?v=drpAao54LG4"}}', 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 (@activity_id, 'submit_application', 'Submit Application', 'general-activity.svg', '', 'https://my.contractorplus.app/settings?group=payments', '{"type":"internal_webview","internal_webview":{"showHeader":"1","title":"Payment Settings","internal_webview_url":"{base_url}\\/settings-web\\/manage-pg\\/{webview_token_prefix}{webview_token}","contrefresh":"1"}}', 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, 'our_new_contractor_pay_platform_ships_july_21st_2024_action_required', 0, 'Our new Contractor+ Pay platform ships <b>July 21st, 2024</b>, action required.', 0, 1, '', 0, 0, NULL, 'staff', st.staffid, UTC_TIMESTAMP(), UTC_TIMESTAMP(), UTC_TIMESTAMP()
FROM  tbltenants t  
LEFT JOIN tbloptions opt ON opt.tenant_id = t.id AND opt.`name` = 'paymentmethod_wepay_active'
JOIN tblstaff st ON st.tenant_id = t.id and st.is_tenant = 1
WHERE opt.`value`;



-- GPS Tracking action item Mark as Done
UPDATE tblin_app_logs SET marked_as_done = 1, marked_as_read = 1 WHERE `action` = 'we_need_your_opinion_gps_tracking_solution_survey';