axitech-widget 0.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (147) hide show
  1. package/README.md +203 -0
  2. package/dist/Modal-fab2abfa.mjs +4 -0
  3. package/dist/axitech-widget.es.js +7 -0
  4. package/dist/axitech-widget.iife.js +698 -0
  5. package/dist/axitech-widget.umd.js +698 -0
  6. package/dist/index-2839010c.mjs +30306 -0
  7. package/dist/style.css +1 -0
  8. package/dist/types/components/base/ActionCard.vue.d.ts +36 -0
  9. package/dist/types/components/base/Button.vue.d.ts +9 -0
  10. package/dist/types/components/base/Collapse.vue.d.ts +2 -0
  11. package/dist/types/components/base/DatePicker.vue.d.ts +70 -0
  12. package/dist/types/components/base/GoogleAutocomplete.vue.d.ts +23 -0
  13. package/dist/types/components/base/GoogleMap.vue.d.ts +26 -0
  14. package/dist/types/components/base/Input.vue.d.ts +43 -0
  15. package/dist/types/components/base/Modal.vue.d.ts +55 -0
  16. package/dist/types/components/base/SelectButton.vue.d.ts +56 -0
  17. package/dist/types/components/base/Spinner.vue.d.ts +34 -0
  18. package/dist/types/components/base/uploader/ImageUpload.vue.d.ts +23 -0
  19. package/dist/types/components/base/uploader/Upload.vue.d.ts +4 -0
  20. package/dist/types/components/claims-widget/ClaimsWidget.ce.vue.d.ts +2 -0
  21. package/dist/types/components/claims-widget/components/Error.vue.d.ts +2 -0
  22. package/dist/types/components/claims-widget/components/SkeletonLoader.vue.d.ts +56 -0
  23. package/dist/types/components/claims-widget/components/StepConfirm.vue.d.ts +6 -0
  24. package/dist/types/components/claims-widget/components/StepSelector.vue.d.ts +6 -0
  25. package/dist/types/components/claims-widget/components/accident/Accident.vue.d.ts +8 -0
  26. package/dist/types/components/claims-widget/components/accident/ImageSection.vue.d.ts +29 -0
  27. package/dist/types/components/claims-widget/components/accident/MapSection.vue.d.ts +29 -0
  28. package/dist/types/components/claims-widget/components/accident/NoteSection.vue.d.ts +21 -0
  29. package/dist/types/components/claims-widget/components/accident/SectionWrapper.vue.d.ts +23 -0
  30. package/dist/types/components/claims-widget/components/accident/YourVehicle.vue.d.ts +2 -0
  31. package/dist/types/components/claims-widget/components/fireWater/FireWater.vue.d.ts +6 -0
  32. package/dist/types/components/claims-widget/components/illustration/Accident.vue.d.ts +2 -0
  33. package/dist/types/components/claims-widget/components/illustration/Location.vue.d.ts +2 -0
  34. package/dist/types/components/claims-widget/components/illustration/SubmittedSuccessfully.vue.d.ts +2 -0
  35. package/dist/types/components/claims-widget/components/illustration/Unsupported.vue.d.ts +2 -0
  36. package/dist/types/components/claims-widget/components/windscreen/Windscreen.vue.d.ts +6 -0
  37. package/dist/types/components/claims-widget/components/windscreen/WindscreenLoading.vue.d.ts +2 -0
  38. package/dist/types/components/index.d.ts +2 -0
  39. package/dist/types/composables/googleMaps.d.ts +11 -0
  40. package/dist/types/constants/index.d.ts +1 -0
  41. package/dist/types/index.d.ts +34 -0
  42. package/dist/types/plugins/firebase.d.ts +2 -0
  43. package/dist/types/plugins/firebaseCloudStorage.d.ts +16 -0
  44. package/dist/types/utils/autocomplete.d.ts +2 -0
  45. package/dist/types/utils/colorHelpers.d.ts +7 -0
  46. package/dist/types/utils/config.d.ts +131 -0
  47. package/dist/types/utils/customElementRegister.d.ts +1 -0
  48. package/dist/types/utils/fontUtils.d.ts +1 -0
  49. package/dist/types/utils/index.d.ts +141 -0
  50. package/dist/types/utils/map.d.ts +21 -0
  51. package/dist/types/utils/request.d.ts +30 -0
  52. package/dist/types/utils/svgUtils.d.ts +0 -0
  53. package/dist/types/utils/themeUtils.d.ts +9 -0
  54. package/package.json +77 -0
  55. package/src/assets/fonts/Volvo Novum-Italic.eot +0 -0
  56. package/src/assets/fonts/Volvo Novum-Italic.svg +723 -0
  57. package/src/assets/fonts/Volvo Novum-Italic.woff +0 -0
  58. package/src/assets/fonts/Volvo Novum-Italic.woff2 +0 -0
  59. package/src/assets/fonts/Volvo Novum-Light.eot +0 -0
  60. package/src/assets/fonts/Volvo Novum-Light.svg +707 -0
  61. package/src/assets/fonts/Volvo Novum-Light.woff +0 -0
  62. package/src/assets/fonts/Volvo Novum-Light.woff2 +0 -0
  63. package/src/assets/fonts/Volvo Novum-LightItalic.eot +0 -0
  64. package/src/assets/fonts/Volvo Novum-LightItalic.svg +723 -0
  65. package/src/assets/fonts/Volvo Novum-LightItalic.woff +0 -0
  66. package/src/assets/fonts/Volvo Novum-LightItalic.woff2 +0 -0
  67. package/src/assets/fonts/Volvo Novum-Medium.eot +0 -0
  68. package/src/assets/fonts/Volvo Novum-Medium.svg +706 -0
  69. package/src/assets/fonts/Volvo Novum-Medium.woff +0 -0
  70. package/src/assets/fonts/Volvo Novum-Medium.woff2 +0 -0
  71. package/src/assets/fonts/Volvo Novum-MediumItalic.eot +0 -0
  72. package/src/assets/fonts/Volvo Novum-MediumItalic.svg +724 -0
  73. package/src/assets/fonts/Volvo Novum-MediumItalic.woff +0 -0
  74. package/src/assets/fonts/Volvo Novum-MediumItalic.woff2 +0 -0
  75. package/src/assets/fonts/Volvo Novum-Regular.eot +0 -0
  76. package/src/assets/fonts/Volvo Novum-Regular.svg +707 -0
  77. package/src/assets/fonts/Volvo Novum-Regular.woff +0 -0
  78. package/src/assets/fonts/Volvo Novum-Regular.woff2 +0 -0
  79. package/src/assets/fonts/Volvo Novum-SemiLight.eot +0 -0
  80. package/src/assets/fonts/Volvo Novum-SemiLight.svg +706 -0
  81. package/src/assets/fonts/Volvo Novum-SemiLight.woff +0 -0
  82. package/src/assets/fonts/Volvo Novum-SemiLight.woff2 +0 -0
  83. package/src/assets/fonts/Volvo Novum-SemiLightItalic.eot +0 -0
  84. package/src/assets/fonts/Volvo Novum-SemiLightItalic.svg +722 -0
  85. package/src/assets/fonts/Volvo Novum-SemiLightItalic.woff +0 -0
  86. package/src/assets/fonts/Volvo Novum-SemiLightItalic.woff2 +0 -0
  87. package/src/assets/styles/collapse.sass +20 -0
  88. package/src/assets/styles/datepicker.sass +14 -0
  89. package/src/assets/styles/main.sass +182 -0
  90. package/src/assets/styles/map.sass +41 -0
  91. package/src/assets/styles/togglebutton.sass +4 -0
  92. package/src/components/base/ActionCard.vue +49 -0
  93. package/src/components/base/Button.vue +16 -0
  94. package/src/components/base/Collapse.vue +41 -0
  95. package/src/components/base/DatePicker.vue +94 -0
  96. package/src/components/base/GoogleAutocomplete.vue +116 -0
  97. package/src/components/base/GoogleMap.vue +114 -0
  98. package/src/components/base/Input.vue +44 -0
  99. package/src/components/base/Modal.vue +117 -0
  100. package/src/components/base/SelectButton.vue +67 -0
  101. package/src/components/base/Spinner.vue +39 -0
  102. package/src/components/base/uploader/ImageUpload.vue +85 -0
  103. package/src/components/base/uploader/Upload.vue +14 -0
  104. package/src/components/claims-widget/ClaimsWidget.ce.vue +117 -0
  105. package/src/components/claims-widget/assets/accident.svg +181 -0
  106. package/src/components/claims-widget/assets/car.svg +6 -0
  107. package/src/components/claims-widget/assets/currentlocation.svg +3 -0
  108. package/src/components/claims-widget/assets/door.svg +3 -0
  109. package/src/components/claims-widget/assets/location.svg +20 -0
  110. package/src/components/claims-widget/assets/marker.svg +1 -0
  111. package/src/components/claims-widget/assets/unsupported.svg +107 -0
  112. package/src/components/claims-widget/assets/windscreen.svg +3 -0
  113. package/src/components/claims-widget/assets/zoomin.svg +3 -0
  114. package/src/components/claims-widget/assets/zoomout.svg +3 -0
  115. package/src/components/claims-widget/components/Error.vue +21 -0
  116. package/src/components/claims-widget/components/SkeletonLoader.vue +77 -0
  117. package/src/components/claims-widget/components/StepConfirm.vue +85 -0
  118. package/src/components/claims-widget/components/StepSelector.vue +58 -0
  119. package/src/components/claims-widget/components/accident/Accident.vue +267 -0
  120. package/src/components/claims-widget/components/accident/ImageSection.vue +82 -0
  121. package/src/components/claims-widget/components/accident/MapSection.vue +72 -0
  122. package/src/components/claims-widget/components/accident/NoteSection.vue +83 -0
  123. package/src/components/claims-widget/components/accident/SectionWrapper.vue +16 -0
  124. package/src/components/claims-widget/components/accident/YourVehicle.vue +60 -0
  125. package/src/components/claims-widget/components/fireWater/FireWater.vue +42 -0
  126. package/src/components/claims-widget/components/illustration/Accident.vue +735 -0
  127. package/src/components/claims-widget/components/illustration/Location.vue +74 -0
  128. package/src/components/claims-widget/components/illustration/SubmittedSuccessfully.vue +2270 -0
  129. package/src/components/claims-widget/components/illustration/Unsupported.vue +393 -0
  130. package/src/components/claims-widget/components/windscreen/Windscreen.vue +44 -0
  131. package/src/components/claims-widget/components/windscreen/WindscreenLoading.vue +34 -0
  132. package/src/components/index.ts +3 -0
  133. package/src/composables/googleMaps.ts +157 -0
  134. package/src/constants/index.ts +1 -0
  135. package/src/index.ts +76 -0
  136. package/src/plugins/firebase.ts +18 -0
  137. package/src/plugins/firebaseCloudStorage.ts +88 -0
  138. package/src/utils/autocomplete.ts +57 -0
  139. package/src/utils/colorHelpers.ts +96 -0
  140. package/src/utils/config.ts +140 -0
  141. package/src/utils/customElementRegister.ts +40 -0
  142. package/src/utils/fontUtils.ts +24 -0
  143. package/src/utils/index.ts +5 -0
  144. package/src/utils/map.ts +212 -0
  145. package/src/utils/request.ts +76 -0
  146. package/src/utils/svgUtils.ts +0 -0
  147. package/src/utils/themeUtils.ts +40 -0
