CustomizeCatalog.vue
3 years ago
CustomizeCustomerPanel.vue
2 years ago
CustomizeEmployeePanel.vue
1 year ago
CustomizeEventCalendar.vue
1 year ago
CustomizeEventList.vue
1 year ago
CustomizeSearch.vue
4 years ago
CustomizeStepNew.vue
2 years ago
CustomizeStepOld.vue
4 years ago
CustomizeCatalog.vue
372 lines
| 1 | <template> |
| 2 | <template v-if="!amCustomize.fonts.customFontSelected"> |
| 3 | <link rel="preconnect" href="https://fonts.googleapis.com"> |
| 4 | <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin> |
| 5 | <link rel="stylesheet" :href="`${baseUrls.wpAmeliaPluginURL}v3/src/assets/scss/common/fonts/font.css`" type="text/css" media="all"> |
| 6 | </template> |
| 7 | <div id="amelia-container" ref="ameliaContainer" class="am-fc__wrapper" :style="cssVars"> |
| 8 | <template v-if="stepsArray.length"> |
| 9 | <component :is="stepsArray[stepIndex]"></component> |
| 10 | </template> |
| 11 | </div> |
| 12 | </template> |
| 13 | |
| 14 | <script setup> |
| 15 | // * Step components |
| 16 | import CategoriesList from '../steps/CategoriesList.vue' |
| 17 | import CategoryItemsList from '../steps/CategoryItemsList.vue' |
| 18 | import CategoryService from '../steps/CategoryService.vue' |
| 19 | import CategoryPackage from '../steps/CategoryPackage.vue' |
| 20 | |
| 21 | const categoriesList = markRaw(CategoriesList) |
| 22 | const categoryItemsList = markRaw(CategoryItemsList) |
| 23 | const categoryService = markRaw(CategoryService) |
| 24 | const categoryPackage = markRaw(CategoryPackage) |
| 25 | |
| 26 | // * Import from Vue |
| 27 | import { |
| 28 | ref, |
| 29 | provide, |
| 30 | inject, |
| 31 | markRaw, |
| 32 | watchEffect, |
| 33 | computed, |
| 34 | onBeforeMount, |
| 35 | onMounted |
| 36 | } from "vue"; |
| 37 | |
| 38 | // * Import composables |
| 39 | import { usePopulateMultiDimensionalObject } from '../../../../assets/js/common/objectAndArrayManipulation.js' |
| 40 | import { defaultCustomizeSettings } from '../../../../assets/js/common/defaultCustomize.js' |
| 41 | |
| 42 | // * Base Urls |
| 43 | const baseUrls = inject('baseUrls') |
| 44 | |
| 45 | // * Customize data |
| 46 | let amCustomize = inject('customize') |
| 47 | |
| 48 | // * Translations |
| 49 | let amTranslations = inject('translations') |
| 50 | |
| 51 | let stepName = inject('stepName') |
| 52 | let pageRenderKey = inject('pageRenderKey') |
| 53 | |
| 54 | // * Fonts |
| 55 | let amFonts = computed(() => { |
| 56 | return amCustomize.value.fonts |
| 57 | }) |
| 58 | provide('amFonts', amFonts) |
| 59 | |
| 60 | let stepsArray = ref([ |
| 61 | categoriesList, |
| 62 | categoryItemsList, |
| 63 | categoryService, |
| 64 | categoryPackage |
| 65 | ]) |
| 66 | |
| 67 | // * Step index |
| 68 | let stepIndex = inject('stepIndex') |
| 69 | |
| 70 | watchEffect( () => { |
| 71 | stepName.value = stepsArray.value[stepIndex.value].key |
| 72 | }) |
| 73 | |
| 74 | let { pageNameHandler } = inject('headerFunctionality', { |
| 75 | pageNameHandler: () => 'Step-by-Step Booking Form' |
| 76 | }) |
| 77 | |
| 78 | pageNameHandler('Catalog Booking Form') |
| 79 | |
| 80 | // * implementation of saved labels into amTranslation object |
| 81 | let stepKey = ref('') |
| 82 | function savedLabelsImplementation (labelObj) { |
| 83 | Object.keys(labelObj).forEach((labelKey) => { |
| 84 | if (labelKey in amCustomize.value[pageRenderKey.value][stepKey.value].translations) { |
| 85 | labelObj[labelKey] = {...labelObj[labelKey], ...amCustomize.value[pageRenderKey.value][stepKey.value].translations[labelKey]} |
| 86 | } |
| 87 | }) |
| 88 | } |
| 89 | |
| 90 | // * Component reference |
| 91 | let ameliaContainer = ref(null) |
| 92 | |
| 93 | // * Plugin wrapper width |
| 94 | let containerWidth = ref() |
| 95 | provide('containerWidth', containerWidth) |
| 96 | |
| 97 | // * window resize listener |
| 98 | window.addEventListener('resize', resize); |
| 99 | |
| 100 | // * resize function |
| 101 | function resize() { |
| 102 | if (ameliaContainer.value) { |
| 103 | containerWidth.value = ameliaContainer.value.offsetWidth |
| 104 | } |
| 105 | } |
| 106 | |
| 107 | onMounted(() => { |
| 108 | if (ameliaContainer.value) { |
| 109 | containerWidth.value = ameliaContainer.value.offsetWidth |
| 110 | } |
| 111 | }) |
| 112 | |
| 113 | /** |
| 114 | * Lifecycle Hooks |
| 115 | */ |
| 116 | onBeforeMount(() => { |
| 117 | window.scrollTo({ |
| 118 | top: 0, |
| 119 | left: 0, |
| 120 | behavior: 'smooth' |
| 121 | }) |
| 122 | Object.keys(amCustomize.value[pageRenderKey.value]).forEach(step => { |
| 123 | if (step !== 'colors' && amCustomize.value[pageRenderKey.value][step].translations) { |
| 124 | stepKey.value = step |
| 125 | usePopulateMultiDimensionalObject('labels', amTranslations[pageRenderKey.value][step], savedLabelsImplementation) |
| 126 | } |
| 127 | }) |
| 128 | }) |
| 129 | |
| 130 | // * Colors |
| 131 | // * Customize colors |
| 132 | let amColors = computed(() => { |
| 133 | return amCustomize.value[pageRenderKey.value] ? amCustomize.value[pageRenderKey.value].colors : defaultCustomizeSettings[pageRenderKey.value].colors |
| 134 | }) |
| 135 | |
| 136 | provide('amColors', amColors) |
| 137 | |
| 138 | let cssVars = computed(() => { |
| 139 | return { |
| 140 | '--am-c-primary': amColors.value.colorPrimary, |
| 141 | '--am-c-success': amColors.value.colorSuccess, |
| 142 | '--am-c-error': amColors.value.colorError, |
| 143 | '--am-c-warning': amColors.value.colorWarning, |
| 144 | // input global colors - usage input, textarea, checkbox, radio button, select input, adv select input |
| 145 | '--am-c-inp-bgr': amColors.value.colorInpBgr, |
| 146 | '--am-c-inp-border': amColors.value.colorInpBorder, |
| 147 | '--am-c-inp-text': amColors.value.colorInpText, |
| 148 | '--am-c-inp-placeholder': amColors.value.colorInpPlaceHolder, |
| 149 | // dropdown global colors - usage select dropdown, adv select dropdown |
| 150 | '--am-c-drop-bgr': amColors.value.colorDropBgr, |
| 151 | '--am-c-drop-text': amColors.value.colorDropText, |
| 152 | // sidebar container colors - left part of the form |
| 153 | '--am-c-sb-bgr': amColors.value.colorSbBgr, |
| 154 | '--am-c-sb-text': amColors.value.colorSbText, |
| 155 | // main container colors - right part of the form |
| 156 | '--am-c-main-bgr': amColors.value.colorMainBgr, |
| 157 | '--am-c-main-heading-text': amColors.value.colorMainHeadingText, |
| 158 | '--am-c-main-text': amColors.value.colorMainText, |
| 159 | // input global colors - usage input, textarea, checkbox, radio button, select input, adv select input |
| 160 | '--am-c-card-bgr': amColors.value.colorCardBgr, |
| 161 | '--am-c-card-border': amColors.value.colorCardBorder, |
| 162 | '--am-c-card-text': amColors.value.colorCardText, |
| 163 | // button global colors |
| 164 | '--am-c-btn-prim': amColors.value.colorBtnPrim, |
| 165 | '--am-c-btn-prim-text': amColors.value.colorBtnPrimText, |
| 166 | '--am-c-btn-sec': amColors.value.colorBtnSec, |
| 167 | '--am-c-btn-sec-text': amColors.value.colorBtnSecText, |
| 168 | '--am-font-family': amCustomize.value.fonts.fontFamily, |
| 169 | // css properties |
| 170 | // -mw- max width |
| 171 | // -brad- border-radius |
| 172 | '--am-mw-main': amCustomize.value.sbsNew.sidebar.options.self.visibility ? '760px' : '520px', |
| 173 | '--am-brad-main': amCustomize.value.sbsNew.sidebar.options.self.visibility ? '0 0.5rem 0.5rem 0' : '0.5rem' |
| 174 | } |
| 175 | }) |
| 176 | </script> |
| 177 | |
| 178 | <script> |
| 179 | export default { |
| 180 | name: "CustomizeCatalog" |
| 181 | } |
| 182 | </script> |
| 183 | |
| 184 | <style lang="scss"> |
| 185 | @import './src/assets/scss/common/reset/reset'; |
| 186 | |
| 187 | :root { |
| 188 | // Colors |
| 189 | // shortcuts |
| 190 | // -c- color |
| 191 | // -bgr- background |
| 192 | // -prim- primary |
| 193 | // -sec- secondary |
| 194 | // primitive colors |
| 195 | --am-c-primary: #{$blue-1000}; |
| 196 | --am-c-success: #{$green-1000}; |
| 197 | --am-c-error: #{$red-900}; |
| 198 | --am-c-warning: #{$yellow-1000}; |
| 199 | // main container colors - right part of the form |
| 200 | --am-c-main-bgr: #{$blue-900}; |
| 201 | --am-c-main-heading-text: #{$shade-800}; |
| 202 | --am-c-main-text: #{$shade-900}; |
| 203 | // sidebar container colors - left part of the form |
| 204 | --am-c-sb-bgr: #17295A; |
| 205 | --am-c-sb-text: #{$am-white}; |
| 206 | // input global colors - usage input, textarea, checkbox, radio button, select input, adv select input |
| 207 | --am-c-inp-bgr: #{$blue-900}; |
| 208 | --am-c-inp-border: #{$shade-250}; |
| 209 | --am-c-inp-text: #{$shade-900}; |
| 210 | --am-c-inp-placeholder: #{$shade-500}; |
| 211 | --am-c-checkbox-border: #{$shade-300}; |
| 212 | --am-c-checkbox-border-disabled: #{$blue-600}; |
| 213 | --am-c-checkbox-border-focused: #{$blue-700}; |
| 214 | --am-c-checkbox-label-disabled: #{$shade-600}; |
| 215 | // dropdown global colors - usage select dropdown, adv select dropdown |
| 216 | --am-c-drop-bgr: #{$am-white}; |
| 217 | --am-c-drop-text: #{$shade-1000}; |
| 218 | // button global colors |
| 219 | --am-c-btn-prim: #{$blue-900}; |
| 220 | --am-c-btn-prim-text: #{$am-white}; |
| 221 | --am-c-btn-sec: #{$am-white}; |
| 222 | --am-c-btn-sec-text: #{$shade-900}; |
| 223 | |
| 224 | // Properties |
| 225 | // shortcuts |
| 226 | // -h- height |
| 227 | // -fs- font size |
| 228 | // -rad- border radius |
| 229 | --am-h-input: 40px; |
| 230 | --am-fs-input: 15px; |
| 231 | --am-rad-input: 6px; |
| 232 | --am-fs-label: 15px; |
| 233 | --am-fs-btn: 15px; |
| 234 | |
| 235 | // Font |
| 236 | --am-font-family: 'Amelia Roboto', sans-serif; |
| 237 | } |
| 238 | |
| 239 | //@import url('https://fonts.googleapis.com/css2?family=Rampart+One&display=swap'); |
| 240 | // am -- amelia |
| 241 | // fc -- form catalog |
| 242 | #amelia-app-backend-new { |
| 243 | * { |
| 244 | font-family: var(--am-font-family); |
| 245 | font-style: initial; |
| 246 | box-sizing: border-box; |
| 247 | } |
| 248 | |
| 249 | #amelia-container { |
| 250 | background-color: transparent; |
| 251 | |
| 252 | * { |
| 253 | font-family: var(--am-font-family); |
| 254 | font-style: initial; |
| 255 | box-sizing: border-box; |
| 256 | } |
| 257 | |
| 258 | &.am-fc { |
| 259 | // Container Wrapper |
| 260 | &__wrapper { |
| 261 | display: flex; |
| 262 | justify-content: center; |
| 263 | max-width: calc(100% - 48px); |
| 264 | width: 100%; |
| 265 | height: auto; |
| 266 | margin: 48px 24px; |
| 267 | padding: 0; |
| 268 | border-radius: 8px; |
| 269 | box-shadow: none; |
| 270 | |
| 271 | .el-form { |
| 272 | &-item { |
| 273 | display: block; |
| 274 | font-family: var(--am-font-family); |
| 275 | font-size: var(--am-fs-label); |
| 276 | margin-bottom: 24px; |
| 277 | |
| 278 | &__label { |
| 279 | flex: 0 0 auto; |
| 280 | text-align: left; |
| 281 | font-size: var(--am-fs-label); |
| 282 | line-height: 1.3; |
| 283 | color: var(--am-c-main-text); |
| 284 | box-sizing: border-box; |
| 285 | margin: 0; |
| 286 | |
| 287 | &:before { |
| 288 | color: var(--am-c-error); |
| 289 | } |
| 290 | } |
| 291 | |
| 292 | &__content { |
| 293 | display: flex; |
| 294 | flex-wrap: wrap; |
| 295 | align-items: center; |
| 296 | flex: 1; |
| 297 | position: relative; |
| 298 | font-size: var(--am-fs-input); |
| 299 | min-width: 0; |
| 300 | color: var(--am-c-main-text); |
| 301 | } |
| 302 | |
| 303 | &__error { |
| 304 | font-size: 12px; |
| 305 | color: var(--am-c-error); |
| 306 | padding-top: 4px; |
| 307 | } |
| 308 | } |
| 309 | } |
| 310 | |
| 311 | * { |
| 312 | font-family: var(--am-font-family); |
| 313 | box-sizing: border-box; |
| 314 | } |
| 315 | |
| 316 | .am-empty { |
| 317 | --am-c-e-bgr: var(--am-c-main-bgr); |
| 318 | --am-c-e-text: var(--am-c-main-text); |
| 319 | max-width: 760px; |
| 320 | width: 100%; |
| 321 | height: 460px; |
| 322 | text-align: center; |
| 323 | background-color: var(--am-c-e-bgr); |
| 324 | padding: 56px; |
| 325 | margin: 100px auto; |
| 326 | box-shadow: 0 30px 40px rgba(0, 0, 0, 0.12); |
| 327 | |
| 328 | * { |
| 329 | font-family: var(--am-font-family); |
| 330 | box-sizing: border-box; |
| 331 | color: var(--am-c-e-text); |
| 332 | } |
| 333 | |
| 334 | &__heading { |
| 335 | display: block; |
| 336 | text-align: center; |
| 337 | font-size: 24px; |
| 338 | line-height: 1.5; |
| 339 | font-weight: bold; |
| 340 | } |
| 341 | |
| 342 | &__subheading { |
| 343 | display: block; |
| 344 | text-align: center; |
| 345 | font-size: 16px; |
| 346 | line-height: 1.5; |
| 347 | font-weight: 400; |
| 348 | } |
| 349 | |
| 350 | p, span { |
| 351 | padding: 0; |
| 352 | } |
| 353 | |
| 354 | p { |
| 355 | font-size: 14px; |
| 356 | margin: 8px 0; |
| 357 | } |
| 358 | |
| 359 | a { |
| 360 | font-size: 14px; |
| 361 | color: var(--am-c-primary); |
| 362 | } |
| 363 | } |
| 364 | } |
| 365 | } |
| 366 | } |
| 367 | |
| 368 | .am-dialog-cs { |
| 369 | z-index: 10000 !important; |
| 370 | } |
| 371 | } |
| 372 | </style> |