<?php

namespace FSPoster\App\view;

use FSPoster\App\Providers\DB;
use FSPoster\App\Providers\Helper;

defined( 'ABSPATH' ) or exit;
?>

<div class="fs_setting_item">
	<div class="fs_setting_item_label" style="width: 55%;">
		<div><?=esc_html__('Custom text:' , 'fs-poster')?></div>
		<div class="fs_s_help">
			<div><?=esc_html__('You can customize the text of the shared post as you like by using the current keywords.' , 'fs-poster')?></div>
			<div>
				<div class="fs_text_codes">
					<div><?=esc_html__('Post ID' , 'fs-poster')?></div>
					<div class="ws_tooltip ws_color_info append_to_text" data-title="<?=esc_html__('Click to append in text' , 'fs-poster')?>">{id}</div>
				</div>
				<div class="fs_text_codes">
					<div><?=esc_html__('Post title' , 'fs-poster')?></div>
					<div class="ws_tooltip ws_color_info append_to_text" data-title="<?=esc_html__('Click to append in text' , 'fs-poster')?>">{title}</div>
				</div>
				<div class="fs_text_codes">
					<div><?=esc_html__('Post excerpt' , 'fs-poster')?></div>
					<div class="ws_tooltip ws_color_info append_to_text" data-title="<?=esc_html__('Click to append in text' , 'fs-poster')?>">{excerpt}</div>
				</div>
				<div class="fs_text_codes">
					<div><?=esc_html__('Post author name' , 'fs-poster')?></div>
					<div class="ws_tooltip ws_color_info append_to_text" data-title="<?=esc_html__('Click to append in text' , 'fs-poster')?>">{author}</div>
				</div>
				<div class="fs_text_codes">
					<div><?php echo esc_html__('Limited post content:', 'fs-poster'); ?> <i class="fas fa-info-circle ws_tooltip" data-title="<?php echo esc_html__('Default is first 40 characters. You can set it whatever you want.', 'fs-poster'); ?>"></i></div>
					<div class="ws_tooltip ws_color_info append_to_text" data-title="<?=esc_html__('Click to append in text' , 'fs-poster')?>">{content_short_40}</div>
				</div>
				<div class="fs_text_codes">
					<div><?=esc_html__('Post content Full' , 'fs-poster')?></div>
					<div class="ws_tooltip ws_color_info append_to_text" data-title="<?=esc_html__('Click to append in text' , 'fs-poster')?>">{content_full}</div>
				</div>
				<div class="fs_text_codes">
					<div><?=esc_html__('Post link' , 'fs-poster')?></div>
					<div class="ws_tooltip ws_color_info append_to_text" data-title="<?=esc_html__('Click to append in text' , 'fs-poster')?>">{link}</div>
				</div>
				<div class="fs_text_codes">
					<div><?=esc_html__('Post short link' , 'fs-poster')?></div>
					<div class="ws_tooltip ws_color_info append_to_text" data-title="<?=esc_html__('Click to append in text' , 'fs-poster')?>">{short_link}</div>
				</div>
				<div class="fs_text_codes">
					<div><?=esc_html__('Featured image URL' , 'fs-poster')?></div>
					<div class="ws_tooltip ws_color_info append_to_text" data-title="<?=esc_html__('Click to append in text' , 'fs-poster')?>">{featured_image_url}</div>
				</div>
				<div class="fs_text_codes">
					<div><?=esc_html__('WooCommerce - product price' , 'fs-poster')?></div>
					<div class="ws_tooltip ws_color_info append_to_text" data-title="<?=esc_html__('Click to append in text' , 'fs-poster')?>">{product_regular_price}</div>
				</div>
				<div class="fs_text_codes">
					<div><?=esc_html__('WooCommerce - product sale price' , 'fs-poster')?></div>
					<div class="ws_tooltip ws_color_info append_to_text" data-title="<?=esc_html__('Click to append in text' , 'fs-poster')?>">{product_sale_price}</div>
				</div>
				<div class="fs_text_codes">
					<div><?=esc_html__('Unique ID' , 'fs-poster')?></div>
					<div class="ws_tooltip ws_color_info append_to_text" data-title="<?=esc_html__('Click to append in text' , 'fs-poster')?>">{uniq_id}</div>
				</div>
				<div class="fs_text_codes">
					<div><?=esc_html__('Post Tags' , 'fs-poster')?></div>
					<div class="ws_tooltip ws_color_info append_to_text" data-title="<?=esc_html__('Click to append in text' , 'fs-poster')?>">{tags}</div>
				</div>
				<div class="fs_text_codes">
					<div><?=esc_html__('Post Categories' , 'fs-poster')?></div>
					<div class="ws_tooltip ws_color_info append_to_text" data-title="<?=esc_html__('Click to append in text' , 'fs-poster')?>">{categories}</div>
				</div>
				<div class="fs_text_codes">
					<div><?=esc_html__('Custom fields' , 'fs-poster')?></div>
					<div class="ws_tooltip ws_color_info append_to_text" data-title="<?=esc_html__('Click to append in text' , 'fs-poster')?>">{cf_KEY}</div>
				</div>
			</div>
		</div>
	</div>
	<div class="fs_s_input" style="width: 45%;">
		<textarea class="ws_form_element2" name="fs_post_text_message_twitter" id="custom_text_area" style="height: 150px !important;"><?=esc_html(Helper::getOption('post_text_message_twitter', "{title}"))?></textarea>
	</div>
