fix(master-rule): clear conflict
This commit is contained in:
commit
cb5b89e1b8
|
@ -0,0 +1 @@
|
||||||
|
{"version":1,"defects":{"Tests\\Unit\\CertaintyFactorTest::test_cf_combination_opposite_signs":7,"Tests\\Feature\\Auth\\AuthenticationTest::test_login_screen_can_be_rendered":8,"Tests\\Feature\\Auth\\AuthenticationTest::test_users_can_authenticate_using_the_login_screen":8,"Tests\\Feature\\Auth\\AuthenticationTest::test_users_can_not_authenticate_with_invalid_password":8,"Tests\\Feature\\Auth\\AuthenticationTest::test_users_can_logout":8,"Tests\\Feature\\Auth\\EmailVerificationTest::test_email_verification_screen_can_be_rendered":8,"Tests\\Feature\\Auth\\EmailVerificationTest::test_email_can_be_verified":8,"Tests\\Feature\\Auth\\EmailVerificationTest::test_email_is_not_verified_with_invalid_hash":8,"Tests\\Feature\\Auth\\PasswordConfirmationTest::test_confirm_password_screen_can_be_rendered":8,"Tests\\Feature\\Auth\\PasswordConfirmationTest::test_password_can_be_confirmed":8,"Tests\\Feature\\Auth\\PasswordConfirmationTest::test_password_is_not_confirmed_with_invalid_password":8,"Tests\\Feature\\Auth\\PasswordResetTest::test_reset_password_link_screen_can_be_rendered":8,"Tests\\Feature\\Auth\\PasswordResetTest::test_reset_password_link_can_be_requested":8,"Tests\\Feature\\Auth\\PasswordResetTest::test_reset_password_screen_can_be_rendered":8,"Tests\\Feature\\Auth\\PasswordResetTest::test_password_can_be_reset_with_valid_token":8,"Tests\\Feature\\Auth\\PasswordUpdateTest::test_password_can_be_updated":8,"Tests\\Feature\\Auth\\PasswordUpdateTest::test_correct_password_must_be_provided_to_update_password":8,"Tests\\Feature\\Auth\\RegistrationTest::test_registration_screen_can_be_rendered":8,"Tests\\Feature\\Auth\\RegistrationTest::test_new_users_can_register":8,"Tests\\Feature\\ProfileTest::test_profile_page_is_displayed":8,"Tests\\Feature\\ProfileTest::test_profile_information_can_be_updated":8,"Tests\\Feature\\ProfileTest::test_email_verification_status_is_unchanged_when_the_email_address_is_unchanged":8,"Tests\\Feature\\ProfileTest::test_user_can_delete_their_account":8,"Tests\\Feature\\ProfileTest::test_correct_password_must_be_provided_to_delete_account":8,"Tests\\Unit\\StoreEvaluationTest::test_store_saves_evaluation_successfully":8},"times":{"Tests\\Unit\\CertaintyFactorTest::test_cf_positive_combination":0.009,"Tests\\Unit\\CertaintyFactorTest::test_cf_negative_combination":0,"Tests\\Unit\\CertaintyFactorTest::test_cf_combination_opposite_signs":0.001,"Tests\\Unit\\ExampleTest::test_that_true_is_true":0.031,"Tests\\Feature\\ExampleTest::test_the_application_returns_a_successful_response":5.614,"Tests\\Unit\\StoreEvaluationTest::test_store_saves_evaluation_successfully":1.869}}
|
|
@ -6,8 +6,7 @@
|
||||||
use App\Models\EvaluationDetail;
|
use App\Models\EvaluationDetail;
|
||||||
use App\Models\Indicator;
|
use App\Models\Indicator;
|
||||||
use App\Models\Land;
|
use App\Models\Land;
|
||||||
use App\Models\Rule;
|
use App\Models\RuleExpert;
|
||||||
use Dotenv\Parser\Value;
|
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
use Illuminate\Support\Facades\DB;
|
use Illuminate\Support\Facades\DB;
|
||||||
use Illuminate\Support\Facades\Validator;
|
use Illuminate\Support\Facades\Validator;
|
||||||
|
@ -36,8 +35,9 @@ public function calculateCFc($cf1, $cf2)
|
||||||
|
|
||||||
public function store(Request $request)
|
public function store(Request $request)
|
||||||
{
|
{
|
||||||
|
dd($request->all());
|
||||||
$customMessages = [
|
$customMessages = [
|
||||||
'land.required' => 'Lahan tidak boleh kosong',
|
'land.required' => 'Harap pilih lahan',
|
||||||
'land.exists' => 'Lahan tidak ditemukan',
|
'land.exists' => 'Lahan tidak ditemukan',
|
||||||
];
|
];
|
||||||
|
|
||||||
|
@ -56,47 +56,33 @@ public function store(Request $request)
|
||||||
return redirect()->back();
|
return redirect()->back();
|
||||||
}
|
}
|
||||||
|
|
||||||
$cf_h = collect(Rule::whereIn('indicator_id', array_keys($cf_e))
|
$cf_h = RuleExpert::get()->keyBy('indicator_id')->pluck('cf', 'indicator_id')->toArray();
|
||||||
->orderByDesc('cf')
|
|
||||||
->get()
|
|
||||||
->unique('indicator_id')
|
|
||||||
->pluck('cf', 'indicator_id')
|
|
||||||
->sortKeys());
|
|
||||||
|
|
||||||
|
|
||||||
$cf_he = collect($cf_e)->map(function ($value, $key) use ($cf_h) {
|
$cf_he = collect($cf_e)->map(function ($value, $key) use ($cf_h) {
|
||||||
return [
|
return [
|
||||||
"cf(h,e)" . $key => (float) $value * (float) ($cf_h[$key] ?? 1)
|
"cf(h,e)" . $key => (float) $value * (float) ($cf_h[$key] ?? 1)
|
||||||
];
|
];
|
||||||
})->collapse();
|
})->collapse()->toArray();
|
||||||
|
|
||||||
$cf_he_array = $cf_he->toArray();
|
$cf_combined = array_shift($cf_he);
|
||||||
|
|
||||||
$cf_combined = array_shift($cf_he_array);
|
foreach ($cf_he as $cf) {
|
||||||
|
|
||||||
foreach ($cf_he_array as $cf) {
|
|
||||||
$cf_combined = $this->calculateCFc($cf_combined, $cf);
|
$cf_combined = $this->calculateCFc($cf_combined, $cf);
|
||||||
}
|
}
|
||||||
|
|
||||||
$cf_pakar = Rule::pluck('cf')->toArray();
|
$presentase = round($cf_combined * 100, 2);
|
||||||
|
|
||||||
$mean_cf = collect($cf_pakar)->avg();
|
if ($presentase < 0) {
|
||||||
$std_dev_cf = sqrt(collect($cf_pakar)->map(function ($cf) use ($mean_cf) {
|
$presentase = "minus";
|
||||||
return pow($cf - $mean_cf, 2);
|
|
||||||
})->avg());
|
|
||||||
|
|
||||||
$threshold_cocok = $mean_cf + $std_dev_cf;
|
|
||||||
$threshold_cocok_bersyarat = $mean_cf - $std_dev_cf;
|
|
||||||
|
|
||||||
if ($cf_combined > $threshold_cocok) {
|
|
||||||
$hasil = 'cocok';
|
|
||||||
} elseif ($cf_combined > $threshold_cocok_bersyarat) {
|
|
||||||
$hasil = 'cocok bersyarat';
|
|
||||||
} else {
|
|
||||||
$hasil = 'tidak cocok';
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// dd($cf_e, $cf_h, $cf_he, $cf_combined, $hasil);
|
if ($presentase >= 80 && $presentase < 99) {
|
||||||
|
$hasil = 'cocok';
|
||||||
|
} elseif ($presentase >= 62 && $presentase < 80) {
|
||||||
|
$hasil = 'cocok bersyarat';
|
||||||
|
} elseif ($presentase >= 42 && $presentase < 62) {
|
||||||
|
$hasil = 'tidak cocok';
|
||||||
|
}
|
||||||
|
|
||||||
$landName = Land::find($request->land)->owner;
|
$landName = Land::find($request->land)->owner;
|
||||||
|
|
||||||
|
@ -117,7 +103,7 @@ public function store(Request $request)
|
||||||
$evaluationDetail->save();
|
$evaluationDetail->save();
|
||||||
}
|
}
|
||||||
DB::commit();
|
DB::commit();
|
||||||
$presentase = round($cf_combined * 100, 2);
|
|
||||||
toast("Data berhasil disimpan.", "success")->position('top-right')->autoclose(3000);
|
toast("Data berhasil disimpan.", "success")->position('top-right')->autoclose(3000);
|
||||||
return redirect()->back()->with(['land' => $landName, 'presentase' => $presentase, 'hasil' => $hasil]);
|
return redirect()->back()->with(['land' => $landName, 'presentase' => $presentase, 'hasil' => $hasil]);
|
||||||
} catch (\Throwable $th) {
|
} catch (\Throwable $th) {
|
||||||
|
|
|
@ -9,7 +9,7 @@ class AssessmentHistoryController extends Controller
|
||||||
{
|
{
|
||||||
public function index()
|
public function index()
|
||||||
{
|
{
|
||||||
$evaluations = Evaluation::with(['land', 'evaluationDetails.indicator.rules' => function ($query) {
|
$evaluations = Evaluation::with(['land', 'user', 'evaluationDetails.indicator.rules' => function ($query) {
|
||||||
$query->whereHas('indicator.evaluationDetails', function ($subquery) {
|
$query->whereHas('indicator.evaluationDetails', function ($subquery) {
|
||||||
$subquery->whereColumn('rule.cf', 'evaluation_details.cf_e');
|
$subquery->whereColumn('rule.cf', 'evaluation_details.cf_e');
|
||||||
});
|
});
|
||||||
|
|
|
@ -69,12 +69,16 @@ public function createNewPasswordForm(Request $request)
|
||||||
public function storeNewPasswordForm(Request $request)
|
public function storeNewPasswordForm(Request $request)
|
||||||
{
|
{
|
||||||
$data = DB::table('password_reset_tokens')->where('email', $request->email)->first();
|
$data = DB::table('password_reset_tokens')->where('email', $request->email)->first();
|
||||||
|
|
||||||
if ($data == null || !Hash::check($request->token, $data->token)) {
|
if ($data == null || !Hash::check($request->token, $data->token)) {
|
||||||
toast('Link reset password tidak valid atau kedaluwarsa', 'error')->position('top')->autoclose(3000);
|
toast('Link reset password tidak valid atau kedaluwarsa', 'error')->position('top')->autoclose(3000);
|
||||||
return redirect()->back();
|
return redirect()->back();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($request->new_password != $request->confirm_password) {
|
||||||
|
toast('Konfirmasi Password tidak cocok', 'error')->position('top')->autoclose(3000);
|
||||||
|
return redirect()->back();
|
||||||
|
}
|
||||||
|
|
||||||
DB::beginTransaction();
|
DB::beginTransaction();
|
||||||
$user = User::where('email', $request->email)->first();
|
$user = User::where('email', $request->email)->first();
|
||||||
$user->password = Hash::make($request->new_password);
|
$user->password = Hash::make($request->new_password);
|
||||||
|
|
|
@ -18,6 +18,7 @@ public function create($email)
|
||||||
|
|
||||||
public function store(Request $request)
|
public function store(Request $request)
|
||||||
{
|
{
|
||||||
|
// dd($request->all());
|
||||||
DB::beginTransaction();
|
DB::beginTransaction();
|
||||||
try {
|
try {
|
||||||
$user = User::where('email', $request->email)->first();
|
$user = User::where('email', $request->email)->first();
|
||||||
|
@ -31,6 +32,10 @@ public function store(Request $request)
|
||||||
DB::commit();
|
DB::commit();
|
||||||
toast('Akun anda telah diaktifkan', 'success')->position('top')->autoclose(3000);
|
toast('Akun anda telah diaktifkan', 'success')->position('top')->autoclose(3000);
|
||||||
return redirect()->route('auth.login');
|
return redirect()->route('auth.login');
|
||||||
|
} else {
|
||||||
|
DB::rollBack();
|
||||||
|
toast('Kode verifikasi salah, silahkan priksa kembali', 'error')->position('top')->autoclose(3000);
|
||||||
|
return redirect()->back();
|
||||||
}
|
}
|
||||||
} catch (\Throwable $th) {
|
} catch (\Throwable $th) {
|
||||||
DB::rollBack();
|
DB::rollBack();
|
||||||
|
|
|
@ -0,0 +1,167 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Controllers;
|
||||||
|
|
||||||
|
use App\Models\Land;
|
||||||
|
use App\Models\LandDetails;
|
||||||
|
use App\Models\Province;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
use Illuminate\Support\Facades\Auth;
|
||||||
|
use Illuminate\Support\Facades\DB;
|
||||||
|
use Illuminate\Support\Facades\Validator;
|
||||||
|
|
||||||
|
class LandControllerOfficer extends Controller
|
||||||
|
{
|
||||||
|
public function index()
|
||||||
|
{
|
||||||
|
$lands = Land::with('province', 'regency', 'user')->where('user_id', auth()->id())->orderBy('created_at', 'desc')->get();
|
||||||
|
return view('master-data.lahan.index', compact('lands'));
|
||||||
|
}
|
||||||
|
|
||||||
|
public function create()
|
||||||
|
{
|
||||||
|
return view('master-data.lahan.create');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function store(Request $request)
|
||||||
|
{
|
||||||
|
$customMessage = [
|
||||||
|
'owner.required' => 'Nama pemilik wajib diisi',
|
||||||
|
'owner.max' => 'Nama pemilik maksimal 25 karakter',
|
||||||
|
'owner.string' => 'Nama pemilik harus berupa string',
|
||||||
|
|
||||||
|
'address.required' => 'Alamat wajib diisi',
|
||||||
|
'address.max' => 'Alamat maksimal 100 karakter',
|
||||||
|
'address.string' => 'Alamat harus berupa string',
|
||||||
|
|
||||||
|
'lat.required' => 'Latitude wajib diisi',
|
||||||
|
'lat.numeric' => 'Latitude harus berupa angka',
|
||||||
|
|
||||||
|
'lng.required' => 'Longitude wajib diisi',
|
||||||
|
'lng.numeric' => 'Longitude harus berupa angka',
|
||||||
|
|
||||||
|
'polygon.required' => 'Petak lahan wajib digambar',
|
||||||
|
];
|
||||||
|
|
||||||
|
$validator = Validator::make($request->all(), [
|
||||||
|
'owner' => 'required|string|max:25',
|
||||||
|
'address' => 'required|string|max:100',
|
||||||
|
'lat' => 'required|numeric',
|
||||||
|
'lng' => 'required|numeric',
|
||||||
|
'polygon' => 'required',
|
||||||
|
], $customMessage);
|
||||||
|
|
||||||
|
$polygon = json_decode($request->polygon, true);
|
||||||
|
|
||||||
|
if ($validator->fails()) {
|
||||||
|
toast($validator->messages()->all()[0], 'error')->position('top')->autoclose(3000);
|
||||||
|
return redirect()->back()->withInput();
|
||||||
|
}
|
||||||
|
|
||||||
|
DB::beginTransaction();
|
||||||
|
try {
|
||||||
|
$land = new Land();
|
||||||
|
$land->user_id = Auth::user()->id;
|
||||||
|
$land->owner = $request->owner;
|
||||||
|
$land->address = $request->address;
|
||||||
|
$land->save();
|
||||||
|
|
||||||
|
foreach ($polygon as $point) {
|
||||||
|
$landDetails = new LandDetails();
|
||||||
|
$landDetails->land_id = $land->id;
|
||||||
|
$landDetails->lat = $point['lat'];
|
||||||
|
$landDetails->lng = $point['lng'];
|
||||||
|
$landDetails->save();
|
||||||
|
}
|
||||||
|
DB::commit();
|
||||||
|
toast('Data berhasil disimpan', 'success')->position('top-right')->autoclose(3000);
|
||||||
|
|
||||||
|
return redirect()->route('lahan.index');
|
||||||
|
} catch (\Throwable $th) {
|
||||||
|
DB::rollBack();
|
||||||
|
toast('Terjadi kesalahan', 'error')->position('top')->autoclose(3000);
|
||||||
|
return redirect()->back();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function edit($id)
|
||||||
|
{
|
||||||
|
$land = Land::with('detailLands')->findOrFail($id);
|
||||||
|
$landDetails = $land->detailLands->map(function ($detail) {
|
||||||
|
return [
|
||||||
|
'lat' => $detail->lat,
|
||||||
|
'lng' => $detail->lng,
|
||||||
|
];
|
||||||
|
});
|
||||||
|
|
||||||
|
return view('master-data.lahan.edit', compact('id', 'land', 'landDetails'));
|
||||||
|
}
|
||||||
|
|
||||||
|
public function update(Request $request, $id)
|
||||||
|
{
|
||||||
|
$customMessage = [
|
||||||
|
'owner.required' => 'Nama pemilik wajib diisi',
|
||||||
|
'owner.max' => 'Nama pemilik maksimal 25 karakter',
|
||||||
|
'owner.string' => 'Nama pemilik harus berupa string',
|
||||||
|
|
||||||
|
'address.required' => 'Alamat wajib diisi',
|
||||||
|
'address.max' => 'Alamat maksimal 100 karakter',
|
||||||
|
'address.string' => 'Alamat harus berupa string',
|
||||||
|
|
||||||
|
'polygon.required' => 'Petak lahan wajib digambar',
|
||||||
|
];
|
||||||
|
|
||||||
|
$validator = Validator::make($request->all(), [
|
||||||
|
'owner' => 'required|string|max:25',
|
||||||
|
'address' => 'required|string|max:100',
|
||||||
|
'polygon' => 'required',
|
||||||
|
], $customMessage);
|
||||||
|
|
||||||
|
$polygon = json_decode($request->polygon, true);
|
||||||
|
|
||||||
|
if ($validator->fails()) {
|
||||||
|
toast($validator->messages()->all()[0], 'error')->position('top')->autoclose(3000);
|
||||||
|
return redirect()->back()->withInput();
|
||||||
|
}
|
||||||
|
|
||||||
|
DB::beginTransaction();
|
||||||
|
try {
|
||||||
|
$land = Land::findOrFail($id);
|
||||||
|
$land->user_id = Auth::user()->id;
|
||||||
|
$land->owner = $request->owner;
|
||||||
|
$land->address = $request->address;
|
||||||
|
$land->save();
|
||||||
|
|
||||||
|
LandDetails::where('land_id', $land->id)->delete();
|
||||||
|
|
||||||
|
foreach ($polygon as $point) {
|
||||||
|
$landDetails = new LandDetails();
|
||||||
|
$landDetails->land_id = $land->id;
|
||||||
|
$landDetails->lat = $point['lat'];
|
||||||
|
$landDetails->lng = $point['lng'];
|
||||||
|
$landDetails->save();
|
||||||
|
}
|
||||||
|
DB::commit();
|
||||||
|
toast('Data berhasil diubah', 'success')->position('top-right')->autoclose(3000);
|
||||||
|
|
||||||
|
return redirect()->route('lahan.index');
|
||||||
|
} catch (\Throwable $th) {
|
||||||
|
DB::rollBack();
|
||||||
|
toast('Terjadi kesalahan', 'error')->position('top')->autoclose(3000);
|
||||||
|
return redirect()->back();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function destroy($id)
|
||||||
|
{
|
||||||
|
$land = Land::find($id);
|
||||||
|
try {
|
||||||
|
$land->delete();
|
||||||
|
toast('Data berhasil dihapus', 'success')->position('top-right')->autoclose(3000);
|
||||||
|
return redirect()->back();
|
||||||
|
} catch (\Throwable $th) {
|
||||||
|
toast('Terjadi kesalahan', 'error')->position('top')->autoclose(3000);
|
||||||
|
return redirect()->back();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -21,8 +21,7 @@ public function index()
|
||||||
|
|
||||||
public function create()
|
public function create()
|
||||||
{
|
{
|
||||||
$provinces = Province::all();
|
return view('master-data.lahan.create');
|
||||||
return view('master-data.lahan.create', compact('provinces'));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function store(Request $request)
|
public function store(Request $request)
|
||||||
|
@ -32,36 +31,16 @@ public function store(Request $request)
|
||||||
'owner.max' => 'Nama pemilik maksimal 25 karakter',
|
'owner.max' => 'Nama pemilik maksimal 25 karakter',
|
||||||
'owner.string' => 'Nama pemilik harus berupa string',
|
'owner.string' => 'Nama pemilik harus berupa string',
|
||||||
|
|
||||||
'province_id.required' => 'Provinsi wajib diisi',
|
|
||||||
'province_id.exists' => 'Provinsi tidak ditemukan',
|
|
||||||
|
|
||||||
'regency_id.required' => 'Kota wajib diisi',
|
|
||||||
'regency_id.exists' => 'Kota tidak ditemukan',
|
|
||||||
|
|
||||||
'district_id.required' => 'Kecamatan wajib diisi',
|
|
||||||
'district_id.exists' => 'Kecamatan tidak ditemukan',
|
|
||||||
|
|
||||||
'address.required' => 'Alamat wajib diisi',
|
'address.required' => 'Alamat wajib diisi',
|
||||||
'address.max' => 'Alamat maksimal 100 karakter',
|
'address.max' => 'Alamat maksimal 100 karakter',
|
||||||
'address.string' => 'Alamat harus berupa string',
|
'address.string' => 'Alamat harus berupa string',
|
||||||
|
|
||||||
'lat.required' => 'Latitude wajib diisi',
|
|
||||||
'lat.numeric' => 'Latitude harus berupa angka',
|
|
||||||
|
|
||||||
'lng.required' => 'Longitude wajib diisi',
|
|
||||||
'lng.numeric' => 'Longitude harus berupa angka',
|
|
||||||
|
|
||||||
'polygon.required' => 'Petak lahan wajib digambar',
|
'polygon.required' => 'Petak lahan wajib digambar',
|
||||||
];
|
];
|
||||||
|
|
||||||
$validator = Validator::make($request->all(), [
|
$validator = Validator::make($request->all(), [
|
||||||
'owner' => 'required|string|max:25',
|
'owner' => 'required|string|max:25',
|
||||||
'province_id' => 'required|exists:provinces,id',
|
|
||||||
'regency_id' => 'required|exists:regencies,id',
|
|
||||||
'district_id' => 'required|exists:districts,id',
|
|
||||||
'address' => 'required|string|max:100',
|
'address' => 'required|string|max:100',
|
||||||
'lat' => 'required|numeric',
|
|
||||||
'lng' => 'required|numeric',
|
|
||||||
'polygon' => 'required',
|
'polygon' => 'required',
|
||||||
], $customMessage);
|
], $customMessage);
|
||||||
|
|
||||||
|
@ -77,12 +56,7 @@ public function store(Request $request)
|
||||||
$land = new Land();
|
$land = new Land();
|
||||||
$land->user_id = Auth::user()->id;
|
$land->user_id = Auth::user()->id;
|
||||||
$land->owner = $request->owner;
|
$land->owner = $request->owner;
|
||||||
$land->province_code = $request->province_id;
|
|
||||||
$land->regency_code = $request->regency_id;
|
|
||||||
$land->district_code = $request->district_id;
|
|
||||||
$land->address = $request->address;
|
$land->address = $request->address;
|
||||||
$land->latitude = $request->lat;
|
|
||||||
$land->longitude = $request->lng;
|
|
||||||
$land->save();
|
$land->save();
|
||||||
|
|
||||||
foreach ($polygon as $point) {
|
foreach ($polygon as $point) {
|
||||||
|
@ -110,7 +84,6 @@ public function store(Request $request)
|
||||||
public function edit($id)
|
public function edit($id)
|
||||||
{
|
{
|
||||||
$land = Land::with('detailLands')->findOrFail($id);
|
$land = Land::with('detailLands')->findOrFail($id);
|
||||||
$provinces = Province::all();
|
|
||||||
$landDetails = $land->detailLands->map(function ($detail) {
|
$landDetails = $land->detailLands->map(function ($detail) {
|
||||||
return [
|
return [
|
||||||
'lat' => $detail->lat,
|
'lat' => $detail->lat,
|
||||||
|
@ -118,7 +91,7 @@ public function edit($id)
|
||||||
];
|
];
|
||||||
});
|
});
|
||||||
|
|
||||||
return view('master-data.lahan.edit', compact('id', 'provinces', 'land', 'landDetails'));
|
return view('master-data.lahan.edit', compact('id', 'land', 'landDetails'));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function update(Request $request, $id)
|
public function update(Request $request, $id)
|
||||||
|
|
|
@ -15,7 +15,7 @@ class UserController extends Controller
|
||||||
{
|
{
|
||||||
public function index()
|
public function index()
|
||||||
{
|
{
|
||||||
$users = User::orderBy('created_at', 'desc')->get();
|
$users = User::where('role', '!=', 'admin')->orderBy('created_at', 'desc')->get();
|
||||||
return view('master-data.pengguna.index', compact('users'));
|
return view('master-data.pengguna.index', compact('users'));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -35,9 +35,6 @@ public function store(Request $request)
|
||||||
'email.email' => 'Email tidak valid',
|
'email.email' => 'Email tidak valid',
|
||||||
'email.unique' => 'Email sudah terdaftar',
|
'email.unique' => 'Email sudah terdaftar',
|
||||||
|
|
||||||
'role.required' => 'Role wajib diisi',
|
|
||||||
'role.in' => 'Role tidak valid',
|
|
||||||
|
|
||||||
'status.required' => 'Status wajib diisi',
|
'status.required' => 'Status wajib diisi',
|
||||||
'status.in' => 'Status tidak valid',
|
'status.in' => 'Status tidak valid',
|
||||||
];
|
];
|
||||||
|
@ -46,7 +43,6 @@ public function store(Request $request)
|
||||||
'fullname' => 'required|string|max:255',
|
'fullname' => 'required|string|max:255',
|
||||||
'username' => 'required|string|max:12',
|
'username' => 'required|string|max:12',
|
||||||
'email' => 'required|string|email|max:255|unique:users',
|
'email' => 'required|string|email|max:255|unique:users',
|
||||||
'role' => 'required|in:admin,user',
|
|
||||||
'status' => 'required|in:1,0',
|
'status' => 'required|in:1,0',
|
||||||
], $customMessage);
|
], $customMessage);
|
||||||
|
|
||||||
|
@ -59,8 +55,7 @@ public function store(Request $request)
|
||||||
$user->name = $request->fullname;
|
$user->name = $request->fullname;
|
||||||
$user->username = $request->username;
|
$user->username = $request->username;
|
||||||
$user->email = $request->email;
|
$user->email = $request->email;
|
||||||
$user->password = Hash::make("12344321");
|
$user->password = Hash::make("petugas123");
|
||||||
$user->role = $request->role;
|
|
||||||
|
|
||||||
if ($request->status == 0) {
|
if ($request->status == 0) {
|
||||||
$activationCode = Str::random(4);
|
$activationCode = Str::random(4);
|
||||||
|
@ -96,9 +91,6 @@ public function update(Request $request, $id)
|
||||||
'email.email' => 'Email tidak valid',
|
'email.email' => 'Email tidak valid',
|
||||||
'email.unique' => 'Email sudah terdaftar',
|
'email.unique' => 'Email sudah terdaftar',
|
||||||
|
|
||||||
'role.required' => 'Role wajib diisi',
|
|
||||||
'role.in' => 'Role tidak valid',
|
|
||||||
|
|
||||||
'status.required' => 'Status wajib diisi',
|
'status.required' => 'Status wajib diisi',
|
||||||
'status.in' => 'Status tidak valid',
|
'status.in' => 'Status tidak valid',
|
||||||
];
|
];
|
||||||
|
@ -107,7 +99,6 @@ public function update(Request $request, $id)
|
||||||
'fullname' => 'required|string|max:255',
|
'fullname' => 'required|string|max:255',
|
||||||
'username' => 'required|string|max:12',
|
'username' => 'required|string|max:12',
|
||||||
'email' => 'required|string|email|max:255|unique:users,email,' . $id,
|
'email' => 'required|string|email|max:255|unique:users,email,' . $id,
|
||||||
'role' => 'required|in:admin,user',
|
|
||||||
'status' => 'required|in:1,0',
|
'status' => 'required|in:1,0',
|
||||||
], $customMessage);
|
], $customMessage);
|
||||||
|
|
||||||
|
@ -120,7 +111,6 @@ public function update(Request $request, $id)
|
||||||
$user->name = $request->fullname;
|
$user->name = $request->fullname;
|
||||||
$user->username = $request->username;
|
$user->username = $request->username;
|
||||||
$user->email = $request->email;
|
$user->email = $request->email;
|
||||||
$user->role = $request->role;
|
|
||||||
$user->is_active = $request->status;
|
$user->is_active = $request->status;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
@ -132,7 +122,6 @@ public function update(Request $request, $id)
|
||||||
return redirect()->back();
|
return redirect()->back();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function destroy($id)
|
public function destroy($id)
|
||||||
{
|
{
|
||||||
$user = User::find($id);
|
$user = User::find($id);
|
||||||
|
|
|
@ -22,4 +22,9 @@ public function evaluationDetails()
|
||||||
{
|
{
|
||||||
return $this->hasMany(EvaluationDetail::class);
|
return $this->hasMany(EvaluationDetail::class);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function user()
|
||||||
|
{
|
||||||
|
return $this->belongsTo(User::class);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -69,7 +69,7 @@
|
||||||
|
|
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
'timezone' => 'UTC',
|
'timezone' => 'Asia/Jakarta',
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|--------------------------------------------------------------------------
|
|--------------------------------------------------------------------------
|
||||||
|
@ -82,7 +82,7 @@
|
||||||
|
|
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
'locale' => 'en',
|
'locale' => 'id',
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|--------------------------------------------------------------------------
|
|--------------------------------------------------------------------------
|
||||||
|
@ -95,7 +95,7 @@
|
||||||
|
|
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
'fallback_locale' => 'en',
|
'fallback_locale' => 'id',
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|--------------------------------------------------------------------------
|
|--------------------------------------------------------------------------
|
||||||
|
@ -108,7 +108,7 @@
|
||||||
|
|
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
'faker_locale' => 'en_US',
|
'faker_locale' => 'id_ID',
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|--------------------------------------------------------------------------
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
@ -1,31 +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('provinces', function (Blueprint $table) {
|
|
||||||
$table->id();
|
|
||||||
$table->string('name');
|
|
||||||
$table->string('alt_name');
|
|
||||||
$table->double('latitude');
|
|
||||||
$table->double('longitude');
|
|
||||||
$table->timestamps();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Reverse the migrations.
|
|
||||||
*/
|
|
||||||
public function down(): void
|
|
||||||
{
|
|
||||||
Schema::dropIfExists('provinces');
|
|
||||||
}
|
|
||||||
};
|
|
|
@ -1,36 +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('regencies', function (Blueprint $table) {
|
|
||||||
$table->id();
|
|
||||||
$table->unsignedBigInteger('province_id');
|
|
||||||
$table->string('name');
|
|
||||||
$table->string('alt_name');
|
|
||||||
$table->double('latitude');
|
|
||||||
$table->double('longitude');
|
|
||||||
$table->timestamps();
|
|
||||||
});
|
|
||||||
|
|
||||||
Schema::table('regencies', function (Blueprint $table) {
|
|
||||||
$table->foreign('province_id')->references('id')->on('provinces');
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Reverse the migrations.
|
|
||||||
*/
|
|
||||||
public function down(): void
|
|
||||||
{
|
|
||||||
Schema::dropIfExists('regencies');
|
|
||||||
}
|
|
||||||
};
|
|
|
@ -1,36 +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('districts', function (Blueprint $table) {
|
|
||||||
$table->id();
|
|
||||||
$table->unsignedBigInteger('regency_id');
|
|
||||||
$table->string('name');
|
|
||||||
$table->string('alt_name');
|
|
||||||
$table->double('latitude');
|
|
||||||
$table->double('longitude');
|
|
||||||
$table->timestamps();
|
|
||||||
});
|
|
||||||
|
|
||||||
Schema::table('districts', function (Blueprint $table) {
|
|
||||||
$table->foreign('regency_id')->references('id')->on('regencies');
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Reverse the migrations.
|
|
||||||
*/
|
|
||||||
public function down(): void
|
|
||||||
{
|
|
||||||
Schema::dropIfExists('districts');
|
|
||||||
}
|
|
||||||
};
|
|
|
@ -15,12 +15,7 @@ public function up(): void
|
||||||
$table->id();
|
$table->id();
|
||||||
$table->unsignedBigInteger('user_id');
|
$table->unsignedBigInteger('user_id');
|
||||||
$table->string('owner');
|
$table->string('owner');
|
||||||
$table->string('province_code');
|
|
||||||
$table->string('regency_code');
|
|
||||||
$table->string('district_code');
|
|
||||||
$table->string('address');
|
$table->string('address');
|
||||||
$table->string('latitude');
|
|
||||||
$table->string('longitude');
|
|
||||||
$table->timestamps();
|
$table->timestamps();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -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('rule_expert_cf', function (Blueprint $table) {
|
||||||
|
$table->id();
|
||||||
|
$table->unsignedBigInteger('indicator_id');
|
||||||
|
$table->string('parameter_type');
|
||||||
|
$table->string('description');
|
||||||
|
$table->float('cf');
|
||||||
|
$table->timestamps();
|
||||||
|
});
|
||||||
|
|
||||||
|
Schema::table('rule_expert_cf', function (Blueprint $table) {
|
||||||
|
$table->foreign('indicator_id')->references('id')->on('indicators')->onDelete('cascade');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*/
|
||||||
|
public function down(): void
|
||||||
|
{
|
||||||
|
Schema::dropIfExists('rule_expert_cf');
|
||||||
|
}
|
||||||
|
};
|
|
@ -3,6 +3,7 @@
|
||||||
namespace Database\Seeders;
|
namespace Database\Seeders;
|
||||||
|
|
||||||
// use Illuminate\Database\Console\Seeds\WithoutModelEvents;
|
// use Illuminate\Database\Console\Seeds\WithoutModelEvents;
|
||||||
|
|
||||||
use Illuminate\Database\Seeder;
|
use Illuminate\Database\Seeder;
|
||||||
|
|
||||||
class DatabaseSeeder extends Seeder
|
class DatabaseSeeder extends Seeder
|
||||||
|
@ -21,11 +22,9 @@ public function run(): void
|
||||||
|
|
||||||
$this->call([
|
$this->call([
|
||||||
UsersSeeder::class,
|
UsersSeeder::class,
|
||||||
ProvinceSeeder::class,
|
|
||||||
RegenciesSeeder::class,
|
|
||||||
// LandSeeder::class,
|
|
||||||
IndicatorSeeder::class,
|
IndicatorSeeder::class,
|
||||||
RuleSeeder::class
|
RuleSeeder::class,
|
||||||
|
RuleExpertSeeder::class
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,261 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
namespace Database\Seeders;
|
|
||||||
|
|
||||||
use App\Models\Province;
|
|
||||||
use Illuminate\Database\Console\Seeds\WithoutModelEvents;
|
|
||||||
use Illuminate\Database\Seeder;
|
|
||||||
|
|
||||||
class ProvinceSeeder extends Seeder
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* Run the database seeds.
|
|
||||||
*/
|
|
||||||
public function run(): void
|
|
||||||
{
|
|
||||||
$provinces = [
|
|
||||||
[
|
|
||||||
'id' => 11,
|
|
||||||
'name' => 'ACEH',
|
|
||||||
'alt_name' => 'ACEH',
|
|
||||||
'latitude' => 4.368550,
|
|
||||||
'longitude' => 97.025300,
|
|
||||||
],
|
|
||||||
[
|
|
||||||
'id' => 12,
|
|
||||||
'name' => 'SUMATERA UTARA',
|
|
||||||
'alt_name' => 'SUMATERA UTARA',
|
|
||||||
'latitude' => 2.192350,
|
|
||||||
'longitude' => 99.381220,
|
|
||||||
],
|
|
||||||
[
|
|
||||||
'id' => 13,
|
|
||||||
'name' => 'SUMATERA BARAT',
|
|
||||||
'alt_name' => 'SUMATERA BARAT',
|
|
||||||
'latitude' => -1.342250,
|
|
||||||
'longitude' => 100.076100,
|
|
||||||
],
|
|
||||||
[
|
|
||||||
'id' => 14,
|
|
||||||
'name' => 'RIAU',
|
|
||||||
'alt_name' => 'RIAU',
|
|
||||||
'latitude' => 0.500410,
|
|
||||||
'longitude' => 101.547580,
|
|
||||||
],
|
|
||||||
[
|
|
||||||
'id' => 15,
|
|
||||||
'name' => 'JAMBI',
|
|
||||||
'alt_name' => 'JAMBI',
|
|
||||||
'latitude' => -1.611570,
|
|
||||||
'longitude' => 102.779700,
|
|
||||||
],
|
|
||||||
[
|
|
||||||
'id' => 16,
|
|
||||||
'name' => 'SUMATERA SELATAN',
|
|
||||||
'alt_name' => 'SUMATERA SELATAN',
|
|
||||||
'latitude' => -3.126680,
|
|
||||||
'longitude' => 104.093060,
|
|
||||||
],
|
|
||||||
[
|
|
||||||
'id' => 17,
|
|
||||||
'name' => 'BENGKULU',
|
|
||||||
'alt_name' => 'BENGKULU',
|
|
||||||
'latitude' => -3.518680,
|
|
||||||
'longitude' => 102.535980,
|
|
||||||
],
|
|
||||||
[
|
|
||||||
'id' => 18,
|
|
||||||
'name' => 'LAMPUNG',
|
|
||||||
'alt_name' => 'LAMPUNG',
|
|
||||||
'latitude' => -4.855500,
|
|
||||||
'longitude' => 105.027300,
|
|
||||||
],
|
|
||||||
[
|
|
||||||
'id' => 19,
|
|
||||||
'name' => 'KEPULAUAN BANGKA BELITUNG',
|
|
||||||
'alt_name' => 'KEPULAUAN BANGKA BELITUNG',
|
|
||||||
'latitude' => -2.757750,
|
|
||||||
'longitude' => 107.583940,
|
|
||||||
],
|
|
||||||
[
|
|
||||||
'id' => 21,
|
|
||||||
'name' => 'KEPULAUAN RIAU',
|
|
||||||
'alt_name' => 'KEPULAUAN RIAU',
|
|
||||||
'latitude' => -0.154780,
|
|
||||||
'longitude' => 104.580370,
|
|
||||||
],
|
|
||||||
[
|
|
||||||
'id' => 31,
|
|
||||||
'name' => 'DKI JAKARTA',
|
|
||||||
'alt_name' => 'DKI JAKARTA',
|
|
||||||
'latitude' => 6.174500,
|
|
||||||
'longitude' => 106.822700,
|
|
||||||
],
|
|
||||||
[
|
|
||||||
'id' => 32,
|
|
||||||
'name' => 'JAWA BARAT',
|
|
||||||
'alt_name' => 'JAWA BARAT',
|
|
||||||
'latitude' => -6.889170,
|
|
||||||
'longitude' => 107.640470,
|
|
||||||
],
|
|
||||||
[
|
|
||||||
'id' => 33,
|
|
||||||
'name' => 'JAWA TENGAH',
|
|
||||||
'alt_name' => 'JAWA TENGAH',
|
|
||||||
'latitude' => -7.303240,
|
|
||||||
'longitude' => 110.004410,
|
|
||||||
],
|
|
||||||
[
|
|
||||||
'id' => 34,
|
|
||||||
'name' => 'DI YOGYAKARTA',
|
|
||||||
'alt_name' => 'DI YOGYAKARTA',
|
|
||||||
'latitude' => 7.795600,
|
|
||||||
'longitude' => 110.369500,
|
|
||||||
],
|
|
||||||
[
|
|
||||||
'id' => 35,
|
|
||||||
'name' => 'JAWA TIMUR',
|
|
||||||
'alt_name' => 'JAWA TIMUR',
|
|
||||||
'latitude' => -6.968510,
|
|
||||||
'longitude' => 113.980050,
|
|
||||||
],
|
|
||||||
[
|
|
||||||
'id' => 36,
|
|
||||||
'name' => 'BANTEN',
|
|
||||||
'alt_name' => 'BANTEN',
|
|
||||||
'latitude' => -6.445380,
|
|
||||||
'longitude' => 106.137560,
|
|
||||||
],
|
|
||||||
[
|
|
||||||
'id' => 51,
|
|
||||||
'name' => 'BALI',
|
|
||||||
'alt_name' => 'BALI',
|
|
||||||
'latitude' => -8.235660,
|
|
||||||
'longitude' => 115.122390,
|
|
||||||
],
|
|
||||||
[
|
|
||||||
'id' => 52,
|
|
||||||
'name' => 'NUSA TENGGARA BARAT',
|
|
||||||
'alt_name' => 'NUSA TENGGARA BARAT',
|
|
||||||
'latitude' => -8.121790,
|
|
||||||
'longitude' => 117.636960,
|
|
||||||
],
|
|
||||||
[
|
|
||||||
'id' => 53,
|
|
||||||
'name' => 'NUSA TENGGARA TIMUR',
|
|
||||||
'alt_name' => 'NUSA TENGGARA TIMUR',
|
|
||||||
'latitude' => -8.565680,
|
|
||||||
'longitude' => 120.697860,
|
|
||||||
],
|
|
||||||
[
|
|
||||||
'id' => 61,
|
|
||||||
'name' => 'KALIMANTAN BARAT',
|
|
||||||
'alt_name' => 'KALIMANTAN BARAT',
|
|
||||||
'latitude' => -0.132240,
|
|
||||||
'longitude' => 111.096890,
|
|
||||||
],
|
|
||||||
[
|
|
||||||
'id' => 62,
|
|
||||||
'name' => 'KALIMANTAN TENGAH',
|
|
||||||
'alt_name' => 'KALIMANTAN TENGAH',
|
|
||||||
'latitude' => -1.499580,
|
|
||||||
'longitude' => 113.290330,
|
|
||||||
],
|
|
||||||
[
|
|
||||||
'id' => 63,
|
|
||||||
'name' => 'KALIMANTAN SELATAN',
|
|
||||||
'alt_name' => 'KALIMANTAN SELATAN',
|
|
||||||
'latitude' => -2.943480,
|
|
||||||
'longitude' => 115.375650,
|
|
||||||
],
|
|
||||||
[
|
|
||||||
'id' => 64,
|
|
||||||
'name' => 'KALIMANTAN TIMUR',
|
|
||||||
'alt_name' => 'KALIMANTAN TIMUR',
|
|
||||||
'latitude' => 0.788440,
|
|
||||||
'longitude' => 116.242000,
|
|
||||||
],
|
|
||||||
[
|
|
||||||
'id' => 65,
|
|
||||||
'name' => 'KALIMANTAN UTARA',
|
|
||||||
'alt_name' => 'KALIMANTAN UTARA',
|
|
||||||
'latitude' => 2.725940,
|
|
||||||
'longitude' => 116.911000,
|
|
||||||
],
|
|
||||||
[
|
|
||||||
'id' => 71,
|
|
||||||
'name' => 'SULAWESI UTARA',
|
|
||||||
'alt_name' => 'SULAWESI UTARA',
|
|
||||||
'latitude' => 0.655570,
|
|
||||||
'longitude' => 124.090150,
|
|
||||||
],
|
|
||||||
[
|
|
||||||
'id' => 72,
|
|
||||||
'name' => 'SULAWESI TENGAH',
|
|
||||||
'alt_name' => 'SULAWESI TENGAH',
|
|
||||||
'latitude' => -1.693780,
|
|
||||||
'longitude' => 120.808860,
|
|
||||||
],
|
|
||||||
[
|
|
||||||
'id' => 73,
|
|
||||||
'name' => 'SULAWESI SELATAN',
|
|
||||||
'alt_name' => 'SULAWESI SELATAN',
|
|
||||||
'latitude' => -3.644670,
|
|
||||||
'longitude' => 119.947190,
|
|
||||||
],
|
|
||||||
[
|
|
||||||
'id' => 74,
|
|
||||||
'name' => 'SULAWESI TENGGARA',
|
|
||||||
'alt_name' => 'SULAWESI TENGGARA',
|
|
||||||
'latitude' => -3.549120,
|
|
||||||
'longitude' => 121.727960,
|
|
||||||
],
|
|
||||||
[
|
|
||||||
'id' => 75,
|
|
||||||
'name' => 'GORONTALO',
|
|
||||||
'alt_name' => 'GORONTALO',
|
|
||||||
'latitude' => 0.718620,
|
|
||||||
'longitude' => 122.455590,
|
|
||||||
],
|
|
||||||
[
|
|
||||||
'id' => 76,
|
|
||||||
'name' => 'SULAWESI BARAT',
|
|
||||||
'alt_name' => 'SULAWESI BARAT',
|
|
||||||
'latitude' => -2.497450,
|
|
||||||
'longitude' => 119.391900,
|
|
||||||
],
|
|
||||||
[
|
|
||||||
'id' => 81,
|
|
||||||
'name' => 'MALUKU',
|
|
||||||
'alt_name' => 'MALUKU',
|
|
||||||
'latitude' => -3.118840,
|
|
||||||
'longitude' => 129.420780,
|
|
||||||
],
|
|
||||||
[
|
|
||||||
'id' => 82,
|
|
||||||
'name' => 'MALUKU UTARA',
|
|
||||||
'alt_name' => 'MALUKU UTARA',
|
|
||||||
'latitude' => 0.630120,
|
|
||||||
'longitude' => 127.972020,
|
|
||||||
],
|
|
||||||
[
|
|
||||||
'id' => 91,
|
|
||||||
'name' => 'PAPUA BARAT',
|
|
||||||
'alt_name' => 'PAPUA BARAT',
|
|
||||||
'latitude' => -1.384240,
|
|
||||||
'longitude' => 132.902530,
|
|
||||||
],
|
|
||||||
[
|
|
||||||
'id' => 94,
|
|
||||||
'name' => 'PAPUA',
|
|
||||||
'alt_name' => 'PAPUA',
|
|
||||||
'latitude' => -3.988570,
|
|
||||||
'longitude' => 138.348530,
|
|
||||||
],
|
|
||||||
];
|
|
||||||
|
|
||||||
foreach ($provinces as $province) {
|
|
||||||
Province::create($province);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,28 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Database\Seeders;
|
||||||
|
|
||||||
|
use App\Models\RuleExpert;
|
||||||
|
use Illuminate\Database\Console\Seeds\WithoutModelEvents;
|
||||||
|
use Illuminate\Database\Seeder;
|
||||||
|
|
||||||
|
class RuleExpertSeeder extends Seeder
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Run the database seeds.
|
||||||
|
*/
|
||||||
|
public function run(): void
|
||||||
|
{
|
||||||
|
$rules = [
|
||||||
|
['indicator_id' => 1, 'parameter_type' => "Ideal", 'description' => "Tingkat keasaman pH tanah antara 6.0 - 7.0", 'cf' => 0.2],
|
||||||
|
['indicator_id' => 2, 'parameter_type' => "Sedang", 'description' => "Lahan berada di ketinggian sedang (800 - 1200 mdpl)", 'cf' => 0.4],
|
||||||
|
['indicator_id' => 3, 'parameter_type' => "Berlimpah", 'description' => "Irigasi teknis, air selalu tersedia sepanjang tahun", 'cf' => 0.6],
|
||||||
|
['indicator_id' => 4, 'parameter_type' => "Sedang", 'description' => "Curah hujan antara 1000 - 1500 mm/tahun", 'cf' => 0.6],
|
||||||
|
['indicator_id' => 5, 'parameter_type' => "Jauh", 'description' => "Jarak antar lahan jauh > 400 meter", 'cf' => 0.8],
|
||||||
|
];
|
||||||
|
|
||||||
|
foreach ($rules as $rule) {
|
||||||
|
RuleExpert::create($rule);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -15,29 +15,29 @@ public function run(): void
|
||||||
{
|
{
|
||||||
$rules = [
|
$rules = [
|
||||||
// pH Tanah
|
// pH Tanah
|
||||||
['indicator_id' => 1, 'parameter_type' => "Asam", 'description' => "Tingkat keasaman pH tanah kurang dari 6", 'cf' => -0.6],
|
['indicator_id' => 1, 'parameter_type' => "Ideal", 'description' => "Tingkat keasaman pH tanah antara 6.0 - 7.0", 'cf' => 1],
|
||||||
['indicator_id' => 1, 'parameter_type' => "Ideal", 'description' => "Tingkat keasaman pH tanah antara 6.0 - 7.0", 'cf' => 0.8],
|
['indicator_id' => 1, 'parameter_type' => "Asam", 'description' => "Tingkat keasaman pH tanah kurang dari 6", 'cf' => 0.6],
|
||||||
['indicator_id' => 1, 'parameter_type' => "Basa", 'description' => "Tingkat keasaman pH tanah lebih dari 7.0", 'cf' => -0.8],
|
['indicator_id' => 1, 'parameter_type' => "Basa", 'description' => "Tingkat keasaman pH tanah lebih dari 7.0", 'cf' => 0.2],
|
||||||
|
|
||||||
// Ketinggian Tempat
|
// Ketinggian Tempat
|
||||||
['indicator_id' => 2, 'parameter_type' => "Rendah", 'description' => "Lahan berada di dataran rendah (<800 mdpl)", 'cf' => 1],
|
['indicator_id' => 2, 'parameter_type' => "Rendah", 'description' => "Lahan berada di dataran rendah (<800 mdpl)", 'cf' => 1],
|
||||||
['indicator_id' => 2, 'parameter_type' => "Sedang", 'description' => "Lahan berada di ketinggian sedang (800 - 1200 mdpl)", 'cf' => 0.6],
|
['indicator_id' => 2, 'parameter_type' => "Sedang", 'description' => "Lahan berada di ketinggian sedang (800 - 1200 mdpl)", 'cf' => 0.6],
|
||||||
['indicator_id' => 2, 'parameter_type' => "Tinggi", 'description' => "Lahan berada di dataran tinggi (1200 - 1800 mdpl)", 'cf' => -0.6],
|
['indicator_id' => 2, 'parameter_type' => "Tinggi", 'description' => "Lahan berada di dataran tinggi (1200 - 1800 mdpl)", 'cf' => 0.2],
|
||||||
|
|
||||||
// Ketersediaan Air
|
// Ketersediaan Air
|
||||||
['indicator_id' => 3, 'parameter_type' => "Berlimpah", 'description' => "Irigasi teknis, air selalu tersedia sepanjang tahun", 'cf' => 1.0],
|
['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' => "Cukup", 'description' => "Sumber air stabil, tetapi tidak selalu tersedia", 'cf' => 0.6],
|
||||||
['indicator_id' => 3, 'parameter_type' => "Terbatas", 'description' => "Kadang-kadang mengalami kekeringan", 'cf' => -0.6],
|
['indicator_id' => 3, 'parameter_type' => "Terbatas", 'description' => "Kadang-kadang mengalami kekeringan", 'cf' => 0.2],
|
||||||
|
|
||||||
// Curah Hujan
|
// Curah Hujan
|
||||||
['indicator_id' => 4, 'parameter_type' => "Rendah", 'description' => "Curah hujan kurang dari 1000 mm/tahun", 'cf' => -0.4],
|
|
||||||
['indicator_id' => 4, 'parameter_type' => "Sedang", 'description' => "Curah hujan antara 1000 - 1500 mm/tahun", 'cf' => 1],
|
['indicator_id' => 4, 'parameter_type' => "Sedang", 'description' => "Curah hujan antara 1000 - 1500 mm/tahun", 'cf' => 1],
|
||||||
['indicator_id' => 4, 'parameter_type' => "Tinggi", 'description' => "Curah hujan antara 1500 - 2000 mm/tahun", 'cf' => 0.6],
|
['indicator_id' => 4, 'parameter_type' => "Rendah", 'description' => "Curah hujan kurang dari 1000 mm/tahun", 'cf' => 0.6],
|
||||||
|
['indicator_id' => 4, 'parameter_type' => "Tinggi", 'description' => "Curah hujan antara 1500 - 2000 mm/tahun", 'cf' => 0.2],
|
||||||
|
|
||||||
// Isolasi (Jarak Antar Lahan)
|
// Isolasi (Jarak Antar Lahan)
|
||||||
['indicator_id' => 5, 'parameter_type' => "Telalu Dekat", 'description' => "Jarak antar lahan sangat dekat < 250 meter", 'cf' => -0.6],
|
|
||||||
['indicator_id' => 5, 'parameter_type' => "Aman", 'description' => "Jarak antar lahan cukup jauh 250 - 400 meter", 'cf' => 0.8],
|
|
||||||
['indicator_id' => 5, 'parameter_type' => "Jauh", 'description' => "Jarak antar lahan jauh > 400 meter", 'cf' => 1.0],
|
['indicator_id' => 5, 'parameter_type' => "Jauh", 'description' => "Jarak antar lahan jauh > 400 meter", 'cf' => 1.0],
|
||||||
|
['indicator_id' => 5, 'parameter_type' => "Aman", 'description' => "Jarak antar lahan cukup jauh 250 - 400 meter", 'cf' => 0.6],
|
||||||
|
['indicator_id' => 5, 'parameter_type' => "Telalu Dekat", 'description' => "Jarak antar lahan sangat dekat < 250 meter", 'cf' => 0.2],
|
||||||
];
|
];
|
||||||
|
|
||||||
foreach ($rules as $rule) {
|
foreach ($rules as $rule) {
|
||||||
|
|
Binary file not shown.
After Width: | Height: | Size: 70 KiB |
|
@ -1,3 +1,52 @@
|
||||||
|
document.addEventListener("DOMContentLoaded", function () {
|
||||||
|
const form = document.getElementById("personalDetailsForm");
|
||||||
|
const submitBtn = document.getElementById("submit-btn");
|
||||||
|
const inputs = form.querySelectorAll(
|
||||||
|
'input[type="text"],input[type="email"],input[type="file"]'
|
||||||
|
);
|
||||||
|
|
||||||
|
submitBtn.disabled = true;
|
||||||
|
|
||||||
|
function isFormChanged() {
|
||||||
|
for (const input of inputs) {
|
||||||
|
const initial = input.dataset.initial;
|
||||||
|
const current =
|
||||||
|
input.type === "file" ? input.files.length > 0 : input.value;
|
||||||
|
|
||||||
|
if (initial !== undefined && current !== initial) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
inputs.forEach((input) => {
|
||||||
|
input.addEventListener("input", () => {
|
||||||
|
submitBtn.disabled = !isFormChanged();
|
||||||
|
});
|
||||||
|
|
||||||
|
if (input.type === "file") {
|
||||||
|
input.addEventListener("change", () => {
|
||||||
|
submitBtn.disabled = !isFormChanged();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
function setDataUser() {
|
||||||
|
const dataUser = document.getElementById("data-user").value;
|
||||||
|
const data = JSON.parse(dataUser);
|
||||||
|
const usernameElement = document.getElementById("username");
|
||||||
|
const fullnameElement = document.getElementById("name");
|
||||||
|
const emailElement = document.getElementById("email");
|
||||||
|
const submitBtn = document.getElementById("submit-btn");
|
||||||
|
|
||||||
|
submitBtn.disabled = true;
|
||||||
|
usernameElement.value = data.username;
|
||||||
|
fullnameElement.value = data.name;
|
||||||
|
emailElement.value = data.email;
|
||||||
|
}
|
||||||
|
|
||||||
function previewImage(event) {
|
function previewImage(event) {
|
||||||
var input = event.target;
|
var input = event.target;
|
||||||
var reader = new FileReader();
|
var reader = new FileReader();
|
||||||
|
|
|
@ -42,7 +42,9 @@ function setEvaluationToMap() {
|
||||||
.bindPopup(
|
.bindPopup(
|
||||||
`<div class="text-center font-semibold"><b> Hasil presentase CF pada lahan <br /> ${
|
`<div class="text-center font-semibold"><b> Hasil presentase CF pada lahan <br /> ${
|
||||||
evaluation.land.owner
|
evaluation.land.owner
|
||||||
}</br>${cfValue.toFixed(2)} %</b></div>`
|
}</br>"${evaluation.threshold_value}"<br/>${cfValue.toFixed(
|
||||||
|
2
|
||||||
|
)} %</b></div>`
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -44,7 +44,9 @@ function setEvaluationToMap() {
|
||||||
.bindPopup(
|
.bindPopup(
|
||||||
`<div class="text-center font-semibold"><b> Hasil presentase CF pada lahan <br /> ${
|
`<div class="text-center font-semibold"><b> Hasil presentase CF pada lahan <br /> ${
|
||||||
evaluation.land.owner
|
evaluation.land.owner
|
||||||
}</br>${cfValue.toFixed(2)} %</b></div>`
|
}</br>"${evaluation.threshold_value}"<br/>${cfValue.toFixed(
|
||||||
|
2
|
||||||
|
)} %</b></div>`
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,19 +1,24 @@
|
||||||
var checkAll = document.getElementById("checkAll");
|
document.addEventListener("DOMContentLoaded", function () {
|
||||||
checkAll &&
|
const indicatorField = document.getElementById("indicator-field");
|
||||||
(checkAll.onclick = function () {
|
const indicatorVal = new Choices(indicatorField);
|
||||||
for (
|
const indicatorEditField = document.getElementById("indicator-edit-field");
|
||||||
var e = document.querySelectorAll(
|
window.indicatorEditVal = new Choices(indicatorEditField);
|
||||||
'.form-check-all input[type="checkbox"]'
|
});
|
||||||
),
|
|
||||||
t = 0;
|
function updateData(rule) {
|
||||||
t < e.length;
|
var form = document.getElementById("edit-form");
|
||||||
t++
|
var categoryEditField = form.querySelector("#category-edit-field");
|
||||||
)
|
var description = form.querySelector("#description-edit-field");
|
||||||
(e[t].checked = this.checked),
|
var cf = form.querySelector("#cf-edit-field");
|
||||||
e[t].checked
|
form.action = "/data-aturan/" + rule.id;
|
||||||
? e[t].closest("tr").classList.add("table-active")
|
|
||||||
: e[t].closest("tr").classList.remove("table-active");
|
window.indicatorEditVal.setChoiceByValue(rule.indicator_id.toString());
|
||||||
});
|
window.indicatorEditVal.passedElement.element.value =
|
||||||
|
rule.indicator_id.toString();
|
||||||
|
categoryEditField.value = rule.parameter_type;
|
||||||
|
description.value = rule.description;
|
||||||
|
cf.value = rule.cf;
|
||||||
|
}
|
||||||
|
|
||||||
function updateData(data) {
|
function updateData(data) {
|
||||||
var form = document.getElementById("edit-form");
|
var form = document.getElementById("edit-form");
|
||||||
|
@ -89,6 +94,61 @@ function validateCfInput(input) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function validateCfInput(input) {
|
||||||
|
input.value = input.value.replace(",", ".");
|
||||||
|
|
||||||
|
input.value = input.value.replace(/[^0-9.\-]/g, "");
|
||||||
|
|
||||||
|
if (input.value.includes("-") && !input.value.startsWith("-")) {
|
||||||
|
input.value = input.value.replace("-", "");
|
||||||
|
}
|
||||||
|
|
||||||
|
input.value = input.value.replace(/-+/g, "-");
|
||||||
|
|
||||||
|
if (input.value === "-") {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (input.value.startsWith(".")) {
|
||||||
|
input.value = "0" + input.value;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (input.value.startsWith("-.")) {
|
||||||
|
input.value = "-0.";
|
||||||
|
}
|
||||||
|
|
||||||
|
// **PERBAIKAN**: Hilangkan nol berlebih di depan angka, kecuali nol sebelum titik
|
||||||
|
input.value = input.value.replace(/^(-?)0+(\d)/, "$1$2");
|
||||||
|
|
||||||
|
// **BATASI INPUT**: Hanya satu titik desimal, dan maksimal 1 angka setelah titik
|
||||||
|
let match = input.value.match(/^-?\d*(\.\d{0,1})?/);
|
||||||
|
if (match) {
|
||||||
|
input.value = match[0];
|
||||||
|
}
|
||||||
|
|
||||||
|
let numValue = parseFloat(input.value);
|
||||||
|
|
||||||
|
if (!isNaN(numValue)) {
|
||||||
|
let decimal = Math.abs(numValue * 10);
|
||||||
|
let lastDigit = decimal % 10;
|
||||||
|
|
||||||
|
if (lastDigit % 2 === 1) {
|
||||||
|
input.value = "";
|
||||||
|
alert("Nilai CF Tidak Sesuai");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// **Batasi nilai antara -1.0 dan 1.0**
|
||||||
|
if (!isNaN(numValue)) {
|
||||||
|
if (numValue > 1) {
|
||||||
|
input.value = "1.0";
|
||||||
|
} else if (numValue < -1) {
|
||||||
|
input.value = "-1.0";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
var perPage = 10,
|
var perPage = 10,
|
||||||
options = {
|
options = {
|
||||||
valueNames: ["id", "customer_name", "email", "date", "phone", "status"],
|
valueNames: ["id", "customer_name", "email", "date", "phone", "status"],
|
||||||
|
|
|
@ -1,5 +1,19 @@
|
||||||
var map, drawnItems, drawControl, googleHybrid, iconMarker;
|
var map, drawnItems, drawControl, googleHybrid, iconMarker;
|
||||||
var currentMarker = null;
|
var currentMarker = null;
|
||||||
|
var btnLocation = document.getElementById("location-btn");
|
||||||
|
var form = document.getElementById("add-form");
|
||||||
|
var addressContainer = form.querySelector("#address-container");
|
||||||
|
var addressField = form.querySelector("#address-field");
|
||||||
|
var mapContainer = form.querySelector("#map-container");
|
||||||
|
var latField = form.querySelector("#lat");
|
||||||
|
var lngField = form.querySelector("#lng");
|
||||||
|
var polygonField = form.querySelector("#polygon");
|
||||||
|
var loading = form.querySelector("#loading");
|
||||||
|
var btnContainer = form.querySelector("#add-footer");
|
||||||
|
|
||||||
|
document.addEventListener("DOMContentLoaded", function () {
|
||||||
|
initMap();
|
||||||
|
});
|
||||||
|
|
||||||
function initMap() {
|
function initMap() {
|
||||||
map = L.map("map", {
|
map = L.map("map", {
|
||||||
|
@ -57,200 +71,88 @@ function initMap() {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
var form = document.getElementById("add-form");
|
function fetchWithTimeout(url, options = {}, timeout = 10000) {
|
||||||
var provinceField = form.querySelector("#province-field");
|
return Promise.race([
|
||||||
var provinceVal = new Choices(provinceField);
|
fetch(url, options),
|
||||||
|
new Promise((_, reject) =>
|
||||||
|
setTimeout(
|
||||||
|
() =>
|
||||||
|
reject(new Error("Request timeout, periksa koneksi Anda")),
|
||||||
|
timeout
|
||||||
|
)
|
||||||
|
),
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
var regencyContainer = form.querySelector("#regency-container");
|
async function reverseGeocode(lat, lng) {
|
||||||
var regencyField = form.querySelector("#regency-field");
|
try {
|
||||||
var regencyVal = new Choices(regencyField, {
|
const response = await fetchWithTimeout(
|
||||||
shouldSort: false,
|
`https://nominatim.openstreetmap.org/reverse?lat=${lat}&lon=${lng}&format=json&accept-language=id`
|
||||||
});
|
);
|
||||||
|
const data = await response.json();
|
||||||
var districtContainer = form.querySelector("#district-container");
|
return data.display_name;
|
||||||
var districtField = form.querySelector("#district-field");
|
} catch (error) {
|
||||||
var districtVal = new Choices(districtField, {
|
return alert(`Error ` + error.message);
|
||||||
shouldSort: false,
|
|
||||||
});
|
|
||||||
|
|
||||||
var addressContainer = form.querySelector("#address-container");
|
|
||||||
var addressField = form.querySelector("#address-field");
|
|
||||||
|
|
||||||
var mapContainer = form.querySelector("#map-container");
|
|
||||||
var latField = form.querySelector("#lat");
|
|
||||||
var lngField = form.querySelector("#lng");
|
|
||||||
|
|
||||||
var polygonField = form.querySelector("#polygon");
|
|
||||||
var loading = form.querySelector("#loading");
|
|
||||||
|
|
||||||
var btnContainer = form.querySelector("#add-footer");
|
|
||||||
|
|
||||||
document.addEventListener("DOMContentLoaded", function () {
|
|
||||||
initMap();
|
|
||||||
if (provinceField.value !== "") {
|
|
||||||
getRegencies(provinceField.value);
|
|
||||||
}
|
}
|
||||||
});
|
|
||||||
|
|
||||||
function getRegencies(provinceId) {
|
|
||||||
regencyContainer.style.display = "none";
|
|
||||||
districtContainer.style.display = "none";
|
|
||||||
addressContainer.style.display = "none";
|
|
||||||
loading.style.display = "block";
|
|
||||||
mapContainer.style.display = "none";
|
|
||||||
|
|
||||||
const url = "/location/get-regency/" + provinceId;
|
|
||||||
$.ajax({
|
|
||||||
url: url,
|
|
||||||
type: "GET",
|
|
||||||
success: function (response) {
|
|
||||||
if (response.success) {
|
|
||||||
loading.style.display = "none";
|
|
||||||
const data = response.data;
|
|
||||||
|
|
||||||
regencyVal.clearStore();
|
|
||||||
regencyVal.clearChoices();
|
|
||||||
|
|
||||||
regencyVal.value = "";
|
|
||||||
regencyVal.setChoices([
|
|
||||||
{
|
|
||||||
value: "",
|
|
||||||
label: "Pilih Kabupaten",
|
|
||||||
selected: true,
|
|
||||||
disabled: true,
|
|
||||||
},
|
|
||||||
]);
|
|
||||||
|
|
||||||
if (Array.isArray(data)) {
|
|
||||||
regencyVal.setChoices(
|
|
||||||
data.map((regency) => ({
|
|
||||||
value: regency.id,
|
|
||||||
label: regency.name,
|
|
||||||
selected: false,
|
|
||||||
disabled: false,
|
|
||||||
}))
|
|
||||||
);
|
|
||||||
|
|
||||||
regencyContainer.style.display = "block";
|
|
||||||
} else {
|
|
||||||
mapContainer.style.display = "block";
|
|
||||||
mapContainer.innerHTML =
|
|
||||||
"<p class='text-center text-muted'>Terjadi kesalaahan saat mengambil data, silahkan coba beberapa saat lagi</p>";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
error: function (xhr, status, error) {
|
|
||||||
mapContainer.style.display = "block";
|
|
||||||
mapContainer.innerHTML =
|
|
||||||
"<p class='text-center text-muted'>Terjadi kesalaahan saat mengambil data, silahkan coba beberapa saat lagi</p>";
|
|
||||||
},
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function getDistricts(regencyId) {
|
function getLocation() {
|
||||||
districtContainer.style.display = "none";
|
|
||||||
addressContainer.style.display = "none";
|
|
||||||
loading.style.display = "block";
|
|
||||||
mapContainer.style.display = "none";
|
|
||||||
|
|
||||||
const url = "/location/get-district/" + regencyId;
|
|
||||||
$.ajax({
|
|
||||||
url: url,
|
|
||||||
type: "GET",
|
|
||||||
success: function (response) {
|
|
||||||
if (response.success) {
|
|
||||||
loading.style.display = "none";
|
|
||||||
const data = response.data;
|
|
||||||
|
|
||||||
districtVal.clearStore();
|
|
||||||
districtVal.clearChoices();
|
|
||||||
|
|
||||||
districtVal.value = "";
|
|
||||||
districtVal.setChoices([
|
|
||||||
{
|
|
||||||
value: "",
|
|
||||||
label: "Pilih Kecamatan",
|
|
||||||
selected: true,
|
|
||||||
disabled: true,
|
|
||||||
},
|
|
||||||
]);
|
|
||||||
|
|
||||||
if (Array.isArray(data)) {
|
|
||||||
districtVal.setChoices(
|
|
||||||
data.map((district) => ({
|
|
||||||
value: district.id,
|
|
||||||
label: district.name,
|
|
||||||
selected: false,
|
|
||||||
disabled: false,
|
|
||||||
}))
|
|
||||||
);
|
|
||||||
|
|
||||||
districtContainer.style.display = "block";
|
|
||||||
} else {
|
|
||||||
mapContainer.style.display = "block";
|
|
||||||
mapContainer.innerHTML =
|
|
||||||
"<p class='text-center text-muted'>Terjadi kesalaahan saat mengambil data, silahkan coba beberapa saat lagi</p>";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
error: function (xhr, status, error) {
|
|
||||||
mapContainer.style.display = "block";
|
|
||||||
mapContainer.innerHTML =
|
|
||||||
"<p class='text-center text-muted'>Terjadi kesalaahan saat mengambil data, silahkan coba beberapa saat lagi</p>";
|
|
||||||
},
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
function showmap(districtId) {
|
|
||||||
loading.style.display = "block";
|
|
||||||
if (!navigator.geolocation) {
|
if (!navigator.geolocation) {
|
||||||
alert("Geolocation tidak didukung oleh browser ini.");
|
alert("Geolocation tidak didukung oleh browser ini.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
btnLocation.innerHTML = ``;
|
||||||
|
btnLocation.innerHTML = `<span class="d-flex align-items-center">
|
||||||
|
<span class="flex-grow-1 me-2">
|
||||||
|
Loading...
|
||||||
|
</span>
|
||||||
|
<span class="spinner-border flex-shrink-0" role="status">
|
||||||
|
<span class="visually-hidden">Loading...</span>
|
||||||
|
</span>
|
||||||
|
</span>`;
|
||||||
|
btnLocation.disabled = true;
|
||||||
|
|
||||||
navigator.geolocation.getCurrentPosition(
|
navigator.geolocation.getCurrentPosition(
|
||||||
function (position) {
|
async function (position) {
|
||||||
loading.style.display = "none";
|
|
||||||
|
|
||||||
mapContainer.style.display = "block";
|
|
||||||
map.invalidateSize();
|
|
||||||
|
|
||||||
addressContainer.style.display = "block";
|
|
||||||
|
|
||||||
var lat = position.coords.latitude;
|
var lat = position.coords.latitude;
|
||||||
var lng = position.coords.longitude;
|
var lng = position.coords.longitude;
|
||||||
|
|
||||||
map.setView([lat, lng], 16);
|
try {
|
||||||
|
const address = await reverseGeocode(lat, lng);
|
||||||
|
btnLocation.classList.add("d-none");
|
||||||
|
addressContainer.style.display = "block";
|
||||||
|
mapContainer.style.display = "block";
|
||||||
|
map.invalidateSize();
|
||||||
|
|
||||||
if (currentMarker) {
|
addressField.value = address;
|
||||||
map.removeLayer(currentMarker);
|
|
||||||
|
map.setView([lat, lng], 16);
|
||||||
|
|
||||||
|
if (currentMarker) {
|
||||||
|
map.removeLayer(currentMarker);
|
||||||
|
}
|
||||||
|
|
||||||
|
currentMarker = L.marker([lat, lng], {
|
||||||
|
icon: iconMarker,
|
||||||
|
draggable: true,
|
||||||
|
}).addTo(map);
|
||||||
|
|
||||||
|
currentMarker.on("dragend", onPointerDragend);
|
||||||
|
|
||||||
|
currentMarker
|
||||||
|
.bindPopup(
|
||||||
|
`<div class="text-center"><b>Anda berada di sini</b><br />Silahkan tentukan petak lahan.<br />Pastikan lokasi anda sudah benar.</div>`
|
||||||
|
)
|
||||||
|
.openPopup();
|
||||||
|
|
||||||
|
latField.value = lat;
|
||||||
|
lngField.value = lng;
|
||||||
|
} catch (error) {
|
||||||
|
alert(`Error ` + error.message);
|
||||||
|
} finally {
|
||||||
|
btnLocation.disabled = false;
|
||||||
}
|
}
|
||||||
if (currentMarker || currentMarkerEdit) {
|
|
||||||
map.removeLayer(currentMarker);
|
|
||||||
}
|
|
||||||
|
|
||||||
var iconMarker = L.icon({
|
|
||||||
iconUrl: "/assets/images/marker.png",
|
|
||||||
iconSize: [50, 50],
|
|
||||||
iconAnchor: [25, 50],
|
|
||||||
popupAnchor: [0, -50],
|
|
||||||
});
|
|
||||||
|
|
||||||
currentMarker = L.marker([lat, lng], {
|
|
||||||
icon: iconMarker,
|
|
||||||
draggable: true,
|
|
||||||
}).addTo(map);
|
|
||||||
|
|
||||||
currentMarker.on("dragend", onPointerDragend);
|
|
||||||
|
|
||||||
currentMarker
|
|
||||||
.bindPopup(
|
|
||||||
`<div class="text-center"><b>Anda berada di sini</b><br />Silahkan tentukan petak lahan.<br />Pastikan lokasi anda sudah benar.</div>`
|
|
||||||
)
|
|
||||||
.openPopup();
|
|
||||||
|
|
||||||
latField.value = lat;
|
|
||||||
lngField.value = lng;
|
|
||||||
},
|
},
|
||||||
function (error) {
|
function (error) {
|
||||||
alert("Error: " + error.message);
|
alert("Error: " + error.message);
|
||||||
|
@ -258,9 +160,22 @@ function showmap(districtId) {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
function onPointerDragend() {
|
async function onPointerDragend() {
|
||||||
if (!currentMarker) return;
|
if (!currentMarker) return;
|
||||||
var coordinates = currentMarker.getLatLng();
|
var coordinates = currentMarker.getLatLng();
|
||||||
|
loading.style.display = "block";
|
||||||
|
addressContainer.style.display = "none";
|
||||||
|
|
||||||
|
try {
|
||||||
|
const address = await reverseGeocode(coordinates.lat, coordinates.lng);
|
||||||
|
loading.style.display = "none";
|
||||||
|
addressContainer.style.display = "block";
|
||||||
|
addressField.value = address;
|
||||||
|
} catch (error) {
|
||||||
|
alert(`Error ` + error.message);
|
||||||
|
} finally {
|
||||||
|
loading.style.display = "none";
|
||||||
|
}
|
||||||
|
|
||||||
currentMarker
|
currentMarker
|
||||||
.setLatLng(coordinates)
|
.setLatLng(coordinates)
|
||||||
|
@ -277,7 +192,6 @@ function handleDrawCreated(e) {
|
||||||
var layer = e.layer;
|
var layer = e.layer;
|
||||||
drawnItems.addLayer(layer);
|
drawnItems.addLayer(layer);
|
||||||
var coordinates = layer.getLatLngs()[0];
|
var coordinates = layer.getLatLngs()[0];
|
||||||
console.log("Koordinat Polygon:", coordinates);
|
|
||||||
polygonField.value = JSON.stringify(coordinates);
|
polygonField.value = JSON.stringify(coordinates);
|
||||||
|
|
||||||
layer.bindPopup("<b>Petak Lahan Berhasil Dibuat!</b>").openPopup();
|
layer.bindPopup("<b>Petak Lahan Berhasil Dibuat!</b>").openPopup();
|
||||||
|
@ -288,7 +202,6 @@ function handleDrawEdited(e) {
|
||||||
var layers = e.layers;
|
var layers = e.layers;
|
||||||
layers.eachLayer(function (layer) {
|
layers.eachLayer(function (layer) {
|
||||||
var coordinates = layer.getLatLngs();
|
var coordinates = layer.getLatLngs();
|
||||||
console.log("Koordinat setelah diedit:", coordinates);
|
|
||||||
polygonField.value = JSON.stringify(coordinates);
|
polygonField.value = JSON.stringify(coordinates);
|
||||||
|
|
||||||
layer.bindPopup("<b>Petak Lahan Berhasil Diedit!</b>").openPopup();
|
layer.bindPopup("<b>Petak Lahan Berhasil Diedit!</b>").openPopup();
|
||||||
|
|
|
@ -1,40 +1,47 @@
|
||||||
var mapEdit, drawnItems, drawControl, googleHybrid, iconMarker;
|
var mapEdit, drawnItems, drawControl, googleHybrid, iconMarker;
|
||||||
var currentMarkerEdit = null;
|
var currentMarkerEdit = null;
|
||||||
|
|
||||||
var formEdit = document.getElementById("edit-form");
|
var formEdit = document.getElementById("edit-form");
|
||||||
var provinceEditField = formEdit.querySelector("#province-edit-field");
|
|
||||||
var provinceEditVal = new Choices(provinceEditField);
|
|
||||||
|
|
||||||
var regencyEditContainer = formEdit.querySelector("#regency-edit-container");
|
|
||||||
let regencyCode = formEdit.querySelector("#regency-code").dataset.regency;
|
|
||||||
var regencyEditField = formEdit.querySelector("#regency-edit-field");
|
|
||||||
var regencyEditVal = new Choices(regencyEditField, {
|
|
||||||
shouldSort: false,
|
|
||||||
});
|
|
||||||
|
|
||||||
var districtEditContainer = formEdit.querySelector("#district-edit-container");
|
|
||||||
let districtCode = formEdit.querySelector("#district-code").dataset.district;
|
|
||||||
var districtEditField = formEdit.querySelector("#district-edit-field");
|
|
||||||
var districtEditVal = new Choices(districtEditField, {
|
|
||||||
shouldSort: false,
|
|
||||||
});
|
|
||||||
|
|
||||||
var addressEditContainer = formEdit.querySelector("#address-edit-container");
|
var addressEditContainer = formEdit.querySelector("#address-edit-container");
|
||||||
var addressEditField = formEdit.querySelector("#address-edit-field");
|
var addressEditField = formEdit.querySelector("#address-edit-field");
|
||||||
|
|
||||||
var mapEditConatiner = formEdit.querySelector("#map-edit-container");
|
var mapEditConatiner = formEdit.querySelector("#map-edit-container");
|
||||||
var latEditField = formEdit.querySelector("#lat-edit");
|
|
||||||
var lngEditField = formEdit.querySelector("#lng-edit");
|
|
||||||
var polygonField = formEdit.querySelector("#polygon-edit");
|
var polygonField = formEdit.querySelector("#polygon-edit");
|
||||||
|
|
||||||
let latDb = formEdit.querySelector("#lat-db").dataset.lat;
|
let latDb = formEdit.querySelector("#lat-db").dataset.lat;
|
||||||
let lngDb = formEdit.querySelector("#lng-db").dataset.lng;
|
let lngDb = formEdit.querySelector("#lng-db").dataset.lng;
|
||||||
let polygonDb = formEdit.querySelector("#polygon-db");
|
let polygonDb = formEdit.querySelector("#polygon-db");
|
||||||
let polygonData = polygonDb.getAttribute("data-polygon");
|
let polygonData = polygonDb.getAttribute("data-polygon");
|
||||||
|
|
||||||
var loadingEdit = formEdit.querySelector("#loading-edit");
|
var loadingEdit = formEdit.querySelector("#loading-edit");
|
||||||
var btnEditContainer = formEdit.querySelector("#edit-footer");
|
var btnEditContainer = formEdit.querySelector("#edit-footer");
|
||||||
|
|
||||||
|
document.addEventListener("DOMContentLoaded", function () {
|
||||||
|
initMapEdit();
|
||||||
|
setMapEdit();
|
||||||
|
});
|
||||||
|
|
||||||
|
function fetchWithTimeout(url, options = {}, timeout = 10000) {
|
||||||
|
return Promise.race([
|
||||||
|
fetch(url, options),
|
||||||
|
new Promise((_, reject) =>
|
||||||
|
setTimeout(
|
||||||
|
() =>
|
||||||
|
reject(new Error("Request timeout, periksa koneksi Anda")),
|
||||||
|
timeout
|
||||||
|
)
|
||||||
|
),
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
async function reverseGeocode(lat, lng) {
|
||||||
|
try {
|
||||||
|
const response = await fetchWithTimeout(
|
||||||
|
`https://nominatim.openstreetmap.org/reverse?lat=${lat}&lon=${lng}&format=json&accept-language=id`
|
||||||
|
);
|
||||||
|
const data = await response.json();
|
||||||
|
return data.display_name;
|
||||||
|
} catch (error) {
|
||||||
|
return alert(`Error ` + error.message);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function initMapEdit() {
|
function initMapEdit() {
|
||||||
mapEdit = L.map("map-edit", {
|
mapEdit = L.map("map-edit", {
|
||||||
attributionControl: false,
|
attributionControl: false,
|
||||||
|
@ -89,246 +96,43 @@ function initMapEdit() {
|
||||||
mapEdit.invalidateSize();
|
mapEdit.invalidateSize();
|
||||||
}
|
}
|
||||||
|
|
||||||
document.addEventListener("DOMContentLoaded", function () {
|
|
||||||
initMapEdit();
|
|
||||||
getRegencies(provinceEditField.value);
|
|
||||||
getDistricts(regencyCode);
|
|
||||||
setMapEdit();
|
|
||||||
});
|
|
||||||
|
|
||||||
function getProvinces(provinceId) {
|
|
||||||
return new Promise(function (resolve, reject) {
|
|
||||||
$.ajax({
|
|
||||||
url: "/location/get-province",
|
|
||||||
type: "GET",
|
|
||||||
success: function (response) {
|
|
||||||
if (response.success) {
|
|
||||||
const province = response.data.find(
|
|
||||||
(province) => province.id == provinceId
|
|
||||||
);
|
|
||||||
|
|
||||||
resolve(province);
|
|
||||||
} else {
|
|
||||||
reject(new Error("Terjadi kesalahan saat mengambil data"));
|
|
||||||
}
|
|
||||||
},
|
|
||||||
error: function (xhr, status, error) {
|
|
||||||
reject(new Error("Terjadi kesalahan saat mengambil data"));
|
|
||||||
},
|
|
||||||
});
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
function getRegencies(provinceId) {
|
|
||||||
regencyEditContainer.style.display = "none";
|
|
||||||
districtEditContainer.style.display = "none";
|
|
||||||
addressEditContainer.style.display = "none";
|
|
||||||
loadingEdit.style.display = "block";
|
|
||||||
mapEditConatiner.style.display = "none";
|
|
||||||
|
|
||||||
const url = "/location/get-regency/" + provinceId;
|
|
||||||
$.ajax({
|
|
||||||
url: url,
|
|
||||||
type: "GET",
|
|
||||||
success: function (response) {
|
|
||||||
if (response.success) {
|
|
||||||
loadingEdit.style.display = "none";
|
|
||||||
const data = response.data;
|
|
||||||
|
|
||||||
regencyEditVal.clearStore();
|
|
||||||
regencyEditVal.clearChoices();
|
|
||||||
|
|
||||||
regencyEditVal.value = "";
|
|
||||||
regencyEditVal.setChoices([
|
|
||||||
{
|
|
||||||
value: "",
|
|
||||||
label: "Pilih Kabupaten",
|
|
||||||
selected: false,
|
|
||||||
disabled: true,
|
|
||||||
},
|
|
||||||
]);
|
|
||||||
|
|
||||||
if (Array.isArray(data)) {
|
|
||||||
regencyEditVal.setChoices(
|
|
||||||
data.map((regency) => ({
|
|
||||||
value: regency.id,
|
|
||||||
label: regency.name,
|
|
||||||
selected: regency.id == regencyCode,
|
|
||||||
disabled: false,
|
|
||||||
}))
|
|
||||||
);
|
|
||||||
regencyEditContainer.style.display = "block";
|
|
||||||
} else {
|
|
||||||
mapEditConatiner.style.display = "block";
|
|
||||||
mapEditConatiner.innerHTML =
|
|
||||||
"<p class='text-center text-muted'>Terjadi kesalaahan saat mengambil data, silahkan coba beberapa saat lagi</p>";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
error: function (xhr, status, error) {
|
|
||||||
mapEditConatiner.style.display = "block";
|
|
||||||
mapEditConatiner.innerHTML =
|
|
||||||
"<p class='text-center text-muted'>Terjadi kesalaahan saat mengambil data, silahkan coba beberapa saat lagi</p>";
|
|
||||||
},
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
function getDistricts(regencyId) {
|
|
||||||
districtEditContainer.style.display = "none";
|
|
||||||
addressEditContainer.style.display = "none";
|
|
||||||
loadingEdit.style.display = "block";
|
|
||||||
mapEditConatiner.style.display = "none";
|
|
||||||
handleDrawDeleted();
|
|
||||||
|
|
||||||
const url = "/location/get-district/" + regencyId;
|
|
||||||
$.ajax({
|
|
||||||
url: url,
|
|
||||||
type: "GET",
|
|
||||||
success: function (response) {
|
|
||||||
if (response.success) {
|
|
||||||
loadingEdit.style.display = "none";
|
|
||||||
const data = response.data;
|
|
||||||
console.log(data);
|
|
||||||
|
|
||||||
districtEditVal.clearStore();
|
|
||||||
districtEditVal.clearChoices();
|
|
||||||
|
|
||||||
districtEditVal.value = "";
|
|
||||||
districtEditVal.setChoices([
|
|
||||||
{
|
|
||||||
value: "",
|
|
||||||
label: "Pilih Kecamatan",
|
|
||||||
selected: false,
|
|
||||||
disabled: true,
|
|
||||||
},
|
|
||||||
]);
|
|
||||||
|
|
||||||
if (Array.isArray(data)) {
|
|
||||||
districtEditVal.setChoices(
|
|
||||||
data.map((district) => ({
|
|
||||||
value: district.id,
|
|
||||||
label: district.name,
|
|
||||||
selected: district.id == districtCode,
|
|
||||||
disabled: false,
|
|
||||||
}))
|
|
||||||
);
|
|
||||||
districtEditContainer.style.display = "block";
|
|
||||||
} else {
|
|
||||||
mapEditConatiner.style.display = "block";
|
|
||||||
mapEditConatiner.innerHTML =
|
|
||||||
"<p class='text-center text-muted'>Terjadi kesalaahan saat mengambil data, silahkan coba beberapa saat lagi</p>";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
error: function (xhr, status, error) {
|
|
||||||
mapEditConatiner.style.display = "block";
|
|
||||||
mapEditConatiner.innerHTML =
|
|
||||||
"<p class='text-center text-muted'>Terjadi kesalaahan saat mengambil data, silahkan coba beberapa saat lagi</p>";
|
|
||||||
},
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
function showmap(districtId) {
|
|
||||||
loadingEdit.style.display = "block";
|
|
||||||
if (!navigator.geolocation) {
|
|
||||||
alert("Geolocation tidak didukung oleh browser ini.");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
navigator.geolocation.getCurrentPosition(
|
|
||||||
function (position) {
|
|
||||||
loadingEdit.style.display = "none";
|
|
||||||
|
|
||||||
mapEditConatiner.style.display = "block";
|
|
||||||
mapEdit.invalidateSize();
|
|
||||||
|
|
||||||
addressEditContainer.style.display = "block";
|
|
||||||
|
|
||||||
btnEditContainer.style.display = "block";
|
|
||||||
|
|
||||||
var lat = position.coords.latitude;
|
|
||||||
var lng = position.coords.longitude;
|
|
||||||
|
|
||||||
console.log(lat, lng);
|
|
||||||
|
|
||||||
mapEdit.setView([lat, lng], 16);
|
|
||||||
|
|
||||||
if (currentMarkerEdit) {
|
|
||||||
mapEdit.removeLayer(currentMarkerEdit);
|
|
||||||
}
|
|
||||||
|
|
||||||
var iconMarker = L.icon({
|
|
||||||
iconUrl: "/assets/images/marker.png",
|
|
||||||
iconSize: [50, 50],
|
|
||||||
iconAnchor: [25, 50],
|
|
||||||
popupAnchor: [0, -50],
|
|
||||||
});
|
|
||||||
|
|
||||||
currentMarkerEdit = L.marker([lat, lng], {
|
|
||||||
icon: iconMarker,
|
|
||||||
draggable: true,
|
|
||||||
}).addTo(mapEdit);
|
|
||||||
|
|
||||||
currentMarkerEdit.on("dragend", onPointerDragend);
|
|
||||||
|
|
||||||
currentMarkerEdit
|
|
||||||
.bindPopup(
|
|
||||||
`<div class="text-center"><b>Anda berada di sini</b><br />Silahkan tentukan petak lahan.<br />Pastikan lokasi anda sudah benar.</div>`
|
|
||||||
)
|
|
||||||
.openPopup();
|
|
||||||
|
|
||||||
latEditField.value = lat;
|
|
||||||
lngEditField.value = lng;
|
|
||||||
},
|
|
||||||
function (error) {
|
|
||||||
alert("Error: " + error.message);
|
|
||||||
}
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
function setMapEdit() {
|
function setMapEdit() {
|
||||||
loadingEdit.style.display = "block";
|
loadingEdit.style.display = "block";
|
||||||
|
|
||||||
mapEditConatiner.style.display = "block";
|
mapEditConatiner.style.display = "block";
|
||||||
mapEdit.invalidateSize();
|
mapEdit.invalidateSize();
|
||||||
addressEditContainer.style.display = "block";
|
addressEditContainer.style.display = "block";
|
||||||
btnEditContainer.style.display = "block";
|
btnEditContainer.style.display = "block";
|
||||||
mapEdit.setView([latDb, lngDb], 16);
|
mapEdit.setView([latDb, lngDb], 16);
|
||||||
|
|
||||||
if (polygonData) {
|
if (polygonData) {
|
||||||
let coordinates = JSON.parse(polygonData);
|
let coordinates = JSON.parse(polygonData);
|
||||||
console.log("Polygon Data:", coordinates);
|
console.log("Polygon Data:", coordinates);
|
||||||
|
|
||||||
let latlngs = coordinates.map((point) => [point.lat, point.lng]);
|
let latlngs = coordinates.map((point) => [point.lat, point.lng]);
|
||||||
let polygon = L.polygon(latlngs, { color: "blue" }).addTo(mapEdit);
|
let polygon = L.polygon(latlngs, { color: "blue" }).addTo(mapEdit);
|
||||||
drawnItems.addLayer(polygon);
|
drawnItems.addLayer(polygon);
|
||||||
mapEdit.fitBounds(polygon.getBounds());
|
mapEdit.fitBounds(polygon.getBounds());
|
||||||
polygonField.value = JSON.stringify(coordinates);
|
polygonField.value = JSON.stringify(coordinates);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (currentMarkerEdit) {
|
if (currentMarkerEdit) {
|
||||||
mapEdit.removeLayer(currentMarkerEdit);
|
mapEdit.removeLayer(currentMarkerEdit);
|
||||||
}
|
}
|
||||||
|
|
||||||
var iconMarker = L.icon({
|
var iconMarker = L.icon({
|
||||||
iconUrl: "/assets/images/marker.png",
|
iconUrl: "/assets/images/marker.png",
|
||||||
iconSize: [50, 50],
|
iconSize: [50, 50],
|
||||||
iconAnchor: [25, 50],
|
iconAnchor: [25, 50],
|
||||||
popupAnchor: [0, -50],
|
popupAnchor: [0, -50],
|
||||||
});
|
});
|
||||||
|
|
||||||
currentMarkerEdit = L.marker([latDb, lngDb], {
|
currentMarkerEdit = L.marker([latDb, lngDb], {
|
||||||
icon: iconMarker,
|
icon: iconMarker,
|
||||||
draggable: true,
|
draggable: true,
|
||||||
}).addTo(mapEdit);
|
}).addTo(mapEdit);
|
||||||
|
|
||||||
currentMarkerEdit.on("dragend", onPointerDragend);
|
currentMarkerEdit.on("dragend", onPointerDragend);
|
||||||
|
|
||||||
currentMarkerEdit
|
currentMarkerEdit
|
||||||
.bindPopup(
|
.bindPopup(
|
||||||
`<div class="text-center"><b>Anda berada di sini</b><br />Silahkan tentukan petak lahan.<br />Pastikan lokasi anda sudah benar.</div>`
|
`<div class="text-center"><b>Anda berada di sini</b><br />Silahkan tentukan petak lahan.<br />Pastikan lokasi anda sudah benar.</div>`
|
||||||
)
|
)
|
||||||
.openPopup();
|
.openPopup();
|
||||||
|
|
||||||
|
loadingEdit.style.display = "none";
|
||||||
}
|
}
|
||||||
|
|
||||||
function handleDrawCreated(e) {
|
function handleDrawCreated(e) {
|
||||||
|
@ -358,16 +162,28 @@ function handleDrawDeleted(e) {
|
||||||
polygonField.value = "";
|
polygonField.value = "";
|
||||||
}
|
}
|
||||||
|
|
||||||
function onPointerDragend() {
|
async function onPointerDragend() {
|
||||||
if (!currentMarkerEdit) return;
|
if (!currentMarkerEdit) return;
|
||||||
var coordinates = currentMarkerEdit.getLatLng();
|
var coordinates = currentMarkerEdit.getLatLng();
|
||||||
|
loadingEdit.style.display = "block";
|
||||||
|
addressEditContainer.style.display = "none";
|
||||||
|
btnEditContainer.style.display = "none";
|
||||||
|
|
||||||
|
try {
|
||||||
|
const address = await reverseGeocode(coordinates.lat, coordinates.lng);
|
||||||
|
loadingEdit.style.display = "none";
|
||||||
|
addressEditContainer.style.display = "block";
|
||||||
|
addressEditField.value = address;
|
||||||
|
} catch (error) {
|
||||||
|
alert(`Error ` + error.message);
|
||||||
|
} finally {
|
||||||
|
loadingEdit.style.display = "none";
|
||||||
|
btnEditContainer.style.display = "block";
|
||||||
|
}
|
||||||
currentMarkerEdit
|
currentMarkerEdit
|
||||||
.setLatLng(coordinates)
|
.setLatLng(coordinates)
|
||||||
.bindPopup(
|
.bindPopup(
|
||||||
`<div class="text-center"><b>Anda berada di sini</b><br />Silahkan tentukan petak lahan.<br />Pastikan lokasi anda sudah benar.</div>`
|
`<div class="text-center"><b>Anda berada di sini</b><br />Silahkan tentukan petak lahan.<br />Pastikan lokasi anda sudah benar.</div>`
|
||||||
)
|
)
|
||||||
.openPopup();
|
.openPopup();
|
||||||
|
|
||||||
latEditField.value = coordinates.lat;
|
|
||||||
lngEditField.value = coordinates.lng;
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,13 +3,11 @@ function updateData(user) {
|
||||||
var fullname = document.getElementById("fullname-edit-field");
|
var fullname = document.getElementById("fullname-edit-field");
|
||||||
var username = document.getElementById("username-edit-field");
|
var username = document.getElementById("username-edit-field");
|
||||||
var email = document.getElementById("email-edit-field");
|
var email = document.getElementById("email-edit-field");
|
||||||
var role = document.getElementById("role-edit-field");
|
|
||||||
var status = document.getElementById("status-edit-field");
|
var status = document.getElementById("status-edit-field");
|
||||||
|
|
||||||
fullname.value = user.name;
|
fullname.value = user.name;
|
||||||
username.value = user.username;
|
username.value = user.username;
|
||||||
email.value = user.email;
|
email.value = user.email;
|
||||||
role.value = user.role;
|
|
||||||
status.value = user.is_active;
|
status.value = user.is_active;
|
||||||
form.action = "/data-pengguna/" + user.id;
|
form.action = "/data-pengguna/" + user.id;
|
||||||
}
|
}
|
||||||
|
@ -37,7 +35,7 @@ checkAll &&
|
||||||
});
|
});
|
||||||
var perPage = 10,
|
var perPage = 10,
|
||||||
options = {
|
options = {
|
||||||
valueNames: ["id", "fullname", "email", "username", "role", "status"],
|
valueNames: ["id", "fullname", "email", "username", "status"],
|
||||||
page: perPage,
|
page: perPage,
|
||||||
pagination: !0,
|
pagination: !0,
|
||||||
plugins: [ListPagination({ left: 2, right: 2 })],
|
plugins: [ListPagination({ left: 2, right: 2 })],
|
||||||
|
|
|
@ -35,7 +35,7 @@
|
||||||
|
|
||||||
<div class="mb-3">
|
<div class="mb-3">
|
||||||
<label for="" class="form-label">Lahan</label>
|
<label for="" class="form-label">Lahan</label>
|
||||||
<select name="land" class="form-control" id="lahan-field" required>
|
<select name="land" class="form-control" id="lahan-field">
|
||||||
<option value="" selected disabled>Pilih Lahan</option>
|
<option value="" selected disabled>Pilih Lahan</option>
|
||||||
@foreach ($lands as $land)
|
@foreach ($lands as $land)
|
||||||
<option value="{{ $land->id }}">{{ $land->owner }}</option>
|
<option value="{{ $land->id }}">{{ $land->owner }}</option>
|
||||||
|
@ -84,7 +84,7 @@
|
||||||
Certainty
|
Certainty
|
||||||
Factor.</p>
|
Factor.</p>
|
||||||
<h1 class="mb-0 mt-2"><span class="counter-value"
|
<h1 class="mb-0 mt-2"><span class="counter-value"
|
||||||
data-target="{{ session('presentase') }}">0</span>%
|
data-target="{{ session('presentase') != 'minus' ? session('presentase') : '0' }}">0</span>%
|
||||||
</h1>
|
</h1>
|
||||||
@endif
|
@endif
|
||||||
@if (session('hasil') && session('land'))
|
@if (session('hasil') && session('land'))
|
||||||
|
|
|
@ -44,6 +44,9 @@
|
||||||
<th class="sort" data-sort="land_name">
|
<th class="sort" data-sort="land_name">
|
||||||
Nama Pemilik
|
Nama Pemilik
|
||||||
</th>
|
</th>
|
||||||
|
<th class="sort" data-sort="land_name">
|
||||||
|
Petugas
|
||||||
|
</th>
|
||||||
<th class="sort" data-sort="threshold">Rekomendasi</th>
|
<th class="sort" data-sort="threshold">Rekomendasi</th>
|
||||||
<th class="sort" data-sort="status">
|
<th class="sort" data-sort="status">
|
||||||
CF Value
|
CF Value
|
||||||
|
@ -60,10 +63,15 @@
|
||||||
class="fw-medium link-primary">#VZ2101</a>
|
class="fw-medium link-primary">#VZ2101</a>
|
||||||
</td>
|
</td>
|
||||||
<td class="customer_name">{{ $evaluation->land->owner }}</td>
|
<td class="customer_name">{{ $evaluation->land->owner }}</td>
|
||||||
|
<td class="customer_name">{{ $evaluation->user->name }}</td>
|
||||||
<td class="threshold text_capitalize">{{ $evaluation->threshold_value }}
|
<td class="threshold text_capitalize">{{ $evaluation->threshold_value }}
|
||||||
</td>
|
</td>
|
||||||
<td class="status">
|
<td class="status">
|
||||||
<span>{{ number_format($evaluation->cf_value, 4) * 100 }}%</span>
|
@if ($evaluation->cf_value < 0)
|
||||||
|
<span>0%<span>
|
||||||
|
@else
|
||||||
|
<span>{{ number_format($evaluation->cf_value, 4) * 100 }}%</span>
|
||||||
|
@endif
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<div class="d-flex gap-2 justify-content-center">
|
<div class="d-flex gap-2 justify-content-center">
|
||||||
|
|
|
@ -63,7 +63,11 @@ class="fw-medium link-primary">#VZ2101</a>
|
||||||
<td class="threshold text-capitalize">{{ $evaluation->threshold_value }}
|
<td class="threshold text-capitalize">{{ $evaluation->threshold_value }}
|
||||||
</td>
|
</td>
|
||||||
<td class="status">
|
<td class="status">
|
||||||
<span>{{ number_format($evaluation->cf_value, 2) * 100 }}%</span>
|
@if ($evaluation->cf_value < 0)
|
||||||
|
<span>0%<span>
|
||||||
|
@else
|
||||||
|
<span>{{ number_format($evaluation->cf_value, 2) * 100 }}%</span>
|
||||||
|
@endif
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<div class="d-flex gap-2 justify-content-center">
|
<div class="d-flex gap-2 justify-content-center">
|
||||||
|
|
|
@ -45,10 +45,10 @@
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-lg-12">
|
<div class="col-lg-12">
|
||||||
<div class="text-center mt-sm-5 mb-4 text-white-50">
|
<div class="text-center text-white-50">
|
||||||
<div>
|
<div>
|
||||||
<a href="index.html" class="d-inline-block auth-logo">
|
<a href="index.html" class="d-inline-block auth-logo">
|
||||||
<img src="assets/images/logo-light.png" alt="" height="20">
|
<img src="{{ 'assets/images/logo-fitfarm.png' }}" alt="" width="20%">
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -45,10 +45,10 @@
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-lg-12">
|
<div class="col-lg-12">
|
||||||
<div class="text-center mt-sm-5 mb-4 text-white-50">
|
<div class="text-center text-white-50">
|
||||||
<div>
|
<div>
|
||||||
<a href="index.html" class="d-inline-block auth-logo">
|
<a href="index.html" class="d-inline-block auth-logo">
|
||||||
<img src="assets/images/logo-light.png" alt="" height="20">
|
<img src="{{ 'assets/images/logo-fitfarm.png' }}" alt="" width="20%">
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -54,12 +54,14 @@ class="rounded-circle avatar-xl img-thumbnail user-profile-image"
|
||||||
@csrf
|
@csrf
|
||||||
@method('PUT')
|
@method('PUT')
|
||||||
<div class="row">
|
<div class="row">
|
||||||
|
<input type="hidden" id="data-user" value="{{ $user }}">
|
||||||
<div class="col-lg-6">
|
<div class="col-lg-6">
|
||||||
<div class="mb-3">
|
<div class="mb-3">
|
||||||
<label for="username" class="form-label">Username</label>
|
<label for="username" class="form-label">Username</label>
|
||||||
<input type="text" class="form-control" id="username"
|
<input type="text" class="form-control" id="username"
|
||||||
placeholder="Masukan username anda" name="username"
|
placeholder="Masukan username anda" name="username"
|
||||||
value="{{ old('username', $user->username) }}" required>
|
value="{{ old('username', $user->username) }}"
|
||||||
|
data-initial="{{ $user->username }}" required>
|
||||||
<div class="invalid-feedback">
|
<div class="invalid-feedback">
|
||||||
Harap masukan username anda
|
Harap masukan username anda
|
||||||
</div>
|
</div>
|
||||||
|
@ -71,7 +73,8 @@ class="rounded-circle avatar-xl img-thumbnail user-profile-image"
|
||||||
<label for="fullname" class="form-label">Nama Lengkap</label>
|
<label for="fullname" class="form-label">Nama Lengkap</label>
|
||||||
<input type="text" class="form-control" id="name"
|
<input type="text" class="form-control" id="name"
|
||||||
placeholder="Masukan nama lengkap anda" name="name"
|
placeholder="Masukan nama lengkap anda" name="name"
|
||||||
value="{{ old('name', $user->name) }}" required>
|
value="{{ old('name', $user->name) }}"
|
||||||
|
data-initial="{{ $user->name }}" required>
|
||||||
<div class="invalid-feedback">
|
<div class="invalid-feedback">
|
||||||
Harap masukan nama lengkap anda
|
Harap masukan nama lengkap anda
|
||||||
</div>
|
</div>
|
||||||
|
@ -83,7 +86,8 @@ class="rounded-circle avatar-xl img-thumbnail user-profile-image"
|
||||||
<label for="emailInput" class="form-label">Alamat Email</label>
|
<label for="emailInput" class="form-label">Alamat Email</label>
|
||||||
<input type="email" class="form-control" id="email"
|
<input type="email" class="form-control" id="email"
|
||||||
placeholder="Masukan alamat email anda" name="email"
|
placeholder="Masukan alamat email anda" name="email"
|
||||||
value="{{ old('email', $user->email) }}" required>
|
value="{{ old('email', $user->email) }}"
|
||||||
|
data-initial="{{ $user->email }}" required>
|
||||||
<div class="invalid-feedback">
|
<div class="invalid-feedback">
|
||||||
Harap masukan alamat email anda
|
Harap masukan alamat email anda
|
||||||
</div>
|
</div>
|
||||||
|
@ -101,8 +105,10 @@ class="rounded-circle avatar-xl img-thumbnail user-profile-image"
|
||||||
<!--end col-->
|
<!--end col-->
|
||||||
<div class="col-lg-12">
|
<div class="col-lg-12">
|
||||||
<div class="hstack gap-2 justify-content-end">
|
<div class="hstack gap-2 justify-content-end">
|
||||||
<button type="submit" class="btn btn-success">Ubah</button>
|
<button type="submit" class="btn btn-success" id="submit-btn"
|
||||||
<button type="button" class="btn btn-soft-secondary">Batal</button>
|
disabled>Ubah</button>
|
||||||
|
<button type="button" class="btn btn-soft-secondary" id="cancel-btn"
|
||||||
|
onclick="setDataUser()">Batal</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<!--end col-->
|
<!--end col-->
|
||||||
|
@ -156,13 +162,6 @@ class="rounded-circle avatar-xl img-thumbnail user-profile-image"
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<!--end col-->
|
<!--end col-->
|
||||||
{{-- <div class="col-lg-12">
|
|
||||||
<div class="mb-3">
|
|
||||||
<a href="javascript:void(0);"
|
|
||||||
class="link-primary text-decoration-underline">Lupa Password ?</a>
|
|
||||||
</div>
|
|
||||||
</div> --}}
|
|
||||||
<!--end col-->
|
|
||||||
<div class="col-lg-12">
|
<div class="col-lg-12">
|
||||||
<div class="text-end">
|
<div class="text-end">
|
||||||
<button type="submit" class="btn btn-success">Ubah Password</button>
|
<button type="submit" class="btn btn-success">Ubah Password</button>
|
||||||
|
|
|
@ -45,10 +45,10 @@
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-lg-12">
|
<div class="col-lg-12">
|
||||||
<div class="text-center mt-sm-5 mb-4 text-white-50">
|
<div class="text-center text-white-50">
|
||||||
<div>
|
<div>
|
||||||
<a href="index.html" class="d-inline-block auth-logo">
|
<a href="index.html" class="d-inline-block auth-logo">
|
||||||
<img src="assets/images/logo-light.png" alt="" height="20">
|
<img src="{{ 'assets/images/logo-fitfarm.png' }}" alt="" width="20%">
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -45,10 +45,10 @@
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-lg-12">
|
<div class="col-lg-12">
|
||||||
<div class="text-center mt-sm-5 mb-4 text-white-50">
|
<div class="text-center text-white-50">
|
||||||
<div>
|
<div>
|
||||||
<a href="index.html" class="d-inline-block auth-logo">
|
<a href="index.html" class="d-inline-block auth-logo">
|
||||||
<img src="assets/images/logo-light.png" alt="" height="20">
|
<img src="{{ 'assets/images/logo-fitfarm.png' }}" alt="" width="20%">
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -45,10 +45,10 @@
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-lg-12">
|
<div class="col-lg-12">
|
||||||
<div class="text-center mt-sm-5 mb-4 text-white-50">
|
<div class="text-center text-white-50">
|
||||||
<div>
|
<div>
|
||||||
<a href="index.html" class="d-inline-block auth-logo">
|
<a href="index.html" class="d-inline-block auth-logo">
|
||||||
<img src="assets/images/logo-light.png" alt="" height="20">
|
<img src="{{ 'assets/images/logo-fitfarm.png' }}" alt="" width="20%">
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -78,7 +78,6 @@ class="fw-semibold">{{ $email }}</span></p>
|
||||||
|
|
||||||
<form action="{{ route('auth.two_step_verify_post') }}" method="POST">
|
<form action="{{ route('auth.two_step_verify_post') }}" method="POST">
|
||||||
@csrf
|
@csrf
|
||||||
|
|
||||||
<input type="hidden" name="email" value="{{ $email }}">
|
<input type="hidden" name="email" value="{{ $email }}">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-3">
|
<div class="col-3">
|
||||||
|
|
|
@ -50,7 +50,7 @@ class="ri-add-line align-bottom me-1"></i> Tambah</button>
|
||||||
<th class="sort" data-sort="customer_name">Indikator</th>
|
<th class="sort" data-sort="customer_name">Indikator</th>
|
||||||
<th class="sort" data-sort="email">Kategori</th>
|
<th class="sort" data-sort="email">Kategori</th>
|
||||||
<th class="sort" data-sort="phone">Deskripsi</th>
|
<th class="sort" data-sort="phone">Deskripsi</th>
|
||||||
<th class="sort" data-sort="status">CF(e)</th>
|
<th class="sort" data-sort="status">Nilai CF</th>
|
||||||
<th class="sort" data-sort="action">Action</th>
|
<th class="sort" data-sort="action">Action</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
|
@ -174,7 +174,7 @@ class="fw-medium link-primary">#VZ2101</a></td>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div>
|
<div>
|
||||||
<label for="cf-field" class="form-label">CF(e)</label>
|
<label for="cf-field" class="form-label">Nilai CF</label>
|
||||||
<input type="text" id="cf-field" class="form-control" name="cf"
|
<input type="text" id="cf-field" class="form-control" name="cf"
|
||||||
placeholder="Masukan nilai CF pakar" required oninput="validateCfInput(this)" />
|
placeholder="Masukan nilai CF pakar" required oninput="validateCfInput(this)" />
|
||||||
<div class="invalid-feedback">
|
<div class="invalid-feedback">
|
||||||
|
@ -246,11 +246,11 @@ class="fw-medium link-primary">#VZ2101</a></td>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div>
|
<div>
|
||||||
<label for="cf-edit-field" class="form-label">CF(e)</label>
|
<label for="cf-edit-field" class="form-label">Nilai CF</label>
|
||||||
<input type="text" id="cf-edit-field" class="form-control" name="cf"
|
<input type="text" id="cf-edit-field" class="form-control" name="cf"
|
||||||
placeholder="Masukan Nilai CF(e)" required oninput="validateCfInput(this)" />
|
placeholder="Masukan Nilai Nilai CF" required oninput="validateCfInput(this)" />
|
||||||
<div class="invalid-feedback">
|
<div class="invalid-feedback">
|
||||||
Masukan CF(e)
|
Masukan Nilai CF
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
|
@ -55,51 +55,9 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{{-- <div class="mb-3">
|
<div class="mb-3 text-end">
|
||||||
<label for="landname-field" class="form-label">Nama Lahan</label>
|
<button id="location-btn" class="btn btn-success btn-load" type="button"
|
||||||
<input type="text" id="landname-field" class="form-control" name="land_name"
|
onclick="getLocation()">Dapatkan Lokasi Lahan!</button>
|
||||||
value="{{ old('land_name') }}" placeholder="Masukan Nama Lahan" required />
|
|
||||||
<div class="invalid-feedback">
|
|
||||||
Masukan Nama Lahan
|
|
||||||
</div>
|
|
||||||
</div> --}}
|
|
||||||
|
|
||||||
<div class="mb-3">
|
|
||||||
<label for="province-field" class="form-label">Provinsi</label>
|
|
||||||
<select name="province_id" id="province-field" class="form-control" required
|
|
||||||
onchange="getRegencies(this.value)">
|
|
||||||
<option value="" selected disabled>Pilih Provinsi</option>
|
|
||||||
@foreach ($provinces as $province)
|
|
||||||
<option value="{{ $province->id }}"
|
|
||||||
{{ old('province_id') == $province->id ? 'selected' : '' }}>
|
|
||||||
{{ $province->name }}</option>
|
|
||||||
@endforeach
|
|
||||||
</select>
|
|
||||||
<div class="invalid-feedback">
|
|
||||||
Harap Pilih Provinsi
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="mb-3" id="regency-container" style="display: none">
|
|
||||||
<label for="regency-field" class="form-label">Kabupaten atau Kota</label>
|
|
||||||
<select name="regency_id" id="regency-field" class="form-control" required
|
|
||||||
onchange="getDistricts(this.value)">
|
|
||||||
<option value="" selected disabled>Pilih Kabupaten atau Kota</option>
|
|
||||||
</select>
|
|
||||||
<div class="invalid-feedback">
|
|
||||||
Harap Pilih Kabupaten atau Kota
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="mb-3" id="district-container" style="display: none">
|
|
||||||
<label for="district-field" class="form-label">Kecamatan</label>
|
|
||||||
<select name="district_id" id="district-field" class="form-control" required
|
|
||||||
onchange="showmap(this.value)">
|
|
||||||
<option value="" selected disabled>Pilih Kecamatan</option>
|
|
||||||
</select>
|
|
||||||
<div class="invalid-feedback">
|
|
||||||
Harap Pilih Kecamatan
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div id="loading" class="text-center" style="display: none">
|
<div id="loading" class="text-center" style="display: none">
|
||||||
|
@ -110,7 +68,7 @@
|
||||||
|
|
||||||
<div class="mb-3" id="address-container" style="display: none">
|
<div class="mb-3" id="address-container" style="display: none">
|
||||||
<label for="address-field" class="form-label">Alamat</label>
|
<label for="address-field" class="form-label">Alamat</label>
|
||||||
<textarea name="address" id="address-field" rows="3" class="form-control"
|
<textarea name="address" id="address-field" rows="3" class="form-control" readonly
|
||||||
placeholder="Masukan Alamat, cnth: Jl. Jend. Sudirman No. 12" required></textarea>
|
placeholder="Masukan Alamat, cnth: Jl. Jend. Sudirman No. 12" required></textarea>
|
||||||
<div class="invalid-feedback">
|
<div class="invalid-feedback">
|
||||||
Masukan Alamat
|
Masukan Alamat
|
||||||
|
|
|
@ -59,55 +59,6 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{{-- <div class="mb-3">
|
|
||||||
<label for="landname-edit-field" class="form-label">Nama Lahan</label>
|
|
||||||
<input type="text" id="landname-edit-field" class="form-control" name="land_name"
|
|
||||||
value="{{ old('land_name') }}" placeholder="Masukan Nama Lahan" required />
|
|
||||||
<div class="invalid-feedback">
|
|
||||||
Masukan Nama Lahan
|
|
||||||
</div>
|
|
||||||
</div> --}}
|
|
||||||
|
|
||||||
<div class="mb-3">
|
|
||||||
<label for="province-edit-field" class="form-label">Provinsi</label>
|
|
||||||
<select name="province_id" id="province-edit-field" class="form-control" required
|
|
||||||
onchange="getRegencies(this.value)">
|
|
||||||
<option value="" selected disabled>Pilih Provinsi</option>
|
|
||||||
@foreach ($provinces as $province)
|
|
||||||
<option value="{{ $province->id }}"
|
|
||||||
{{ old('province_id', $land->province_code) == $province->id ? 'selected' : '' }}>
|
|
||||||
{{ $province->name }}</option>
|
|
||||||
@endforeach
|
|
||||||
</select>
|
|
||||||
<div class="invalid-feedback">
|
|
||||||
Harap Pilih Provinsi
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="mb-3" id="regency-edit-container">
|
|
||||||
<label for="regency-edit-field" class="form-label">Kabupaten atau Kota</label>
|
|
||||||
<input type="hidden" id="regency-code" data-regency="{{ $land->regency_code }}">
|
|
||||||
<select name="regency_id" id="regency-edit-field" class="form-control" required
|
|
||||||
onchange="getDistricts(this.value)">
|
|
||||||
<option value="" selected disabled>Pilih Kabupaten atau Kota</option>
|
|
||||||
</select>
|
|
||||||
<div class="invalid-feedback">
|
|
||||||
Harap Pilih Kabupaten atau Kota
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="mb-3" id="district-edit-container">
|
|
||||||
<label for="district-edit-field" class="form-label">Kecamatan</label>
|
|
||||||
<input type="hidden" id="district-code" data-district="{{ $land->district_code }}">
|
|
||||||
<select name="district_id" id="district-edit-field" class="form-control" required
|
|
||||||
onchange="showmap(this.value)">
|
|
||||||
<option value="" selected disabled>Pilih Kecamatan</option>
|
|
||||||
</select>
|
|
||||||
<div class="invalid-feedback">
|
|
||||||
Harap Pilih Kecamatan
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div id="loading-edit" class="text-center" style="display: none">
|
<div id="loading-edit" class="text-center" style="display: none">
|
||||||
<div class="spinner-border text-primary" role="status">
|
<div class="spinner-border text-primary" role="status">
|
||||||
<span class="visually-hidden">Loading...</span>
|
<span class="visually-hidden">Loading...</span>
|
||||||
|
@ -116,7 +67,7 @@
|
||||||
|
|
||||||
<div class="mb-3" id="address-edit-container">
|
<div class="mb-3" id="address-edit-container">
|
||||||
<label for="address-edit-field" class="form-label">Alamat</label>
|
<label for="address-edit-field" class="form-label">Alamat</label>
|
||||||
<textarea name="address" id="address-edit-field" rows="3" class="form-control"
|
<textarea name="address" id="address-edit-field" rows="3" class="form-control" readonly
|
||||||
placeholder="Masukan Alamat, cnth: Jl. Jend. Sudirman No. 12" required>{{ old('address', $land->address) }}</textarea>
|
placeholder="Masukan Alamat, cnth: Jl. Jend. Sudirman No. 12" required>{{ old('address', $land->address) }}</textarea>
|
||||||
<div class="invalid-feedback">
|
<div class="invalid-feedback">
|
||||||
Masukan Alamat
|
Masukan Alamat
|
||||||
|
@ -128,16 +79,11 @@
|
||||||
<div id="map-edit"></div>
|
<div id="map-edit"></div>
|
||||||
|
|
||||||
<div class="mt-3">
|
<div class="mt-3">
|
||||||
<input type="hidden" name="lat" id="lat-edit" class="form-control"
|
|
||||||
value="{{ $land->latitude }}" readonly>
|
|
||||||
<input type="hidden" name="lng" id="lng-edit" class="form-control"
|
|
||||||
value="{{ $land->longitude }}" readonly>
|
|
||||||
|
|
||||||
<input type="hidden" name="polygon" id="polygon-edit" class="form-control"
|
<input type="hidden" name="polygon" id="polygon-edit" class="form-control"
|
||||||
readonly>
|
readonly>
|
||||||
|
|
||||||
<input type="hidden" id="lat-db" data-lat={{ $land->latitude }}>
|
<input type="hidden" id="lat-db" data-lat={{ $landDetails[0]['lat'] }}>
|
||||||
<input type="hidden" id="lng-db" data-lng={{ $land->longitude }}>
|
<input type="hidden" id="lng-db" data-lng={{ $landDetails[0]['lng'] }}>
|
||||||
|
|
||||||
<input type="hidden" id="polygon-db"
|
<input type="hidden" id="polygon-db"
|
||||||
data-polygon="{{ json_encode($landDetails) }}">
|
data-polygon="{{ json_encode($landDetails) }}">
|
||||||
|
|
|
@ -49,7 +49,9 @@ class="ri-add-line align-bottom me-1"></i>
|
||||||
<th class="sort" data-sort="no">No</th>
|
<th class="sort" data-sort="no">No</th>
|
||||||
<th class="sort" data-sort="owner">Pemilik</th>
|
<th class="sort" data-sort="owner">Pemilik</th>
|
||||||
<th class="sort" data-sort="address">Alamat</th>
|
<th class="sort" data-sort="address">Alamat</th>
|
||||||
<th class="sort" data-sort="user">Petugas</th>
|
@if (Auth::user()->role == 'admin')
|
||||||
|
<th class="sort" data-sort="user">Petugas</th>
|
||||||
|
@endif
|
||||||
<th class="sort" data-sort="action">Action</th>
|
<th class="sort" data-sort="action">Action</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
|
@ -62,24 +64,25 @@ class="fw-medium link-primary">#VZ2101</a></td>
|
||||||
<td class="owner">{{ $land->owner }}</td>
|
<td class="owner">{{ $land->owner }}</td>
|
||||||
</td>
|
</td>
|
||||||
<td class="status">
|
<td class="status">
|
||||||
<span class="text-capitalize">{{ $land->address }}, Kecamatan
|
<span class="text-capitalize">{{ $land->address }}</span>
|
||||||
{{ ucwords(strtolower($land->district->name)) }},
|
|
||||||
{{ ucwords(strtolower($land->regency->name)) }}, Provinsi
|
|
||||||
{{ ucwords(strtolower($land->province->name)) }}</span>
|
|
||||||
</td>
|
</td>
|
||||||
<td class="user">{{ $land->user->username }}</td>
|
@if (Auth::user()->role == 'admin')
|
||||||
|
<td class="user">{{ $land->user->username }}</td>
|
||||||
|
@endif
|
||||||
<td>
|
<td>
|
||||||
<div class="d-flex gap-2 justify-content-center">
|
<div class="d-flex gap-2 justify-content-center">
|
||||||
<div class="edit">
|
<div class="edit">
|
||||||
<a href="{{ Auth::user()->role == 'admin' ? route('master_data.lahan.edit', $land->id) : route('lahan.edit', $land->id) }}"
|
<a href="{{ Auth::user()->role == 'admin' ? route('master_data.lahan.edit', $land->id) : route('lahan.edit', $land->id) }}"
|
||||||
class="btn btn-sm btn-warning edit-item-btn">Edit</a>
|
class="btn btn-sm btn-warning edit-item-btn">Edit</a>
|
||||||
</div>
|
</div>
|
||||||
<div class="remove">
|
@if (Auth::user()->role == 'admin')
|
||||||
<button class="btn btn-sm btn-danger remove-item-btn"
|
<div class="remove">
|
||||||
data-bs-toggle="modal"
|
<button class="btn btn-sm btn-danger remove-item-btn"
|
||||||
data-bs-target="#deleteRecordModal"
|
data-bs-toggle="modal"
|
||||||
onclick="deleteData({{ json_encode(['landId' => $land->id, 'role' => Auth::user()->role]) }})">Hapus</button>
|
data-bs-target="#deleteRecordModal"
|
||||||
</div>
|
onclick="deleteData({{ json_encode(['landId' => $land->id, 'role' => Auth::user()->role]) }})">Hapus</button>
|
||||||
|
</div>
|
||||||
|
@endif
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
|
@ -54,9 +54,6 @@
|
||||||
</th>
|
</th>
|
||||||
<th class="sort" data-sort="username">Username</th>
|
<th class="sort" data-sort="username">Username</th>
|
||||||
<th class="sort" data-sort="email">Email</th>
|
<th class="sort" data-sort="email">Email</th>
|
||||||
<th class="sort" data-sort="role">
|
|
||||||
Role
|
|
||||||
</th>
|
|
||||||
<th class="sort" data-sort="status">
|
<th class="sort" data-sort="status">
|
||||||
Status
|
Status
|
||||||
</th>
|
</th>
|
||||||
|
@ -74,7 +71,6 @@ class="fw-medium link-primary">#VZ2101</a>
|
||||||
<td class="fullname">{{ $user->name }}</td>
|
<td class="fullname">{{ $user->name }}</td>
|
||||||
<td class="username">{{ $user->username }}</td>
|
<td class="username">{{ $user->username }}</td>
|
||||||
<td class="email">{{ $user->email }}</td>
|
<td class="email">{{ $user->email }}</td>
|
||||||
<td class="role">{{ $user->role }}</td>
|
|
||||||
<td class="status">
|
<td class="status">
|
||||||
@if ($user->is_active == 0)
|
@if ($user->is_active == 0)
|
||||||
<span class="badge badge-soft-danger text-uppercase">Tidak
|
<span class="badge badge-soft-danger text-uppercase">Tidak
|
||||||
|
@ -187,18 +183,6 @@ class="badge badge-soft-success text-uppercase">Aktif</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="mb-3">
|
|
||||||
<label for="date-field" class="form-label">Role</label>
|
|
||||||
<select name="role" id="role-field" data-trigger class="form-control" required>
|
|
||||||
<option value="" selected disabled>Pilih Role</option>
|
|
||||||
<option value="admin">Admin</option>
|
|
||||||
<option value="user">User</option>
|
|
||||||
</select>
|
|
||||||
<div class="invalid-feedback">
|
|
||||||
Pilih Role
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div>
|
<div>
|
||||||
<label for="status-field" class="form-label">Status</label>
|
<label for="status-field" class="form-label">Status</label>
|
||||||
<select class="form-control" data-trigger name="status" id="status-field" required>
|
<select class="form-control" data-trigger name="status" id="status-field" required>
|
||||||
|
@ -270,19 +254,6 @@ class="badge badge-soft-success text-uppercase">Aktif</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="mb-3">
|
|
||||||
<label for="date-field" class="form-label">Role</label>
|
|
||||||
<select name="role" id="role-edit-field" data-trigger class="form-control"
|
|
||||||
required>
|
|
||||||
<option value="" selected disabled>Pilih Role</option>
|
|
||||||
<option value="admin">Admin</option>
|
|
||||||
<option value="user">User</option>
|
|
||||||
</select>
|
|
||||||
<div class="invalid-feedback">
|
|
||||||
Pilih Role
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div>
|
<div>
|
||||||
<label for="status-field" class="form-label">Status</label>
|
<label for="status-field" class="form-label">Status</label>
|
||||||
<select class="form-control" data-trigger name="status" id="status-edit-field"
|
<select class="form-control" data-trigger name="status" id="status-edit-field"
|
||||||
|
|
|
@ -8,14 +8,13 @@
|
||||||
use App\Http\Controllers\Auth\RegisteredUserController;
|
use App\Http\Controllers\Auth\RegisteredUserController;
|
||||||
use App\Http\Controllers\Auth\TwoStepVerifyController;
|
use App\Http\Controllers\Auth\TwoStepVerifyController;
|
||||||
use App\Http\Controllers\DashboardController;
|
use App\Http\Controllers\DashboardController;
|
||||||
|
use App\Http\Controllers\LandControllerOfficer;
|
||||||
use App\Http\Controllers\LocationController;
|
use App\Http\Controllers\LocationController;
|
||||||
use App\Http\Controllers\MasterData\IndicatorController;
|
use App\Http\Controllers\MasterData\IndicatorController;
|
||||||
use App\Http\Controllers\MasterData\LandController;
|
use App\Http\Controllers\MasterData\LandController;
|
||||||
use App\Http\Controllers\MasterData\RuleController;
|
use App\Http\Controllers\MasterData\RuleController;
|
||||||
use App\Http\Controllers\MasterData\RuleExpertController;
|
use App\Http\Controllers\MasterData\RuleExpertController;
|
||||||
use App\Http\Controllers\MasterData\UserController;
|
use App\Http\Controllers\MasterData\UserController;
|
||||||
use Illuminate\Routing\RouteGroup;
|
|
||||||
use Illuminate\Routing\RouteUrlGenerator;
|
|
||||||
use Illuminate\Support\Facades\Route;
|
use Illuminate\Support\Facades\Route;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -136,7 +135,7 @@
|
||||||
Route::get('/', 'officer')->name('index');
|
Route::get('/', 'officer')->name('index');
|
||||||
});
|
});
|
||||||
|
|
||||||
Route::prefix('data-lahan-petugas')->controller(LandController::class)->name('lahan.')->group(function () {
|
Route::prefix('data-lahan-petugas')->controller(LandControllerOfficer::class)->name('lahan.')->group(function () {
|
||||||
Route::get('/', 'index')->name('index');
|
Route::get('/', 'index')->name('index');
|
||||||
Route::get('/tambah', 'create')->name('create');
|
Route::get('/tambah', 'create')->name('create');
|
||||||
Route::post('/tambah', 'store')->name('store');
|
Route::post('/tambah', 'store')->name('store');
|
||||||
|
|
|
@ -0,0 +1,30 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Tests\Unit;
|
||||||
|
|
||||||
|
use App\Http\Controllers\AssesmentFormController;
|
||||||
|
use PHPUnit\Framework\TestCase;
|
||||||
|
|
||||||
|
class CertaintyFactorTest extends TestCase
|
||||||
|
{
|
||||||
|
public function test_cf_positive_combination()
|
||||||
|
{
|
||||||
|
$controller = new AssesmentFormController();
|
||||||
|
$result = $controller->calculateCFc(0.6, 0.4);
|
||||||
|
$this->assertEquals(0.76, $result);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function test_cf_negative_combination()
|
||||||
|
{
|
||||||
|
$controller = new AssesmentFormController();
|
||||||
|
$result = $controller->calculateCFc(-0.6, -0.4);
|
||||||
|
$this->assertEquals(-0.76, $result);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function test_cf_combination_opposite_signs()
|
||||||
|
{
|
||||||
|
$controller = new AssesmentFormController();
|
||||||
|
$result = $controller->calculateCFc(0.6, -0.4);
|
||||||
|
$this->assertEqualsWithDelta(0.333, $result, 0.001);
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue