From 1023524f8cb533276db43f30e88ae31728fa3afb Mon Sep 17 00:00:00 2001
From: Drushya-jolly <160266129+Drushya-jolly@users.noreply.github.com>
Date: Sat, 8 Feb 2025 19:46:16 +0530
Subject: [PATCH 1/4] Add files via upload
---
index.html | 41 +++++++++++++++++++++
script.js | 91 +++++++++++++++++++++++++++++++++++++++++++++++
styles.css | 102 +++++++++++++++++++++++++++++++++++++++++++++++++++++
3 files changed, 234 insertions(+)
create mode 100644 index.html
create mode 100644 script.js
create mode 100644 styles.css
diff --git a/index.html b/index.html
new file mode 100644
index 000000000..7c00ab4cc
--- /dev/null
+++ b/index.html
@@ -0,0 +1,41 @@
+
+
+
+
+
+ AI Travel Itinerary Planner
+
+
+
+
+
+ AI Travel Itinerary Planner
+
+
+
+
Select Your Destination
+
+ Select a destination
+ Paris
+ New York
+ Tokyo
+
+
+ Enter Your Budget
+
+
+ Generate Itinerary
+
+
+
+
Your AI-Generated Itinerary
+
+
+
+
+
+ Export as PDF
+
+
+
+
diff --git a/script.js b/script.js
new file mode 100644
index 000000000..d71b6b8b6
--- /dev/null
+++ b/script.js
@@ -0,0 +1,91 @@
+const destinationData = {
+ "Paris": {
+ activities: [
+ { name: "Eiffel Tower Visit", cost: 30 },
+ { name: "Louvre Museum", cost: 20 },
+ { name: "Seine River Cruise", cost: 50 }
+ ],
+ accommodations: [
+ { name: "Budget Hotel", costPerNight: 100 },
+ { name: "Mid-range Hotel", costPerNight: 200 },
+ { name: "Luxury Hotel", costPerNight: 400 }
+ ]
+ },
+ "New York": {
+ activities: [
+ { name: "Statue of Liberty", cost: 25 },
+ { name: "Central Park", cost: 0 },
+ { name: "Broadway Show", cost: 100 }
+ ],
+ accommodations: [
+ { name: "Budget Hostel", costPerNight: 50 },
+ { name: "Mid-range Hotel", costPerNight: 150 },
+ { name: "Luxury Hotel", costPerNight: 350 }
+ ]
+ },
+ "Tokyo": {
+ activities: [
+ { name: "Shibuya Crossing", cost: 0 },
+ { name: "Tokyo Tower", cost: 15 },
+ { name: "Senso-ji Temple", cost: 0 }
+ ],
+ accommodations: [
+ { name: "Capsule Hotel", costPerNight: 40 },
+ { name: "Business Hotel", costPerNight: 100 },
+ { name: "Luxury Hotel", costPerNight: 300 }
+ ]
+ }
+};
+
+// Function to generate the AI-driven itinerary
+function generateItinerary() {
+ const destination = document.getElementById('destination').value;
+ const budget = parseFloat(document.getElementById('budget').value);
+
+ if (!destination || isNaN(budget) || budget <= 0) {
+ alert("Please enter a valid destination and budget.");
+ return;
+ }
+
+ // Check if the destination is in the predefined data
+ const data = destinationData[destination];
+ if (!data) {
+ alert("Sorry, we don't have data for this destination.");
+ return;
+ }
+
+ // Suggest activities based on the budget
+ let activities = data.activities.filter(activity => activity.cost <= budget);
+ let accommodations = data.accommodations.filter(acc => acc.costPerNight <= budget / 3); // Assume a 3-night stay
+
+ // Generate itinerary summary
+ let itinerarySummary = `
+ Destination: ${destination}
+ Activities (within your budget):
+
+ ${activities.map(activity => `${activity.name} - $${activity.cost} `).join('')}
+
+ Accommodation Options (within your budget):
+
+ ${accommodations.map(acc => `${acc.name} - $${acc.costPerNight} per night `).join('')}
+
+ Suggested Itinerary:
+
+ Day 1: Arrive and check into your accommodation
+ ${activities.slice(0, 2).map((activity, index) => `Day ${index + 2}: ${activity.name} `).join('')}
+
+ `;
+
+ // Display the generated itinerary
+ document.getElementById('itinerary-summary').innerHTML = itinerarySummary;
+}
+
+// Export function to PDF
+function exportItinerary() {
+ const { jsPDF } = window.jspdf;
+ const doc = new jsPDF();
+
+ const itineraryContent = document.getElementById('itinerary-summary').innerText;
+ doc.text(itineraryContent, 10, 10);
+ doc.save('itinerary.pdf');
+}
diff --git a/styles.css b/styles.css
new file mode 100644
index 000000000..9775d7354
--- /dev/null
+++ b/styles.css
@@ -0,0 +1,102 @@
+body {
+ font-family: Arial, sans-serif;
+ background-color: #f4f4f4;
+ color: #333;
+ margin: 0;
+ padding: 0;
+}
+
+header {
+ background-color: #4CAF50;
+ color: white;
+ text-align: center;
+ padding: 20px 0;
+}
+
+h1 {
+ margin: 0;
+}
+
+h2 {
+ font-size: 1.5rem;
+ margin-top: 0;
+ color: #444;
+}
+
+h3 {
+ font-size: 1.2rem;
+ margin-bottom: 10px;
+}
+
+h4 {
+ font-size: 1rem;
+ color: #555;
+}
+
+.form-container {
+ background-color: white;
+ padding: 20px;
+ margin: 20px;
+ border-radius: 8px;
+ box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
+}
+
+input[type="text"],
+input[type="number"] {
+ width: 100%;
+ padding: 10px;
+ margin: 10px 0;
+ border-radius: 4px;
+ border: 1px solid #ddd;
+}
+
+button {
+ background-color: #4CAF50;
+ color: white;
+ border: none;
+ padding: 10px 20px;
+ cursor: pointer;
+ border-radius: 4px;
+ font-size: 1rem;
+ margin-top: 10px;
+}
+
+button:hover {
+ background-color: #45a049;
+}
+
+#itinerary-view {
+ margin: 20px;
+ background-color: white;
+ padding: 20px;
+ border-radius: 8px;
+ box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
+}
+
+ul {
+ list-style-type: none;
+ padding: 0;
+}
+
+ul li {
+ padding: 5px 0;
+ font-size: 1rem;
+}
+
+ul li:nth-child(even) {
+ background-color: #f9f9f9;
+}
+
+button:active {
+ transform: scale(0.98);
+}
+
+footer {
+ text-align: center;
+ padding: 10px;
+ background-color: #4CAF50;
+ color: white;
+ position: fixed;
+ bottom: 0;
+ width: 100%;
+}
From 314a57fd4f88a4eef99b50ef1a9ae145aa8bb741 Mon Sep 17 00:00:00 2001
From: Drushya-jolly <160266129+Drushya-jolly@users.noreply.github.com>
Date: Sat, 8 Feb 2025 19:49:43 +0530
Subject: [PATCH 2/4] Update README.md
---
README.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/README.md b/README.md
index 79f19266d..43f690330 100644
--- a/README.md
+++ b/README.md
@@ -1,4 +1,4 @@
-# [Project Name] 🎯
+# DestINo 🎯
## Basic Details
From cb0e77c0af68fc69db9aeaa8ec81fe23e5deea46 Mon Sep 17 00:00:00 2001
From: Drushya-jolly <160266129+Drushya-jolly@users.noreply.github.com>
Date: Sat, 8 Feb 2025 21:32:43 +0530
Subject: [PATCH 3/4] Update index.html (#1)
---
index.html | 12 +++++++++---
1 file changed, 9 insertions(+), 3 deletions(-)
diff --git a/index.html b/index.html
index 7c00ab4cc..12771891a 100644
--- a/index.html
+++ b/index.html
@@ -19,19 +19,25 @@ Select Your Destination
Paris
New York
Tokyo
+ London
+ Rome
+ Sydney
+ Dubai
Enter Your Budget
+ Select Your Trip Dates
+
+
+
Generate Itinerary
Your AI-Generated Itinerary
-
-
-
+
Export as PDF
From 0e1007648a5b3cff340d6d407e8d45dfc65aacc1 Mon Sep 17 00:00:00 2001
From: Drushya-jolly <160266129+Drushya-jolly@users.noreply.github.com>
Date: Sat, 8 Feb 2025 21:33:40 +0530
Subject: [PATCH 4/4] Update script.js
---
script.js | 53 +++++++++++++++++++++++++++++++++++------------------
1 file changed, 35 insertions(+), 18 deletions(-)
diff --git a/script.js b/script.js
index d71b6b8b6..eeeb8619e 100644
--- a/script.js
+++ b/script.js
@@ -3,7 +3,8 @@ const destinationData = {
activities: [
{ name: "Eiffel Tower Visit", cost: 30 },
{ name: "Louvre Museum", cost: 20 },
- { name: "Seine River Cruise", cost: 50 }
+ { name: "Seine River Cruise", cost: 50 },
+ { name: "Notre-Dame Cathedral", cost: 0 }
],
accommodations: [
{ name: "Budget Hotel", costPerNight: 100 },
@@ -15,7 +16,8 @@ const destinationData = {
activities: [
{ name: "Statue of Liberty", cost: 25 },
{ name: "Central Park", cost: 0 },
- { name: "Broadway Show", cost: 100 }
+ { name: "Broadway Show", cost: 100 },
+ { name: "Times Square", cost: 0 }
],
accommodations: [
{ name: "Budget Hostel", costPerNight: 50 },
@@ -27,60 +29,75 @@ const destinationData = {
activities: [
{ name: "Shibuya Crossing", cost: 0 },
{ name: "Tokyo Tower", cost: 15 },
- { name: "Senso-ji Temple", cost: 0 }
+ { name: "Senso-ji Temple", cost: 0 },
+ { name: "Odaiba Shopping Mall", cost: 30 }
],
accommodations: [
{ name: "Capsule Hotel", costPerNight: 40 },
{ name: "Business Hotel", costPerNight: 100 },
{ name: "Luxury Hotel", costPerNight: 300 }
]
+ },
+ "London": {
+ activities: [
+ { name: "London Eye", cost: 30 },
+ { name: "British Museum", cost: 0 },
+ { name: "Westminster Abbey", cost: 20 }
+ ],
+ accommodations: [
+ { name: "Budget Hostel", costPerNight: 60 },
+ { name: "Mid-range Hotel", costPerNight: 180 },
+ { name: "Luxury Hotel", costPerNight: 400 }
+ ]
}
};
-// Function to generate the AI-driven itinerary
function generateItinerary() {
- const destination = document.getElementById('destination').value;
+ const destinationSelect = document.getElementById('destination');
+ const selectedDestination = destinationSelect.value;
const budget = parseFloat(document.getElementById('budget').value);
+ const startDate = document.getElementById('start-date').value;
+ const endDate = document.getElementById('end-date').value;
- if (!destination || isNaN(budget) || budget <= 0) {
- alert("Please enter a valid destination and budget.");
+ if (!selectedDestination || isNaN(budget) || budget <= 0 || !startDate || !endDate) {
+ alert("Please select a valid destination, enter a valid budget, and select trip dates.");
return;
}
- // Check if the destination is in the predefined data
- const data = destinationData[destination];
+ const data = destinationData[selectedDestination];
if (!data) {
alert("Sorry, we don't have data for this destination.");
return;
}
- // Suggest activities based on the budget
+ const start = new Date(startDate);
+ const end = new Date(endDate);
+ const days = Math.floor((end - start) / (1000 * 60 * 60 * 24));
+
let activities = data.activities.filter(activity => activity.cost <= budget);
- let accommodations = data.accommodations.filter(acc => acc.costPerNight <= budget / 3); // Assume a 3-night stay
+ let accommodations = data.accommodations.filter(acc => acc.costPerNight <= budget / 3);
- // Generate itinerary summary
let itinerarySummary = `
- Destination: ${destination}
- Activities (within your budget):
+ Destination: ${selectedDestination}
+ Dates: ${startDate} to ${endDate} (Total Days: ${days})
+ Activities:
${activities.map(activity => `${activity.name} - $${activity.cost} `).join('')}
- Accommodation Options (within your budget):
+ Accommodation Options:
${accommodations.map(acc => `${acc.name} - $${acc.costPerNight} per night `).join('')}
Suggested Itinerary:
Day 1: Arrive and check into your accommodation
- ${activities.slice(0, 2).map((activity, index) => `Day ${index + 2}: ${activity.name} `).join('')}
+ ${activities.slice(0, days - 1).map((activity, index) => `Day ${index + 2}: ${activity.name} `).join('')}
`;
- // Display the generated itinerary
document.getElementById('itinerary-summary').innerHTML = itinerarySummary;
}
-// Export function to PDF
function exportItinerary() {
const { jsPDF } = window.jspdf;
const doc = new jsPDF();