Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update the code #1

Open
wants to merge 39 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
42dbfba
Updated HTML and Working on Javascript itinerary list
ZaneMODell Apr 9, 2022
1a8adff
Began for loop iterations and HTML Upgrade
ZaneMODell Apr 9, 2022
cff4fd6
Added style.css and updated index.html
ZaneMODell Apr 9, 2022
a742242
Changed slider value
ZaneMODell Apr 9, 2022
5ea4d75
added conditional for food preferences
ZaneMODell Apr 9, 2022
64f8faf
Update index.html
emilygoldwater Apr 10, 2022
e38733b
test push
ZaneMODell Apr 10, 2022
e6e84f3
Merge branch 'main' of https://github.com/ZaneMODell/spartahackvii in…
ZaneMODell Apr 10, 2022
851167a
Update style.css
emilygoldwater Apr 10, 2022
a54a538
Merge branch 'main' of https://github.com/ZaneMODell/spartahackvii
emilygoldwater Apr 10, 2022
c681cab
Update index.html
emilygoldwater Apr 10, 2022
c3f6741
added files
emilygoldwater Apr 10, 2022
10bf7c1
Update index.html
Wilson-chongchong Apr 10, 2022
afbded7
html, design.png, css
emilygoldwater Apr 10, 2022
4314b42
updated html
emilygoldwater Apr 10, 2022
0434d5b
updating app.js
ZaneMODell Apr 10, 2022
1439b15
Merge branch 'main' of https://github.com/ZaneMODell/spartahackvii in…
ZaneMODell Apr 10, 2022
b6ed794
aversion
emilygoldwater Apr 10, 2022
fd944f6
Merge branch 'main' of https://github.com/ZaneMODell/spartahackvii
emilygoldwater Apr 10, 2022
d372391
thing
ZaneMODell Apr 10, 2022
c943e7b
Merge branch 'main' of https://github.com/ZaneMODell/spartahackvii in…
ZaneMODell Apr 10, 2022
a4971c3
Finished iterating through the database
ZaneMODell Apr 10, 2022
be440c0
added and updated files
emilygoldwater Apr 10, 2022
7a00aec
Merge branch 'main' of https://github.com/ZaneMODell/spartahackvii
emilygoldwater Apr 10, 2022
40613d1
App.js line adjustments
ZaneMODell Apr 10, 2022
3df16cd
Merge branch 'main' of https://github.com/ZaneMODell/spartahackvii in…
ZaneMODell Apr 10, 2022
fe17879
updates
emilygoldwater Apr 10, 2022
17c49f0
Merge branch 'main' of https://github.com/ZaneMODell/spartahackvii
emilygoldwater Apr 10, 2022
e3df953
Added createItinerary and submitFunction
ZaneMODell Apr 10, 2022
e099758
Merge branch 'main' of https://github.com/ZaneMODell/spartahackvii in…
ZaneMODell Apr 10, 2022
9450e3d
createItinerary modified
ZaneMODell Apr 10, 2022
902f578
anotherone
emilygoldwater Apr 10, 2022
fcd59d9
Merge branch 'main' of https://github.com/ZaneMODell/spartahackvii
emilygoldwater Apr 10, 2022
b86f45f
html done?
emilygoldwater Apr 10, 2022
32bc924
purpose
emilygoldwater Apr 10, 2022
d48198d
css updates
emilygoldwater Apr 10, 2022
568b5e5
Reworked the connection between the HTML and Javascript elements. Iti…
ZaneMODell Apr 10, 2022
e110de3
Merge branch 'main' of https://github.com/ZaneMODell/spartahackvii in…
ZaneMODell Apr 10, 2022
371f7b0
final
ZaneMODell Apr 10, 2022
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
15 changes: 15 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"type": "pwa-chrome",
"request": "launch",
"name": "Launch Chrome against localhost",
"url": "http://localhost:8080",
"webRoot": "${workspaceFolder}"
}
]
}
Binary file added 0travel_icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
47 changes: 47 additions & 0 deletions about.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title></title> <!--title of the tap -->
<link rel="stylesheet" href="./style.css"> <!-- include the style.css file for the presentation-->
</head>
<body>
<ul> <!--how to add the blue background??-->
<li><a class="active" href="index.html">Home</a></li>
<li><a href="purpose.html">Our Purpose</a></li>
<li><a href="about.html">About Us</a></li>
<li><a href="itinerary.html" style="visibility:hidden">Itinerary</a></li>
</ul>
<div class="about_doc">
<br>
<br>

