<div class="page-content-wrapper">
    <div class="page-content all">
        <div class="row">
            <div class="col-md-12">
                <!-- BEGIN EXAMPLE TABLE PORTLET-->


                <div class="portlet box blue">
                    <div class="portlet-title">
                        <div class="caption">
                            <i class="fa fa-cogs"></i>Votes Report
                        </div>
                        <div class="actions">
                            <a class="btn btn-default btn-sm" href="{$hosturl}/controllers/{$controllname}.php?ac=show">
                                <i class="fa fa-eye"></i> Show </a>
                        </div>

                    </div>
                    <div class="portlet-body" style="padding: 15px;">
                        <input id="patientId" type="hidden" value="{$patientId}">
                        <form action="{$hosturl}/controllers/vote.php?ac=empReport" method="post" style="margin-bottom: 15px;">
                            <div class="col-md-3">
                                <div class="form-group">
                                    <label class="col-md-12 control-label">Role</label>
                                    <div class="col-md-11">
                                        <select class="form-control select2me" required="required" name="role_id" data-placeholder="Select...">
                                            <option></option>
                                            {foreach $roles as $single}
                                                <option value="{$single->id}" {if $single->id eq $role_id}selected {/if}>{$single->name}</option>
                                            {/foreach}
                                        </select>
                                    </div>
                                </div>
                            </div>

                            <div class="col-md-3">
                                <label class="col-md-12 control-label">Date From </label>
                                <div class="col-md-11">
                                    <div class="form-group">
                                        <input type="text" class="form-control datepicker txtc" required name="from_date" readonly value="{$search_dates.from_date}"/>
                                    </div>
                                </div>
                            </div>

                            <div class="col-md-3">
                                <label class="col-md-12 control-label">Date To </label>
                                <div class="col-md-11">
                                    <div class="form-group">
                                        <input type="text" class="form-control datepicker txtc" required name="to_date" readonly value="{$search_dates.to_date}"/>
                                    </div>
                                </div>
                            </div>
                            <div class="col-md-2">
                                <div class="form-actions">
                                    <div class="row">
                                        <div class="col-md-offset-2 col-md-10">
                                            <button class="btn btn-sm blue" type="submit">Filter</button>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </form>
                        <div class="clearfix"></div>
                        <hr>
                        {assign var="itr" value=1}
                        {foreach $users_info as $single}
                            <table class="table table-striped table-bordered table-hover" style="margin-bottom: 10px;border-bottom: none;border-collapse: unset;">
                                <thead>
                                <tr>
                                    <th>Name</th>
                                    <th style="width: 50px;">Eval no.</th>{*
                                    <th>Question No.</th>
                                    <th>Vote no.</th>*}
                                    {foreach $single.count_answer_text as $answer}
                                        <th style="width: 50px;">{$answer.answer_text}</th>
                                    {/foreach}
                                </tr>
                                </thead>
                                <tbody>
                                {* get even and odd from itr *}
                                <tr {if $itr%2 eq 1}class="odd gradeX" {else} class="odd gradeX" style="background: #fff{/if}">
                                    <td><a href="{$hosturl}/controllers/vote.php?ac=reportDetails&id={$single.user_id}">{$single.name}</a></td>
                                    <td>{$single.count_votes}</td>
                                    {*<td>Questions:{$single.count_question[0]}</td>
                                    <td>Vote: {$single.count_answer[0]}</td>*}
                                    {foreach $single.count_answer_text as $answer}
                                        <td>{$answer.count_answer} ({round(($answer.count_answer/$single.count_answer[0])*100)}%)</td>
                                    {/foreach}
                                </tr>
                                </tbody>
                            </table>
                            {capture assign=itr}{$itr+1}{/capture}
                        {/foreach}

                    </div>
                </div>
            </div>
        </div>

    </div>
</div>

