main
ilhamwara 2025-06-13 15:48:17 +07:00
parent 7fb4d52b86
commit 37930bdfc4
21 changed files with 1104 additions and 58 deletions

View File

@ -228,7 +228,7 @@ if (!function_exists('renderMenu')) {
$html .= '<li class=" menu-item ' . $ch1 . '">
<a '.$collapse1.' class=" menu-link '.$active1.'" href="' . url($p1->url) . '">
<span class="menu-icon"><i class="' . $p1->menu_icons . '"></i>
</span> <span class="menu-text">' . @$p1->title.'</span>';
</span> <span class="menu-text ">' . @$p1->title.'</span>';
if (count($child2) > 0) {
$html .= '<span class="menu-arrow"></span>';
$html .= '</a>';
@ -241,7 +241,7 @@ if (!function_exists('renderMenu')) {
$link2 = count($child3) > 0 ? '' : 'menu-link';
if ($access2) {
$active2 = activeMenuClass($p2->module) ? 'active' : '';
$html .= '<li class=" menu-item ' . $ch2 . '"><a '.$collapse2.' class="menu-link '.$active2.'" href="' . url($p2->url) . '"><span class="menu-icon"><i class="' . $p2->menu_icons . '"></i></span> <span class="menu-text">' . @$p2->title.'<span>';
$html .= '<li class=" menu-item ' . $ch2 . '"><a '.$collapse2.' class="menu-link '.$active2.'" href="' . url($p2->url) . '"><span class="menu-icon"><i class="' . $p2->menu_icons . '"></i></span> <span class="menu-text ">' . @$p2->title.'<span>';
if (count($child3) > 0) {
$html .= '<span class="menu-arrow"></span>';
$html .= '</a>';
@ -255,13 +255,13 @@ if (!function_exists('renderMenu')) {
if ($access3) {
$active3 = activeMenuClass($p3->module) ? 'active' : '';
// $active3 = $active ? ' ' . null : null;
$html .= '<li class=" menu-item ' . $ch3 .'"><a '.$collapse3.' class="menu-link '.$active3.'" href="' . url($p3->url) . '"> <span class="menu-text">' . @$p3->title.'</span>';
$html .= '<li class=" menu-item ' . $ch3 .'"><a '.$collapse3.' class="menu-link '.$active3.'" href="' . url($p3->url) . '"> <span class="menu-text ">' . @$p3->title.'</span>';
if (count($child4) > 0) {
$html .= '<span class="menu-arrow"></span>';
$html .= '</a>';
$html .= '<ul class="sub-menu hidden">';
foreach ($child4 as $p4) {
$html .= '<li class=" ' . null . '"><a class="menu-link" href="' . url($p4->url) . '"> <span class="menu-text">' . @$p4->title.'<span>';
$html .= '<li class=" ' . null . '"><a class="menu-link" href="' . url($p4->url) . '"> <span class="menu-text ">' . @$p4->title.'<span>';
}
$html .= '</ul>';
} else {

View File

@ -9,4 +9,7 @@ class FrontController extends Controller
function index() {
return view('index');
}
function search() {
return view('search');
}
}

View File

@ -0,0 +1,157 @@
<?php
namespace App\Http\Controllers\Master;
use App\Http\Controllers\Controller;
use Illuminate\Support\Facades\Validator;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\Hash;
use App\Models\Master\Topik;
use Illuminate\Http\Request;
class TopikController extends Controller
{
protected $title = 'Data Topik';
protected $template = 'modules.master.topik';
protected $route = 'modules.master.topik';
/**
* Display a listing of the resource.
*/
public function index()
{
permission('is_read', $this->route, 'module',true);
$data['breadcrumbs'] = [
['name' => 'Dashboard','url' => url('dashboard')],
['name' => 'Master Data'],
['name' => 'Data Topik','active' => true],
];
$data['title'] = $this->title;
$data['route'] = $this->route;
return view($this->template.'.index',$data);
}
public function grid(Request $request)
{
$data = Topik::all();
$_data = [];
foreach ($data as $key => $row) {
$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('master/topik/update/'.encode_id($row->MsTopikId)).'" data-toggle="tooltip" title="Edit Data" class="btn btn-sm btn-block bg-primary"><i class="ri-pencil-line text-white"></i></a>';
$action .= '</div>';
}
$_data[] = [
'no' => $key+1,
'id' => encode_id($row->id),
'name' => @$row->name,
'action' => @$action,
];
}
// return response()->json($_data); // Return the data as a JSON response
return response()->json($_data);
}
/**
* Show the form for creating a new resource.
*/
public function create()
{
//
}
/**
* Store a newly created resource in storage.
*/
public function store(Request $request)
{
try {
$keyId = decode_id($request->secure_id);
if(@$keyId){
Validator::make($request->all(), [
'name' => 'required',
])->validate();
$user = Topik::find($keyId);
$user->name = $request->name;
$user->save();
}else{
Validator::make($request->all(), [
'name' => 'required',
])->validate();
$user = new Topik;
$user->name = $request->name;
$user->save();
}
return redirect()->back()->with([
'message' => 'Berhasil update data',
'type' => 'success',
]);
} catch (Exception $e) {
return redirect()->back()->with([
'message' => $e->getMessage(),
'type' => "error"
]);
}
}
/**
* Display the specified resource.
*/
public function show(string $id)
{
//
}
/**
* Show the form for editing the specified resource.
*/
public function edit(string $id)
{
//
}
/**
* Update the specified resource in storage.
*/
public function update($id = null)
{
$data['breadcrumbs'] = [
['name' => 'Dashboard','url' => url('dashboard')],
['name' => 'Master Data'],
['name' => 'Data Topik','active' => true],
];
$keyId = decode_id($id);
$data['title'] = $this->title;
$data['route'] = $this->route;
$data['keyId'] = $id;
$data['item'] = Topik::where('MsTopikId',$keyId)->first();
return view($this->template.'.form',$data);
}
/**
* Remove the specified resource from storage.
*/
public function destroy(string $id)
{
//
}
}

View File

@ -0,0 +1,183 @@
<?php
namespace App\Http\Controllers\Opendata;
use App\Http\Controllers\Controller;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Validator;
use App\Models\Master\Instansi;
use App\Models\Master\Topik;
use App\Models\Dataset;
class DatasetController extends Controller
{
protected $title = 'Dataset';
protected $template = 'modules.opendata.dataset';
protected $route = 'modules.opendata.dataset';
/**
* Display a listing of the resource.
*/
public function index()
{
permission('is_read', $this->route, 'module',true);
$data['breadcrumbs'] = [
['name' => 'Dashboard','url' => url('dashboard')],
['name' => 'Open Data'],
['name' => 'Dataset','active' => true],
];
$data['title'] = $this->title;
$data['route'] = $this->route;
return view($this->template.'.index',$data);
}
public function grid(Request $request)
{
$data = Dataset::all();
// $data = User::with(['group'])->orderBy('id','DESC')->get();
$_data = [];
foreach ($data as $key => $row) {
$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('master/dataset/update/'.encode_id($row->DatasetId)).'" data-toggle="tooltip" title="Edit Data" class="btn btn-sm btn-block bg-primary"><i class="ri-pencil-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,
];
}
// return response()->json($_data); // Return the data as a JSON response
return response()->json($_data);
}
/**
* Show the form for creating a new resource.
*/
public function create()
{
//
}
/**
* Store a newly created resource in storage.
*/
public function store(Request $request)
{
Validator::make($request->all(), [
'name' => 'required',
'instansi_id' => 'required',
'template' => 'required',
'publik' => 'required',
'tags' => 'required',
'file' => 'required',
'topik' => 'required',
])->validate();
try {
$keyId = decode_id($request->secure_id);
if(@$keyId){
$insert = Dataset::find($keyId);
$insert->instansi_id = decode_id($request->instansi_id);
$insert->template = $request->template;
$insert->name = $request->name;
$insert->publik = $request->publik;
$insert->tags = json_encode($request->tags);
$insert->data = json_encode($request->data);
$insert->file = $request->file;
$insert->topik = json_encode($request->topik);
$insert->deskripsi = $request->deskripsi;
$insert->created_by = auth()->user()->id;
$insert->save();
}else{
$insert = new Dataset;
$insert->instansi_id = decode_id($request->instansi_id);
$insert->template = $request->template;
$insert->name = $request->name;
$insert->publik = $request->publik;
$insert->tags = json_encode($request->tags);
$insert->data = json_encode($request->data);
$insert->file = $request->file;
$insert->topik = json_encode($request->topik);
$insert->deskripsi = $request->deskripsi;
$insert->created_by = auth()->user()->id;
$insert->save();
}
return redirect()->back()->with([
'message' => 'Berhasil update data',
'type' => 'success',
]);
} catch (Exception $e) {
return redirect()->back()->with([
'message' => $e->getMessage(),
'type' => "error"
]);
}
}
/**
* Display the specified resource.
*/
public function show(string $id)
{
//
}
/**
* Show the form for editing the specified resource.
*/
public function edit(string $id)
{
//
}
/**
* Update the specified resource in storage.
*/
public function update($id = null)
{
$data['breadcrumbs'] = [
['name' => 'Dashboard','url' => url('dashboard')],
['name' => 'Open Data'],
['name' => 'Dataset','active' => true],
];
$keyId = decode_id($id);
$data['title'] = $this->title;
$data['route'] = $this->route;
$data['keyId'] = $id;
$data['item'] = null;
$data['instansi'] = Instansi::all();
$data['topik'] = Topik::all();
return view($this->template.'.form',$data);
}
/**
* Remove the specified resource from storage.
*/
public function destroy(string $id)
{
//
}
}

View File

@ -0,0 +1,19 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class Dataset extends Model
{
use HasFactory;
protected $table = 'dataset';
protected $primaryKey = 'DatasetId';
protected $guarded = [];
function instansi() {
return $this->belongsTo('App\Models\Master\Instansi','instansi_id');
}
}

View File

@ -0,0 +1,15 @@
<?php
namespace App\Models\Master;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class Topik extends Model
{
use HasFactory;
protected $table = 'ms_topik';
protected $primaryKey = 'MsTopikId';
protected $guarded = [];
}

View File

@ -0,0 +1,28 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('ms_topik', function (Blueprint $table) {
$table->id('MsTopikId');
$table->string('name');
$table->timestampsTz();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('topiks');
}
};

View File

@ -0,0 +1,41 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('dataset', function (Blueprint $table) {
$table->id('DatasetId');
$table->integer('instansi_id');
$table->integer('template');
$table->string('name');
$table->integer('publik');
$table->json('tags')->nullable();
$table->json('data')->nullable();
$table->string('file')->nullable();
$table->json('topik')->nullable();
$table->text('deskripsi')->nullable();
$table->integer('status')->default(1);
$table->integer('created_by');
$table->timestampsTz();
$table->foreign('instansi_id')->references('MsInstansiId')->on('ms_instansi')->cascadeOnDelete();
$table->foreign('created_by')->references('id')->on('users')->cascadeOnDelete();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('datasets');
}
};

View File

@ -0,0 +1,57 @@
<?php
namespace Database\Seeders;
use Illuminate\Database\Console\Seeds\WithoutModelEvents;
use Illuminate\Database\Seeder;
use App\Models\Master\Topik;
class TopikSeeder extends Seeder
{
/**
* Run the database seeds.
*/
public function run(): void
{
$data = [
['name' => 'Covid 19'],
['name' => 'Keagamaan'],
['name' => 'Kehutanan, Pertanian & Ketahanan Pangan'],
['name' => 'Kelautan, Perikanan & Peternakan'],
['name' => 'Kepegawaian'],
['name' => 'Kependudukan'],
['name' => 'Kesatuan Bangsa & Politik'],
['name' => 'Kesehatan'],
['name' => 'Ketenagakerjaan'],
['name' => 'Ketertiban Umum'],
['name' => 'Keuangan Daerah'],
['name' => 'Komunikasi dan Informasi'],
['name' => 'Lingkungan Hidup'],
['name' => 'Olahraga & Pemuda'],
['name' => 'Pariwisata & Kebudayaan'],
['name' => 'Pekerjaan Umum'],
['name' => 'Pemerintahan'],
['name' => 'Penanaman Modal'],
['name' => 'Penanggulangan Bencana'],
['name' => 'Penataan Kota'],
['name' => 'Pendidikan'],
['name' => 'Perdanganan'],
['name' => 'Perekonomian'],
['name' => 'Perhubungan'],
['name' => 'Perindustrian & Energi'],
['name' => 'Perpustakaan & Arsip'],
['name' => 'Pertamanan & Pemakaman'],
['name' => 'Perumahan dan Kawasan Permukiman'],
['name' => 'Sosial'],
['name' => 'Statistik Sektoral'],
];
foreach($data as $valData){
Topik::updateOrCreate([
'name' => $valData['name'],
],[
'name' => $valData['name'],
]);
}
}
}

View File

@ -1,3 +1,22 @@
.required::after {
content: " *";
color: red;
}
.bg-primary{
background-color: #4d77da!important;
}
.bg-warning{
background-color: #e8bf44!important;
}
.bg-success{
background-color: #2dad62!important;
}
.bg-info{
background-color: #483AA0!important;
}
.bg-info-light{
background-color: #7965C1!important;
}
@font-face {
font-family: 'Poppins';
src: url('../fonts/Poppins-Regular.ttf') format('truetype');

View File

@ -3,9 +3,14 @@
<!-- App Logo -->
<a href="{{url('/')}}">
<div class="logo-light flex gap-3 p-4">
<img src="https://lingkunganhidup.jakarta.go.id/dist/images/logo/logo-dlh-big.png" class="logo-lg h-[22px]" alt="Light logo">
<h6 class="text-white">DIKPLHD</h6>
<div class="flex gap-3 p-4 items-center">
<div>
<img src="https://lingkunganhidup.jakarta.go.id/dist/images/logo/logo-dlh-big.png" class="" alt="Light logo" width="35">
</div>
<div class="flex text-menu flex-col gap-1">
<h6 class="text-white text-lg">DIKPLHD</h6>
<h6 class="text-white text-xs">Dinas Lingkungan Hidup</h6>
</div>
</div>
</a>
@ -42,4 +47,4 @@
</div>
</div>
<!-- Sidenav Menu End -->
<!-- Sidenav Menu End -->

View File

@ -35,11 +35,12 @@
</div>
</div>
<div class="flex flex-row gap-10">
<a class="text-white font-bold" href="">Home</a>
<a class="text-white font-bold" href="">Open Data</a>
<a class="text-white font-bold" href="{{url('/')}}">Home</a>
<a class="text-white font-bold" href="{{url('/search?page=opd')}}">OPD</a>
<a class="text-white font-bold" href="{{url('/search?page=dataset')}}">Dataset</a>
</div>
<div>
<a class="btn bg-white rounded-full pxy-4 border-none" href="">Login&nbsp;<i class="ri-login-box-line"></i></a>
<a class="btn text-white font-bold" href="{{url('login')}}">Login&nbsp;<i class="ri-login-box-line"></i></a>
</div>
</div>
</div>
@ -47,7 +48,7 @@
@yield('content')
<div class="p-12 text-white bg-gradient-to-r from-cyan-500 to-success mix-blend-multiply blur-3xl">
<div class="p-12 text-white" style="background:#333;">
<div class="container">
<div class="flex flex-row justify-between items-center gap-6 mb-5">
<div>
@ -84,7 +85,7 @@
</div>
</div>
</div>
<div class="flex flex-row items-center text-center justify-center p-4 text-white bg-gradient-to-r from-cyan-500 to-success mix-blend-multiply blur-3xl">
<div class="flex flex-row items-center text-center justify-center p-4 text-white" style="background:#333;">
<p>Copyright © {{date('Y')}} Dinas Lingkungan Hidup Provinsi DKI Jakarta. All Right Reserved</p>
</div>

View File

@ -17,7 +17,11 @@
<link rel="stylesheet" href="{{asset('assets/css/custom.css')}}">
<link rel="stylesheet" media="screen, print" href="{{asset('assets/css/datatables/datatables.bundle.css')}}">
<script src="{{asset('assets/js/config.js')}}"></script>
<style>
.menu-text{
font-size:13px!important;
}
</style>
@yield('css')
</head>
@ -116,6 +120,11 @@
<!-- Dashboard App js -->
@yield('js')
<script>
$('#button-toggle-menu').on('click',function(){
$('.text-menu').toggle();
});
</script>
</body>
</html>

View File

@ -43,49 +43,6 @@
@endsection
@section('js')
<script type="text/javascript">
$("#grid-data").on("click", ".forcelogin", function() {
var base_url = $(this).attr('data-href');
var id = $(this).attr('data-id');
swal({
title: "Force Login!",
text: "Apa anda yakin ingin login sebagai akun ini ?",
type: "warning",
showCancelButton: true,
confirmButtonColor: "#3F7D58",
confirmButtonText: "Ya Masuk Sekarang",
cancelButtonText: "Tidak",
closeOnConfirm: true,
closeOnCancel: true
},
function(isConfirm) {
if(isConfirm){
request = $.ajax({
url: base_url,
type: "GET",
});
// Callback handler that will be called on success
request.done(function(response, textStatus, jqXHR){
console.log(response);
toastr.success("Berhasil Login", 'Berhasil!', {positionClass: 'toast-bottom-right', containerId: 'toast-bottom-right'});
window.location.href = '{{url("/dashboard")}}';
history.pushState(null, null, location.href);
window.onpopstate = function () {
history.go(1);
};
});
// Callback handler that will be called on failure
request.fail(function (jqXHR, textStatus, errorThrown){
toastr.error(
"Gagal "+textStatus, errorThrown
);
});
}
});
return false;
});
$("#grid-data").on("click", ".remove_data", function() {
var base_url = $(this).attr('data-href');
var id = $(this).attr('data-id');

View File

@ -0,0 +1,53 @@
@extends('layouts.master')
@section('content')
<div class="flex flex-col gap-6">
<div class="card">
<div class="card-header">
<div class="flex justify-between items-center">
<h4 class="card-title">{{$title}}</h4>
</div>
</div>
<form action="{{route($route.'.store')}}" method="POST" class="">
{{csrf_field()}}
<input type="hidden" name="secure_id" value="{{@$keyId}}">
<div class="p-6">
<div class="grid lg:grid-cols-2 gap-3">
<div class="mb-3">
<label class="mb-3">Nama Topik</label>
<input type="text" value="{{@$item->name ? @$item->name : old('name')}}" name="name" class="form-input @error('name') is-invalid @enderror" placeholder="Masukan Nama Instansi" required>
@error('name')
<span class="invalid-feedback" style="display: block!important;"><strong>{{$message}}</strong></span>
@enderror
</div>
</div>
</div>
<div class="p-6">
<a href="{{route($route.'.index')}}" class="btn bg-danger text-white"><i class="ri-close-line"></i>&nbsp;Batal</a>
<button type="submit" class="btn bg-success text-white"><i class="ri-save-line"></i> Simpan</button>
</div>
</form>
</div>
</div>
@endsection
@section('page-js')
<script type="text/javascript">
$(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

View File

@ -0,0 +1,85 @@
@extends('layouts.master')
@section('css')
@endsection
@section('content')
<div class="flex flex-col gap-6">
<div class="card">
<div class="card-header">
<div class="flex justify-between items-center">
<h4 class="card-title">Data {{$title}}</h4>
</div>
</div>
<div class="p-6">
<div id="toolbar">
<a href="{{route($route.'.create')}}" class="btn bg-success text-white"><i class="ri-add-line"></i>&nbsp;Tambah Data</a>
</div>
<table class="gridjs-table"
data-search="true"
data-toggle="table"
data-pagination="true"
data-toolbar="#toolbar"
data-show-refresh="false"
data-url="{{route($route.'.grid')}}"
data-sort-name="ids"
data-sort-order="desc"
data-page-size="10"
data-id-field="id"
id="grid-data">
<thead class="gridjs-thead">
<tr class="gridjs-tr bg-secondary/10">
<th class="gridjs-td gridjs-th text-sm text-gray-500" data-width="10" data-field="action">#</th>
<th class="gridjs-td gridjs-th text-sm text-gray-500" data-width="10" data-field="no">No</th>
<th class="gridjs-td gridjs-th text-sm text-gray-500" data-field="name">Name</th>
</tr>
</thead>
<tbody class="gridjs-tbody"></tbody>
</table>
</div>
</div>
</div>
@endsection
@section('js')
<script type="text/javascript">
$("#grid-data").on("click", ".remove_data", function() {
var base_url = $(this).attr('data-href');
var id = $(this).attr('data-id');
swal({
title: "Hapus Data!",
text: "Apa anda yakin ingin menghapus data ini ?",
type: "warning",
showCancelButton: true,
confirmButtonColor: "#DD6B55",
confirmButtonText: "Ya Hapus Sekarang",
cancelButtonText: "Tidak",
closeOnConfirm: true,
closeOnCancel: true
},
function(isConfirm) {
if(isConfirm){
request = $.ajax({
url: base_url,
type: "GET",
});
// Callback handler that will be called on success
request.done(function(response, textStatus, jqXHR){
console.log(response);
toastr.success("Berhasil Menhapus Data", 'Berhasil!', {positionClass: 'toast-bottom-right', containerId: 'toast-bottom-right'});
$('#grid-data').bootstrapTable('refresh');
});
// Callback handler that will be called on failure
request.fail(function (jqXHR, textStatus, errorThrown){
toastr.error(
"Gagal "+textStatus, errorThrown
);
});
}
});
return false;
});
</script>
@endsection

View File

@ -0,0 +1,186 @@
@extends('layouts.master')
@section('content')
<div class="flex flex-col gap-6">
<div class="card">
<div class="card-header">
<div class="flex justify-between items-center">
<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="card border rounded mb-5">
<div class="card-header">
<h5 class="font-bold text-md">Informasi Instansi Dataset</h5>
</div>
<div class="card-body p-5">
<div class="grid lg:grid-cols-2 gap-3">
<div class="">
<label class="mb-3 required">Instansi</label>
<select name="instansi_id" required class="form-input instansi_id select2 @error('instansi_id') is-invalid @enderror" id="">
<option value="">-</option>
@foreach($instansi as $dataInstansi)
<option value="{{encode_id($dataInstansi->MsInstansiId)}}">{{$dataInstansi->name}}</option>
@endforeach
</select>
@error('instansi_id')
<span class="invalid-feedback" style="display: block!important;"><strong>{{$message}}</strong></span>
@enderror
</div>
<div class="mb-3">
<label class="mb-3 required">Menggunakan Apakah Template Yang Disediakan ?</label>
<select name="template" class="form-input @error('template') is-invalid @enderror" id="template" required>
<option value="">-</option>
<option value="1">Ya</option>
<option value="0">Tidak</option>
</select>
@error('template')
<span class="invalid-feedback" style="display: block!important;"><strong>{{$message}}</strong></span>
@enderror
</div>
</div>
<a href="#" class="btn bg-success btnDownload hidden text-white btn-md"><i class="ri-download-2-line"></i>&nbsp;Download Template Excel</a>
</div>
</div>
<div class="grid lg:grid-cols-2 gap-3">
<div class="mb-3">
<label class="mb-3 required">Nama Dataset</label>
<input type="text" value="{{@$item->name ? @$item->name : old('name')}}" name="name" class="form-input @error('name') is-invalid @enderror" placeholder="Masukan Nama Dataset" required>
<small><i>*Harap perhatikan nama dataset yang Anda buat. Pastikan tidak ada duplikasi dataset dengan menekan tombol Cek Data.</i></small>
@error('name')
<span class="invalid-feedback" style="display: block!important;"><strong>{{$message}}</strong></span>
@enderror
</div>
<div class="mb-3">
<label class="mb-3 required">Sifat Dataset</label>
<select name="publik" required class="form-input @error('publik') is-invalid @enderror" id="">
<option value="1">Terbuka/Publik</option>
<option value="0">Rahasia/Private</option>
</select>
@error('publik')
<span class="invalid-feedback" style="display: block!important;"><strong>{{$message}}</strong></span>
@enderror
</div>
<div class="mb-3">
<label class="mb-3 required">Tags / Kata Kunci</label>
<div id="tag-container" class="flex flex-wrap gap-2 p-2 form-input rounded bg-white focus-within:ring-2 ring-blue-500">
<input id="tag-input" type="text" value="{{@$item->tags ? @$item->tags : old('tags')}}" name="tags[]" placeholder="Tambah tag..." class="flex-grow border-none p-1 text-sm" />
</div>
<small><i>*Sesuaikan kata kunci dengan dataset Anda</i></small>
@error('tags')
<span class="invalid-feedback" style="display: block!important;"><strong>{{$message}}</strong></span>
@enderror
</div>
<div class="mb-3">
<label class="mb-3 required">Upload File</label>
<input type="file" accept=".xls,.xlsx" value="{{@$item->file ? @$item->file : old('file')}}" name="file" class="form-input @error('file') is-invalid @enderror" placeholder="Masukan File Dataset" required>
<small><i>Masukan Ekstensi File : .xls,.xlsx</i></small>
@error('file')
<span class="invalid-feedback" style="display: block!important;"><strong>{{$message}}</strong></span>
@enderror
</div>
</div>
<div class="mb-3">
<label class="mb-3 required">Topik</label>
<select required name="topik[]" class="form-input select2 @error('topik') is-invalid @enderror" multiple>
@foreach($topik as $dataTopik)
<option value="{{encode_id($dataTopik->MsTopikId)}}">{{$dataTopik->name}}</option>
@endforeach
</select>
@error('topik')
<span class="invalid-feedback" style="display: block!important;"><strong>{{$message}}</strong></span>
@enderror
</div>
<div class="mb-3">
<label class="mb-3 required">Deskripsi Dataset</label>
<textarea name="deskripsi" required class="form-input @error('deskripsi') is-invalid @enderror" id="">{{@$item->deskripsi}}</textarea>
@error('deskripsi')
<span class="invalid-feedback" style="display: block!important;"><strong>{{$message}}</strong></span>
@enderror
</div>
</div>
<div class="p-6">
<a href="{{route($route.'.index')}}" class="btn bg-danger text-white"><i class="ri-close-line"></i>&nbsp;Batal</a>
<button type="submit" class="btn bg-success text-white"><i class="ri-save-line"></i> Simpan</button>
</div>
</form>
</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">&times;</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').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').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

View File

@ -0,0 +1,87 @@
@extends('layouts.master')
@section('css')
@endsection
@section('content')
<div class="flex flex-col gap-6">
<div class="card">
<div class="card-header">
<div class="flex justify-between items-center">
<h4 class="card-title">Data {{$title}}</h4>
</div>
</div>
<div class="p-6">
<div id="toolbar">
<a href="{{route($route.'.update')}}" class="btn bg-success text-white"><i class="ri-add-line"></i>&nbsp;Tambah Data</a>
</div>
<table class="gridjs-table"
data-search="true"
data-toggle="table"
data-pagination="true"
data-toolbar="#toolbar"
data-show-refresh="false"
data-url="{{route($route.'.grid')}}"
data-sort-name="ids"
data-sort-order="desc"
data-page-size="10"
data-id-field="id"
id="grid-data">
<thead class="gridjs-thead">
<tr class="gridjs-tr bg-secondary/10">
<th class="gridjs-td gridjs-th text-sm text-gray-500" data-width="10" data-field="action">#</th>
<th class="gridjs-td gridjs-th text-sm text-gray-500" data-width="10" data-field="no">No</th>
<th class="gridjs-td gridjs-th text-sm text-gray-500" data-field="instansi">Nama Instansi</th>
<th class="gridjs-td gridjs-th text-sm text-gray-500" data-field="name">Nama Dataset</th>
<th class="gridjs-td gridjs-th text-sm text-gray-500" data-field="created_at">Tanggal Dibuat</th>
</tr>
</thead>
<tbody class="gridjs-tbody"></tbody>
</table>
</div>
</div>
</div>
@endsection
@section('js')
<script type="text/javascript">
$("#grid-data").on("click", ".remove_data", function() {
var base_url = $(this).attr('data-href');
var id = $(this).attr('data-id');
swal({
title: "Hapus Data!",
text: "Apa anda yakin ingin menghapus data ini ?",
type: "warning",
showCancelButton: true,
confirmButtonColor: "#DD6B55",
confirmButtonText: "Ya Hapus Sekarang",
cancelButtonText: "Tidak",
closeOnConfirm: true,
closeOnCancel: true
},
function(isConfirm) {
if(isConfirm){
request = $.ajax({
url: base_url,
type: "GET",
});
// Callback handler that will be called on success
request.done(function(response, textStatus, jqXHR){
console.log(response);
toastr.success("Berhasil Menhapus Data", 'Berhasil!', {positionClass: 'toast-bottom-right', containerId: 'toast-bottom-right'});
$('#grid-data').bootstrapTable('refresh');
});
// Callback handler that will be called on failure
request.fail(function (jqXHR, textStatus, errorThrown){
toastr.error(
"Gagal "+textStatus, errorThrown
);
});
}
});
return false;
});
</script>
@endsection

View File

@ -0,0 +1,132 @@
@extends('layouts.app')
@section('content')
<div class="bg-gradient-to-r from-cyan-500 to-success mix-blend-multiply blur-3xl p-10">
<div class="container">
<div class="flex flex-row gap-3 mb-5">
<a href="" class="text-white uppercase">Beranda&nbsp;<i class="ri-arrow-right-line"></i></a>
<a href="" class="text-white uppercase">Open Data {{request()->page}}&nbsp;</a>
</div>
<div class="flex flex-col justify-center">
<div class="py-3">
<h1 class="text-white bold text-4xl uppercase">Open Data {{request()->page}}</h1>
</div>
</div>
</div>
</div>
<div class="card">
<div class="container p-5 py-10">
<div class="flex flex-row justify-between items-center mb-5">
<div class="bold text-xl text-sky-700">4.000 Data</div>
<div class="">
<input type="text" class="form-input text-sm" placeholder="Data apa yang kamu cari....?">
</div>
</div>
<div class="flex flex-row gap-3">
<div class="card border p-3 w-1/4">
<div class="flex flex-col gap-3">
<div><h5 class="font-bold text-md">Filter</h5></div>
<hr>
<div><input {{request()->page == 'opd' ? 'checked' : ''}} class="form-checkbox" type="checkbox">&nbsp;OPD</div>
<div><input {{request()->page == 'dataset' ? 'checked' : ''}} class="form-checkbox" type="checkbox">&nbsp;Dataset</div>
<div class="mt-3"><h5 class="font-bold text-md">Status</h5></div>
<hr>
<div><input class="form-checkbox" type="checkbox">&nbsp;Publik</div>
<div><input class="form-checkbox" type="checkbox">&nbsp;Terbatas</div>
<hr>
<div>
<button class="btn btn-sm bg-teal-500 w-full text-white">Cari Data</button>
</div>
</div>
</div>
<divc class="w-full">
<div class="grid grid-cols-1 gap-3">
<div class="card p-6 border w-full">
<div class="flex flex-row items-center gap-6">
<div>
<img src="https://lingkunganhidup.jakarta.go.id/dist/images/logo/logo-dlh-big.png" width="80" alt="">
</div>
<div class="flex flex-col gap-3">
<a href="">
<h4 class="bold text-md text-sky-700">Data Harga dan Pasokan Pangan Jakarta</h4>
</a>
<div class="w-3/4">
<p>
Lorem ipsum dolor sit amet consectetur, adipisicing elit. Obcaecati consequatur similique sapiente quod eum aperiam,
</p>
</div>
<div class="flex flex-row gap-3">
<h4 class="text-xs rounded bg-primary text-white p-1">Dinas Lingkungan Hidup Provinsi DKI</h4>
<span class="bg-danger rounded text-white p-1 text-xs"><i class="ri-calendar-line"></i>&nbsp;11-09-2025</span>
</div>
</div>
</div>
</div>
<div class="card p-6 border w-full">
<div class="flex flex-row items-center gap-6">
<div>
<img src="https://lingkunganhidup.jakarta.go.id/dist/images/logo/logo-dlh-big.png" width="80" alt="">
</div>
<div class="flex flex-col gap-3">
<h4 class="bold text-md text-sky-700">Data Harga dan Pasokan Pangan Jakarta</h4>
<div class="w-3/4">
<p>
Lorem ipsum dolor sit amet consectetur, adipisicing elit. Obcaecati consequatur similique sapiente quod eum aperiam,
</p>
</div>
<div class="flex flex-row gap-3">
<h4 class="text-xs rounded bg-primary text-white p-1">Dinas Lingkungan Hidup Provinsi DKI</h4>
<span class="bg-danger rounded text-white p-1 text-xs"><i class="ri-calendar-line"></i>&nbsp;11-09-2025</span>
</div>
</div>
</div>
</div>
<div class="card p-6 border w-full">
<div class="flex flex-row items-center gap-6">
<div>
<img src="https://lingkunganhidup.jakarta.go.id/dist/images/logo/logo-dlh-big.png" width="80" alt="">
</div>
<div class="flex flex-col gap-3">
<h4 class="bold text-md text-sky-700">Data Harga dan Pasokan Pangan Jakarta</h4>
<div class="w-3/4">
<p>
Lorem ipsum dolor sit amet consectetur, adipisicing elit. Obcaecati consequatur similique sapiente quod eum aperiam,
</p>
</div>
<div class="flex flex-row gap-3">
<h4 class="text-xs rounded bg-primary text-white p-1">Dinas Lingkungan Hidup Provinsi DKI</h4>
<span class="bg-danger rounded text-white p-1 text-xs"><i class="ri-calendar-line"></i>&nbsp;11-09-2025</span>
</div>
</div>
</div>
</div>
<div class="card p-6 border w-full">
<div class="flex flex-row items-center gap-6">
<div>
<img src="https://lingkunganhidup.jakarta.go.id/dist/images/logo/logo-dlh-big.png" width="80" alt="">
</div>
<div class="flex flex-col gap-3">
<h4 class="bold text-md text-sky-700">Data Harga dan Pasokan Pangan Jakarta</h4>
<div class="w-3/4">
<p>
Lorem ipsum dolor sit amet consectetur, adipisicing elit. Obcaecati consequatur similique sapiente quod eum aperiam,
</p>
</div>
<div class="flex flex-row gap-3">
<h4 class="text-xs rounded bg-primary text-white p-1">Dinas Lingkungan Hidup Provinsi DKI</h4>
<span class="bg-danger rounded text-white p-1 text-xs"><i class="ri-calendar-line"></i>&nbsp;11-09-2025</span>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
@endsection

View File

@ -7,10 +7,18 @@ use App\Http\Controllers\Master\InstansiController;
use App\Http\Controllers\Management\UserController;
use App\Http\Controllers\Management\RoleController;
use App\Http\Controllers\Management\AksesController;
use App\Http\Controllers\Opendata\DatasetController;
Route::get('dashboard',[HomeController::class,'dashboard'])->name('dashboard');
Route::name('opendata.')->prefix('opendata')->group(function () {
Route::name('dataset.')->prefix('dataset')->group(function () {
Route::resource('/',DatasetController::class);
Route::get('grid',[DatasetController::class,'grid'])->name('grid');
Route::get('update/{id?}',[DatasetController::class,'update'])->name('update');
});
});
Route::name('master.')->prefix('master')->group(function () {
Route::name('instansi.')->prefix('instansi')->group(function () {

View File

@ -17,7 +17,8 @@ use App\Http\Controllers\Auth\CustomRegisterController;
|
*/
Route::get('/', [FrontController::class,'index'])->name('inde');
Route::get('/', [FrontController::class,'index'])->name('index');
Route::get('/search', [FrontController::class,'search'])->name('search');
Route::get('/login', [CustomLoginController::class,'index'])->name('login');
Route::post('login',[CustomLoginController::class,'post_login'])->name('post_login');
Route::get('register',[CustomRegisterController::class,'index'])->name('register');