<div class="jobs view">
<h2><?php  __('Job: '.$job['Job']['title']." for ".$customer['Customer']['name']);?></h2>
	<dl><?php $i = 0; $class = ' class="altrow"';?>
		
		
		<dt<?php if ($i % 2 == 0) echo $class;?>><?php __('Job Number'); ?></dt>
		<dd<?php if ($i++ % 2 == 0) echo $class;?>>
			<?php echo $job['Job']['title']; ?>
			&nbsp;
		</dd>
		<dt<?php if ($i % 2 == 0) echo $class;?>><?php __('Enquiry'); ?></dt>
		<dd<?php if ($i++ % 2 == 0) echo $class;?>>
			<?php echo $html->link($job['Enquiry']['title'], array('controller' => 'enquiries', 'action' => 'view', $job['Enquiry']['id'])); ?>
			&nbsp;
		</dd>
		<dt<?php if ($i % 2 == 0) echo $class;?>><?php __('Comments'); ?></dt>
		<dd<?php if ($i++ % 2 == 0) echo $class;?>>
			<?php echo $job['Job']['comments']; ?>
			&nbsp;
		</dd>
		<dt<?php if ($i % 2 == 0) echo $class;?>><?php __('Date Order Received'); ?></dt>
		<dd<?php if ($i++ % 2 == 0) echo $class;?>>
			<?php echo $this->element('isEmptyDate', 
                                array('date'=>$job['Job']['date_order_received'])); ?>
			&nbsp;
		</dd>
		
		<dt<?php if ($i % 2 == 0) echo $class;?>><?php __('Date Order Sent To Customer'); ?></dt>
		<dd<?php if ($i++ % 2 == 0) echo $class;?>>
			<?php echo $this->element('isEmptyDate', 
                                array('date'=> $job['Job']['date_order_sent_to_customer'])); ?>
			&nbsp;
		</dd>
		<dt<?php if ($i % 2 == 0) echo $class;?>><?php __('Customer Order Number'); ?></dt>
		<dd<?php if ($i++ % 2 == 0) echo $class;?>>
			<?php echo $job['Job']['customer_order_number']; ?>
			&nbsp;
		</dd>
		<dt<?php if ($i % 2 == 0) echo $class;?>><?php __('Domestic Freight Paid By'); ?></dt>
		<dd<?php if ($i++ % 2 == 0) echo $class;?>>
			<?php echo $job['Job']['domestic_freight_paid_by']; ?>
			&nbsp;
		</dd>
		<dt<?php if ($i % 2 == 0) echo $class;?>><?php __('Sale Category'); ?></dt>
		<dd<?php if ($i++ % 2 == 0) echo $class;?>>
			<?php echo $job['Job']['sale_category']; ?>
			&nbsp;
		</dd>
		<dt<?php if ($i % 2 == 0) echo $class;?>><?php __('Shipment Category'); ?></dt>
		<dd<?php if ($i++ % 2 == 0) echo $class;?>>
			<?php echo $job['Job']['shipment_category']; ?>
			&nbsp;
		</dd>
	</dl>
</div>

<div class="related">
	<h3><?php __('Purchase Orders for this Job');?></h3>
	<?php if (!empty($job['PurchaseOrder'])):?>
	<table cellpadding = "0" cellspacing = "0">
	<tr>
	
	<th>Issue Date</th>
	<th>Dispatch Date</th>
	<th>Date Arrived</th>
	<th>PO Number</th>
	<th>Principle</th>
	<th>Principle Reference</th>
	<th>Document</th>
	<th class="actions"><?php __('Actions');?></th>
	</tr>

	<?php
$i = 0;
foreach ($job['PurchaseOrder'] as $purchaseOrder):
	$class = null;
	if ($i++ % 2 == 0) {
		$class = ' class="altrow"';
	}
?>
	<tr<?php echo $class;?>>

		<td>
			<?php echo $purchaseOrder['issue_date']; ?>
		</td>
		<td>
			<?php echo $purchaseOrder['dispatch_date']; ?>
		</td>
		<td>
			<?php echo $purchaseOrder['date_arrived']; ?>
		</td>
		<td>
			<?php echo $purchaseOrder['title']; ?>
		</td>
		<td>
			<?php echo $html->link($principles[$purchaseOrder['principle_id']], array('controller' => 'principles', 'action' => 'view', $purchaseOrder['principle_id'])); ?>
		</td>
		<td>
			<?php echo $purchaseOrder['principle_reference']; ?>
		</td>
		<td>
			<?php //echo $html->link($purchaseOrder['Document']['id'], array('controller' => 'documents', 'action' => 'view', $purchaseOrder['Document']['id'])); ?>
		</td>
		<td class="actions">
			<?php echo $html->link(__('View', true), array('controller'=>'purchase_orders', 'action' => 'view', $purchaseOrder['id'])); ?>
			<?php echo $html->link(__('Edit', true), array('controller'=>'purchase_orders','action' => 'edit', $purchaseOrder['id'])); ?>
		</td>
	</tr>
<?php endforeach; ?>
</table>
</div>

	<?php endif;?>



<div class="related">
    <h3>
 Emails for this Job<?php echo $html->image('internet-mail.png'); ?>
    </h3>
<?php echo $this->element('email_table_ajax', array('emails' => $emails)); ?>
<?php //echo $this->element('email_table_ajax', $enquiry, array('cache'=>'+1 day')); ?>
</div>


<?php debug($job);?>
