aboutsummaryrefslogtreecommitdiff
path: root/interface/views/citizens.ejs
blob: 224471393a5c00a76b84a2128675cbb4aec56da4 (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
<!DOCTYPE html>
<html lang="en">
  <head>
    <%- include('partials/head') %>
    <style>
      .ui.menu {
        margin: 0;
      }
      .ui.table {
        margin: 0;
      }
    </style>
  </head>

  <body>
    <div class="ui modal edit">
      <i class="close icon"></i>
      <div class="header">Editing Citizen (<span id="citizen_id"></span>)</div>
      <div
        class="ui padded container segment"
        style="border: none; box-shadow: none"
      >
        <form class="ui form" method="post" onsubmit="editCitizen(event)">
          <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="Mobile Number"
              id="mobile_number"
            />
          </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="ui primary button" id="editCitizen">Submit</div>
          <div class="ui error message"></div>
        </form>
      </div>
    </div>

    <%- include('partials/navbar') %>
    <table class="ui selectable table">
      <thead>
        <tr>
          <th>First 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>Village Name</th>
          <th></th>
        </tr>
      </thead>
      <tbody>
        <% for(var i=0; i < citizens.length; i++) { %>
        <tr>
          <td><%= citizens[i].first_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].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') %>
  <script src="/citizens.js"></script>
</html>