<div class="panel panel-default">
	<div class="panel-heading">
	    <h3 class="panel-title"><img src="<?php echo isset($image)?$image:'';?>" style="margin-top: -3px;" alt="">&nbsp;<strong><?php echo isset($item_name)?$item_name:''; ?></strong></h3>
	</div>
   	<div class="panel-body">
	    <div class="tabbable">
	        <div class="tab-navigation form-inline">
	            <ul class="nav nav-tabs mainMenuTabs">
	                <li class="active"><a href="#tab_gift_settings" data-toggle="tab"><i class="fa fa-gift"></i>&nbsp;<?php echo $gift_options;?> </a></li>
	                <li><a href="#tab_gift_description" data-toggle="tab"><i class="fa fa-comment-o"></i>&nbsp;<?php echo $gift_description;?></a></li>
	            </ul>
	        </div>
	  	</div>
		<div class="tab-content">
	   	 	<div class="tab-pane active" id="tab_gift_settings">
				<table class="giftForm table">
					<tr>
						<td><?php echo $valid_from; ?></td>
						<td>
							<div class="input-group">
								<span class="input-group-addon"><i class="fa fa-calendar-o" type="text" ></i></span>
								<input type="text" class="form-control datetimepicker" name="startDate" value="<?php echo isset($gift['start_date'])?date('Y-m-d H:i', $gift['start_date']):''; ?>" placeholder="Start date..."/>
							</div>
							<input type="hidden" id="itemParams" gift-id="<?php echo $gift_id; ?>" item-id="<?php echo isset($item_id)?$item_id:''; ?>" condition-type="<?php echo isset($gift['condition_type'])?$gift['condition_type']:0;?>" />
						</td>
					</tr>
					<tr>
						<td><?php echo $valid_to;?></td>
						<td>
							<div class="input-group">
								<span class="input-group-addon"><i class="fa fa-calendar-o" type="text" ></i></span>					
								<input type="text" class="form-control datetimepicker" name="endDate" value="<?php echo isset($gift['end_date'])?date('Y-m-d H:i', $gift['end_date']):''; ?>" placeholder="End date..."/>
							</div>
						</td>	
					</tr>
					<tr>
						<td><?php echo $entry_sort_order; ?></td>
						<td><input class="form-control" name="sort_order" type="number" style="width:100px;" value="<?php echo isset($gift['sort_order'])?$gift['sort_order']:'0'; ?>" placeholder="Sort order"/>
							</div>
						</td>	
					</tr>
					<tr>
						<td class="col-md-4"><?php echo $get_gift_when;?></td>
						<td class="col-md-8">
							<div class="form-group">
								<select name="selectCondition" class="form-control">
									<option value="1" <?php if(isset($gift['condition_type']) && $gift['condition_type'] == '1'){ ?>selected="selected"<?php } ?>>1.&nbsp;<?php echo $condition_total;?></option>
									<option value="2" <?php if(isset($gift['condition_type']) && $gift['condition_type'] == '2'){ ?>selected="selected"<?php } ?>>2.&nbsp;<?php echo $condition_certain;?></option>
									<option value="3" <?php if(isset($gift['condition_type']) && $gift['condition_type'] == '3'){ ?>selected="selected"<?php } ?>>3.&nbsp;<?php echo $condition_some;?></option>
									<option value="4" <?php if(isset($gift['condition_type']) && $gift['condition_type'] == '4'){ ?>selected="selected"<?php } ?>>4.&nbsp;<?php echo $condition_category;?></option>
								</select>
								<input type="hidden" name="gift-parameters" gift-id="<?php echo $gift_id;?>" />
							</div>
						</td>
					</tr>
				
					<tr class="option-widget" id="total_amount" style="display:none;">
						<td>
							<?php echo $total_amount; ?>
						</td>	
						<td>
                        	<input name="total_amount" style="width:43%; display:inline-block;" type="number" class="form-control" value="<?php echo isset($total)?$total:'0'; ?>"/>&nbsp;&nbsp;&nbsp;and&nbsp;&nbsp;&nbsp;
							<input name="total_amount_max" style="width:43%; display:inline-block;"  type="number" class="form-control" value="<?php echo isset($total_max)?$total_max:'1000000000'; ?>"/>
                        </td>
					</tr>
					
					<tr style="display:none" id="some-product-selector" class="option-widget" style="position: absolute;">
				      	<td><?php echo $entry_product;?></td>
				    	<td>
				         	<div>
                            	<div id="product_help"><?php echo $some_product_help; ?></div>
				         		<input type="text" name="product" class="form-control" style="z-index: 2000;" placeholder="Type a product name here.." />
                                <label style="margin-left:15px" for="some_product_quantity">Qty:</label>
                            	<input class="form-control" id="some_product_quantity" name="some_product_quantity" type="number" style="width:80px;" value="<?php echo isset($some_product_quantity)?$some_product_quantity:'1'; ?>" placeholder="Quantity"/>
				         	</div>
				          	<div id="some-gift-product" class="scrollbox">
				            	<?php if(isset($some)) foreach ($some as $product) { ?>
				            		<div id="<?php echo $product['product_id']; ?>"><?php echo $product['name']; ?><i class="glyphicon glyphicon-minus-sign removeIcon"></i><input type="hidden" name="gift[product][]" value="<?php echo $product['product_id']; ?>" /></div>
				            	<?php } ?>
				            </div>
				     	</td>
				    </tr> 
				    
				    <tr style="display:none" id="certain-product-selector" class="option-widget">
				      	<td><?php echo $entry_product;?></td>
				    	<td>
				         	<div>
                            	<div id="product_help"><?php echo $certain_product_help; ?></div>
                            	<input type="text" name="product" style="z-index: 2000;" class="form-control" placeholder="Type a product name here.." />
                                <label style="margin-left:15px" for="certain_product_quantity">Qty:</label>
                            	<input class="form-control" id="certain_product_quantity" name="certain_product_quantity" type="number" style="width:80px;" value="<?php echo isset($certain_product_quantity)?$certain_product_quantity:'1'; ?>" placeholder="Quantity"/>
                            </div>
				          	<div id="certain-gift-product" class="scrollbox">
				            	<?php if(isset($certain)) foreach ($certain as $product) { ?>
				            		<div id="<?php echo $product['product_id']; ?>"><?php echo $product['name']; ?><i class="glyphicon glyphicon-minus-sign removeIcon"></i><input type="hidden" value="<?php echo $product['product_id']; ?>" /></div>
				            	<?php } ?>
				            </div>
				     	</td>
				    </tr>
				    
				    <tr style="display:none" id="category-selector" class="option-widget">
				      	<td>
				      		<?php echo $entry_category; ?>
				      	</td>
				      	<td>
				      		<div>
                                <input type="text" name="category" class="form-control" style="z-index: 2000;" placeholder="Type a category name here.." /></div>
				          	<div id="gift-category" class="scrollbox">
				          		<?php  if(isset($categories)) foreach ($categories as $category) { ?>
				           	 		<div id="<?php echo $category['category_id']; ?>"><?php echo $category['name']; ?><i class="glyphicon glyphicon-minus-sign removeIcon"></i><input type="hidden" value="<?php echo $category['category_id']; ?>" /></div>
				            	<?php } ?>
				          	</div>
				      	</td>
				    </tr>
				</table>
			</div>
			<!--Gift description -->
			<div class="tab-pane" id="tab_gift_description">
				<div class="tabbable">
			      	<div class="tab-navigation">
			        	<ul class="nav nav-tabs notificationMessageTabs" style="margin-top:10px;">
			          		<?php $class="active"; foreach ($languages as $lang) : ?>
			               		<li class="<?php echo $class; $class='';?>"><a href="#description_lang_<?php echo $lang["code"]; ?>" data-toggle="tab"><img src="view/image/flags/<?php echo $lang['image']; ?>" title="<?php echo $lang['name']; ?>" /></a></li>
			          		<?php endforeach; ?> 
			        	</ul>
			      	</div><!-- /.tab-navigation --> 
			      	<div class="tab-content">
						<?php $class="active"; foreach ($languages as $lang) :  if(isset($gift['description'])){
							$description = unserialize(base64_decode($gift['description']));
						}?>
			               <div class="tab-pane <?php echo $class; $class='';?>" id="description_lang_<?php echo $lang["code"]; ?>">		
			                  <div class="col-md-12">
			                    	<textarea id="desc_<?php echo $lang['code']?>"><?php echo isset($description['desc_' . $lang["code"]])?$description['desc_' . $lang["code"]]:''; ?></textarea>	
			                  </div>
			               </div>
			          	<?php endforeach; ?> 
					</div>
				</div>
			</div>
		</div>
	</div>
</div>
<a id="cancelCondition" class="btn btn-warning btn-small" data-dismiss="modal"><?php echo $button_cancel;?></a>&nbsp; 
<a id="saveCondition" class="btn btn-success btn-small" gift-id="<?php echo $gift_id;?>"  onclick="saveItem($(this));" ><?php echo $button_save;?></a></td>
<span class="error hidden">&nbsp;&nbsp;<i class='fa fa-warning'></i></span>