Update Pertama Fitur Detail Curas dan Curanmor
This commit is contained in:
parent
7fa65c1bb1
commit
16daed6b6f
|
@ -3,6 +3,7 @@
|
|||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\HasMany;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
|
||||
|
@ -21,6 +22,10 @@ public function punyaKecamatanCuranmor(): BelongsTo{
|
|||
return $this->belongsTo(Kecamatan::class, 'kecamatan_id');
|
||||
}
|
||||
|
||||
public function curanmor_DetailCuranmor(): HasMany{
|
||||
return $this->hasMany(Detail_Curanmor::class);
|
||||
}
|
||||
|
||||
protected $with = ['punyaKecamatanCuranmor', 'punyaKlasterCuranmor'];
|
||||
|
||||
}
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\HasMany;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
|
||||
|
@ -17,11 +18,14 @@ public function punyaKlasterCuras(): BelongsTo{
|
|||
return $this->belongsTo(Klaster::class, 'klaster_id');
|
||||
}
|
||||
|
||||
|
||||
public function punyaKecamatanCuras(): BelongsTo {
|
||||
return $this->belongsTo(Kecamatan::class, 'kecamatan_id');
|
||||
}
|
||||
|
||||
public function curas_DetailCuras(): HasMany{
|
||||
return $this->hasMany(Detail_Curas::class);
|
||||
}
|
||||
|
||||
protected $with = ['punyaKlasterCuras', 'punyaKecamatanCuras'];
|
||||
|
||||
|
||||
|
|
|
@ -0,0 +1,25 @@
|
|||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
|
||||
class Detail_Curanmor extends Model
|
||||
{
|
||||
/** @use HasFactory<\Database\Factories\DetailCuranmorFactory> */
|
||||
use HasFactory;
|
||||
|
||||
protected $guarded =['id'];
|
||||
|
||||
public function detailCuranmor_Curanmor(): BelongsTo{
|
||||
return $this->belongsTo(Curanmor::class, 'curanmor_id');
|
||||
}
|
||||
|
||||
public function detailCuranmor_Kecamatan(): BelongsTo{
|
||||
return $this->belongsTo(Kecamatan::class, 'detailCuranmor_kecamatan_Id');
|
||||
}
|
||||
|
||||
protected $with = ['detailCuranmor_Curanmor', 'detailCuranmor_Kecamatan'];
|
||||
}
|
|
@ -0,0 +1,27 @@
|
|||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
|
||||
class Detail_Curas extends Model
|
||||
{
|
||||
/** @use HasFactory<\Database\Factories\DetailCurasFactory> */
|
||||
use HasFactory;
|
||||
|
||||
protected $guarded =['id'];
|
||||
|
||||
public function detailCuras_Curas(): BelongsTo{
|
||||
return $this->belongsTo(Curas::class, 'curas_id');
|
||||
}
|
||||
|
||||
public function detailCuras_Kecamatan(): BelongsTo{
|
||||
return $this->belongsTo(Kecamatan::class, 'detailCuras_kecamatan_Id');
|
||||
}
|
||||
|
||||
protected $with = ['detailCuras_Curas', 'detailCuras_Kecamatan'];
|
||||
|
||||
}
|
|
@ -2,9 +2,10 @@
|
|||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\HasOne;
|
||||
use Illuminate\Database\Eloquent\Relations\HasMany;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
|
||||
class Kecamatan extends Model
|
||||
{
|
||||
|
@ -20,4 +21,12 @@ public function kecamatanCuras(): HasOne {
|
|||
public function kecamatanCuranmor(): HasOne {
|
||||
return $this->hasOne(Curanmor::class);
|
||||
}
|
||||
|
||||
public function kecamatan_DetailCuras(): HasMany{
|
||||
return $this->hasMany(Detail_Curas::class);
|
||||
}
|
||||
|
||||
public function kecamatan_DetailCuranmor(): HasMany{
|
||||
return $this->hasMany(Detail_Curanmor::class);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,23 @@
|
|||
<?php
|
||||
|
||||
namespace Database\Factories;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
|
||||
/**
|
||||
* @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\Detail_Curanmor>
|
||||
*/
|
||||
class DetailCuranmorFactory extends Factory
|
||||
{
|
||||
/**
|
||||
* Define the model's default state.
|
||||
*
|
||||
* @return array<string, mixed>
|
||||
*/
|
||||
public function definition(): array
|
||||
{
|
||||
return [
|
||||
//
|
||||
];
|
||||
}
|
||||
}
|
|
@ -0,0 +1,23 @@
|
|||
<?php
|
||||
|
||||
namespace Database\Factories;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
|
||||
/**
|
||||
* @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\Detail_Curas>
|
||||
*/
|
||||
class DetailCurasFactory extends Factory
|
||||
{
|
||||
/**
|
||||
* Define the model's default state.
|
||||
*
|
||||
* @return array<string, mixed>
|
||||
*/
|
||||
public function definition(): array
|
||||
{
|
||||
return [
|
||||
//
|
||||
];
|
||||
}
|
||||
}
|
|
@ -1,57 +0,0 @@
|
|||
<?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('jobs', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('queue')->index();
|
||||
$table->longText('payload');
|
||||
$table->unsignedTinyInteger('attempts');
|
||||
$table->unsignedInteger('reserved_at')->nullable();
|
||||
$table->unsignedInteger('available_at');
|
||||
$table->unsignedInteger('created_at');
|
||||
});
|
||||
|
||||
Schema::create('job_batches', function (Blueprint $table) {
|
||||
$table->string('id')->primary();
|
||||
$table->string('name');
|
||||
$table->integer('total_jobs');
|
||||
$table->integer('pending_jobs');
|
||||
$table->integer('failed_jobs');
|
||||
$table->longText('failed_job_ids');
|
||||
$table->mediumText('options')->nullable();
|
||||
$table->integer('cancelled_at')->nullable();
|
||||
$table->integer('created_at');
|
||||
$table->integer('finished_at')->nullable();
|
||||
});
|
||||
|
||||
Schema::create('failed_jobs', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('uuid')->unique();
|
||||
$table->text('connection');
|
||||
$table->text('queue');
|
||||
$table->longText('payload');
|
||||
$table->longText('exception');
|
||||
$table->timestamp('failed_at')->useCurrent();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('jobs');
|
||||
Schema::dropIfExists('job_batches');
|
||||
Schema::dropIfExists('failed_jobs');
|
||||
}
|
||||
};
|
|
@ -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('detail__curas', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->foreignId('curas_id')->constrained(
|
||||
table: 'curas', indexName: 'detailCuras_curas_id');
|
||||
$table->float('tambahan_curas');
|
||||
$table->foreignId('detailCuras_kecamatan_Id')->constrained(
|
||||
table: 'kecamatans', indexName: 'detailCuras_kecamatan_id');
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('detail__curas');
|
||||
}
|
||||
};
|
|
@ -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('detail__curanmors', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->foreignId('curanmor_id')->constrained(
|
||||
table: 'curanmors', indexName: 'detailCuranmor_curanmor_id');
|
||||
$table->float('tambahan_curanmor');
|
||||
$table->foreignId('detailCuranmor_kecamatan_Id')->constrained(
|
||||
table: 'kecamatans', indexName: 'detailCuranmor_kecamatan_id');
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('detail__curanmors');
|
||||
}
|
||||
};
|
|
@ -6,7 +6,6 @@
|
|||
use App\Models\Curanmor;
|
||||
use App\Models\Kecamatan;
|
||||
use Illuminate\Database\Seeder;
|
||||
use Illuminate\Database\Console\Seeds\WithoutModelEvents;
|
||||
|
||||
class CuranmorSeeder extends Seeder
|
||||
{
|
||||
|
|
|
@ -6,19 +6,15 @@
|
|||
use App\Models\Klaster;
|
||||
use App\Models\Kecamatan;
|
||||
use Illuminate\Database\Seeder;
|
||||
use Illuminate\Database\Console\Seeds\WithoutModelEvents;
|
||||
|
||||
class CurasSeeder extends Seeder
|
||||
{
|
||||
/**
|
||||
* Run the database seeds.
|
||||
*/
|
||||
public function run(): void
|
||||
{
|
||||
$klasterIds = Klaster::pluck('id'); // Ambil semua ID klaster
|
||||
$kecamatanIds = Kecamatan::pluck('id'); // Ambil semua ID kecamatan
|
||||
$klasterIds = Klaster::pluck('id');
|
||||
$kecamatanIds = Kecamatan::pluck('id');
|
||||
|
||||
|
||||
// Data jumlah curas untuk setiap kecamatan (sesuaikan dengan kebutuhan)
|
||||
$dataCuras = [
|
||||
1 => 0,
|
||||
2 => 0,
|
||||
|
@ -42,16 +38,16 @@ public function run(): void
|
|||
20 => 1,
|
||||
21 => 0,
|
||||
22 => 0,
|
||||
23 => 1,
|
||||
24 => 0,
|
||||
23 => 3,
|
||||
24 => 2,
|
||||
];
|
||||
|
||||
// Looping untuk membuat data curas berdasarkan kecamatan
|
||||
|
||||
foreach ($kecamatanIds as $kecamatanId) {
|
||||
Curas::create([
|
||||
'kecamatan_id' => $kecamatanId,
|
||||
'jumlah_curas' => $dataCuras[$kecamatanId], // Gunakan nilai default jika tidak ada data
|
||||
'klaster_id' => $klasterIds->random(), // Pilih klaster secara acak
|
||||
'jumlah_curas' => $dataCuras[$kecamatanId],
|
||||
'klaster_id' => $klasterIds->random(),
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,19 @@
|
|||
<?php
|
||||
|
||||
namespace Database\Seeders;
|
||||
|
||||
use App\Models\Curas;
|
||||
use App\Models\Kecamatan;
|
||||
use App\Models\Detail_Curanmor;
|
||||
use Illuminate\Database\Seeder;
|
||||
|
||||
class DetailCuranmorSeeder extends Seeder
|
||||
{
|
||||
/**
|
||||
* Run the database seeds.
|
||||
*/
|
||||
public function run(): void
|
||||
{
|
||||
|
||||
}
|
||||
}
|
|
@ -0,0 +1,17 @@
|
|||
<?php
|
||||
|
||||
namespace Database\Seeders;
|
||||
|
||||
use Illuminate\Database\Console\Seeds\WithoutModelEvents;
|
||||
use Illuminate\Database\Seeder;
|
||||
|
||||
class DetailCurasSeeder extends Seeder
|
||||
{
|
||||
/**
|
||||
* Run the database seeds.
|
||||
*/
|
||||
public function run(): void
|
||||
{
|
||||
//
|
||||
}
|
||||
}
|
|
@ -0,0 +1,76 @@
|
|||
<x-layoutAdmin>
|
||||
<div class="content-page">
|
||||
<div class="container-fluid">
|
||||
<div class="row">
|
||||
<div class="col-lg-12">
|
||||
<div class="d-flex flex-wrap align-items-center justify-content-between mb-4">
|
||||
<div>
|
||||
<h4 class="mb-3">Detail Kasus Curas Per Tanggal</h4>
|
||||
<p class="mb-0">Berikut ini merupakan rincian kasus Pencurian Dengan Kekerasan (CURAS) <br>
|
||||
yang dikelompokkan berdasarkan tanggal</p>
|
||||
</div>
|
||||
<a href="/dashboard/curas/create" class="btn btn-primary add-list"><i class="las la-plus mr-3"></i>Tambah Kasus Curas</a>
|
||||
</div>
|
||||
@if (session()->has('succes'))
|
||||
<div class="alert alert-success" role="alert">
|
||||
{{ session('succes') }}
|
||||
</div>
|
||||
@endif
|
||||
@if (session()->has('error'))
|
||||
<div class="alert alert-danger" role="alert">
|
||||
{{ session('error') }}
|
||||
</div>
|
||||
@endif
|
||||
</div>
|
||||
<div class="col-lg-12">
|
||||
<div class="table-responsive rounded mb-3">
|
||||
<table class="data-table table mb-0 tbl-server-info">
|
||||
<thead class="bg-white text-uppercase">
|
||||
<tr class="ligth ligth-data">
|
||||
<th>
|
||||
<div class="checkbox d-inline-block">
|
||||
<input type="checkbox" class="checkbox-input" id="checkbox1">
|
||||
<label for="checkbox1" class="mb-0"></label>
|
||||
</div>
|
||||
</th>
|
||||
<th>No</th>
|
||||
<th>Tanggal</th>
|
||||
<th>Tambahan Kasus Curas</th>
|
||||
<th>Nama Kecamatan</th>
|
||||
<th>Hapus Kasus</th>
|
||||
</tr>
|
||||
</thead>
|
||||
{{-- @foreach ( $curases as $curas ) --}}
|
||||
<tbody class="ligth-body">
|
||||
<tr>
|
||||
<td>
|
||||
<div class="checkbox d-inline-block">
|
||||
<input type="checkbox" class="checkbox-input" id="checkbox2">
|
||||
<label for="checkbox2" class="mb-0"></label>
|
||||
</div>
|
||||
</td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td>
|
||||
<div class="d-flex align-items-center list-action">
|
||||
<form action="/dashboard/curanmor/" method="post" class="d-inline">
|
||||
@method('delete')
|
||||
@csrf
|
||||
<button type="submit" class="badge bg-warning mr-2 border-0"><i class="ri-delete-bin-line mr-0"></i></button>
|
||||
|
||||
</form>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
{{-- @endforeach --}}
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- Page end -->
|
||||
</div>
|
||||
</div>
|
||||
</x-layoutAdmin>
|
|
@ -37,7 +37,6 @@
|
|||
<th>Nama Kecamatan</th>
|
||||
<th>Jumlah Kasus Curas</th>
|
||||
<th>Klaster</th>
|
||||
<th>Action</th>
|
||||
</tr>
|
||||
</thead>
|
||||
@foreach ( $curases as $curas )
|
||||
|
@ -52,19 +51,7 @@
|
|||
<td>{{ $loop->iteration }}</td>
|
||||
<td>{{ $curas->punyaKecamatanCuras->nama_kecamatan}}</td>
|
||||
<td>{{ $curas->jumlah_curas }}</td>
|
||||
<td style="background-color: {{ $curas->punyaKlasterCuras->warna }}">{{ $curas -> punyaKlasterCuras -> nama_klaster }}</td>
|
||||
<td>
|
||||
<div class="d-flex align-items-center list-action">
|
||||
<a class="badge bg-success mr-2" data-toggle="tooltip" data-placement="top" title="" data-original-title="Edit"
|
||||
href="/dashboard/curas/{{ $curas->id }}/edit"><i class="ri-pencil-line mr-0"></i></a>
|
||||
<form action="/dashboard/curas/{{ $curas->id }}" method="post" class="d-inline">
|
||||
@method('delete')
|
||||
@csrf
|
||||
<button type="submit" class="badge bg-warning mr-2 border-0"><i class="ri-delete-bin-line mr-0"></i></button>
|
||||
|
||||
</form>
|
||||
</div>
|
||||
</td>
|
||||
<td style="background-color: {{ $curas->punyaKlasterCuras->warna }}">{{ $curas->punyaKlasterCuras->nama_klaster }}</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
@endforeach
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
<link rel="stylesheet" href="https://unpkg.com/leaflet@1.9.4/dist/leaflet.css" integrity="sha256-p4NxAoJBhIIN+hmNHrzRCf9tD/miZyoHS5obTRR9BMY=" crossorigin="" />
|
||||
<script src="https://unpkg.com/leaflet@1.9.4/dist/leaflet.js" integrity="sha256-20nQCchB9co0qIjJZRGuk2/Z9VM+kNiyxNV1lvTlZBo=" crossorigin=""></script>
|
||||
<script src="{{ asset('assets/map/leaflet.ajax.js') }}" ></script>
|
||||
<link rel="shortcut icon" href="{{ asset('/assets/images/favicon2.png') }}" />
|
||||
<link rel="shortcut icon" href="{{ asset('assets/assetLanding/images/favicon2.png') }}" />
|
||||
<link rel="stylesheet" href="{{ asset('/assets/css/backend-plugin.min.css') }}">
|
||||
<link rel="stylesheet" href="{{ asset('/assets/css/backend.css?v=1.0.0') }}">
|
||||
<link rel="stylesheet" href="{{ asset('/assets/vendor/@fortawesome/fontawesome-free/css/all.min.css') }}/">
|
||||
|
|
|
@ -1453,6 +1453,7 @@ class="tab-pane show active"
|
|||
<div class="col-xl-12 col-sm-12">
|
||||
<div class="iq-pricing active white-bg">
|
||||
<div id="map" style="width: 100%; height: 500px;" ></div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -14,6 +14,10 @@
|
|||
return view('landing');
|
||||
});
|
||||
|
||||
Route::get('/detail', function () {
|
||||
return view('admin.dashboardDetailCuras');
|
||||
});
|
||||
|
||||
|
||||
Route::get('/blank', function () {
|
||||
return view('admin.dashboardBlank');
|
||||
|
|
Loading…
Reference in New Issue