<h1>Who We Are</h1>
<br>
<!--http://clipart-library.com/clip-art/michigan-state-logo-transparent-1.htm-->
<h3>Hi! We are a group of sophomores at Michigan State University, all majoring in
computer science. Although our interests range from game development to entrepreneurship
and innovation, we all love to travel, and hope you enjoy MyTinerary!
</h3>
<br>
<div class="about_pic1">
<img src="michigan-state-logo-transparent-1.png" alt="MSU Icon">
</div>
<br>
<h2>What We've Learned</h2>
<br>
<h3> In the process of working on MyTinerary, we have been learning how to use HTML, CSS, and JavaScript.
We combined these tools to create and style web pages and integrate the form the user filled out with our
itinerary generation. None of us knew very much about any of these tools, but we have learned a lot through
trying them out during SpartaHack.
</h3>
<br>
<div class="about_pic2">
<img src="logos.png" alt="Logos"> <!--colors shouldn't be inverted-->
</div>
<br>
</div>
</body>
</html>
197 changes: 197 additions & 0 deletions app-backup.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,197 @@
class Attraction {
constructor(name, open_time, close_time, cost_scale, radius, local) {
this.name = name;
this.open_time = open_time;
this.close_time = close_time;
this.cost_scale = cost_scale;
this.radius = radius;
this.local = local;
this.activity_level = 0;
}
}

//Preference variables

var city_traveled;
var begin_date_reference;
var end_date_reference;
var activity_level_reference;
var budget_range_reference;
var hotel_location_reference;
var breakfast_provided_reference;
var preferred_radius_reference;
var transport_type_reference;
var food_preferences_reference = [];
var vegetarian_preference_reference;
var vegan_preference_reference;
var travel_party_reference;
var wake_up_time_reference;
var bed_time_reference;
var itinerary_list = [];


const destination = document.getElementById("destination");
const budget = document.getElementById("budget");
const begin_date = document.getElementById("begin_date");
const end_date = document.getElementById("end_date");
const hotel = document.getElementById("hotel");
const radius = document.getElementById("radius");
const food1 = document.querySelector("input[type=checkbox]");
const food2 = document.getElementById("food2");
const num_people = document.getElementById("num_people");
const begin_time = document.getElementById("begin_time");
const end_time = document.getElementById("end_time");

// const background2 = document.querySelector(".background2");


var budget_current = 1;

budget.addEventListener("change", () => {
if (budget.value == " $ (low) "){
budget_current = 1;
}
else if (budget.value == " $$ (medium) "){
budget_current = 2;
}
else{
budget_current = 3;
}
});

radius_current = 1;
radius.addEventListener("change", () =>{
radius_current = parseFloat(radius.value);
})

food1.addEventListener("change", () =>{
if (food1.checked){
food_preferences_reference.push(food1.value);
}
else{
food_preferences_reference.pop(food1.value);
}
})

food2.addEventListener("change", () =>{
if (food2.checked){
food_preferences_reference.push(food2.value);
}
else{
food_preferences_reference.pop(food2.value);
}
})

// function createDatabase(){
// name, open_time, close_time, cost_scale, radius, local
// let Udon_Sushi_Restaurant = new Attraction("Udon_Sushi_Restaurant", 12, 20, 3, 3, true)
// let Omi_Sushi = new Attraction("Omi_Sushi", 11, 20, 2, 1, true)
// let East_Cafe = new Attraction("East_Cafe", 5, 24, 2, 3, true)
// let Royal_Pot = new Attraction("Royal_Pot", 10, 24, 2, 2, true)

