<div class="wrap">
	<h1>
		<?php esc_html_e('belboon WooCommerce Advertiser Plugin', BELBOON_TACKING_TEXTDOMAIN);?>
	</h1>
	<div class="bb-option-container">
		<div class="bb-option-box left">
			<form method="post" action="options.php">
				<?php settings_fields(BelboonAdvertiserTrackingPlugin::OPTION_GROUP);?>
				<?php do_settings_sections(BelboonAdvertiserTrackingPlugin::OPTION_GROUP);?>
				<table class="form-table">
					<tr valign="top">
						<th scope="row"><?php _e("Advertiser ID", BELBOON_TACKING_TEXTDOMAIN);?></th>
						<td>
							<input type="text" name="<?php echo BelboonAdvertiserTrackingPlugin::OPTION_ADVERTISER_ID;?>" value="<?php echo $belboon_plugin->getAdvertiserId();?>" />
						</td>
					</tr>
					<tr valign="top">
						<th scope="row"><?php _e("Tracking Domain", BELBOON_TACKING_TEXTDOMAIN);?></th>
						<td>
                            <?php foreach(BelboonAdvertiserTrackingPlugin::OPTION_TRACKING_TYPE_OPTIONS as $key => $value):?>
                                <?php
                                    $name = BelboonAdvertiserTrackingPlugin::OPTION_TRACKING_TYPE;
	                                $translated_name = $belboon_plugin->getTranslatedTrackingTypeName($key, $value);
                                    $checked_html = '';
                                    if($belboon_plugin->getTrackingTypeKey() === $key) {
                                        $checked_html = ' checked="checked"';
                                    }
                                ?>
                                <label class="bb-radio-lbl">
                                    <input type="radio" class="js-belboon-radio-trackingdomain-type" value="<?php echo $key;?>" name="<?php echo $name;?>"<?php echo $checked_html;?> /> <?php echo $translated_name;?>
                                </label>
                            <?php endforeach;?>
						</td>
					</tr>
					<tr valign="top">
						<th scope="row">&nbsp;</th>
						<td>
							<div class="bb-inline-input-wrap">
                                <input type="text" class="bb-inline-input" placeholder="<?php _e("subdomain", BELBOON_TACKING_TEXTDOMAIN);?>" value="<?php echo $belboon_plugin->getTrackingSubdomain();?>" name="<?php echo BelboonAdvertiserTrackingPlugin::OPTION_TRACKING_SUBDOMAIN;?>" />
                                <span>.</span>
                                <?php
                                    $hide_hint_html = '';
                                    if($belboon_plugin->getTrackingTypeKey() === BelboonAdvertiserTrackingPlugin::OPTION_TRACKING_TYPE_1ST_PARTY_KEY) {
                                        $hide_hint_html = ' style="display:none;"';
                                    }
                                ?>
                                <span class="js-belboon-tracking-domain-hint"<?php echo $hide_hint_html;?>>r.</span>
                                <input type="text" class="bb-inline-input" placeholder="<?php _e("domainname", BELBOON_TACKING_TEXTDOMAIN);?>" value="<?php echo $belboon_plugin->getTrackingDomainname();?>" name="<?php echo BelboonAdvertiserTrackingPlugin::OPTION_TRACKING_DOMAINNAME;?>" />
                                <span>.</span>
                                <input type="text" class="bb-inline-input" placeholder="<?php _e("tld", BELBOON_TACKING_TEXTDOMAIN);?>" value="<?php echo $belboon_plugin->getTrackingTld();?>" name="<?php echo BelboonAdvertiserTrackingPlugin::OPTION_TRACKING_TLD;?>" maxlength="3" style="width:45px;" />
							</div>
						</td>
					</tr>
					<tr valign="top">
						<th scope="row">&nbsp;</th>
						<td>
							<?php
								submit_button(
									null,
									'bb-button',
								);
							?>
						</td>
					</tr>
				</table>
			</form>
		</div>
		<div class="right">
            <div class="bb-option-box">
                <div class="bb-status-row">
                    <div class="bb-small">
                        <?php _e("Status:", BELBOON_TACKING_TEXTDOMAIN);?>
                    </div>
                    <?php
                        if($belboon_plugin->trackingIsAcitve() === true) {
                            echo '✅ ' . __("Tracking is active", BELBOON_TACKING_TEXTDOMAIN);
                        } else {
                            echo '❌ ' . __("Tracking is not active", BELBOON_TACKING_TEXTDOMAIN);
                        }
                    ?>
                </div>
                <div class="bb-status-row">
                    <div class="bb-small">
	                    <?php _e("Active Tracking Domain:", BELBOON_TACKING_TEXTDOMAIN);?>
                    </div>
                    <?php
                        $tracking_domain = $belboon_plugin->getTrackingDomain();
                        if($tracking_domain !== '') {
                            echo $tracking_domain;
                        } else {
	                        _e("Please enter a valid Tracking Domain", BELBOON_TACKING_TEXTDOMAIN);
                        }
                    ?>
                </div>
                <div class="bb-status-row">
                    <div class="bb-small">
	                    <?php _e("Plugin Version:", BELBOON_TACKING_TEXTDOMAIN);?>
                    </div>
                    <?php echo BELBOON_TACKING_VERSION;?>
                </div>
            </div>
            <div class="bb-option-box">
                <img src="<?php echo plugins_url('../assets/img/belboon_logo.svg?v='.BELBOON_TACKING_VERSION, __FILE__);?>" />
                <h2><?php _e("You need some help?", BELBOON_TACKING_TEXTDOMAIN);?></h2>
                <p>
                    <?php _e("You have a question about our service or a problem with the integration of the plugin? Just contact us with a click on the button.", BELBOON_TACKING_TEXTDOMAIN);?>
                </p>
                <a href="mailto:info@belboon.com" class="button bb-button bb-button-ghost"><?php _e("Contact us", BELBOON_TACKING_TEXTDOMAIN);?></a>
            </div>
		</div>
	</div>
</div>
