# /packages/intranet-leaflet/tcl/intranet-leaflet-procs.tcl
#
# Copyright (C) 2003-2011 ]project-open[
#
# All rights reserved. Please check
# https://www.project-open.com/license/ for details.

ad_library {
    Procs used in Google Maps
    @author frank.bergmann@project-open.com
}


# ----------------------------------------------------------------------
# Components
# ---------------------------------------------------------------------

ad_proc -public im_leaflet_customer_component {
    {-width "600"}
    {-height "400" }
    {-customer_status_id ""}
    {-customer_type_id ""}
} {
    Returns a HTML component with a map with location pointers for all selected places.
    Expects as parameter a SQL that returns the location and the description of the places.
} {
    im_sencha_extjs_load_libraries
    set params [list \
		    [list width $width] \
		    [list height $height] \
		    [list customer_status_id $customer_status_id] \
		    [list customer_type_id $customer_type_id] \
    ]
    set result [ad_parse_template -params $params "/packages/intranet-leaflet/lib/leaflet-customer-component"]
    return [string trim $result]
}


ad_proc -public im_leaflet_crm_ip_component {
    {-width "600"}
    {-height "400" }
} {
    Returns a HTML component with a map with location pointers for
    IP addresses from CRM
} {
    im_sencha_extjs_load_libraries
    set params [list \
		    [list width $width] \
		    [list height $height] \
    ]
    set result [ad_parse_template -params $params "/packages/intranet-leaflet/lib/leaflet-crm-ip-component"]
    return [string trim $result]
}




ad_proc -public im_leaflet_world_countries {
    {-width "600"}
    {-height "400" }
    {-customer_status_id ""}
    {-customer_type_id ""}
} {
    Returns a HTML component with a map of world countries.
} {
    im_sencha_extjs_load_libraries
    set params [list \
		    [list width $width] \
		    [list height $height] \
		    [list customer_status_id $customer_status_id] \
		    [list customer_type_id $customer_type_id] \
    ]
    set result [ad_parse_template -params $params "/packages/intranet-leaflet/lib/leaflet-world-countries"]
    return [string trim $result]
}

