main
Ilham Wara Nugroho 2026-02-11 16:14:02 +07:00
parent 63753083bb
commit 27858b277d
14 changed files with 805 additions and 60 deletions

View File

@ -0,0 +1,131 @@
<?php
namespace App\Http\Controllers\Master;
use App\Http\Controllers\Controller;
use Illuminate\Http\Request;
use App\Models\Master\TabelData;
use App\Models\Master\TabelDataKolom;
class TabelDataController extends Controller
{
protected $title = 'Tabel Data';
protected $template = 'modules.master.tabel-data';
protected $route = 'modules.master.tabel-data';
/**
* 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' => 'Tabel Data','active' => true],
];
$data['title'] = $this->title;
$data['route'] = $this->route;
return view($this->template.'.index',$data);
}
public function grid(Request $request)
{
$data = TabelData::orderBy('MsTabelDataId','ASC')->get();
// $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/tabel-data/update/'.encode_id($row->MsTabelDataId)).'" data-toggle="tooltip" title="Edit Data" class="btn btn-sm btn-block bg-primary"><i class="ri-pencil-line text-white"></i></a>';
$action .= '<a href="'.url('master/tabel-data/kolom/'.encode_id($row->MsTabelDataId)).'" data-toggle="tooltip" title="View Data" class="btn btn-sm btn-block text-white bg-success"><i class="ri-eye-line text-white"></i></a>';
if((session('group_id') == 1) || (session('group_alias') == 'admin')){
// $action .= '<a href="#" data-href="'.url('master/table-data/delete/'.encode_id($row->MsTabelDataId)).'" 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->MsTabelDataId),
'name' => @$row->name,
'key' => @$row->key,
'tahun' => @$row->tahun,
'nomor_tabel' => @$row->nomor_tabel,
'jml_kolom' => TabelDataKolom::where('ms_tabel_data_id',$row->MsTabelDataId)->count(),
'action' => @$action,
];
}
// return response()->json($_data); // Return the data as a JSON response
return response()->json($_data);
}
public function update($id = null)
{
$data['breadcrumbs'] = [
['name' => 'Dashboard','url' => url('dashboard')],
['name' => 'Master Data'],
['name' => 'Tabel Data','active' => true],
];
$keyId = decode_id($id);
$data['title'] = $this->title;
$data['route'] = $this->route;
$data['keyId'] = $id;
// $data['item'] = TabelData::where('MsTabelDataId',$keyId)->first();
return view($this->template.'.form',$data);
}
/**
* Show the form for creating a new resource.
*/
public function create()
{
//
}
/**
* Store a newly created resource in storage.
*/
public function store(Request $request)
{
//
}
/**
* Display the specified resource.
*/
public function show(string $id)
{
//
}
/**
* Show the form for editing the specified resource.
*/
public function edit(string $id)
{
//
}
/**
* Remove the specified resource from storage.
*/
public function destroy(string $id)
{
//
}
}

View File

