|
@@ -16,13 +16,8 @@ use Auth;
|
16
|
16
|
use App\Utils\DashboardUtil;
|
17
|
17
|
|
18
|
18
|
//MODEL
|
19
|
|
-use App\Model\Logistik\ManajemenKantong;
|
20
|
|
-use App\Model\Master\Reagen;
|
21
|
|
-use App\Model\Master\ItemKantongs;
|
22
|
|
-use App\Model\Master\MasterJenisKantong;
|
23
|
|
-use App\Model\Master\MerkReagen;
|
24
|
|
-use App\Model\Master\Reagens;
|
25
|
|
-use GuzzleHttp\Psr7\Request;
|
|
19
|
+use App\User;
|
|
20
|
+
|
26
|
21
|
|
27
|
22
|
class DashboardController extends Controller
|
28
|
23
|
{
|
|
@@ -41,56 +36,38 @@ class DashboardController extends Controller
|
41
|
36
|
|
42
|
37
|
public function index()
|
43
|
38
|
{
|
44
|
|
- // $petugas_udd_id = Auth::user()->petugas->unit_donor_darah_id;
|
45
|
|
- // $kantongLogistik_last_30_days = ManajemenKantong::getData30Days($status_kantongs = 1, $status_kantong_item = 1, $petugas_udd_id, $param_order = 'created_at', $imltd = null, $kgd = null);
|
46
|
|
- // $kantongAftap_last_30_days = ManajemenKantong::getData30Days($status_kantongs = 1, $status_kantong_item = 2, $petugas_udd_id, $param_order = 'created_at', $imltd = null, $kgd = null);
|
47
|
|
- // $kantongBelumImltd_last_30_days = ManajemenKantong::getData30Days($status_kantongs = 3, $status_kantong_item = 3, $petugas_udd_id, $param_order = 'updated_at', $imltd = 'is_lulus_imltd', $kgd = null);
|
48
|
|
- // $kantongBelumKgd_last_30_days = ManajemenKantong::getData30Days($status_kantongs = 3, $status_kantong_item = 3, $petugas_udd_id, $param_order = 'updated_at', $imltd = null, $kgd = 'is_konfirmasi_golongan_darah');
|
49
|
|
- // $kantongRelease_last_1_years = $this->DashboardUtil->getDataLast1Years(9, $petugas_udd_id, 'updated_at'); //param, status id 9 release
|
50
|
|
-
|
51
|
|
- // $kantongLogistik = ManajemenKantong::getKantong($status_kantongs = 1,$status_kantong_item = 1, $petugas_udd_id, $imtld = null, $kgd = null);
|
52
|
|
- // $kantongAftap = ManajemenKantong::where('kantong_items.status_id', '=', 2)
|
53
|
|
- // ->where('kantong_items.is_pemindahan_aftap', '=', 1)
|
54
|
|
- // ->where('kantongs.status_id', '=', 1)
|
55
|
|
- // ->where('kantong_items.unit_donor_darah_id', Auth::user()->petugas->unit_donor_darah_id)
|
56
|
|
- // ->join('kantong_items', 'kantongs.id', 'kantong_items.kantong_id')
|
57
|
|
- // ->groupBy('kantong_id')
|
58
|
|
- // ->get();
|
59
|
|
- // $kantongBelumImltd = ItemKantongs::selectRaw('
|
60
|
|
- // kantong_items.id,
|
61
|
|
- // kantong_items.no_kantong,
|
62
|
|
- // kantong_items.kantong_id
|
63
|
|
- // ')
|
64
|
|
- // ->leftjoin('hasil_imltds', 'hasil_imltds.kantong_item_id','=','kantong_items.id')
|
65
|
|
- // ->join('kantongs', 'kantongs.id','kantong_items.kantong_id')
|
66
|
|
- // ->where('hasil_imltds.id',null)
|
67
|
|
- // ->where('kantongs.status_id',3)
|
68
|
|
- // ->where('kantong_items.is_sah', 1 )
|
69
|
|
- // ->whereNull('is_lulus_imltd')
|
70
|
|
- // ->where('kantong_items.unit_donor_darah_id', Auth::user()->petugas->unit_donor_darah_id)
|
71
|
|
- // ->groupBy('kantong_items.kantong_id')->orderBy('kantong_items.created_at', 'asc')->get();
|
72
|
|
- // $kantongBelumKgd = ManajemenKantong::getKantong($status_kantongs = 3,$status_kantong_item = null, $petugas_udd_id, $imltd = null, $kgd = 'is_konfirmasi_golongan_darah');
|
73
|
|
- // $belum_aftap = ManajemenKantong::getKantong($status_kantongs = 1,$status_kantong_item = 11, $petugas_udd_id, $imltd = null, $kgd = null);
|
|
39
|
+ $reguler_points = User::select('users.name', DB::raw('SUM(point_logs.point) as total_point'))->rightJoin('point_logs', 'point_logs.user_id', 'users.id')->where('event_id', '=', 0)->groupBy('point_logs.user_id')->orderBy('total_point', 'desc')->limit(5)->get();
|
|
40
|
+
|
|
41
|
+ $reguler_point_all = [];
|
|
42
|
+
|
|
43
|
+ $reguler_user_all = [];
|
|
44
|
+
|
|
45
|
+ foreach($reguler_points as $key => $value){
|
|
46
|
+ array_push($reguler_point_all , intval($value->total_point));
|
|
47
|
+ array_push($reguler_user_all , $value->name);
|
|
48
|
+ }
|
|
49
|
+
|
|
50
|
+ $event_points = User::select('users.name', DB::raw('SUM(point_logs.point) as total_point'))->rightJoin('point_logs', 'point_logs.user_id', 'users.id')->where('event_id', '=', 1)->groupBy('point_logs.user_id')->orderBy('total_point', 'desc')->limit(5)->get();
|
|
51
|
+
|
|
52
|
+ $event_point_all = [];
|
|
53
|
+
|
|
54
|
+ $event_user_all = [];
|
|
55
|
+
|
|
56
|
+ foreach($event_points as $key => $value){
|
|
57
|
+ array_push($event_point_all , intval($value->total_point));
|
|
58
|
+ array_push($event_user_all , $value->name);
|
|
59
|
+ }
|
74
|
60
|
|
75
|
61
|
$data = [
|
76
|
62
|
//bawaan
|
77
|
63
|
'title' => $this->title,
|
78
|
64
|
'route' => $this->route,
|
79
|
|
- // 'kantongLogistik' => count($kantongLogistik),
|
80
|
|
- // 'kantongAftap' => count($kantongAftap),
|
81
|
|
- // 'kantongBelumImltd' => count($kantongBelumImltd),
|
82
|
|
- // 'kantongBelumKgd' => count($kantongBelumKgd),
|
83
|
|
- // 'count_logistik' => $kantongLogistik,
|
84
|
|
- // 'count_aftap' => $kantongAftap,
|
85
|
|
- // 'belum_aftap' => $belum_aftap,
|
86
|
|
- // 'jenis_kantong' => MasterJenisKantong::All(),
|
87
|
|
- // 'master_reagen' => Reagen::where('unit_donor_darah_id', Auth::user()->petugas->unit_donor_darah_id)->get(),
|
88
|
|
- // 'reagens' => Reagens::where('reagens.unit_donor_darah_id', Auth::user()->petugas->unit_donor_darah_id)
|
89
|
|
- // ->join('master_reagens', 'reagens.master_reagen_id', 'master_reagens.id')
|
90
|
|
- // ->get(),
|
91
|
|
- // 'merk_reagen' => MerkReagen::all(),
|
|
65
|
+ 'reguler_user_all' => $reguler_user_all,
|
|
66
|
+ 'reguler_point_all' => $reguler_point_all,
|
|
67
|
+ 'event_user_all' => $event_user_all,
|
|
68
|
+ 'event_point_all' => $event_point_all,
|
92
|
69
|
];
|
93
|
|
- // dd($data['reagens']);
|
|
70
|
+ // dd($data['log_points']);
|
94
|
71
|
return view($this->route . 'index', $data);
|
95
|
72
|
}
|
96
|
73
|
}
|