PluginProbe ʕ •ᴥ•ʔ
Booking for Appointments and Events Calendar – Amelia / 2.4.6
Booking for Appointments and Events Calendar – Amelia v2.4.6
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 / common / FormFields / AmAttachmentFormField.vue
ameliabooking / v3 / src / views / common / FormFields Last commit date
AmAddressFormField.vue 1 month ago AmAttachmentFormField.vue 1 month ago AmCheckboxFormField.vue 1 month ago AmContentFormField.vue 1 month ago AmDatePickerFormField.vue 1 month ago AmInputFormField.vue 1 month ago AmPhoneFormField.vue 1 month ago AmRadioFormField.vue 1 month ago AmSelectFormField.vue 1 month ago AmSocialButton.vue 1 month ago
AmAttachmentFormField.vue
141 lines
1 <template>
2 <el-form-item
3 v-if="props.isUpload"
4 :id="props.id"
5 ref="formFieldRef"
6 class="am-ff__item"
7 :prop="props.itemName"
8 :label-position="props.labelPosition"
9 >
10 <template #label>
11 <span class="am-ff__item-label" v-html="props.label" />
12 </template>
13 <AmAttachment
14 :id="props.id"
15 v-model="model"
16 :auto-upload="false"
17 :accept="customFieldsAllowedExtensions"
18 @change="onAddFile"
19 @remove="onRemoveFile"
20 >
21 {{ props.btnLabel }}
22 </AmAttachment>
23 </el-form-item>
24 <div v-else>
25 <p v-for="(fileInfo, index) in props.modelValue" :key="index">
26 <a
27 :key="index"
28 :href="
29 ajaxUrl +
30 '/fields/' +
31 props.id +
32 '/' +
33 props.bookingId +
34 '/' +
35 index +
36 '&source=' +
37 props.source
38 "
39 target="_blank"
40 >
41 {{ fileInfo.name }}
42 </a>
43 </p>
44 </div>
45 </template>
46
47 <script setup>
48 // * _components
49 import AmAttachment from '../../_components/attachment/AmAttachment.vue'
50
51 // * Import from Vue
52 import { computed, onMounted, ref, toRefs } from 'vue'
53 import { settings } from '../../../plugins/settings'
54
55 // * Import from Vuex
56 import { useStore } from 'vuex'
57
58 // * Form Item Props
59 let props = defineProps({
60 modelValue: {
61 type: [String, Array, Object, Number],
62 required: true,
63 },
64 id: {
65 type: [String, Number],
66 },
67 bookingId: {
68 type: [String, Number],
69 },
70 itemName: {
71 type: String,
72 required: true,
73 },
74 isUpload: {
75 type: Boolean,
76 default: true,
77 },
78 label: {
79 type: String,
80 },
81 labelPosition: {
82 type: String,
83 default: 'top',
84 },
85 btnLabel: {
86 type: String,
87 },
88 source: {
89 type: String,
90 default: 'cabinet-provider',
91 },
92 })
93
94 // * Define Emits
95 const emits = defineEmits(['update:modelValue', 'change', 'remove'])
96
97 const store = useStore()
98
99 let ajaxUrl = computed(() => store.getters['getBaseUrls'].wpAmeliaPluginAjaxURL)
100
101 // * Component model
102 let { modelValue } = toRefs(props)
103 let model = computed({
104 get: () => modelValue.value,
105 set: (val) => {
106 emits('update:modelValue', val)
107 },
108 })
109
110 // * Form Item Reference
111 let formFieldRef = ref(null)
112
113 defineExpose({
114 formFieldRef,
115 })
116
117 let customFieldsAllowedExtensions = ref('')
118
119 onMounted(() => {
120 if (settings.general.customFieldsAllowedExtensions) {
121 customFieldsAllowedExtensions.value = Object.keys(
122 settings.general.customFieldsAllowedExtensions,
123 ).join(', ')
124 }
125 })
126
127 function onAddFile(a) {
128 emits('update:modelValue', a.raw)
129 }
130
131 function onRemoveFile(a) {
132 emits('update:modelValue', a.raw)
133 }
134 </script>
135
136 <script>
137 export default {
138 name: 'AttachmentFormField',
139 }
140 </script>
141