@ -0,0 +1,148 @@
<?php
namespace App\Http\Controllers\Master;
use App\Http\Controllers\Controller;
use Illuminate\Http\Request;
use App\Models\Master\TabelDataKolom;
class TabelDataKolomController extends Controller
{
protected $title = 'Tabel Data Kolom';
protected $template = 'modules.master.tabel-data.kolom';
protected $route = 'modules.master.tabel-data.kolom';
/**
* Display a listing of the resource.
*/
public function index($id = null)
{
permission('is_read', $this->route, 'module',true);
$data['breadcrumbs'] = [
['name' => 'Dashboard','url' => url('dashboard')],
['name' => 'Master Data'],
['name' => 'Tabel Data'],
['name' => 'Tabel Data Kolom','active' => true],
];
$data['title'] = $this->title;
$data['route'] = $this->route;
$data['keyId'] = $id;
return view($this->template.'.index',$data);
}
public function grid(Request $request,$id = null)
{
$data = TabelDataKolom::where('ms_tabel_data_id',decode_id($id))->orderBy('order','ASC')->get();
// $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/tabel-data/kolom/'.encode_id($row->ms_tabel_data_id).'/update/'.encode_id($row->MsTabelDataKolomId).'').'" 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) || (session('group_alias') == 'admin')){
// $action .= '<a href="#" data-href="'.url('master/table-data/delete/'.encode_id($row->MsTabelDataKolomId)).'" 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->MsTabelDataKolomId),
'name' => @$row->name,
'key' => @$row->key,
'order' => @$row->order,
'action' => @$action,
];
}
// return response()->json($_data); // Return the data as a JSON response
return response()->json($_data);
}
public function update($id = null,$kolomId = null)
{
$data['breadcrumbs'] = [
['name' => 'Dashboard','url' => url('dashboard')],
['name' => 'Master Data'],
['name' => 'Tabel Data','active' => true],
];
$keyId = decode_id($kolomId);
$data['title'] = $this->title;
$data['route'] = $this->route;
$data['keyId'] = $kolomId;
$data['tabelId'] = $id;
$data['item'] = TabelDataKolom::where('MsTabelDataKolomId',$keyId)->first();
return view($this->template.'.form',$data);
}
/**
* Show the form for creating a new resource.
*/
public function create()
{
//
}
/**
* Store a newly created resource in storage.
*/
public function store(Request $request)
{
if(@$request->secure_id){
$item = TabelDataKolom::find(decode_id($request->secure_id));
$item->name = $request->name;
$item->key = $request->key;
$item->order = $request->order;
$item->save();
}else{
$item = new TabelDataKolom;
$item->ms_tabel_data_id = decode_id($request->tabelId);
$item->name = $request->name;
$item->key = $request->key;
$item->order = $request->order;
$item->save();
}
return redirect()->back()->with([
'message' => 'Berhasil update data',
'type' => 'success',
]);
}
/**
* Display the specified resource.
*/
public function show(string $id)
{
//
}
/**
* Show the form for editing the specified resource.
*/
public function edit(string $id)
{
//
}
/**
* Remove the specified resource from storage.
*/
public function destroy(string $id)
{
//
}
}

View File

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

View File

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

View File

@ -0,0 +1,32 @@
<?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_tabel_data', function (Blueprint $table) {
$table->id('MsTabelDataId');
$table->string('nomor_tabel')->nullable();
$table->year('tahun');
$table->string('name');
$table->string('key')->nullable();
$table->timestampsTz();
$table->softdeletesTz();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('ms_table_data');
}
};

View File

@ -0,0 +1,35 @@
<?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_tabel_data_kolom', function (Blueprint $table) {
$table->id('MsTabelDataKolomId');
$table->integer('ms_tabel_data_id');
$table->string('name')->nullable();
$table->string('key')->nullable();
$table->string('order')->nullable();
$table->integer('status')->default(1);
$table->timestampsTz();
$table->softdeletesTz();
$table->foreign('ms_tabel_data_id')->references('MsTabelDataId')->on('ms_tabel_data')->cascadeOnDelete();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('table_data_koloms');
}
};

View File

@ -3,7 +3,7 @@
<head>
<meta charset="utf-8">
<title>Login | DIKPLHD</title>
<title>Login | SLHD</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta content="Dinas Lingkungan Hidup Provinsi DKI Jakarta" name="description">
<meta content="coderthemes" name="author">
@ -36,8 +36,9 @@
</a>
</div>
<div class="mb-5">
<h3 style="font-size: 20px;" class="mt-1 text-center"><b>DIKPLHD</b></h3>
<h3 class="mt-1 text-center">Dinas Lingkungan Hidup Provinsi DKI Jakarta</h3>
<h3 style="font-size: 20px;" class="mt-1 text-center"><b>SLHD</b></h3>
<h3 class="mt-1 text-center">Status Lingkungan Hidup Daerah</h3>
{{-- <h3 class="mt-1 text-center">Dinas Lingkungan Hidup Provinsi DKI Jakarta</h3> --}}
</div>
<div class="my-auto">
<!-- title-->

View File

@ -3,7 +3,7 @@
<head>
<meta charset="utf-8">
<title>DIKPLHD | Dinas Lingkungan Hidup</title>
<title>SLHD | Dinas Lingkungan Hidup</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="apple-touch-icon" sizes="180x180" href="{{asset('assets/logo-dinas.ico')}}">
@ -148,7 +148,7 @@
<a href="{{ url('/') }}" class="flex items-center gap-3">
<img src="{{ asset('assets/logo-dlh.png') }}" class="w-12 h-12 rounded-full bg-white p-1" alt="logo">
<div>
<h1 class="text-accent poppins-bold font-bold text-lg active">DIKPLHD</h1>
<h1 class="text-accent poppins-bold font-bold text-lg active">SLHD</h1>
<p class="text-white text-sm">Dinas Lingkungan Hidup Provinsi DKI Jakarta</p>
</div>
</a>

