feat: goverment agency
This commit is contained in:
parent
17e4b379a4
commit
3ff970391c
@ -75,16 +75,16 @@ function is_role($roles) {
|
||||
}
|
||||
}
|
||||
|
||||
if (! function_exists('encryptId')) {
|
||||
function encryptId($id)
|
||||
if (! function_exists('encrypt_id')) {
|
||||
function encrypt_id($id)
|
||||
{
|
||||
$hashids = new Hashids('alwayssaybismillahirrahmanirrahim', 15);
|
||||
return $hashids->encode($id);
|
||||
}
|
||||
}
|
||||
|
||||
if (! function_exists('decryptId')) {
|
||||
function decryptId($hash)
|
||||
if (! function_exists('decrypt_id')) {
|
||||
function decrypt_id($hash)
|
||||
{
|
||||
$hashids = new Hashids('alwayssaybismillahirrahmanirrahim', 15);
|
||||
$result = $hashids->decode($hash);
|
||||
|
||||
@ -38,7 +38,7 @@ public function store(ClassificationRequest $request){
|
||||
}
|
||||
|
||||
public function edit($id){
|
||||
$classification = Classification::find(decryptId($id));
|
||||
$classification = Classification::find(decrypt_id($id));
|
||||
|
||||
return view('dashboard.classifications.edit', [
|
||||
'title' => 'Ubah Klasifikasi',
|
||||
@ -51,7 +51,8 @@ public function update(ClassificationRequest $request, $id){
|
||||
$validatedData['slug'] = Str::slug($validatedData['name']);
|
||||
$validatedData['enhancer_id'] = Auth::id();
|
||||
|
||||
$updatedClassification = Classification::find(decryptId($id))->update($validatedData);
|
||||
$classification = Classification::find(decrypt_id($id));
|
||||
$updatedClassification = $classification->update($validatedData);
|
||||
|
||||
if($updatedClassification){
|
||||
return redirect()->back()->with('success-status', 'Berhasil mengubah klasifikasi.');
|
||||
@ -61,7 +62,7 @@ public function update(ClassificationRequest $request, $id){
|
||||
}
|
||||
|
||||
public function show($id){
|
||||
$classification = Classification::find(decryptId($id));
|
||||
$classification = Classification::find(decrypt_id($id));
|
||||
|
||||
return view('dashboard.classifications.show', [
|
||||
'title' => 'Detail Klasifikasi',
|
||||
@ -71,7 +72,7 @@ public function show($id){
|
||||
|
||||
public function destroy($id){
|
||||
try {
|
||||
$classification = Classification::findOrFail(decryptId($id));
|
||||
$classification = Classification::findOrFail(decrypt_id($id));
|
||||
|
||||
$classification->delete();
|
||||
|
||||
|
||||
@ -4,6 +4,7 @@
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Models\Classification;
|
||||
use App\Models\GovernmentAgency;
|
||||
use App\Models\SubClassification;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
@ -39,13 +40,13 @@ public function classification(Request $request){
|
||||
|
||||
})
|
||||
->addColumn('action', function ($data) {
|
||||
$showUrl = route('dashboard.classifications.show', ['id' => encryptId($data->id)]);
|
||||
$showUrl = route('dashboard.classifications.show', ['id' => encrypt_id($data->id)]);
|
||||
|
||||
$addSubClassificationUrl = route('dashboard.sub.classifications.create', ['classification' => $data->slug]);
|
||||
|
||||
$editUrl = route('dashboard.classifications.edit', ['id' => encryptId($data->id)]);
|
||||
$editUrl = route('dashboard.classifications.edit', ['id' => encrypt_id($data->id)]);
|
||||
|
||||
$deleteUrl = route('dashboard.classifications.destroy', ['id' => encryptId($data->id)]);
|
||||
$deleteUrl = route('dashboard.classifications.destroy', ['id' => encrypt_id($data->id)]);
|
||||
|
||||
$dropdown = '<div class="dropdown" style="display:flex; justify-content:center;">
|
||||
<a class="dropdown-toggle btn btn-icon btn-light" data-bs-toggle="dropdown"><em class="icon ni ni-more-v"></em></a>
|
||||
@ -106,11 +107,11 @@ public function subClassification(Request $request){
|
||||
}
|
||||
})
|
||||
->addColumn('action', function ($data) {
|
||||
$showUrl = route('dashboard.sub.classifications.show', ['id' => encryptId($data->id)]);
|
||||
$showUrl = route('dashboard.sub.classifications.show', ['id' => encrypt_id($data->id)]);
|
||||
|
||||
$editUrl = route('dashboard.sub.classifications.edit', ['id' => encryptId($data->id)]);
|
||||
$editUrl = route('dashboard.sub.classifications.edit', ['id' => encrypt_id($data->id)]);
|
||||
|
||||
$deleteUrl = route('dashboard.sub.classifications.destroy', ['id' => encryptId($data->id)]);
|
||||
$deleteUrl = route('dashboard.sub.classifications.destroy', ['id' => encrypt_id($data->id)]);
|
||||
|
||||
$dropdown = '<div class="dropdown" style="display:flex; justify-content:center;">
|
||||
<a class="dropdown-toggle btn btn-icon btn-light" data-bs-toggle="dropdown"><em class="icon ni ni-more-v"></em></a>
|
||||
@ -141,4 +142,47 @@ public function subClassification(Request $request){
|
||||
return response()->json(['error' => 'Unauthorized'], 401);
|
||||
|
||||
}
|
||||
|
||||
public function governmentAgency(Request $request){
|
||||
if ($request->ajax()) {
|
||||
$data = GovernmentAgency::all();
|
||||
|
||||
return DataTables::of($data)
|
||||
->addIndexColumn()
|
||||
->addColumn('action', function ($data) {
|
||||
$showUrl = route('dashboard.government.agencies.show', ['id' => encrypt_id($data->id)]);
|
||||
|
||||
$editUrl = route('dashboard.government.agencies.edit', ['id' => encrypt_id($data->id)]);
|
||||
|
||||
$deleteUrl = route('dashboard.government.agencies.destroy', ['id' => encrypt_id($data->id)]);
|
||||
|
||||
$dropdown = '<div class="dropdown" style="display:flex; justify-content:center;">
|
||||
<a class="dropdown-toggle btn btn-icon btn-light" data-bs-toggle="dropdown"><em class="icon ni ni-more-v"></em></a>
|
||||
<div class="dropdown-menu dropdown-menu-end">
|
||||
<ul class="link-list-opt">
|
||||
<li><a href="'.$showUrl.'"><em class="icon ni ni-eye"></em><span>Detail</span></a></li>';
|
||||
|
||||
if (is_role([1])) {
|
||||
$dropdown .= '<li><a href="'.$editUrl.'"><em class="icon ni ni-edit"></em><span>Ubah</span></a></li>';
|
||||
}
|
||||
|
||||
if (is_role([1])) {
|
||||
$dropdown .= '<li><a href="javascript:void(0);" onclick="deleteItem(\''.$deleteUrl.'\', \'Apakah Anda yakin ingin menghapus OPD '.$data->name.'? Item ini akan dihapus secara permanen!\')"><em class="icon ni ni-trash"></em><span>Hapus</span></a></li>';
|
||||
|
||||
}
|
||||
|
||||
$dropdown .= '</ul>
|
||||
</div>
|
||||
</div>';
|
||||
|
||||
return $dropdown;
|
||||
})
|
||||
|
||||
->rawColumns(['action'])
|
||||
->make(true);
|
||||
}
|
||||
|
||||
return response()->json(['error' => 'Unauthorized'], 401);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -0,0 +1,85 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Dashboard;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Http\Requests\GovernmentAgencyRequest;
|
||||
use App\Models\GovernmentAgency;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
class GovernmentAgencyController extends Controller
|
||||
{
|
||||
public function index(){
|
||||
return view('dashboard.government-agencies.index', [
|
||||
'title' => 'OPD'
|
||||
]);
|
||||
}
|
||||
|
||||
public function create(){
|
||||
return view('dashboard.government-agencies.create', [
|
||||
'title' => 'Tambah OPD'
|
||||
]);
|
||||
}
|
||||
|
||||
public function store(GovernmentAgencyRequest $request){
|
||||
$validatedData = $request->validated();
|
||||
$validatedData['slug'] = Str::slug($validatedData['name']);
|
||||
$validatedData['enhancer_id'] = Auth::id();
|
||||
|
||||
$createdGovernmentAgency = GovernmentAgency::create($validatedData);
|
||||
|
||||
if($createdGovernmentAgency){
|
||||
return redirect()->back()->with('success-status', 'Berhasil menambahkan OPD.');
|
||||
}else{
|
||||
return redirect()->back()->with('failed-status', 'Gagal menambahkan OPD');
|
||||
}
|
||||
}
|
||||
|
||||
public function edit($id){
|
||||
$governmentAgency = GovernmentAgency::find(decrypt_id($id));
|
||||
|
||||
return view('dashboard.government-agencies.edit',[
|
||||
'title' => 'Ubah OPD',
|
||||
'governmentAgency' => $governmentAgency
|
||||
]);
|
||||
}
|
||||
|
||||
public function update(GovernmentAgencyRequest $request, $id){
|
||||
$validatedData = $request->validated();
|
||||
$validatedData['slug'] = Str::slug($validatedData['name']);
|
||||
$validatedData['enhancer_id'] = Auth::id();
|
||||
|
||||
$governmentAgency = GovernmentAgency::findOrFail(decrypt_id($id));
|
||||
$updatedGovernmentAgency = $governmentAgency->update($validatedData);
|
||||
|
||||
if($updatedGovernmentAgency){
|
||||
return redirect()->back()->with('success-status', 'Berhasil mengubah OPD.');
|
||||
}else{
|
||||
return redirect()->back()->with('failed-status', 'Gagal mengubah OPD');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public function show($id){
|
||||
$governmentAgency = GovernmentAgency::find(decrypt_id($id));
|
||||
|
||||
return view('dashboard.government-agencies.show',[
|
||||
'title' => 'Detail OPD',
|
||||
'governmentAgency' => $governmentAgency
|
||||
]);
|
||||
}
|
||||
|
||||
public function destroy($id){
|
||||
try {
|
||||
$governmentAgency = GovernmentAgency::findOrFail(decrypt_id($id));
|
||||
|
||||
$governmentAgency->delete();
|
||||
|
||||
return response()->json(['message' => 'Berhasil menghapus OPD']);
|
||||
} catch (\Exception $e) {
|
||||
return response()->json(['message' => 'Gagal menghapus OPD.'], 500);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -55,7 +55,7 @@ public function store(SubClassificationRequest $request){
|
||||
}
|
||||
|
||||
public function edit($id){
|
||||
$subClassification = SubClassification::find(decryptId($id));
|
||||
$subClassification = SubClassification::find(decrypt_id($id));
|
||||
|
||||
return view('dashboard.sub-classifications.edit', [
|
||||
'title' => 'Ubah Sub Klasifikasi',
|
||||
@ -69,7 +69,8 @@ public function update(SubClassificationRequest $request, $id){
|
||||
$validatedData['slug'] = Str::slug($validatedData['name']);
|
||||
$validatedData['enhancer_id'] = Auth::id();
|
||||
|
||||
$updatedSubClassification = SubClassification::find(decryptId($id))->update($validatedData);
|
||||
$subClassification = SubClassification::find(decrypt_id($id));
|
||||
$updatedSubClassification = $subClassification->update($validatedData);
|
||||
|
||||
if($updatedSubClassification){
|
||||
return redirect()->back()->with('success-status', 'Berhasil mengubah sub klasifikasi.');
|
||||
@ -79,7 +80,7 @@ public function update(SubClassificationRequest $request, $id){
|
||||
}
|
||||
|
||||
public function show($id){
|
||||
$subClassification = SubClassification::with(['classification'])->find(decryptId($id));
|
||||
$subClassification = SubClassification::with(['classification'])->find(decrypt_id($id));
|
||||
|
||||
return view('dashboard.sub-classifications.show', [
|
||||
'title' => 'Detail Sub Klasifikasi',
|
||||
@ -89,7 +90,7 @@ public function show($id){
|
||||
|
||||
public function destroy($id){
|
||||
try {
|
||||
$subClassification = SubClassification::findOrFail(decryptId($id));
|
||||
$subClassification = SubClassification::findOrFail(decrypt_id($id));
|
||||
|
||||
$subClassification->delete();
|
||||
|
||||
|
||||
32
app/Http/Requests/GovernmentAgencyRequest.php
Normal file
32
app/Http/Requests/GovernmentAgencyRequest.php
Normal file
@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
|
||||
class GovernmentAgencyRequest extends FormRequest
|
||||
{
|
||||
/**
|
||||
* Determine if the user is authorized to make this request.
|
||||
*/
|
||||
public function authorize(): bool
|
||||
{
|
||||
return Auth::check() && is_role(['1']);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the validation rules that apply to the request.
|
||||
*
|
||||
* @return array<string, \Illuminate\Contracts\Validation\ValidationRule|array<mixed>|string>
|
||||
*/
|
||||
public function rules(): array
|
||||
{
|
||||
return [
|
||||
'name' => ['required', 'max:100'],
|
||||
'short_name' => ['nullable', 'max:100'],
|
||||
'location' => ['nullable'],
|
||||
'description' => ['nullable'],
|
||||
];
|
||||
}
|
||||
}
|
||||
19
app/Models/GovernmentAgency.php
Normal file
19
app/Models/GovernmentAgency.php
Normal file
@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class GovernmentAgency extends Model
|
||||
{
|
||||
protected $table = 'government_agencies';
|
||||
|
||||
protected $fillable = [
|
||||
'name',
|
||||
'slug',
|
||||
'short_name',
|
||||
'location',
|
||||
'description',
|
||||
'enhancer_id',
|
||||
];
|
||||
}
|
||||
@ -0,0 +1,34 @@
|
||||
<?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('government_agencies', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('name');
|
||||
$table->string('slug');
|
||||
$table->string('short_name')->nullable();
|
||||
$table->text('location')->nullable();
|
||||
$table->text('description')->nullable();
|
||||
$table->unsignedBigInteger('enhancer_id');
|
||||
$table->foreign('enhancer_id')->references('id')->on('users');
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('government_agencies');
|
||||
}
|
||||
};
|
||||
@ -2,6 +2,7 @@
|
||||
|
||||
namespace Database\Seeders;
|
||||
|
||||
use App\Models\Classification;
|
||||
use Illuminate\Database\Console\Seeds\WithoutModelEvents;
|
||||
use Illuminate\Database\Seeder;
|
||||
|
||||
@ -12,6 +13,19 @@ class ClassificationSeeder extends Seeder
|
||||
*/
|
||||
public function run(): void
|
||||
{
|
||||
//
|
||||
Classification::insert([
|
||||
[
|
||||
'name' => 'Politik',
|
||||
'slug' => 'politik',
|
||||
'description' => null,
|
||||
'enhancer_id' => '1'
|
||||
],
|
||||
[
|
||||
'name' => 'Kiriminal',
|
||||
'slug' => 'kriminal',
|
||||
'description' => null,
|
||||
'enhancer_id' => '1'
|
||||
]
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
@ -15,5 +15,8 @@ public function run(): void
|
||||
{
|
||||
$this->call(RoleSeeder::class);
|
||||
$this->call(UserSeeder::class);
|
||||
$this->call(ClassificationSeeder::class);
|
||||
$this->call(SubClassificationSeeder::class);
|
||||
$this->call(GovernmentAgencySeeder::class);
|
||||
}
|
||||
}
|
||||
|
||||
24
database/seeders/GovernmentAgencySeeder.php
Normal file
24
database/seeders/GovernmentAgencySeeder.php
Normal file
@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Seeders;
|
||||
|
||||
use App\Models\GovernmentAgency;
|
||||
use Illuminate\Database\Console\Seeds\WithoutModelEvents;
|
||||
use Illuminate\Database\Seeder;
|
||||
|
||||
class GovernmentAgencySeeder extends Seeder
|
||||
{
|
||||
/**
|
||||
* Run the database seeds.
|
||||
*/
|
||||
public function run(): void
|
||||
{
|
||||
GovernmentAgency::create([
|
||||
'name' => 'Dinas Pendidikan',
|
||||
'slug' => 'dinas-pendidikan',
|
||||
'short_name' => 'Disdik',
|
||||
'description' => 'Dinas yang menangani bidang pendidikan.',
|
||||
'enhancer_id' => '1',
|
||||
]);
|
||||
}
|
||||
}
|
||||
@ -2,6 +2,7 @@
|
||||
|
||||
namespace Database\Seeders;
|
||||
|
||||
use App\Models\SubClassification;
|
||||
use Illuminate\Database\Console\Seeds\WithoutModelEvents;
|
||||
use Illuminate\Database\Seeder;
|
||||
|
||||
@ -12,6 +13,21 @@ class SubClassificationSeeder extends Seeder
|
||||
*/
|
||||
public function run(): void
|
||||
{
|
||||
//
|
||||
SubClassification::insert([
|
||||
[
|
||||
'name' => 'Pembacokan',
|
||||
'slug' => 'pembacokan',
|
||||
'description' => null,
|
||||
'classification_id' => '2',
|
||||
'enhancer_id' => '1'
|
||||
],
|
||||
[
|
||||
'name' => 'Tawuran',
|
||||
'slug' => 'tawuran',
|
||||
'description' => null,
|
||||
'classification_id' => '2',
|
||||
'enhancer_id' => '1'
|
||||
]
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
@ -12,7 +12,7 @@
|
||||
<div class="card-head">
|
||||
<h5 class="card-title">{{$title}}</h5>
|
||||
</div>
|
||||
<form action="{{route('dashboard.classifications.update', ['id' => encryptId($classification->id)])}}" method="post">
|
||||
<form action="{{route('dashboard.classifications.update', ['id' => encrypt_id($classification->id)])}}" method="post">
|
||||
@csrf
|
||||
@method('put')
|
||||
<div class="row g-4">
|
||||
|
||||
@ -44,7 +44,7 @@
|
||||
<hr>
|
||||
<div class="form-group d-flex justify-content-end">
|
||||
<a href="{{route('dashboard.classifications.index')}}" class="btn btn-white btn-dim btn-outline-light mx-2"><span>Kembali</span></a>
|
||||
<a href="{{route('dashboard.classifications.edit', ['id' => encryptId($classification->id)])}}" class="btn btn-warning"><span>Ubah</span></a>
|
||||
<a href="{{route('dashboard.classifications.edit', ['id' => encrypt_id($classification->id)])}}" class="btn btn-warning"><span>Ubah</span></a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@ -0,0 +1,77 @@
|
||||
@include('partials.dashboard.head')
|
||||
@include('partials.dashboard.sidebar', ['page' => 'government_agencies'])
|
||||
@include('partials.dashboard.header')
|
||||
<!-- content @s -->
|
||||
<div class="nk-content ">
|
||||
<div class="container-fluid">
|
||||
<div class="nk-content-inner">
|
||||
<div class="nk-content-body">
|
||||
<div class="nk-block nk-block-lg">
|
||||
<div class="card card-bordered card-preview">
|
||||
<div class="card-inner">
|
||||
<div class="card-head">
|
||||
<h5 class="card-title">{{$title}}</h5>
|
||||
</div>
|
||||
<form action="{{route('dashboard.government.agencies.store')}}" method="post">
|
||||
@csrf
|
||||
<div class="row g-4">
|
||||
<div class="col-lg-6">
|
||||
<div class="form-group">
|
||||
<label class="form-label" for="name">Nama<span class="required-input">*</span></label>
|
||||
<div class="form-control-wrap">
|
||||
<input type="text" class="form-control @error('name') border-danger @enderror" id="name" name="name" placeholder="Masukan nama OPD" value="{{old('name')}}">
|
||||
</div>
|
||||
@error('name')
|
||||
<span class="validation-error">{{$message}}</span>
|
||||
@enderror
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-lg-6">
|
||||
<div class="form-group">
|
||||
<label class="form-label" for="short_name">Singkatan Nama</label>
|
||||
<div class="form-control-wrap">
|
||||
<input type="text" class="form-control @error('short_name') border-danger @enderror" id="short_name" name="short_name" placeholder="Masukan singkatan nama OPD" value="{{old('short_name')}}">
|
||||
</div>
|
||||
@error('short_name')
|
||||
<span class="validation-error">{{$message}}</span>
|
||||
@enderror
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-lg-6">
|
||||
<div class="form-group">
|
||||
<label class="form-label" for="location">Lokasi</label>
|
||||
<div class="form-control-wrap">
|
||||
<input type="text" class="form-control @error('location') border-danger @enderror" id="location" name="location" placeholder="Masukan lokasi OPD" value="{{old('location')}}">
|
||||
</div>
|
||||
@error('location')
|
||||
<span class="validation-error">{{$message}}</span>
|
||||
@enderror
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-lg-12">
|
||||
<div class="form-group">
|
||||
<label class="form-label" for="phone-no-1">Deskripsi</label>
|
||||
<div class="form-control-wrap">
|
||||
<div class="summernote-minimal">{!!old('description')!!}</div>
|
||||
<input type="hidden" name="description" id="richEeditorValue">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-12">
|
||||
<hr>
|
||||
<div class="form-group d-flex justify-content-end">
|
||||
<a href="{{route('dashboard.government.agencies.index')}}" class="btn btn-white btn-dim btn-outline-light mx-2"><span>Kembali</span></a>
|
||||
<button type="submit" class="btn btn-md btn-primary">Tambahkan</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- content @e -->
|
||||
@include('partials.dashboard.footer', ['rich_editor' => true])
|
||||
78
resources/views/dashboard/government-agencies/edit.blade.php
Normal file
78
resources/views/dashboard/government-agencies/edit.blade.php
Normal file
@ -0,0 +1,78 @@
|
||||
@include('partials.dashboard.head')
|
||||
@include('partials.dashboard.sidebar', ['page' => 'government_agencies'])
|
||||
@include('partials.dashboard.header')
|
||||
<!-- content @s -->
|
||||
<div class="nk-content ">
|
||||
<div class="container-fluid">
|
||||
<div class="nk-content-inner">
|
||||
<div class="nk-content-body">
|
||||
<div class="nk-block nk-block-lg">
|
||||
<div class="card card-bordered card-preview">
|
||||
<div class="card-inner">
|
||||
<div class="card-head">
|
||||
<h5 class="card-title">{{$title}}</h5>
|
||||
</div>
|
||||
<form action="{{route('dashboard.government.agencies.update', ['id' => encrypt_id($governmentAgency->id)])}}" method="post">
|
||||
@csrf
|
||||
@method('put')
|
||||
<div class="row g-4">
|
||||
<div class="col-lg-6">
|
||||
<div class="form-group">
|
||||
<label class="form-label" for="name">Nama<span class="required-input">*</span></label>
|
||||
<div class="form-control-wrap">
|
||||
<input type="text" class="form-control @error('name') border-danger @enderror" id="name" name="name" placeholder="Masukan nama OPD" value="{{$governmentAgency->name}}">
|
||||
</div>
|
||||
@error('name')
|
||||
<span class="validation-error">{{$message}}</span>
|
||||
@enderror
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-lg-6">
|
||||
<div class="form-group">
|
||||
<label class="form-label" for="short_name">Singkatan Nama</label>
|
||||
<div class="form-control-wrap">
|
||||
<input type="text" class="form-control @error('short_name') border-danger @enderror" id="short_name" name="short_name" placeholder="Masukan singkatan nama OPD" value="{{$governmentAgency->short_name}}">
|
||||
</div>
|
||||
@error('short_name')
|
||||
<span class="validation-error">{{$message}}</span>
|
||||
@enderror
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-lg-6">
|
||||
<div class="form-group">
|
||||
<label class="form-label" for="location">Lokasi</label>
|
||||
<div class="form-control-wrap">
|
||||
<input type="text" class="form-control @error('location') border-danger @enderror" id="location" name="location" placeholder="Masukan lokasi OPD" value="{{$governmentAgency->location}}">
|
||||
</div>
|
||||
@error('location')
|
||||
<span class="validation-error">{{$message}}</span>
|
||||
@enderror
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-lg-12">
|
||||
<div class="form-group">
|
||||
<label class="form-label" for="phone-no-1">Deskripsi</label>
|
||||
<div class="form-control-wrap">
|
||||
<div class="summernote-minimal">{!!$governmentAgency->description!!}</div>
|
||||
<input type="hidden" name="description" id="richEeditorValue">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-12">
|
||||
<hr>
|
||||
<div class="form-group d-flex justify-content-end">
|
||||
<a href="{{route('dashboard.government.agencies.index')}}" class="btn btn-white btn-dim btn-outline-light mx-2"><span>Kembali</span></a>
|
||||
<button type="submit" class="btn btn-md btn-primary">Simpan</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- content @e -->
|
||||
@include('partials.dashboard.footer', ['rich_editor' => true])
|
||||
@ -0,0 +1,60 @@
|
||||
@include('partials.dashboard.head')
|
||||
@include('partials.dashboard.sidebar', ['page' => 'government_agencies'])
|
||||
@include('partials.dashboard.header')
|
||||
<!-- content @s -->
|
||||
<div class="nk-content ">
|
||||
<div class="container-fluid">
|
||||
<div class="nk-content-inner">
|
||||
<div class="nk-content-body">
|
||||
<div class="nk-block-head nk-block-head-sm">
|
||||
<div class="nk-block-between">
|
||||
<div class="nk-block-head-content">
|
||||
<h3 class="nk-block-title page-title">{{$title}}</h3>
|
||||
</div><!-- .nk-block-head-content -->
|
||||
<div class="nk-block-head-content">
|
||||
<div class="toggle-wrap nk-block-tools-toggle">
|
||||
<a href="#" class="btn btn-icon btn-trigger toggle-expand me-n1" data-target="pageMenu"><em class="icon ni ni-more-v"></em></a>
|
||||
<div class="toggle-expand-content" data-content="pageMenu">
|
||||
<ul class="nk-block-tools g-3">
|
||||
{{-- <li>
|
||||
<div class="drodown">
|
||||
<a href="#" class="dropdown-toggle btn btn-white btn-dim btn-outline-light" data-bs-toggle="dropdown"><em class="d-none d-sm-inline icon ni ni-calender-date"></em><span><span class="d-none d-md-inline">Last</span> 30 Days</span><em class="dd-indc icon ni ni-chevron-right"></em></a>
|
||||
<div class="dropdown-menu dropdown-menu-end">
|
||||
<ul class="link-list-opt no-bdr">
|
||||
<li><a href="#"><span>Last 30 Days</span></a></li>
|
||||
<li><a href="#"><span>Last 6 Months</span></a></li>
|
||||
<li><a href="#"><span>Last 1 Years</span></a></li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</li> --}}
|
||||
<li class="nk-block-tools-opt"><a href="{{route('dashboard.government.agencies.create')}}" class="btn btn-primary"><em class="icon ni ni-plus"></em><span>Tambah</span></a></li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div><!-- .nk-block-head-content -->
|
||||
</div><!-- .nk-block-between -->
|
||||
</div><!-- .nk-block-head -->
|
||||
<div class="nk-block nk-block-lg">
|
||||
<div class="card card-bordered card-preview">
|
||||
<div class="card-inner">
|
||||
<div class="table-responsive">
|
||||
<table class="table table-striped table-bordered nowrap" id="governmentAgenciesTable" border="1">
|
||||
<thead>
|
||||
<tr>
|
||||
<th style="width: 10% !important;">No</th>
|
||||
<th>Nama</th>
|
||||
<th style="width: 10% !important;"></th>
|
||||
</tr>
|
||||
</thead>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- content @e -->
|
||||
@include('partials.dashboard.footer' ,['datatable' => 'government_agency'])
|
||||
68
resources/views/dashboard/government-agencies/show.blade.php
Normal file
68
resources/views/dashboard/government-agencies/show.blade.php
Normal file
@ -0,0 +1,68 @@
|
||||
@include('partials.dashboard.head')
|
||||
@include('partials.dashboard.sidebar', ['page' => 'government_agencies'])
|
||||
@include('partials.dashboard.header')
|
||||
<!-- content @s -->
|
||||
<div class="nk-content ">
|
||||
<div class="container-fluid">
|
||||
<div class="nk-content-inner">
|
||||
<div class="nk-content-body">
|
||||
<div class="nk-block nk-block-lg">
|
||||
<div class="card card-bordered card-preview">
|
||||
<div class="card-inner">
|
||||
<div class="card-head">
|
||||
<h5 class="card-title">{{$title}}</h5>
|
||||
</div>
|
||||
<form action="#" method="post">
|
||||
@csrf
|
||||
@method('put')
|
||||
<div class="row g-4">
|
||||
<div class="col-lg-6">
|
||||
<div class="form-group">
|
||||
<label class="form-label" for="name">Nama<span class="required-input">*</span></label>
|
||||
<div class="form-control-wrap">
|
||||
<input type="text" class="form-control @error('name') border-danger @enderror" id="name" name="name" placeholder="Masukan nama OPD" value="{{$governmentAgency->name}}" readonly>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-lg-6">
|
||||
<div class="form-group">
|
||||
<label class="form-label" for="short_name">Singkatan Nama</label>
|
||||
<div class="form-control-wrap">
|
||||
<input type="text" class="form-control @error('short_name') border-danger @enderror" id="short_name" name="short_name" placeholder="Masukan singkatan nama OPD" value="{{$governmentAgency->short_name}}" readonly>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-lg-6">
|
||||
<div class="form-group">
|
||||
<label class="form-label" for="location">Lokasi</label>
|
||||
<div class="form-control-wrap">
|
||||
<input type="text" class="form-control @error('location') border-danger @enderror" id="location" name="location" placeholder="Masukan lokasi OPD" value="{{$governmentAgency->location}}" readonly>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-lg-12">
|
||||
<div class="form-group">
|
||||
<label class="form-label" for="phone-no-1">Deskripsi</label>
|
||||
<div class="form-control-wrap">
|
||||
<div class="description-content">{!! $governmentAgency->description !!}</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-12">
|
||||
<hr>
|
||||
<div class="form-group d-flex justify-content-end">
|
||||
<a href="{{route('dashboard.government.agencies.index')}}" class="btn btn-white btn-dim btn-outline-light mx-2"><span>Kembali</span></a>
|
||||
<a href="{{route('dashboard.government.agencies.edit', ['id' => encrypt_id($governmentAgency->id)])}}" class="btn btn-warning"><span>Ubah</span></a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- content @e -->
|
||||
@include('partials.dashboard.footer', ['rich_editor' => true])
|
||||
@ -19,7 +19,7 @@
|
||||
<div class="form-group">
|
||||
<label class="form-label" for="name">Nama Sub Klasifikasi<span class="required-input">*</span></label>
|
||||
<div class="form-control-wrap">
|
||||
<input type="text" class="form-control @error('name') border-danger @enderror" id="name" name="name" placeholder="Masukan nama klasifikasi" value="{{old('name')}}">
|
||||
<input type="text" class="form-control @error('name') border-danger @enderror" id="name" name="name" placeholder="Masukan nama sub klasifikasi" value="{{old('name')}}">
|
||||
</div>
|
||||
@error('name')
|
||||
<span class="validation-error">{{$message}}</span>
|
||||
|
||||
@ -12,7 +12,7 @@
|
||||
<div class="card-head">
|
||||
<h5 class="card-title">{{$title}}</h5>
|
||||
</div>
|
||||
<form action="{{route('dashboard.sub.classifications.update', ['id' => encryptId($subClassification->id)])}}" method="post">
|
||||
<form action="{{route('dashboard.sub.classifications.update', ['id' => encrypt_id($subClassification->id)])}}" method="post">
|
||||
@csrf
|
||||
@method('put')
|
||||
<div class="row g-4">
|
||||
@ -20,7 +20,7 @@
|
||||
<div class="form-group">
|
||||
<label class="form-label" for="name">Nama Sub Klasifikasi<span class="required-input">*</span></label>
|
||||
<div class="form-control-wrap">
|
||||
<input type="text" class="form-control @error('name') border-danger @enderror" id="name" name="name" placeholder="Masukan nama klasifikasi" value="{{$subClassification->name}}">
|
||||
<input type="text" class="form-control @error('name') border-danger @enderror" id="name" name="name" placeholder="Masukan nama sub klasifikasi" value="{{$subClassification->name}}">
|
||||
</div>
|
||||
@error('name')
|
||||
<span class="validation-error">{{$message}}</span>
|
||||
|
||||
@ -52,7 +52,7 @@
|
||||
<hr>
|
||||
<div class="form-group d-flex justify-content-end">
|
||||
<a href="{{route('dashboard.sub.classifications.index')}}" class="btn btn-white btn-dim btn-outline-light mx-2"><span>Kembali</span></a>
|
||||
<a href="{{route('dashboard.sub.classifications.edit', ['id' => encryptId($subClassification->id)])}}" class="btn btn-warning"><span>Ubah</span></a>
|
||||
<a href="{{route('dashboard.sub.classifications.edit', ['id' => encrypt_id($subClassification->id)])}}" class="btn btn-warning"><span>Ubah</span></a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@ -68,3 +68,25 @@
|
||||
});
|
||||
</script>
|
||||
@endif
|
||||
|
||||
@if ($datatable === 'government_agency')
|
||||
<script>
|
||||
$(document).ready(function() {
|
||||
$('#governmentAgenciesTable').DataTable({
|
||||
processing: true,
|
||||
serverSide: true,
|
||||
ajax: '{{ route('dashboard.government.agencies.data') }}',
|
||||
columns: [
|
||||
{ data: 'DT_RowIndex', name: 'DT_RowIndex', orderable: false, searchable: false },
|
||||
{ data: 'name', name: 'name' },
|
||||
{ data: 'action', name: 'action', orderable: false, searchable: false },
|
||||
{ data: 'id', name: 'id', orderable: true, searchable: false, visible: false },
|
||||
],
|
||||
language: datatableLanguage,
|
||||
autoWidth: false,
|
||||
order: [[1, 'desc']],
|
||||
lengthMenu: [[10, 25, 50, 100, -1], ['Tampilkan 10 data', 'Tampilkan 25 data', 'Tampilkan 50 data', 'Tampilkan 100 data', 'Tampilkan semua']]
|
||||
});
|
||||
});
|
||||
</script>
|
||||
@endif
|
||||
|
||||
@ -58,7 +58,7 @@
|
||||
</a>
|
||||
</li><!-- .nk-menu-item -->
|
||||
<li class="nk-menu-item">
|
||||
<a href="javascript:void(0);" class="nk-menu-link">
|
||||
<a href="{{route('dashboard.government.agencies.index')}}" class="nk-menu-link {{$page === 'government_agencies' ? 'active-page' : ''}}">
|
||||
<span class="nk-menu-icon"><em class="icon ni ni-building"></em></span>
|
||||
<span class="nk-menu-text">OPD</span>
|
||||
</a>
|
||||
|
||||
@ -3,6 +3,7 @@
|
||||
use App\Http\Controllers\AuthController;
|
||||
use App\Http\Controllers\Dashboard\ClassificationController;
|
||||
use App\Http\Controllers\Dashboard\DatatableController;
|
||||
use App\Http\Controllers\Dashboard\GovernmentAgencyController;
|
||||
use App\Http\Controllers\Dashboard\OverviewController;
|
||||
use App\Http\Controllers\Dashboard\SubClassificationController;
|
||||
use Illuminate\Support\Facades\Route;
|
||||
@ -58,5 +59,19 @@
|
||||
|
||||
Route::get('/data', [DatatableController::class, 'subClassification'])->name('data');
|
||||
});
|
||||
|
||||
Route::prefix('government-agencies')->name('government.agencies.')->group(function(){
|
||||
Route::controller(GovernmentAgencyController::class)->group(function(){
|
||||
Route::get('/', 'index')->name('index');
|
||||
Route::get('/create', 'create')->name('create');
|
||||
Route::post('/', 'store')->name('store');
|
||||
Route::get('/{id}/show', 'show')->name('show');
|
||||
Route::get('/{id}/edit', 'edit')->name('edit');
|
||||
Route::put('/{id}', 'update')->name('update');
|
||||
Route::delete('/{id}', 'destroy')->name('destroy');
|
||||
});
|
||||
|
||||
Route::get('/data', [DatatableController::class, 'governmentAgency'])->name('data');
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
Loading…
Reference in New Issue
Block a user