<div class="industries view">
<h2><?php  
				
				if($industry['ParentIndustry']['name']) {
					
					__($html->link('Industry', array('action' => 'index')).": ".$html->link($industry['ParentIndustry']['name'], 
						array('controller'=> 'industries', 'action'=>'view', $industry['ParentIndustry']['id']))
						.': '.$industry['Industry']['name']); }
				else {

				__($html->link('Industry', array('action' => 'index')).": ".$industry['Industry']['name']);
				}

				?></h2>
	

<div class="actions">
	<ul>
		<li><?php echo $html->link(__('Edit Industry', true), array('action'=>'edit', $industry['Industry']['id'])); ?> </li>
		<li><?php echo $html->link(__('Delete Industry', true), array('action'=>'delete', $industry['Industry']['id']), null, sprintf(__('Are you sure you want to delete # %s?', true), $industry['Industry']['id'])); ?> </li>
		<li><?php echo $html->link(__('List Industries', true), array('action'=>'index')); ?> </li>
		<li><?php echo $html->link(__('New Industry', true), array('action'=>'add')); ?> </li>
	</ul>
</div>


<?php if (!empty($industry['subIndustry'])):?>
<div class="related">
	<h3><?php __('Sub-Industries');?></h3>
	<table cellpadding = "0" cellspacing = "0">
	<tr>
		<th><?php __('Name'); ?></th>
		<th class="actions"><?php __('Actions');?></th>
	</tr>
	<?php
		$i = 0;
		foreach ($industry['subIndustry'] as $subIndustry):
			$class = null;
			if ($i++ % 2 == 0) {
				$class = ' class="altrow"';
			}
		?>
		<tr<?php echo $class;?>>
			<td><?php echo $subIndustry['name'];?></td>
			<td class="actions">
				<?php echo $html->link(__('View', true), array('controller'=> 'industries', 'action'=>'view', $subIndustry['id'])); ?>
				<?php echo $html->link(__('Edit', true), array('controller'=> 'industries', 'action'=>'edit', $subIndustry['id'])); ?>
			</td>
		</tr>
	<?php endforeach; ?>
	</table>


	<div class="actions">
		<ul>
			<li><?php echo $html->link(__('New Sub Industry', true), array('controller'=> 'industries', 'action'=>'add'));?> </li>
		</ul>
	</div>

<?php endif; ?>

</div>


<div class="related">
	<h3><?php __('Customers in this Industry');?></h3>
	

<?php if (!empty($industry['Customer'])):?>
	<table cellpadding = "0" cellspacing = "0">
	<tr>
		<th><?php __('Name'); ?></th>
		<th><?php __('Notes'); ?></th>
		<th><?php __('Payment Terms'); ?></th>
		<th class="actions"><?php __('Actions');?></th>
	</tr>
	<?php
		$i = 0;
		foreach ($industry['Customer'] as $customer):
			$class = null;
			if ($i++ % 2 == 0) {
				$class = ' class="altrow"';
			}
		?>
		<tr<?php echo $class;?>>
			<td><?php echo $customer['name'];?></td>
			<td><?php echo $customer['notes'];?></td>
			<td><?php echo $customer['payment_terms'];?></td>
			<td class="actions">
				<?php echo $html->link(__('View', true), array('controller'=> 'customers', 'action'=>'view', $customer['id'])); ?>
				<?php echo $html->link(__('Edit', true), array('controller'=> 'customers', 'action'=>'edit', $customer['id'])); ?>
			</td>
		</tr>
	<?php endforeach; ?>
	</table>


<?php  
		elseif (!empty($category_customers)): ?>

	<table cellpadding = "0" cellspacing = "0">
	<tr>
		<th><?php __('Name'); ?></th>
		<th><?php __('Notes'); ?></th>
		<th><?php __('Payment Terms'); ?></th>
		<th class="actions"><?php __('Actions');?></th>
	</tr>
	<?php
		$i = 0;
		foreach ($category_customers as $customer):
			$class = null;
			if ($i++ % 2 == 0) {
				$class = ' class="altrow"';
			}
		?>
		<tr<?php echo $class;?>>
			<td><?php echo $customer['name'];?></td>
			<td><?php echo $customer['notes'];?></td>
			<td><?php echo $customer['payment_terms'];?></td>
			<td class="actions">
				<?php echo $html->link(__('View', true), array('controller'=> 'customers', 'action'=>'view', $customer['id'])); ?>
				<?php echo $html->link(__('Edit', true), array('controller'=> 'customers', 'action'=>'edit', $customer['id'])); ?>
			</td>
		</tr>
	<?php endforeach; ?>
	</table>
<?php endif; ?>

</div>

<?php debug($industry); ?>



