Compare commits
2
Commits
3464a802e2
...
316b256ae0
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
316b256ae0 | ||
|
|
bfabab96c5 |
@@ -235,6 +235,8 @@ class SosialEkonomiController extends Controller
|
|||||||
|
|
||||||
private function validateData(Request $request, ?int $id = null): array
|
private function validateData(Request $request, ?int $id = null): array
|
||||||
{
|
{
|
||||||
|
$this->normalizeCurrencyInput($request);
|
||||||
|
|
||||||
$section = $request->input('form_section');
|
$section = $request->input('form_section');
|
||||||
|
|
||||||
$rules = [
|
$rules = [
|
||||||
@@ -530,6 +532,51 @@ class SosialEkonomiController extends Controller
|
|||||||
return $request->validate($rules, $this->validationMessages(), $this->validationAttributes());
|
return $request->validate($rules, $this->validationMessages(), $this->validationAttributes());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private function normalizeCurrencyInput(Request $request): void
|
||||||
|
{
|
||||||
|
$data = $request->all();
|
||||||
|
$currencyFields = [
|
||||||
|
'total_estimasi_biaya_kebun_per_musim',
|
||||||
|
'estimasi_tabungan_per_bulan',
|
||||||
|
'total_hutang_rupiah',
|
||||||
|
];
|
||||||
|
|
||||||
|
foreach ($currencyFields as $field) {
|
||||||
|
if (array_key_exists($field, $data)) {
|
||||||
|
$data[$field] = $this->currencyDigits($data[$field]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isset($data['pendapatan_komoditas']) && is_array($data['pendapatan_komoditas'])) {
|
||||||
|
foreach ($data['pendapatan_komoditas'] as $index => $item) {
|
||||||
|
if (is_array($item) && array_key_exists('pendapatan', $item)) {
|
||||||
|
$data['pendapatan_komoditas'][$index]['pendapatan'] = $this->currencyDigits($item['pendapatan']);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isset($data['pendapatan_luar_pertanian']) && is_array($data['pendapatan_luar_pertanian'])) {
|
||||||
|
foreach ($data['pendapatan_luar_pertanian'] as $index => $item) {
|
||||||
|
if (is_array($item) && array_key_exists('estimasi_per_bulan', $item)) {
|
||||||
|
$data['pendapatan_luar_pertanian'][$index]['estimasi_per_bulan'] = $this->currencyDigits($item['estimasi_per_bulan']);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$request->merge($data);
|
||||||
|
}
|
||||||
|
|
||||||
|
private function currencyDigits(mixed $value): ?string
|
||||||
|
{
|
||||||
|
if (is_null($value) || $value === '') {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
$digits = preg_replace('/\D/', '', (string) $value);
|
||||||
|
|
||||||
|
return $digits === '' ? null : $digits;
|
||||||
|
}
|
||||||
|
|
||||||
private function sosialEkonomiPayload(array $validated, ?SosialEkonomi $sosialEkonomi = null): array
|
private function sosialEkonomiPayload(array $validated, ?SosialEkonomi $sosialEkonomi = null): array
|
||||||
{
|
{
|
||||||
$payload = collect($validated)
|
$payload = collect($validated)
|
||||||
|
|||||||
@@ -37,17 +37,17 @@
|
|||||||
<form id="formAuthentication" class="mb-4" action="{{ route('auth.authenticate') }}" method="POST">
|
<form id="formAuthentication" class="mb-4" action="{{ route('auth.authenticate') }}" method="POST">
|
||||||
@csrf
|
@csrf
|
||||||
<div class="mb-6 form-control-validation">
|
<div class="mb-6 form-control-validation">
|
||||||
<label for="email" class="form-label">Email atau Username</label>
|
<label for="email" class="form-label">Email atau Nama Pengguna</label>
|
||||||
<input
|
<input
|
||||||
type="text"
|
type="text"
|
||||||
class="form-control"
|
class="form-control"
|
||||||
id="email"
|
id="email"
|
||||||
name="email_username"
|
name="email_username"
|
||||||
placeholder="Masukkan email atau username Anda"
|
placeholder="Masukkan email atau nama pengguna Anda"
|
||||||
autofocus />
|
autofocus />
|
||||||
</div>
|
</div>
|
||||||
<div class="mb-6 form-password-toggle form-control-validation">
|
<div class="mb-6 form-password-toggle form-control-validation">
|
||||||
<label class="form-label" for="password">Password</label>
|
<label class="form-label" for="password">Kata Sandi</label>
|
||||||
<div class="input-group input-group-merge">
|
<div class="input-group input-group-merge">
|
||||||
<input
|
<input
|
||||||
type="password"
|
type="password"
|
||||||
@@ -63,15 +63,15 @@
|
|||||||
<div class="d-flex justify-content-between">
|
<div class="d-flex justify-content-between">
|
||||||
<div class="form-check mb-0 ms-2">
|
<div class="form-check mb-0 ms-2">
|
||||||
<input class="form-check-input" type="checkbox" id="remember-me" />
|
<input class="form-check-input" type="checkbox" id="remember-me" />
|
||||||
<label class="form-check-label" for="remember-me"> Remember Me </label>
|
<label class="form-check-label" for="remember-me"> Ingat saya </label>
|
||||||
</div>
|
</div>
|
||||||
<a href="auth-forgot-password-basic.html">
|
<a href="auth-forgot-password-basic.html">
|
||||||
<p class="mb-0">Lupa Password?</p>
|
<p class="mb-0">Lupa Kata Sandi?</p>
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="mb-6">
|
<div class="mb-6">
|
||||||
<button class="btn btn-primary d-grid w-100" type="submit">Login</button>
|
<button class="btn btn-primary d-grid w-100" type="submit">Masuk</button>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
@@ -86,4 +86,4 @@
|
|||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@endsection
|
@endsection
|
||||||
|
|||||||
@@ -4,141 +4,135 @@
|
|||||||
<div class="card-body">
|
<div class="card-body">
|
||||||
<!-- Logo -->
|
<!-- Logo -->
|
||||||
<div class="app-brand justify-content-center mb-6">
|
<div class="app-brand justify-content-center mb-6">
|
||||||
<a href="{{ route('home') }}" class="app-brand-link">
|
<a href="{{ route('home') }}" class="app-brand-link">
|
||||||
<span class="app-brand-logo demo">
|
<span class="app-brand-logo demo">
|
||||||
<span class="text-primary">
|
<span class="text-primary">
|
||||||
<svg width="32" height="24" viewBox="0 0 32 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
<svg width="32" height="24" viewBox="0 0 32 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||||
|
<path opacity="0.3"
|
||||||
<!-- Daun Kiri (Hijau transparan) -->
|
d="M16 2.5C16 2.5 5 6.5 5 15.5C5 20.5 11 23.5 16 23.5V2.5Z"
|
||||||
<path opacity="0.3"
|
fill="#2E7D32" />
|
||||||
d="M16 2.5C16 2.5 5 6.5 5 15.5C5 20.5 11 23.5 16 23.5V2.5Z"
|
|
||||||
fill="#2E7D32" />
|
|
||||||
|
|
||||||
<!-- Daun Kanan (Hijau lebih solid) -->
|
<path opacity="0.6"
|
||||||
<path opacity="0.6"
|
d="M16 2.5C16 2.5 27 6.5 27 15.5C27 20.5 21 23.5 16 23.5V2.5Z"
|
||||||
d="M16 2.5C16 2.5 27 6.5 27 15.5C27 20.5 21 23.5 16 23.5V2.5Z"
|
fill="#2E7D32" />
|
||||||
fill="#2E7D32" />
|
|
||||||
|
|
||||||
<!-- Grafik Biru (bawah → tengah) -->
|
<path d="M2 19L10 11L15 15"
|
||||||
<path d="M2 19L10 11L15 15"
|
stroke="#0054A6"
|
||||||
stroke="#0054A6"
|
stroke-width="2.5"
|
||||||
stroke-width="2.5"
|
stroke-linecap="round"
|
||||||
stroke-linecap="round"
|
stroke-linejoin="round" />
|
||||||
stroke-linejoin="round" />
|
|
||||||
|
|
||||||
<!-- Grafik Merah (tengah → atas) -->
|
<path d="M15 15L27 4"
|
||||||
<path d="M15 15L27 4"
|
stroke="#ED1C24"
|
||||||
stroke="#ED1C24"
|
stroke-width="2.5"
|
||||||
stroke-width="2.5"
|
stroke-linecap="round"
|
||||||
stroke-linecap="round"
|
stroke-linejoin="round" />
|
||||||
stroke-linejoin="round" />
|
|
||||||
|
|
||||||
<!-- Titik target -->
|
<circle cx="27" cy="4" r="2.5" fill="#ED1C24" />
|
||||||
<circle cx="27" cy="4" r="2.5" fill="#ED1C24" />
|
</svg>
|
||||||
</svg>
|
</span>
|
||||||
</span>
|
</span>
|
||||||
</span>
|
|
||||||
|
|
||||||
<span class="app-brand-text demo menu-text fw-bold ms-3" style="text-transform: capitalize;">
|
<span class="app-brand-text demo menu-text fw-bold ms-3" style="text-transform: capitalize;">
|
||||||
AgroMonev
|
AgroMonev
|
||||||
</span>
|
</span>
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
<!-- /Logo -->
|
<!-- /Logo -->
|
||||||
<h4 class="mb-1">Adventure starts here 🚀</h4>
|
<h4 class="mb-1">Buat akun AgroMonev</h4>
|
||||||
<p class="mb-6">Make your app management easy and fun!</p>
|
<p class="mb-6">Lengkapi data berikut untuk membuat akun baru.</p>
|
||||||
|
|
||||||
<form id="formAuthentication" class="mb-6" action="{{ route('auth.createAccount') }}" method="POST">
|
<form id="formAuthentication" class="mb-6" action="{{ route('auth.createAccount') }}" method="POST">
|
||||||
@csrf
|
@csrf
|
||||||
<div class="mb-6 form-control-validation">
|
<div class="mb-6 form-control-validation">
|
||||||
<label for="username" class="form-label">Username</label>
|
<label for="username" class="form-label">Nama Pengguna</label>
|
||||||
<input
|
<input
|
||||||
type="text"
|
type="text"
|
||||||
class="form-control"
|
class="form-control"
|
||||||
id="username"
|
id="username"
|
||||||
name="username"
|
name="username"
|
||||||
value="{{ old('username') }}"
|
value="{{ old('username') }}"
|
||||||
placeholder="Enter your username"
|
placeholder="Masukkan nama pengguna"
|
||||||
autofocus />
|
autofocus />
|
||||||
@error('username')
|
@error('username')
|
||||||
<div class="invalid-feedback d-block">{{ $message }}</div>
|
<div class="invalid-feedback d-block">{{ $message }}</div>
|
||||||
@enderror
|
@enderror
|
||||||
</div>
|
|
||||||
<div class="mb-6 form-control-validation">
|
|
||||||
<label for="email" class="form-label">Email</label>
|
|
||||||
<input type="text" class="form-control" id="email" name="email" value="{{ old('email') }}" placeholder="Enter your email" />
|
|
||||||
@error('email')
|
|
||||||
<div class="invalid-feedback d-block">{{ $message }}</div>
|
|
||||||
@enderror
|
|
||||||
</div>
|
|
||||||
<div class="mb-6 form-password-toggle form-control-validation">
|
|
||||||
<label class="form-label" for="password">Password</label>
|
|
||||||
<div class="input-group input-group-merge">
|
|
||||||
<input
|
|
||||||
type="password"
|
|
||||||
id="password"
|
|
||||||
class="form-control"
|
|
||||||
name="password"
|
|
||||||
placeholder="············"
|
|
||||||
aria-describedby="password" />
|
|
||||||
<span class="input-group-text cursor-pointer"><i class="icon-base ti tabler-eye-off"></i></span>
|
|
||||||
</div>
|
</div>
|
||||||
@error('password')
|
<div class="mb-6 form-control-validation">
|
||||||
<div class="invalid-feedback d-block">{{ $message }}</div>
|
<label for="email" class="form-label">Email</label>
|
||||||
@enderror
|
<input type="text" class="form-control" id="email" name="email" value="{{ old('email') }}" placeholder="Masukkan email" />
|
||||||
</div>
|
@error('email')
|
||||||
<div class="mb-6 form-password-toggle form-control-validation">
|
<div class="invalid-feedback d-block">{{ $message }}</div>
|
||||||
<label class="form-label" for="password_confirmation">Confirm Password</label>
|
@enderror
|
||||||
<div class="input-group input-group-merge">
|
|
||||||
<input
|
|
||||||
type="password"
|
|
||||||
id="password_confirmation"
|
|
||||||
class="form-control"
|
|
||||||
name="password_confirmation"
|
|
||||||
placeholder="············"
|
|
||||||
aria-describedby="password_confirmation" />
|
|
||||||
<span class="input-group-text cursor-pointer"><i class="icon-base ti tabler-eye-off"></i></span>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
<div class="mb-6 form-password-toggle form-control-validation">
|
||||||
<div class="my-8 form-control-validation">
|
<label class="form-label" for="password">Kata Sandi</label>
|
||||||
<div class="form-check mb-0 ms-2">
|
<div class="input-group input-group-merge">
|
||||||
<input class="form-check-input" type="checkbox" id="terms-conditions" name="terms" />
|
<input
|
||||||
<label class="form-check-label" for="terms-conditions">
|
type="password"
|
||||||
I agree to
|
id="password"
|
||||||
<a href="javascript:void(0);">privacy policy & terms</a>
|
class="form-control"
|
||||||
</label>
|
name="password"
|
||||||
|
placeholder="············"
|
||||||
|
aria-describedby="password" />
|
||||||
|
<span class="input-group-text cursor-pointer"><i class="icon-base ti tabler-eye-off"></i></span>
|
||||||
|
</div>
|
||||||
|
@error('password')
|
||||||
|
<div class="invalid-feedback d-block">{{ $message }}</div>
|
||||||
|
@enderror
|
||||||
</div>
|
</div>
|
||||||
</div>
|
<div class="mb-6 form-password-toggle form-control-validation">
|
||||||
<button type="submit" class="btn btn-primary d-grid w-100">Sign up</button>
|
<label class="form-label" for="password_confirmation">Konfirmasi Kata Sandi</label>
|
||||||
|
<div class="input-group input-group-merge">
|
||||||
|
<input
|
||||||
|
type="password"
|
||||||
|
id="password_confirmation"
|
||||||
|
class="form-control"
|
||||||
|
name="password_confirmation"
|
||||||
|
placeholder="············"
|
||||||
|
aria-describedby="password_confirmation" />
|
||||||
|
<span class="input-group-text cursor-pointer"><i class="icon-base ti tabler-eye-off"></i></span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="my-8 form-control-validation">
|
||||||
|
<div class="form-check mb-0 ms-2">
|
||||||
|
<input class="form-check-input" type="checkbox" id="terms-conditions" name="terms" />
|
||||||
|
<label class="form-check-label" for="terms-conditions">
|
||||||
|
Saya menyetujui
|
||||||
|
<a href="javascript:void(0);">kebijakan privasi dan ketentuan layanan</a>
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<button type="submit" class="btn btn-primary d-grid w-100">Daftar</button>
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
<p class="text-center">
|
<p class="text-center">
|
||||||
<span>Already have an account?</span>
|
<span>Sudah memiliki akun?</span>
|
||||||
<a href="{{ route('login') }}">
|
<a href="{{ route('login') }}">
|
||||||
<span>Sign in instead</span>
|
<span>Masuk di sini</span>
|
||||||
</a>
|
</a>
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<div class="divider my-6">
|
<div class="divider my-6">
|
||||||
<div class="divider-text">or</div>
|
<div class="divider-text">atau</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="d-flex justify-content-center">
|
<div class="d-flex justify-content-center">
|
||||||
<a href="javascript:;" class="btn btn-icon rounded-circle btn-text-facebook me-1_5">
|
<a href="javascript:;" class="btn btn-icon rounded-circle btn-text-facebook me-1_5">
|
||||||
<i class="icon-base ti tabler-brand-facebook-filled icon-20px"></i>
|
<i class="icon-base ti tabler-brand-facebook-filled icon-20px"></i>
|
||||||
</a>
|
</a>
|
||||||
|
|
||||||
<a href="javascript:;" class="btn btn-icon rounded-circle btn-text-twitter me-1_5">
|
<a href="javascript:;" class="btn btn-icon rounded-circle btn-text-twitter me-1_5">
|
||||||
<i class="icon-base ti tabler-brand-twitter-filled icon-20px"></i>
|
<i class="icon-base ti tabler-brand-twitter-filled icon-20px"></i>
|
||||||
</a>
|
</a>
|
||||||
|
|
||||||
<a href="javascript:;" class="btn btn-icon rounded-circle btn-text-github me-1_5">
|
<a href="javascript:;" class="btn btn-icon rounded-circle btn-text-github me-1_5">
|
||||||
<i class="icon-base ti tabler-brand-github-filled icon-20px"></i>
|
<i class="icon-base ti tabler-brand-github-filled icon-20px"></i>
|
||||||
</a>
|
</a>
|
||||||
|
|
||||||
<a href="javascript:;" class="btn btn-icon rounded-circle btn-text-google-plus">
|
<a href="javascript:;" class="btn btn-icon rounded-circle btn-text-google-plus">
|
||||||
<i class="icon-base ti tabler-brand-google-filled icon-20px"></i>
|
<i class="icon-base ti tabler-brand-google-filled icon-20px"></i>
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -1062,6 +1062,49 @@
|
|||||||
const pinjamanTokohAdatAda = @json($pinjamanTokohAdatAdaValue);
|
const pinjamanTokohAdatAda = @json($pinjamanTokohAdatAdaValue);
|
||||||
const tekananJualSegeraAda = @json($tekananJualSegeraAdaValue);
|
const tekananJualSegeraAda = @json($tekananJualSegeraAdaValue);
|
||||||
const kebebasanMemilihPembeliCukupBebas = Number(@json($kebebasanMemilihPembeliCukupBebasValue));
|
const kebebasanMemilihPembeliCukupBebas = Number(@json($kebebasanMemilihPembeliCukupBebasValue));
|
||||||
|
const fieldExamples = {
|
||||||
|
jumlah_tanggungan: 'Contoh: 4',
|
||||||
|
anak_masih_sekolah: 'Contoh: 2',
|
||||||
|
yang_ikut_bekerja: 'Contoh: 2',
|
||||||
|
'pendapatan_komoditas[][pendapatan]': 'Contoh: 3.500.000',
|
||||||
|
'pendapatan_luar_pertanian[][jenis_pekerjaan]': 'Contoh: Buruh bangunan',
|
||||||
|
'pendapatan_luar_pertanian[][estimasi_per_bulan]': 'Contoh: 1.500.000',
|
||||||
|
bulan_paceklik: 'Contoh: Januari-Maret',
|
||||||
|
sumber_penghasilan_paceklik: 'Contoh: Buruh harian',
|
||||||
|
total_estimasi_biaya_kebun_per_musim: 'Contoh: 2.500.000',
|
||||||
|
estimasi_tabungan_per_bulan: 'Contoh: 250.000',
|
||||||
|
alasan_kecukupan_penghasilan: 'Contoh: Cukup untuk makan dan biaya sekolah',
|
||||||
|
keterangan_sengketa: 'Contoh: Batas lahan belum disepakati',
|
||||||
|
pihak_membantu_konflik_nama: 'Contoh: Ketua adat setempat',
|
||||||
|
tahun_bantuan_konflik: 'Contoh: 2025',
|
||||||
|
alasan_mencoba_praktik_baru: 'Contoh: Ingin meningkatkan hasil panen',
|
||||||
|
hambatan_mengubah_cara_bertani: 'Contoh: Biaya dan tenaga terbatas',
|
||||||
|
contoh_pemahaman_mutu_harga: 'Contoh: Biji kering bersih dihargai lebih tinggi',
|
||||||
|
penyebab_harga_lebih_tinggi: 'Contoh: Kualitas lebih baik dan pembeli premium',
|
||||||
|
alasan_usaha_mutu_tambahan_harga: 'Contoh: Harga tambahan menutup biaya proses',
|
||||||
|
nama_lokasi_panutan: 'Contoh: Pak Anton, Dusun Wae',
|
||||||
|
harapan_program: 'Contoh: Bantuan pelatihan dan akses pembeli',
|
||||||
|
rencana_jangka_panjang: 'Contoh: Menambah tanaman dan memperbaiki kebun',
|
||||||
|
nama_kelompok_tani: 'Contoh: Kelompok Tani Maju Bersama',
|
||||||
|
lama_bergabung_kelompok_tahun: 'Contoh: 3',
|
||||||
|
topik_biasa_dibahas: 'Contoh: Pemupukan, hama, dan harga jual',
|
||||||
|
manfaat_lain_kartu_tani: 'Contoh: Lebih mudah membeli pupuk',
|
||||||
|
nama_bank: 'Contoh: BRI',
|
||||||
|
alasan_kredit_ditolak_lainnya: 'Contoh: Belum punya agunan',
|
||||||
|
jenis_aset_produktif_lainnya: 'Contoh: Mesin parut',
|
||||||
|
keterangan_kondisi_aset: 'Contoh: Pompa air masih berfungsi baik',
|
||||||
|
program_keuangan_formal_lainnya_nama: 'Contoh: Arisan kelompok',
|
||||||
|
'detail_bantuan_ngo_perusahaan[][nama_lembaga]': 'Contoh: Yayasan Tani Sejahtera',
|
||||||
|
'detail_bantuan_ngo_perusahaan[][bentuk_bantuan]': 'Contoh: Bibit dan pelatihan',
|
||||||
|
'detail_bantuan_ngo_perusahaan[][frekuensi]': 'Contoh: 2',
|
||||||
|
'detail_bantuan_ngo_perusahaan[][tahun_terakhir]': 'Contoh: 2025',
|
||||||
|
keterangan_pinjaman_tokoh_adat: 'Contoh: Pinjaman dibayar setelah panen',
|
||||||
|
total_hutang_rupiah: 'Contoh: 1.500.000',
|
||||||
|
total_hutang_setara_kg_panen: 'Contoh: 100',
|
||||||
|
penyebab_tekanan_jual_segera: 'Contoh: Butuh biaya sekolah',
|
||||||
|
alasan_tidak_bebas_memilih_pembeli: 'Contoh: Masih punya hutang pada pembeli',
|
||||||
|
alasan_minat_pembeli_harga_stabil: 'Contoh: Lebih aman untuk rencana biaya keluarga',
|
||||||
|
};
|
||||||
|
|
||||||
$('#status-kepemilikan-lahan, #pihak-membantu, #status-konflik, #pengetahuan-harga-hasil-olah, #pernah-jual-harga-lebih-tinggi, #usaha-mutu-tambahan-harga, #kedekatan-sesama-anggota, #status-kartu-tani, #bisa-beli-pupuk-bersubsidi, #minat-pembeli-stabil, .sosial-ekonomi-komoditas').select2();
|
$('#status-kepemilikan-lahan, #pihak-membantu, #status-konflik, #pengetahuan-harga-hasil-olah, #pernah-jual-harga-lebih-tinggi, #usaha-mutu-tambahan-harga, #kedekatan-sesama-anggota, #status-kartu-tani, #bisa-beli-pupuk-bersubsidi, #minat-pembeli-stabil, .sosial-ekonomi-komoditas').select2();
|
||||||
|
|
||||||
@@ -1247,6 +1290,7 @@
|
|||||||
|
|
||||||
$tbody.append($row);
|
$tbody.append($row);
|
||||||
$row.find('.sosial-ekonomi-komoditas').select2();
|
$row.find('.sosial-ekonomi-komoditas').select2();
|
||||||
|
applySosialEkonomiExamples($row);
|
||||||
syncKomoditasLainnyaOptions();
|
syncKomoditasLainnyaOptions();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1534,6 +1578,22 @@
|
|||||||
return digits.replace(/\B(?=(\d{3})+(?!\d))/g, '.');
|
return digits.replace(/\B(?=(\d{3})+(?!\d))/g, '.');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function normalizedFieldName(name) {
|
||||||
|
return String(name || '').replace(/\[\d+\]/g, '[]');
|
||||||
|
}
|
||||||
|
|
||||||
|
function applySosialEkonomiExamples($scope = $(document)) {
|
||||||
|
$scope.find('input:not([type="hidden"]):not([type="radio"]):not([type="checkbox"]), textarea').each(function () {
|
||||||
|
const $field = $(this);
|
||||||
|
const name = normalizedFieldName($field.attr('name'));
|
||||||
|
const example = fieldExamples[name] || ($field.hasClass('currency-input') ? 'Contoh: 150.000' : null);
|
||||||
|
|
||||||
|
if (example) {
|
||||||
|
$field.attr('placeholder', example);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
function clearPendapatanRow($row) {
|
function clearPendapatanRow($row) {
|
||||||
$row.find('select').val('').trigger('change');
|
$row.find('select').val('').trigger('change');
|
||||||
$row.find('input[type="text"], input[type="number"]').val('');
|
$row.find('input[type="text"], input[type="number"]').val('');
|
||||||
@@ -1567,6 +1627,9 @@
|
|||||||
this.setSelectionRange(this.value.length, this.value.length);
|
this.setSelectionRange(this.value.length, this.value.length);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
$('.currency-input').each(function () {
|
||||||
|
this.value = formatRupiah(this.value);
|
||||||
|
});
|
||||||
$('form').on('submit', function () {
|
$('form').on('submit', function () {
|
||||||
$(this).find('.currency-input').each(function () {
|
$(this).find('.currency-input').each(function () {
|
||||||
this.value = onlyDigits(this.value);
|
this.value = onlyDigits(this.value);
|
||||||
@@ -1587,6 +1650,7 @@
|
|||||||
$('#total-hutang-tidak-bersedia').on('change', syncTotalHutangFields);
|
$('#total-hutang-tidak-bersedia').on('change', syncTotalHutangFields);
|
||||||
$('input[name="tekanan_jual_segera"]').on('change', syncTekananJualFields);
|
$('input[name="tekanan_jual_segera"]').on('change', syncTekananJualFields);
|
||||||
$('input[name="kebebasan_memilih_pembeli"]').on('change', syncKebebasanPembeliFields);
|
$('input[name="kebebasan_memilih_pembeli"]').on('change', syncKebebasanPembeliFields);
|
||||||
|
applySosialEkonomiExamples();
|
||||||
syncKomoditasLainnyaOptions();
|
syncKomoditasLainnyaOptions();
|
||||||
setupAllPendapatanRows();
|
setupAllPendapatanRows();
|
||||||
syncPihakMembantuFields();
|
syncPihakMembantuFields();
|
||||||
|
|||||||
@@ -1058,6 +1058,49 @@
|
|||||||
const pinjamanTokohAdatAda = @json($pinjamanTokohAdatAdaValue);
|
const pinjamanTokohAdatAda = @json($pinjamanTokohAdatAdaValue);
|
||||||
const tekananJualSegeraAda = @json($tekananJualSegeraAdaValue);
|
const tekananJualSegeraAda = @json($tekananJualSegeraAdaValue);
|
||||||
const kebebasanMemilihPembeliCukupBebas = Number(@json($kebebasanMemilihPembeliCukupBebasValue));
|
const kebebasanMemilihPembeliCukupBebas = Number(@json($kebebasanMemilihPembeliCukupBebasValue));
|
||||||
|
const fieldExamples = {
|
||||||
|
jumlah_tanggungan: 'Contoh: 4',
|
||||||
|
anak_masih_sekolah: 'Contoh: 2',
|
||||||
|
yang_ikut_bekerja: 'Contoh: 2',
|
||||||
|
'pendapatan_komoditas[][pendapatan]': 'Contoh: 3.500.000',
|
||||||
|
'pendapatan_luar_pertanian[][jenis_pekerjaan]': 'Contoh: Buruh bangunan',
|
||||||
|
'pendapatan_luar_pertanian[][estimasi_per_bulan]': 'Contoh: 1.500.000',
|
||||||
|
bulan_paceklik: 'Contoh: Januari-Maret',
|
||||||
|
sumber_penghasilan_paceklik: 'Contoh: Buruh harian',
|
||||||
|
total_estimasi_biaya_kebun_per_musim: 'Contoh: 2.500.000',
|
||||||
|
estimasi_tabungan_per_bulan: 'Contoh: 250.000',
|
||||||
|
alasan_kecukupan_penghasilan: 'Contoh: Cukup untuk makan dan biaya sekolah',
|
||||||
|
keterangan_sengketa: 'Contoh: Batas lahan belum disepakati',
|
||||||
|
pihak_membantu_konflik_nama: 'Contoh: Ketua adat setempat',
|
||||||
|
tahun_bantuan_konflik: 'Contoh: 2025',
|
||||||
|
alasan_mencoba_praktik_baru: 'Contoh: Ingin meningkatkan hasil panen',
|
||||||
|
hambatan_mengubah_cara_bertani: 'Contoh: Biaya dan tenaga terbatas',
|
||||||
|
contoh_pemahaman_mutu_harga: 'Contoh: Biji kering bersih dihargai lebih tinggi',
|
||||||
|
penyebab_harga_lebih_tinggi: 'Contoh: Kualitas lebih baik dan pembeli premium',
|
||||||
|
alasan_usaha_mutu_tambahan_harga: 'Contoh: Harga tambahan menutup biaya proses',
|
||||||
|
nama_lokasi_panutan: 'Contoh: Pak Anton, Dusun Wae',
|
||||||
|
harapan_program: 'Contoh: Bantuan pelatihan dan akses pembeli',
|
||||||
|
rencana_jangka_panjang: 'Contoh: Menambah tanaman dan memperbaiki kebun',
|
||||||
|
nama_kelompok_tani: 'Contoh: Kelompok Tani Maju Bersama',
|
||||||
|
lama_bergabung_kelompok_tahun: 'Contoh: 3',
|
||||||
|
topik_biasa_dibahas: 'Contoh: Pemupukan, hama, dan harga jual',
|
||||||
|
manfaat_lain_kartu_tani: 'Contoh: Lebih mudah membeli pupuk',
|
||||||
|
nama_bank: 'Contoh: BRI',
|
||||||
|
alasan_kredit_ditolak_lainnya: 'Contoh: Belum punya agunan',
|
||||||
|
jenis_aset_produktif_lainnya: 'Contoh: Mesin parut',
|
||||||
|
keterangan_kondisi_aset: 'Contoh: Pompa air masih berfungsi baik',
|
||||||
|
program_keuangan_formal_lainnya_nama: 'Contoh: Arisan kelompok',
|
||||||
|
'detail_bantuan_ngo_perusahaan[][nama_lembaga]': 'Contoh: Yayasan Tani Sejahtera',
|
||||||
|
'detail_bantuan_ngo_perusahaan[][bentuk_bantuan]': 'Contoh: Bibit dan pelatihan',
|
||||||
|
'detail_bantuan_ngo_perusahaan[][frekuensi]': 'Contoh: 2',
|
||||||
|
'detail_bantuan_ngo_perusahaan[][tahun_terakhir]': 'Contoh: 2025',
|
||||||
|
keterangan_pinjaman_tokoh_adat: 'Contoh: Pinjaman dibayar setelah panen',
|
||||||
|
total_hutang_rupiah: 'Contoh: 1.500.000',
|
||||||
|
total_hutang_setara_kg_panen: 'Contoh: 100',
|
||||||
|
penyebab_tekanan_jual_segera: 'Contoh: Butuh biaya sekolah',
|
||||||
|
alasan_tidak_bebas_memilih_pembeli: 'Contoh: Masih punya hutang pada pembeli',
|
||||||
|
alasan_minat_pembeli_harga_stabil: 'Contoh: Lebih aman untuk rencana biaya keluarga',
|
||||||
|
};
|
||||||
|
|
||||||
$('#status-kepemilikan-lahan, #pihak-membantu, #status-konflik, #pengetahuan-harga-hasil-olah, #pernah-jual-harga-lebih-tinggi, #usaha-mutu-tambahan-harga, #kedekatan-sesama-anggota, #status-kartu-tani, #bisa-beli-pupuk-bersubsidi, #minat-pembeli-stabil, .sosial-ekonomi-komoditas').select2();
|
$('#status-kepemilikan-lahan, #pihak-membantu, #status-konflik, #pengetahuan-harga-hasil-olah, #pernah-jual-harga-lebih-tinggi, #usaha-mutu-tambahan-harga, #kedekatan-sesama-anggota, #status-kartu-tani, #bisa-beli-pupuk-bersubsidi, #minat-pembeli-stabil, .sosial-ekonomi-komoditas').select2();
|
||||||
|
|
||||||
@@ -1243,6 +1286,7 @@
|
|||||||
|
|
||||||
$tbody.append($row);
|
$tbody.append($row);
|
||||||
$row.find('.sosial-ekonomi-komoditas').select2();
|
$row.find('.sosial-ekonomi-komoditas').select2();
|
||||||
|
applySosialEkonomiExamples($row);
|
||||||
syncKomoditasLainnyaOptions();
|
syncKomoditasLainnyaOptions();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1530,6 +1574,22 @@
|
|||||||
return digits.replace(/\B(?=(\d{3})+(?!\d))/g, '.');
|
return digits.replace(/\B(?=(\d{3})+(?!\d))/g, '.');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function normalizedFieldName(name) {
|
||||||
|
return String(name || '').replace(/\[\d+\]/g, '[]');
|
||||||
|
}
|
||||||
|
|
||||||
|
function applySosialEkonomiExamples($scope = $(document)) {
|
||||||
|
$scope.find('input:not([type="hidden"]):not([type="radio"]):not([type="checkbox"]), textarea').each(function () {
|
||||||
|
const $field = $(this);
|
||||||
|
const name = normalizedFieldName($field.attr('name'));
|
||||||
|
const example = fieldExamples[name] || ($field.hasClass('currency-input') ? 'Contoh: 150.000' : null);
|
||||||
|
|
||||||
|
if (example) {
|
||||||
|
$field.attr('placeholder', example);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
function clearPendapatanRow($row) {
|
function clearPendapatanRow($row) {
|
||||||
$row.find('select').val('').trigger('change');
|
$row.find('select').val('').trigger('change');
|
||||||
$row.find('input[type="text"], input[type="number"]').val('');
|
$row.find('input[type="text"], input[type="number"]').val('');
|
||||||
@@ -1563,6 +1623,9 @@
|
|||||||
this.setSelectionRange(this.value.length, this.value.length);
|
this.setSelectionRange(this.value.length, this.value.length);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
$('.currency-input').each(function () {
|
||||||
|
this.value = formatRupiah(this.value);
|
||||||
|
});
|
||||||
$('form').on('submit', function () {
|
$('form').on('submit', function () {
|
||||||
$(this).find('.currency-input').each(function () {
|
$(this).find('.currency-input').each(function () {
|
||||||
this.value = onlyDigits(this.value);
|
this.value = onlyDigits(this.value);
|
||||||
@@ -1583,6 +1646,7 @@
|
|||||||
$('#total-hutang-tidak-bersedia').on('change', syncTotalHutangFields);
|
$('#total-hutang-tidak-bersedia').on('change', syncTotalHutangFields);
|
||||||
$('input[name="tekanan_jual_segera"]').on('change', syncTekananJualFields);
|
$('input[name="tekanan_jual_segera"]').on('change', syncTekananJualFields);
|
||||||
$('input[name="kebebasan_memilih_pembeli"]').on('change', syncKebebasanPembeliFields);
|
$('input[name="kebebasan_memilih_pembeli"]').on('change', syncKebebasanPembeliFields);
|
||||||
|
applySosialEkonomiExamples();
|
||||||
syncKomoditasLainnyaOptions();
|
syncKomoditasLainnyaOptions();
|
||||||
setupAllPendapatanRows();
|
setupAllPendapatanRows();
|
||||||
syncPihakMembantuFields();
|
syncPihakMembantuFields();
|
||||||
|
|||||||
Reference in New Issue
Block a user