Skip to content

Commit

Permalink
industry filter working #59 #60 #9
Browse files Browse the repository at this point in the history
  • Loading branch information
thegsi committed Jan 13, 2016
1 parent cdfd781 commit 799f49d
Show file tree
Hide file tree
Showing 4 changed files with 87 additions and 83 deletions.
11 changes: 6 additions & 5 deletions lib/companydashboardsearch.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ var client = require('./redis.js');

exports.register = function (server, options, next) {

var template = require('./societydashboardhandlebars.js');
var template = require('./companydashboardhandlebars.js');

server.route([
{
Expand All @@ -19,9 +19,10 @@ var template = require('./societydashboardhandlebars.js');
description: 'return home page',
handler: function(request,reply){
var requestPayload = request.payload;
var arrayOfFilters = ['type:society'];
var arrayOfFilters = ['type:company'];
var requestPayloadKeys = Object.keys(requestPayload);
var object = [];
var companyHashesArrayFiltered = [];
console.log('companydashboardsearch requestPayload', requestPayload);

var arrayOfSetNames = function(requestPayload,requestPayloadKeys){
requestPayloadKeys.forEach(function(elem){
Expand All @@ -35,7 +36,7 @@ var template = require('./societydashboardhandlebars.js');
var callback = function(){

var quoteData = {
object:object
object:companyHashesArrayFiltered
};
var quote = template.buildQuote(quoteData);
return reply(quote);
Expand All @@ -46,7 +47,7 @@ var template = require('./societydashboardhandlebars.js');
.each(function(membersArray){
return client.hgetallAsync(membersArray)
.then(function(hgetallobject){
object.push(hgetallobject);
companyHashesArrayFiltered.push(hgetallobject);
});
})
.then(function(){
Expand Down
5 changes: 2 additions & 3 deletions lib/companyredis.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
//var client = redisClient.createClient(process.env.REDIS_URL);
var client = require('./redis.js');


exports.register = function(server, options, next) {

var companyDatabase = function(request, reply) {
Expand All @@ -15,8 +14,8 @@ exports.register = function(server, options, next) {
var companyFormObjectKeys = Object.keys(companyFormObject);

var thisId = client.incr('id', function(err, reply) {
var companyHashArray = [reply, 'id', reply, 'timestamp', timeNow, 'date', date];
var companyHashArray = [reply, 'id', reply, 'timestamp', timeNow, 'date', date, 'type', 'company'];

function addHashToDatabase(reply){
client.hmset.apply(client,companyHashArray);
}
Expand Down
69 changes: 41 additions & 28 deletions views/companydashboard.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,25 +2,46 @@ <h1> Company dashboard</h1>

<form role="form" action="/companydashboardsearch" method="POST" id="companyForm">

<label for="University">University Name</label>
<input type="text" id="university" name="university" placeholder="university auto/comp" value="University of Glasgow" >
<output id="universityAcList"></output>
<br>
<label for="Region">Region </label>
<select name="region" id="region" >
<option value="" selected>Select region</option>
<option value="East" selected="selected">East</option>
<option value="East Midlands">East Midlands</option>
<option value="London">London</option>
<option value="North East">North East</option>
<option value="North West">North West</option>
<option value="Northern Ireland">Northern Ireland</option>
<option value="Scotland">Scotland</option>
<option value="South East">South East</option>
<option value="South West">South West</option>
<option value="Wales">Wales</option>
<option value="West Midlands">West Midlands</option>
<option value="Yorkshire and the Humber">Yorkshire and the Humber</option>
<label for="Industry">Industry </label>
<select name="industry" id="industry" >
<option value="" selected>Select industry</option>
<option value="Aeronautics and Defence">Aeronautics and Defence</option>
<option value="Alternative Investment Instruments">Alternative Investment Instruments</option>
<option value="Automotive and Parts">Automotive and Parts</option>
<option value="Banking">Banking</option>
<option value="Beverages">Beverages</option>
<option value="Building and Materials">Building and Materials</option>
<option value="Commercial Transportation">Commercial Transportation</option>
<option value="Domestic Goods">Domestic Goods</option>
<option value="Electricity Generation and Distribution">Electricity Generation and Distribution</option>
<option value="Electronic & Electrical Equipment">Electronic & Electrical Equipment</option>
<option value="Engineering Products">Engineering Products</option>
<option value="Financials">Financials</option>
<option value="Food Products">Food Products</option>
<option value="Forestry & Paper">Forestry & Paper</option>
<option value="Fossil Fuels and Distribution">Fossil Fuels and Distribution</option>
<option value="Health Care and Related Services">Health Care and Related Services</option>
<option value="Household Utilities">Household Utilities</option>
<option value="Industrial Chemicals">Industrial Chemicals</option>
<option value="Industrials">Industrials</option>
<option value="Insurance">Insurance</option>
<option value="Investment Companies">Investment Companies</option>
<option value="IT Hardware">IT Hardware</option>
<option value="IT Services">IT Services</option>
<option value="Leisure Products">Leisure Products</option>
<option value="Media">Media</option>
<option value="Medicine and Biotech Research">Medicine and Biotech Research</option>
<option value="Metals">Metals</option>
<option value="Mining">Mining</option>
<option value="Personal Goods">Personal Goods</option>
<option value="Property">Property</option>
<option value="Property Investment Trusts">Property Investment Trusts</option>
<option value="Retailers">Retailers</option>
<option value="Support">Support</option>
<option value="Telecommunications">Telecommunications</option>
<option value="Tobacco">Tobacco</option>
<option value="Tourism and Leisure">Tourism and Leisure</option>
<option value="Utilities">Utilities</option>
</select>
<br>
<label for="Type of society">Type of society </label>
Expand All @@ -41,15 +62,7 @@ <h1> Company dashboard</h1>
<option value="Other">Other</option>
</select>
<br>
<label for="Member size">Member Size</label>
<select name="memberSize" id="region" >
<option value="" selected>Select size</option>
<option value="0-50" selected="selected">0-50</option>
<option value="51-100">51-100</option>
<option value="101-150">101-150</option>
<option value="151-200">151-200</option>
<option value="200+">200 +</option>
</select>

<br>

<button type="submit">Submit</button>
Expand Down
85 changes: 38 additions & 47 deletions views/partials/companyform.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,56 +6,47 @@ <h1 class="text-center">COMPANY FORM</h1>
<label for="companyName">Company Name</label>
<input type="text" name="companyName" value="companyX" class="form-control" required>
</div>

<!-- //Aeronautics and Defence
Alternative Investment Instruments
Automotive and Parts
Banking
Beverages
Building and Materials
Commercial Transportation
Domestic Goods
Electricity Generation and Distribution
Electronic & Electrical Equipment
Engineering Products
Financials
Food Products
Forestry & Paper
Fossil Fuels and Distribution
Health Care and Related Services
Household Utilities
Industrial Chemicals
Industrials
Insurance
Investment Companies
IT Hardware
IT Services
Leisure Products
Media
Medicine and Biotech Research
Metals
Mining
Personal Goods
Property
Property Investment Trusts
Retailers
Support
Telecommunications
Tobacco
Tourism and Leisure
Utilities -->
<div class="form-group">
<label for="industryType">Industry Type</label>
<select name="industryType" id="industry" class="form-control" required>
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
<option value="5">5</option>
<option value="6">6</option>
<option value="7">7</option>
<option value="8">8</option>
<option value="9">9</option>
<option value="" selected>Select industry</option>
<option value="Aeronautics and Defence">Aeronautics and Defence</option>
<option value="Alternative Investment Instruments">Alternative Investment Instruments</option>
<option value="Automotive and Parts">Automotive and Parts</option>
<option value="Banking">Banking</option>
<option value="Beverages">Beverages</option>
<option value="Building and Materials">Building and Materials</option>
<option value="Commercial Transportation">Commercial Transportation</option>
<option value="Domestic Goods">Domestic Goods</option>
<option value="Electricity Generation and Distribution">Electricity Generation and Distribution</option>
<option value="Electronic & Electrical Equipment">Electronic & Electrical Equipment</option>
<option value="Engineering Products">Engineering Products</option>
<option value="Financials">Financials</option>
<option value="Food Products">Food Products</option>
<option value="Forestry & Paper">Forestry & Paper</option>
<option value="Fossil Fuels and Distribution">Fossil Fuels and Distribution</option>
<option value="Health Care and Related Services">Health Care and Related Services</option>
<option value="Household Utilities">Household Utilities</option>
<option value="Industrial Chemicals">Industrial Chemicals</option>
<option value="Industrials">Industrials</option>
<option value="Insurance">Insurance</option>
<option value="Investment Companies">Investment Companies</option>
<option value="IT Hardware">IT Hardware</option>
<option value="IT Services">IT Services</option>
<option value="Leisure Products">Leisure Products</option>
<option value="Media">Media</option>
<option value="Medicine and Biotech Research">Medicine and Biotech Research</option>
<option value="Metals">Metals</option>
<option value="Mining">Mining</option>
<option value="Personal Goods">Personal Goods</option>
<option value="Property">Property</option>
<option value="Property Investment Trusts">Property Investment Trusts</option>
<option value="Retailers">Retailers</option>
<option value="Support">Support</option>
<option value="Telecommunications">Telecommunications</option>
<option value="Tobacco">Tobacco</option>
<option value="Tourism and Leisure">Tourism and Leisure</option>
<option value="Utilities">Utilities</option>
</select>
</div>
<div class="form-group">
Expand Down

0 comments on commit 799f49d

Please sign in to comment.