Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions eservices
Submodule eservices added at ba0136
55 changes: 55 additions & 0 deletions p4-nigeria/nigeria.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
<!DOCTYPE html>
<html>
<head>
<title>Nigeria States</title>
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css" integrity="sha384-JcKb8q3iqJ61gNV9KGb8thSsNjpSL0n8PARn9HuZOnIxN0hoP+VmmDGMN5t9UJ0Z" crossorigin="anonymous">

<style type="text/css">

</style>

</head>
<body>
<div class="container">


<h1>States & LGAs </h1>
<h3>How it works?</h3>
<ul>
<li>Click on state in the drop-down</li>
<li>it will list the LGA's under it </li>

</ul>

<div class="row">
<div class="col-3">
<h4>Select A State</h4>
<select id="states">
</select>
</div>
<div class="col-2">
<p>Select LGA</p>
<select id="lga">


</select>

</div>
<div class="col-2"></div>
<div class="col-5">
<h4><span id="number_of_lgas"></span> LGAs in <span id="state_name">State</span></h4>
<ol id="lga-list">

</ol>
</div>
</div>
</div>





</body>
<script type="text/javascript" src="nigeria.json"></script>
<script type="text/javascript" src="nigeria.js"></script>
</html>
58 changes: 58 additions & 0 deletions p4-nigeria/nigeria.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
console.log(nigeria)

let nigeria_state = document.getElementById('states')

let state_local_government = document.getElementById('lga')
let state_local_government_list = document.getElementById('lga-list')

let state_name = document.getElementById('state_name')
let number_of_lgas = document.getElementById('number_of_lgas')

for( let index in nigeria )
{
//console.log(state, nigeria[state].state.name)

let option = document.createElement("option")
option.setAttribute("value", nigeria[index].state.id)
option.textContent = nigeria[index].state.name

nigeria_state.appendChild(option)

}

nigeria_state.addEventListener('click', (e) => {
console.log(e, nigeria_state )

if(nigeria_state.value)
{
let state_index = parseInt( nigeria_state.value ) - 1


// console.log(e, nigeria[ state_index ].state.name )

state_name.textContent = nigeria[ state_index ].state.name


let state_lga = nigeria[state_index].state.locals
number_of_lgas.textContent = state_lga.length
// console.log(state_index, state_lga, state_lga[0].name)

state_local_government_list.innerHTML = ""
state_local_government.innerHTML = ""

for( lga in state_lga )
{
let option = document.createElement("option")
option.setAttribute("value",state_lga[lga].id)
option.textContent = state_lga[lga].name

state_local_government.appendChild(option)


let listItem = document.createElement("li")
listItem.textContent = state_lga[lga].name

state_local_government_list.appendChild(listItem)
}
}
})
6 changes: 6 additions & 0 deletions p4-nigeria/nigeria.json

Large diffs are not rendered by default.

18 changes: 17 additions & 1 deletion routes/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,24 @@ var express = require('express');
var router = express.Router();

/* GET home page. */
router.get('/', function(req, res, next) {
router.get('/', function(req, res) {
res.render('index', { title: 'EServices' });
});

/* GET contact page. */

router.get('/contact', function(req, res, next) {
res.render('contact');
});

/* GET together page. */
router.get('/', function(req, res, next) {
res.render('together');
});

/* GET search page. */
router.get('/', function(req, res, next) {
res.render('search');
});

module.exports = router;
5 changes: 5 additions & 0 deletions views/search.jade
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
extends layout

block content
h1= title
p Welcome to #{title}
25 changes: 25 additions & 0 deletions views/together.jade
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
extends layout

block content
h1 Together Page
p Local Government

h2 local Governments in Enugu State
ul
li Aninri
li Agwu
li Enugu East
li Enugu North
li Enugu South
li Ezeagu
li Igbo Etiti
li Igbo Eze North
li Igbo Eze South
li Isi Uzo
li Nkanu East
li Nkanu West
li Nsukka
li Oji River
li Udenu
li Udi
li Uzo-Uwani