This commit is contained in:
Julien Nahum 2023-09-20 21:06:48 +02:00
commit 9534847a24
9 changed files with 39 additions and 11 deletions

View File

@ -190,6 +190,9 @@ class AnswerFormRequest extends FormRequest
} }
return $this->getRulesForDate($property); return $this->getRulesForDate($property);
case 'phone_number': case 'phone_number':
if (isset($property['use_simple_text_input']) && $property['use_simple_text_input']) {
return ['string'];
}
return ['string', 'min:6', new ValidPhoneInputRule]; return ['string', 'min:6', new ValidPhoneInputRule];
default: default:
return []; return [];

View File

@ -13,8 +13,12 @@ class ValidPhoneInputRule implements Rule
return false; return false;
} }
try {
$phoneUtil = \libphonenumber\PhoneNumberUtil::getInstance(); $phoneUtil = \libphonenumber\PhoneNumberUtil::getInstance();
return $phoneUtil->isValidNumber($phoneUtil->parse($value)); return $phoneUtil->isValidNumber($phoneUtil->parse($value));
} catch (\Exception $e) {
return false;
}
} }
public function message() public function message()

View File

@ -12,7 +12,7 @@
</router-link> </router-link>
<workspace-dropdown class="ml-6"/> <workspace-dropdown class="ml-6"/>
</div> </div>
<div class="hidden md:block ml-auto relative"> <div v-if="showAuth" class="hidden md:block ml-auto relative">
<router-link :to="{name:'templates'}" v-if="$route.name !== 'templates'" <router-link :to="{name:'templates'}" v-if="$route.name !== 'templates'"
class="text-sm text-gray-600 dark:text-white hover:text-gray-800 cursor-pointer mt-1 mr-8"> class="text-sm text-gray-600 dark:text-white hover:text-gray-800 cursor-pointer mt-1 mr-8">
Templates Templates
@ -27,7 +27,7 @@
<span v-else>Pricing</span> <span v-else>Pricing</span>
</router-link> </router-link>
<a href="#" class="text-sm text-gray-600 dark:text-white hover:text-gray-800 cursor-pointer mt-1" <a href="#" class="text-sm text-gray-600 dark:text-white hover:text-gray-800 cursor-pointer mt-1"
@click.prevent="$crisp.push(['do', 'helpdesk:search'])" v-if="hasCrisp" @click.prevent="openCrisp" v-if="hasCrisp"
> >
Help Help
</a> </a>
@ -194,6 +194,10 @@ export default {
// Redirect to login. // Redirect to login.
this.$router.push({name: 'login'}) this.$router.push({name: 'login'})
}, },
openCrisp () {
window.$crisp.push(['do', 'chat:show'])
window.$crisp.push(['do', 'chat:open'])
}
} }
} }
</script> </script>

View File

@ -13,7 +13,7 @@
</small> </small>
</div> </div>
<div :id="id ? id : name" :name="name" :style="inputStyle" class="flex items-center"> <div :id="id ? id : name" :name="name" :style="inputStyle" class="flex items-center">
<v-select class="w-[110px]" dropdown-class="w-[400px]" input-class="rounded-r-none" :data="countries" <v-select class="w-[110px]" dropdown-class="w-[350px]" input-class="rounded-r-none" :data="countries"
v-model="selectedCountryCode" v-model="selectedCountryCode"
:has-error="hasValidation && form.errors.has(name)" :has-error="hasValidation && form.errors.has(name)"
:disabled="disabled" :searchable="true" :search-keys="['name']" :option-key="'code'" :color="color" :disabled="disabled" :searchable="true" :search-keys="['name']" :option-key="'code'" :color="color"

View File

