DELETE FROM engine4_core_menuitems WHERE `engine4_core_menuitems`.`name` = 'core_admin_message_mail';
DELETE FROM engine4_core_menuitems WHERE `engine4_core_menuitems`.`name` = 'core_admin_main_settings_mailtemplates';
DELETE FROM engine4_core_menuitems WHERE `engine4_core_menuitems`.`name` = 'core_admin_main_settings_mailsettings';

INSERT IGNORE INTO `engine4_core_menuitems` (`name`, `module`, `label`, `plugin`, `params`, `menu`, `submenu`, `order`) VALUES 
('core_admin_main_emailsettings', 'core', 'Email Settings', '', '{"route":"admin_default","module":"core","controller":"message","action":"mail"}', 'core_admin_main_settings', '', 22),
('core_admin_message_mail',  'core',  'Email All Members',  '',  '{"route":"admin_default","module":"core","controller":"message","action":"mail"}',  'core_admin_main_emailsettings',  '',  1),
('core_admin_main_settings_mailsettings', 'core', 'Mail Settings', '', '{"route":"admin_default","controller":"mail","action":"settings"}', 'core_admin_main_emailsettings', '', 2),
("core_admin_main_settings_managetemplates", "core", "Manage Email Templates", "", '{"route":"admin_default","module":"core","controller":"mail", "action":"manage"}', "core_admin_main_emailsettings", "", 3),
('core_admin_main_settings_mailtemplates', 'core', 'Mail Templates', '', '{"route":"admin_default","controller":"mail","action":"templates"}', 'core_admin_main_emailsettings', '', 4);

INSERT IGNORE INTO `engine4_core_mailtemplates` (`type`,`module`,`vars`) VALUES ("core_test_mailtemplate","module","[host],[email],[recipient_title],[recipient_link],[recipient_photo],[sender_title],[sender_link],[sender_photo]");

