You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

68 lines
1.7 KiB

  1. <template>
  2. <div class="">
  3. <div class="calendar-wrapper">
  4. <Calendar
  5. v-for="date in startingDates"
  6. :key="date.toString()"
  7. :date="new Date(date)"
  8. :selected-dows="selectedDows"
  9. @book="book"
  10. />
  11. </div>
  12. </div>
  13. </template>
  14. <script>
  15. export default {
  16. props: {
  17. startingDate: {
  18. type: [Date],
  19. default () {
  20. return new Date()
  21. }
  22. },
  23. selectedDows: {
  24. type: [Array],
  25. default () {
  26. return []
  27. }
  28. }
  29. },
  30. data () {
  31. return {
  32. numberOfMonths: 4,
  33. numAdult: 1,
  34. numChild: 0
  35. }
  36. },
  37. computed: {
  38. startingDates () {
  39. const listOfDates = []
  40. for (let index = 0; index < this.numberOfMonths; index++) {
  41. const thisDate = new Date(this.startingDate.getUTCFullYear(), this.startingDate.getUTCMonth() + index, 1)
  42. listOfDates.push(thisDate)
  43. }
  44. return listOfDates
  45. }
  46. },
  47. methods: {
  48. book (thisDate) {
  49. window.open(`https://www.anrdoezrs.net/links/100449149/type/am/https://www.expedia.com/go/flight/search/oneway/${this.formatDate(thisDate)}/${this.formatDate(thisDate)}?langid=1033&FromAirport=${this.selectedSchedule.Origin_IATA}&FromTime=${this.selectedSchedule.Departure_TimeL}&ToTime=${this.selectedSchedule.Arrival_TimeL}&ToAirport=${this.selectedSchedule.Destination_IATA}&Class=3&NumAdult=${this.numAdult}&NumChild=${this.numChild}`)
  50. },
  51. formatDate (thisDate) {
  52. return thisDate.toLocaleDateString('en-CA')
  53. }
  54. }
  55. }
  56. </script>
  57. <style scoped>
  58. .calendar-wrapper {
  59. display: flex;
  60. flex-wrap: wrap;
  61. gap: 3rem;
  62. justify-content: center;
  63. margin-top: 3rem;
  64. margin-bottom: 3rem;
  65. }
  66. </style>