blob: d11b4f5bac1e1b238ca387db113683b63df3f9f5 (
plain)
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
|
<!DOCTYPE html>
<html lang="en">
<script>
function editCitizensRecord(citizen) {
$(".edit.modal").modal("show");
$("#address").val(citizen.address);
$("#mobilenumber").val(citizen.mobile_num);
$("#dob").val(citizen.dob);
$("#marital_status").val(citizen.marital_status);
$('#villagename').val(citizen.village_name);
}
function editCitizen(event) {
event.preventDefault();
var data = {
address: $("#address").val(),
mobilenumber: $("#mobilenumber").val(),
dob: $("#dob").val(),
marital_status: $("#marital_status").val(),
villagename: $("#villagename").val(),
};
$.ajax({
url: "/citizen/edit",
type: "POST",
data: data,
success: function(response) {
console.log(response);
$(".edit.modal").modal("hide");
location.reload();
}
});
}
</script>
<head>
<%- include('partials/head') %>
</head>
<body>
<div class="ui modal edit">
<i class="close icon"></i>
<div class="header">Log in to continue</div>
<div
class="ui padded container segment"
style="border: none; box-shadow: none"
>
<div class="ui form">
<div class="field">
<label>Address</label>
<input
placeholder="Address"
name="address"
type="text"
autocomplete="off"
id="address"
/>
</div>
<div class="field">
<label>Mobile Number</label>
<input
type="text"
name="mobile_number"
placeholder="Mobuile Number"
id="mobilenumber"
/>
</div>
<div class="field">
<label>Date of Birth</label>
<input
type="date"
name="dob"
placeholder="DOB"
id="dob"
/>
</div>
<div class="field">
<label>Marital Status</label>
<select class="ui dropdown" id="marital_status">
<option value="M">Married</option>
<option value="UM">Unmarried</option>
</select>
</div>
<div class="field">
<label>Village Name</label>
<input
type="text"
name="village"
placeholder="Village Name"
id="villagename"
/>
</div>
<div class="ui primary button" id="submit">Submit</div>
<div class="ui error message"></div>
</div>
</div>
</div>
<%- include('partials/navbar') %>
<table class="ui selectable table" style="padding: 2%">
<thead>
<tr>
<!-- <th>Citizen ID</th> -->
<th>First Name</th>
<!-- <th>Middle Name</th> -->
<th>Last Name</th>
<th>Address</th>
<th>Mobile Number</th>
<th>Date of Birth</th>
<th>Gender</th>
<th>Marital Status</th>
<!-- <th>Disabled</th>
<th>Disabled Percentage</th> -->
<!-- <th>Caste</th> -->
<th>Village Name</th>
<th></th>
</tr>
</thead>
<tbody>
<% for(var i=0; i < citizens.length; i++) { %>
<tr>
<!-- <td><%= citizens[i].citizen_id %></td> -->
<td><%= citizens[i].first_name %></td>
<!-- <td>
<%= citizens[i].middle_name ? citizens[i].middle_name : '-' %>
</td> -->
<td><%= citizens[i].last_name %></td>
<td><%= citizens[i].address %></td>
<td><%= citizens[i].mobile_num %></td>
<td><%= citizens[i].dob %></td>
<td><%= citizens[i].gender %></td>
<td><%= citizens[i].marital_status %></td>
<!-- <td><%= citizens[i].disabled %></td> -->
<!-- <td><%= citizens[i].disbaled_percentage %></td> -->
<!-- <td><%= citizens[i].caste %></td> -->
<td><%= citizens[i].village_name %></td>
<td>
<div class="ui teal buttons">
<div class="ui button" onclick="editCitizensRecord(<%=JSON.stringify(citizens[i])%>)">Edit</div>
<div class="ui floating dropdown icon button">
<i class="dropdown icon"></i>
<div class="menu">
<div class="item" onclick="deleteCitizenRecord(<%= JSON.stringify(citizens[i])%>)"><i class="delete icon"></i> Delete</div>
</div>
</div>
</div>
</td>
</tr>
<% } %>
</tbody>
</table>
</body>
<%- include('partials/scripts') %>
</html>
|