<?php
/**
 * Template used to render "Send to KSeF" button. Button inits sending action
 *
 * @var int $post_id
 * @var string $download_url
 */
if ( ! defined( 'ABSPATH' ) ) exit;
?>

<p class="ksef-action-buttons">
	<a class="button button-primary fi-init-ksef" data-document-id="<?php echo esc_attr( $post_id ); ?>">
			<span class="dashicons dashicons-cloud-upload"></span>
			<?php esc_html_e( 'Send to KSeF', 'ksef-for-flexible-invoices' ); ?>
		</a>
	<?php if( $download_url !== null ): ?>
	<a href="<?php echo esc_url( $download_url ); ?>" class="button button-secondary" target="_blank">
		<span class="dashicons dashicons-download"></span>
		<?php esc_html_e( 'Download XML', 'ksef-for-flexible-invoices' ); ?>
	</a>
	<?php endif; ?>
	<span class="ksef-sending-warning" style="display:none; color: #d63638; margin-left: 10px; font-weight: bold;">
		<span class="dashicons dashicons-warning"></span>
		<?php esc_html_e( 'Save changes before sending to KSeF', 'ksef-for-flexible-invoices' ); ?>
</span>
</p>


<style>
	p.ksef-action-buttons{
		display:flex;
		flex-direction:row;
		gap:12px;
		align-items: center;
	}

	.ksef-action-buttons .button{
		display:flex;
		flex-direction:row;
		align-items: center;
		gap:4px;
	}

	.ksef-action-buttons .button .dashicons {
		width: 16px;
		height: 16px;
		font-size: 16px;
		line-height: 1;
	}

</style>
