Viewing file: dashboard.blade.php (9.74 KB) -rw-r--r-- Select action/file-type: (+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
@extends('student.navigation') @section('content')
@php $class_wise_attandance = array(); $total_student = 0; $todays_total_attandance = 0; $all_classes = DB::table('classes')->where('school_id', auth()->user()->school_id)->get(); $currently_session_id = DB::table('sessions')->where('status', 1)->value('id');
foreach($all_classes as $class){ $total_student += DB::table('enrollments')->where('session_id', $currently_session_id)->where('class_id', $class->id)->where('school_id', auth()->user()->school_id)->get()->count();
$start_date = strtotime(date('d M Y')); $end_date = $start_date + 86400; $today_attanded = DB::table('daily_attendances')->where('class_id', $class->id)->where('timestamp', '>=', $start_date)->where('timestamp', '<', $end_date)->get(); array_push($class_wise_attandance, array("class_name" => $class->name, "today_attended" => $today_attanded->count())); $todays_total_attandance += $today_attanded->count(); } @endphp
<!-- Mani section header and breadcrumb --> <div class="mainSection-title"> <div class="row"> <div class="col-12"> <div class="d-flex justify-content-between align-items-center flex-wrap gr-15" > <div class="d-flex flex-column"> <h4>{{ get_phrase('Dashboard') }}</h4> <ul class="d-flex align-items-center eBreadcrumb-2"> <li><a href="#">{{ get_phrase('Home') }}</a></li> <li><a href="#">{{ get_phrase('Dashboard') }}</a></li> </ul> </div> </div> </div> </div> </div>
<!-- Start Alerts --> <div class="row"> <div class="col-12"> <div class="eSection-dashboardItems"> <div class="row flex-wrap"> <div class="col-lg-12"> <div class="dashboard_ShortListItem"> <h4 class="text-dark">{{ auth()->user()->name }}</h4> <p>{{ get_phrase('Welcome, to') }} {{ DB::table('schools')->where('id', auth()->user()->school_id)->value('title') }}</p> </div> </div> <!-- Dashboard Short Details --> <div class="col-lg-6"> <div class="dashboard_ShortListItems"> <div class="row"> <div class="col-md-6"> <div class="dashboard_ShortListItem"> <div class="dsHeader d-flex justify-content-between align-items-center" > <h5 class="title">{{ get_phrase('Students') }}</h5> </div> <div class="dsBody d-flex justify-content-between align-items-center" > <div class="ds_item_details"> <h4 class="total_no">{{ DB::table('users')->where('role_id', 7)->where('school_id', auth()->user()->school_id)->get()->count() }}</h4> <p class="total_info">{{ get_phrase('Total Student') }}</p> </div> <div class="ds_item_icon"> <img src="{{asset('public/assets/images/Student_icon.png')}}" alt="" /> </div> </div> </div> </div> <div class="col-md-6"> <div class="dashboard_ShortListItem"> <div class="dsHeader d-flex justify-content-between align-items-center" > <h5 class="title">{{ get_phrase('Teacher') }}</h5> <a href="{{ route('student.teacher') }}" class="ds_link ds_teacher"> <svg xmlns="http://www.w3.org/2000/svg" width="10.146" height="4.764" viewBox="0 0 10.146 4.764" > <path id="Read_more_icon" data-name="Read more icon" d="M11.337,5.978l-.84.84.941.947H3.573V8.955h7.865L10.5,9.9l.84.846L13.719,8.36Z" transform="translate(-3.573 -5.978)" fill="#000000" /> </svg> </a> </div> <div class="dsBody d-flex justify-content-between align-items-center" > <div class="ds_item_details"> <h4 class="total_no">{{ DB::table('users')->where('role_id', 3)->where('school_id', auth()->user()->school_id)->get()->count() }}</h4> <p class="total_info">{{ get_phrase('Total Teacher') }}</p> </div> <div class="ds_item_icon"> <img src="{{asset('public/assets/images/Teacher_icon.png')}}" alt="" /> </div> </div> </div> </div> </div> </div> </div> <!-- Imcome Report -->
<!-- Upcoming Events --> <div class="col-md-6 ms-auto"> <div class="dashboard_report dashboard_upcoming_events"> <div class="ds_report_header d-flex justify-content-between align-items-start" > <div class="ds_report_left"> <h4 class="title">{{ get_phrase('Upcoming Events') }}</h4> </div>
</div> <div class="ds_report_list pt-38"> <ul class="upcoming_events_items d-flex flex-column">
@php $upcoming_events = DB::table('frontend_events')->where('school_id', auth()->user()->school_id)->where('timestamp', '>', time())->where('status', 1)->take(3)->orderBy('id', 'DESC')->get(); @endphp @foreach($upcoming_events as $upcoming_event) <li> <div class="upcoming_events_item d-flex justify-content-between align-items-start" > <div class="events_info"> <a href="#" class="title">{{$upcoming_event->title}}</a> <p class="date">{{ date('D, M d Y', $upcoming_event->timestamp) }}</p> </div>
</div> </li> @endforeach </ul> <div class="text-end"> <a href="{{route('student.events.list')}}" class="all_report_btn_2">{{ get_phrase('See all') }}</a> </div> </div> </div> </div> </div> </div> </div> </div>
<!-- Resources --> <script src="{{asset('public/assets/amchart/index.js')}}"></script> <script src="{{asset('public/assets/amchart/xy.js')}}"></script> <script src="{{asset('public/assets/amchart/animated.js')}}"></script>
<!-- Chart code --> <script> "use strict";
am5.ready(function() {
// Create root element var root = am5.Root.new("chartdiv");
// Set themes root.setThemes([ am5themes_Animated.new(root) ]);
// Create chart var chart = root.container.children.push(am5xy.XYChart.new(root, { panX: true, panY: true, wheelX: "panX", wheelY: "zoomX", pinchZoomX:true }));
// Add cursor var cursor = chart.set("cursor", am5xy.XYCursor.new(root, {})); cursor.lineY.set("visible", false);
// Create axes var xRenderer = am5xy.AxisRendererX.new(root, { minGridDistance: 30 }); xRenderer.labels.template.setAll({ rotation: -90, centerY: am5.p50, centerX: am5.p100, paddingRight: 15 });
var xAxis = chart.xAxes.push(am5xy.CategoryAxis.new(root, { maxDeviation: 0.3, categoryField: "class_name", renderer: xRenderer, tooltip: am5.Tooltip.new(root, {}) }));
var yAxis = chart.yAxes.push(am5xy.ValueAxis.new(root, { maxDeviation: 0.3, renderer: am5xy.AxisRendererY.new(root, {}) }));
// Create series var series = chart.series.push(am5xy.ColumnSeries.new(root, { name: "Series 1", xAxis: xAxis, yAxis: yAxis, valueYField: "today_attended", sequencedInterpolation: true, categoryXField: "class_name", tooltip: am5.Tooltip.new(root, { labelText:"{valueY}" }) }));
series.columns.template.setAll({ cornerRadiusTL: 5, cornerRadiusTR: 5 }); series.columns.template.adapters.add("fill", function(fill, target) { return chart.get("colors").getIndex(series.columns.indexOf(target)); });
series.columns.template.adapters.add("stroke", function(stroke, target) { return chart.get("colors").getIndex(series.columns.indexOf(target)); });
// Set data var data = <?php echo json_encode($class_wise_attandance); ?>;
xAxis.data.setAll(data); series.data.setAll(data);
// Make stuff animate on load // https://www.amcharts.com/docs/v5/concepts/animations/ series.appear(1000); chart.appear(1000, 100);
}); // end am5.ready() </script>
<!-- HTML -->
@endsection
|