diff --git a/app/Http/Controllers/DashboardController.php b/app/Http/Controllers/DashboardController.php index d55c3ad..3a51650 100644 --- a/app/Http/Controllers/DashboardController.php +++ b/app/Http/Controllers/DashboardController.php @@ -15,23 +15,52 @@ use Illuminate\Support\Str; class DashboardController extends Controller { public function index(){ - dd(auth()->user()); - $unitKerja = UnitKerja::where('statusenabled', true)->select('id', 'name')->get(); - $subUnitKerja = SubUnitKerja::where('statusenabled', true)->select('id', 'name')->get(); $katDok = MasterKategori::where('statusenabled', true)->select('master_kategori_directory_id', 'nama_kategori_directory')->get(); $klasifikasiDok = MasterKlasifikasi::where('statusenabled', true)->select('master_klasifikasi_directory_id', 'nama_klasifikasi_directory')->get(); + + $authMapping = auth()->user()?->dataUser?->mappingUnitKerjaPegawai[0]; + $authUnitKerja = $authMapping->objectunitkerjapegawaifk; + $authSubUnitKerja = $authMapping->objectsubunitkerjapegawaifk; $payload = [ 'title' => 'Dashboard', - 'unitKerja' => $unitKerja, - 'subUnitKerja' => $subUnitKerja, 'katDok' => $katDok, 'klasifikasiDok' => $klasifikasiDok, + 'authUnitKerja' => $authUnitKerja, + 'authSubUnitKerja' => $authSubUnitKerja, ]; return view('dashboard.index', $payload); } public function dataUnitKerja(){ - $unitKerja = UnitKerja::where('statusenabled', true)->select('id', 'name')->get(); + $authMapping = auth()->user()?->dataUser?->mappingUnitKerjaPegawai[0]; + $authUnitKerja = $authMapping->objectunitkerjapegawaifk; + $authSubUnitKerja = $authMapping->objectsubunitkerjapegawaifk; + $kategori = request('kategori'); + $filterUnit = request('unitKerja'); + $subUnit = request('subUnit'); + $klasifikasi = request('klasifikasi'); + + + + $unitKerja = UnitKerja::where('statusenabled', true) + ->where('id', $authUnitKerja) + ->with(['subUnitKerja' => function ($query) use ($authSubUnitKerja, $kategori, $filterUnit, $subUnit, $klasifikasi) { + $query->where('id', $authSubUnitKerja) + ->with(['fileDirectory' => function ($q) use ($kategori, $filterUnit, $subUnit, $klasifikasi) { + $q->when($filterUnit, function ($subQ) use ($filterUnit) { + $subQ->where('id_unit_kerja', $filterUnit); + })->when($subUnit, function ($subQ) use ($subUnit) { + $subQ->where('id_sub_unit_kerja', $subUnit); + })->when($kategori, function ($subQ) use ($kategori) { + $subQ->where('master_kategori_directory_id', $kategori); + })->when($klasifikasi, function ($subQ) use ($klasifikasi) { + $subQ->where('master_klasifikasi_directory_id', $klasifikasi); + }); + }]); + }]) + ->select('id', 'name') + ->get(); + $katDok = MasterKategori::where('statusenabled', true)->select('master_kategori_directory_id', 'nama_kategori_directory')->get(); $data = [ 'unitKerja' => $unitKerja, @@ -51,9 +80,9 @@ class DashboardController extends Controller $file = request()->file("data.$index.file"); $payload = [ 'master_klasifikasi_directory_id' => $value['klasifikasi'], - 'id_unit_kerja' => request('id_unit_kerja') ?? null, - 'id_sub_unit_kerja' => request('id_sub_unit_kerja') ?? null, - 'master_kategori_directory_id' => request('master_kategori_directory_id') ?? null, + 'id_unit_kerja' => $value['id_unit_kerja'], + 'id_sub_unit_kerja' => $value['id_sub_unit_kerja'], + 'master_kategori_directory_id' => $value['master_kategori_directory_id'], 'pegawai_id_entry' => auth()->user()->id ?? 1, 'pegawai_nama_entry' => auth()->user()->namalengkap ?? 'tes', ]; @@ -77,4 +106,37 @@ class DashboardController extends Controller ], 500); } } + + public function OptionUnitKerja(){ + $q = request()->get('q'); + $authMapping = auth()->user()?->dataUser?->mappingUnitKerjaPegawai[0]; + $authUnitKerja = $authMapping?->objectunitkerjapegawaifk; + $authSubUnitKerja = $authMapping?->objectsubunitkerjapegawaifk; + $akses = false; + + $query = UnitKerja::query(); + if(!$akses){ + $query->where(['statusenabled' => true, 'id' => $authUnitKerja]) + ->with(['subUnitKerja' => function($query) use($authSubUnitKerja){ + $query->where('id', $authSubUnitKerja); + }]); + } + $data = $query->when($q, function ($query, $q){ + $query->where('name', 'ILIKE', '%' .$q . '%'); + }) + ->select('id', 'name')->get(); + return response()->json([ + 'status' => true, + 'data' => $data + ], 200); + } + + public function deleteFile(string $id){ + $data = FileDirectory::where('file_directory_id', $id)->first(); + $data->update(['statusenabled' => false]); + return response()->json([ + 'success' => true, + 'message' => 'Berhasil menghapus data' + ]); + } } diff --git a/app/Models/DataUser.php b/app/Models/DataUser.php new file mode 100644 index 0000000..efc9035 --- /dev/null +++ b/app/Models/DataUser.php @@ -0,0 +1,18 @@ +hasMany(MappingUnitKerjaPegawai::class, 'objectpegawaifk', 'id')->select('id', 'objectsubunitkerjapegawaifk', 'objectunitkerjapegawaifk'); + } +} diff --git a/app/Models/MappingUnitKerjaPegawai.php b/app/Models/MappingUnitKerjaPegawai.php new file mode 100644 index 0000000..97b0a7a --- /dev/null +++ b/app/Models/MappingUnitKerjaPegawai.php @@ -0,0 +1,22 @@ +belongsTo(UnitKerja::class, 'objectunitkerjapegawaifk', 'id'); + } + public function subUnitKerja(){ + return $this->belongsTo(SubUnitKerja::class, 'objectsubunitkerjapegawaifk', 'id'); + } +} diff --git a/app/Models/User.php b/app/Models/User.php index 973a47c..61d6e40 100644 --- a/app/Models/User.php +++ b/app/Models/User.php @@ -45,4 +45,8 @@ class User extends Authenticatable 'katasandi' => 'hashed', ]; } + protected $with = ['dataUser']; + public function dataUser(){ + return $this->belongsTo(DataUser::class, 'objectpegawaifk', 'id')->select('id', 'namalengkap'); + } } diff --git a/public/file/6mxSTn10NBcE0TDgaXLJIhNx2dORcZRMZaQuUxuc.pdf b/public/file/6mxSTn10NBcE0TDgaXLJIhNx2dORcZRMZaQuUxuc.pdf new file mode 100644 index 0000000..cae760d Binary files /dev/null and b/public/file/6mxSTn10NBcE0TDgaXLJIhNx2dORcZRMZaQuUxuc.pdf differ diff --git a/public/file/ChatGPT Image Aug 26, 2025, 08_47_44 AM.png b/public/file/ChatGPT Image Aug 26, 2025, 08_47_44 AM.png new file mode 100644 index 0000000..1fb1f83 Binary files /dev/null and b/public/file/ChatGPT Image Aug 26, 2025, 08_47_44 AM.png differ diff --git a/public/file/Jooocode (1).png b/public/file/Jooocode (1).png new file mode 100644 index 0000000..0278293 Binary files /dev/null and b/public/file/Jooocode (1).png differ diff --git a/public/file/Jooocode.png b/public/file/Jooocode.png new file mode 100644 index 0000000..c091b3f Binary files /dev/null and b/public/file/Jooocode.png differ diff --git a/public/file/PAKET 1 (KENTANG REBUS, GALANTIN AYAM SAUS BISTIK, TUMIS BUNCIS DAGING GILING, SAMBAL).jpg b/public/file/PAKET 1 (KENTANG REBUS, GALANTIN AYAM SAUS BISTIK, TUMIS BUNCIS DAGING GILING, SAMBAL).jpg new file mode 100644 index 0000000..013d276 Binary files /dev/null and b/public/file/PAKET 1 (KENTANG REBUS, GALANTIN AYAM SAUS BISTIK, TUMIS BUNCIS DAGING GILING, SAMBAL).jpg differ diff --git a/public/file/PAKET 1 (NASI MERAH, AYAM GORENG, GADO-GADO, KERUPUK).jpg.jpg b/public/file/PAKET 1 (NASI MERAH, AYAM GORENG, GADO-GADO, KERUPUK).jpg.jpg new file mode 100644 index 0000000..ceff63d Binary files /dev/null and b/public/file/PAKET 1 (NASI MERAH, AYAM GORENG, GADO-GADO, KERUPUK).jpg.jpg differ diff --git a/public/file/PAKET 1 (NASI MERAH, FISH STEAK NUGGET, TUMIS SAWI PUTIH, SAMBAL).jpg b/public/file/PAKET 1 (NASI MERAH, FISH STEAK NUGGET, TUMIS SAWI PUTIH, SAMBAL).jpg new file mode 100644 index 0000000..20bfa61 Binary files /dev/null and b/public/file/PAKET 1 (NASI MERAH, FISH STEAK NUGGET, TUMIS SAWI PUTIH, SAMBAL).jpg differ diff --git a/public/file/PAKET 1 (NASI PUTIH, PEPES AYAM, TUMIS DAUN SINGKONG, SAMBAL).jpg b/public/file/PAKET 1 (NASI PUTIH, PEPES AYAM, TUMIS DAUN SINGKONG, SAMBAL).jpg new file mode 100644 index 0000000..bb0f3de Binary files /dev/null and b/public/file/PAKET 1 (NASI PUTIH, PEPES AYAM, TUMIS DAUN SINGKONG, SAMBAL).jpg differ diff --git a/public/file/PAKET 2 (KENTANG REBUS, BISTIK DAGING, TUMIS KAILAN, SAMBAL).jpg b/public/file/PAKET 2 (KENTANG REBUS, BISTIK DAGING, TUMIS KAILAN, SAMBAL).jpg new file mode 100644 index 0000000..f4729a6 Binary files /dev/null and b/public/file/PAKET 2 (KENTANG REBUS, BISTIK DAGING, TUMIS KAILAN, SAMBAL).jpg differ diff --git a/public/file/PAKET 2 (KENTANG REBUS, DAGING SUKIYAKI, TUMIS BROKOLI WORTEL, SAMBAL).jpg b/public/file/PAKET 2 (KENTANG REBUS, DAGING SUKIYAKI, TUMIS BROKOLI WORTEL, SAMBAL).jpg new file mode 100644 index 0000000..2023f0c Binary files /dev/null and b/public/file/PAKET 2 (KENTANG REBUS, DAGING SUKIYAKI, TUMIS BROKOLI WORTEL, SAMBAL).jpg differ diff --git a/public/file/PAKET 2 (NASI PUTIH, KAKAP KULUYUK, CAPCAY, SAMBAL ASAM MANIS).jpg b/public/file/PAKET 2 (NASI PUTIH, KAKAP KULUYUK, CAPCAY, SAMBAL ASAM MANIS).jpg new file mode 100644 index 0000000..bb812ac Binary files /dev/null and b/public/file/PAKET 2 (NASI PUTIH, KAKAP KULUYUK, CAPCAY, SAMBAL ASAM MANIS).jpg differ diff --git a/public/file/PAKET 2 (NASI PUTIH, ROLLADE DAGING SAUS BISTIK, TUMIS SAWI PUTIH, SAMBAL).jpg b/public/file/PAKET 2 (NASI PUTIH, ROLLADE DAGING SAUS BISTIK, TUMIS SAWI PUTIH, SAMBAL).jpg new file mode 100644 index 0000000..3bdccb2 Binary files /dev/null and b/public/file/PAKET 2 (NASI PUTIH, ROLLADE DAGING SAUS BISTIK, TUMIS SAWI PUTIH, SAMBAL).jpg differ diff --git a/public/file/W4hGD1Br5INRp1SItxATO89kXQTd93hvBb4KfOUe.pdf b/public/file/W4hGD1Br5INRp1SItxATO89kXQTd93hvBb4KfOUe.pdf new file mode 100644 index 0000000..e9e7444 Binary files /dev/null and b/public/file/W4hGD1Br5INRp1SItxATO89kXQTd93hvBb4KfOUe.pdf differ diff --git a/public/file/WhatsApp Image 2025-08-20 at 07.44.39_7b5b4fcb.jpg b/public/file/WhatsApp Image 2025-08-20 at 07.44.39_7b5b4fcb.jpg new file mode 100644 index 0000000..0a7aa7f Binary files /dev/null and b/public/file/WhatsApp Image 2025-08-20 at 07.44.39_7b5b4fcb.jpg differ diff --git a/public/file/WhatsApp Image 2025-08-26 at 09.00.22_d2384700.jpg b/public/file/WhatsApp Image 2025-08-26 at 09.00.22_d2384700.jpg new file mode 100644 index 0000000..df217a9 Binary files /dev/null and b/public/file/WhatsApp Image 2025-08-26 at 09.00.22_d2384700.jpg differ diff --git a/public/file/laporan-pesanan-20250819-143732.xlsx b/public/file/laporan-pesanan-20250819-143732.xlsx new file mode 100644 index 0000000..8897c71 Binary files /dev/null and b/public/file/laporan-pesanan-20250819-143732.xlsx differ diff --git a/public/file/pesanan-selesai20250813-142653.xlsx b/public/file/pesanan-selesai20250813-142653.xlsx new file mode 100644 index 0000000..45993fd Binary files /dev/null and b/public/file/pesanan-selesai20250813-142653.xlsx differ diff --git a/public/file/pesanan-selesai20250819-142335.xlsx b/public/file/pesanan-selesai20250819-142335.xlsx new file mode 100644 index 0000000..2cea49d Binary files /dev/null and b/public/file/pesanan-selesai20250819-142335.xlsx differ diff --git a/public/file/pesanan-selesai20250825-144604.xlsx b/public/file/pesanan-selesai20250825-144604.xlsx new file mode 100644 index 0000000..ee3d358 Binary files /dev/null and b/public/file/pesanan-selesai20250825-144604.xlsx differ diff --git a/public/file/qRzWz72H1Sbf6CsbqmA4l8d9nYNmoExiLNqUWy0c.pdf b/public/file/qRzWz72H1Sbf6CsbqmA4l8d9nYNmoExiLNqUWy0c.pdf new file mode 100644 index 0000000..d186fe7 Binary files /dev/null and b/public/file/qRzWz72H1Sbf6CsbqmA4l8d9nYNmoExiLNqUWy0c.pdf differ diff --git a/public/file/semua-pesanan20250819-143713.xlsx b/public/file/semua-pesanan20250819-143713.xlsx new file mode 100644 index 0000000..6d52130 Binary files /dev/null and b/public/file/semua-pesanan20250819-143713.xlsx differ diff --git a/public/js/dashboard/_init.js b/public/js/dashboard/_init.js index e45243d..e1165e4 100644 --- a/public/js/dashboard/_init.js +++ b/public/js/dashboard/_init.js @@ -1,2 +1,2 @@ -const modalCreate = document.getElementById('modalFileCreate') +const modalCreate = document.getElementById('modalCreateFile') const formCreate = $("#formFile") diff --git a/public/js/dashboard/action.js b/public/js/dashboard/action.js index 3b98a06..4058b80 100644 --- a/public/js/dashboard/action.js +++ b/public/js/dashboard/action.js @@ -26,8 +26,10 @@ formCreate.on('submit', function(e){ }).showToast(); $("#col_add_file").html(''); - colCount = 0; // reset counter - formCreate[0].reset(); + colCount = 1; // reset counter + formCreate.find('input[type="text"], input[type="file"]').val(''); + formCreate.find('select').val(null).trigger('change'); + index() modalCreate.removeEventListener('hidden.bs.modal', handler); }; diff --git a/public/js/dashboard/functions.js b/public/js/dashboard/functions.js index a588b41..d441c73 100644 --- a/public/js/dashboard/functions.js +++ b/public/js/dashboard/functions.js @@ -1,24 +1,89 @@ +let colCount = 1; $(document).ready(function() { - $('.unit_kerja').select2(); - $('.sub_unit_kerja').select2(); + $('.unit_kerja').select2({ + placeholder: '-- Pilih Unit Kerja --', + allowClear:true, + width: '100%', + ajax:{ + url : '/select-unit-kerja', + dataType: 'json', + delay: 250, + data: function(params){ + return { + q: params.term + } + }, + processResults: function(data){ + return { + results : data?.data.map(item => ({ + id: item.id, + text: item.name, + sub_units: item?.sub_unit_kerja + })) + } + }, + cache: true, + }, + minimumInputLength: 1, + }); + + $('.sub_unit_kerja').select2({ + placeholder: '-- Pilih Sub Unit Kerja ', + allowClear:true, + width: '100%', + }) + + $('.unit_kerja').on('select2:select', function(e){ + let data = e.params.data; + $('.sub_unit_kerja').empty().append('') + + if(data.sub_units && data.sub_units.length > 0){ + data.sub_units.forEach(sub => { + $('.sub_unit_kerja').append(``) + }) + } + }) + $('.klasifikasi_dok').select2(); $('.kategori_dok').select2(); + + selectOptionUnitKerja(0) }); - -let colCount = 1; function addForm(){ let col = $("#col_add_file") let html = ''; - html += `
-
+ html += `
+
+
+ + +
+
+ + +
+
+ + +
+
-
- +
+ - - @foreach ($unitKerja as $unit) - - @endforeach - -
-
- - -
+
- - +
+ +
- - +
+ +
- + + +
+ + +
+ + +
+ + +
+ +
+ + +
+
-
+
+
+
+
+
+
+
+
📄 Preview
+ +
+
+
+

📂 Pilih file untuk melihat preview

+
+
+ +
+
+
+ +
@@ -110,6 +142,115 @@ @include('dashboard.modal.create') diff --git a/resources/views/dashboard/modal/create.blade.php b/resources/views/dashboard/modal/create.blade.php index 10c72f8..6f809c0 100644 --- a/resources/views/dashboard/modal/create.blade.php +++ b/resources/views/dashboard/modal/create.blade.php @@ -1,10 +1,10 @@ -