<?php $katao_order = $katao_order_product->getKataoOrder() ?>
<div class="content-add01">
	<div class="heading01"><h1>Ajustement de la commande "<?php echo $katao_order->getNumber() ?>" du fournisseur "<?php echo $katao_order->getSupplierName() ?>" pour la période "<?php echo $katao_order->getKataoPeriod()->getName() ?>"</h1></div>
</div>

<?php echo form_tag('@katao_order_product_adjust?id=' . $katao_order_product->getId()) ?>

<?php $katao_product = $katao_order_product->getKataoProduct() ?>
<h3><?php echo $katao_order_product->getProductName() ?></h3>

<table class="admin-sub-list">
<tr>
	<td style="border:none!important">Commande : <?php echo $katao_product->getOrderDetails($katao_order_product->getKataoOrder()->getKataoPeriodId(), $katao_order_product->getKataoOrder()->getKataoNodeId(), true) ?></td>
	<th colspan="2" style="text-align:center!important">Quantités</th>
</tr>
<tr>
	<th>Adhérent</th>
	<th nowrap="nowrap" width="1%">Commandée</th>
	<th nowrap="nowrap" width="1%">Ajustée</th>
</tr>
<?php foreach ($katao_order_product->getKataoCartProductsJoinKataoCart() as/*(KataoCartProduct)*/ $katao_cart_product): ?>
	<?php $katao_member = $katao_cart_product->getKataoCart()->getMember() ?>
<tr>
 	<td>
 		<?php echo catalyz_link_to_image_tag('@katao_cart_pdf?id=' . $katao_cart_product->getKataoCartId(), 'actions/pdf.png', array('title' => 'Exporter la demande correspondante en PDF'), array('alt' => 'Exporter la demande correspondante en PDF', 'align' => 'top')) ?>
		<?php echo $katao_member->getFullName() ?>
 	</td>
 	<td><?php echo $katao_cart_product->getQuantity() ?></td>
 	<td nowrap="nowrap">
 	<?php if (!$view_mode_only): ?>
 		<a href="javascript://" onclick="document.getElementById('quantity_<?php echo $katao_cart_product->getId() ?>').value = Math.max(0, parseInt(document.getElementById('quantity_<?php echo $katao_cart_product->getId() ?>').value) - 1)" title="Diminuer la quantité"><?php echo image_tag('minus.png', array('alt' => 'Diminuer la quantité', 'align' => 'top')) ?></a>
		<?php echo input_tag('quantity[' . $katao_cart_product->getId() . ']', $katao_cart_product->getQuantityAdjusted(), array('style' => 'width: 20px; text-align: center;')) ?>
		<a href="javascript://" onclick="document.getElementById('quantity_<?php echo $katao_cart_product->getId() ?>').value = parseInt(document.getElementById('quantity_<?php echo $katao_cart_product->getId() ?>').value) + 1" title="Augmenter la quantité"><?php echo image_tag('plus.png', array('alt' => 'Augmenter la quantité', 'align' => 'top')) ?></a>
	<?php else: ?>
		<?php echo $katao_cart_product->getQuantityAdjusted() ?>
	<?php endif ?>
	</td>
</tr>
<?php endforeach ?>
<?php if (!$view_mode_only): ?>
<tr>
 	<td><?php echo select_tag('new_user_id', options_for_select($katao_order_product->getMembersWithoutProduct(), false, array('include_custom' => '&mdash;&nbsp;Ajouter une commande à un adhérent&nbsp;&mdash;'))) ?></td>
 	<td>-</td>
 	<td nowrap="nowrap">
 		<a href="javascript://" onclick="document.getElementById('quantity_0').value = Math.max(0, parseInt(document.getElementById('quantity_0').value) - 1)" title="Diminuer la quantité"><?php echo image_tag('minus.png', array('alt' => 'Diminuer la quantité', 'align' => 'top')) ?></a>
		<?php echo input_tag('quantity[0]', '0', array('style' => 'width: 20px; text-align: center;')) ?>
		<a href="javascript://" onclick="document.getElementById('quantity_0').value = parseInt(document.getElementById('quantity_0').value) + 1" title="Augmenter la quantité"><?php echo image_tag('plus.png', array('alt' => 'Augmenter la quantité', 'align' => 'top')) ?></a>
	</td>
</tr>
<?php endif ?>
</table>

<br /><?php if (!$view_mode_only): ?><?php echo submit_tag('Ajuster') ?> ou <?php endif ?><a href="<?php echo url_for('kataoOrder/index') ?>">annuler</a>

</form>