View File

@ -1,65 +1,93 @@
@extends('layouts.master')
@section('css')
<link rel="stylesheet" href="https://unpkg.com/leaflet@1.9.4/dist/leaflet.css"
integrity="sha256-p4NxAoJBhIIN+hmNHrzRCf9tD/miZyoHS5obTRR9BMY="
crossorigin=""/>
@endsection
@section('content')
<!-- Page Title Start -->
<div class="flex justify-between items-center mb-6">
<h4 class="text-slate-900 dark:text-slate-200 text-lg font-medium">Dashboard</h4>
</div>
<!-- Page Title End -->
@if((session('group_id') == 1) || (session('group_alias') == 'admin'))
<div class="grid xl:grid-cols-4 lg:grid-cols-2 grid-cols-1 gap-6 mb-6">
@foreach($group as $dataGroup)
<?php
$bg = '';
// if(@$dataGroup->alias == 'dinas'){
$bg = 'success';
// }elseif(@$dataGroup->alias == 'biro'){
// $bg = 'warning';
// }elseif(@$dataGroup->alias == 'badan'){
// $bg = 'danger';
// }elseif(@$dataGroup->alias == 'deputi'){
// $bg = 'info';
// }
?>
<div class="card border-top-{{$bg}} hidden">
<div class="p-6">
<div class="flex flex-col items-center">
<div class="w-full">
{{-- <div class="flex justify-between">
<div class="p-1 bg-primary text-white rounded text-xs">{{date('Y')}}</div>
</div> --}}
<div class="flex items-center justify-between">
<div class="px-4 py-3 rounded-full bg-{{$bg}}-light">
<i class="ri-database-2-line text-lg text-{{$bg}}"></i>
</div>
<div>
<?php
$count = $classDataset::where('tahun',date('Y'))->whereHas('instansi',function($query) use ($dataGroup){
$query->where('parent','ilike','%'.$dataGroup->alias.'%');
})->count();
?>
<h2 class="text-3xl bold my-3 py-0.5">{{$count}}</h2>
</div>
</div>
{{-- <div class="flex justify-between items-center mb-6"> --}}
{{-- <h4 class="text-slate-900 dark:text-slate-200 text-lg font-medium">Dashboard</h4> --}}
{{-- </div> --}}
<div class="mb-3 hidden">
<div class="card">
<div class="card-header flex justify-between items-center">
<h4 class="bold">Profile Wilayah</h4>
<div>
<select name="" id="" class="form-input">
<option value="">Data Penduduk</option>
<option value="">Data Timbulan Sampah</option>
</select>
</div>
</div>
<div class="">
<div class="grid lg:grid-cols-2 grid-cols-1">
<div class="flex p-6">
<div class="rounded" id="map" style="width: 600px; height: 400px;"></div>
</div>
<div class="w-full">
<div class="">
<div class="mb-2"><h5 class="uppercase text-sm font-bold mt-0 truncate">Data {{$dataGroup->name}}</h5></div>
<a href="{{url('dashboard/dataset/'.$dataGroup->alias)}}" class="text-{{ $bg }} text-xs">Lihat Selengkapnya&nbsp;<i class="ri-arrow-right-line"></i></a>
<div class="flex justify-center items-center p-6">
Data
</div>
</div>
</div>
</div>
</div>
<div class="flex hidden gap-3">
<div class="w-full">
<div class="card">
<div class="card-header flex justify-between items-center">
<h4 class="bold">
Persebaran Data -
@if(@request()->key)
{{ str_replace('_',' ',ucwords(@request()->key)) }}
@else
Tata Guna Lahan
@endif
</h4>
<div>
<select name="" id="" class="form-input kategori">
<option {{ @request()->key == '' ? 'selected' : '' }} {{ @request()->key == 'tata_guna_lahan' ? 'selected' : '' }} value="tata_guna_lahan">Tata Guna Lahan </option>
<option {{ @request()->key == 'kualitas_air' ? 'selected' : '' }} value="kualitas_air">Kualitas Air</option>
<option {{ @request()->key == 'kualitas_udara' ? 'selected' : '' }} value="kualitas_udara">Kualitas Udara</option>
<option {{ @request()->key == 'perkotaan' ? 'selected' : '' }} value="perkotaan">Perkotaan</option>
<option {{ @request()->key == 'kebencanaan' ? 'selected' : '' }} value="kebencanaan">Kebencanaan</option>
<option {{ @request()->key == 'tata_kelola' ? 'selected' : '' }} value="tata_kelola">Tata Kelola</option>
</select>
</div>
</div>
<div class="p-6">
<div class="grid grid-cols-1 lg:grid-cols-2 gap-3">
<div class="card">
<div class="card-header bg-primary-light text-primary bold">Driving Force</div>
<div class="p-6"><p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Provident tenetur repudiandae labore reprehenderit, ipsam consequatur odio molestiae quidem ratione atque dignissimos omnis nam voluptate iste at, cumque ipsum voluptas aperiam!</p></div>
</div>
<div class="card">
<div class="card-header bg-primary-light text-primary bold">Pressures</div>
<div class="p-6"><p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Provident tenetur repudiandae labore reprehenderit, ipsam consequatur odio molestiae quidem ratione atque dignissimos omnis nam voluptate iste at, cumque ipsum voluptas aperiam!</p></div>
</div>
<div class="card">
<div class="card-header bg-primary-light text-primary bold">State</div>
<div class="p-6"><p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Provident tenetur repudiandae labore reprehenderit, ipsam consequatur odio molestiae quidem ratione atque dignissimos omnis nam voluptate iste at, cumque ipsum voluptas aperiam!</p></div>
</div>
<div class="card">
<div class="card-header bg-primary-light text-primary bold">Impact</div>
<div class="p-6"><p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Provident tenetur repudiandae labore reprehenderit, ipsam consequatur odio molestiae quidem ratione atque dignissimos omnis nam voluptate iste at, cumque ipsum voluptas aperiam!</p></div>
</div>
</div>
</div> <!-- end row-->
</div> <!-- end p-6 -->
</div> <!-- end card -->
@endforeach
<div class="grid grid-cols-1 lg:grid-cols-1 gap-3 mt-3">
<div class="card">
<div class="card-header bg-primary-light text-primary bold">Response</div>
<div class="p-6"><p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Provident tenetur repudiandae labore reprehenderit, ipsam consequatur odio molestiae quidem ratione atque dignissimos omnis nam voluptate iste at, cumque ipsum voluptas aperiam!</p></div>
</div>
</div>
</div>
</div>
</div>
</div>
@endif
<div class="grid xl:grid-cols-2 lg:grid-cols-2 grid-cols-1 gap-6 mb-6">
<div class="grid xl:grid-cols-2 lg:grid-cols-2 grid-cols-1 gap-6 mb-6 hidden">
<div class="card">
<div class="p-6">
<div class="flex items-center justify-center">
@ -84,7 +112,7 @@
</div>
</div>
<div class="grid xl:grid-cols-2 lg:grid-cols-2 grid-cols-1 gap-6 mb-6">
<div class="grid xl:grid-cols-2 lg:grid-cols-2 grid-cols-1 gap-6 mb-6 hidden">
<div class="card">
<div class="p-6">
<div class="flex items-center justify-center">
@ -112,8 +140,26 @@
<!-- end row -->
@endsection
@section('js')
<script src="https://unpkg.com/leaflet@1.9.4/dist/leaflet.js"
integrity="sha256-20nQCchB9co0qIjJZRGuk2/Z9VM+kNiyxNV1lvTlZBo="
crossorigin=""></script>
<script>
var map = L.map('map').setView([51.505, -0.09], 13);
L.tileLayer('https://tile.openstreetmap.org/{z}/{x}/{y}.png', {
attribution: '&copy; <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors'
}).addTo(map);
L.marker([51.5, -0.09]).addTo(map)
.bindPopup('A pretty CSS popup.<br> Easily customizable.')
.openPopup();
</script>
<script src="{{asset('assets/libs/apexcharts/apexcharts.min.js')}}"></script>
<script>
$('.kategori').on('change',function(){
var val = $(this).val();
window.location = "{{ url('dashboard?key=') }}"+val;
});
var base_url = '{{ url("/") }}';
var tahun = '{{ date("Y")-1 }}';

