<?php

	/**
	 * Template für die Integration von Click&Buy in die Bestellverwaltung
	 */

?>
<?php if (wpsg_isSizedString($this->view['wpsg_mod_cab']['strError'])) { ?>
<div class="wpsg_error"><?php echo $this->view['wpsg_mod_cab']['strError']; ?></div><br />
<?php } ?>

<div style="width:30%; float:left;"><?php echo __("Derzeitiger Status", "wpsg"); ?></div>

<div style="width:70%; float:right;">
	<?php echo $this->view['wpsg_mod_cab']['order']['cab_transactionStatus'].' ('.wpsg_formatTimestamp(strtotime($this->view['wpsg_mod_cab']['order']['cab_lastupdate'])).')'; ?>
	<a href="#" onclick="return wpsg_mod_cab_reload();"><?php echo __("Neu abfragen", "wpsg"); ?></a>
</div><div style="clear:both; height:3px; width:100%;"></div>			

<div style="width:100%;">
	<div style="width:30%; float:left;"><?php echo __("transactionID", "wpsg"); ?>:</div>
	<div style="width:70%; float:right;"><?php echo $this->view['wpsg_mod_cab']['order']['cab_transactionID']; ?></div>
</div><div style="clear:both; height:3px; width:100%;"></div>
		
<div style="width:100%;">
	<div style="width:30%; float:left;"><?php echo __("externalID", "wpsg"); ?>:</div>
	<div style="width:70%; float:right;"><?php echo $this->view['wpsg_mod_cab']['order']['cab_externalid']; ?></div>
</div><div style="clear:both; height:3px; width:100%;"></div>

<?php if (wpsg_isSizedArray($this->view['wpsg_mod_cab']['log'])) { ?>
<table style="width:100%;">
	<tr>
		<th><?php echo __("Datum", "wpsg"); ?></th>
		<th><?php echo __("Event ID", "wpsg"); ?></th>
		<th><?php echo __("Alter Status", "wpsg"); ?></th>
		<th><?php echo __("Neuer Status", "wpsg"); ?></th>
	</tr>
	<?php foreach ($log as $l) { ?>
	<tr>
		<td><?php echo date("d.m.Y H:i:s", strtotime($l['cdate'])); ?></td>
		<td><?php echo $l['eventID']; ?></td>
		<td><?php echo $l['oldState']; ?></td>
		<td><?php echo $l['newState']; ?></td>
	</tr>
	<?php } ?>
</table><div style="clear:both; height:3px; width:100%;"></div>
<?php } ?>

<div style="width:100%;">
<div style="width:30%; float:left;"><?php echo __("Link zum Bezahlen", "wpsg"); ?>:</div>
<div style="width:70%; float:right;">
	<a href="<?php echo $this->view['wpsg_mod_cab']['order']['cab_paylink']; ?>"><?php echo __("Link", "wpsg"); ?></a>&nbsp;|&nbsp;
	<a href="#" onclick="return wpsg_mod_cab_rebuild();"><?php echo __("Neu generieren und versenden", "wpsg"); ?></a>
</div>
</div><div style="clear:both; height:3px; width:100%;"></div>
		
<br />

<div style="width:30%; float:left; line-height:20px;"><?php echo __("Rückzahlung", "wpsg"); ?>:</div>
	
<?php if (($this->view['wpsg_mod_cab']['order']['price_gesamt'] - $this->view['wpsg_mod_cab']['order']['cab_repayed']) > 0) { ?>
<div style="width:70%; float:left;">
	<input type="text" id="wpsg_cab_repayvalue" name="wpsg_cab_repayvalue" value="" />&nbsp;&nbsp;(<?php echo __('Max', 'wpsg'); ?>: <?php echo wpsg_ff($this->view['wpsg_mod_cab']['order']['price_gesamt'] - $this->view['wpsg_mod_cab']['order']['cab_repayed'], $this->get_option('wpsg_currency')).')'; ?>
	<input onclick="return wpsg_mod_cab_repay();" type="submit" value="<?php echo __("Zurückzahlen", "wpsg"); ?>" style="float:right;" />
</div>
<?php } ?>
	
<div style="clear:both; height:3px; width:100%;"></div>