Geen omschrijving
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

DashboardController.php 5.3KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. <?php
  2. namespace App\Http\Controllers\Admin;
  3. use App\Helpers\Helper;
  4. use App\Http\Controllers\Controller;
  5. use Illuminate\Support\Facades\DB;
  6. //modal
  7. ;
  8. use Carbon\Carbon;
  9. use Illuminate\Support\Str;
  10. use Auth;
  11. //UTILS
  12. use App\Utils\DashboardUtil;
  13. //MODEL
  14. use App\Model\Logistik\ManajemenKantong;
  15. use App\Model\Master\Reagen;
  16. use App\Model\Master\ItemKantongs;
  17. use App\Model\Master\MasterJenisKantong;
  18. use App\Model\Master\MerkReagen;
  19. use App\Model\Master\Reagens;
  20. use GuzzleHttp\Psr7\Request;
  21. class DashboardController extends Controller
  22. {
  23. /**
  24. * Title untuk judul di web
  25. * route digunakan untuk tempat resource (file path) + routing (route/web) diusahain sama ya biar gak ngubah"
  26. */
  27. private $title = 'Admin';
  28. private $route = 'admin.dashboard.'; //path awal foldernya ajah
  29. protected $DashboardUtil;
  30. public function __construct(DashboardUtil $DashboardUtil)
  31. {
  32. $this->DashboardUtil = $DashboardUtil;
  33. DB::enableQueryLog();
  34. }
  35. public function index()
  36. {
  37. // $petugas_udd_id = Auth::user()->petugas->unit_donor_darah_id;
  38. // $kantongLogistik_last_30_days = ManajemenKantong::getData30Days($status_kantongs = 1, $status_kantong_item = 1, $petugas_udd_id, $param_order = 'created_at', $imltd = null, $kgd = null);
  39. // $kantongAftap_last_30_days = ManajemenKantong::getData30Days($status_kantongs = 1, $status_kantong_item = 2, $petugas_udd_id, $param_order = 'created_at', $imltd = null, $kgd = null);
  40. // $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);
  41. // $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');
  42. // $kantongRelease_last_1_years = $this->DashboardUtil->getDataLast1Years(9, $petugas_udd_id, 'updated_at'); //param, status id 9 release
  43. // $kantongLogistik = ManajemenKantong::getKantong($status_kantongs = 1,$status_kantong_item = 1, $petugas_udd_id, $imtld = null, $kgd = null);
  44. // $kantongAftap = ManajemenKantong::where('kantong_items.status_id', '=', 2)
  45. // ->where('kantong_items.is_pemindahan_aftap', '=', 1)
  46. // ->where('kantongs.status_id', '=', 1)
  47. // ->where('kantong_items.unit_donor_darah_id', Auth::user()->petugas->unit_donor_darah_id)
  48. // ->join('kantong_items', 'kantongs.id', 'kantong_items.kantong_id')
  49. // ->groupBy('kantong_id')
  50. // ->get();
  51. // $kantongBelumImltd = ItemKantongs::selectRaw('
  52. // kantong_items.id,
  53. // kantong_items.no_kantong,
  54. // kantong_items.kantong_id
  55. // ')
  56. // ->leftjoin('hasil_imltds', 'hasil_imltds.kantong_item_id','=','kantong_items.id')
  57. // ->join('kantongs', 'kantongs.id','kantong_items.kantong_id')
  58. // ->where('hasil_imltds.id',null)
  59. // ->where('kantongs.status_id',3)
  60. // ->where('kantong_items.is_sah', 1 )
  61. // ->whereNull('is_lulus_imltd')
  62. // ->where('kantong_items.unit_donor_darah_id', Auth::user()->petugas->unit_donor_darah_id)
  63. // ->groupBy('kantong_items.kantong_id')->orderBy('kantong_items.created_at', 'asc')->get();
  64. // $kantongBelumKgd = ManajemenKantong::getKantong($status_kantongs = 3,$status_kantong_item = null, $petugas_udd_id, $imltd = null, $kgd = 'is_konfirmasi_golongan_darah');
  65. // $belum_aftap = ManajemenKantong::getKantong($status_kantongs = 1,$status_kantong_item = 11, $petugas_udd_id, $imltd = null, $kgd = null);
  66. $data = [
  67. //bawaan
  68. 'title' => $this->title,
  69. 'route' => $this->route,
  70. // 'kantongLogistik' => count($kantongLogistik),
  71. // 'kantongAftap' => count($kantongAftap),
  72. // 'kantongBelumImltd' => count($kantongBelumImltd),
  73. // 'kantongBelumKgd' => count($kantongBelumKgd),
  74. // 'count_logistik' => $kantongLogistik,
  75. // 'count_aftap' => $kantongAftap,
  76. // 'belum_aftap' => $belum_aftap,
  77. // 'jenis_kantong' => MasterJenisKantong::All(),
  78. // 'master_reagen' => Reagen::where('unit_donor_darah_id', Auth::user()->petugas->unit_donor_darah_id)->get(),
  79. // 'reagens' => Reagens::where('reagens.unit_donor_darah_id', Auth::user()->petugas->unit_donor_darah_id)
  80. // ->join('master_reagens', 'reagens.master_reagen_id', 'master_reagens.id')
  81. // ->get(),
  82. // 'merk_reagen' => MerkReagen::all(),
  83. ];
  84. // dd($data['reagens']);
  85. return view($this->route . 'index', $data);
  86. }
  87. }