View File

@ -0,0 +1,61 @@
@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="grid lg:grid-cols-2 gap-3">
<div class="mb-3">
<label class="mb-3">Nama Tabel</label>
<input type="text" value="{{@$item->name ? @$item->name : old('name')}}" name="name" class="form-input @error('name') is-invalid @enderror" placeholder="Masukan Nama Tabel" required>
@error('name')
<span class="invalid-feedback" style="display: block!important;"><strong>{{$message}}</strong></span>
@enderror
</div>
<div class="mb-3">
<label class="mb-3">Key</label>
<input type="text" value="{{@$item->key ? @$item->key : old('key')}}" name="key" class="form-input @error('key') is-invalid @enderror" placeholder="Masukan Key Tabel">
@error('key')
<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,88 @@
@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-primary-light">
<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="tahun">Tahun</th>
<th class="gridjs-td gridjs-th text-sm text-gray-500 text-center" data-field="name">Name</th>
<th class="gridjs-td gridjs-th text-sm text-gray-500" data-field="nomor_tabel">Nomor Tabel</th>
<th class="gridjs-td gridjs-th text-sm text-gray-500 text-center" data-field="jml_kolom">Jumlah Kolom</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,69 @@
@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}}">
<input type="hidden" name="tabelId" value="{{@$tabelId}}">
<div class="p-6">
<div class="grid lg:grid-cols-2 gap-3">
<div class="mb-3">
<label class="mb-3">Nama Kolom</label>
<input type="text" value="{{@$item->name ? @$item->name : old('name')}}" name="name" class="form-input @error('name') is-invalid @enderror" placeholder="Masukan Nama Kolom" required>
@error('name')
<span class="invalid-feedback" style="display: block!important;"><strong>{{$message}}</strong></span>
@enderror
</div>
<div class="mb-3">
<label class="mb-3">Key</label>
<input type="text" value="{{@$item->key ? @$item->key : old('key')}}" name="key" class="form-input @error('key') is-invalid @enderror" placeholder="Masukan Key Tabel">
@error('key')
<span class="invalid-feedback" style="display: block!important;"><strong>{{$message}}</strong></span>
@enderror
</div>
<div class="mb-3">
<label class="mb-3">Order</label>
<input type="text" value="{{@$item->order ? @$item->order : old('order')}}" name="order" class="form-input @error('order') is-invalid @enderror" placeholder="Masukan Order Kolom">
@error('order')
<span class="invalid-feedback" style="display: block!important;"><strong>{{$message}}</strong></span>
@enderror
</div>
</div>
</div>
<div class="p-6">
<a href="{{url('master/tabel-data/kolom/'.@$tabelId.'/')}}" 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,88 @@
@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="{{url('master/tabel-data/')}}" class="btn bg-primary text-white"><i class="ri-arrow-left-line"></i>&nbsp;Lihat Daftar Tabel</a>
<a href="{{url('master/tabel-data/kolom/'.@$keyId.'/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="{{url('master/tabel-data/kolom/'.@$keyId.'/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-primary-light">
<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>
<th class="gridjs-td gridjs-th text-sm text-gray-500 text-center" data-field="order">Order</th>
<th class="gridjs-td gridjs-th text-sm text-gray-500 text-center" data-field="key">Key</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

@ -6,6 +6,8 @@ use App\Http\Controllers\HomeController;
use App\Http\Controllers\Master\InstansiController;
use App\Http\Controllers\Master\ResourceController;
use App\Http\Controllers\Master\TopikController;
use App\Http\Controllers\Master\TabelDataController;
use App\Http\Controllers\Master\TabelDataKolomController;
use App\Http\Controllers\Management\UserController;
use App\Http\Controllers\Management\RoleController;
use App\Http\Controllers\Management\AksesController;
@ -53,6 +55,20 @@ Route::name('opendata.')->prefix('opendata')->group(function () {
Route::name('master.')->prefix('master')->group(function () {
Route::name('tabel-data.')->prefix('tabel-data')->group(function () {
Route::resource('/',TabelDataController::class);
Route::get('grid',[TabelDataController::class,'grid'])->name('grid');
Route::get('update/{id?}',[TabelDataController::class,'update'])->name('update');
Route::name('kolom.')->prefix('kolom/{id?}')->group(function () {
Route::resource('/',TabelDataKolomController::class);
Route::get('/grid',[TabelDataKolomController::class,'grid'])->name('grid');
Route::get('/update/{kolomId?}',[TabelDataKolomController::class,'update'])->name('update');
});
});
Route::name('resource.')->prefix('resource')->group(function () {
Route::resource('/',ResourceController::class);
Route::get('grid',[ResourceController::class,'grid'])->name('grid');