@ -133,7 +133,7 @@ export default {
checkbox: 'CheckboxInput', checkbox: 'CheckboxInput',
url: 'TextInput', url: 'TextInput',
email: 'TextInput', email: 'TextInput',
phone_number: 'PhoneInput' phone_number: 'TextInput'
} }
}, },
/** /**
@ -159,6 +159,9 @@ export default {
if (field.type === 'signature') { if (field.type === 'signature') {
return 'SignatureInput' return 'SignatureInput'
} }
if (field.type === 'phone_number' && !field.use_simple_text_input) {
return 'PhoneInput'
}
return this.fieldComponents[field.type] return this.fieldComponents[field.type]
}, },
isPublicFormPage() { isPublicFormPage() {

View File

@ -22,7 +22,7 @@
<div class="hidden md:block mr-10 relative"> <div class="hidden md:block mr-10 relative">
<a href="#" <a href="#"
class="text-sm px-3 py-2 hover:bg-gray-50 cursor-pointer rounded-md text-gray-500 px-0 sm:px-3 hover:text-gray-800 cursor-pointer mt-1" class="text-sm px-3 py-2 hover:bg-gray-50 cursor-pointer rounded-md text-gray-500 px-0 sm:px-3 hover:text-gray-800 cursor-pointer mt-1"
@click.prevent="$crisp.push(['do', 'helpdesk:search'])" @click.prevent="openCrisp"
> >
Help Help
</a> </a>
@ -221,6 +221,10 @@ export default {
}, },
methods: { methods: {
openCrisp () {
window.$crisp.push(['do', 'chat:show'])
window.$crisp.push(['do', 'chat:open'])
},
showValidationErrors() { showValidationErrors() {
this.showFormErrorModal = true this.showFormErrorModal = true
}, },

View File

@ -43,7 +43,7 @@ export default {
checkbox: 'CheckboxInput', checkbox: 'CheckboxInput',
url: 'TextInput', url: 'TextInput',
email: 'TextInput', email: 'TextInput',
phone_number: 'PhoneInput' phone_number: 'TextInput'
} }
} }
}, },
@ -57,6 +57,10 @@ export default {
required: true required: true
} }
if (this.property.type === 'phone_number' && !this.property.use_simple_text_input) {
componentData.component = 'PhoneInput'
}
if (['select', 'multi_select'].includes(this.property.type)) { if (['select', 'multi_select'].includes(this.property.type)) {
componentData.multiple = false; componentData.multiple = false;
componentData.options = this.property[this.property.type].options.map(option => { componentData.options = this.property[this.property.type].options.map(option => {

View File

@ -193,12 +193,18 @@
label="Field Name" label="Field Name"
/> />
<v-checkbox v-model="field.hide_field_name" class="mb-3" <v-checkbox v-model="field.hide_field_name" class="mt-3"
:name="field.id+'_hide_field_name'" :name="field.id+'_hide_field_name'"
> >
Hide field name Hide field name
</v-checkbox> </v-checkbox>
<v-checkbox v-model="field.use_simple_text_input" class="mt-3"
:name="field.id+'_use_simple_text_input'"
>
Use simple text input
</v-checkbox>
<!-- Pre-fill depends on type --> <!-- Pre-fill depends on type -->
<v-checkbox v-if="field.type=='checkbox'" v-model="field.prefill" class="mt-3" <v-checkbox v-if="field.type=='checkbox'" v-model="field.prefill" class="mt-3"
:name="field.id+'_prefill'" :name="field.id+'_prefill'"
@ -216,7 +222,7 @@
:date-range="field.date_range===true" :date-range="field.date_range===true"
label="Pre-filled value" label="Pre-filled value"
/> />
<phone-input v-else-if="field.type === 'phone_number'" <phone-input v-else-if="field.type === 'phone_number' && !field.use_simple_text_input"
name="prefill" class="mt-3" name="prefill" class="mt-3"
:form="field" :can-only-country="true" :form="field" :can-only-country="true"
label="Pre-filled value" label="Pre-filled value"

View File

@ -1,6 +1,6 @@
<template> <template>
<div> <div>
<section class="bg-gradient-to-b relative from-white to-gray-100 py-12 sm:py-16 lg:py-20 xl:py-24"> <section class="bg-gradient-to-b relative from-white to-gray-100 py-8 sm:py-16 ">
<div class="absolute inset-0"> <div class="absolute inset-0">
<img class="w-full h-full object-cover object-top" <img class="w-full h-full object-cover object-top"
:src="asset('img/pages/ai_form_builder/background-pattern.svg')" alt=""> :src="asset('img/pages/ai_form_builder/background-pattern.svg')" alt="">