<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
{assign var="ruleID" value=$ruleID|default:''}
<title>{$language.lblAdmin}: {$language.lblBundle} : {if $ruleID}{$language.lblEditBundle} {else} {$language.lblAddBundle}{/if}</title>
{include file='CommonStyles.tpl'}
{include file='CommonJavaScript.tpl'}
<link href="{$view_styles}/jqueryui.plugin.css" rel="stylesheet" type="text/css" />
<link href="{$view_styles}/jquery-ui-1.8.19.custom.css" rel="stylesheet" type="text/css" />
<link rel="stylesheet" type="text/css" href="{$view_styles}/add-edit.css" media="screen" />
<link rel="stylesheet" type="text/css" href="{$view_styles}/colorbox.css" media="screen" />
<link rel="stylesheet" type="text/css" href="{$view_styles}/choosen.css" />
{include file='CommonCustomStyles.tpl'}
<style>
.deleteConditionRow,.deleteGroupRow,.deleteBonusRow,.deleteBonusGroupRow{
	float:right;
	font-size: 10px;
	font-weight: bold;
	margin-left:5px;
}

</style>
</head>
<body>
{if $tabSection == ""}	
{assign var="tabSection" value="general"}
{/if}
<div class="outer_container">{include file='CommonTop.tpl'} 
  <!--End:Header Container--> 
  <!--***********************************************************************START CONTAINER SECTION******************************************************-->
	<div class="content_container equalHeight">
		<div class="content_wrapper">
		<noscript>
			<div class="message_info">{$language.lblJsEnable} !!</div>
		</noscript>
		<div class="strict_fixing_right">{include file='ContentLanguageOptions.tpl'}</div>
		<h2>  {if $ruleID}{$language.lblEditBundle} {else} {$language.lblAddBundle}{/if}</h2>
		<div id="common_message"></div>
		<!-- Inner Content Container starts-->
		<div class="inner_content_wrapper">         
        <!-- tab product details starts -->
			<div class="tab-content-outer  clearfix ">
				<div class="left_block fixing_left">
					<ul class="left-tab" id="maintab">
						<li class="sub">{html->anchor caption="<span>{$language.lblPromotionGeneral}</span>" class="left-tab-a {if $tabSection == "general"}active{/if}" rel="catalog-promo-save" section="general"}</li>
						<li class="sub">{html->anchor caption="<span>{$language.lblProducts}</span>" class="left-tab-a {if $tabSection == "conditions"}active{/if}" rel="catalog-promo-save" section="conditions"}</li>  
						<li class="sub">{html->anchor caption="<span>{$language.lblPrice}</span>" class="left-tab-a {if $tabSection == "bonus"}active{/if}" rel="catalog-promo-save" section="bonus"}</li> 
					</ul>
				</div>				            
				<div class="right_block fixing_right">
					{form->start name="bundleAddForm" action="" method="post" enctype="multipart/form-data" rel="catalog-promo-save"}
					<div id="catalog-promo-save-section" class="save-floating-section">
						<div class="cm-buttons-floating">
							<div class="submit-position"> 
								{form->submit name="submitCartPromotions" id="submitCartPromotions" class="blueBtn-1" value="{$language.lblSave}" form="bundleAddForm"}                
								{$language.lblOr}{html->anchor href="bundle/index/" class="grayBtn3" content=$language.lblCancel}
							</div>
						</div>
						<div class="cm-buttons"></div>
					</div>
					<!-- tab General tab-1 starts --> 
					<div class="tabpane" {if $tabSection == "general"}style="display:block;"{/if}>
						<div class="tabpane_inner"> 
							<div class="form_listing">
								<ul class="levl-00">
									<li class="clearfix">
										<div  class="left1 mandatory">{$language.lblPromotionName}</div>
										<div class="right1 fixing_right">
											{form->textbox  name="ruleName"  validate="required"  error=$language.errPromotionName class="textbox width-60per"  maxlength="225" value=$resPromo.ruleName|default:''}
										</div>
									</li>
                                                                        {if $ruleID}        
                                                                            <li class="clearfix">
										<div  class="left1 mandatory">{$language.lblBundleUrlKey}</div>
										<div class="right1 fixing_right">
                                                                                    {$resPromo.ruleKey|default:''}
                                                                                </div>
                                                                            </li>
                                                                        {else}
                                                                            <li class="clearfix">
										<div  class="left1 mandatory">{$language.lblBundleUrlKey}</div>
										<div class="right1 fixing_right">
                                                                                    {form->textbox name="ruleKey" validate="required~*callback_checkBundleUrlKeyExist" error="{$language.errUrlKeyRequired}~*{$language.errUrlKeyExists}" class="textbox width-60per" maxlength="225"} 
                                                                                </div>
                                                                            </li>
                                                                        {/if}
									<li class="clearfix">
										<div  class="left1">
											{$language.lblPromotionDescription}
										</div>
										<div class="right1 fixing_right">
											{form->editor mode="simple" skin=2  name="ruleDescription" id="ruleDescription" class="text-area-01" value=$resPromo.ruleDescription|default:''}
										</div>
									</li> 
									<li class="clearfix">
										<div  class="left1">{$language.lblBundleImage}
										</div>
										<div class="right1 fixing_right">
											{form->upload_image 
											name="promoImage"
											path= "uploads/bundle/product/"
											file= $resPromo.promoImage|default:''
											validate="required~*isImage"
											error=$language.errValidImage
											size_caption=$language.lblMaximumFileSize
											types_caption=$language.lblFileTypes}
										</div>
									</li> 
									<li class="clearfix">
										<div class="left1 ">{$language.lblStatus}</div>
										<div class="right1 fixing_right top-spc">
											<ul class="levl-03">
												<li>
													{if $resPromo.status=='A' || $resPromo.status==''}
														{assign var="statusChecked" value="A"} 
													{else}
														{assign var="statusChecked" value="I"} 
													{/if}
													{form->radio name="status" class="customradio" options="A->{$language.lblActive}~*I->{$language.lblInactive}" value=$statusChecked}
												</li>
											</ul>
										</div>
									</li>  
								</ul>
							</div>
						</div>
					</div>
					<!-- tab General tab-1 ends -->  
					<!-- tab Conditions tab-2 starts --> 
					<div  class="tabpane" {if $tabSection == "conditions"}style="display:block;"{/if}>
						<div class="tabpane_inner"> 
							{form->validate name="validateConditionSelection" validate="callback_checkConditionFields" error=$language.errEnterConditions}
							{form->hidden class="validateConditionValues" name="validateConditionValues" value="0"}
							<br/>
							{include file='BundleConditions.tpl'}
						</div>
					</div>
					<!-- tab Conditions tab-2 ends --> 
					<!-- tab Bonus tab-3 starts --> 
					<div  class="tabpane" {if $tabSection == "bonus"}style="display:block;"{/if}>
						<div class="tabpane_inner">
							{form->hidden class="validateBonusEnteredValues" name="validateBonusEnteredValues" value="0"}
							<div class="form_listing">
								<ul class="levl-00">
									<li class="clearfix">
										<div  class="left1">
										<strong>{$language.lblDiscountPrice}</strong>
										</div>
										<div class="right1 fixing_right">
											{form->hidden name="promoBonusType" value=$resPromo.apply}
											{if $resPromo.apply eq "by_percentage"}
												{assign var="promoDiscountBonusValueVar" value=$resPromo.discountAmount|number_format:2:".":""}
											{else}
												{assign var="promoDiscountBonusValueVar" value=$resPromo.discountAmount}
											{/if}
											{if $resPromo.apply eq ""}
												{assign var="bonusValueDisabled" value="disabled"}
												{assign var="bonusValueReadonly" value="true"}
											{/if}
											{form->textbox name="promoDiscountBonusValue" id="promoDiscountBonusValue" class="textbox width-136px" maxlength="225" autocomplete="off" value=$promoDiscountBonusValueVar validate="promoBonusType->isNotEqual->~*required~*isPrice~*promoBonusType->isEqual->Percentage~*isPercentage" error="~*"|cat:$language.errPromotionBonusPriceValue|cat:"~*"|cat:$language.errPromotionBonusPriceValue|cat:"~*"|cat:$language.errPromotionBonusPercentageValue:"~*"|cat:$language.errPromotionBonusPercentageValue}
										</div>
									</li> 
									
								</ul>
							</div>
						</div>
					</div>	
					<!-- tab Bonus tab-3 ends --> 
					{form->close}
				</div>    				
			</div>
		</div>
      <!-- tab product details ends -->       
		</div>
	</div>
  <!-- tab product details ends --> 