//AMERICAN
let Olympic_Broil = new Attraction("Olympic Broil", 11, 20, 1, 6.2, true)
let Buffalo_Wild_Wings = new Attraction("Buffalo_Wild_Wings", 11, 24, 2, 1, false)
let iHop = new Attraction("iHop", 7, 15, 2, 1, false)
let Red_Haven = new Attraction("Red Haven", 17, 20, 3, 2.3, true)

//ITALIAN
let Sidebar = new Attraction("Sidebar", 12, 0, 1, 2.5, true)
let Jets_Pizza = new Attraction("Jet's Pizza", 10, 22, 2, 2.2, false)
let Andiamo_Fenton = new Attraction("Andiamo Fenton", 15, 22, 3, 60, true)

//Indoor Activities
let Spare_Time = new Attraction("Spare Time", 13, 23, 2, 2.2, true)

//Outdoor Activities
let Horticulture_Gardens = new Attraction("Horticulture Gardens", 6, 22, 1, 1, true)

const data_dict = {
"Food": {"American": [Olympic_Broil, Buffalo_Wild_Wings, iHop, Red_Haven], "Italian": [Sidebar, Jets_Pizza, Andiamo_Fenton]},
"Activities": {"Indoor": [Spare_Time], "Outdoor": [Horticulture_Gardens]}
};

// for (const [key, value] of Object.entries(data_dict)) {
// var add_count = 0;
// for (const [inner_key, inner_value] of Object.entries(value)){
// for (var i = 0; i < inner_value.length; i++){
// // if (inner_value[i].activity_level <= activity_level_reference){
// // add_count += 1;
// // }
// if (inner_value[i].radius <= preferred_radius_reference){
// add_count += 1;
// }
// if (inner_value[i].cost_scale <= budget_range_reference){
// add_count += 1;
// }
// if (inner_key in food_preferences_reference){
// add_count += 1;
// }

// if (add_count >= 1){
// itinerary_list.push(inner_value[i])
// }
// add_count = 0;
// }
// }

// }
// return itinerary_list;
// }

function createItinerary(itinerary_list){
for (var i = 0; i < itinerary_list.length; i++){
console.log(itinerary_list[i])
const curr_activity = itinerary_list[i];
const activity_name = curr_activity.name;
const open_time = curr_activity.open_time;
const close_time = curr_activity.close_time;
const cost_scale = curr_activity.cost_scale;
const radius = curr_activity.radius;
const local = curr_activity.local;

const activity_name_container = document.createElement("p");
const activity_time_container = document.createElement("span");
const activity_cost_container = document.createElement("span");
const activity_radius_container = document.createElement("span");
const activity_local_container = document.createElement("span");

activity_name_container.innerHTML = activity_name;
activity_time_container.innerHTML = `${open_time} - ${close_time}`;
activity_cost_container.innerHTML = cost_scale;
activity_radius_container.innerHTML = radius;
activity_local_container.innerHTML = local;

const itineraryList = document.querySelector("#itinerary-list");
const activity_placard = document.createElement("div");
activity_placard.append(activity_name_container);
activity_placard.append(activity_time_container);
activity_placard.append(activity_cost_container);
activity_placard.append(activity_radius_container);
activity_placard.append(activity_local_container);
itineraryList.append(activity_placard);

// const activity_level = curr_activity.activity_level;

}
}
// const itineraryContainer = document.createElement("div");
// console.log(itineraryContainer);
// itineraryContainer.classList.add("textbox");
// background2.append(itineraryContainer);


const submitButton = document.querySelector("#submit-button");

submitButton.addEventListener('click', (e) => {
e.preventDefault();
submitFunction();
})

// Object.keys(data_dict).forEach(function(key) {
// console.log(data_dict[key])
// });

function submitFunction(){
createItinerary(data_dict);
}
Loading