Merge branch 'main' of https://git.probindo.com/Probindo/database-pertani-web
This commit is contained in:
@@ -235,6 +235,8 @@ class SosialEkonomiController extends Controller
|
||||
|
||||
private function validateData(Request $request, ?int $id = null): array
|
||||
{
|
||||
$this->normalizeCurrencyInput($request);
|
||||
|
||||
$section = $request->input('form_section');
|
||||
|
||||
$rules = [
|
||||
@@ -530,6 +532,51 @@ class SosialEkonomiController extends Controller
|
||||
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
|
||||
{
|
||||
$payload = collect($validated)
|
||||
|
||||
@@ -37,17 +37,17 @@
|
||||
<form id="formAuthentication" class="mb-4" action="{{ route('auth.authenticate') }}" method="POST">
|
||||
@csrf
|
||||
<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
|
||||
type="text"
|
||||
class="form-control"
|
||||
id="email"
|
||||
name="email_username"
|
||||
placeholder="Masukkan email atau username Anda"
|
||||
placeholder="Masukkan email atau nama pengguna Anda"
|
||||
autofocus />
|
||||
</div>
|
||||
<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">
|
||||
<input
|
||||
type="password"
|
||||
@@ -63,15 +63,15 @@
|
||||
<div class="d-flex justify-content-between">
|
||||
<div class="form-check mb-0 ms-2">
|
||||
<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>
|
||||
<a href="auth-forgot-password-basic.html">
|
||||
<p class="mb-0">Lupa Password?</p>
|
||||
<p class="mb-0">Lupa Kata Sandi?</p>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
<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>
|
||||
</form>
|
||||
|
||||
|
||||
@@ -8,32 +8,26 @@
|
||||
<span class="app-brand-logo demo">
|
||||
<span class="text-primary">
|
||||
<svg width="32" height="24" viewBox="0 0 32 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
|
||||
<!-- Daun Kiri (Hijau transparan) -->
|
||||
<path opacity="0.3"
|
||||
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"
|
||||
d="M16 2.5C16 2.5 27 6.5 27 15.5C27 20.5 21 23.5 16 23.5V2.5Z"
|
||||
fill="#2E7D32" />
|
||||
|
||||
<!-- Grafik Biru (bawah → tengah) -->
|
||||
<path d="M2 19L10 11L15 15"
|
||||
stroke="#0054A6"
|
||||
stroke-width="2.5"
|
||||
stroke-linecap="round"
|
||||
stroke-linejoin="round" />
|
||||
|
||||
<!-- Grafik Merah (tengah → atas) -->
|
||||
<path d="M15 15L27 4"
|
||||
stroke="#ED1C24"
|
||||
stroke-width="2.5"
|
||||
stroke-linecap="round"
|
||||
stroke-linejoin="round" />
|
||||
|
||||
<!-- Titik target -->
|
||||
<circle cx="27" cy="4" r="2.5" fill="#ED1C24" />
|
||||
</svg>
|
||||
</span>
|
||||
@@ -45,20 +39,20 @@
|
||||
</a>
|
||||
</div>
|
||||
<!-- /Logo -->
|
||||
<h4 class="mb-1">Adventure starts here 🚀</h4>
|
||||
<p class="mb-6">Make your app management easy and fun!</p>
|
||||
<h4 class="mb-1">Buat akun AgroMonev</h4>
|
||||
<p class="mb-6">Lengkapi data berikut untuk membuat akun baru.</p>
|
||||
|
||||
<form id="formAuthentication" class="mb-6" action="{{ route('auth.createAccount') }}" method="POST">
|
||||
@csrf
|
||||
<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
|
||||
type="text"
|
||||
class="form-control"
|
||||
id="username"
|
||||
name="username"
|
||||
value="{{ old('username') }}"
|
||||
placeholder="Enter your username"
|
||||
placeholder="Masukkan nama pengguna"
|
||||
autofocus />
|
||||
@error('username')
|
||||
<div class="invalid-feedback d-block">{{ $message }}</div>
|
||||
@@ -66,13 +60,13 @@
|
||||
</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" />
|
||||
<input type="text" class="form-control" id="email" name="email" value="{{ old('email') }}" placeholder="Masukkan 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>
|
||||
<label class="form-label" for="password">Kata Sandi</label>
|
||||
<div class="input-group input-group-merge">
|
||||
<input
|
||||
type="password"
|
||||
@@ -88,7 +82,7 @@
|
||||
@enderror
|
||||
</div>
|
||||
<div class="mb-6 form-password-toggle form-control-validation">
|
||||
<label class="form-label" for="password_confirmation">Confirm Password</label>
|
||||
<label class="form-label" for="password_confirmation">Konfirmasi Kata Sandi</label>
|
||||
<div class="input-group input-group-merge">
|
||||
<input
|
||||
type="password"
|
||||
@@ -104,23 +98,23 @@
|
||||
<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">
|
||||
I agree to
|
||||
<a href="javascript:void(0);">privacy policy & terms</a>
|
||||
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">Sign up</button>
|
||||
<button type="submit" class="btn btn-primary d-grid w-100">Daftar</button>
|
||||
</form>
|
||||
|
||||
<p class="text-center">
|
||||
<span>Already have an account?</span>
|
||||
<span>Sudah memiliki akun?</span>
|
||||
<a href="{{ route('login') }}">
|
||||
<span>Sign in instead</span>
|
||||
<span>Masuk di sini</span>
|
||||
</a>
|
||||
</p>
|
||||
|
||||
<div class="divider my-6">
|
||||
<div class="divider-text">or</div>
|
||||
<div class="divider-text">atau</div>
|
||||
</div>
|
||||
|
||||
<div class="d-flex justify-content-center">
|
||||
|
||||
@@ -1062,6 +1062,49 @@
|
||||
const pinjamanTokohAdatAda = @json($pinjamanTokohAdatAdaValue);
|
||||
const tekananJualSegeraAda = @json($tekananJualSegeraAdaValue);
|
||||
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();
|
||||
|
||||
@@ -1247,6 +1290,7 @@
|
||||
|
||||
$tbody.append($row);
|
||||
$row.find('.sosial-ekonomi-komoditas').select2();
|
||||
applySosialEkonomiExamples($row);
|
||||
syncKomoditasLainnyaOptions();
|
||||
}
|
||||
|
||||
@@ -1534,6 +1578,22 @@
|
||||
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) {
|
||||
$row.find('select').val('').trigger('change');
|
||||
$row.find('input[type="text"], input[type="number"]').val('');
|
||||
@@ -1567,6 +1627,9 @@
|
||||
this.setSelectionRange(this.value.length, this.value.length);
|
||||
}
|
||||
});
|
||||
$('.currency-input').each(function () {
|
||||
this.value = formatRupiah(this.value);
|
||||
});
|
||||
$('form').on('submit', function () {
|
||||
$(this).find('.currency-input').each(function () {
|
||||
this.value = onlyDigits(this.value);
|
||||
@@ -1587,6 +1650,7 @@
|
||||
$('#total-hutang-tidak-bersedia').on('change', syncTotalHutangFields);
|
||||
$('input[name="tekanan_jual_segera"]').on('change', syncTekananJualFields);
|
||||
$('input[name="kebebasan_memilih_pembeli"]').on('change', syncKebebasanPembeliFields);
|
||||
applySosialEkonomiExamples();
|
||||
syncKomoditasLainnyaOptions();
|
||||
setupAllPendapatanRows();
|
||||
syncPihakMembantuFields();
|
||||
|
||||
@@ -1058,6 +1058,49 @@
|
||||
const pinjamanTokohAdatAda = @json($pinjamanTokohAdatAdaValue);
|
||||
const tekananJualSegeraAda = @json($tekananJualSegeraAdaValue);
|
||||
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();
|
||||
|
||||
@@ -1243,6 +1286,7 @@
|
||||
|
||||
$tbody.append($row);
|
||||
$row.find('.sosial-ekonomi-komoditas').select2();
|
||||
applySosialEkonomiExamples($row);
|
||||
syncKomoditasLainnyaOptions();
|
||||
}
|
||||
|
||||
@@ -1530,6 +1574,22 @@
|
||||
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) {
|
||||
$row.find('select').val('').trigger('change');
|
||||
$row.find('input[type="text"], input[type="number"]').val('');
|
||||
@@ -1563,6 +1623,9 @@
|
||||
this.setSelectionRange(this.value.length, this.value.length);
|
||||
}
|
||||
});
|
||||
$('.currency-input').each(function () {
|
||||
this.value = formatRupiah(this.value);
|
||||
});
|
||||
$('form').on('submit', function () {
|
||||
$(this).find('.currency-input').each(function () {
|
||||
this.value = onlyDigits(this.value);
|
||||
@@ -1583,6 +1646,7 @@
|
||||
$('#total-hutang-tidak-bersedia').on('change', syncTotalHutangFields);
|
||||
$('input[name="tekanan_jual_segera"]').on('change', syncTekananJualFields);
|
||||
$('input[name="kebebasan_memilih_pembeli"]').on('change', syncKebebasanPembeliFields);
|
||||
applySosialEkonomiExamples();
|
||||
syncKomoditasLainnyaOptions();
|
||||
setupAllPendapatanRows();
|
||||
syncPihakMembantuFields();
|
||||
|
||||
Reference in New Issue
Block a user