<?php
/**
 * @version		3.0.0
 * @package		JomLand TicketCenter
 * @copyright	Copyright (C) 2010 JomLand.com. All rights reserved.
 * @link 		www.jomland.com
 * @license		GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
 */
defined('_JEXEC') or die('Restricted access');
$paid_disabled='';
$sent_disabled='';
$cancel_disabled='';
switch ($this->order->order_status){
	case JLTCENTER_PAID:
		$paid_disabled = 'disabled="disabled"';
		break;

	case JLTCENTER_SENT:
		$paid_disabled = 'disabled="disabled"';
		$sent_disabled = 'disabled="disabled"';
		break;

	case JLTCENTER_CANCEL:
		$paid_disabled = 'disabled="disabled"';
		$sent_disabled = 'disabled="disabled"';
		$cancel_disabled = 'disabled="disabled"';
		break;
}
?>

<script language="javascript" type="text/javascript">
<!--
function submitbutton(pressbutton) {
	
	var form = document.adminForm;
	if (pressbutton == 'cancel') {
		submitform(pressbutton);
		return;
	}
	// do field validation
	
	<?php /*
		$editor =& JFactory::getEditor();
		echo $editor->save('description');
    */ ?>
	submitform(pressbutton);
	
}
//-->

function submitOrderForm(pressbutton)
{
	if (pressbutton=='OrderCancel'){
		var ok= confirm('<?php echo JText::_('Cancel the order?');?>')
		if(!ok){
			return;
		}

	}
	var form = document.orderForm;
	form.new_status.value =pressbutton;
  	form.submit();
}
</script>

<div class="col100">
	<table width="100%" cellspacing="0" cellpadding="0" border="0">
		<tbody>
			<tr valign="top">
				<td>
					<fieldset class="adminform">
						<legend>
						<?php echo JText::_('Order Process'); ?>
						</legend>

						<form action="index.php" method="post" name="orderForm"
							id="orderForm">
							<input type="button" name="paid"
								value="<?php echo JText::_('Order Paid');?>"
								onclick="javascript: submitOrderForm('OrderPaid');"
						<?php echo $paid_disabled;?> /> <input type="button" name="sent"
								value="<?php echo JText::_('Tickets Sent');?>"
								onclick="javascript: submitOrderForm('OrderSent');"
						<?php echo $sent_disabled ;?> /> <input type="button"
								name="cencel" value="<?php echo JText::_('Order Cancel');?>"
								onclick="javascript: submitOrderForm('OrderCancel');"
						<?php echo $cancel_disabled;?> /> <input type="hidden"
								name="option" value="com_jlticketcenter" /> <input type="hidden"
								name="order_id" value="<?php echo $this->order->order_id;?>" />
							<input type="hidden" name="order_status"
								value="<?php echo $this->order->order_status;?>" /> <input
								type="hidden" name="new_status" id="new_status" value="" /> <input
								type="hidden" name="task" value="orderProcess" /> <input
								type="hidden" name="controller" value="order" />
								<?php echo JHTML::_( 'form.token' ); ?>

						</form>
					</fieldset>
				</td>
			</tr>
		</tbody>
	</table>
</div>