@@ -0,0 +1,20 @@
1
+ .accordion
2
+ padding: 16px
3
+ border: 1px solid #F4F4F4
4
+ box-shadow: -4px 8px 8px rgba(0, 0, 0, 0.02)
5
+ cursor: pointer
6
+ transition: all 250ms ease-in-out
7
+ @apply gap-4 rounded
8
+ &:hover
9
+ @apply backdrop-brightness-100
10
+ @media screen and (min-width: 480px)
11
+ padding: 16px 24px
12
+
13
+ .wrapper
14
+ display: grid
15
+ grid-template-rows: 0fr
16
+ transition: grid-template-rows 0.25s ease-out
17
+ .wrapper.is-open
18
+ grid-template-rows: 1fr
19
+ .inner
20
+ overflow: hidden
@@ -0,0 +1,14 @@
1
+
2
+ .date-time-input
3
+ width: 100%
4
+ @apply border-0 border-b border-primary
5
+ &[is-error='true']
6
+ @apply border-negative-700
7
+ &:focus
8
+ @apply outline-0
9
+ input::placeholder
10
+ font-style: normal
11
+ font-size: 16px
12
+ line-height: 150%
13
+ input::-webkit-calendar-picker-indicator
14
+ @apply text-primary-500
@@ -0,0 +1,182 @@
1
+ @tailwind base
2
+ @tailwind components
3
+ @tailwind utilities
4
+
5
+ @layer base
6
+ :root
7
+ --color-bg: #ffffff
8
+ --color-bg-soft: #f3f4f6
9
+ --color-dark-blue-10: 242 242 245
10
+ --color-dark-blue: 0 0 0
11
+ --color-dark-grey: 97 95 110
12
+ --color-light-grey: 0 79 188
13
+ --color-primary-50: #f4f7fa
14
+ --color-primary-100: #eaeff5
15
+ --color-primary-200: #cad7e7
16
+ --color-primary-300: #aabfd8
17
+ --color-primary-400: #6a90ba
18
+ --color-primary-500: #2A609D
19
+ --color-primary-600: #26568d
20
+ --color-primary-700: #204876
21
+ --color-primary-800: #193a5e
22
+ --color-primary-900: #152f4d
23
+ --color-secondary-50: #f2f6fc
24
+ --color-secondary-100: #e6edf8
25
+ --color-secondary-200: #bfd3ee
26
+ --color-secondary-300: #99b9e4
27
+ --color-secondary-400: #4d84d0
28
+ --color-secondary-500: #004FBC
29
+ --color-secondary-600: #0047a9
30
+ --color-secondary-700: #003b8d
31
+ --color-secondary-800: #002f71
32
+ --color-secondary-900: #00275c
33
+ --color-fontSecondary-50: #f2f2f2
34
+ --color-fontSecondary-100: #e6e6e6
35
+ --color-fontSecondary-200: #bfbfbf
36
+ --color-fontSecondary-300: #999999
37
+ --color-fontSecondary-400: #4d4d4d
38
+ --color-fontSecondary-500: #000000
39
+ --color-fontSecondary-600: #000000
40
+ --color-fontSecondary-700: #000000
41
+ --color-fontSecondary-800: #000000
42
+ --color-fontSecondary-900: #000000
43
+ --color-fontPrimary-50: #f2f2f2
44
+ --color-fontPrimary-100: #e6e6e6
45
+ --color-fontPrimary-200: #bfbfbf
46
+ --color-fontPrimary-300: #999999
47
+ --color-fontPrimary-400: #4d4d4d
48
+ --color-fontPrimary-500: #000000
49
+ --color-fontPrimary-600: #000000
50
+ --color-fontPrimary-700: #000000
51
+ --color-fontPrimary-800: #000000
52
+ --color-fontPrimary-900: #000000
53
+ --color-positive-50: #f5f9f4
54
+ --color-positive-100: #ecf3e9
55
+ --color-positive-200: #cfe1c9
56
+ --color-positive-300: #b3cfa8
57
+ --color-positive-400: #79ac66
58
+ --color-positive-500: #408825
59
+ --color-positive-600: #3a7a21
60
+ --color-positive-700: #30661c
61
+ --color-positive-800: #265216
62
+ --color-positive-900: #1f4312
63
+ --color-negative-50: #fdf3f3
64
+ --color-negative-100: #fce6e6
65
+ --color-negative-200: #f7c1c1
66
+ --color-negative-300: #f29c9c
67
+ --color-negative-400: #e85252
68
+ --color-negative-500: #DE0808
69
+ --color-negative-600: #c80707
70
+ --color-negative-700: #a70606
71
+ --color-negative-800: #850505
72
+ --color-negative-900: #6d0404
73
+ --color-dark: 29 29 29
74
+ --color-dark-page: 18 18 18
75
+ --font-24: 24px
76
+ --font-20: 20px
77
+ --font-16: 16px
78
+
79
+ html
80
+ font-family: WidgetFont, system-ui, sans-serif
81
+ #axitech-claims-widget
82
+ font-family: WidgetFont, sans-serif
83
+ @apply text-fontPrimary-500
84
+ & *
85
+ transition-property: color, background, background-color, fill
86
+ transition-duration: 150ms
87
+ transition-timing-function: ease-in-out
88
+ @mixin title($index, $font-size, $line-height)
89
+ .title#{$index}, .title#{$index}-bold
90
+ font-style: normal
91
+ font-family: WidgetFont, sans-serif
92
+ font-size: $font-size
93
+ line-height: $line-height
94
+ letter-spacing: -0.02em
95
+ .title#{$index}-bold
96
+ font-weight: bold
97
+
98
+ @mixin body($index, $font-size, $line-height)
99
+ .body#{$index}, .body#{$index}-bold
100
+ font-style: normal
101
+ font-family: WidgetFont, sans-serif
102
+ font-size: $font-size
103
+ line-height: $line-height
104
+ letter-spacing: -0.02em
105
+ .body#{$index}-bold
106
+ font-weight: bold
107
+
108
+ @mixin action($index, $font-size, $line-height)
109
+ .action#{$index}, .action#{$index}-bold
110
+ font-style: normal
111
+ font-family: WidgetFont, sans-serif
112
+ font-size: $font-size
113
+ line-height: $line-height
114
+ .action#{$index}-bold
115
+ font-weight: 900
116
+
117
+ @include title(1, 24px, 34px)
118
+ @include title(2, 20px, 28px)
119
+ @include title(3, 18px, 27px)
120
+ @include title(4, 16px, 22px)
121
+
122
+ @include body(1, 16px, 24px)
123
+ @include body(2, 14px, 20px)
124
+ @include body(3, 12px, 18px)
125
+
126
+ @include action(1, 16px, 20px)
127
+ @include action(2, 14px, 18px)
128
+
129
+ @import './collapse.sass'
130
+ @import './datepicker.sass'
131
+ @import './map.sass'
132
+ @import './togglebutton.sass'
133
+
134
+ .slide-up-enter-active,
135
+ .slide-up-leave-active
136
+ transition: all 0.25s ease-out
137
+
138
+ .slide-up-enter-from
139
+ opacity: 0
140
+ transform: translateY(30px)
141
+
142
+ .slide-up-leave-to
143
+ opacity: 0
144
+ transform: translateY(-30px)
145
+
146
+ .slide-right-enter-active,
147
+ .slide-right-leave-active
148
+ transition: all 0.25s ease-out
149
+
150
+ .slide-right-enter-from
151
+ opacity: 0
152
+ transform: translateX(-30px)
153
+
154
+ .slide-right-leave-to
155
+ opacity: 0
156
+ transform: translateX(30px)
157
+
158
+ .slide-left-enter-active,
159
+ .slide-left-leave-active
160
+ transition: all 0.25s ease-out
161
+
162
+ .slide-left-enter-from
163
+ opacity: 0
164
+ transform: translateX(30px)
165
+
166
+ .slide-left-leave-to
167
+ opacity: 0
168
+ transform: translateX(-30px)
169
+
170
+ .fade-enter-active,
171
+ .fade-leave-active
172
+ transition: opacity 0.25s ease-out
173
+
174
+ .fade-enter-from,
175
+ .fade-leave-to
176
+ opacity: 0
177
+
178
+ .checklist-line
179
+ height: 1.5rem
180
+ width: 2px
181
+ margin-block: 8px
182
+ @apply bg-primary-500
@@ -0,0 +1,41 @@
1
+ #axitech-google-map
2
+ --_header-height: 10vh
3
+ #axitech-widget-map
4
+ --_height: 100vh
5
+ --_height: 100dvh
6
+ width: 100vw
7
+ height: var(--_height)
8
+
9
+ #axitech-preview-map
10
+ width: 100%
11
+ height: 250px
12
+ border-radius: 8px
13
+
14
+ .search
15
+ position: absolute
16
+ top: 0
17
+ left: 0
18
+ width: 100vw
19
+ padding: 16px
20
+ z-index: 1
21
+ box-shadow: 0px 4px 10px rgba(131, 131, 131, 0.25)
22
+ column-gap: 12px
23
+ background-color: #fff
24
+
25
+ @media screen and (min-width: 768px)
26
+ #axitech-widget-map
27
+ --_height: 100vh
28
+ --_height: 100dvh
29
+ width: calc(100vw)
30
+ height: calc(var(--_height))
31
+
32
+ .search
33
+ position: absolute
34
+ top: 36px
35
+ left: 36px
36
+ padding: 16px
37
+ z-index: 1
38
+ box-shadow: 0px 4px 10px rgba(131, 131, 131, 0.25)
39
+ border-radius: 8px
40
+ max-width: 675px
41
+ column-gap: 12px
@@ -0,0 +1,4 @@
1
+ #widget-select-button
2
+ button
3
+ &[data-selected="false"]
4
+ @apply border-gray-400 text-fontSecondary-400 hover:border-white hover:text-white
@@ -0,0 +1,49 @@
1
+ <template>
2
+ <div id="widget-action-card" class="bg-gray-100 rounded-2xl w-full h-full p-4 flex flex-col gap-3">
3
+ <div class="title title4-bold">
4
+ <template v-if="title">
5
+ <div class="flex justify-start items-center gap-3">
6
+ <Icon v-if="icon" :icon="icon" class="text-primary" height="32px"></Icon>
7
+ <span>{{ title }}</span>
8
+ </div>
9
+ </template>
10
+ <slot v-else name="title"></slot>
11
+ </div>
12
+ <div class="content body1 text-fontSecondary-500">
13
+ <template v-if="content">
14
+ {{ content }}
15
+ </template>
16
+ <slot v-else name="content"></slot>
17
+ </div>
18
+ <div class="action">
19
+ <template v-if="action">
20
+ <a
21
+ class="action1-bold text-primary hover:text-primary-400 underline underline-offset-2 cursor-pointer"
22
+ :disabled="disabled"
23
+ @click.prevent="emit('action')"
24
+ >
25
+ {{ action }}
26
+ </a>
27
+ </template>
28
+ <slot v-else name="action"></slot>
29
+ </div>
30
+ </div>
31
+ </template>
32
+
33
+ <script setup lang="ts">
34
+ import { Icon } from '@iconify/vue';
35
+
36
+ const props = defineProps<{
37
+ icon?: string;
38
+ content?: string;
39
+ title?: string;
40
+ action?: string;
41
+ disabled?: boolean;
42
+ }>();
43
+
44
+ const emit = defineEmits<{
45
+ (event: 'action'): void;
46
+ }>();
47
+ </script>
48
+
49
+ <style scoped></style>
@@ -0,0 +1,16 @@
1
+ <template>
2
+ <Button
3
+ class="text-primary border-primary hover:bg-primary focus:ring-primary-200 uppercase p-4 border-2 rounded-md action2-bold"
4
+ square
5
+ outline
6
+ >
7
+ <slot></slot>
8
+ </Button>
9
+ </template>
10
+
11
+ <script setup lang="ts">
12
+ // @ts-expect-error could not resolve
13
+ import { Button } from 'flowbite-vue';
14
+ </script>
15
+
16
+ <style scoped></style>
@@ -0,0 +1,41 @@
1
+ <template>
2
+ <div class="accordion w-full">
3
+ <div class="w-full flex flex-row justify-between flex-nowrap items-center" @click.prevent="toggleAccordion">
4
+ <div class="flex flex-row gap-2 items-center justify-start">
5
+ <Icon icon="mdi:info-outline" class="text-primary" width="27"></Icon>
6
+ <h4 class="body1-bold">{{ accordionConfig.title }}</h4>
7
+ </div>
8
+ <Icon :icon="icon" width="27" class="text-primary"></Icon>
9
+ </div>
10
+ <div class="wrapper" :class="{ 'is-open': isOpen }">
11
+ <ul class="inner">
12
+ <li class="accordion-part mt-4" v-for="(bullet, index) in accordionConfig.bullets" :key="index">
13
+ <p class="body1">{{ bullet }}</p>
14
+ </li>
15
+ </ul>
16
+ </div>
17
+ </div>
18
+ </template>
19
+
20
+ <script setup lang="ts">
21
+ import { Icon } from '@iconify/vue';
22
+ import { ref, computed } from 'vue';
23
+
24
+ const isOpen = ref(false);
25
+ // const accordionStyle = computed(() => ({ display: isOpen.value ? 'block' : 'none' }));
26
+ const icon = computed(() => (isOpen.value ? 'mdi:chevron-up' : 'mdi:chevron-down'));
27
+ const accordionConfig = {
28
+ title: 'Important tips at the scene to keep you safe',
29
+ bullets: [
30
+ 'Move your vehicle if it is blocking traffic, and be sure to turn on your hazard lights',
31
+ 'Make sure you and others are OK. If there are injuries, or if it is an emergency call emargency services!',
32
+ 'Stop your vehicle, and unless injury prevents it, move all passengers and pets to a safe location',
33
+ 'Do not apologise or admit fault to anyone, as any statements could be used against you in claims',
34
+ 'Use our complementary Axitech Demo Support to assist you in capturing the details you need to protect your position. We can also help with fast and free recovery.',
35
+ ],
36
+ };
37
+
38
+ function toggleAccordion() {
39
+ isOpen.value = !isOpen.value;
40
+ }
41
+ </script>
@@ -0,0 +1,94 @@
1
+ <template>
2
+ <div>
3
+ <input
4
+ v-model="date"
5
+ type="datetime-local"
6
+ class="date-time-input body1 q-py-sm"
7
+ :max="dayjs().format('YYYY-MM-DDTHH:mm')"
8
+ :min="dayjs().subtract(20, 'year').format('YYYY-MM-DDTHH:mm')"
9
+ :is-error="!!dateError"
10
+ />
11
+ <span v-if="dateError" class="text-negative-700">{{ dateError }}</span>
12
+ </div>
13
+ </template>
14
+
15
+ <script setup lang="ts">
16
+ import { computed, ref, watch } from 'vue';
17
+ import dayjs from 'dayjs';
18
+ import customParseFormat from 'dayjs/plugin/customParseFormat';
19
+ import utc from 'dayjs/plugin/utc';
20
+ dayjs.extend(customParseFormat);
21
+ dayjs.extend(utc);
22
+
23
+ const props = defineProps({
24
+ modelValue: {
25
+ type: String,
26
+ required: false,
27
+ default: '',
28
+ },
29
+ loading: {
30
+ type: Boolean,
31
+ required: false,
32
+ default: false,
33
+ },
34
+ disabled: {
35
+ type: Boolean,
36
+ required: false,
37
+ default: false,
38
+ },
39
+ onlyPicker: {
40
+ type: Boolean,
41
+ default: false,
42
+ },
43
+ icon: {
44
+ type: String,
45
+ default: 'mdi-calendar-range',
46
+ },
47
+ color: {
48
+ type: String,
49
+ default: 'secondary',
50
+ },
51
+ });
52
+ const emit = defineEmits(['update:modelValue', 'close', 'open', 'error']);
53
+
54
+ const collisionDate = computed({
55
+ get: () => {
56
+ const date = formatDate(props.modelValue);
57
+ emit('update:modelValue', date);
58
+ return date;
59
+ },
60
+ set(value) {
61
+ emit('update:modelValue', value);
62
+ },
63
+ });
64
+
65
+ const date = ref(dayjs(collisionDate.value).format('YYYY-MM-DDTHH:mm'));
66
+ const dateError = ref('');
67
+
68
+ function formatDate(date: string) {
69
+ return date
70
+ ? dayjs(date).utc().format('ddd, MMM DD, YYYY, HH:mm')
71
+ : props.onlyPicker
72
+ ? ''
73
+ : dayjs().utc().format('ddd, MMM DD, YYYY, HH:mm');
74
+ }
75
+
76
+ function validateDate(val: string) {
77
+ if (dayjs(val, 'YYYY-MM-DDTHH:mm', true).isValid() && dayjs(val).isAfter(dayjs())) {
78
+ dateError.value = 'Please enter a date before now';
79
+ return false;
80
+ }
81
+ dateError.value = dayjs(val, 'YYYY-MM-DDTHH:mm', true).isValid() ? '' : 'Please enter a valid date';
82
+
83
+ return dayjs(val, 'YYYY-MM-DDTHH:mm', true).isValid();
84
+ }
85
+
86
+ watch(date, () => {
87
+ if (!validateDate(date.value)) {
88
+ emit('error', true);
89
+ return;
90
+ }
91
+ emit('error', false);
92
+ collisionDate.value = formatDate(`${dayjs(date.value).format('YYYY-MM-DD HH:mm')}`);
93
+ });
94
+ </script>
@@ -0,0 +1,116 @@
1
+ <template>
2
+ <div ref="inputDiv" class="w-full">
3
+ <Input
4
+ v-model="autocompleteText"
5
+ id="google-autocomplete"
6
+ placeholder="Start by entering an address"
7
+ prefix="mdi:magnify"
8
+ class="w-full md:min-w-[320px]"
9
+ />
10
+ </div>
11
+ </template>
12
+
13
+ <script setup lang="ts">
14
+ import { onBeforeUnmount, ref, watch } from 'vue';
15
+ import Input from './Input.vue';
16
+ import { ILocationInfo } from 'src/utils/map';
17
+
18
+ const props = defineProps<{
19
+ address?: string;
20
+ }>();
21
+
22
+ const emit = defineEmits<{
23
+ (e: 'placeChanged', value: ILocationInfo, place: google.maps.places.PlaceResult): void;
24
+ (e: 'noResult'): void;
25
+ }>();
26
+
27
+ const autocomplete = ref<google.maps.places.Autocomplete>();
28
+ let autocompleteListener: google.maps.MapsEventListener;
29
+ const autocompleteText = ref(props.address || '');
30
+ const inputDiv = ref<HTMLDivElement>();
31
+
32
+ function onPlaceChanged() {
33
+ if (!autocomplete.value) {
34
+ return;
35
+ }
36
+ const place = autocomplete.value.getPlace();
37
+ if (!place.geometry) {
38
+ return emit('noResult');
39
+ }
40
+ if (place.address_components !== undefined) {
41
+ emit('placeChanged', formatResult(place), place);
42
+ autocompleteText.value = place.formatted_address ?? '';
43
+ }
44
+ }
45
+
46
+ function getFormatValue(place: google.maps.places.PlaceResult, type: string, name: 'short_name' | 'long_name') {
47
+ const component = place.address_components?.find((c) => c.types.includes(type));
48
+ return component?.[name] ?? '';
49
+ }
50
+
51
+ function formatResult(place: google.maps.places.PlaceResult) {
52
+ const returnData: ILocationInfo = {
53
+ latitude: 0,
54
+ longitude: 0,
55
+ formatted_address: '',
56
+ address_line: '',
57
+ city: '',
58
+ state: '',
59
+ country: '',
60
+ postal_code: '',
61
+ };
62
+ if (!place.address_components) {
63
+ return returnData;
64
+ }
65
+ returnData.address_line = `${getFormatValue(place, 'street_number', 'short_name')} ${getFormatValue(
66
+ place,
67
+ 'route',
68
+ 'long_name'
69
+ )}`;
70
+ returnData.city = getFormatValue(place, 'postal_town', 'long_name');
71
+ returnData.state = getFormatValue(place, 'administrative_area_level_1', 'short_name');
72
+ returnData.country = getFormatValue(place, 'country', 'long_name');
73
+ returnData.postal_code = getFormatValue(place, 'postal_code', 'short_name');
74
+
75
+ if (!place?.geometry?.location) {
76
+ return returnData;
77
+ }
78
+ returnData.latitude = place.geometry.location.lat();
79
+ returnData.longitude = place.geometry.location.lng();
80
+ returnData.formatted_address = place.formatted_address ?? '';
81
+ return returnData;
82
+ }
83
+
84
+ watch(inputDiv, () => {
85
+ const inputElement = inputDiv.value?.getElementsByTagName('input')[0];
86
+ if (!inputElement) {
87
+ return;
88
+ }
89
+ autocomplete.value = new google.maps.places.Autocomplete(inputElement, { types: ['address'] });
90
+ autocompleteListener = autocomplete.value.addListener('place_changed', onPlaceChanged);
91
+ });
92
+
93
+ watch(
94
+ () => props.address,
95
+ () => {
96
+ if (props.address) {
97
+ autocompleteText.value = props.address;
98
+ }
99
+ },
100
+ {
101
+ immediate: true,
102
+ }
103
+ );
104
+
105
+ onBeforeUnmount(() => {
106
+ if (autocomplete.value) {
107
+ autocomplete.value?.unbindAll?.();
108
+ autocomplete.value?.unbind?.('place_changed');
109
+ Array.from(document.getElementsByClassName('pac-container'))?.forEach((element) => element?.remove());
110
+ google.maps.event?.removeListener?.(autocompleteListener);
111
+ google.maps.event?.clearInstanceListeners?.(autocomplete.value);
112
+ }
113
+ });
114
+ </script>
115
+
116
+ <style scoped></style>