248 lines
6.0 KiB
HTML
248 lines
6.0 KiB
HTML
<!DOCTYPE html>
|
|
<html lang="id">
|
|
<head>
|
|
<meta charset="UTF-8" />
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
|
|
<title>Formulir Pemindahan TPS</title>
|
|
<style>
|
|
body {
|
|
font-family: sans-serif;
|
|
padding: 20px;
|
|
background-color: #fff;
|
|
}
|
|
|
|
/* HEADER */
|
|
.header {
|
|
position: relative;
|
|
padding-bottom: 30px;
|
|
}
|
|
|
|
.back-btn {
|
|
background: none;
|
|
border: none;
|
|
font-size: 20px;
|
|
cursor: pointer;
|
|
position: absolute;
|
|
left: 0;
|
|
top: 0;
|
|
}
|
|
|
|
.header h2 {
|
|
margin: 0;
|
|
font-size: 20px;
|
|
text-align: center;
|
|
}
|
|
|
|
.sub {
|
|
font-size: 14px;
|
|
color: #888;
|
|
text-align: center;
|
|
margin-top: 4px;
|
|
}
|
|
|
|
.steps {
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
margin-top: 16px;
|
|
gap: 10px;
|
|
}
|
|
|
|
.step {
|
|
width: 28px;
|
|
height: 28px;
|
|
border-radius: 50%;
|
|
background-color: #eee;
|
|
color: #999;
|
|
font-weight: bold;
|
|
display: flex;
|
|
justify-content: center;
|
|
align-items: center;
|
|
}
|
|
|
|
.step.active {
|
|
background-color: #e74c3c;
|
|
color: #fff;
|
|
}
|
|
|
|
.line {
|
|
height: 4px;
|
|
width: 60px;
|
|
background-color: #e74c3c;
|
|
border-radius: 4px;
|
|
}
|
|
|
|
/* FORM */
|
|
.form-group {
|
|
margin-bottom: 16px;
|
|
}
|
|
|
|
label {
|
|
display: block;
|
|
margin-bottom: 6px;
|
|
font-weight: 600;
|
|
}
|
|
|
|
select, input[type="text"], input[type="file"] {
|
|
width: 100%;
|
|
padding: 10px;
|
|
font-size: 14px;
|
|
border-radius: 8px;
|
|
border: 1px solid #ccc;
|
|
}
|
|
|
|
button {
|
|
width: 100%;
|
|
background-color: #e74c3c;
|
|
color: white;
|
|
border: none;
|
|
padding: 14px;
|
|
font-size: 16px;
|
|
border-radius: 8px;
|
|
cursor: pointer;
|
|
margin-top: 20px;
|
|
}
|
|
|
|
.file-label {
|
|
font-size: 13px;
|
|
color: #666;
|
|
margin-top: 4px;
|
|
}
|
|
</style>
|
|
</head>
|
|
<body>
|
|
|
|
<!-- HEADER -->
|
|
<div class="header">
|
|
<button class="back-btn" onclick="history.back()">←</button>
|
|
<h2>Form A5 Pindah TPS</h2>
|
|
<p class="sub">Lengkapi data dibawah untuk melanjutkan proses pemindahan TPS</p>
|
|
<div class="steps">
|
|
<div class="step active">1</div>
|
|
<div class="line"></div>
|
|
<div class="step active">2</div>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- FORM -->
|
|
<div class="form-group">
|
|
<label>Provinsi</label>
|
|
<select id="provinsi">
|
|
<option selected disabled>Pilih Provinsi</option>
|
|
</select>
|
|
</div>
|
|
|
|
<div class="form-group">
|
|
<label>Kabupaten / Kota</label>
|
|
<select id="kabupaten">
|
|
<option selected disabled>Pilih Kabupaten</option>
|
|
</select>
|
|
</div>
|
|
|
|
<div class="form-group">
|
|
<label>Kecamatan</label>
|
|
<select id="kecamatan">
|
|
<option selected disabled>Pilih Kecamatan</option>
|
|
</select>
|
|
</div>
|
|
|
|
<div class="form-group">
|
|
<label>Desa / Kelurahan</label>
|
|
<select id="desa">
|
|
<option selected disabled>Pilih Desa</option>
|
|
</select>
|
|
</div>
|
|
|
|
<div class="form-group">
|
|
<label>RW</label>
|
|
<input type="text" id="rw" placeholder="Contoh: 001">
|
|
</div>
|
|
|
|
<div class="form-group">
|
|
<label>RT</label>
|
|
<input type="text" id="rt" placeholder="Contoh: 002">
|
|
</div>
|
|
|
|
<div class="form-group">
|
|
<label>Upload Dokumen Pendukung</label>
|
|
<input type="file" id="file" accept=".pdf,.jpg,.jpeg,.png">
|
|
<div class="file-label">PDF atau gambar, maksimal 2MB</div>
|
|
</div>
|
|
|
|
<button onclick="submitForm()">Simpan</button>
|
|
|
|
<!-- SCRIPT -->
|
|
<script>
|
|
const API = "https://www.emsifa.com/api-wilayah-indonesia/api";
|
|
const provinsi = document.getElementById('provinsi');
|
|
const kabupaten = document.getElementById('kabupaten');
|
|
const kecamatan = document.getElementById('kecamatan');
|
|
const desa = document.getElementById('desa');
|
|
|
|
// Load Provinsi
|
|
fetch(`${API}/provinces.json`)
|
|
.then(res => res.json())
|
|
.then(data => {
|
|
data.forEach(p => {
|
|
provinsi.innerHTML += `<option value="${p.id}">${p.name}</option>`;
|
|
});
|
|
});
|
|
|
|
// Load Kabupaten
|
|
provinsi.addEventListener('change', () => {
|
|
kabupaten.innerHTML = `<option selected disabled>Pilih Kabupaten</option>`;
|
|
kecamatan.innerHTML = `<option selected disabled>Pilih Kecamatan</option>`;
|
|
desa.innerHTML = `<option selected disabled>Pilih Desa</option>`;
|
|
fetch(`${API}/regencies/${provinsi.value}.json`)
|
|
.then(res => res.json())
|
|
.then(data => {
|
|
data.forEach(k => {
|
|
kabupaten.innerHTML += `<option value="${k.id}">${k.name}</option>`;
|
|
});
|
|
});
|
|
});
|
|
|
|
// Load Kecamatan
|
|
kabupaten.addEventListener('change', () => {
|
|
kecamatan.innerHTML = `<option selected disabled>Pilih Kecamatan</option>`;
|
|
desa.innerHTML = `<option selected disabled>Pilih Desa</option>`;
|
|
fetch(`${API}/districts/${kabupaten.value}.json`)
|
|
.then(res => res.json())
|
|
.then(data => {
|
|
data.forEach(d => {
|
|
kecamatan.innerHTML += `<option value="${d.id}">${d.name}</option>`;
|
|
});
|
|
});
|
|
});
|
|
|
|
// Load Desa
|
|
kecamatan.addEventListener('change', () => {
|
|
desa.innerHTML = `<option selected disabled>Pilih Desa</option>`;
|
|
fetch(`${API}/villages/${kecamatan.value}.json`)
|
|
.then(res => res.json())
|
|
.then(data => {
|
|
data.forEach(v => {
|
|
desa.innerHTML += `<option value="${v.id}">${v.name}</option>`;
|
|
});
|
|
});
|
|
});
|
|
|
|
// Simulasi submit
|
|
function submitForm() {
|
|
const rw = document.getElementById('rw').value.trim();
|
|
const rt = document.getElementById('rt').value.trim();
|
|
const file = document.getElementById('file').files[0];
|
|
|
|
if (!provinsi.value || !kabupaten.value || !kecamatan.value || !desa.value || !rw || !rt || !file) {
|
|
alert("Mohon lengkapi semua data dan unggah dokumen.");
|
|
return;
|
|
}
|
|
|
|
alert("✅ Form berhasil dikirim");
|
|
window.location.href = 'home-pemilih-tunggu.html';
|
|
}
|
|
</script>
|
|
|
|
</body>
|
|
</html>
|