add data petani
This commit is contained in:
@@ -80,7 +80,9 @@ class PetaniController extends Controller
|
|||||||
'kk' => ['nullable', 'min:16', 'max:16'],
|
'kk' => ['nullable', 'min:16', 'max:16'],
|
||||||
'file_kk' => ['nullable', 'image', 'mimes:jpeg,jpg,png', 'max:2048'],
|
'file_kk' => ['nullable', 'image', 'mimes:jpeg,jpg,png', 'max:2048'],
|
||||||
'foto' => ['nullable', 'image', 'mimes:jpeg,jpg,png', 'max:2048'],
|
'foto' => ['nullable', 'image', 'mimes:jpeg,jpg,png', 'max:2048'],
|
||||||
'nomor_telepon' => ['nullable', 'numeric', 'max:20'],
|
'nomor_telepon' => ['nullable', 'digits_between:11,13'],
|
||||||
|
], [
|
||||||
|
'nomor_telepon.digits_between' => 'Nomor telepon harus berupa angka 11 sampai 13 digit.',
|
||||||
]);
|
]);
|
||||||
|
|
||||||
if ($request->hasFile('file_ktp')) {
|
if ($request->hasFile('file_ktp')) {
|
||||||
@@ -162,7 +164,9 @@ class PetaniController extends Controller
|
|||||||
'kk' => ['nullable', 'min:16', 'max:16'],
|
'kk' => ['nullable', 'min:16', 'max:16'],
|
||||||
'file_kk' => ['nullable', 'file', 'mimes:jpeg,jpg,png,pdf', 'max:2048'],
|
'file_kk' => ['nullable', 'file', 'mimes:jpeg,jpg,png,pdf', 'max:2048'],
|
||||||
'foto' => ['nullable', 'file', 'mimes:jpeg,jpg,png', 'max:2048'],
|
'foto' => ['nullable', 'file', 'mimes:jpeg,jpg,png', 'max:2048'],
|
||||||
'nomor_telepon' => ['nullable', 'numeric', 'max:20'],
|
'nomor_telepon' => ['nullable', 'digits_between:11,13'],
|
||||||
|
], [
|
||||||
|
'nomor_telepon.digits_between' => 'Nomor telepon harus berupa angka 11 sampai 13 digit.',
|
||||||
]);
|
]);
|
||||||
|
|
||||||
if ($request->hasFile('file_ktp')) {
|
if ($request->hasFile('file_ktp')) {
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ class Petani extends Model
|
|||||||
'uid',
|
'uid',
|
||||||
'nama',
|
'nama',
|
||||||
|
|
||||||
'telepon',
|
'nomor_telepon',
|
||||||
'alamat',
|
'alamat',
|
||||||
|
|
||||||
'kk',
|
'kk',
|
||||||
|
|||||||
@@ -12,16 +12,13 @@
|
|||||||
</div>
|
</div>
|
||||||
@endif
|
@endif
|
||||||
<div class="row">
|
<div class="row">
|
||||||
|
|
||||||
<!-- PROFIL PETANI -->
|
|
||||||
@include('produktivitas.petani.header', ['petani' => null])
|
|
||||||
|
|
||||||
<div class="row">
|
|
||||||
<div class="col-md-12">
|
<div class="col-md-12">
|
||||||
|
|
||||||
<div class="card mb-6">
|
<div class="card mb-6">
|
||||||
<div class="card-body pt-12">
|
<div class="card-header border-bottom">
|
||||||
<!-- INFORMASI PETANI -->
|
<h5 class="card-title mb-0">Tambah Petani Baru</h5>
|
||||||
|
</div>
|
||||||
|
<div class="card-body pt-4">
|
||||||
<form id="addNewPetaniForm" action="{{ route('petani.store') }}" method="POST" enctype="multipart/form-data">
|
<form id="addNewPetaniForm" action="{{ route('petani.store') }}" method="POST" enctype="multipart/form-data">
|
||||||
@csrf
|
@csrf
|
||||||
<div class="row">
|
<div class="row">
|
||||||
@@ -35,7 +32,7 @@
|
|||||||
width="120"
|
width="120"
|
||||||
alt="User avatar" />
|
alt="User avatar" />
|
||||||
<div class="user-info text-center">
|
<div class="user-info text-center">
|
||||||
<h5><i>Nama Petani</i></h5>
|
<h5><i>Petani Baru</i></h5>
|
||||||
<span class="badge bg-label-secondary">Petani</span>
|
<span class="badge bg-label-secondary">Petani</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -157,7 +154,7 @@
|
|||||||
<div class="col-md-3 mb-4 form-control-validation">
|
<div class="col-md-3 mb-4 form-control-validation">
|
||||||
<label class="form-label" for="add-petani-no-hp">Nomor Telepon</label>
|
<label class="form-label" for="add-petani-no-hp">Nomor Telepon</label>
|
||||||
<input type="text" class="form-control @error('nomor_telepon') is-invalid @enderror" id="add-petani-no-hp" name="nomor_telepon"
|
<input type="text" class="form-control @error('nomor_telepon') is-invalid @enderror" id="add-petani-no-hp" name="nomor_telepon"
|
||||||
placeholder="Cth: 081234567890" value="{{ old('nomor_telepon') }}" />
|
placeholder="Cth: 081234567890" value="{{ old('nomor_telepon') }}" minlength="11" maxlength="13" />
|
||||||
@error('nomor_telepon')<div class="error invalid-feedback">{{ $message }}</div>@enderror
|
@error('nomor_telepon')<div class="error invalid-feedback">{{ $message }}</div>@enderror
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -183,7 +180,7 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="mt-4 text-end">
|
<div class="mt-4 text-end">
|
||||||
<button type="submit" class="btn btn-success data-submit wave-effect wave-light">Simpan Profil</button>
|
<button type="submit" class="btn btn-success data-submit wave-effect wave-light">Simpan Petani</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</form>
|
</form>
|
||||||
@@ -191,7 +188,6 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
@endsection
|
@endsection
|
||||||
|
|
||||||
@@ -278,7 +274,7 @@
|
|||||||
status_perkawinan: { required: true },
|
status_perkawinan: { required: true },
|
||||||
file_ktp: { accept: "image/png, image/jpeg, image/jpg" },
|
file_ktp: { accept: "image/png, image/jpeg, image/jpg" },
|
||||||
file_kk: { accept: "image/png, image/jpeg, image/jpg" },
|
file_kk: { accept: "image/png, image/jpeg, image/jpg" },
|
||||||
nomor_telepon: { required: false, digits: true, maxlength: 20 }
|
nomor_telepon: { required: false, digits: true, minlength: 11, maxlength: 13 }
|
||||||
},
|
},
|
||||||
messages: {
|
messages: {
|
||||||
nama: { required: "Nama petani wajib diisi" },
|
nama: { required: "Nama petani wajib diisi" },
|
||||||
@@ -296,7 +292,11 @@
|
|||||||
status_perkawinan: { required: "Status perkawinan wajib diisi" },
|
status_perkawinan: { required: "Status perkawinan wajib diisi" },
|
||||||
file_ktp: { accept: "Format file tidak valid. Harap unggah file berupa gambar (PNG, JPEG, JPG)" },
|
file_ktp: { accept: "Format file tidak valid. Harap unggah file berupa gambar (PNG, JPEG, JPG)" },
|
||||||
file_kk: { accept: "Format file tidak valid. Harap unggah file berupa gambar (PNG, JPEG, JPG)" },
|
file_kk: { accept: "Format file tidak valid. Harap unggah file berupa gambar (PNG, JPEG, JPG)" },
|
||||||
nomor_telepon: { digits: "Nomor telepon harus berupa angka", maxlength: "Nomor telepon maksimal 20 digit" }
|
nomor_telepon: {
|
||||||
|
digits: "Nomor telepon harus berupa angka",
|
||||||
|
minlength: "Nomor telepon minimal 11 digit",
|
||||||
|
maxlength: "Nomor telepon maksimal 13 digit"
|
||||||
|
}
|
||||||
},
|
},
|
||||||
errorElement: 'div',
|
errorElement: 'div',
|
||||||
errorPlacement: function (error, element) {
|
errorPlacement: function (error, element) {
|
||||||
@@ -312,4 +312,4 @@
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
@endpush
|
@endpush
|
||||||
|
|||||||
@@ -159,7 +159,7 @@
|
|||||||
<div class="col-md-3 mb-4 form-control-validation">
|
<div class="col-md-3 mb-4 form-control-validation">
|
||||||
<label class="form-label" for="edit-petani-nomor-telepon">Nomor Telepon</label>
|
<label class="form-label" for="edit-petani-nomor-telepon">Nomor Telepon</label>
|
||||||
<input type="text" class="form-control @error('nomor_telepon') is-invalid @enderror" id="edit-petani-nomor-telepon" name="nomor_telepon"
|
<input type="text" class="form-control @error('nomor_telepon') is-invalid @enderror" id="edit-petani-nomor-telepon" name="nomor_telepon"
|
||||||
placeholder="Cth: 081234567890" value="{{ old('nomor_telepon', $petani->nomor_telepon) }}" />
|
placeholder="Cth: 081234567890" value="{{ old('nomor_telepon', $petani->nomor_telepon) }}" minlength="11" maxlength="13" />
|
||||||
@error('nomor_telepon')<div class="error invalid-feedback">{{ $message }}</div>@enderror
|
@error('nomor_telepon')<div class="error invalid-feedback">{{ $message }}</div>@enderror
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -303,7 +303,7 @@
|
|||||||
status_perkawinan: { required: true },
|
status_perkawinan: { required: true },
|
||||||
file_ktp: { accept: "image/png, image/jpeg, image/jpg" },
|
file_ktp: { accept: "image/png, image/jpeg, image/jpg" },
|
||||||
file_kk: { accept: "image/png, image/jpeg, image/jpg" },
|
file_kk: { accept: "image/png, image/jpeg, image/jpg" },
|
||||||
nomor_telepon: { required: false, digits: true, maxlength: 20 }
|
nomor_telepon: { required: false, digits: true, minlength: 11, maxlength: 13 }
|
||||||
},
|
},
|
||||||
messages: {
|
messages: {
|
||||||
nama: { required: "Nama petani wajib diisi" },
|
nama: { required: "Nama petani wajib diisi" },
|
||||||
@@ -321,7 +321,11 @@
|
|||||||
status_perkawinan: { required: "Status perkawinan wajib diisi" },
|
status_perkawinan: { required: "Status perkawinan wajib diisi" },
|
||||||
file_ktp: { accept: "Format file tidak valid. Harap unggah file berupa gambar (PNG, JPEG, JPG)" },
|
file_ktp: { accept: "Format file tidak valid. Harap unggah file berupa gambar (PNG, JPEG, JPG)" },
|
||||||
file_kk: { accept: "Format file tidak valid. Harap unggah file berupa gambar (PNG, JPEG, JPG)" },
|
file_kk: { accept: "Format file tidak valid. Harap unggah file berupa gambar (PNG, JPEG, JPG)" },
|
||||||
nomor_telepon: { digits: "Nomor telepon harus berupa angka", maxlength: "Nomor telepon maksimal 20 digit" }
|
nomor_telepon: {
|
||||||
|
digits: "Nomor telepon harus berupa angka",
|
||||||
|
minlength: "Nomor telepon minimal 11 digit",
|
||||||
|
maxlength: "Nomor telepon maksimal 13 digit"
|
||||||
|
}
|
||||||
|
|
||||||
},
|
},
|
||||||
errorElement: 'div',
|
errorElement: 'div',
|
||||||
@@ -338,4 +342,4 @@
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
@endpush
|
@endpush
|
||||||
|
|||||||
Reference in New Issue
Block a user