Merge branch 'fix/master-rule' of https://github.com/arieeefajar/Tugas_Akhir into fix/master-rule
This commit is contained in:
commit
bcd9a86888
|
@ -11,7 +11,7 @@ class IndicatorController extends Controller
|
||||||
{
|
{
|
||||||
public function index()
|
public function index()
|
||||||
{
|
{
|
||||||
$indicators = Indicator::all();
|
$indicators = Indicator::select('id', 'name')->orderBy('created_at', 'desc')->get();
|
||||||
return view('master-data.indikator.index', compact('indicators'));
|
return view('master-data.indikator.index', compact('indicators'));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -21,15 +21,10 @@ public function store(Request $request)
|
||||||
"name.required" => "Nama wajib diisi",
|
"name.required" => "Nama wajib diisi",
|
||||||
"name.max" => "Nama maksimal 25 karakter",
|
"name.max" => "Nama maksimal 25 karakter",
|
||||||
"name.string" => "Nama harus berupa string",
|
"name.string" => "Nama harus berupa string",
|
||||||
|
|
||||||
"description.required" => "Deskripsi wajib diisi",
|
|
||||||
"description.max" => "Deskripsi maksimal 50 karakter",
|
|
||||||
"description.string" => "Deskripsi harus berupa string",
|
|
||||||
];
|
];
|
||||||
|
|
||||||
$validator = Validator::make($request->all(), [
|
$validator = Validator::make($request->all(), [
|
||||||
'name' => 'required|string|max:25',
|
'name' => 'required|string|max:25',
|
||||||
'description' => 'required|string|max:50',
|
|
||||||
], $customMessage);
|
], $customMessage);
|
||||||
|
|
||||||
if ($validator->fails()) {
|
if ($validator->fails()) {
|
||||||
|
@ -39,7 +34,6 @@ public function store(Request $request)
|
||||||
|
|
||||||
$indicator = new Indicator();
|
$indicator = new Indicator();
|
||||||
$indicator->name = $request->name;
|
$indicator->name = $request->name;
|
||||||
$indicator->description = $request->description;
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$indicator->save();
|
$indicator->save();
|
||||||
|
@ -57,15 +51,10 @@ public function update(Request $request, $id)
|
||||||
"name.required" => "Nama wajib diisi",
|
"name.required" => "Nama wajib diisi",
|
||||||
"name.max" => "Nama maksimal 25 karakter",
|
"name.max" => "Nama maksimal 25 karakter",
|
||||||
"name.string" => "Nama harus berupa string",
|
"name.string" => "Nama harus berupa string",
|
||||||
|
|
||||||
"description.required" => "Deskripsi wajib diisi",
|
|
||||||
"description.max" => "Deskripsi maksimal 50 karakter",
|
|
||||||
"description.string" => "Deskripsi harus berupa string",
|
|
||||||
];
|
];
|
||||||
|
|
||||||
$validator = Validator::make($request->all(), [
|
$validator = Validator::make($request->all(), [
|
||||||
'name' => 'required|string|max:25',
|
'name' => 'required|string|max:25',
|
||||||
'description' => 'required|string|max:50',
|
|
||||||
], $customMessage);
|
], $customMessage);
|
||||||
|
|
||||||
if ($validator->fails()) {
|
if ($validator->fails()) {
|
||||||
|
@ -75,7 +64,6 @@ public function update(Request $request, $id)
|
||||||
|
|
||||||
$indicator = Indicator::find($id);
|
$indicator = Indicator::find($id);
|
||||||
$indicator->name = $request->name;
|
$indicator->name = $request->name;
|
||||||
$indicator->description = $request->description;
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$indicator->save();
|
$indicator->save();
|
||||||
|
|
|
@ -14,7 +14,6 @@ public function up(): void
|
||||||
Schema::create('indicators', function (Blueprint $table) {
|
Schema::create('indicators', function (Blueprint $table) {
|
||||||
$table->id();
|
$table->id();
|
||||||
$table->string('name');
|
$table->string('name');
|
||||||
$table->string('description');
|
|
||||||
$table->timestamps();
|
$table->timestamps();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,9 +14,9 @@ public function up(): void
|
||||||
Schema::create('rule', function (Blueprint $table) {
|
Schema::create('rule', function (Blueprint $table) {
|
||||||
$table->id();
|
$table->id();
|
||||||
$table->unsignedBigInteger('indicator_id');
|
$table->unsignedBigInteger('indicator_id');
|
||||||
$table->float('ideal_min');
|
$table->string('parameter_type');
|
||||||
$table->float('ideal_max');
|
$table->string('description');
|
||||||
$table->float('mb');
|
$table->float('cf');
|
||||||
$table->timestamps();
|
$table->timestamps();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -14,11 +14,11 @@ class IndicatorSeeder extends Seeder
|
||||||
public function run(): void
|
public function run(): void
|
||||||
{
|
{
|
||||||
$indicator = [
|
$indicator = [
|
||||||
['name' => 'pH Tanah', 'description' => 'Indicator 1 Description'],
|
['name' => 'pH Tanah'],
|
||||||
['name' => 'Ketinggian Tempat', 'description' => 'Indicator 2 Description'],
|
['name' => 'Ketinggian Tempat'],
|
||||||
['name' => 'Ketersediaan Air', 'description' => 'Indicator 3 Description'],
|
['name' => 'Ketersediaan Air'],
|
||||||
['name' => 'Curah Hujan', 'description' => 'Indicator 4 Description'],
|
['name' => 'Curah Hujan'],
|
||||||
['name' => 'Isolasi', 'description' => 'Indicator 5 Description']
|
['name' => 'Isolasi']
|
||||||
];
|
];
|
||||||
|
|
||||||
foreach ($indicator as $item) {
|
foreach ($indicator as $item) {
|
||||||
|
|
|
@ -14,11 +14,35 @@ class RuleSeeder extends Seeder
|
||||||
public function run(): void
|
public function run(): void
|
||||||
{
|
{
|
||||||
$rules = [
|
$rules = [
|
||||||
['indicator_id' => 1, 'ideal_min' => 5.5, 'ideal_max' => 7, 'mb' => 0.9],
|
// pH Tanah
|
||||||
['indicator_id' => 2, 'ideal_min' => 0, 'ideal_max' => 1500, 'mb' => 0.8],
|
['indicator_id' => 1, 'parameter_type' => "Sangat Asam", 'description' => "Tingkat keasaman pH tanah kurang dari 5.5", 'cf' => -0.6],
|
||||||
['indicator_id' => 3, 'ideal_min' => 70, 'ideal_max' => 100, 'mb' => 0.7],
|
['indicator_id' => 1, 'parameter_type' => "Asam", 'description' => "Tingkat keasaman pH tanah antara 5.5 - 6.0", 'cf' => 0.6],
|
||||||
['indicator_id' => 4, 'ideal_min' => 1000, 'ideal_max' => 2000, 'mb' => 0.9],
|
['indicator_id' => 1, 'parameter_type' => "Netral", 'description' => "Tingkat keasaman pH tanah antara 6.1 - 7.0", 'cf' => 1.0],
|
||||||
['indicator_id' => 5, 'ideal_min' => 0, 'ideal_max' => 100, 'mb' => 0.8],
|
['indicator_id' => 1, 'parameter_type' => "Basa", 'description' => "Tingkat keasaman pH tanah antara 7.1 - 7.5", 'cf' => 0.6],
|
||||||
|
['indicator_id' => 1, 'parameter_type' => "Sangat Basa", 'description' => "Tingkat keasaman pH tanah lebih besar dari 7.5", 'cf' => -0.4],
|
||||||
|
|
||||||
|
// Ketinggian Tempat
|
||||||
|
['indicator_id' => 2, 'parameter_type' => "Rendah", 'description' => "Lahan berada di dataran rendah (<300 mdpl)", 'cf' => 1.0],
|
||||||
|
['indicator_id' => 2, 'parameter_type' => "Sedang", 'description' => "Lahan berada di ketinggian sedang (300 - 700 mdpl)", 'cf' => 0.7],
|
||||||
|
['indicator_id' => 2, 'parameter_type' => "Tinggi", 'description' => "Lahan berada di dataran tinggi (>700 mdpl)", 'cf' => -0.5],
|
||||||
|
|
||||||
|
// Ketersediaan Air
|
||||||
|
['indicator_id' => 3, 'parameter_type' => "Berlimpah", 'description' => "Irigasi teknis, air selalu tersedia sepanjang tahun", 'cf' => 1.0],
|
||||||
|
['indicator_id' => 3, 'parameter_type' => "Cukup", 'description' => "Sumber air stabil, tetapi tidak selalu tersedia", 'cf' => 0.8],
|
||||||
|
['indicator_id' => 3, 'parameter_type' => "Terbatas", 'description' => "Kadang-kadang mengalami kekeringan", 'cf' => -0.5],
|
||||||
|
['indicator_id' => 3, 'parameter_type' => "Sangat Terbatas", 'description' => "Sering mengalami kekeringan", 'cf' => -0.8],
|
||||||
|
|
||||||
|
// Curah Hujan
|
||||||
|
['indicator_id' => 4, 'parameter_type' => "Rendah", 'description' => "Curah hujan kurang dari 1000 mm/tahun", 'cf' => -0.6],
|
||||||
|
['indicator_id' => 4, 'parameter_type' => "Sedang", 'description' => "Curah hujan antara 1000 - 1500 mm/tahun", 'cf' => 0.6],
|
||||||
|
['indicator_id' => 4, 'parameter_type' => "Tinggi", 'description' => "Curah hujan antara 1500 - 2000 mm/tahun", 'cf' => 0.8],
|
||||||
|
['indicator_id' => 4, 'parameter_type' => "Sangat Tinggi", 'description' => "Curah hujan lebih dari 2000 mm/tahun", 'cf' => -0.4],
|
||||||
|
|
||||||
|
// Isolasi (Jarak Antar Lahan)
|
||||||
|
['indicator_id' => 5, 'parameter_type' => "Sangat Baik", 'description' => "Jarak antar lahan sangat dekat (0 - 50 meter)", 'cf' => 1.0],
|
||||||
|
['indicator_id' => 5, 'parameter_type' => "Baik", 'description' => "Jarak antar lahan cukup dekat (50 - 200 meter)", 'cf' => 0.8],
|
||||||
|
['indicator_id' => 5, 'parameter_type' => "Sedang", 'description' => "Jarak antar lahan cukup jauh (200 - 500 meter)", 'cf' => -0.4],
|
||||||
|
['indicator_id' => 5, 'parameter_type' => "Buruk", 'description' => "Lahan sangat terisolasi (>500 meter)", 'cf' => -0.7],
|
||||||
];
|
];
|
||||||
|
|
||||||
foreach ($rules as $rule) {
|
foreach ($rules as $rule) {
|
||||||
|
|
|
@ -20,10 +20,8 @@ document.addEventListener("DOMContentLoaded", function () {
|
||||||
function updateData(indicator) {
|
function updateData(indicator) {
|
||||||
var form = document.getElementById("edit-form");
|
var form = document.getElementById("edit-form");
|
||||||
var indicatorName = form.querySelector('input[name="name"]');
|
var indicatorName = form.querySelector('input[name="name"]');
|
||||||
var description = form.querySelector('textarea[name="description"]');
|
|
||||||
|
|
||||||
indicatorName.value = indicator.name;
|
indicatorName.value = indicator.name;
|
||||||
description.value = indicator.description;
|
|
||||||
form.action = "/data-indikator/" + indicator.id;
|
form.action = "/data-indikator/" + indicator.id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -50,7 +48,7 @@ checkAll &&
|
||||||
});
|
});
|
||||||
var perPage = 8,
|
var perPage = 8,
|
||||||
options = {
|
options = {
|
||||||
valueNames: ["id", "indicator_name", "status"],
|
valueNames: ["id", "status"],
|
||||||
page: perPage,
|
page: perPage,
|
||||||
pagination: !0,
|
pagination: !0,
|
||||||
plugins: [ListPagination({ left: 2, right: 2 })],
|
plugins: [ListPagination({ left: 2, right: 2 })],
|
||||||
|
|
|
@ -61,7 +61,6 @@
|
||||||
<th class="sort" data-sort="indicator_name">
|
<th class="sort" data-sort="indicator_name">
|
||||||
Name
|
Name
|
||||||
</th>
|
</th>
|
||||||
<th class="sort" data-sort="description">Description</th>
|
|
||||||
<th class="sort" data-sort="action">Action</th>
|
<th class="sort" data-sort="action">Action</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
|
@ -73,9 +72,8 @@
|
||||||
<a href="javascript:void(0);"
|
<a href="javascript:void(0);"
|
||||||
class="fw-medium link-primary">#VZ2101</a>
|
class="fw-medium link-primary">#VZ2101</a>
|
||||||
</td>
|
</td>
|
||||||
<td class="indicator_name">{{ $indicator->name }}</td>
|
|
||||||
<td class="status">
|
<td class="status">
|
||||||
<span>{{ $indicator->description }}</span>
|
<span>{{ $indicator->name }}</span>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<div class="d-flex gap-2 justify-content-center">
|
<div class="d-flex gap-2 justify-content-center">
|
||||||
|
@ -151,7 +149,7 @@ class="fw-medium link-primary">#VZ2101</a>
|
||||||
readonly />
|
readonly />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="mb-3">
|
<div>
|
||||||
<label for="indicatorname-field" class="form-label">Indikator</label>
|
<label for="indicatorname-field" class="form-label">Indikator</label>
|
||||||
<input type="text" id="indicatorname-field" class="form-control" name="name"
|
<input type="text" id="indicatorname-field" class="form-control" name="name"
|
||||||
value="{{ old('name') }}" placeholder="Masukan Nama Indikator" required
|
value="{{ old('name') }}" placeholder="Masukan Nama Indikator" required
|
||||||
|
@ -160,15 +158,6 @@ class="fw-medium link-primary">#VZ2101</a>
|
||||||
Masukan Nama Indikator
|
Masukan Nama Indikator
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div>
|
|
||||||
<label for="description-field" class="form-label">Description</label>
|
|
||||||
<textarea name="description" id="description-field" id="description-field" rows="5" class="form-control"
|
|
||||||
placeholder="Masukan Deskripsi" required>{{ old('description') }}</textarea>
|
|
||||||
<div class="invalid-feedback">
|
|
||||||
Masukan Deskripsi
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
<div class="modal-footer">
|
<div class="modal-footer">
|
||||||
<div class="hstack gap-2 justify-content-end">
|
<div class="hstack gap-2 justify-content-end">
|
||||||
|
@ -205,7 +194,7 @@ class="fw-medium link-primary">#VZ2101</a>
|
||||||
readonly />
|
readonly />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="mb-3">
|
<div>
|
||||||
<label for="indicatorname-field" class="form-label">Indikator</label>
|
<label for="indicatorname-field" class="form-label">Indikator</label>
|
||||||
<input type="text" id="indicatorname-field" class="form-control" name="name"
|
<input type="text" id="indicatorname-field" class="form-control" name="name"
|
||||||
value="{{ old('name') }}" placeholder="Masukan Nama Indikator" required
|
value="{{ old('name') }}" placeholder="Masukan Nama Indikator" required
|
||||||
|
@ -214,15 +203,6 @@ class="fw-medium link-primary">#VZ2101</a>
|
||||||
Masukan Nama Indikator
|
Masukan Nama Indikator
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div>
|
|
||||||
<label for="description-field" class="form-label">Description</label>
|
|
||||||
<textarea name="description" id="description-field" id="description-field" rows="5" class="form-control"
|
|
||||||
placeholder="Masukan Deskripsi" required>{{ old('description') }}</textarea>
|
|
||||||
<div class="invalid-feedback">
|
|
||||||
Masukan Deskripsi
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
<div class="modal-footer">
|
<div class="modal-footer">
|
||||||
<div class="hstack gap-2 justify-content-end">
|
<div class="hstack gap-2 justify-content-end">
|
||||||
|
|
Loading…
Reference in New Issue