<?php
/**
 * Dokan Seller Single product tab Template
 *
 * @since 2.4
 *
 * @package dokan
 */

global $labels;

$store_user = dokan()->vendor->get($author->ID);
$store_address = dokan_get_seller_short_address($store_user->get_id(), false);
$social_info = $store_user->get_social_profiles();
$social_fields = dokan_get_social_profile_fields();
$biography = $store_info['vendor_biography'] ?? null;
?>
    <h2>
        <?php echo esc_html($store_info['store_name']); ?>
        <a href="<?php echo esc_url(dokan_get_store_url($author->ID)); ?>" class="vendor-page">
            (<?php esc_html_e($labels->get_label('view-vendor-page')); ?>)
        </a>
    </h2>
    <div class="vendor-contact row">
        <?php if (!dokan_is_vendor_info_hidden( 'phone' ) && $store_user->get_phone()): ?>
            <div class="col-12 col-lg-6">
                <div>
                    <span class="icon" data-icon="Icon-Communication-Phone"></span>
                    <span><?php esc_html_e($labels->get_label('phone')); ?>:&nbsp;</span>
                    <?php if (!empty($store_user->get_phone())): ?>
                        <a href="tel:<?php echo esc_html($store_user->get_phone()); ?>"><?php echo esc_html($store_user->get_phone()); ?></a>
                    <?php endif; ?>
                </div>
            </div>
        <?php endif; ?>
        <?php if (!dokan_is_vendor_info_hidden( 'email' ) && $store_user->show_email() == 'yes'): ?>
            <div class="col-12 col-lg-6">
                <div>
                    <span class="icon" data-icon="inbox"></span>
                    <span><?php esc_html_e($labels->get_label('email')); ?>:&nbsp;</span>
                    <?php if ($store_user->show_email() == 'yes'): ?>
                        <a href="mailto:<?php echo esc_attr(antispambot($store_user->get_email())); ?>"><?php echo esc_attr(antispambot($store_user->get_email())); ?></a>
                    <?php endif; ?>
                </div>
            </div>
        <?php endif; ?>
    </div>
    <hr>
<?php if (!dokan_is_vendor_info_hidden( 'address' ) && isset($store_address) && !empty($store_address)): ?>
    <div class="vendor-address">
        <span class="icon" data-icon="address-map"></span>
        <span><?php esc_html_e($labels->get_label('address')); ?>:&nbsp;</span>
        <?php echo wp_kses_post($store_address); ?>
    </div>
    <hr>
<?php endif; ?>
<?php if ($biography): ?>
    <div class="vendor-biography">
        <h4><?php esc_html_e($labels->get_label('about') . ' ' . $store_info['store_name']); ?></h4>
        <?php echo $biography; ?>
    </div>
    <hr>
<?php endif; ?>
<?php if ($social_fields): ?>
    <div class="store-social-wrapper">
        <ul class="store-social">
            <?php foreach ($social_fields as $key => $field): ?>
                <?php if (!empty($social_info[$key])): ?>
                    <li>
                        <a href="<?php echo esc_url($social_info[$key]); ?>" target="_blank"><i class="fa fa-<?php echo esc_attr($field['icon']); ?>"></i></a>
                    </li>
                <?php endif; ?>
            <?php endforeach; ?>
        </ul>
    </div>
<?php endif; ?>