ameliabooking
/
v3
/
src
/
views
/
admin
/
customize
/
steps
/
Cabinet
/
common
/
Authentication
/
SetPass.vue
ameliabooking
/
v3
/
src
/
views
/
admin
/
customize
/
steps
/
Cabinet
/
common
/
Authentication
Last commit date
SendAccessLink.vue
1 month ago
SendAccessLinkSuccess.vue
1 month ago
SetPass.vue
1 month ago
SignIn.vue
1 month ago
Skeleton.vue
1 month ago
SetPass.vue
310 lines
| 1 | <template> |
| 2 | <div class="am-asi" :style="cssVars"> |
| 3 | <div class="am-asi__top"> |
| 4 | <div class="am-asi__header"> |
| 5 | {{ labelsDisplay('new_password_set') }} |
| 6 | </div> |
| 7 | <div class="am-asi__text"> |
| 8 | {{ labelsDisplay('new_password_set_description') }} |
| 9 | </div> |
| 10 | </div> |
| 11 | |
| 12 | <el-form |
| 13 | ref="authFormRef" |
| 14 | :model="infoFormData" |
| 15 | :rules="infoFormRules" |
| 16 | label-position="top" |
| 17 | class="am-asi__form" |
| 18 | :class="responsiveClass" |
| 19 | > |
| 20 | <template v-for="(item, index) in signInFormConstruction" :key="index"> |
| 21 | <component |
| 22 | :is="item.template" |
| 23 | ref="customerCollectorRef" |
| 24 | v-model="infoFormData[index]" |
| 25 | v-bind="item.props" |
| 26 | @enter="submitForm" |
| 27 | ></component> |
| 28 | </template> |
| 29 | </el-form> |
| 30 | |
| 31 | <AmButton |
| 32 | class="am-asi__btn" |
| 33 | :type="amCustomize[pageRenderKey][stepName].options.newPassBtn.buttonType" |
| 34 | @click="submitForm" |
| 35 | > |
| 36 | {{ labelsDisplay('new_password_set_action') }} |
| 37 | </AmButton> |
| 38 | </div> |
| 39 | </template> |
| 40 | |
| 41 | <script setup> |
| 42 | // * import from Vue |
| 43 | import { ref, computed, inject } from 'vue' |
| 44 | |
| 45 | // * Components |
| 46 | import { formFieldsTemplates } from '../../../../../../../assets/js/common/formFieldsTemplates' |
| 47 | import AmButton from '../../../../../../_components/button/AmButton.vue' |
| 48 | |
| 49 | // * Composables |
| 50 | import { useResponsiveClass } from '../../../../../../../assets/js/common/responsive.js' |
| 51 | import { useColorTransparency } from '../../../../../../../assets/js/common/colorManipulation.js' |
| 52 | import { useReactiveCustomize } from '../../../../../../../assets/js/admin/useReactiveCustomize.js' |
| 53 | |
| 54 | // * Customize |
| 55 | const { amCustomize } = useReactiveCustomize() |
| 56 | |
| 57 | // * Labels |
| 58 | let langKey = inject('langKey') |
| 59 | let amLabels = inject('labels') |
| 60 | |
| 61 | let pageRenderKey = inject('pageRenderKey') |
| 62 | let stepName = inject('stepName') |
| 63 | |
| 64 | // * Label computed function |
| 65 | function labelsDisplay(label) { |
| 66 | let computedLabel = computed(() => { |
| 67 | return amCustomize.value[pageRenderKey.value][stepName.value].translations && |
| 68 | amCustomize.value[pageRenderKey.value][stepName.value].translations[label] && |
| 69 | amCustomize.value[pageRenderKey.value][stepName.value].translations[label][langKey.value] |
| 70 | ? amCustomize.value[pageRenderKey.value][stepName.value].translations[label][langKey.value] |
| 71 | : amLabels[label] |
| 72 | }) |
| 73 | |
| 74 | return computedLabel.value |
| 75 | } |
| 76 | |
| 77 | /******** |
| 78 | * Form * |
| 79 | ********/ |
| 80 | // * Form reference |
| 81 | let authFormRef = ref(null) |
| 82 | |
| 83 | // * Form data |
| 84 | let infoFormData = ref({ |
| 85 | newPassword: '', |
| 86 | confirmPassword: '', |
| 87 | }) |
| 88 | |
| 89 | // * Form validation rules |
| 90 | let infoFormRules = computed(() => { |
| 91 | return { |
| 92 | newPassword: [ |
| 93 | { |
| 94 | required: true, |
| 95 | message: labelsDisplay('new_password_required'), |
| 96 | trigger: 'submit', |
| 97 | }, |
| 98 | { |
| 99 | min: 4, |
| 100 | message: labelsDisplay('new_password_length'), |
| 101 | trigger: 'submit', |
| 102 | }, |
| 103 | ], |
| 104 | confirmPassword: [ |
| 105 | { |
| 106 | required: true, |
| 107 | message: labelsDisplay('new_password_required'), |
| 108 | trigger: 'submit', |
| 109 | }, |
| 110 | { |
| 111 | min: 4, |
| 112 | message: labelsDisplay('new_password_length'), |
| 113 | trigger: 'submit', |
| 114 | }, |
| 115 | ], |
| 116 | } |
| 117 | }) |
| 118 | |
| 119 | // * Form construction |
| 120 | let signInFormConstruction = ref({ |
| 121 | newPassword: { |
| 122 | template: formFieldsTemplates.text, |
| 123 | props: { |
| 124 | itemName: 'newPassword', |
| 125 | itemType: 'password', |
| 126 | showPassword: true, |
| 127 | label: computed(() => labelsDisplay('new_password_colon')), |
| 128 | placeholder: '', |
| 129 | minLength: 3, |
| 130 | class: 'am-asi__item', |
| 131 | }, |
| 132 | }, |
| 133 | confirmPassword: { |
| 134 | template: formFieldsTemplates.text, |
| 135 | props: { |
| 136 | itemName: 'confirmPassword', |
| 137 | itemType: 'password', |
| 138 | showPassword: true, |
| 139 | label: computed(() => labelsDisplay('new_password_colon_retype')), |
| 140 | placeholder: '', |
| 141 | minLength: 3, |
| 142 | class: 'am-asi__item', |
| 143 | }, |
| 144 | }, |
| 145 | }) |
| 146 | |
| 147 | // * Submit Form |
| 148 | function submitForm() { |
| 149 | authFormRef.value.validate((valid) => { |
| 150 | return !!valid |
| 151 | }) |
| 152 | } |
| 153 | |
| 154 | /************* |
| 155 | * Customize * |
| 156 | *************/ |
| 157 | |
| 158 | // * Responsive - Container Width |
| 159 | let cWidth = inject('containerWidth') |
| 160 | |
| 161 | let responsiveClass = computed(() => useResponsiveClass(cWidth.value)) |
| 162 | |
| 163 | // * Fonts |
| 164 | let amFonts = inject('amFonts') |
| 165 | |
| 166 | // * Colors block |
| 167 | let amColors = inject('amColors') |
| 168 | |
| 169 | let cssVars = computed(() => { |
| 170 | return { |
| 171 | '--am-c-primary': amColors.value.colorPrimary, |
| 172 | '--am-c-success': amColors.value.colorSuccess, |
| 173 | '--am-c-error': amColors.value.colorError, |
| 174 | '--am-c-warning': amColors.value.colorWarning, |
| 175 | '--am-c-main-bgr': amColors.value.colorMainBgr, |
| 176 | '--am-c-main-heading-text': amColors.value.colorMainHeadingText, |
| 177 | '--am-c-main-text': amColors.value.colorMainText, |
| 178 | '--am-c-main-text-op70': useColorTransparency(amColors.value.colorMainText, 0.7), |
| 179 | '--am-c-main-text-op60': useColorTransparency(amColors.value.colorMainText, 0.6), |
| 180 | '--am-c-main-text-op40': useColorTransparency(amColors.value.colorMainText, 0.4), |
| 181 | '--am-c-main-text-op25': useColorTransparency(amColors.value.colorMainText, 0.25), |
| 182 | '--am-c-inp-bgr': amColors.value.colorInpBgr, |
| 183 | '--am-c-inp-border': amColors.value.colorInpBorder, |
| 184 | '--am-c-inp-text': amColors.value.colorInpText, |
| 185 | '--am-c-inp-placeholder': amColors.value.colorInpPlaceHolder, |
| 186 | '--am-c-btn-prim': amColors.value.colorBtnPrim, |
| 187 | '--am-c-btn-prim-text': amColors.value.colorBtnPrimText, |
| 188 | '--am-c-skeleton-op20': useColorTransparency(amColors.value.colorMainText, 0.2), |
| 189 | '--am-c-skeleton-op60': useColorTransparency(amColors.value.colorMainText, 0.6), |
| 190 | '--am-font-family': amFonts.value.fontFamily, |
| 191 | |
| 192 | '--am-c-scroll-op30': useColorTransparency(amColors.value.colorPrimary, 0.3), |
| 193 | '--am-c-scroll-op10': useColorTransparency(amColors.value.colorPrimary, 0.1), |
| 194 | } |
| 195 | }) |
| 196 | </script> |
| 197 | |
| 198 | <script> |
| 199 | export default { |
| 200 | name: 'AuthNewPass', |
| 201 | key: 'setPass', |
| 202 | } |
| 203 | </script> |
| 204 | |
| 205 | <style lang="scss"> |
| 206 | // am - amelia |
| 207 | // asi - authentication sign in |
| 208 | @mixin auth { |
| 209 | .am-asi { |
| 210 | max-width: 400px; |
| 211 | width: 100%; |
| 212 | background-color: var(--am-c-main-bgr); |
| 213 | box-shadow: |
| 214 | 0 0 9px -4px var(--am-c-main-text-op40), |
| 215 | 0px 17px 35px -12px var(--am-c-main-text-op25); |
| 216 | border-radius: 12px; |
| 217 | padding: 32px 24px 24px; |
| 218 | margin: 0 auto; |
| 219 | font-family: var(--am-font-family); |
| 220 | |
| 221 | * { |
| 222 | font-family: var(--am-font-family); |
| 223 | box-sizing: border-box; |
| 224 | } |
| 225 | |
| 226 | &__top { |
| 227 | display: flex; |
| 228 | flex-direction: column; |
| 229 | align-items: center; |
| 230 | margin: 0 0 32px; |
| 231 | } |
| 232 | |
| 233 | &__header { |
| 234 | font-size: 24px; |
| 235 | font-weight: 500; |
| 236 | line-height: 1.33333; |
| 237 | color: var(--am-c-main-heading-text); |
| 238 | margin: 0 0 4px; |
| 239 | } |
| 240 | |
| 241 | &__text { |
| 242 | font-size: 15px; |
| 243 | font-weight: 400; |
| 244 | line-height: 1.6; |
| 245 | text-align: center; |
| 246 | color: var(--am-c-main-text-op70); |
| 247 | } |
| 248 | |
| 249 | &__form { |
| 250 | .am-ff { |
| 251 | &__item { |
| 252 | &-label { |
| 253 | font-size: 15px; |
| 254 | font-weight: 500; |
| 255 | color: var(--am-c-main-text); |
| 256 | } |
| 257 | } |
| 258 | } |
| 259 | |
| 260 | .el-form { |
| 261 | &-item { |
| 262 | margin-bottom: 30px; |
| 263 | |
| 264 | &__label { |
| 265 | margin: 0 0 4px; |
| 266 | } |
| 267 | } |
| 268 | } |
| 269 | } |
| 270 | |
| 271 | &__btn { |
| 272 | width: 100%; |
| 273 | margin: 16px 0; |
| 274 | } |
| 275 | |
| 276 | &__footer { |
| 277 | display: flex; |
| 278 | align-items: center; |
| 279 | justify-content: center; |
| 280 | |
| 281 | &-text { |
| 282 | font-size: 15px; |
| 283 | font-weight: 400; |
| 284 | line-height: 1.6; |
| 285 | margin: 0 4px 0 0; |
| 286 | color: var(--am-c-main-text-op60); |
| 287 | } |
| 288 | |
| 289 | &-link { |
| 290 | font-size: 15px; |
| 291 | font-weight: 400; |
| 292 | line-height: 1.6; |
| 293 | color: var(--am-c-primary); |
| 294 | cursor: pointer; |
| 295 | } |
| 296 | } |
| 297 | } |
| 298 | } |
| 299 | |
| 300 | // Public |
| 301 | .amelia-v2-booking #amelia-container { |
| 302 | @include auth; |
| 303 | } |
| 304 | |
| 305 | // Admin |
| 306 | #amelia-app-backend-new { |
| 307 | @include auth; |
| 308 | } |
| 309 | </style> |
| 310 |