Fix dislpay of mb file upload size
This commit is contained in:
parent
77ff8637b3
commit
5ee599fba5
|
@ -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',
|
||||||
|
|
|
@ -12,7 +12,8 @@
|
||||||
@click.prevent="openAddFieldSidebar"
|
@click.prevent="openAddFieldSidebar"
|
||||||
>
|
>
|
||||||
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="3"
|
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="3"
|
||||||
stroke="currentColor" class="w-5 h-5">
|
stroke="currentColor" class="w-5 h-5"
|
||||||
|
>
|
||||||
<path stroke-linecap="round" stroke-linejoin="round" d="M12 4.5v15m7.5-7.5h-15" />
|
<path stroke-linecap="round" stroke-linejoin="round" d="M12 4.5v15m7.5-7.5h-15" />
|
||||||
</svg>
|
</svg>
|
||||||
</div>
|
</div>
|
||||||
|
@ -80,7 +81,7 @@
|
||||||
<script>
|
<script>
|
||||||
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";
|
import { mapState } from 'vuex'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'OpenFormField',
|
name: 'OpenFormField',
|
||||||
|
@ -301,8 +302,8 @@ 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)
|
||||||
} else if (field.type === 'number' && field.is_scale) {
|
} else if (field.type === 'number' && field.is_scale) {
|
||||||
|
@ -316,7 +317,7 @@ export default {
|
||||||
}
|
}
|
||||||
|
|
||||||
return inputProperties
|
return inputProperties
|
||||||
},
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
Loading…
Reference in New Issue