<form action="index.php" method="post" name="adminForm" id="adminForm">
	<div class="col100">

		<table width="100%" cellspacing="0" cellpadding="0" border="0">
			<tbody>
				<tr valign="top">
					<td>
						<fieldset class="adminform">
							<legend>
							<?php echo JText::_('Order Details'); ?>
							</legend>
							<table class="admintable" width="100%" cellspacing="0"
								cellpadding="0" border="0">
								<tr>
									<td width="100" class="key"><label for=""> <?php echo JText::_('Order Id'); ?>:
									</label>
									</td>
									<td><?php echo $this->order->order_id;?>
									</td>
								</tr>
								<tr>
									<td width="100" class="key"><label for="created"> <?php echo JText::_('Created'); ?>:
									</label>
									</td>
									<td><?php echo JHTML::_('date',$this->order->created, JText::_('DATE_FORMAT_LC4').' H:i');?>
									</td>
								</tr>


								<tr>
									<td width="100" class="key"><label for="order_status"> <?php echo JText::_('Order Status'); ?>:
									</label>
									</td>
									<td><?php echo $this->order_status;?>
									</td>
								</tr>

								<tr>
									<td width="100" class="key"><label for="delivery_method"> <?php echo JText::_('Delivery Methods'); ?>:
									</label>
									</td>
									<td><?php echo $this->DeliveryMethods;?>
									</td>
								</tr>



								<tr>
									<td width="100" class="key"><label for="type_desc"> <?php echo JText::_('Order Total'); ?>:
									</label>
									</td>
									<td><?php echo $this->params->get('currency_symbol');?> <input
										class="input" type="text" name="order_total" id="order_total"
										size="10" maxlength="50"
										value="<?php echo $this->order->order_total;?>" />
									</td>
								</tr>
								<?php /*
								<tr>
								<td width="100" class="key">
								<label for="manager_remark">
								<?php echo JText::_('Manager Remarks'); ?>:
								</label>
								</td>
								<td>
								<textarea rows="5" cols="60" id="manager_remark" name="manager_remark"><?php echo $this->order->manager_remark;?></textarea>
								</td>
								</tr>
								*/?>
							</table>
						</fieldset>

						<fieldset class="adminform">
							<legend>
							<?php echo JText::_('Order Lines');?>
							</legend>
							<table class="admintable" width="100%" cellspacing="0"
								cellpadding="0" border="0">
								<tr>
									<th><?php echo JText::_('ID');?></th>
									<th><?php echo JText::_('Event Name');?></th>
									<th><?php echo JText::_('Event Date');?></th>
									<th><?php echo JText::_('Event Location');?></th>
									<th><?php echo JText::_('Quantity');?></th>
									<th><?php echo JText::_('Ticket Price');?></th>
									<th><?php echo JText::_('Line Total');?></th>
								</tr>

								<?php foreach ($this->order_lines as $line){?>
								<tr>
									<td><?php echo $line->event_id;?></td>
									<td><?php echo $line->event_name;?></td>
									<td><?php echo JHTML::_('date',$line->event_date, JText::_('DATE_FORMAT_LC4').' H:i',null);?>
									</td>
									<td><?php echo $line->venue_name .' '.$line->city_name.' '.$line->state_name.' '.$line->country;?>
									</td>
									<td><?php echo $line->quantity;?></td>
									<td><?php if($line->event_type!=1){echo $this->params->get('currency_symbol').' '.$line->ticket_price;}?>
									</td>
									<td><?php if($line->event_type!=1){echo $this->params->get('currency_symbol').' '.$line->ticket_price * $line->quantity;}?>
									</td>
								</tr>


								<?php }?>

							</table>
						</fieldset>
					</td>
					<td width="410" valign="top">
						<fieldset class="adminform">
							<legend>
							<?php echo JText::_('Client Detials'); ?>
							</legend>
							<table class="admintable">
								<tr>
									<td class="key" style="width: 80px;"><label for="first_name"> <?php echo JText::_('First Name'); ?>:
									</label>
									</td>
									<td><input class="input" type="text" name="first_name"
										id="first_name" value="<?php echo $this->order->first_name;?>" />
									</td>
								</tr>

								<tr>
									<td class="key" style="width: 80px;"><label for="last_name"> <?php echo JText::_('Last Name'); ?>:
									</label>
									</td>
									<td><input class="input" type="text" name="last_name"
										id="last_name" value="<?php echo $this->order->last_name;?>" />
									</td>
								</tr>

								<tr>
									<td class="key" style="width: 80px;"><label for="phone_num"> <?php echo JText::_('Phone'); ?>:
									</label>
									</td>
									<td><input class="input" type="text" name="phone_num"
										id="phone_num" value="<?php echo $this->order->phone_num;?>" />
									</td>
								</tr>
								<tr>
									<td width="60" class="key" style="width: 80px;"><label
										for="street"> <?php echo JText::_('Street'); ?>: </label>
									</td>
									<td><input class="input" type="text" name="street" id="street"
										value="<?php echo $this->order->street;?>" />
									</td>
								</tr>
								<tr>
									<td width="60" class="key" style="width: 80px;"><label
										for="city"> <?php echo JText::_('City'); ?>: </label>
									</td>
									<td><input class="input" type="text" name="city" id="city"
										value="<?php echo $this->order->city;?>" />
									</td>
								</tr>
								<tr>
									<td width="60" class="key" style="width: 80px;"><label
										for="state"> <?php echo JText::_('State'); ?>: </label>
									</td>
									<td><input class="input" type="text" name="state" id="state"
										value="<?php echo $this->order->state;?>" />
									</td>
								</tr>
								<tr>
									<td width="60" class="key" style="width: 80px;"><label
										for="zip_code"> <?php echo JText::_('Zip code'); ?>: </label>
									</td>
									<td><input class="input" type="text" name="zip_code"
										id="zip_code" value="<?php echo $this->order->zip_code;?>" />
									</td>
								</tr>
								<tr>
									<td width="60" class="key" style="width: 80px;"><label
										for="country"> <?php echo JText::_('Country'); ?>: </label>
									</td>
									<td><input class="input" type="text" name="country"
										id="country" value="<?php echo $this->order->country;?>" />
									</td>
								</tr>
								<tr>
									<td width="60" class="key" style="width: 80px;"><label
										for="email"> <?php echo JText::_('Email'); ?>: </label>
									</td>
									<td><input class="input" type="text" name="email" id="email"
										value="<?php echo $this->order->email;?>" />
									</td>
								</tr>
								<tr>
									<td width="60" class="key" style="width: 80px;"><label
										for="order_ip"> <?php echo JText::_('order ip'); ?>: </label>
									</td>
									<td><?php echo $this->order->order_ip;?>
									</td>
								</tr>
							</table>
						</fieldset>
					</td>
				</tr>
			</tbody>
		</table>

	</div>
	<div class="clr"></div>

	<input type="hidden" name="option" value="com_jlticketcenter" /> <input
		type="hidden" name="order_id"
		value="<?php echo $this->order->order_id;?>" /> <input type="hidden"
		name="client_id" value="<?php echo $this->order->client_id;?>" /> <input
		type="hidden" name="user_id"
		value="<?php echo $this->order->user_id;?>" /> <input type="hidden"
		name="order_ip" value="<?php echo $this->order->order_ip;?>" /> <input
		type="hidden" name="delivery_rate"
		value="<?php echo $this->order->delivery_rate;?>" /> <input
		type="hidden" name="payment_method"
		value="<?php echo $this->order->payment_method;?>" /> <input
		type="hidden" name="order_status"
		value="<?php echo $this->order->order_status;?>" /> <input
		type="hidden" name="created"
		value="<?php echo $this->order->created;?>" /> <input type="hidden"
		name="task" value="save" /> <input type="hidden" name="controller"
		value="order" />
	<?php echo JHTML::_( 'form.token' ); ?>
</form>



