<div class="divide-y divide-gray-200 lg:col-span-9">
    <div class="py-6 px-4 sm:p-6 lg:pb-8">

        <main>
            <table id="abonnement-user-table">
                <tr>
                    <th scope="col">
						<?= __( 'Product', 'wpboutik' ) ?>
                    </th>
                    <th scope="col">
						<?= __( 'Limit date', 'wpboutik' ) ?>
                    </th>
                    <th scope="col">
						<?= __( 'automatic renewal', 'wpboutik' ) ?>
                    </th>
                </tr>
				<?php
				foreach ( $licenses as $license ) :
					$pid = $license['product'];
					$delay = '';
					if ( ! empty( $license['variant_id'] ) ) {
						$variants  = get_post_meta( $license['product'], 'variants', true );
						$variation = wpboutik_get_variation_by_id( json_decode( $variants ), $license['variant_id'] );
						$price     = $variation->price;
						if ( ! empty( $variation->recursive ) && $variation->recursive == 1 ) {
							$delay = display_recursivity( $variation->recursive_type, $variation->recursive_number );
						}
					} else {
						$price = get_post_meta( $pid, 'price', true );
						if ( get_post_meta( $pid, 'recursive', true ) == 1 ) {
							$delay = display_recursivity( get_post_meta( $pid, 'recursive_type', true ), get_post_meta( $pid, 'recursive_number', true ) );
						}
					}
					?>
                    <tr>
                        <td>
                            <a target="_blank"
                               href="<?= get_the_permalink( $pid ) ?>"><?= get_the_title( $pid ) ?></a>
                            <br/>
                            <small>
								<?= $price . get_wpboutik_currency_symbol() . ' ' . $delay ?>
                            </small>
                        </td>
                        <td>
							<?php
							$timestamp = strtotime( $license['limit_code'] );
							// Récupérer le format de date défini dans l'administration de WordPress
							$date_format = get_option( 'date_format' );
							// Afficher la date au format défini
							print date_i18n( $date_format, $timestamp );
							?>
                        </td>
                        <td>
							<?= ( ! empty( $license['auto_renew'] ) ) ? __( 'Yes' ) : __( 'No' ) ?>
                            <br/>
							<?= ( ! empty( $license['auto_renew'] ) ) ? '<a href="#" class="wpb-link wpb-resiliation" data-subscription="' . $license['id'] . '">' . __( 'Résilier' ) . '</a>' : '<a href="#" data-product="' . $license['product'] . '" data-variant="' . $license['variant_id'] . '" data-code="' . $license['code'] . '" class="wpb-link wpb-renew">' . __( 'Renouveler' ) . '</a>' ?>
                        </td>
                    </tr>
				<?php endforeach; ?>
            </table>
        </main>
    </div>
</div>