File input new design (#246)

Co-authored-by: Julien Nahum <julien@nahum.net>
This commit is contained in:
formsdev
2023-11-28 16:01:57 +05:30
committed by GitHub
parent 730bdd1b1f
commit 57fdfb25a0
4 changed files with 218 additions and 203 deletions

View File

@@ -8,6 +8,7 @@ use App\Http\Controllers\Forms\FormController;
use App\Http\Requests\AnswerFormRequest;
use App\Models\Forms\Form;
use App\Models\Forms\FormSubmission;
use App\Service\Forms\FormLogicPropertyResolver;
use App\Service\Storage\StorageFileNameParser;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Filesystem\Filesystem;
@@ -224,8 +225,10 @@ class StoreFormSubmissionJob implements ShouldQueue
collect($this->form->properties)->filter(function ($property) {
return isset($property['hidden'])
&& isset($property['prefill'])
&& $property['hidden']
&& !is_null($property['prefill']);
&& FormLogicPropertyResolver::isHidden($property, $this->submissionData)
&& !is_null($property['prefill'])
&& !in_array($property['type'], ['files'])
&& !($property['type'] == 'url' && isset($property['file_upload']) && $property['file_upload']);
})->each(function (array $property) use (&$formData) {
if ($property['type'] === 'date' && isset($property['prefill_today']) && $property['prefill_today']) {
$formData[$property['id']] = now()->format((isset($property['with_time']) && $property['with_time']) ? 'Y-m-d H:i' : 'Y-m-d');