diff --git a/app/Http/Requests/AnswerFormRequest.php b/app/Http/Requests/AnswerFormRequest.php index 7cd1f3b..999586f 100644 --- a/app/Http/Requests/AnswerFormRequest.php +++ b/app/Http/Requests/AnswerFormRequest.php @@ -152,15 +152,25 @@ class AnswerFormRequest extends FormRequest return ['email:filter']; case 'date': if (isset($property['date_range']) && $property['date_range']) { - $this->requestRules[$property['id'].'.*'] = ['date']; - return ['array']; + $this->requestRules[$property['id'].'.*'] = $this->getRulesForDate($property); + return ['array', 'min:2']; } - return ['date']; + return $this->getRulesForDate($property); default: return []; } } + private function getRulesForDate($property) + { + if (isset($property['disable_past_dates']) && $property['disable_past_dates']) { + return ['date', 'after_or_equal:today']; + }else if (isset($property['disable_future_dates']) && $property['disable_future_dates']) { + return ['date', 'before_or_equal:today']; + } + return ['date']; + } + private function getSelectPropertyOptions($property): array { $type = $property['type']; diff --git a/app/Http/Requests/UserFormRequest.php b/app/Http/Requests/UserFormRequest.php index e5fd267..ea9a0df 100644 --- a/app/Http/Requests/UserFormRequest.php +++ b/app/Http/Requests/UserFormRequest.php @@ -102,6 +102,8 @@ abstract class UserFormRequest extends \Illuminate\Foundation\Http\FormRequest 'properties.*.use_am_pm' => 'boolean|nullable', 'properties.*.date_range' => 'boolean|nullable', 'properties.*.prefill_today' => 'boolean|nullable', + 'properties.*.disable_past_dates' => 'boolean|nullable', + 'properties.*.disable_future_dates' => 'boolean|nullable', // Select / Multi Select field 'properties.*.allow_creation' => 'boolean|nullable', diff --git a/app/Mail/Forms/SubmissionConfirmationMail.php b/app/Mail/Forms/SubmissionConfirmationMail.php index 5305b66..933122f 100644 --- a/app/Mail/Forms/SubmissionConfirmationMail.php +++ b/app/Mail/Forms/SubmissionConfirmationMail.php @@ -42,6 +42,7 @@ class SubmissionConfirmationMail extends OpenFormMail implements ShouldQueue ->markdown('mail.form.confirmation-submission-notification',[ 'fields' => $formatter->getFieldsWithValue(), 'form' => $form, + 'noBranding' => $form->no_branding ]); } diff --git a/app/Rules/FormPropertyLogicRule.php b/app/Rules/FormPropertyLogicRule.php index 8e8f84a..1c3ed40 100644 --- a/app/Rules/FormPropertyLogicRule.php +++ b/app/Rules/FormPropertyLogicRule.php @@ -490,7 +490,7 @@ class FormPropertyLogicRule implements Rule, DataAwareRule if (is_array($conditions) && count($conditions) > 0) { foreach($conditions as $val){ if (!in_array($val, static::ACTIONS_VALUES) || - (in_array($this->field["type"], ['nf-text', 'nf-page-break', 'nf-divider', 'nf-image']) && !in_array($val, ['hide-block'])) || + (in_array($this->field["type"], ['nf-text', 'nf-code', 'nf-page-break', 'nf-divider', 'nf-image']) && !in_array($val, ['hide-block'])) || (isset($this->field["hidden"]) && $this->field["hidden"] && !in_array($val, ['show-block', 'require-answer'])) || (isset($this->field["required"]) && $this->field["required"] && !in_array($val, ['make-it-optional', 'hide-block'])) ) { diff --git a/resources/js/components/common/Button.vue b/resources/js/components/common/Button.vue index c1fdca4..0738851 100644 --- a/resources/js/components/common/Button.vue +++ b/resources/js/components/common/Button.vue @@ -1,6 +1,6 @@