<?php 
    $post_id = get_the_ID();
    $img_id = get_post_thumbnail_id($post_id) ?? '';
    $img_size = !empty($img_size) ? $settings['img_size'] : '767x899';

    $thumbnail = solarva_get_thumbnail($img_id, $img_size, false, 'layzyload');

    $position = get_post_meta($post_id, 'team_position', '');
    $email = get_post_meta($post_id, 'team_email', '');
    $phone_number = get_post_meta($post_id, 'team_phone_number', '');
    $address = get_post_meta($post_id, 'team_address', '');
    

    $info_title1 = 'Email Address';
    $info_title2 = 'Phone Number';
    $info_title3 = 'Address';
    $socials = (!empty($settings['social_custom'])) ? $settings['social'] : get_team_socials($post_id);
    
?>
<div class="pxl-team-info pxl-team-info1">
    <div class="pxl-item--container">
        <div class="pxl-item--inner">
            <div class="pxl-key--info">
                <?php if(!empty($thumbnail)) : ?>
                    <div class="pxl-item--featured">
                        <?php pxl_print_html($thumbnail); ?>
                    </div>
                <?php endif; ?>
                <h2 class="pxl-item--title">
                    <a class="pxl-title--link" href="<?php echo esc_url(get_permalink($post_id)); ?>">
                        <?php echo esc_attr(get_the_title($post_id)); ?>
                    </a>
                </h2>
                <?php if(!empty($position)) : ?>
                    <span class="pxl-item--position">
                        <?php echo esc_attr($position[0]); ?>
                    </span>
                <?php endif; ?>
            </div>
            <div class="pxl-add--info">
                <?php if(!empty($email)) :  ?>
                    <div class="pxl-item--group">
                        <span class="pxl-info--title">
                            <?php echo esc_attr($info_title1); ?>
                        </span>
                        <h3 class="pxl-item--email pxl-item--info"><?php echo esc_html($email[0]); ?></h3>
                    </div>
                <?php endif; ?>
                    
                <?php if(!empty($phone_number)) :  ?>
                    <div class="pxl-item--group">
                        <span class="pxl-info--title">
                            <?php echo esc_attr($info_title2); ?>
                        </span>
                        <h3 class="pxl-item--tel pxl-item--info"><?php echo esc_html($phone_number[0]); ?></h3>
                    </div>
                <?php endif; ?>

                <?php if(!empty($address)) :  ?>
                    <div class="pxl-item--group">
                        <span class="pxl-info--title">
                            <?php echo esc_attr($info_title3); ?>
                        </span>
                        <h3 class="pxl-item--email pxl-item--info"><?php echo esc_html($address[0]); ?></h3>
                    </div>
                <?php endif; ?>

            </div>
            <?php if(!empty($socials)): ?>
                <?php $socials = (!empty($settings['social_custom'])) ? json_decode($socials, true) : $socials; ?>
                <div class="pxl-item--socials">
                    <?php foreach ($socials as $social): ?>
                        <?php 

                            $is_active = isset($social['is_active']) ? (bool)$social['is_active'] : true;
                            $social_url = !empty($social['url']) ? $social['url'] : '#';
                        ?>
                        <?php if($is_active) : ?>
                            <a class="btn pxl-item--social" href="<?php echo esc_url($social_url); ?>" target="_blank">
                                <i class="<?php echo esc_attr($social['icon']); ?>"></i>
                            </a>
                        <?php endif; ?>
                    <?php endforeach; ?>
                </div>
            <?php endif; ?>
        </div>
    </div>
</div>