<?php
/**
 * Orders sync modal view template
 *
 * @package FinalPOS
 */

if ( ! defined( 'ABSPATH' ) ) {
	die( 'Direct access is not allowed.' );
}

if ( ! is_admin() ) {
	return;
}
?>

<!-- Orders Sync Modal -->
<div id="orders-sync-modal" class="finalpos-modal">
	<div class="finalpos-modal-content">
		<div class="finalpos-modal-header">
			<h2 class="finalpos-modal-title"><?php esc_html_e( 'Configure Orders Sync', 'finalpos' ); ?></h2>
			<span class="finalpos-modal-close" data-modal-id="orders-sync-modal">&times;</span>
		</div>
		<div class="finalpos-modal-body">
			<p class="finalpos-modal-description">
				<?php esc_html_e( 'We will sync online orders from your WooCommerce store to Final POS for the last 30 days, or you can select a specific time period:', 'finalpos' ); ?>
			</p>

			<div class="finalpos-form-group">
				<label class="finalpos-form-label"><?php esc_html_e( 'Sync from date (optional):', 'finalpos' ); ?></label>
				<input type="date" id="orders-from-date" class="finalpos-form-input" value="<?php echo esc_attr( gmdate( 'Y-m-d', strtotime( '-30 days' ) ) ); ?>">
				<p class="finalpos-form-help-text"><?php esc_html_e( 'Leave empty to sync all orders', 'finalpos' ); ?></p>
			</div>

			<div class="finalpos-form-actions">
				<button type="button" class="finalpos-button finalpos-button-secondary modal-cancel" data-modal-id="orders-sync-modal"><?php esc_html_e( 'Cancel', 'finalpos' ); ?></button>
				<button type="button" class="finalpos-button modal-save" data-modal-id="orders-sync-modal" data-sync-type="orders"><?php esc_html_e( 'Save', 'finalpos' ); ?></button>
			</div>
		</div>
	</div>
</div>
