<?php

	/**
	 * Template für die Integration des Produktpaketes in die Produktverwaltung
	 */

?>
<div id="wpsg_mod_productpackage_dialog"></div>

<div id="wpsg_productpackage" class="postbox">	
	<h3 class="wpsg_handlediv">
		<span class="handlediv" title="<?php echo __('Zum Ein/Ausklappen hier klicken', 'wpsg'); ?>"><br /></span>
		<span><?php echo __('Produktpaket', 'wpsg'); ?> </span>
	</h3>
	<div class="inside">
	
		<?php echo wpsg_drawForm_Checkbox('wpsg_mod_productpackage_set', __('Produktpaket', 'wpsg'), $this->get_option('wpsg_mod_productpackage_set')); ?>
		
		<div id="wpsg_mod_productpackage_layer">
			
			<?php echo $this->callMod('wpsg_mod_productpackage', 'productlist', array($this->view['data']['id'])); ?>
			
		</div>
		
	</div>
</div>

<script type="text/javascript">/* <![CDATA[ */

	function wpsg_mod_productpackage_select(product_id)
	{

		alert(product_id);
		
	} // function wpsg_mod_productpackage_select(product_id)

	function wpsg_mod_productpackage_add()
	{

		jQuery('#wpsg_mod_productpackage_dialog').html('<img style="margin:15px;" src="<?php echo WPSG_URL; ?>views/gfx/ajax-loader.gif" alt="<?php echo __('Bitte warten ...', 'wpsg'); ?>" />');
		
		jQuery('#wpsg_mod_productpackage_dialog').dialog( {
			'dialogClass': 'wp-dialog',           
	        'modal': true,
	        'width': 390,
	        'height': 350,	       
	        'title': '<?php echo __('Produktauswahl', 'wpsg'); ?>',
	        'open': function() {

	        	jQuery.ajax( {
	    			url: '<?php echo WPSG_URL_WP; ?>wp-admin/admin.php?page=wpsg-Produkt&action=select&wpsg_mode=filterDialog&noheader=1&edit_id=<?php echo $this->view['data']['id']; ?>&callback=wpsg_mod_productpackage_select',
	    			success: function(data) {
		    			
	    				jQuery('#wpsg_mod_productpackage_dialog').html(data);
	    					
	    			}
	    		} );
			        
	        }
		} );

		return false;
		
	} // function wpsg_mod_productpackage_select()

	jQuery(document).ready(function() {

		jQuery('#wpsg_mod_productpackage_set').bind('change', function() {
 
			if (jQuery(this).attr("checked") == "checked") jQuery('#wpsg_mod_productpackage_layer').show();
			else jQuery('#wpsg_mod_productpackage_layer').hide();
			
		} ).click();
		
	} );

/* ]]> */</script>