ALTER TABLE tblreminders ADD is_notified_on_calendar tinyint(1) NOT NULL DEFAULT 0 AFTER isnotified;
ALTER TABLE tblreminders ADD is_mail_reminder tinyint(1) NOT NULL DEFAULT 0 AFTER is_notified_on_calendar;
ALTER TABLE tblreminders ADD is_app_reminder tinyint(1) NOT NULL DEFAULT 0 AFTER is_mail_reminder;
ALTER TABLE tblreminders ADD is_calendar_reminder tinyint(1) NOT NULL DEFAULT 0 AFTER is_app_reminder;
ALTER TABLE tblreminders ADD reminder_duration bigint(20) unsigned NOT NULL DEFAULT 0 AFTER is_calendar_reminder;
ALTER TABLE tblreminders ADD reminder_duration_type enum('minutes','hours','days','weeks','months') DEFAULT NULL AFTER reminder_duration;

INSERT INTO tblplan_features (name, codename, description,type,added_on) 
VALUES('Reminders', 'allowed_reminders', 'Reminders','restrict','2022-06-16 13:16:16');

SET @plans_features_id = LAST_INSERT_ID();

INSERT INTO tblplan_features_value (plans_id, plans_features_id, value,other_data,added_on) 
VALUES(9, @plans_features_id, 0,'{"outside_message":"Sending Reminder is a pro feature, in order to use it Upgrade to PRO","inside_message":"Sending Reminder is a pro feature, in order to use it Upgrade to PRO","tag_color":"#eb0e0e","tag_title":"UPGRADE","link":"https:\/\/my.contractorplus.app\/","count":"0"}','2022-06-16 13:16:16'),
(10, @plans_features_id, 1,NULL,'2022-06-16 13:16:16'),
(11, @plans_features_id, 1,NULL,'2022-06-16 13:16:16'),
(12, @plans_features_id, 1,NULL,'2022-06-16 13:16:16'); 

UPDATE tblstaff SET refresh_permissions = 1;

INSERT INTO tblmobile_push_notification_config (codename,is_active) VALUES ('send_lead_reminder', 1);

INSERT INTO tblapad_emailtemplates (type,slug,language,name,subject,message,fromname,fromemail,plaintext,active,`order`)
VALUES('reminders','send-lead-reminder','english','Send Lead Reminder',"Reminder to follow up with {reminder_client_name}",'<span style="font-size: 12pt;">Hi {staff_firstname}, </span><br/><br/><span style="font-size: 12pt;">This is a reminder to follow up with {reminder_client_name} at {reminder_client_phone_number}.</span><br/><br/><span style="font-size: 12pt;">You scheduled this follow up reminder on {reminder_date} at {reminder_time}.</span><br/><br/><span style="font-size: 12pt;">Notes: {reminder_note}</span><br/><br/>','','',0,1,0);

UPDATE tblnotes SET rel_type = 'leads' WHERE rel_type = 'lead';