DROP TABLE IF EXISTS `engine4_core_emailtemplates`;
CREATE TABLE IF NOT EXISTS `engine4_core_emailtemplates` (
  `emailtemplate_id` int(11) unsigned NOT NULL auto_increment,
  `is_active` tinyint(1) NOT NULL default "0",
  `title` varchar(255) NOT NULL default "Test Template",
  `mail_background_color` varchar(25) default NULL,
  `mail_padding_topbottom` varchar(15) default NULL,
  `mail_padding_rightleft` varchar(15) default NULL,
  `predefined` tinyint(1) NOT NULL default "0",
  `creation_date` datetime NOT NULL,
  `header_logo` varchar(25) NOT NULL,
  `header_logo_align` varchar(50) default NULL,
  `header_emailphone_show` varchar(50) default NULL,
  `header_mail` varchar(50) default NULL,
  `header_phone` varchar(25) default NULL,
  `font_color_textemailphone` varchar(25) default NULL,
  `header_emailphone_align` varchar(25) default NULL,
  `header_background_color` varchar(25) default NULL,
  `header_border_Width` varchar(12) default NULL,
  `header_border_color` varchar(25) default NULL,
  `header_border_style` varchar(25) default NULL,
  `header_padding` varchar(25) default NULL,
  `tagline_position` varchar(25) default NULL,
  `tagline_content` text default NULL,
  `tagline_font_color` varchar(25) default NULL,
  `tagline_background_color` varchar(25) default NULL,
  `tagline_border_Width` varchar(12) default NULL,
  `tagline_border_color` varchar(25) default NULL,
  `tagline_border_style` varchar(25) default NULL,
  `tagline_text_alignment` varchar(25) default NULL,
  `tagline_padding` varchar(25) default NULL,
  `body_background_color` varchar(25) default NULL,
  `body_text_color` varchar(25) NOT NULL default "000000",
  `body_border_Width` varchar(12) default NULL,
  `body_border_color` varchar(25) default NULL,
  `body_border_style` varchar(25) default NULL,
  `body_padding` varchar(25) default NULL,
  `footer_social_icons` text default NULL,
  `footer_social_icons_type` text default NULL,
  `footer_background_color` varchar(25) default NULL,
  `footer_border_Width` varchar(12) default NULL,
  `footer_border_color` varchar(25) default NULL,
  `footer_border_style` varchar(25) default NULL,
  `footer_text_alignment` varchar(25) default NULL,
  `footer_padding` varchar(25) default NULL,
  PRIMARY KEY  (`emailtemplate_id`),
  KEY `is_active` (`is_active`),
  KEY `creation_date` (`creation_date`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE utf8mb4_unicode_ci ;

INSERT IGNORE INTO `engine4_core_emailtemplates` (`is_active`, `title`, `mail_background_color`, `mail_padding_topbottom`, `mail_padding_rightleft`, `predefined`, `creation_date`, `header_logo_align`, `header_emailphone_show`, `header_mail`, `header_phone`, `font_color_textemailphone`, `header_emailphone_align`, `header_background_color`, `header_border_Width`, `header_border_color`, `header_border_style`, `header_padding`, `tagline_position`, `tagline_content`, `tagline_font_color`, `tagline_background_color`, `tagline_border_Width`, `tagline_border_color`, `tagline_border_style`, `tagline_text_alignment`, `tagline_padding`, `body_background_color`, `body_text_color`, `body_border_Width`, `body_border_color`, `body_border_style`, `body_padding`, `footer_social_icons`, `footer_social_icons_type`, `footer_background_color`, `footer_border_Width`, `footer_border_color`, `footer_border_style`, `footer_text_alignment`, `footer_padding`) VALUES
(0, "Template 1", "DFF1FE", "50", "0", 0, "2019-01-14 08:38:05","1", "1", "info@abc.com", "9950682999", "333333", "2", "FFFFFF", "0", "FFFFFF", "solid", "15", "2", "Your Business Tagline Goes Here", "FFFFFF", "0C2A4B", "0", "FFFFFF", "solid", "2", "10", "F5F5F5", "000000", "0", "FFFFFF", "solid", "15", "Facebbok,Twitter,Linkedin,instagram,Google Plus,Pinterest,Flickr", 0, "FFFFFF", "0", "FFFFFF", "solid", "2", "15"),
(1, "Template 2", "F6F6F6", "50", "0", 0, "2019-01-14 08:40:46","1", "1", "info@abc.com", "+1-1234567890", "FFFFFF", "2", "15A5DD", "0", "FFFFFF", "solid", "15", "2", "Your Business Tagline Goes Here", "FFFFFF", "0C2A4B", "0", "FFFFFF", "solid", "2", "10", "FFFFFF", "000000", "0", "FFFFFF", "solid", "15", "Facebbok,Twitter,Linkedin,instagram,Google Plus,Pinterest,Flickr", 1, "DFF1FE", "0", "FFFFFF", "solid", "2", "15"),
(0, "Template 3", "15A5DD", "50", "0", 0, "2019-01-14 08:44:25","2", "0", "info@abc.com", "+1-1234567890", "333333", "1", "FFFFFF", "0", "FFFFFF", "solid", "15", "2", "Your Business Tagline Goes Here", "FFFFFF", "0C2A4B", "0", "FFFFFF", "solid", "2", "10", "F5F5F5", "000000", "0", "FFFFFF", "solid", "15", "Facebbok,Twitter,Linkedin,instagram,Google Plus,Pinterest,Flickr", 0, "FFFFFF", "0", "FFFFFF", "solid", "2", "15"),
(0, "Template 4", "F6F6F6", "50", "0", 0, "2019-01-14 08:45:18", "3", "1", "info@abc.com", "+1-1234567890", "FFFFFF", "1", "0C2A4B", "0", "FFFFFF", "solid", "15", "2", "Your Business Tagline Goes Here", "0C2A4B", "FFFFFF", "0", "FFFFFF", "solid", "2", "10", "00AEEF", "FFFFFF", "0", "FFFFFF", "solid", "15", "Facebbok,Twitter,Linkedin,instagram,Google Plus,Pinterest,Flickr", 1, "FFFFFF", "0", "FFFFFF", "solid", "2", "15"),
(0, "Template 5", "DFF1FE", "50", "0", 0, "2019-01-14 08:46:08","1", "0", "info@abc.com", "+1-1234567890", "333333", "1", "15A5DD", "0", "FFFFFF", "solid", "15", "1", "Your Business Tagline Goes Here", "FFFFFF", "0C2A4B", "0", "FFFFFF", "solid", "2", "10", "F6F6F6", "000000", "0", "FFFFFF", "solid", "15", "Facebbok,Twitter,Linkedin,instagram,Google Plus,Pinterest,Flickr", 0, "FFFFFF", "0", "FFFFFF", "solid", "2", "15"),
(0, "Template 6", "F6F6F6", "50", "0", 0, "2019-01-14 08:49:30","3", "1", "info@abc.com", "+1-1234567890", "333333", "1", "FFFFFF", "0", "0C2A4B", "solid", "15", "1", "Your Business Tagline Goes Here", "FFFFFF", "0C2A4B", "0", "FFFFFF", "solid", "3", "10", "0C2A4B", "FFFFFF", "0", "FFFFFF", "solid", "15", "Facebbok,Twitter,Linkedin,instagram,Google Plus,Pinterest,Flickr", 0, "FFFFFF", "0", "FFFFFF", "solid", "2", "15"),
(0, "Template 7", "15A5DD", "50", "0", 0, "2019-01-14 08:52:09","1", "1", "info@abc.com", "+1-1234567890", "333333", "2", "FFFFFF", "0", "FFFFFF", "solid", "15", "2", "Your Business Tagline Goes Here", "FFFFFF", "0C2A4B", "0", "FFFFFF", "solid", "3", "10", "FFFFFF", "000000", "0", "FFFFFF", "solid", "15", "Facebbok,Twitter,Linkedin,instagram,Google Plus,Pinterest,Flickr", 0, "F5F5F5", "0", "FFFFFF", "solid", "2", "15"),
(0, "Template 8", "F6F6F6", "50", "0", 0, "2019-01-14 08:56:52", "2", "0", "info@abc.com", "+1-1234567890", "333333", "2", "0C2A4B", "0", "EBEBEB", "solid", "15", "2", "Your Business Tagline Goes Here", "0C2A4B", "FFFFFF", "0", "FFFFFF", "solid", "2", "10", "FFFFFF", "000000", "3", "0C2A4B", "solid", "15", "Facebbok,Twitter,Linkedin,instagram,Google Plus,Pinterest,Flickr", 0, "FFFFFF", "0", "FFFFFF", "solid", "2", "15"),
(0, "Template 9", "00AEEF", "50", "0", 0, "2019-01-14 09:00:28", "3", "1", "info@abc.com", "+1-1234567890", "333333", "1", "F5F5F5", "0", "FFFFFF", "solid", "15", "1", "Your Business Tagline Goes Here", "0C2A4B", "FFFFFF", "0", "FFFFFF", "solid", "3", "10", "FFFFFF", "000000", "0", "FFFFFF", "solid", "15", "Facebbok,Twitter,Linkedin,instagram,Google Plus,Pinterest,Flickr", 0, "F6F6F6", "0", "FFFFFF", "solid", "2", "15"),
(0, "Template 10", "F6F6F6", "50", "0", 0, "2019-01-14 09:02:35", "3", "1", "info@abc.com", "+1-1234567890", "FFFFFF", "1", "0C2A4B", "0", "FFFFFF", "solid", "15", "2", "Your Business Tagline Goes Here", "0C2A4B", "DCF0FF", "0", "FFFFFF", "solid", "2", "10", "FFFFFF", "000000", "0", "FFFFFF", "solid", "15", "Facebbok,Twitter,Linkedin,instagram,Google Plus,Pinterest,Flickr", 1, "DCF0FF", "0", "FFFFFF", "solid", "2", "15");


INSERT IGNORE INTO `engine4_core_menuitems` (`name`, `module`, `label`, `plugin`, `params`, `menu`, `submenu`, `order`) VALUES ('core_admin_main_layout_customcss', 'core', 'Custom CSS', '', '{"route":"admin_default","controller":"custom-css", "action":"index"}', 'core_admin_main_layout', '', 80);

INSERT IGNORE INTO `engine4_core_menuitems` (`name`, `module`, `label`, `plugin`, `params`, `menu`, `submenu`, `order`) VALUES
("core_admin_main_managedashboards", "core", "Manage Dashboards", "", '{"route":"admin_default","module":"core","controller":"managedashboard","action":"index"}', "core_admin_main_manage", "", 999);

DROP TABLE IF EXISTS `engine4_core_dashboards`;
CREATE TABLE IF NOT EXISTS `engine4_core_dashboards` (
  `dashboard_id` INT(11) UNSIGNED NOT NULL AUTO_INCREMENT,
  `dashboard_name` VARCHAR(255) DEFAULT NULL,
  `creation_date` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `modified_date` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  `enabled` TINYINT(1) NOT NULL DEFAULT 1,
  PRIMARY KEY (`dashboard_id`),
  KEY `dashboard_enabled` (`enabled`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

DROP TABLE IF EXISTS `engine4_core_dashboardlinks`;
CREATE TABLE IF NOT EXISTS `engine4_core_dashboardlinks` (
  `dashboardlink_id` INT(11) UNSIGNED NOT NULL AUTO_INCREMENT,
  `dashboard_id` INT(11) UNSIGNED NOT NULL,
  `name` VARCHAR(255) NOT NULL,
	`description` VARCHAR(255) NULL DEFAULT NULL,
  `url` VARCHAR(255) NOT NULL,
  `enabled` TINYINT(1) NOT NULL DEFAULT 1,
  `sublink` TINYINT(1) NOT NULL DEFAULT 0,
  `file_id` INT(11) NOT NULL DEFAULT 0,
  `icon_type` TINYINT(1) NOT NULL DEFAULT 0,
  `font_icon` VARCHAR(255) NOT NULL,
  `order` INT(11) NOT NULL,
  `type` VARCHAR(32) DEFAULT NULL,
  `privacy` VARCHAR(255) DEFAULT NULL,
  PRIMARY KEY (`dashboardlink_id`),
  KEY `dashboard_id` (`dashboard_id`),
  KEY `enabled` (`enabled`),
  KEY `sublink` (`sublink`),
  KEY `order` (`order`),
  KEY `type_privacy` (`type`, `privacy`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci AUTO_INCREMENT=1;

ALTER TABLE `engine4_core_files` ADD `alt_text` VARCHAR(255) NULL DEFAULT NULL;
