diff --git a/laravel_app/app/Livewire/Projects/ProjectManager.php b/laravel_app/app/Livewire/Projects/ProjectManager.php index ffeaf76..12e0ed8 100644 --- a/laravel_app/app/Livewire/Projects/ProjectManager.php +++ b/laravel_app/app/Livewire/Projects/ProjectManager.php @@ -214,7 +214,7 @@ private function validateForm() 'name' => $this->formData['name'], 'pivot_file' => $this->pivotFiles[0] ?? null, 'span_file' => $this->spanFiles[0] ?? null, - 'harvest_data_file' => $this->harvestDataFiles[0] ?? null, + 'harvest_file' => $this->harvestDataFiles[0] ?? null, 'boundingBoxes' => $this->formData['boundingBoxes'], ], [ 'name' => [ @@ -223,9 +223,17 @@ private function validateForm() 'string', 'max:255' ], - 'pivot_file' => ['sometimes'], - 'span_file' => ['sometimes'], - 'harvestDataFile' => ['sometimes',new HarvestFile], + 'pivot_file.extension' => ['sometimes',function ($attribute, $value, $fail) { + if($value != 'json'){ + $fail('Not a json file'); + } + }], + 'span_file' => ['sometimes',function ($attribute, $value, $fail) { + if($value != 'json'){ + $fail('Not a json file'); + } + }], + 'harvest_file' => ['sometimes',new HarvestFile], 'boundingBoxes' => ['required', 'array', 'min:1'], 'boundingBoxes.*.name' => ['required', 'string', 'max:255'], 'boundingBoxes.*.top_left_latitude' => ['required', 'string'], diff --git a/laravel_app/app/Rules/HarvestFile.php b/laravel_app/app/Rules/HarvestFile.php index 7b35310..d2ace6b 100644 --- a/laravel_app/app/Rules/HarvestFile.php +++ b/laravel_app/app/Rules/HarvestFile.php @@ -14,6 +14,7 @@ class HarvestFile implements ValidationRule */ public function validate(string $attribute, mixed $value, Closure $fail): void { - // + $extensions = ['']; + } } diff --git a/laravel_app/resources/views/components/project-manager-properties-modal.blade.php b/laravel_app/resources/views/components/project-manager-properties-modal.blade.php index bfa536b..0b31524 100644 --- a/laravel_app/resources/views/components/project-manager-properties-modal.blade.php +++ b/laravel_app/resources/views/components/project-manager-properties-modal.blade.php @@ -60,9 +60,9 @@ - @error('harvestDataFiles') + @error('harvest_file') {{ $message }} @enderror