-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Co-authored-by: ahmad afandi <[email protected]> Co-authored-by: Firliani Fauziah <[email protected]>
- Loading branch information
1 parent
28b3ae1
commit 55421e2
Showing
34 changed files
with
93,456 additions
and
102 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
<?php | ||
|
||
namespace App\Http\Controllers\Api; | ||
|
||
use App\Http\Controllers\Controller; | ||
use App\Models\Desa; | ||
use App\Models\Opendk; | ||
use Carbon\Carbon; | ||
use Illuminate\Http\Request; | ||
|
||
class InstallOpenDKController extends Controller | ||
{ | ||
public function chart(Request $request) | ||
{ | ||
$provinsi = $request->get('provinsi'); | ||
$kabupaten = $request->get('kabupaten'); | ||
$kecamatan = $request->get('kecamatan'); | ||
$minCreatedAt = Carbon::now()->subYears(2)->format('Y-m-d'); | ||
$opendk = Opendk::selectRaw("DATE_FORMAT(created_at, '%m-%Y') month_year, count(*) as total") | ||
->groupBy('month_year')->orderBy('created_at')->whereDate('created_at', '>', $minCreatedAt); | ||
if ($provinsi) { | ||
$opendk->where('kode_provinsi', $provinsi); | ||
} | ||
if ($kabupaten) { | ||
$opendk->where('kode_kabupaten', $kabupaten); | ||
} | ||
if ($kecamatan) { | ||
$opendk->where('kode_kecamatan', $kecamatan); | ||
} | ||
|
||
$opendkData = $opendk->get(); | ||
$labels = []; | ||
$datasetOpendk = []; | ||
foreach ($opendkData as $item) { | ||
$period = Carbon::createFromFormat('d-m-Y', '01-'.$item->month_year)->translatedFormat('M-y'); | ||
$labels[] = $period; | ||
$datasetOpendk[] = $item->total; | ||
} | ||
$datasets = [ | ||
['label' => 'OpenDK', 'data' => $datasetOpendk], | ||
]; | ||
|
||
$result = [ | ||
'labels' => $labels, | ||
'datasets' => $datasets, | ||
]; | ||
|
||
return response()->json($result); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
<?php | ||
|
||
namespace App\Http\Controllers; | ||
|
||
use App\Models\Desa; | ||
use Carbon\Carbon; | ||
use Illuminate\Http\Request; | ||
use Yajra\DataTables\Facades\DataTables; | ||
|
||
class LaporanTemaController extends Controller | ||
{ | ||
|
||
public function index(Request $request) | ||
{ | ||
$fillters = [ | ||
'kode_provinsi' => $request->kode_provinsi, | ||
'kode_kabupaten' => $request->kode_kabupaten, | ||
'kode_kecamatan' => $request->kode_kecamatan, | ||
'status' => $request->status, | ||
'akses' => $request->akses, | ||
'versi_lokal' => $request->versi_lokal, | ||
'versi_hosting' => $request->versi_hosting, | ||
'tte' => $request->tte, | ||
]; | ||
|
||
$tema = $request->query('tema', ''); | ||
|
||
if ($request->ajax()) { | ||
if($tema){ | ||
$data = DataTables::of(Desa::fillter($fillters)->where('tema', $tema)); | ||
}else{ | ||
$data = DataTables::of(Desa::fillter($fillters)->whereIn('tema', ['esensi', 'natra', 'palanta'])); | ||
} | ||
return $data->addIndexColumn() | ||
->editColumn('updated_at', fn($q) => $q->updated_at->format('Y-m-d H:i:s')) | ||
->editColumn('url_hosting', function ($q) { | ||
return '<a href="https://' . $q->url_hosting . '" target="_blank">'. $q->url_hosting .'</a>'; | ||
}) | ||
->rawColumns(['url_hosting']) // Mengizinkan HTML di kolom url_hosting | ||
->make(true); | ||
} | ||
|
||
$palanta = Desa::TemaPalanta(); | ||
$natra = Desa::TemaNatra(); | ||
$esensi = Desa::TemaEsensi(); | ||
$tema = Desa::Tema(); | ||
|
||
return view('laporan.tema', compact('fillters', 'palanta', 'natra', 'esensi', 'tema')); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,154 @@ | ||
<?php | ||
|
||
namespace App\Http\Controllers; | ||
|
||
use App\Models\Desa; | ||
use App\Models\Opendk; | ||
use Carbon\Carbon; | ||
use Illuminate\Http\Request; | ||
use Yajra\DataTables\Facades\DataTables; | ||
|
||
class OpenDKDashboardController extends Controller | ||
{ | ||
public function index(Request $request) | ||
{ | ||
$fillters = [ | ||
'kode_provinsi' => $request->kode_provinsi, | ||
'kode_kabupaten' => $request->kode_kabupaten, | ||
'kode_kecamatan' => $request->kode_kecamatan, | ||
]; | ||
$versiTerakhir = lastrelease_opendk(); | ||
$installHariIni = Opendk::whereDate('created_at', '>=',Carbon::now()->format('Y-m-d'))->get(); | ||
return view('website.opendk.index', [ | ||
'fillters' => $fillters, | ||
'total_desa' => format_angka(Desa::count()), | ||
'pengguna_opendk' => Opendk::count(), | ||
'info_rilis' => 'Rilis OpenDK '.$versiTerakhir, | ||
'installHariIni' => $installHariIni, | ||
'provinsi_pengguna_opendk' => Opendk::selectRaw('nama_provinsi, count(*) as total')->orderBy('total', 'desc')->groupBy('nama_provinsi')->get(), | ||
]); | ||
} | ||
|
||
public function detail() | ||
{ | ||
return view('website.opendk.detail'); | ||
} | ||
|
||
public function versi(Request $request) | ||
{ | ||
$fillters = [ | ||
'kode_provinsi' => $request->kode_provinsi, | ||
'kode_kabupaten' => $request->kode_kabupaten, | ||
'kode_kecamatan' => $request->kode_kecamatan, | ||
]; | ||
|
||
if ($request->ajax()) { | ||
return DataTables::of(Opendk::filter($fillters)->groupBy('versi')->selectRaw('versi, count(*) as jumlah')) | ||
->addIndexColumn() | ||
->make(true); | ||
} | ||
|
||
return view('website.opendk.versi_lengkap', compact('fillters')); | ||
} | ||
|
||
public function versi_detail(Request $request) | ||
{ | ||
$fillters = [ | ||
'kode_provinsi' => $request->kode_provinsi, | ||
'kode_kabupaten' => $request->kode_kabupaten, | ||
'kode_kecamatan' => $request->kode_kecamatan, | ||
]; | ||
|
||
if ($request->ajax()) { | ||
$versi = $request->versi; | ||
return DataTables::of(Opendk::filter($fillters)->when($versi, static fn($q) => $q->where('versi', $versi))) | ||
->editColumn('updated_at', static fn($q) => $q->updated_at->translatedFormat('Y-m-d H:i:s')) | ||
->addIndexColumn() | ||
->make(true); | ||
} | ||
|
||
return view('website.opendk.versi_detail', compact('fillters')); | ||
} | ||
|
||
public function install_baru(Request $request) | ||
{ | ||
if ($request->ajax()) { | ||
return DataTables::of(Opendk::whereDate('created_at', '>=', Carbon::now()->subDays(7))) | ||
->editColumn('created_at', static fn($q) => $q->created_at->translatedFormat('j F Y H:i')) | ||
->addIndexColumn() | ||
->make(true); | ||
} | ||
} | ||
|
||
public function peta(Request $request) | ||
{ | ||
if ($request->ajax()) { | ||
$fillters = [ | ||
'kode_provinsi' => $request->kode_provinsi, | ||
'kode_kabupaten' => $request->kode_kabupaten, | ||
'kode_kecamatan' => $request->kode_kecamatan | ||
]; | ||
// | ||
$geoJSONdata = Opendk::filter($fillters) | ||
->whereRaw("CONCAT('',lat * 1) = lat") // tdk ikut sertakan data bukan bilangan | ||
->whereRaw("CONCAT('',lng * 1) = lng") // tdk ikut sertakan data bukan bilangan | ||
->whereRaw('lat BETWEEN -10 AND 6') | ||
->whereRaw('lng BETWEEN 95 AND 142') | ||
->where(function ($query) { | ||
$query | ||
->where('lat', '!=', config('tracksid.desa_contoh.lat')) | ||
->where('lng', '!=', config('tracksid.desa_contoh.lng')); | ||
})->orderBy('kode_kecamatan', 'ASC')->get()->map(function ($kecamatan) { | ||
return [ | ||
'type' => 'Feature', | ||
'geometry' => [ | ||
'type' => 'Point', | ||
'coordinates' => [ | ||
(float) $kecamatan->lng, | ||
(float) $kecamatan->lat, | ||
], | ||
], | ||
'properties' => $this->properties($kecamatan), | ||
'id' => $kecamatan->id, | ||
]; | ||
}); | ||
|
||
return response()->json([ | ||
'type' => 'FeatureCollection', | ||
'features' => $geoJSONdata, | ||
]); | ||
} | ||
} | ||
|
||
private function properties(Opendk $kecamatan) | ||
{ | ||
$link = ''; | ||
if (auth()->check()) { | ||
$link = '<tr><td>Website</td><td> : <a href="http://'.strtolower($kecamatan->url).'" target="_blank">'.strtolower($kecamatan->url).'</a></b></td></tr>'; | ||
} | ||
|
||
return [ | ||
'logo' => null, | ||
'popupContent' => ' | ||
<h6 class="text-center"><b style="color:red">'.strtoupper($kecamatan->sebutan_wilayah.' '.$kecamatan->nama_kecamatan).'</b></h6> | ||
<b><table width="100%"> | ||
<tr> | ||
<td>'.ucwords($kecamatan->sebutan_wilayah).'</td><td> : '.ucwords($kecamatan->sebutan_wilayah.' '.$kecamatan->nama_kecamatan).'</b></td> | ||
</tr> | ||
<tr> | ||
<td>Kecamatan</td><td> : '.ucwords($kecamatan->nama_kecamatan).'</b></td> | ||
</tr> | ||
<tr> | ||
<td>Kab/Kota</td><td> : '.ucwords($kecamatan->nama_kabupaten).'</b></td> | ||
</tr> | ||
<tr> | ||
<td>Provinsi</td><td> : '.ucwords($kecamatan->nama_provinsi).'</b></td> | ||
</tr> | ||
<tr> | ||
<td>Alamat</td><td> : '.$kecamatan->alamat.'</b></td> | ||
</tr> | ||
'.$link.' | ||
</table></b>', | ||
]; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -181,7 +181,8 @@ public function requestData() | |
'jml_dokumen', | ||
'jml_keluarga', | ||
'anjungan', | ||
'kontak' | ||
'kontak', | ||
'tema' | ||
]); | ||
} | ||
} |
Oops, something went wrong.