Merge changes from main
This commit is contained in:
commit
8346fe7093
|
@ -60,7 +60,7 @@ class AnswerFormRequest extends FormRequest
|
||||||
if(isset($data[$field['id']]) && is_array($data[$field['id']])){
|
if(isset($data[$field['id']]) && is_array($data[$field['id']])){
|
||||||
$data[$field['id']] = array_map(function ($val) use ($field) {
|
$data[$field['id']] = array_map(function ($val) use ($field) {
|
||||||
$tmpop = collect($field[$field['type']]['options'])->first(function ($op) use ($val) {
|
$tmpop = collect($field[$field['type']]['options'])->first(function ($op) use ($val) {
|
||||||
return ($op['id'] === $val);
|
return ($op['id'] ?? $op['value'] === $val);
|
||||||
});
|
});
|
||||||
return isset($tmpop['name']) ? $tmpop['name'] : "";
|
return isset($tmpop['name']) ? $tmpop['name'] : "";
|
||||||
}, $data[$field['id']]);
|
}, $data[$field['id']]);
|
||||||
|
|
|
@ -126,7 +126,7 @@ abstract class UserFormRequest extends \Illuminate\Foundation\Http\FormRequest
|
||||||
|
|
||||||
// Custom SEO
|
// Custom SEO
|
||||||
'seo_meta' => 'nullable|array',
|
'seo_meta' => 'nullable|array',
|
||||||
'custom_domain' => 'sometimes|nullable|regex:/^[a-z0-9]+([\-\.]{1}[a-z0-9]+)*\.[a-z]{2,5}$/'
|
'custom_domain' => 'sometimes|nullable|regex:/^[a-z0-9]+([\-\.]{1}[a-z0-9]+)*\.[a-z]{2,20}$/'
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -32,7 +32,7 @@ class CustomDomainRequest extends FormRequest
|
||||||
$domains = collect($value)->filter(function ($domain) {
|
$domains = collect($value)->filter(function ($domain) {
|
||||||
return !empty( trim($domain) );
|
return !empty( trim($domain) );
|
||||||
})->each(function($domain) use (&$errors) {
|
})->each(function($domain) use (&$errors) {
|
||||||
if (!preg_match('/^[a-z0-9]+([\-\.]{1}[a-z0-9]+)*\.[a-z]{2,5}$/', $domain)) {
|
if (!preg_match('/^[a-z0-9]+([\-\.]{1}[a-z0-9]+)*\.[a-z]{2,20}$/', $domain)) {
|
||||||
$errors[] = 'Invalid domain: ' . $domain;
|
$errors[] = 'Invalid domain: ' . $domain;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -50,7 +50,8 @@ class FormResource extends JsonResource
|
||||||
'notification_settings' => $this->notification_settings,
|
'notification_settings' => $this->notification_settings,
|
||||||
'removed_properties' => $this->removed_properties,
|
'removed_properties' => $this->removed_properties,
|
||||||
'last_edited_human' => $this->updated_at?->diffForHumans(),
|
'last_edited_human' => $this->updated_at?->diffForHumans(),
|
||||||
'seo_meta' => $this->seo_meta
|
'seo_meta' => $this->seo_meta,
|
||||||
|
'max_file_size' => $this->max_file_size / 1000000,
|
||||||
] : [];
|
] : [];
|
||||||
|
|
||||||
$baseData = $this->getFilteredFormData(parent::toArray($request), $this->userIsFormOwner());
|
$baseData = $this->getFilteredFormData(parent::toArray($request), $this->userIsFormOwner());
|
||||||
|
|
|
@ -133,6 +133,7 @@ class Form extends Model implements CachableAttributes
|
||||||
protected $cachableAttributes = [
|
protected $cachableAttributes = [
|
||||||
'is_pro',
|
'is_pro',
|
||||||
'views_count',
|
'views_count',
|
||||||
|
'max_file_size'
|
||||||
];
|
];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -234,6 +235,13 @@ class Form extends Model implements CachableAttributes
|
||||||
return !empty($this->password);
|
return !empty($this->password);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getMaxFileSizeAttribute()
|
||||||
|
{
|
||||||
|
return $this->remember('max_file_size', 15 * 60, function(): int {
|
||||||
|
return $this->workspace->max_file_size;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
protected function removedProperties(): Attribute
|
protected function removedProperties(): Attribute
|
||||||
{
|
{
|
||||||
return Attribute::make(
|
return Attribute::make(
|
||||||
|
|
|
@ -14,9 +14,7 @@ class Workspace extends Model implements CachableAttributes
|
||||||
|
|
||||||
const MAX_FILE_SIZE_FREE = 5000000; // 5 MB
|
const MAX_FILE_SIZE_FREE = 5000000; // 5 MB
|
||||||
const MAX_FILE_SIZE_PRO = 50000000; // 50 MB
|
const MAX_FILE_SIZE_PRO = 50000000; // 50 MB
|
||||||
|
|
||||||
const MAX_DOMAIN_PRO = 1;
|
const MAX_DOMAIN_PRO = 1;
|
||||||
|
|
||||||
protected $fillable = [
|
protected $fillable = [
|
||||||
'name',
|
'name',
|
||||||
'icon',
|
'icon',
|
||||||
|
|
|
@ -51,7 +51,7 @@
|
||||||
</div>
|
</div>
|
||||||
<component :is="getFieldComponents" v-if="getFieldComponents"
|
<component :is="getFieldComponents" v-if="getFieldComponents"
|
||||||
v-bind="inputProperties(field)" :required="isFieldRequired"
|
v-bind="inputProperties(field)" :required="isFieldRequired"
|
||||||
:disabled="isFieldDisabled?true:null"
|
:disabled="isFieldDisabled"
|
||||||
/>
|
/>
|
||||||
<template v-else>
|
<template v-else>
|
||||||
<div v-if="field.type === 'nf-text' && field.content" :id="field.id" :key="field.id"
|
<div v-if="field.type === 'nf-text' && field.content" :id="field.id" :key="field.id"
|
||||||
|
@ -79,10 +79,9 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { computed } from 'vue'
|
|
||||||
import { useWorkingFormStore } from '../../../stores/working_form'
|
|
||||||
import FormLogicPropertyResolver from '../../../forms/FormLogicPropertyResolver.js'
|
import FormLogicPropertyResolver from '../../../forms/FormLogicPropertyResolver.js'
|
||||||
import FormPendingSubmissionKey from '../../../mixins/forms/form-pending-submission-key.js'
|
import FormPendingSubmissionKey from '../../../mixins/forms/form-pending-submission-key.js'
|
||||||
|
import { mapState } from 'vuex'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'OpenFormField',
|
name: 'OpenFormField',
|
||||||
|
@ -115,21 +114,15 @@ export default {
|
||||||
},
|
},
|
||||||
adminPreview: { type: Boolean, default: false } // If used in FormEditorPreview
|
adminPreview: { type: Boolean, default: false } // If used in FormEditorPreview
|
||||||
},
|
},
|
||||||
|
|
||||||
setup () {
|
|
||||||
const workingFormStore = useWorkingFormStore()
|
|
||||||
return {
|
|
||||||
workingFormStore,
|
|
||||||
selectedFieldIndex: computed(() => workingFormStore.selectedFieldIndex),
|
|
||||||
showEditFieldSidebar: computed(() => workingFormStore.showEditFieldSidebar)
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
data () {
|
data () {
|
||||||
return {}
|
return {}
|
||||||
},
|
},
|
||||||
|
|
||||||
computed: {
|
computed: {
|
||||||
|
...mapState({
|
||||||
|
selectedFieldIndex: state => state['open/working_form'].selectedFieldIndex,
|
||||||
|
showEditFieldSidebar: state => state['open/working_form'].showEditFieldSidebar
|
||||||
|
}),
|
||||||
fieldComponents () {
|
fieldComponents () {
|
||||||
return {
|
return {
|
||||||
text: 'TextInput',
|
text: 'TextInput',
|
||||||
|
@ -222,10 +215,10 @@ export default {
|
||||||
|
|
||||||
methods: {
|
methods: {
|
||||||
editFieldOptions () {
|
editFieldOptions () {
|
||||||
this.workingFormStore.openSettingsForField(this.field)
|
this.$store.commit('open/working_form/openSettingsForField', this.field)
|
||||||
},
|
},
|
||||||
openAddFieldSidebar () {
|
openAddFieldSidebar () {
|
||||||
this.workingFormStore.openAddFieldSidebar(this.field)
|
this.$store.commit('open/working_form/openAddFieldSidebar', this.field)
|
||||||
},
|
},
|
||||||
/**
|
/**
|
||||||
* Get the right input component for the field/options combination
|
* Get the right input component for the field/options combination
|
||||||
|
@ -309,7 +302,7 @@ export default {
|
||||||
}
|
}
|
||||||
} else if (field.type === 'files' || (field.type === 'url' && field.file_upload)) {
|
} else if (field.type === 'files' || (field.type === 'url' && field.file_upload)) {
|
||||||
inputProperties.multiple = (field.multiple !== undefined && field.multiple)
|
inputProperties.multiple = (field.multiple !== undefined && field.multiple)
|
||||||
inputProperties.mbLimit = 5
|
inputProperties.mbLimit = this.form.max_file_size
|
||||||
inputProperties.accept = (this.form.is_pro && field.allowed_file_types) ? field.allowed_file_types : ''
|
inputProperties.accept = (this.form.is_pro && field.allowed_file_types) ? field.allowed_file_types : ''
|
||||||
} else if (field.type === 'number' && field.is_rating) {
|
} else if (field.type === 'number' && field.is_rating) {
|
||||||
inputProperties.numberOfStars = parseInt(field.rating_max_value)
|
inputProperties.numberOfStars = parseInt(field.rating_max_value)
|
||||||
|
|
Loading…
Reference in New Issue