<!-- Poll content Ajax load   -->

<h3 class="vr-text-color"><i class="fa fa-question-circle text-warning"></i>  Poll:   {{$poll_text}}  </h3>

@if(!empty($poll))
@if($poll_image!='')<img class="img-responsive" src="{{$poll_image}}">@endif

<?php
$total = 0;
foreach ($poll as $p) {
    $total += isset($p->number) ? $p->number : 0;
}
?>
@foreach($poll as $p)

<?php
$percent = 0;
if (isset($p->number) && !empty($p->number)) {
    $percent = $p->number / $total * 100;
    $percent = number_format((float) $percent, 0, '.', '');  // Outputs -> 105.00
}
?>
<strong>{{$p->poll_option_text}}</strong><span class="pull-right"></span>
<div class="progress">
    <div class="progress-bar {{Util::getColor($percent)}}" role="progressbar" aria-valuenow="40" aria-valuemin="0" aria-valuemax="100" style="width:{{$percent}}%">
        <center>  <b style="color:black"> {{$percent}}%</b></center>
    </div>
</div>
@endforeach
<hr>
<div class="row">
    <div class="col-md-2"><button class="btn btn-large btn-info vote btn-block" poll-id="{{$poll[0]->poll_id}}"><i class="fa fa-thumbs-o-up"></i> Vote</button></div>
    <div class="col-md-2"><a href="#" class="btn btn-large btn-info btn-facebook btn-block share" short_url="{{url()}}/poll-share/{{$short_code}}"><i class="fa fa-facebook"></i> Share </a></div>
    <div class="col-md-2">
        <a href="https://twitter.com/share" class="twitter-share-button" data-url="{{url()}}/poll-share/{{$short_code}}" data-size="large">Tweet</a>
        <script>!function(d, s, id) {
                var js, fjs = d.getElementsByTagName(s)[0], p = /^http:/.test(d.location) ? 'http' : 'https';
                if (!d.getElementById(id)) {
                    js = d.createElement(s);
                    js.id = id;
                    js.src = p + '://platform.twitter.com/widgets.js';
                    fjs.parentNode.insertBefore(js, fjs);
                }
            }(document, 'script', 'twitter-wjs');</script>
    </div>
    <div class="col-md-6"><input style="cursor: pointer" type="text" class="form-control input-sm" value="{{url()}}/poll-share/{{$short_code}}" readonly="readonly"></div>
</div>
<div>&nbsp;</div>
@else
<h4> No Poll found !</h4>
@endif
