update
parent
0286fd466f
commit
26c8e7df99
|
@ -0,0 +1,46 @@
|
|||
APP_NAME=Laravel
|
||||
APP_ENV=local
|
||||
APP_KEY=base64:kJqxmAbo0WxiIy/a1U0U807qcfgj+Dz7ZVrQHZaiJ84=
|
||||
APP_DEBUG=true
|
||||
APP_URL=http://localhost
|
||||
|
||||
LOG_CHANNEL=stack
|
||||
|
||||
DB_CONNECTION=pgsql
|
||||
DB_HOST=localhost
|
||||
DB_PORT=5432
|
||||
DB_DATABASE=dikplhd
|
||||
DB_USERNAME=postgres
|
||||
DB_PASSWORD=postgres
|
||||
|
||||
BROADCAST_DRIVER=log
|
||||
CACHE_DRIVER=file
|
||||
QUEUE_CONNECTION=sync
|
||||
SESSION_DRIVER=file
|
||||
SESSION_LIFETIME=120
|
||||
|
||||
REDIS_HOST=127.0.0.1
|
||||
REDIS_PASSWORD=null
|
||||
REDIS_PORT=6379
|
||||
|
||||
MAIL_MAILER=smtp
|
||||
MAIL_HOST=smtp.mailtrap.io
|
||||
MAIL_PORT=2525
|
||||
MAIL_USERNAME=null
|
||||
MAIL_PASSWORD=null
|
||||
MAIL_ENCRYPTION=null
|
||||
MAIL_FROM_ADDRESS=null
|
||||
MAIL_FROM_NAME="${APP_NAME}"
|
||||
|
||||
AWS_ACCESS_KEY_ID=
|
||||
AWS_SECRET_ACCESS_KEY=
|
||||
AWS_DEFAULT_REGION=us-east-1
|
||||
AWS_BUCKET=
|
||||
|
||||
PUSHER_APP_ID=
|
||||
PUSHER_APP_KEY=
|
||||
PUSHER_APP_SECRET=
|
||||
PUSHER_APP_CLUSTER=mt1
|
||||
|
||||
MIX_PUSHER_APP_KEY="${PUSHER_APP_KEY}"
|
||||
MIX_PUSHER_APP_CLUSTER="${PUSHER_APP_CLUSTER}"
|
|
@ -3,6 +3,8 @@ use App\Models\Master\Menu;
|
|||
use App\Models\Master\AccessMenu;
|
||||
use App\Models\User;
|
||||
use App\Models\Master\Group;
|
||||
use App\Models\Master\Dataset;
|
||||
use App\Models\Master\Topik;
|
||||
use App\Models\Log;
|
||||
|
||||
if (!function_exists('taskLabel')) {
|
||||
|
@ -325,4 +327,65 @@ if (!function_exists('include_files_in_folder')) {
|
|||
echo $e->getMessage();
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!function_exists('topikById')) {
|
||||
function topikById($id){
|
||||
$keyId = decode_id($id);
|
||||
$topik = Topik::find($keyId);
|
||||
return $topik;
|
||||
}
|
||||
}
|
||||
|
||||
if (!function_exists('topikByDataset')) {
|
||||
function topikByDataset($json){
|
||||
|
||||
// $table = Dataset::find($id);
|
||||
|
||||
$decode = json_decode($json);
|
||||
|
||||
$res = "Belum ada data";
|
||||
if(count($decode) > 0){
|
||||
$res = [];
|
||||
$d = '';
|
||||
foreach ($decode as $key => $value) {
|
||||
if (($value !== null) && ($value !== "")) {
|
||||
$d .= '<span class="p-1 bg-info rounded text-white">'.topikById($value)->name.'</span> ';
|
||||
}
|
||||
|
||||
}
|
||||
// $d .= '</ul>';
|
||||
array_push($res, $d);
|
||||
|
||||
$res = implode("", $res);
|
||||
}
|
||||
|
||||
return $res;
|
||||
}
|
||||
}
|
||||
|
||||
if (!function_exists('tags')) {
|
||||
function tags($json){
|
||||
|
||||
// $table = Dataset::find($id);
|
||||
|
||||
$decode = json_decode($json);
|
||||
|
||||
$res = "Belum ada data";
|
||||
if(count($decode) > 0){
|
||||
$res = [];
|
||||
$d = '';
|
||||
foreach ($decode as $key => $value) {
|
||||
if (($value !== null) && ($value !== "")) {
|
||||
$d .= '<span class="p-1 bg-warning rounded text-white mr-3">'.$value.'</span> ';
|
||||
}
|
||||
|
||||
}
|
||||
// $d .= '</ul>';
|
||||
array_push($res, $d);
|
||||
|
||||
$res = implode("", $res);
|
||||
}
|
||||
|
||||
return $res;
|
||||
}
|
||||
}
|
|
@ -39,41 +39,85 @@ class DatasetController extends Controller
|
|||
public function grid(Request $request)
|
||||
{
|
||||
|
||||
$data = Dataset::all();
|
||||
// $data = User::with(['group'])->orderBy('id','DESC')->get();
|
||||
$_data = [];
|
||||
// $data = Dataset::all();
|
||||
// // $data = User::with(['group'])->orderBy('id','DESC')->get();
|
||||
// $_data = [];
|
||||
|
||||
|
||||
foreach ($data as $key => $row) {
|
||||
// foreach ($data as $key => $row) {
|
||||
|
||||
|
||||
$action = '';
|
||||
// $action = '';
|
||||
|
||||
if((permission('is_create', $this->route.'.*','module',false)) || (permission('is_update', $this->route.'.*','module',false))){
|
||||
$action .= '<div class="flex gap-3 justify-center items-center flex-row">';
|
||||
$action .= '<a href="'.url('opendata/dataset/update/'.encode_id($row->DatasetId)).'" data-toggle="tooltip" title="Ubah Data" class="btn btn-sm btn-block bg-primary"><i class="ri-pencil-line text-white"></i></a>';
|
||||
$action .= '<a href="'.url('opendata/dataset/view/'.encode_id($row->DatasetId)).'" data-toggle="tooltip" title="Lihat Data" class="btn btn-sm btn-block bg-info"><i class="ri-eye-line text-white"></i></a>';
|
||||
if(session('group_id') == 1){
|
||||
// $action .= '<a href="#" data-href="'.url('management/user/forcelogin/'.encode_id($row->id)).'" data-toggle="tooltip" title="Force Login" class="forcelogin btn btn-sm btn-block bg-success"><i class="ri-user-2-line text-white"></i></a>';
|
||||
// $action .= '<a href="#" data-href="'.url('management/user/delete/'.encode_id($row->id)).'" data-toggle="tooltip" title="Hapus Data" class="remove_data btn btn-sm btn-block bg-danger"><i class="ri-delete-bin-line text-white"></i></a>';
|
||||
}
|
||||
$action .= '</div>';
|
||||
}
|
||||
// if((permission('is_create', $this->route.'.*','module',false)) || (permission('is_update', $this->route.'.*','module',false))){
|
||||
// $action .= '<div class="flex gap-3 justify-center items-center flex-row">';
|
||||
// $action .= '<a href="'.url('opendata/dataset/update/'.encode_id($row->DatasetId)).'" data-toggle="tooltip" title="Ubah Data" class="btn btn-sm btn-block bg-primary"><i class="ri-pencil-line text-white"></i></a>';
|
||||
// $action .= '<a href="'.url('opendata/dataset/view/'.encode_id($row->DatasetId)).'" data-toggle="tooltip" title="Lihat Data" class="btn btn-sm btn-block bg-info"><i class="ri-eye-line text-white"></i></a>';
|
||||
// if(session('group_id') == 1){
|
||||
// // $action .= '<a href="#" data-href="'.url('management/user/forcelogin/'.encode_id($row->id)).'" data-toggle="tooltip" title="Force Login" class="forcelogin btn btn-sm btn-block bg-success"><i class="ri-user-2-line text-white"></i></a>';
|
||||
// // $action .= '<a href="#" data-href="'.url('management/user/delete/'.encode_id($row->id)).'" data-toggle="tooltip" title="Hapus Data" class="remove_data btn btn-sm btn-block bg-danger"><i class="ri-delete-bin-line text-white"></i></a>';
|
||||
// }
|
||||
// $action .= '</div>';
|
||||
// }
|
||||
|
||||
$_data[] = [
|
||||
'no' => $key+1,
|
||||
'id' => encode_id($row->id),
|
||||
'name' => @$row->name,
|
||||
'publik' => @$row->publik,
|
||||
'created_at' => date('d-m-Y H:i:s',strtotime(@$row->created_at)),
|
||||
'instansi' => @$row->instansi->name,
|
||||
'action' => @$action,
|
||||
];
|
||||
// $_data[] = [
|
||||
// 'no' => $key+1,
|
||||
// 'id' => encode_id($row->id),
|
||||
// 'name' => @$row->name,
|
||||
// 'publik' => @$row->publik,
|
||||
// 'created_at' => date('d-m-Y H:i:s',strtotime(@$row->created_at)),
|
||||
// 'instansi' => @$row->instansi->name,
|
||||
// 'action' => @$action,
|
||||
// ];
|
||||
|
||||
}
|
||||
// }
|
||||
|
||||
// return response()->json($_data); // Return the data as a JSON response
|
||||
return response()->json($_data);
|
||||
// // return response()->json($_data); // Return the data as a JSON response
|
||||
// return response()->json($_data);
|
||||
|
||||
// $perPage = $request->query('limit', 10);
|
||||
// $page = $request->query('page', 1);
|
||||
// // dd($page);
|
||||
// $search = $request->query('search');
|
||||
$id = $request->query('id');
|
||||
$keyId = decode_id($id);
|
||||
$item = Dataset::find($keyId); // atau pakai ->pluck(), ->find(), dll
|
||||
|
||||
$json = json_decode($item->data, true);
|
||||
$limit = $request->input('limit', 10);
|
||||
$offset = $request->input('offset', 0);
|
||||
|
||||
$rows = array_slice($json, $offset, $limit);
|
||||
return response()->json([
|
||||
'total' => count($json),
|
||||
'rows' => $rows
|
||||
]);
|
||||
|
||||
// // Ambil JSON dari kolom database
|
||||
// $rawData = Dataset::find($keyId)->data; // atau pakai ->pluck(), ->find(), dll
|
||||
// $array = json_decode($rawData, true); // array dari JSON
|
||||
// $collection = collect($array);
|
||||
|
||||
// if ($search) {
|
||||
// $collection = $collection->filter(function ($item) use ($search) {
|
||||
// foreach ($item as $value) {
|
||||
// if (stripos($value, $search) !== false) {
|
||||
// return true;
|
||||
// }
|
||||
// }
|
||||
// return false;
|
||||
// });
|
||||
// }
|
||||
|
||||
// $total = $collection->count();
|
||||
|
||||
// $paginated = $collection->slice(($page - 1) * $perPage, $perPage)->values();
|
||||
|
||||
// return response()->json([
|
||||
// 'data' => $paginated,
|
||||
// 'page' => $page,
|
||||
// 'total' => $total
|
||||
// ]);
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
*.sqlite*
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -1,4 +1,6 @@
|
|||
@extends('layouts.master')
|
||||
@section('css')
|
||||
@endsection
|
||||
@section('content')
|
||||
<div class="flex flex-col gap-6">
|
||||
<div class="card">
|
||||
|
@ -7,153 +9,75 @@
|
|||
<h4 class="card-title">{{$title}}</h4>
|
||||
</div>
|
||||
</div>
|
||||
<form action="{{route($route.'.store')}}" method="POST" class="" enctype="multipart/form-data">
|
||||
{{csrf_field()}}
|
||||
<input type="hidden" name="secure_id" value="{{@$keyId}}">
|
||||
<div class="p-6">
|
||||
<div class="grid lg:grid-cols-1 gap-3">
|
||||
<table class="gridjs-table">
|
||||
<tbody class="gridjs-tbody">
|
||||
<tr class="gridjs-tr">
|
||||
<td class="gridjs-td border-none text-xs">Instansi</td>
|
||||
<td class="gridjs-td border-none text-xs">{{$item->instansi->name}}</td>
|
||||
</tr>
|
||||
<tr class="gridjs-tr">
|
||||
<td class="gridjs-td border-none text-xs">Resource Data</td>
|
||||
<td class="gridjs-td border-none text-xs">{{$item->template->name}}</td>
|
||||
</tr>
|
||||
<tr class="gridjs-tr">
|
||||
<td class="gridjs-td border-none text-xs">Nama Dataset</td>
|
||||
<td class="gridjs-td border-none text-xs">{{$item->name}}</td>
|
||||
</tr>
|
||||
<tr class="gridjs-tr">
|
||||
<td class="gridjs-td border-none text-xs">Sifat Dataset</td>
|
||||
<td class="gridjs-td border-none text-xs">
|
||||
@if($item->publik == 1)
|
||||
<span class="p-1 text-xs text-white rounded bg-success">Terbuka/Publik</span>
|
||||
@else
|
||||
<span class="p-1 text-xs text-white rounded bg-primary">Rahasia/Private</span>
|
||||
@endif
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="gridjs-tr">
|
||||
<td class="gridjs-td border-none text-xs">Tags</td>
|
||||
<td class="gridjs-td border-none text-xs">{{$item->tags}}</td>
|
||||
</tr>
|
||||
<tr class="gridjs-tr">
|
||||
<td class="gridjs-td border-none text-xs">File : </td>
|
||||
<td class="gridjs-td border-none text-xs"><a href="{{asset('uploads/'.@$item->file)}}" class="btn bg-primary text-white text-xs"><i class="ri-download-line"></i> Download File</a></td>
|
||||
</tr>
|
||||
<tr class="gridjs-tr">
|
||||
<td class="gridjs-td border-none text-xs">Topik</td>
|
||||
<td class="gridjs-td border-none text-xs">{{$item->topik}}</td>
|
||||
</tr>
|
||||
<tr class="gridjs-tr">
|
||||
<td class="gridjs-td border-none text-xs">Deskripsi</td>
|
||||
<td class="gridjs-td border-none text-xs">{{$item->deskripsi}}</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<?php
|
||||
$data = json_decode($item->data);
|
||||
?>
|
||||
<table id="table" class="gridjs-table border">
|
||||
<thead class="gridjs-thead">
|
||||
<tr class="gridjs-tr bg-secondary/10">
|
||||
@if (!empty($data))
|
||||
@foreach ($data[0] as $k => $key)
|
||||
<th class="gridjs-td gridjs-th text-xs text-gray-500">{{ ucwords(str_replace('_', ' ', $k)) }}</th>
|
||||
@endforeach
|
||||
<div class="p-6">
|
||||
<div class="grid lg:grid-cols-1 gap-3">
|
||||
<table class="gridjs-table">
|
||||
<tbody class="gridjs-tbody">
|
||||
<tr class="gridjs-tr">
|
||||
<td class="gridjs-td border-none text-xs">Instansi</td>
|
||||
<td class="gridjs-td border-none text-xs">{{$item->instansi->name}}</td>
|
||||
</tr>
|
||||
<tr class="gridjs-tr">
|
||||
<td class="gridjs-td border-none text-xs">Resource Data</td>
|
||||
<td class="gridjs-td border-none text-xs">{{$item->template->name}}</td>
|
||||
</tr>
|
||||
<tr class="gridjs-tr">
|
||||
<td class="gridjs-td border-none text-xs">Nama Dataset</td>
|
||||
<td class="gridjs-td border-none text-xs">{{$item->name}}</td>
|
||||
</tr>
|
||||
<tr class="gridjs-tr">
|
||||
<td class="gridjs-td border-none text-xs">Sifat Dataset</td>
|
||||
<td class="gridjs-td border-none text-xs">
|
||||
@if($item->publik == 1)
|
||||
<span class="p-1 text-xs text-white rounded bg-success">Terbuka/Publik</span>
|
||||
@else
|
||||
<span class="p-1 text-xs text-white rounded bg-primary">Rahasia/Private</span>
|
||||
@endif
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody class="gridjs-tbody">
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="gridjs-tr">
|
||||
<td class="gridjs-td border-none text-xs">Tags</td>
|
||||
<td class="gridjs-td border-none text-xs">{!!tags($item->tags)!!}</td>
|
||||
</tr>
|
||||
<tr class="gridjs-tr">
|
||||
<td class="gridjs-td border-none text-xs">File : </td>
|
||||
<td class="gridjs-td border-none text-xs"><a href="{{asset('uploads/'.@$item->file)}}" class="btn bg-primary text-white text-xs"><i class="ri-download-line"></i> Download File</a></td>
|
||||
</tr>
|
||||
<tr class="gridjs-tr">
|
||||
<td class="gridjs-td border-none text-xs">Topik</td>
|
||||
<td class="gridjs-td border-none text-xs">{!! topikByDataset($item->topik)!!}</td>
|
||||
</tr>
|
||||
<tr class="gridjs-tr">
|
||||
<td class="gridjs-td border-none text-xs">Deskripsi</td>
|
||||
<td class="gridjs-td border-none text-xs">{{$item->deskripsi}}</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<?php
|
||||
$data = json_decode($item->data);
|
||||
?>
|
||||
<!-- <div id="table-grid"></div> -->
|
||||
|
||||
<table id="table"
|
||||
data-toggle="table"
|
||||
data-search="false"
|
||||
data-pagination="true"
|
||||
data-side-pagination="server"
|
||||
data-url="{{ route($route.'.grid', ['id' => $keyId]) }}">
|
||||
<thead>
|
||||
<tr class="bg-secondary text-white">
|
||||
@if (!empty($data))
|
||||
@foreach ($data as $row)
|
||||
<tr class="gridjs-tr">
|
||||
@foreach ($row as $value)
|
||||
<td class="gridjs-th text-xs">{{ $value ?? '-' }}</td>
|
||||
@endforeach
|
||||
</tr>
|
||||
@foreach ($data[0] as $k => $key)
|
||||
<th data-field="{{$k}}" class="gridjs-td gridjs-th text-xs">{{ ucwords(str_replace('_', ' ', $k)) }}</th>
|
||||
@endforeach
|
||||
@endif
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</tr>
|
||||
</thead>
|
||||
</table>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@endsection
|
||||
@section('js')
|
||||
<script>
|
||||
const input = document.getElementById('tag-input');
|
||||
const container = document.getElementById('tag-container');
|
||||
|
||||
input.addEventListener('keydown', function (e) {
|
||||
if (e.key === 'Enter' && this.value.trim() !== '') {
|
||||
e.preventDefault();
|
||||
const tagText = this.value.trim();
|
||||
|
||||
// Buat tag baru
|
||||
const tag = document.createElement('span');
|
||||
tag.className = 'inline-flex items-center px-2 py-1 bg-primary text-white text-sm rounded';
|
||||
tag.innerHTML = `${tagText} <button type="button" class="ml-1 text-blue-500 hover:text-red-600">×</button>`;
|
||||
|
||||
// Hidden input untuk dikirim ke server
|
||||
const hiddenInput = document.createElement('input');
|
||||
hiddenInput.type = 'hidden';
|
||||
hiddenInput.name = 'tags[]';
|
||||
hiddenInput.value = tagText;
|
||||
|
||||
// Tempelkan ke tag
|
||||
tag.appendChild(hiddenInput);
|
||||
|
||||
// Tambahkan tag ke container sebelum input
|
||||
container.insertBefore(tag, input);
|
||||
|
||||
// Reset input
|
||||
this.value = '';
|
||||
|
||||
// Hapus tag saat tombol × ditekan
|
||||
tag.querySelector('button').addEventListener('click', () => tag.remove());
|
||||
}
|
||||
});
|
||||
</script>
|
||||
<script type="text/javascript">
|
||||
$('#template_default').on('change',function(){
|
||||
var instansi_id = $('.instansi_id').find(':selected').val();
|
||||
var val = $(this).find(':selected').val();
|
||||
if(instansi_id == ''){
|
||||
toastr.error("Data instansi_id Belum Dipilih", 'Error!', {positionClass: 'toast-bottom-right', containerId: 'toast-bottom-right'});
|
||||
$('#template_default').val('');
|
||||
}else{
|
||||
if(val == 1){
|
||||
$('.btnDownload').attr('href',"{{url('test')}}");
|
||||
$('.btnDownload').removeClass('hidden');
|
||||
}else{
|
||||
$('.btnDownload').attr('href',"#");
|
||||
$('.btnDownload').addClass('hidden');
|
||||
}
|
||||
}
|
||||
});
|
||||
$(document).ready(function() {
|
||||
$('.numberInput').on('input', function() {
|
||||
this.value = this.value.replace(/[^0-9]/g, ''); // Hanya angka 0-9
|
||||
});
|
||||
$('#togglePassword').on('click', function() {
|
||||
let passwordField = $('#password');
|
||||
let icon = $(this).find('i');
|
||||
|
||||
// Cek apakah input saat ini bertipe password
|
||||
if (passwordField.attr('type') === 'password') {
|
||||
passwordField.attr('type', 'text'); // Ubah ke teks
|
||||
icon.removeClass('fa-eye').addClass('fa-eye-slash'); // Ganti ikon
|
||||
} else {
|
||||
passwordField.attr('type', 'password'); // Ubah ke password
|
||||
icon.removeClass('fa-eye-slash').addClass('fa-eye'); // Kembalikan ikon
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
@endsection
|
|
@ -0,0 +1,9 @@
|
|||
compiled.php
|
||||
config.php
|
||||
down
|
||||
events.scanned.php
|
||||
maintenance.php
|
||||
routes.php
|
||||
routes.scanned.php
|
||||
schedule-*
|
||||
services.json
|
|
@ -0,0 +1,2 @@
|
|||
composer.lock
|
||||
vendor
|
|
@ -0,0 +1 @@
|
|||
_build
|
|
@ -0,0 +1,3 @@
|
|||
composer.lock
|
||||
composer.phar
|
||||
/vendor/
|
|
@ -0,0 +1,2 @@
|
|||
/vendor/
|
||||
composer.lock
|
Loading…
Reference in New Issue