update
parent
2558f6cbb6
commit
4863119117
|
|
@ -92,9 +92,9 @@ class DatasetController extends Controller
|
|||
public function grid(Request $request)
|
||||
{
|
||||
if((session('group_id') == 1) || (session('group_alias') == 'admin')){
|
||||
$data = Dataset::with(['tabelData'])->orderBy('DatasetId','DESC')->get();
|
||||
$data = Dataset::with(['tabelData'])->where('status',1)->orderBy('DatasetId','DESC')->get();
|
||||
}else{
|
||||
$data = Dataset::with(['tabelData'])->orderBy('DatasetId','DESC')->whereIn('instansi_id',[auth()->user()->ms_instansi_id])->get();
|
||||
$data = Dataset::with(['tabelData'])->where('status',1)->orderBy('DatasetId','DESC')->whereIn('instansi_id',[auth()->user()->ms_instansi_id])->get();
|
||||
}
|
||||
// $data = User::with(['group'])->orderBy('id','DESC')->get();
|
||||
$_data = [];
|
||||
|
|
@ -116,7 +116,7 @@ class DatasetController extends Controller
|
|||
if($row->status == 1){
|
||||
$action .= '<a href="#" data-href="'.url('opendata/dataset/delete/'.encode_id($row->DatasetId)).'" title="Hapus Data" class="remove_data p-2 w-full rounded bg-red-600 text-white">Hapus</a>';
|
||||
}else{
|
||||
$action .= '<a href="#" data-href="'.url('opendata/dataset/aktif/'.encode_id($row->DatasetId)).'" title="Aktifkan Data" class="aktif_data p-2 w-full rounded bg-emerald-600"><i data-lucide="check" class="text-white w-4 h-4 mr-2"></i></a>';
|
||||
$action .= '<a href="#" data-href="'.url('opendata/dataset/aktif/'.encode_id($row->DatasetId)).'" title="Aktifkan Data" class="aktif_data p-2 w-full rounded bg-emerald-600 text-white">Restore Data</a>';
|
||||
}
|
||||
}
|
||||
$action .= '</div>';
|
||||
|
|
|
|||
|
|
@ -14,6 +14,8 @@
|
|||
<link rel="stylesheet" media="screen, print" href="{{asset('assets/css/datatables/datatables.bundle.css')}}">
|
||||
<link rel="stylesheet" href="{{asset('assets/css/sweetalert.min.css')}}">
|
||||
<link rel="stylesheet" href="{{asset('assets/css/toast.min.css')}}">
|
||||
<link rel="stylesheet" href="{{asset('assets/css/select2/select2.bundle.css')}}">
|
||||
@yield('css')
|
||||
<style>
|
||||
body { font-family: 'Plus Jakarta Sans', sans-serif; }
|
||||
|
||||
|
|
@ -202,10 +204,17 @@
|
|||
<script src="{{asset('assets/js/bootstrap-table.min.js')}}"></script>
|
||||
<script src="{{ asset('assets/js/sweetalert.min.js') }}"></script>
|
||||
<script src="{{asset('assets/js/toast.min.js')}}"></script>
|
||||
<script src="{{asset('assets/js/select2/select2.bundle.js')}}"></script>
|
||||
@yield('js')
|
||||
<script>
|
||||
$(document).ready(function() {
|
||||
lucide.createIcons();
|
||||
|
||||
$('.select2').select2();
|
||||
$('.numberInput').on('input', function() {
|
||||
this.value = this.value.replace(/[^0-9]/g, ''); // Hanya angka 0-9
|
||||
});
|
||||
|
||||
// 1. Sidebar Collapse Logic
|
||||
$('#toggle-sidebar').click(function() {
|
||||
const sidebar = $('#sidebar');
|
||||
|
|
|
|||
|
|
@ -3,46 +3,55 @@
|
|||
@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 class="flex-1 overflow-y-auto p-8 custom-scrollbar">
|
||||
<div class="bg-white rounded-3xl border border-slate-200 shadow-sm overflow-hidden">
|
||||
<div class="p-6 border-b border-slate-100 flex flex-col md:flex-row md:items-center justify-between gap-4">
|
||||
<div>
|
||||
<h3 class="text-lg font-bold text-slate-900">{{$title}}</h3>
|
||||
{{-- <p class="text-xs text-slate-500 font-medium">Pengelolaan data masuk dari berbagai stasiun pemantauan.</p> --}}
|
||||
</div>
|
||||
<div class="flex items-center space-x-2">
|
||||
@if(permission('is_create', $route.'.*','module',false) || permission('is_update', $route.'.*','module',false))
|
||||
<a href="{{route($route.'.update')}}" class="p-2 border border-slate-200 rounded-xl hover:bg-slate-50 transition-colors flex items-center text-sm font-semibold text-slate-600">
|
||||
<i data-lucide="plus" class="w-4 h-4 mr-2"></i> Tambah Data
|
||||
</a>
|
||||
@endif
|
||||
<button class="hidden p-2 bg-slate-900 text-white rounded-xl hover:bg-slate-800 transition-colors flex items-center text-sm font-semibold">
|
||||
<i data-lucide="filter" class="w-4 h-4 mr-2"></i> Filter
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="overflow-x-auto">
|
||||
<table class="w-full text-left border-collapse"
|
||||
data-search="false"
|
||||
data-toggle="table"
|
||||
data-pagination="false"
|
||||
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="bg-slate-50/50 border-b border-slate-100">
|
||||
<tr class="">
|
||||
<th class="px-6 py-4 text-[10px] font-bold text-slate-400 uppercase tracking-widest" data-width="10" data-field="action">#</th>
|
||||
<th class="px-6 py-4 text-[10px] font-bold text-slate-400 uppercase tracking-widest" data-width="10" data-field="no">No</th>
|
||||
<th class="px-6 py-4 text-[10px] font-bold text-slate-400 uppercase tracking-widest" data-field="instansi">Nama Instansi</th>
|
||||
<th class="px-6 py-4 text-[10px] font-bold text-slate-400 uppercase tracking-widest" data-field="name">Nama Dataset</th>
|
||||
<th class="px-6 py-4 text-[10px] font-bold text-slate-400 uppercase tracking-widest" data-field="template">Resource Data</th>
|
||||
<th class="px-6 py-4 text-[10px] font-bold text-slate-400 uppercase tracking-widest" data-field="tahun">Tahun</th>
|
||||
<th class="px-6 py-4 text-[10px] font-bold text-slate-400 uppercase tracking-widest" data-field="status">Status</th>
|
||||
<th class="px-6 py-4 text-[10px] font-bold text-slate-400 uppercase tracking-widest" data-field="created_at">Tanggal Dibuat</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody class=""></tbody>
|
||||
</table>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="p-6">
|
||||
<div id="toolbar">
|
||||
@if(permission('is_create', $route.'.*','module',false) || permission('is_update', $route.'.*','module',false))
|
||||
<a href="{{route($route.'.update')}}" class="btn bg-success text-white"><i class="ri-add-line"></i> Tambah Data</a>
|
||||
@endif
|
||||
</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="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="tahun">Tahun</th>
|
||||
<th class="gridjs-td gridjs-th text-sm text-center text-gray-500" data-field="status">Status</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
|
||||
|
|
|
|||
|
|
@ -0,0 +1,131 @@
|
|||
@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">
|
||||
@if(permission('is_create', $route.'.*','module',false) || permission('is_update', $route.'.*','module',false))
|
||||
<a href="{{route($route.'.update')}}" class="btn bg-success text-white"><i class="ri-add-line"></i> Tambah Data</a>
|
||||
@endif
|
||||
</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="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="tahun">Tahun</th>
|
||||
<th class="gridjs-td gridjs-th text-sm text-center text-gray-500" data-field="status">Status</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;
|
||||
});
|
||||
|
||||
$("#grid-data").on("click", ".aktif_data", function() {
|
||||
var base_url = $(this).attr('data-href');
|
||||
var id = $(this).attr('data-id');
|
||||
swal({
|
||||
title: "Aktifkan Data!",
|
||||
text: "Apa anda yakin ingin aktifkan data ini ?",
|
||||
type: "warning",
|
||||
showCancelButton: true,
|
||||
confirmButtonColor: "#2dad62",
|
||||
confirmButtonText: "Ya Aktifkan 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 Mengaktifkan 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
|
||||
|
|
@ -1,45 +1,52 @@
|
|||
@extends('layouts.master')
|
||||
@section('content')
|
||||
<div class="flex flex-col gap-6">
|
||||
<div class="flex-1 overflow-y-auto p-8 custom-scrollbar">
|
||||
<div class="bg-white rounded-3xl border border-slate-200 shadow-sm overflow-hidden">
|
||||
<form action="{{route($route.'.store')}}" method="POST" class="" enctype="multipart/form-data">
|
||||
{{csrf_field()}}
|
||||
<input type="hidden" name="secure_id" value="{{@$keyId}}">
|
||||
<div class="flex flex-col p-3 gap-3">
|
||||
<div class="flex gap-4">
|
||||
<label class="mb-3 w-1/2 font-bold required">Instansi</label>
|
||||
<select name="instansi_id" {{ @$item ? 'disabled' : 'required' }} class="p-2 bg-white rounded border instansi_id select2 @error('instansi_id') is-invalid @enderror" id="instansi_id">
|
||||
<option value="">-</option>
|
||||
@foreach($instansi as $dataInstansi)
|
||||
<option {{@$item->instansi_id == $dataInstansi->MsInstansiId ? 'selected' : ''}} 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="flex gap-4">
|
||||
<label class="mb-3 w-1/2 font-bold required">Resource Data</label>
|
||||
<select name="template_id" {{ @$item ? 'disabled' : 'required' }} class="p-2 bg-white rounded border template_id select2 @error('template_id') is-invalid @enderror" id="template_id">
|
||||
<option value="">Tabel {{@$item->tabelData->nomor_tabel}} - {{@$item->tabelData->name}}</option>
|
||||
</select>
|
||||
@error('template_id')
|
||||
<span class="invalid-feedback" style="display: block!important;"><strong>{{$message}}</strong></span>
|
||||
@enderror
|
||||
</div>
|
||||
</div>
|
||||
<a href="{{ url('opendata/dataset/generateTemplate/'.encode_id(@$item->ms_tabel_data_id)); }}" class="btn bg-success btnDownload text-white btn-md mt-3"><i class="ri-download-2-line"></i> Download Template Excel</a>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
<div class="flex flex-col gap-6 hidden">
|
||||
<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-1 gap-3">
|
||||
<div class="">
|
||||
<label class="mb-3 required">Instansi</label>
|
||||
<select name="instansi_id" {{ @$item ? 'disabled' : 'required' }} class="form-input instansi_id select2 @error('instansi_id') is-invalid @enderror" id="instansi_id">
|
||||
<option value="">-</option>
|
||||
@foreach($instansi as $dataInstansi)
|
||||
<option {{@$item->instansi_id == $dataInstansi->MsInstansiId ? 'selected' : ''}} 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="">
|
||||
<label class="mb-3 required">Resource Data</label>
|
||||
<select name="template_id" {{ @$item ? 'disabled' : 'required' }} class="form-input template_id select2 @error('template_id') is-invalid @enderror" id="template_id">
|
||||
<option value="">Tabel {{@$item->tabelData->nomor_tabel}} - {{@$item->tabelData->name}}</option>
|
||||
</select>
|
||||
@error('template_id')
|
||||
<span class="invalid-feedback" style="display: block!important;"><strong>{{$message}}</strong></span>
|
||||
@enderror
|
||||
</div>
|
||||
</div>
|
||||
<a href="{{ url('opendata/dataset/generateTemplate/'.encode_id(@$item->ms_tabel_data_id)); }}" class="btn bg-success btnDownload text-white btn-md mt-3"><i class="ri-download-2-line"></i> Download Template Excel</a>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
|
|
|||
Loading…
Reference in New Issue