</div>

<div style="display: flex;">
	<div style="width: 50%;">
		<div class="fs_setting_item">
			<div class="fs_setting_item_label">
				<div><?=esc_html__('Limit the Custom text symbols:' , 'fs-poster')?></div>
				<div class="fs_s_help"><?=esc_html__('Twitter limits Tweet length to a maximum of 280 characters for display.  By enabling the option, the first 280 characters of your text will be shared; otherwise, the tweet will not be shared because of exceeding.' , 'fs-poster')?></div>
			</div>
			<div class="fs_s_input">
				<div class="fs_onoffswitch">
					<input type="checkbox" name="fs_twitter_auto_cut_tweets" class="fs_onoffswitch-checkbox" id="fs_twitter_auto_cut_tweets"<?=Helper::getOption('twitter_auto_cut_tweets', '1')?' checked':''?>>
					<label class="fs_onoffswitch-label" for="fs_twitter_auto_cut_tweets"></label>
				</div>
			</div>
		</div>
	</div>
</div>

<div style="display: flex;">
	<div style="">
		<div class="fs_setting_item">
			<div class="fs_setting_item_label" style="width: 55%;">
				<div><?=esc_html__('Posting type:' , 'fs-poster')?></div>
				<div class="fs_s_help"><?=esc_html__('Choose a method to share your tweets: Link card view – share the tweets with the link; Upload featured image only - upload and share featured image only; Upload all post images - upload and share featured image and all attached images as albom.' , 'fs-poster')?></div>
			</div>
			<input type="hidden" name="fs_twitter_posting_type" id="fs_twitter_posting_type" value="<?=Helper::getOption('twitter_posting_type', '1')?>">
			<div class="fs_image_buttons1">
				<div<?=(Helper::getOption('twitter_posting_type', '1')=='1' ? ' class="selected_btn"' : '') ?> data-id="1">
					<img src="<?=Helper::assets('images/post_link_type.png')?>">
					<span>Link card view</span>
				</div>
				<div<?=(Helper::getOption('twitter_posting_type', '1')=='2' ? ' class="selected_btn"' : '') ?> data-id="2">
					<img src="<?=Helper::assets('images/post_image_type.png')?>">
					<span>Upload featured image only</span>
				</div>
				<div<?=(Helper::getOption('twitter_posting_type', '1')=='3' ? ' class="selected_btn"' : '') ?> data-id="3">
					<img src="<?=Helper::assets('images/post_multi_image_type.png')?>">
					<span>Upload all post images</span>
				</div>
			</div>
		</div>
	</div>
</div>


<script>
	var fadeSpeed = 0;
	jQuery(document).ready(function()
	{
		if( typeof $ == 'undefined' ) var $ = typeof jQuery == 'undefined' ? null : jQuery;

		$("#save_btn").click(function()
		{
			var data = fsCode.serialize($(".settings_form"));

			fsCode.ajax('settings_twitter_save' , data , function(result)
			{
				fsCode.toast("<?=esc_html__('Save successful!' , 'fs-poster');?>" , 'success');
			});
		});

		fadeSpeed = 200;
	});
</script>