<?php
if (isset($tpl['status']))
{
	$status = __('status', true);
	switch ($tpl['status'])
	{
		case 2:
			pjUtil::printNotice(NULL, $status[2]);
			break;
	}
} else {
	pjUtil::printNotice(__('infoAddProductTitle', true), __('infoAddProductDesc', true));
	?>
	
	<form action="<?php echo $_SERVER['PHP_SELF']; ?>?controller=pjAdminProducts&amp;action=pjActionCreate" method="post" id="frmCreateProduct" class="pj-form form">
		<input type="hidden" name="product_create" value="1" />
		
		<div class="clear_both">
			<p>
				<label class="title"><?php __('lblProductName'); ?></label>
				<span class="inline_block">
					<input type="text" name="name" class="pj-form-field required w300" data-msg-required="<?php __('lblFieldRequired');?>"/>
				</span>
			</p>
			<p>
				<label class="title"><?php __('lblPrice'); ?></label>
				<span class="inline_block">
					<span class="pj-form-field-custom pj-form-field-custom-before float_left r10">
						<span class="pj-form-field-before"><abbr class="pj-form-field-icon-text"><?php echo pjUtil::formatCurrencySign(NULL, $tpl['option_arr']['o_currency'], ""); ?></abbr></span>
						<input type="text" id="price" name="price" class="pj-form-field required number w60" data-currency="<?php echo $tpl['option_arr']['o_currency'];?>" data-msg-required="<?php __('lblFieldRequired');?>" data-msg-number="<?php __('lblValidPrice');?>"/>
					</span>
				</span>
			</p>
			<?php
			$price_suggestions = __('price_suggest', true); 
			$suggest_actions = __('suggest_action', true);
			?>
			<p>
				<label class="title"><?php __('lblPriceSuggestions'); ?></label>
				<span class="inline_block">
					<span class="block float_left r10 t5">
						<input type="radio" name="suggest_type" id="offer_type" value="offer" checked="checked" class="block float_left r5"/><label for="offer_type" class="block float_left"><?php echo $price_suggestions['offer'];?></label>
					</span>
					<span class="block float_left r10 t5">
						<input type="radio" name="suggest_type" id="suggest_type" value="suggest" class="block float_left r5"/><label for="suggest_type" class="block float_left"><?php echo $price_suggestions['suggest'];?></label>
					</span>
				</span>
			</p>
			
			<div id="pjSpOfferBox">
				<p>
					<label class="title"><?php __('lblPriceSuggestionOne'); ?></label>
					<span class="inline_block">
						<span class="pj-form-field-custom pj-form-field-custom-before float_left r10">
							<span class="pj-form-field-before"><abbr class="pj-form-field-icon-text"><?php echo pjUtil::formatCurrencySign(NULL, $tpl['option_arr']['o_currency'], ""); ?></abbr></span>
							<input type="text" name="price_suggest_1" class="pj-form-field number w60" data-msg-required="<?php __('lblFieldRequired');?>" data-msg-number="<?php __('lblValidPrice');?>"/>
						</span>
						<select name="price_suggest_1_action" class="pj-form-field w150 float_left r10 pjSpSuggestAction" data-index="1">
							<option value="">-- <?php __('lblAction'); ?> --</option>
							<?php
							foreach($suggest_actions as $k => $v)
							{
								?><option value="<?php echo $k;?>"<?php echo $k == 'promo' ? ' selected="selected"' : null;?>><?php echo $v;?></option><?php
							} 
							?>
						</select>
						<span id="price_suggest_1_promo_box" class="price_suggest_1 block float_left" style="display: block;">
							<label class="block float_left t5 r5 w80"><?php __('lblPromoCode');?></label>
							<input type="text" name="price_suggest_1_promo" class="pj-form-field w200"/>
						</span>
						<span id="price_suggest_1_email_box" class="price_suggest_1 block float_left" style="display: none;">
							<label class="block float_left t5 r5 w80"><?php __('lblEmailRequest');?></label>
							<input type="text" name="price_suggest_1_email" value="<?php __('lblDefaultEmailRequest');?>" class="pj-form-field w200"/>
						</span>
						<span id="price_suggest_1_thank_box" class="price_suggest_1 block float_left" style="display: none;">
							<label class="block float_left t5 r5 w80"><?php __('lblMessage');?></label>
							<input type="text" name="price_suggest_1_message" value="<?php __('lblDefaultMessage');?>" class="pj-form-field w200"/>
						</span>
					</span>
				</p>
				<p>
					<label class="title"><?php __('lblPriceSuggestionTwo'); ?></label>
					<span class="inline_block">
						<span class="pj-form-field-custom pj-form-field-custom-before float_left r10">
							<span class="pj-form-field-before"><abbr class="pj-form-field-icon-text"><?php echo pjUtil::formatCurrencySign(NULL, $tpl['option_arr']['o_currency'], ""); ?></abbr></span>
							<input type="text" name="price_suggest_2" class="pj-form-field number w60" data-msg-required="<?php __('lblFieldRequired');?>" data-msg-number="<?php __('lblValidPrice');?>"/>
						</span>
						
						<select name="price_suggest_2_action" class="pj-form-field w150 float_left r10 pjSpSuggestAction" data-index="2">
							<option value="">-- <?php __('lblAction'); ?> --</option>
							<?php
							foreach($suggest_actions as $k => $v)
							{
								?><option value="<?php echo $k;?>"<?php echo $k == 'promo' ? ' selected="selected"' : null;?>><?php echo $v;?></option><?php
							} 
							?>
						</select>
						<span id="price_suggest_2_promo_box" class="price_suggest_2 block float_left" style="display: block;">
							<label class="block float_left t5 r5 w80"><?php __('lblPromoCode');?></label>
							<input type="text" name="price_suggest_2_promo" class="pj-form-field w200"/>
						</span>
						<span id="price_suggest_2_email_box" class="price_suggest_2 block float_left" style="display: none;">
							<label class="block float_left t5 r5 w80"><?php __('lblEmailRequest');?></label>
							<input type="text" name="price_suggest_2_email" value="<?php __('lblDefaultEmailRequest');?>" class="pj-form-field w200"/>
						</span>
						<span id="price_suggest_2_thank_box" class="price_suggest_2 block float_left" style="display: none;">
							<label class="block float_left t5 r5 w80"><?php __('lblMessage');?></label>
							<input type="text" name="price_suggest_2_message" value="<?php __('lblDefaultMessage');?>" class="pj-form-field w200"/>
						</span>
					</span>
				</p>
				<p>
					<label class="title"><?php __('lblPriceSuggestionThree'); ?></label>
					<span class="inline_block">
						<span class="pj-form-field-custom pj-form-field-custom-before float_left r10">
							<span class="pj-form-field-before"><abbr class="pj-form-field-icon-text"><?php echo pjUtil::formatCurrencySign(NULL, $tpl['option_arr']['o_currency'], ""); ?></abbr></span>
							<input type="text" name="price_suggest_3" class="pj-form-field number w60" data-msg-required="<?php __('lblFieldRequired');?>" data-msg-number="<?php __('lblValidPrice');?>"/>
						</span>
						
						<select name="price_suggest_3_action" class="pj-form-field w150 float_left r10 pjSpSuggestAction" data-index="3">
							<option value="">-- <?php __('lblAction'); ?> --</option>
							<?php
							foreach($suggest_actions as $k => $v)
							{
								?><option value="<?php echo $k;?>"<?php echo $k == 'promo' ? ' selected="selected"' : null;?>><?php echo $v;?></option><?php
							} 
							?>
						</select>
						<span id="price_suggest_3_promo_box" class="price_suggest_3 block float_left" style="display: block;">
							<label class="block float_left t5 r5 w80"><?php __('lblPromoCode');?></label>
							<input type="text" name="price_suggest_3_promo" class="pj-form-field w200"/>
						</span>
						<span id="price_suggest_3_email_box" class="price_suggest_3 block float_left" style="display: none;">
							<label class="block float_left t5 r5 w80"><?php __('lblEmailRequest');?></label>
							<input type="text" name="price_suggest_3_email" value="<?php __('lblDefaultEmailRequest');?>" class="pj-form-field w200"/>
						</span>
						<span id="price_suggest_3_thank_box" class="price_suggest_3 block float_left" style="display: none;">
							<label class="block float_left t5 r5 w80"><?php __('lblMessage');?></label>
							<input type="text" name="price_suggest_3_message" value="<?php __('lblDefaultMessage');?>" class="pj-form-field w200"/>
						</span>
					</span>
				</p>
			</div>
			<div id="pjSpSuggestBox" style="display: none;">
				<?php
				$label_one =  __('lblPriceRangeOne', true);
				$label_two =  __('lblPriceRangeTwo', true);
				$label_three =  __('lblPriceRangeThree', true);
				
				$label_one = str_replace("{R1}", "", $label_one);
				$label_one = str_replace("{R2}", "", $label_one);
				
				$label_two = str_replace("{R3}", "", $label_two);
				$label_two = str_replace("{R4}", "", $label_two);
				
				$label_three = str_replace("{R5}", "", $label_three);
				$label_three = str_replace("{R6}", "", $label_three);
				?>
				<p>
					<label id="pjSpLabelOne" class="block float_left w250 t5 r10" data-title="<?php __('lblPriceRangeOne');?>"><?php echo $label_one; ?></label>
					<span class="inline_block">
						<select name="price_range_1_action" class="pj-form-field w150 float_left r10 pjSpRangeAction" data-index="1">
							<option value="">-- <?php __('lblAction'); ?> --</option>
							<?php
							foreach($suggest_actions as $k => $v)
							{
								?><option value="<?php echo $k;?>"<?php echo $k == 'promo' ? ' selected="selected"' : null;?>><?php echo $v;?></option><?php
							} 
							?>
						</select>
						<span id="price_range_1_promo_box" class="price_range_1 block float_left" style="display: block;">
							<label class="block float_left t5 r5 w80"><?php __('lblPromoCode');?></label>
							<input type="text" name="price_range_1_promo" class="pj-form-field w200"/>
						</span>
						<span id="price_range_1_email_box" class="price_range_1 block float_left" style="display: none;">
							<label class="block float_left t5 r5 w80"><?php __('lblEmailRequest');?></label>
							<input type="text" name="price_range_1_email" value="<?php __('lblDefaultEmailRequest');?>" class="pj-form-field w200"/>
						</span>
						<span id="price_range_1_thank_box" class="price_range_1 block float_left" style="display: none;">
							<label class="block float_left t5 r5 w80"><?php __('lblMessage');?></label>
							<input type="text" name="price_range_1_message" value="<?php __('lblDefaultMessage');?>" class="pj-form-field w200"/>
						</span>
					</span>
				</p>
				<p>
					<label id="pjSpLabelTwo" class="block float_left w250 t5 r10" data-title="<?php __('lblPriceRangeTwo');?>"><?php echo $label_two; ?></label>
					<span class="inline_block">
						<select name="price_range_2_action" class="pj-form-field w150 float_left r10 pjSpRangeAction" data-index="2">
							<option value="">-- <?php __('lblAction'); ?> --</option>
							<?php
							foreach($suggest_actions as $k => $v)
							{
								?><option value="<?php echo $k;?>"<?php echo $k == 'promo' ? ' selected="selected"' : null;?>><?php echo $v;?></option><?php
							} 
							?>
						</select>
						<span id="price_range_2_promo_box" class="price_range_2 block float_left" style="display: block;">
							<label class="block float_left t5 r5 w80"><?php __('lblPromoCode');?></label>
							<input type="text" name="price_range_2_promo" class="pj-form-field w200"/>
						</span>
						<span id="price_range_2_email_box" class="price_range_2 block float_left" style="display: none;">
							<label class="block float_left t5 r5 w80"><?php __('lblEmailRequest');?></label>
							<input type="text" name="price_range_2_email" value="<?php __('lblDefaultEmailRequest');?>" class="pj-form-field w200"/>
						</span>
						<span id="price_range_2_thank_box" class="price_range_2 block float_left" style="display: none;">
							<label class="block float_left t5 r5 w80"><?php __('lblMessage');?></label>
							<input type="text" name="price_range_2_message" value="<?php __('lblDefaultMessage');?>" class="pj-form-field w200"/>
						</span>
					</span>
				</p>
				<p>
					<label id="pjSpLabelThree" class="block float_left w250 t5 r10" data-title="<?php __('lblPriceRangeThree');?>"><?php echo $label_three; ?></label>
					<span class="inline_block">
						<select name="price_range_3_action" class="pj-form-field w150 float_left r10 pjSpRangeAction" data-index="3">
							<option value="">-- <?php __('lblAction'); ?> --</option>
							<?php
							foreach($suggest_actions as $k => $v)
							{
								?><option value="<?php echo $k;?>"<?php echo $k == 'promo' ? ' selected="selected"' : null;?>><?php echo $v;?></option><?php
							} 
							?>
						</select>
						<span id="price_range_3_promo_box" class="price_range_3 block float_left" style="display: block;">
							<label class="block float_left t5 r5 w80"><?php __('lblPromoCode');?></label>
							<input type="text" name="price_range_3_promo" class="pj-form-field w200"/>
						</span>
						<span id="price_range_3_email_box" class="price_range_3 block float_left" style="display: none;">
							<label class="block float_left t5 r5 w80"><?php __('lblEmailRequest');?></label>
							<input type="text" name="price_range_3_email" value="<?php __('lblDefaultEmailRequest');?>" class="pj-form-field w200"/>
						</span>
						<span id="price_range_3_thank_box" class="price_range_3 block float_left" style="display: none;">
							<label class="block float_left t5 r5 w80"><?php __('lblMessage');?></label>
							<input type="text" name="price_range_3_message" value="<?php __('lblDefaultMessage');?>" class="pj-form-field w200"/>
						</span>
					</span>
				</p>
			</div>
			
			<p>
				<label class="title"><?php __('lblAskForPrice'); ?></label>
				<span class="inline_block">
					<input type="text" name="ask_price" value="<?php __('lblAskForPriceDefaultText');?>" class="pj-form-field w400"/>
				</span>
			</p>
			<p>
				<label class="title"><?php __('lblStatus'); ?></label>
				<span class="inline_block">
					<select name="status" id="status" class="pj-form-field required" data-msg-required="<?php __('lblFieldRequired');?>">
						<option value="">-- <?php __('lblChoose'); ?>--</option>
						<?php
						foreach (__('u_statarr', true) as $k => $v)
						{
							?><option value="<?php echo $k; ?>"<?php echo $k == 'T' ? ' selected="selected"' : NULL;?>><?php echo $v; ?></option><?php
						}
						?>
					</select>
				</span>
			</p>
			<p>
				<label class="title">&nbsp;</label>
				<input type="submit" value="<?php __('btnSave'); ?>" class="pj-button" />
				<input type="button" value="<?php __('btnCancel'); ?>" class="pj-button" onclick="window.location.href='<?php echo PJ_INSTALL_URL; ?>index.php?controller=pjAdminProducts&action=pjActionIndex';" />
			</p>
		</div>
	</form>
	
	<script type="text/javascript">
	var myLabel = myLabel || {};
	</script>
	<?php
}
?>