PluginProbe ʕ •ᴥ•ʔ
Booking for Appointments and Events Calendar – Amelia / 2.4.8
Booking for Appointments and Events Calendar – Amelia v2.4.8
2.4.8 2.4.7 2.4.6 2.4.5 2.4.4 2.4.3 2.4.2 2.4.1 2.4 trunk 1.2.1 1.2.10 1.2.11 1.2.12 1.2.13 1.2.14 1.2.15 1.2.16 1.2.17 1.2.18 1.2.19 1.2.2 1.2.20 1.2.21 1.2.22 1.2.23 1.2.24 1.2.25 1.2.26 1.2.27 1.2.28 1.2.29 1.2.3 1.2.30 1.2.31 1.2.32 1.2.33 1.2.34 1.2.35 1.2.36 1.2.37 1.2.38 1.2.4 1.2.5 1.2.6 1.2.7 1.2.8 1.2.9 2.0 2.0.1 2.0.2 2.1 2.1.1 2.1.2 2.1.3 2.2 2.2.1 2.3
ameliabooking / v3 / src / views / _components / image-placeholder / AmImagePlaceholder.vue
ameliabooking / v3 / src / views / _components / image-placeholder Last commit date
AmImagePlaceholder.vue 1 month ago
AmImagePlaceholder.vue
54 lines
1 <template>
2 <span :class="props.itemClass" :style="{ ...cardImage(props.itemData) }">
3 {{ cardSign(props.itemData) }}
4 </span>
5 </template>
6
7 <script setup>
8 import { amCardColors } from '../../../assets/js/common/colorManipulation'
9
10 let props = defineProps({
11 itemClass: {
12 type: String,
13 default: '',
14 },
15 itemData: {
16 type: Object,
17 default: () => {},
18 },
19 trimString: {
20 type: Number,
21 default: 2,
22 },
23 })
24
25 function cardImage(itemData) {
26 if (itemData.pictureFullPath) return { backgroundImage: `url(${itemData.pictureFullPath})` }
27
28 return {
29 backgroundColor: `${amCardColors.value[Math.floor(Math.random() * amCardColors.value.length)]}`,
30 }
31 }
32
33 function cardSign(itemData) {
34 if (!itemData.pictureFullPath) {
35 let name =
36 'firstName' in itemData ? `${itemData.firstName} ${itemData.lastName}` : itemData.name
37 return name
38 .split(' ')
39 .map((s) => s.charAt(0))
40 .join('')
41 .toUpperCase()
42 .substring(0, props.trimString)
43 .replace(/[^\w\s]/g, '')
44 }
45 return ''
46 }
47 </script>
48
49 <script>
50 export default {
51 name: 'AmImagePlaceholder',
52 }
53 </script>
54