-- /packages/intranet-leaflet/sql/postgresql/intranet-leaflet-create.sql
--
-- Copyright (c) 2003-2018 ]project-open[
--
-- All rights reserved. Please check
-- https://www.project-open.com/license/ for details.
--
-- @author frank.bergmann@project-open.com


alter table im_offices add column geo_lat double precision;
alter table im_offices add column geo_lng double precision;
alter table im_offices add column geo_last_modified timestamptz;

-----------------------------------------------------------
-- Plugin Components
--

-- Map of customers on Company Dashboard
SELECT im_component_plugin__new (
	null, 'im_component_plugin', now(), null, null, null,
	'Leaflet Customer Map',					-- plugin_name
	'intranet-leaflet',					-- package_name
	'left',							-- location
	'/intranet/companies/dashboard',			-- page_url
	null,							-- view_name
	20,							-- sort_order
	''							-- component_tcl - to be updated
);

update im_component_plugins set 
	title_tcl = 'lang::message::lookup "" intranet-leaflet.Customer_Map "Customer Map"',
	component_tcl = 'im_leaflet_customer_component -width 600 -height 400 -customer_type_id 57 -customer_status_id 46'
where plugin_name = 'Leaflet Customer Map' and package_name = 'intranet-leaflet';


------------------------------------------------------------
-- Only for developers:
------------------------------------------------------------

\q

-- Map of IP addresses in CRM Opportunities Dashboard
SELECT im_component_plugin__new (
	null, 'im_component_plugin', now(), null, null, null,
	'Leaflet CRM IP Map',					-- plugin_name
	'intranet-leaflet',					-- package_name
	'top',							-- location
	'/intranet-crm-opportunities/index',			-- page_url
	null,							-- view_name
	10,							-- sort_order
	''							-- component_tcl - to be updated
);

update im_component_plugins set 
	title_tcl = 'lang::message::lookup "" intranet-leaflet.CRM_IP_Map "CRM IP Map"',
	component_tcl = 'im_leaflet_crm_ip_component -width 1200 -height 600'
where plugin_name = 'Leaflet CRM IP Map' and package_name = 'intranet-leaflet';







-- Map of world countries
SELECT im_component_plugin__new (
	null, 'im_component_plugin', now(), null, null, null,
	'Leaflet World Countries',				-- plugin_name
	'intranet-leaflet',					-- package_name
	'left',							-- location
	'/intranet/companies/dashboard',			-- page_url
	null,							-- view_name
	30,							-- sort_order
	''							-- component_tcl - to be updated
);

update im_component_plugins set 
	title_tcl = 'lang::message::lookup "" intranet-leaflet.World_Countries "World Countries"',
	component_tcl = 'im_leaflet_world_countries -width 600 -height 400'
where plugin_name = 'Leaflet World Countries' and package_name = 'intranet-leaflet';



