<?php
/**
 * Default template part for the purchase
 * confirmation page.
 *
 * 
 * @version 1.1.0
 * @link http://ithemes.com/codex/page/Exchange_Template_Updates
 * @package IT_Exchange
 *
 * WARNING: Do not edit this file directly. To use
 * this template in a theme, simply copy over this
 * file's content to the exchange directory located
 * at your templates root.
 *
 * Example: theme/exchange/content-confirmation.php
*/
?>

<div id="it-exchange-confirmation">
	<?php if ( it_exchange( 'transactions', 'found' ) ) : ?>
		<?php while( it_exchange( 'transactions', 'exist' ) ) : ?>
			<?php it_exchange( 'transaction', 'date' ); ?><br />
			<?php it_exchange( 'transaction', 'status' ); ?><br />
			<?php it_exchange( 'transaction', 'total' ); ?><br />
			<?php it_exchange( 'transaction', 'instructions' ); ?><br />

			<?php if ( it_exchange( 'transaction', 'has-products' ) ) : ?>
				<div class="transaction-products">
					<?php while( it_exchange( 'transaction', 'products' ) ) : ?>
						<div class="transaction-product">
							<?php it_exchange( 'transaction', 'product-attribute', array( 'attribute' => 'title', 'wrap' => 'h3' ) ); ?>
							<?php if ( it_exchange( 'transaction', 'has-product-downloads' ) ) : ?>
								<div class="transaction-product-downloads">
									<?php if ( ! it_exchange( 'transaction', 'get-cleared-for-delivery' ) ) : ?>
										<p><?php _e( 'The status for this transaction does not grant access to downloadable files. Once the transaction is updated to an appoved status, you will receive a followup email with your download links.', 'it-l10n-ithemes-exchange' ); ?></p>
									<?php endif; ?>
									<?php while( it_exchange( 'transaction', 'product-downloads' ) ) : ?>
										<div class="transaction-product-download">
											<h4 class="transaction-product-download-title">
												<?php it_exchange( 'transaction', 'product-download', array( 'attribute' => 'title' ) ); ?>
											</h4>
											<?php if ( it_exchange( 'transaction', 'has-product-download-hashes' ) ) : ?>
												<ul class="transaction-product-download-hashes">
													<?php while( it_exchange( 'transaction', 'product-download-hashes' ) ) : ?>
														<li>
															<code class="download-hash">
																<?php it_exchange( 'transaction', 'product-download-hash', array( 'attribute' => 'hash' ) ); ?>
															</code>
															<?php if ( it_exchange( 'transaction', 'get-product-download-hash', array( 'attribute' => 'expires' ) ) ) : ?>
																<span class="download-expiration">
																	<?php _e( 'Expires on', 'it-l10n-ithemes-exchange' ); ?> <?php it_exchange( 'transaction', 'product-download-hash', array( 'attribute' => 'expiration-date' ) ); ?>
																</span>
															<?php else : ?>
																<span class="download-expiration">
																	<?php _e( 'No expiration date', 'it-l10n-ithemes-exchange' ); ?>
																</span>
															<?php endif; ?>
															<?php if ( it_exchange( 'transaction', 'get-product-download-hash', array( 'attribute' => 'download-limit' ) ) ) : ?>
																<span class="download-limit">
																	<?php it_exchange( 'transaction', 'product-download-hash', array( 'attribute' => 'downloads-remaining' ) ); ?> <?php _e( 'download(s) remaining', 'it-l10n-ithemes-exchange' ); ?>
																</span>
															<?php else : ?>
																<span class="download-limit">
																	<?php _e( 'Unlimited downloads', 'it-l10n-ithemes-exchange' ); ?>
																</span>
															<?php endif; ?>
															<?php if ( ! it_exchange( 'transaction', 'get-product-download-hash', array( 'attribute' => 'download-limit' ) ) || it_exchange( 'transaction', 'get-product-download-hash', array( 'attribute' => 'downloads-remaining' ) ) ) : ?>
																<?php if ( it_exchange( 'transaction', 'get-cleared-for-delivery' ) ) : ?>
																	<span>
																		<a href="<?php it_exchange( 'transaction', 'product-download-hash', array( 'attribute' => 'download-url' ) ); ?>"><?php _e( 'Download Now', 'it-l10n-ithemes-exchange' ); ?></a>
																	</span>
																<?php endif; ?>
															<?php endif; ?>
														</li>
													<?php endwhile; ?>
												</ul>
											<?php endif; ?>
										</div>
									<?php endwhile; ?>
								</div>
							<?php endif; ?>
						</div>
					<?php endwhile; ?>
				</div>
			<?php endif; ?>
		<?php endwhile; ?>
	<?php else : ?>
		<p class="error"><?php _e( 'No transactions found.', 'it-l10n-ithemes-exchange' ); ?></p>
	<?php endif; ?>
</div>
