diff --git a/app/Http/Controllers/FrontController.php b/app/Http/Controllers/FrontController.php
index 5dfec48..c3b138d 100644
--- a/app/Http/Controllers/FrontController.php
+++ b/app/Http/Controllers/FrontController.php
@@ -18,11 +18,12 @@ class FrontController extends Controller
$data = [];
// $data['template'] = TabelData::where('show_dashboard',1)->limit(4)->inRandomOrder()->get();
- $data['template'] = TabelData::limit(4)->inRandomOrder()->get();
+ $data['template'] = TabelData::limit(6)->orderBy('created_at','DESC')->get();
$data['dataset'] = Dataset::orderBy('DatasetId','DESC')->limit(4)->get();
// $data['instansi'] = Instansi::all();
$data['count'] = [
'dataset' => Dataset::count(),
+ 'dataset_tambahan' => DatasetTambahan::count(),
'resource' => TabelData::count(),
'instansi' => Instansi::count(),
];
diff --git a/app/Http/Controllers/Opendata/DatasetController.php b/app/Http/Controllers/Opendata/DatasetController.php
index 4855760..fc4a10e 100644
--- a/app/Http/Controllers/Opendata/DatasetController.php
+++ b/app/Http/Controllers/Opendata/DatasetController.php
@@ -190,7 +190,12 @@ class DatasetController extends Controller
$dataset->data = null;
$dataset->file = null;
$dataset->deskripsi = $request->deskripsi;
- $dataset->status = 0;
+ if((session('group_id') == 1) || (session('group_alias') == 'admin')){
+ $dataset->status = 1;
+ }else{
+ $dataset->status = 0;
+ }
+
$dataset->created_by = auth()->user()->id;
$dataset->save();
}
diff --git a/app/Http/Controllers/Opendata/DatasetTambahanController.php b/app/Http/Controllers/Opendata/DatasetTambahanController.php
index b76a8bb..6e7662c 100644
--- a/app/Http/Controllers/Opendata/DatasetTambahanController.php
+++ b/app/Http/Controllers/Opendata/DatasetTambahanController.php
@@ -72,26 +72,28 @@ class DatasetTambahanController extends Controller
$action = '';
if((permission('is_create', $this->route.'.*','module',false)) || (permission('is_update', $this->route.'.*','module',false))){
- $action .= '
';
+ $action .= '
';
if($row->created_by == auth()->user()->id){
- $action .= '
';
+ $action .= '
';
}
- $action .= '
';
+ $action .= '
';
if((session('group_id') == 1) || (session('group_alias') == 'admin')){
- // $action .= '
';
+ // $action .= '
';
if($row->status == 1){
- $action .= '
';
+ $action .= '
';
}else{
- $action .= '
';
+ $action .= '
';
}
}
$action .= '
';
}
$status = '';
if($row->status == 1){
- $status = '
';
- }else{
- $status = '
';
+ $status = '
Valid';
+ }elseif($row->status == 0){
+ $status = '
Menunggu Verifikasi';
+ }elseif($row->status == 2){
+ $status = '
Verifikasi Ditolak';
}
$_data[] = [
@@ -100,6 +102,7 @@ class DatasetTambahanController extends Controller
'name' => @$row->name,
'publik' => @$row->publik,
'tahun' => @$row->tahun,
+ 'template' => @$row->tabelData->name,
'created_at' => date('d-m-Y',strtotime(@$row->created_at)),
'instansi' => @$row->instansi->name,
'action' => @$action,
@@ -134,10 +137,10 @@ class DatasetTambahanController extends Controller
if(@$request->file){
$file = $request->file('file');
$path = $file->getRealPath();
- $spreadsheet = IOFactory::load($path);
- $sheet = $spreadsheet->getActiveSheet();
- $rows = $sheet->toArray();
- $header = $rows[4]; // Baris pertama sebagai header
+ // $spreadsheet = IOFactory::load($path);
+ // $sheet = $spreadsheet->getActiveSheet();
+ // $rows = $sheet->toArray();
+ // $header = $rows[4]; // Baris pertama sebagai header
if (@$request->hasFile('file')) {
$file = $request->file('file');
$destinationPath = public_path('uploads/dataset');
@@ -147,9 +150,9 @@ class DatasetTambahanController extends Controller
$fileMime = $file->getClientMimeType();
$fileExtension = $file->getClientOriginalExtension();
$fileSize = $file->getSize();
- if(($fileExtension != 'xls') && ($fileExtension != 'xlsx')){
+ if(($fileExtension != 'xls') && ($fileExtension != 'xlsx') && ($fileExtension != 'pdf') && ($fileExtension != 'docx')){
return redirect()->back()->with([
- 'message' => 'Maaf File Harus Berupa xls,xlsx!',
+ 'message' => 'Maaf File Harus Berupa pdf,docx,xls,xlsx!',
'type' => "error"
]);
}
@@ -164,21 +167,21 @@ class DatasetTambahanController extends Controller
- for ($i = 5; $i < count($rows); $i++) {
- $row = $rows[$i];
+ // for ($i = 5; $i < count($rows); $i++) {
+ // $row = $rows[$i];
- // Skip baris kosong
- if (collect($row)->filter()->isEmpty()) continue;
+ // // Skip baris kosong
+ // if (collect($row)->filter()->isEmpty()) continue;
- $assoc = [];
- foreach ($header as $j => $columnName) {
- if($columnName != null){
- $assoc[strtolower(str_replace(' ','_',$columnName))] = $row[$j] ?? null;
- }
- }
+ // $assoc = [];
+ // foreach ($header as $j => $columnName) {
+ // if($columnName != null){
+ // $assoc[strtolower(str_replace(' ','_',$columnName))] = $row[$j] ?? null;
+ // }
+ // }
- $data[] = $assoc;
- }
+ // $data[] = $assoc;
+ // }
}
}
@@ -207,7 +210,12 @@ class DatasetTambahanController extends Controller
}
$insert->deskripsi = $request->deskripsi;
$insert->tahun = $request->tahun;
- $insert->tahun_data = $request->tahun_data;
+ $insert->tahun_data = $request->tahun_data;
+ if((session('group_id') == 1) || (session('group_alias') == 'admin')){
+ $insert->status = 1;
+ }else{
+ $insert->status = 0;
+ }
$insert->save();
}else{
// dd($request->all());
diff --git a/app/Models/DatasetTambahan.php b/app/Models/DatasetTambahan.php
index 35831b5..b9614c7 100644
--- a/app/Models/DatasetTambahan.php
+++ b/app/Models/DatasetTambahan.php
@@ -11,6 +11,10 @@ class DatasetTambahan extends Model
protected $primaryKey = 'DatasetTambahanId';
protected $guarded = [];
+ function tabelData() {
+ return $this->belongsTo('App\Models\Master\TabelData','template_id');
+ }
+
function instansi() {
return $this->belongsTo('App\Models\Master\Instansi','instansi_id');
}
diff --git a/database/migrations/2026_02_25_025804_add_column_tahun_data.php b/database/migrations/2026_02_25_025804_add_column_tahun_data.php
new file mode 100644
index 0000000..4f1fd35
--- /dev/null
+++ b/database/migrations/2026_02_25_025804_add_column_tahun_data.php
@@ -0,0 +1,28 @@
+year('tahun_data')->nullable();
+ });
+ }
+
+ /**
+ * Reverse the migrations.
+ */
+ public function down(): void
+ {
+ Schema::table('dataset-tambahan', function (Blueprint $table) {
+ //
+ });
+ }
+};
diff --git a/resources/views/dataset-detail.blade.php b/resources/views/dataset-detail.blade.php
index 1c8a02a..5a7f907 100644
--- a/resources/views/dataset-detail.blade.php
+++ b/resources/views/dataset-detail.blade.php
@@ -5,7 +5,7 @@
+
{{ $dataset->instansi->name }}