CREATE TABLE `tblcommon_activity_log` (
  `tenant_id` bigint(20) UNSIGNED NOT NULL DEFAULT 1,
  `id` bigint(20) UNSIGNED NOT NULL,
  `rel_type` varchar(20) DEFAULT NULL,
  `rel_id` bigint(20) UNSIGNED NOT NULL,
  `description` text NOT NULL,
  `additional_data` text DEFAULT NULL,
  `staffid` varchar(11) DEFAULT NULL,
  `full_name` varchar(100) DEFAULT NULL,
  `date` datetime NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;


ALTER TABLE `tblcommon_activity_log`
  ADD PRIMARY KEY (`id`);

ALTER TABLE `tblcommon_activity_log`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=1;




-- Shopping lists start

INSERT INTO `tblmobile_push_notification_config` (`id`, `codename`, `is_active`) VALUES (NULL, 'shopping_list_newly_added', '1');
INSERT INTO `tbldesktop_push_notification_config` (`id`, `codename`, `is_active`) VALUES (NULL, 'shopping_list_newly_added', '1');
INSERT INTO `tblemail_push_notification_config` (`id`, `codename`, `is_active`) VALUES (NULL, 'shopping_list_newly_added', '1');
INSERT INTO `tblsms_push_notification_config` (`id`, `codename`, `is_active`) VALUES (NULL, 'shopping_list_newly_added', '1');
INSERT INTO `tblin_app_notification_config` (`id`, `codename`, `is_active`) VALUES (NULL, 'shopping_list_newly_added', '1');
INSERT INTO `tblactivity_log_config` (`id`, `codename`, `is_active`) VALUES (NULL, 'shopping_list_newly_added', '1');
INSERT INTO `tblreward_distribution_config` 
(`id`, `codename`, `is_active`, `reward_for`, `is_multiple_distribution`, `reward_to_a`, `reward_to_b`) 
VALUES 
(NULL, 'shopping_list_newly_added', '0', 'both', '1', '50', '50');

INSERT INTO `tblmobile_push_notification_config` (`id`, `codename`, `is_active`) VALUES (NULL, 'shopping_list_newly_edited', '1');
INSERT INTO `tbldesktop_push_notification_config` (`id`, `codename`, `is_active`) VALUES (NULL, 'shopping_list_newly_edited', '1');
INSERT INTO `tblemail_push_notification_config` (`id`, `codename`, `is_active`) VALUES (NULL, 'shopping_list_newly_edited', '1');
INSERT INTO `tblsms_push_notification_config` (`id`, `codename`, `is_active`) VALUES (NULL, 'shopping_list_newly_edited', '1');
INSERT INTO `tblin_app_notification_config` (`id`, `codename`, `is_active`) VALUES (NULL, 'shopping_list_newly_edited', '1');
INSERT INTO `tblactivity_log_config` (`id`, `codename`, `is_active`) VALUES (NULL, 'shopping_list_newly_edited', '1');
INSERT INTO `tblreward_distribution_config` 
(`id`, `codename`, `is_active`, `reward_for`, `is_multiple_distribution`, `reward_to_a`, `reward_to_b`) 
VALUES 
(NULL, 'shopping_list_newly_edited', '0', 'both', '1', '50', '50');

INSERT INTO `tblmobile_push_notification_config` (`id`, `codename`, `is_active`) VALUES (NULL, 'shopping_list_status_changed', '1');
INSERT INTO `tbldesktop_push_notification_config` (`id`, `codename`, `is_active`) VALUES (NULL, 'shopping_list_status_changed', '1');
INSERT INTO `tblemail_push_notification_config` (`id`, `codename`, `is_active`) VALUES (NULL, 'shopping_list_status_changed', '1');
INSERT INTO `tblsms_push_notification_config` (`id`, `codename`, `is_active`) VALUES (NULL, 'shopping_list_status_changed', '1');
INSERT INTO `tblin_app_notification_config` (`id`, `codename`, `is_active`) VALUES (NULL, 'shopping_list_status_changed', '1');
INSERT INTO `tblactivity_log_config` (`id`, `codename`, `is_active`) VALUES (NULL, 'shopping_list_status_changed', '1');
INSERT INTO `tblreward_distribution_config` 
(`id`, `codename`, `is_active`, `reward_for`, `is_multiple_distribution`, `reward_to_a`, `reward_to_b`) 
VALUES 
(NULL, 'shopping_list_status_changed', '0', 'both', '1', '50', '50');

INSERT INTO `tblmobile_push_notification_config` (`id`, `codename`, `is_active`) VALUES (NULL, 'invoice_activity_added_attachment', '1');
INSERT INTO `tbldesktop_push_notification_config` (`id`, `codename`, `is_active`) VALUES (NULL, 'invoice_activity_added_attachment', '1');
INSERT INTO `tblemail_push_notification_config` (`id`, `codename`, `is_active`) VALUES (NULL, 'invoice_activity_added_attachment', '1');
INSERT INTO `tblsms_push_notification_config` (`id`, `codename`, `is_active`) VALUES (NULL, 'invoice_activity_added_attachment', '1');
INSERT INTO `tblin_app_notification_config` (`id`, `codename`, `is_active`) VALUES (NULL, 'invoice_activity_added_attachment', '1');
INSERT INTO `tblactivity_log_config` (`id`, `codename`, `is_active`) VALUES (NULL, 'invoice_activity_added_attachment', '1');
INSERT INTO `tblreward_distribution_config` 
(`id`, `codename`, `is_active`, `reward_for`, `is_multiple_distribution`, `reward_to_a`, `reward_to_b`) 
VALUES 
(NULL, 'invoice_activity_added_attachment', '0', 'both', '1', '50', '50');

-- Shopping lists end



INSERT INTO `tblemailtemplates` 
(`tenant_id`, `emailtemplateid`, `type`, `slug`, `language`, `name`, `subject`, `message`, `fromname`, `fromemail`, `plaintext`, `active`, `order`) 
VALUES 
('1', NULL, 'post-inspection', 'post-inspection-accepted-to-staff', 'english', 'Post Inspection Accepted (Sent to Staff)', 'Customer Accepted Post Inspection', '<span style=\"font-size: 12pt;\">Hi</span><br /> <br /><span style=\"font-size: 12pt;\">Customer ({client_company}) accepted estimate with number <strong># {estimate_number}</strong></span><br /> <br /><span style=\"font-size: 12pt;\">You can view the estimate on the following link: <a href=\"{estimate_link}\">{estimate_number}</a></span><br /> <br /><span style=\"font-size: 12pt;\">{email_signature}</span>', '{companyname} | CRM', '', '0', '1', '0'), 
('1', NULL, 'post-inspection', 'post-inspection-already-send', 'english', 'Post Inspection Already Sent to Customer', 'Post Inspection # {estimate_number} ', '<span style=\"font-size: 12pt;\">Dear {contact_firstname} {contact_lastname}</span><br /> <br /><span style=\"font-size: 12pt;\">Thank you for your estimate request.</span><br /> <br /><span style=\"font-size: 12pt;\">You can view the estimate on the following link: <a href=\"{estimate_link}\">{estimate_number}</a></span><br /> <br /><span style=\"font-size: 12pt;\">Please contact us for more information.</span><br /> <br /><span style=\"font-size: 12pt;\">Kind Regards,</span><br /><span style=\"font-size: 12pt;\">{email_signature}</span>', '{companyname} | CRM', '', '0', '1', '0'), ('1', NULL, 'post-inspection', 'post-inspection-declined-to-staff', 'english', 'Post Inspection Declined (Sent to Staff)', 'Customer Declined Post Inspection', '<span style=\"font-size: 12pt;\">Hi</span><br /> <br /><span style=\"font-size: 12pt;\">Customer ({client_company}) declined estimate with number <strong># {estimate_number}</strong></span><br /> <br /><span style=\"font-size: 12pt;\">You can view the estimate on the following link: <a href=\"{estimate_link}\">{estimate_number}</a></span><br /> <br /><span style=\"font-size: 12pt;\">{email_signature}</span>', '{companyname} | CRM', '', '0', '1', '0'), ('1', NULL, 'post-inspection', 'post-inspection-expiry-reminder', 'english', 'Post Inspection Expiration Reminder', 'Post Inspection Expiration Reminder', '<p><span style=\"font-size: 12pt;\">Hello {contact_firstname} {contact_lastname}</span><br /><br /><span style=\"font-size: 12pt;\">The estimate with <strong># {estimate_number}</strong> will expire on <strong>{estimate_expirydate}</strong></span><br /><br /><span style=\"font-size: 12pt;\">You can view the estimate on the following link: <a href=\"{estimate_link}\">{estimate_number}</a></span><br /><br /><span style=\"font-size: 12pt;\">Kind Regards,</span><br /><span style=\"font-size: 12pt;\">{email_signature}</span></p>', '{companyname} | CRM', '', '0', '1', '0'), ('1', NULL, 'post-inspection', 'post-inspection-send-to-client', 'english', 'Send Post Inspection to Customer', 'Post Inspection # {estimate_number} created', '<span style=\"font-size: 12pt;\">Dear {contact_firstname} {contact_lastname}</span><br /> <br /><span style=\"font-size: 12pt;\">Please find the attached estimate <strong># {estimate_number}</strong></span><br /> <br /><span style=\"font-size: 12pt;\"><strong>Estimate status:</strong> {estimate_status}</span><br /><br /><span style=\"font-size: 12pt;\">You can view the estimate on the following link: <a href=\"{estimate_link}\">{estimate_number}</a></span><br /> <br /><span style=\"font-size: 12pt;\">We look forward to your communication.</span><br /> <br /><span style=\"font-size: 12pt;\">Kind Regards,</span><br /><span style=\"font-size: 12pt;\">{email_signature}<br /></span>', '{companyname} | CRM', '', '0', '1', '0'), ('1', NULL, 'post-inspection', 'post-inspection-thank-you-to-customer', 'english', 'Thank You Email (Sent to Customer After Accept)', 'Thank for you accepting Post Inspection', '<span style=\"font-size: 12pt;\">Dear {contact_firstname} {contact_lastname}</span><br /> <br /><span style=\"font-size: 12pt;\">Thank for for accepting the estimate.</span><br /> <br /><span style=\"font-size: 12pt;\">We look forward to doing business with you.</span><br /> <br /><span style=\"font-size: 12pt;\">We will contact you as soon as possible.</span><br /> <br /><span style=\"font-size: 12pt;\">Kind Regards,</span><br /><span style=\"font-size: 12pt;\">{email_signature}</span>', '{companyname} | CRM', '', '0', '1', '0');