<?php

$coingeck_type = get_post_meta($post_id, 'coingecko_widget_type', true);
$locale = get_post_meta($post_id, 'coingecko_locale', true);
$currency_code = get_post_meta($post_id, 'coingecko_select_currency', true);
$width = get_post_meta($post_id, 'coingecko_width', true);
$height = get_post_meta($post_id, 'coingecko_height', true);
//$back_color = get_post_meta($post_id, 'coingecko_back_color', true);
$coin_id = get_post_meta($post_id, 'coingecko_coin_id', true);
$top_coin = get_post_meta($post_id, 'coingecko_top_coin', true);
$type_compare = get_post_meta($post_id, 'coingecko_type_compare', true);
$coin_array = get_post_meta($post_id, 'coingecko_compare_coins', true);
$coin_compare='';
if($coin_array != null){
$coin_compare = implode(',',$coin_array);
}


if($coingeck_type == "marketlist"){
    $currency_code = strtolower($currency_code);
    $output  .='<div class="ccpw-coingecko-widget" style="width:'.esc_attr($width).'%;">
   <gecko-coin-market-ticker-list-widget locale="'.$locale.'" outlined="true" coin-id="'.$coin_id.'" initial-currency="'.$currency_code.'"></gecko-coin-market-ticker-list-widget>
    </div>';
}

else if($coingeck_type == "heatmap"){
    $output .= '<div class="ccpw-coingecko-widget" style="width:'.esc_attr($width).'%;"> 
    <gecko-coin-heatmap-widget  height='.esc_attr($height).'  locale='.esc_attr($locale).' outlined="true" top="'.esc_attr($top_coin).'"></gecko-coin-heatmap-widget>
    </div>'  ;
}
else if($coingeck_type == "comparsionchart"){
    $output .= '<div class="ccpw-coingecko-widget">
    <gecko-coin-compare-chart-widget  locale="'.esc_attr($locale).'" outlined="true"  coin-ids="'.esc_attr($coin_compare).'" initial-currency="'.esc_attr($currency_code).'"
    ></gecko-coin-compare-chart-widget>
    </div>';

}
else {
    $output .=__('You have not selected any Widget to display', 'ccpw');

}