<?php
/**
 * This file contains the markup for the receipt email downloads.
 *
 * 
 * @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/emails/receipt/downloads.php
 */
?>
<tr>
	<td align="center">
		<!--[if mso]>
		<center>
			<table>
				<tr>
					<td width="640">
		<![endif]-->
		<table border="0" cellpadding="0" cellspacing="0" width="100%" style="max-width: 640px; background: <?php it_exchange( 'email', 'body-background-color' ); ?>; padding-bottom: 20px; margin: 0 auto;" class="wrapper body-bkg-color">
			<tr>
				<td valign="top" style="padding: 20px 25px; ">
					<table width="100%">
						<tr>
							<td>
								<h3 style="margin-top: 0;">
									<?php _e( 'Downloads', 'it-l10n-ithemes-exchange' ); ?>
								</h3>

								<?php if ( ! it_exchange( 'transaction', 'cleared-for-delivery' ) ): ?>

									<p>
										<?php
										_e( 'The status for this transaction does not grant access to downloadable files.', 'it-l10n-ithemes-exchange' );
										_e(' Once the transaction is updated to an approved status, you will receive a follow-up email with your download links.', 'it-l10n-ithemes-exchange' );
										?>
									</p>

								<?php else: ?>

									<?php while ( it_exchange( 'transaction', 'products' ) ): ?>
										<?php if ( it_exchange( 'transaction', 'has-product-downloads' ) ): ?>

											<h4 style="margin:.5em 0;">
												<?php it_exchange( 'transaction', 'product-attribute', 'attribute=product_name' ); ?>
											</h4>

											<?php while ( it_exchange( 'transaction', 'product-downloads' ) ): ?>

												<ul style="list-style: none;margin: 0;padding: 0;">
													<?php while ( it_exchange( 'transaction', 'product-download-hashes' ) ): ?>
														<li>
															<a href="<?php it_exchange( 'transaction', 'product-download-hash', 'attribute=download-url' ); ?>" class="button"
															   style="
																   padding: 10px 20px; margin: 5px 0; display: inline-block; background: <?php it_exchange( 'email', 'body-highlight-color' ); ?>;
																   color: <?php it_exchange( 'email', 'body-button-color' ); ?>; text-decoration: none;font-weight: bold;">
																<?php it_exchange( 'transaction', 'product-download', 'attribute=title' ); ?>
															</a>
														</li>
													<?php break; endwhile; ?>
												</ul>

											<?php endwhile; ?>
										<?php endif; ?>
									<?php endwhile; ?>

								<?php endif; ?>
							</td>
						</tr>
					</table>
				</td>
			</tr>
		</table>
		<!--[if mso]>
		</td></tr></table>
		</center>
		<![endif]-->
	</td>
</tr>
