index.coffee 3.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. # vue/app/pages/Contacts/index.coffee
  2. document.head.insertAdjacentHTML('beforeend','<style type="text/tailwindcss">'+stylFns['app/pages/Contacts/index.styl']+'</style>')
  3. module.exports =
  4. name: 'Contacts'
  5. render: (new Function '_ctx', '_cache', renderFns['app/pages/Contacts/index.pug'])()
  6. data: ->
  7. contactInfo:
  8. phone: '+992 372 27 09 46'
  9. address: 'просп. Исмоила Сомони, 26'
  10. map: {}
  11. director: 'Джумахон Розикзода'
  12. deputyDirector: 'Азимов Махмадюсуф'
  13. workingHours: [
  14. { days: 'Понедельник - Пятница', hours: '9:00 - 18:00' }
  15. { days: 'Суббота', hours: '10:00 - 16:00' }
  16. { days: 'Воскресенье', hours: 'Выходной' }
  17. ]
  18. transportInfo:
  19. buses: ['1', '2', '3', '4', '8', '12', '18']
  20. minibuses: ['1', '2', '3', '4', '8', '12', '18', '27', '34']
  21. mounted: ->
  22. @setupAnimations()
  23. debug.log "Contacts page mounted"
  24. marker = new ol.Feature
  25. geometry: new ol.geom.Point(ol.proj.fromLonLat([68.762398,38.582698]))
  26. marker.setStyle new ol.style.Style
  27. image: new ol.style.Icon({src: 'https://openlayers.org/en/latest/examples/data/icon.png'})
  28. vectorSource = new ol.source.Vector
  29. features: [marker]
  30. vectorLayer = new ol.layer.Vector
  31. source: vectorSource
  32. @map = new ol.Map
  33. target: 'map'
  34. layers: [
  35. new ol.layer.Tile
  36. source: new ol.source.OSM()
  37. vectorLayer
  38. ]
  39. view: new ol.View
  40. center: ol.proj.fromLonLat([68.762398,38.582698])
  41. zoom: 17
  42. methods:
  43. setupAnimations: ->
  44. observer = new IntersectionObserver (entries) ->
  45. entries.forEach (entry) ->
  46. if entry.isIntersecting
  47. entry.target.classList.add('animate-fade-in-up')
  48. ,
  49. threshold: 0.1
  50. document.querySelectorAll('.contacts-section .bg-white, .contacts-section .bg-gray-800').forEach (el) ->
  51. observer.observe(el)
  52. handleContactSubmit: (formData) ->
  53. debug.log "Contact form submitted: " + JSON.stringify(formData)
  54. @$root.$emit('open-modal',
  55. component: 'SuccessModal'
  56. props:
  57. title: 'Сообщение отправлено'
  58. content: 'Мы получили ваше сообщение и свяжемся с вами в ближайшее время.'
  59. )
  60. showOnMap: ->
  61. debug.log "Showing location on map"
  62. address = encodeURIComponent(@contactInfo.address + ', Душанбе, Таджикистан')
  63. mapUrl = "https://yandex.ru/maps/?text=#{address}"
  64. window.open(mapUrl, '_blank')
  65. callPhone: ->
  66. debug.log "Calling phone: " + @contactInfo.phone
  67. window.location.href = "tel:#{@contactInfo.phone.replace(/\s/g, '')}"