Skip to content

Commit

Permalink
Working data from Tommy now.
Browse files Browse the repository at this point in the history
  • Loading branch information
ZermattChris committed Oct 11, 2023
1 parent ab14a3b commit 6d2e48f
Show file tree
Hide file tree
Showing 4 changed files with 65 additions and 56 deletions.
35 changes: 20 additions & 15 deletions src/components/FlightDialogBody.vue
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,13 @@
const parasList = []
// Break double new lines into paragraphs
const paras = this.body.split(/\n\n/)
//console.log(paras)
//const paras = this.body.split(/\r\n\r\n/) // Tommy
// Split on custom [p] delimiters.
const paras = this.body.split( /\[p\]/g )
//console.log("paras ",paras)
// Parse out the optional 'icon' type.
for (const p of paras) {
Expand All @@ -82,7 +87,7 @@
// Find and parse all entries with a "location" icon.
const iconLocSplit = thisP.split('[location]');
if (iconLocSplit.length > 1) {
console.log("Has Location icon: " + iconLocSplit.length);
//console.log("Has Location icon: " + iconLocSplit.length);
const obj = {"icon":"location", "text":iconLocSplit[1]}
parasList.push(obj)
continue
Expand All @@ -91,7 +96,7 @@
// Find and parse all entries with a "star" icon.
const iconStarSplit = thisP.split('[star]');
if (iconStarSplit.length > 1) {
console.log("Has Star icon: " + iconStarSplit.length);
//console.log("Has Star icon: " + iconStarSplit.length);
const obj = {"icon":"star", "text":iconStarSplit[1]}
parasList.push(obj)
continue
Expand All @@ -100,25 +105,25 @@
// Find and parse all entries with a "Info" icon.
const iconInfoSplit = thisP.split('[info]');
if (iconInfoSplit.length > 1) {
console.log("Has Info icon: " + iconInfoSplit.length);
//console.log("Has Info icon: " + iconInfoSplit.length);
const obj = {"icon":"info", "text":iconInfoSplit[1]}
parasList.push(obj)
continue
}
// Finally, add any paragraph that doesn't use an 'icon'
console.log("Paragraph has NO icon: ")
console.log(thisP)
// const plainParaSplit = thisP.split('[info]');
// if (plainParaSplit.length > 1) {
// console.log("Has NO icon: " + plainParaSplit.length);
const obj = {"icon":"", "text":thisP}
parasList.push(obj)
// }
//console.log("Paragraph has NO icon: ")
//console.log(thisP)
if (thisP === '') {
//console.log("- thisP is empty -")
continue
}
const obj = {"icon":"", "text":thisP}
parasList.push(obj)
}
console.log(parasList)
//console.log(parasList)
this.paragraphsList = parasList
Expand Down
13 changes: 7 additions & 6 deletions src/store/storex.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import navigation from './modules/nav'
// -----------------


import testFlightData from "./test.json";
//import testFlightData from "./test.json";


//import { format, add, sub, parseISO, isAfter, isBefore, isEqual } from 'date-fns'
Expand Down Expand Up @@ -459,15 +459,15 @@ export default new Vuex.Store({

// Setup dev/live API call to Tommy.
let apiPath = "https://bookings.simpleitsolutions.ch/api/flightoptions/" + flDate
//if (context.state._DEV === true) apiPath = "https://bookings-dev.simpleitsolutions.ch/api/flightoptions/" + flDate
if (context.state._DEV === true) apiPath = "https://bookings-dev.simpleitsolutions.ch/api/flightoptions/" + flDate


// local test data until Tom delivers.
if (context.state._DEV === true) {
//console.log("testFlightData on load: " + testFlightData)
context.commit("FLIGHTS_LIST", testFlightData)
context.commit("FLIGHTSLIST_LOADING", false)
return
//console.log("testFlightData: ", testFlightData)
// context.commit("FLIGHTS_LIST", testFlightData)
// context.commit("FLIGHTSLIST_LOADING", false)
// return
}


Expand Down Expand Up @@ -510,6 +510,7 @@ export default new Vuex.Store({
return axios.get(apiPath)
.then(response => {
let data = response.data;
console.log("-- Tommy data --", data)
context.commit("TIMELIST_DATES", data)
})
.catch(error => {
Expand Down
6 changes: 3 additions & 3 deletions src/store/test.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"name":"Scenic",
"price":"190.00",
"body": {
"en": "[location] We fly the Scenic from both Blauherd and Riffelberg. We try and choose the location that we feel will have the best conditions for your specific booking time. \n\n[star] We fly the Scenic in the Spring, Summer and Autumn, from Riffelberg/Blauherd (there is too much snow in winter forthese lower take off areas). \n\n[info]If you book the early morning (08:00) flight, we ask that you be be fairly fit, confident and not too heavy.",
"en": "[location] We fly the Scenic from both Blauherd and Riffelberg. We try and choose the location that we feel will have the best conditions for your specific booking time. [p][p][star] We fly the Scenic in the Spring, Summer and Autumn, from Riffelberg/Blauherd (there is too much snow in winter forthese lower take off areas). [p][info]If you book the early morning (08:00) flight, we ask that you be be fairly fit, confident and not too heavy.[p]And some empty para text to test",
"de": "[location] DE...",
"fr": "[location] FR...",
"ko": "[location] KO..."
Expand All @@ -15,7 +15,7 @@
"name":"Classic High",
"price":"240.00",
"body": {
"en": "The best time for the Classic High is in the mornings. It is often also possible to do this flight in the afternoon, but it depends on the day's conditions. \n\nWe fly the Classic High the entire year, in the summer from Rothorn and in the spring/autumn, from Gornergrat and/or Rotenboden. \n\nIf you book the early morning (08:00) flight, we ask that you be be fairly fit, confident and not too heavy.",
"en": "The best time for the Classic High is in the mornings. It is often also possible to do this flight in the afternoon, but it depends on the day's conditions. \r\n\r\nWe fly the Classic High the entire year, in the summer from Rothorn and in the spring/autumn, from Gornergrat and/or Rotenboden. \r\n\r\nIf you book the early morning (08:00) flight, we ask that you be be fairly fit, confident and not too heavy.",
"de": "[location] DE...",
"fr": "[location] FR...",
"ko": "[location] KO..."
Expand All @@ -26,7 +26,7 @@
"name":"Elite",
"price":"420.00",
"body": {
"en": "The Elite flight is the highest tandem take off in the Alps - this makes for an amazing flight, but also means that both weather and snow conditions have to be just right. Winds are often strong at this altitude and our take off areas are on glacier/snow - because of this we try and do this flight early in the morning when conditions are the best. \n\n[location] We fly the Elite over the entire year, when ever wind and snow conditions allow. \n\nIf you book the Elite, we ask that you are happy to do the Classic High flight as a back-up - in case the conditions don't allow us to fly from Klein Matterhorn. \n\n[star]The Elite flight also requires passengers to be fairly fit, confident and not too heavy.",
"en": "The Elite flight is the highest tandem take off in the Alps - this makes for an amazing flight, but also means that both weather and snow conditions have to be just right. Winds are often strong at this altitude and our take off areas are on glacier/snow - because of this we try and do this flight early in the morning when conditions are the best. \r\n\r\n[location] We fly the Elite over the entire year, when ever wind and snow conditions allow. \r\n\r\nIf you book the Elite, we ask that you are happy to do the Classic High flight as a back-up - in case the conditions don't allow us to fly from Klein Matterhorn. \r\n\r\n[star]The Elite flight also requires passengers to be fairly fit, confident and not too heavy.",
"de": "[location] DE...",
"fr": "[location] FR...",
"ko": "[location] KO..."
Expand Down
67 changes: 35 additions & 32 deletions src/views/Step_Start.vue
Original file line number Diff line number Diff line change
Expand Up @@ -836,7 +836,7 @@ export default {
let newFlightsList = []
// Custom Sort order, so we have Classic at top, etc.
obj = this.customFlightSort(obj)
//obj = this.customFlightSort(obj)
// eslint-disable-next-line no-unused-vars
for (const [key, value] of Object.entries(obj)) {
Expand All @@ -852,7 +852,8 @@ export default {
customFlightSort (flightsObj) {
//console.log(flightsObj)
console.log("Tommy flight obj")
console.log(flightsObj)
// As our flight id's are not in any particular order, need to do a
// switch and manually sort them as desired.
Expand All @@ -863,39 +864,41 @@ export default {
let sortedArray = []
/* eslint-disable */
for (const key of Object.keys(flightsObj)) {
//console.log(flightsObj[key].id, flightsObj[key].name, flightsObj[key].price)
switch (flightsObj[key].id) {
case 38: // "Classic"
sortedArray[0] = {
id: flightsObj[key].id,
name: flightsObj[key].name,
price: flightsObj[key].price
}
break
case 39: // "Scenic"
sortedArray[1] = {
id: flightsObj[key].id,
name: flightsObj[key].name,
price: flightsObj[key].price
}
break
case 41: // "HeliFly"
sortedArray[2] = {
id: flightsObj[key].id,
name: flightsObj[key].name,
price: flightsObj[key].price
}
break
case 40: // "Elite"
sortedArray[3] = {
id: flightsObj[key].id,
name: flightsObj[key].name,
price: flightsObj[key].price
}
break
}
// OLD sorting code when all was hard coded.
// switch (flightsObj[key].id) {
// case 38: // "Classic"
// sortedArray[0] = {
// id: flightsObj[key].id,
// name: flightsObj[key].name,
// price: flightsObj[key].price
// }
// break
// case 39: // "Scenic"
// sortedArray[1] = {
// id: flightsObj[key].id,
// name: flightsObj[key].name,
// price: flightsObj[key].price
// }
// break
// case 41: // "HeliFly"
// sortedArray[2] = {
// id: flightsObj[key].id,
// name: flightsObj[key].name,
// price: flightsObj[key].price
// }
// break
// case 40: // "Elite"
// sortedArray[3] = {
// id: flightsObj[key].id,
// name: flightsObj[key].name,
// price: flightsObj[key].price
// }
// break
// }
}
Expand Down

0 comments on commit 6d2e48f

Please sign in to comment.