<?php
if ( ! defined( 'ABSPATH' ) ) {
	exit;
}
$qrcdr_get_watermarks = qrcdr_settings()->get_option( 'watermarks', '' );
// $qrcdr_allow_upload = in_array( 'logo', $qrcdr_features );
?>
<div class="accordion-body">
	<div class="form-group mt-3">
		<div class="qrcdr-upmarker shadow-sm">
			<div class="d-flex align-items-center flex-row">
				<div class="btn-group">
					<input type="radio" name="optionlogo" id="optionlogo-custom-<?php echo esc_attr( $form_id ); ?>" value="" class="btn-check custom-watermark-input">
					<label for="optionlogo-custom-<?php echo esc_attr( $form_id ); ?>" class="btn custom-watermark">
						<div class="hold-custom-watermark">
							<img src="<?php echo esc_url( plugin_dir_url( dirname( __DIR__ ) ) . 'images/upload.svg' ); ?>">
						</div>
					</label>
				</div>
				<label class="m-0 mx-3">
					Custom logo
				</label>
				<input type="file" accept="image/png, image/jpeg, image/svg+xml" multiple="false">
			</div>
		</div>
	</div>

	<div class="logoselecta form-group">
		<div data-bs-toggle="buttons">
			<div class="qrcdr-scrolling-nav-component">
				<div class="qrcdr-scrolling-nav-wrapper">
					<button class="btn btn-glass qrcdr-scroll-btn qrcdr-scroll-btn-left" aria-label="Prev">
						<?php qrcdr_icons()->the_icon( 'ui', 'chevron-left' ); ?>
					</button>
					<div class="qrcdr-scrolling-nav">
						<div class="d-flex flex-nowrap">
							<input type="radio" name="optionlogo" value="none" class="btn-check" id="qrcdr-watermark-delete-<?php echo esc_attr( $form_id ); ?>">
							<label class="py-2 px-3 m-0 rounded-0 d-flex align-items-center" role="button" for="qrcdr-watermark-delete-<?php echo esc_attr( $form_id ); ?>">
								<?php qrcdr_icons()->the_icon( 'ui', 'x-lg' ); ?>
							</label>
							<?php
							if ( strlen( $qrcdr_get_watermarks ) ) {
								$qrcdr_watermarks_array = explode( ',', $qrcdr_get_watermarks );
								$qrcdr_count = 0;
								foreach ( $qrcdr_watermarks_array as $qrcdr_watermark ) {
									$qrcdr_count++;
									$qrcdr_water_thumb = wp_get_attachment_image_url( $qrcdr_watermark );
									if ( $qrcdr_water_thumb ) {
										?>
							<input type="radio" name="optionlogo" value="<?php echo esc_attr( $qrcdr_watermark ); ?>" id="qrcdr-watermark-<?php echo esc_attr( $qrcdr_count ); ?>-id-<?php echo esc_attr( $form_id ); ?>" class="btn-check">
							<label class="btn btn-link rounded-0" for="qrcdr-watermark-<?php echo esc_attr( $qrcdr_count ); ?>-id-<?php echo esc_attr( $form_id ); ?>"><img src="<?php echo esc_url( $qrcdr_water_thumb ); ?>"></label>
										<?php
									}
								}
							}
							?>
						</div>
					</div>
					<button class="btn btn-glass qrcdr-scroll-btn qrcdr-scroll-btn-right" aria-label="Next">
						<?php qrcdr_icons()->the_icon( 'ui', 'chevron-right' ); ?>
					</button>
				</div>
			</div>
		</div>
	</div>
	<?php qrcdr_renderer()->the_input( $feature['inputs']['logo_size'] ); ?>
	<?php qrcdr_renderer()->the_input( $feature['inputs']['no_logo_bg'] ); ?>
</div>
