<?php

/**
* @version 2.7.17
* @package Joomla 1.7/2.5
* @subpackage DT Register
* @copyright Copyright (C) 2006 DTH Development
* @copyright contact dthdev@dthdevelopment.com
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
*/
global $Itemid;
$document =& JFactory::getDocument();

	$document->addScript( JURI::root(true).'/components/com_dtregister/assets/js/dt_jquery.js');

	$document->addScript( JURI::root(true).'/components/com_dtregister/assets/js/form.js');

?>
    <form name="adminForm" id="newDiscountCode" method="post" action="index.php?option=com_dtregister&Itemid=<?php echo $Itemid; ?>">

    <table width="100%" class="adminlist" border="1">

			<tbody>

			<tr>

				<th class="dt_heading" colspan="3"><?php echo JText::_( 'DT_DISCOUNT_CODE');?> <?php echo JText::_( 'DT_DETAILS');?></th>

			</tr>

			<tr>

				<td width="20%" align="left" valign="top"><?php echo JText::_( 'DT_NAME');?>:</td>

				<td valign="top" align="left" width="30%">

				<input class="text_area" type="text" name="name" size="50" maxlength="50" value=""  />

				</td>

				<td valign="top" align="left">
                       <?php echo JHTML::tooltip((JText::_( 'DT_DISCOUNT_NAME_HELP' )), '', 'tooltip.png', '', ''); ?>
					
				</td>

			</tr>

			<tr class="typeshow type1 type3 type4" >

				<td><?php echo JText::_( 'DT_START_DATE');?>:</td>

				<td align="left">

				<?php echo JHTML::_("calendar",null,"start","start",'%Y-%m-%d %H:%M:%S',array('size'=>'25')); ?>

				</td>

				<td valign="top" align="left">
                    <?php echo JHTML::tooltip((JText::_( 'DT_DISCOUNT_STARTDATE_HELP' )), '', 'tooltip.png', '', ''); ?>
					
				</td>

			</tr>

			<tr class="typeshow type1 type3 type4">

				<td><?php echo JText::_( 'DT_END_DATE');?>:</td>

				<td align="left">

					<?php echo JHTML::_("calendar",null,"end","end",'%Y-%m-%d %H:%M:%S',array('size'=>'25')); ?>

				</td>

				<td valign="top" align="left">
                      <?php echo JHTML::tooltip((JText::_( 'DT_DISCOUNT_ENDDATE_HELP' )), '', 'tooltip.png', '', ''); ?>
					
				</td>

			</tr>

            <tr class="typeshow type1 type3 type4">

				<td><?php echo JText::_( 'DT_DISCOUNT_CODE_LIMIT');?>:</td>

				<td align="left">

                    <input class="text_area" type="text" name="limit" size="10" maxlength="4" value="" />

				</td>

				<td valign="top" align="left">
                    <?php echo JHTML::tooltip((JText::_( 'DT_DISCOUNT_CODE_LIMIT_HELP' )), '', 'tooltip.png', '', ''); ?>
					
				</td>

			</tr>

			<tr class="typeshow type1 type3 type4">

				<td><?php echo JText::_( 'DT_PUBLISH');?>:</td>

				<td>

                  <?php

					   	$options=array();

						$options[]=JHTML::_('select.option', "0",JText::_( 'DT_NO'));

						$options[]=JHTML::_('select.option', "1",JText::_( 'DT_YES'));

						echo JHTML::_('select.genericlist',$options,"publish","","value","text");

					?>

				</td>

				</td>

					<td valign="top" align="left">
                     <?php echo JHTML::tooltip((JText::_( 'DT_DISCOUNT_PUBLISH_HELP' )), '', 'tooltip.png', '', ''); ?>
					
				</td>

			</tr>
             <tr class="typeshow type1 type3 type4">

				<td><?php echo JText::_( 'DT_ENABLE_FOR');?>:</td>

				<td>

                  <?php

					   	$options=array();

						$options[]=JHTML::_('select.option',"0",JText::_( 'DT_PER_EVENT'));

						$options[]=JHTML::_('select.option',"1",JText::_( 'DT_ALL_EVENT'));

						echo JHTML::_('select.genericlist',$options,"events_enable","","value","text");

					?>

				</td>

				</td>

					<td valign="top" align="left">
                     <?php echo JHTML::tooltip((JText::_( 'DT_ENABLE_FOR_HELP' )), '', 'tooltip.png', '', ''); ?>
					
				</td>

			</tr>

			<tr class="typeshow type1 type3 type4">

				<td><?php echo JText::_( 'DT_CODE_DISCOUNT_TYPE');?>:</td>

				<td align="left">

         <?php

				    $options=array();

				    $options[]=JHTML::_('select.option', "1",JText::_( 'DT_AMOUNT'));

					$options[]=JHTML::_('select.option', "2",JText::_( 'DT_PERCENTAGE'));

					echo JHTML::_('select.genericlist',$options,"discount_type","","value","text");

				 ?>

				</td>

				<td valign="top" align="left">
                      <?php echo JHTML::tooltip((JText::_( 'DT_DISCOUNT_CODE_TYPE_HELP' )), '', 'tooltip.png', '', ''); ?>
					
				</td>

			</tr>

			<tr class="typeshow type2">

				<td><?php echo JText::_( 'DT_AMOUNT');?>:</td>

				<td align="left">

					<input class="text_area" type="text" name="amount" size="10" maxlength="250" value="" />

				</td>

				<td valign="top" align="left">
                      <?php echo JHTML::tooltip((JText::_( 'DT_DISCOUNT_CODE_AMOUNT_HELP' )), '', 'tooltip.png', '', ''); ?>
					
				</td>

			</tr>

			<tr class="typeshow type2">

				<td><?php echo JText::_('DT_DISCOUNT_CODE');?>:</td>

				<td align="left">

					<input class="text_area" type="text" name="code" size="10" maxlength="250" value="" />

				</td>

				<td valign="top" align="left">
                      
                      <?php echo JHTML::tooltip((JText::_( 'DT_DISCOUNT_CODE_HELP' )), '', 'tooltip.png', '', ''); ?>
					
				</td>

			</tr>
			 <tr >

				<td valign="top"><?php echo JText::_( 'DT_DISCOUNT_CODE_REGTYPE' );?>:</td>

				<td valign="top">

				<?php 
              $options = array();
			
              $options[]=JHTML::_('select.option',"1",JText::_( 'DT_INDIVIDUAL' ));

              $options[]=JHTML::_('select.option',"2",JText::_( 'DT_GROUP' ));

              $options[]=JHTML::_('select.option',"3",JText::_( 'DT_BOTH'));

	          echo JHTML::_('select.genericlist', $options,"code_useage_reg","","value","text",3);

				 ?>

				</td>

				<td valign="top"><?php echo JHTML::tooltip((JText::_( 'DT_DISCOUNT_CODE_REGTYPE_HELP' )), '', 'tooltip.png', '', '');?></td>

			</tr>
			
            <tr class="group_params">

				<td valign="top"><?php echo JText::_( 'DT_DISCOUNTCODE_GROUPOPTIONS' );?>:</td>

				<td valign="top">

				<?php

				 $options = array();

   				 $options[]=JHTML::_('select.option',"1",JText::_( 'DT_EACH_MEMBER' ));

			     $options[]=JHTML::_('select.option',"2",JText::_( 'DT_BILLING_ONLY' ));

   				 $options[]=JHTML::_('select.option',"3",JText::_( 'DT_MEMBERS_BILLING'));

				 echo JHTML::_('select.genericlist', $options,"discountcode_group_behave","","value","text",2);

 ?>

				</td>

				<td valign="top"><?php echo JHTML::tooltip((JText::_( 'DT_HELP_DISCOUNTCODE_GROUPOPTIONS' )), '', 'tooltip.png', '', '');?></td>

			</tr>
            <tr class="group_params">

				<td><?php echo JText::_( 'DT_DISCOUNT_CODE_MIN');?>:</td>

				<td align="left">

					<input class="text_area" type="text" name="min" size="3" maxlength="5" value="" />

				</td>

				<td valign="top" align="left">
                      
                      <?php echo JHTML::tooltip((JText::_( 'DT_DISCOUNT_CODE_MIN_HELP' )), '', 'tooltip.png', '', ''); ?>
					
				</td>

			</tr>
            
            <tr class="group_params" >

				<td><?php echo JText::_( 'DT_DISCOUNT_CODE_MAX');?>:</td>

				<td align="left">

					<input class="text_area" type="text" name="max" size="3" maxlength="5" value="" />

				</td>

				<td valign="top" align="left">
                      
                      <?php echo JHTML::tooltip((JText::_( 'DT_DISCOUNT_CODE_MAX_HELP' )), '', 'tooltip.png', '', ''); ?>
					
				</td>

			</tr>
			</tbody>

		</table>

    <input type="hidden" name="option" value="<?php echo DTR_COM_COMPONENT;?>" />
    
    <input type="hidden" name="controller" value="discountcode" />

    <input type="hidden" name="task" value="" />
    <input type="hidden" name="Itemid" value="<?php echo $Itemid;?>">

    </form>

     <script language="JavaScript" type="text/javascript">

	   DTjQuery(function(){
			
			 DTjQuery('select[name="code_useage_reg"]').change(function(){
      
				  if(DTjQuery(this).val() != "1") {
					  if(navigator.appName.indexOf("Micro") >=0){
		  
							  display = 'block';
		  
						  }else{
		  
							  display = 'table-row';
		  
						  }
						  DTjQuery(".group_params").css({display:display});
				  } else {
						 DTjQuery(".group_params").hide();
				  }
					
			})
  
   		    DTjQuery('select[name="code_useage_reg"]').trigger('change');
			
	   });

		Joomla.submitbutton =   function (pressbutton)

		{
           if(pressbutton=="cancel"){
		     submitform(pressbutton);
		   }else{
			document.adminForm.task.value = pressbutton;
			data = DTjQuery('#newDiscountCode').formSerialize();

			DTjQuery.post('index.php?no_html=1', data,function(){},'script');

			return false;
		   }

		}

		</script>