</div>
{include file='CommonBottom.tpl'}
</div>
<!--End:Outer Container-->
{include file='CommonJavaScriptBottom.tpl'} 
<script type="text/javascript" src="{$view_javascript}/custom-radiobutton.js"></script> 
<script type="text/javascript">
$(function(){
	 $('.customradio').customInput('');
	});	
var lblDelete = "{$language.lblDelete}";
var lblPromoProductQuantity = "{$language.lblPromoProductQuantity}";
var msgConfirmDelete="{$language.lblPromotionCouponDeleted}";
var lblSelectItem ="{$language.lblSelectItem}";
var msgSelectAStatus ="{$language.msgSelectAStatus}";
var lblCombinations ="{$language.lblCombinations}";
var lblVariants ="{$language.lblVariants}";
var lblCustomOptions ="{$language.lblCustomOptions}";
var lblFreeshipping ="{$language.lblFreeshipping}";
{if isset($attrData)}
	var attrArray = {$attrData};
	var attrData = attrArray.attributeArray;
	var attrOptionData = attrArray.attrOptionArray;
	var attrForOption = '';
	$.each(attrData, function(index, value) {
		attrForOption = attrForOption + '<option value="'+value['attributeID']+'" attrInputType="'+value['attrInputType']+'">'+value['attrName']+'</option>';
	});
	$(".promoConditionCopySource").find(".promotionCondtionElement_attributes").append(attrForOption);
	$(".promoBonusCopySource").find(".promotionBonusElement_attributes").append(attrForOption);
{/if}
</script> 
{form->editor_script names="ruleDescription"}
{form->editor_script names="termsAndConditions"}
{html->messages_script id="common_message"}
{form->basepath_script}
{form->rootpath_script}
<script type="text/javascript" src="{$view_javascript}/table.plugin.js"></script> 
<script type="text/javascript" src="{$common_js}/validate.plugin.js"></script>  
<script type="text/javascript" src="{$view_javascript}/jquery.colorbox.js"></script> 
<script type="text/javascript" src="{$view_javascript}/bundle.page.js"></script>
<script type="text/javascript" src="{$common_js}/uploadImage.plugin.js"></script>
{form->validate_script form="bundleAddForm"}
</body>
</html>