diff --git a/app/Jobs/Form/StoreFormSubmissionJob.php b/app/Jobs/Form/StoreFormSubmissionJob.php index 0c4e526..8361f04 100644 --- a/app/Jobs/Form/StoreFormSubmissionJob.php +++ b/app/Jobs/Form/StoreFormSubmissionJob.php @@ -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'); diff --git a/resources/js/components/forms/FileInput.vue b/resources/js/components/forms/FileInput.vue index d7ffbd2..0b041e6 100644 --- a/resources/js/components/forms/FileInput.vue +++ b/resources/js/components/forms/FileInput.vue @@ -1,168 +1,98 @@ + + - - - -

- Upload {{ multiple ? 'file(s)' : 'a file' }} -

- -
-
-
-
-
- -

- Uploading your file... -

-
- -
-
-
-
-

- {{ file.file.name }} -

- -
-
-
-
-
-
-
diff --git a/resources/js/config/form-themes.js b/resources/js/config/form-themes.js index 1e4a15e..56c761e 100644 --- a/resources/js/config/form-themes.js +++ b/resources/js/config/form-themes.js @@ -31,6 +31,14 @@ export const themes = { button: 'cursor-pointer text-gray-700 inline-block rounded-lg border-gray-300 px-4 py-2 flex-grow dark:bg-notion-dark-light dark:text-gray-300 text-center', unselectedButton: 'bg-white hover:bg-gray-50 border', help: 'text-gray-400 dark:text-gray-500' + }, + fileInput: { + input: 'min-h-40 border border-dashed border-gray-300 p-4 rounded-lg', + inputHover: { + light: 'bg-neutral-50', + dark: 'bg-notion-dark-light' + }, + uploadedFile: 'border border-gray-300 dark:border-gray-600 bg-white dark:bg-notion-dark-light rounded-lg shadow-sm max-w-[10rem]' } }, simple: { @@ -62,6 +70,14 @@ export const themes = { button: 'flex-1 appearance-none border-gray-300 dark:border-gray-600 w-full py-2 px-2 bg-gray-50 text-gray-700 dark:bg-notion-dark-light dark:text-gray-300 text-center', unselectedButton: 'bg-white hover:bg-gray-50 border -mx-4', help: 'text-gray-400 dark:text-gray-500' + }, + fileInput: { + input: 'min-h-40 border border-dashed border-gray-300 p-4', + inputHover: { + light: 'bg-neutral-50', + dark: 'bg-notion-dark-light' + }, + uploadedFile: 'border border-gray-300 dark:border-gray-600 bg-white dark:bg-notion-dark-light shadow-sm max-w-[10rem]' } }, notion: { @@ -93,6 +109,14 @@ export const themes = { button: 'rounded border-transparent flex-1 appearance-none shadow-inner-notion w-full py-2 px-2 bg-notion-input-background dark:bg-notion-dark-light text-gray-900 dark:text-gray-100 text-center', unselectedButton: 'bg-notion-input-background dark:bg-notion-dark-light hover:bg-gray-50 border', help: 'text-notion-input-help dark:text-gray-500' + }, + fileInput: { + input: 'min-h-40 border border-dashed border-gray-300 p-4 rounded bg-notion-input-background', + inputHover: { + light: 'bg-neutral-50', + dark: 'bg-notion-dark-light' + }, + uploadedFile: 'border border-gray-300 dark:border-gray-600 bg-white dark:bg-notion-dark-light rounded shadow-sm max-w-[10rem]' } }