-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathdisplayData.js
83 lines (55 loc) · 1.98 KB
/
displayData.js
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
import { isEmpty } from "./utils/utils.js";
export function displayDataController(venues, specialHours, specials) {
// Clear previous content
console.log("type: ", typeof venues);
console.log("type: ", typeof specialHours);
console.log("type: ", typeof specials);
/*
// Step 1: Normalize data
const venuesMap = Object.fromEntries(venues.map(venue => [venue.id, venue]));
const specialHoursMap = Object.fromEntries(specialHours.map(hour => [hour.venueId, hour]));
const specialsMap = Object.fromEntries(specials.map(special => [special.venueId, special]));
console.log(combinedData);
*/
// displayVenues(venues, specials);
// displaySpecialHours(specialHours);
// displaySpecials(specials);
}
function displayVenues(venues, specials){
const venueListDiv = document.createElement('div');
venueListDiv.id = 'venueList';
venueListDiv.innerHTML = '';
document.body.appendChild(venueListDiv);
// Add new venues
venues.forEach(venue => {
let venueDiv = document.createElement('div');
venueDiv.innerHTML = `
<h3>${venue.txtVenueName}</h3>
<h6><a href='${venue.txtVenueWebsite}'>${venue.txtVenueWebsite}</a> <br>${venue.txtVenueAddress1}' <br>${venue.txtVenuePhoneNumber}</h6>
`;
venueListDiv.appendChild(venueDiv);
//
});
}
function displaySpecialHours(specialHours){
}
function displaySpecials(specials){
console.log(isEmpty(specials)); // true
specials.prop = 'value';
console.log(isEmpty(specials)); // false
const specialsListDiv = document.createElement('div');
specialsListDiv.id = 'specialsList';
specialsListDiv.innerHTML = '';
document.body.appendChild(specialsListDiv);
console.log("specials length: ", specials.id)
// Add new venues
specials.forEach(special => {
// console.log("special: ", special.txtSpecialName);
let specialDiv = document.createElement('div');
specialDiv.innerHTML = `
<p>Happy Hour: ${special.txtSpecialName}</p>
`;
specialsListDiv.appendChild(specialDiv);
//
});
}