<div class="design-pst">
    <div class="pst-block">
        <div class="pst-block-head" style="background: #395a93;">
            <h2 class="title-4" style="color: #fff"><strong><?php echo e(trans('resource.dashboard.dashboard')); ?></strong></h2>
        </div>
        <?php echo e(csrf_field()); ?>

        <div class="pst-block-main">
            <div class="col-row">
              <div class="col-half xs-half mb-ls-half">
                    <article class="post post-tp-5">
                      <h3 class="title-5"><?php echo e(trans('resource.decision.menu')); ?></h3>
                        <figure>
                            <div id="pie">
                                <div id="pieChartContainer" style="max-width: 800px; margin: 0 auto"></div>
                            </div>
                        </figure>
                 </article>
             </div>
             <div class="col-half xs-half mb-ls-half">
                   <article class="post post-tp-5">
                        <h3 class="title-5"><?php echo e(trans('resource.polling')); ?></h3>
                       <figure>
                            <?php echo $__env->make('layouts.sidebar_poll',['type'=> 2], array_except(get_defined_vars(), array('__data', '__path')))->render(); ?>
                       </figure>
                </article>
            </div>
         </div>
     </div>
 </div>
</div>
<script>

$(function () {

    $.post("/complaintInfo", {'_token' : $('[name="_token"]').val()}, function(data){

        var unsolved = 0;
        var solvedpositive = 0;
        var solvednegative = 0;
        $.each(data, function(i, v){
            if(v['type'] == 0){
                unsolved += 1;
            }else{
                if(v['kind'] == 2)
                    solvednegative += 1;
                else
                    solvedpositive += 1;
            }
        });

        var data = [
            {name : '<?php echo trans('resource.decision.undone'); ?>', value : unsolved},
            {name : '<?php echo trans('resource.decision.negative'); ?>', value : solvednegative},
            {name : '<?php echo trans('resource.decision.positive'); ?>', value : solvedpositive}
        ]

        $("#pieChartContainer").dxPieChart({
            dataSource: data,
            series: {
                argumentField: 'name',
                valueField: 'value',
                type: 'doughnut',
                label: {
                    visible: true,
                    connector: { visible: true },
                    format: {
                        type: 'largeNumber',
                        precision: 0
                    }
                }
            },
            palette: 'Ocean',
            adaptiveLayout: {
                width: 300
            },
            legend: {
                horizontalAlignment: 'center',
                verticalAlignment: 'bottom'
            }

        });



    });

});
</script>
