forked from pandigresik/simdesa
-
Notifications
You must be signed in to change notification settings - Fork 0
/
mutasi_masuk.php
executable file
·183 lines (181 loc) · 4.7 KB
/
mutasi_masuk.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
<?php
include_once "include/config.php";
?>
<div class="top-bar">
<h1>Pertambahan Penduduk</h1>
<div class="breadcrumbs">Update data perubahan penduduk yang lahir dan pindah masuk</div>
</div>
<div id="stylized">
<form id="form" name="form" method="post" action="simpan_mutasi.php">
<label>No. KTP
<span class="small">Masukkan no ktp anda</span>
</label>
<input type="text" name="no_ktp" id="no_ktp" class="isian"/>
<span class="ket"></span>
<label >Nama
<span class="small">Masukkan nama anda</span>
</label>
<input type="text" name="nama" id="nama" class="isian" />
<span class="ket"></span>
<label >Agama
<span class="small">Pilih agama anda</span>
</label>
<select name="agama" id="agama" class="isian">
<?php
for($i = 0; $i < count($agama); $i++){
if($i == 0){
$value="";
}
else {
$value=$agama[$i];
}
echo "<option value=".$value.">".$agama[$i]."</option>";
}
?>
</select>
<span class="ket"></span>
<label>Tempat Lahir
<span class="small">Masukkan tempat lahir anda</span>
</label>
<input type="text" name="t_lahir" id="t_lahir" class="isian"/>
<span class="ket"></span>
<label>Tanggal Lahir
<span class="small">Tahun-bulan-tanggal (2010-02-19)</span>
</label>
<input type="text" name="tgl_lahir" id="tgl_lahir" class="isian" readonly />
<span class="ket"></span>
<label>Jenis Kelamin
<span class="small">L = laki - laki, W = wanita</span>
</label>
<select name="j_kel" id="j_kel" class="isian">
<?php
$i = 0;
foreach($j_kelamin as $index => $val){
if($i == 0){
$value="";
}
else {
$value=$index;
}
echo "<option value=".$value.">".$val."</option>";
$i++;
}
?>
</select>
<span class="ket"></span>
<label>Golongan Darah
<span class="small">Golongan darah anda</span>
</label>
<select name="gol_darah" id="gol_darah" class="isian">
<?php
$i = 0;
foreach($gol_darah as $index){
if($i == 0){
$value="";
}
else {
$value=$index;
}
echo "<option value=".$value.">".$index."</option>";
$i++;
}
?>
</select>
<span class="ket"></span>
<label>Warga negara
<span class="small">Kewarganegaraan anda</span>
</label>
<input type="text" name="w_negara" id="w_negara" class="isian"/>
<span class="ket"></span>
<label>Pendidikan
<span class="small">Pendidikan anda</span>
</label>
<input type="text" name="pendidikan" id="pendidikan" class="isian"/>
<span class="ket"></span>
<label>Pekerjaan
<span class="small">Pekerjaan anda</span>
</label>
<input type="text" name="pekerjaan" id="pekerjaan" class="isian" />
<span class="ket"></span>
<label>Status Pernikahan
<span class="small">Status pernikahan anda</span>
</label>
<select name="s_nikah" id="s_nikah" class="isian">
<?php
for($i = 0; $i < count($s_pernikahan); $i++){
if($i == 0){
$value="";
}
else {
$value=$s_pernikahan[$i];
}
echo "<option value=".$value.">".$s_pernikahan[$i]."</option>";
}
?>
</select>
<span class="ket"></span>
<label>Mutasi
<span class="small">Jenis mutasi </span>
</label>
<select id="mutasi" class="isian" onchange="isi_tanggal(this)">
<option value="">Pilih jenis mutasi</option>
<option value="lahir">Lahir</option>
<option value="masuk">Pindah Masuk</option>
</select>
<span class="ket"></span>
<label>Tanggal
<span class="small">Tanggal lahir / pindah </span>
</label>
<input type="text" id="tanggal" class="isian" />
<span class="ket"></span>
<label>Keterangan
<span class="small">Sebab kematian / pindah </span>
</label>
<input type="text" style="width:400px" id="ket" class="isian" />
<span class="ket"></span>
<button type="submit" class="isian">Simpan</button>
<span style="margin:10px;float:left;display:none" id="status_proses" class="proses-inline"></span>
</form>
</div>
<script>
function isi_tanggal(elm){
if($(elm).val() == "lahir"){
$("#tanggal").val($("#tgl_lahir").val());
$("#ket").focus();
}
}
$(function(){
awal();
$("#tanggal,#tgl_lahir").datepicker({dateFormat:"yy-mm-dd",changeMonth:true,changeYear:true,yearRange:"1930"});
$("#form").submit(function(){
var url = $(this).attr("action");
// inputan harus diisi semua
var ada_error = 0;
$(".isian:not(:last)").each(function(){
if($(this).val() == ""){
$(this).focus();
ada_error++;
return false;
}
})
// simpan ke database gan
if(!ada_error){
$("#status_proses").removeClass("sukses-inline").fadeIn("slow");
var no_ktp = $("#no_ktp").val();
var tanggal = $("#tanggal").val();
var ket = $("#ket").val();
var mutasi = $("#mutasi").val();
var inputs = $(this).serializeArray(); //berupa JSON object
$.post(url,{data:inputs,id_warga:no_ktp,tanggal:tanggal,ket:ket,mutasi:mutasi,status:"1"},function(data){
if(data == 1){
$("#status_proses").removeClass("proses-inline")
.addClass("sukses-inline").delay("2000").fadeOut("slow");
$("input,select").val("");
awal();
}
});
}
return false;
})
})
</script>