diff --git a/app/Http/Requests/Project/StoreRequest.php b/app/Http/Requests/Project/StoreRequest.php
index 2c8d9bc5..8bb42f41 100644
--- a/app/Http/Requests/Project/StoreRequest.php
+++ b/app/Http/Requests/Project/StoreRequest.php
@@ -40,9 +40,11 @@ public function rules(): array
'accepting_volunteers' => ['boolean', 'nullable'],
'accepting_comments' => ['boolean', 'nullable'],
'videos' => ['nullable', 'array'],
- 'videos.*' => ['nullable', 'url'],
+ 'videos.*.url' => ['required', 'url'],
'external_links' => ['nullable', 'array'],
- 'external_links.*' => ['nullable', 'url'],
+ 'external_links.*.title' => ['required', 'string'],
+ 'external_links.*.url' => ['required', 'url'],
+
'is_national' => ['boolean', 'nullable'],
'gallery' => ['array', 'nullable'],
'gallery.*.file' => ['file', 'nullable'],
diff --git a/app/Services/ProjectService.php b/app/Services/ProjectService.php
index dd692594..a9eb2b0f 100644
--- a/app/Services/ProjectService.php
+++ b/app/Services/ProjectService.php
@@ -37,12 +37,10 @@ public function create(array $data): Project|RegionalProject
if (! empty($data['counties'])) {
$project->counties()->attach($data['counties']);
}
- if (!empty($data['preview']))
- {
+ if (! empty($data['preview'])) {
$project->addMedia($data['preview'])->toMediaCollection('preview');
}
- if (!empty($data['gallery']))
- {
+ if (! empty($data['gallery'])) {
collect($data['gallery'])->map(function ($image) use ($project) {
$project->addMedia($image)->toMediaCollection('gallery');
});
@@ -109,6 +107,7 @@ public static function update(Project $project, array $attributes)
'counties' => $project->counties()->sync($value),
'categories' => $project->categories()->sync($value),
'image' => $project->addMedia($value)->toMediaCollection('preview'),
+ 'gallery' => collect($value)->map(fn ($image) => $project->addMedia($image)->toMediaCollection('gallery')),
default => ($project->status === ProjectStatus::approved && \in_array($key, $project->requiresApproval))
? $project->fill($attributes->all())->saveForApproval()
diff --git a/lang/ro.json b/lang/ro.json
index b5218dce..60269900 100644
--- a/lang/ro.json
+++ b/lang/ro.json
@@ -450,7 +450,13 @@
"projects.status.starting_soon" : "Incepe in curand",
"projects.status.ending_soon" : "Se incheie in curand",
- "project.labels.preview_image": "Imagine de prezentare"
+ "project.labels.preview_image": "Imagine de prezentare",
+ "project.labels.videos" : "Videoclipuri externe ale proiectului",
+ "project.labels.videos_extra" : "Aici puteti adauga link-uri de pe diverse platforme de streaming (youtube, vimeo, etc.)",
+
+ "project.labels.external_links_title": "Titlu link extern",
+ "project.labels.external_links_url": "URL link extern"
+
diff --git a/lang/ro/validation.php b/lang/ro/validation.php
index 007b6f4c..85a43c97 100644
--- a/lang/ro/validation.php
+++ b/lang/ro/validation.php
@@ -223,5 +223,10 @@
'categories' => 'Categorii',
'counties' => 'Județe',
'preview' => 'Imaginea principala',
+ 'external_links.*.title' => 'Titlu link extern',
+ 'external_links.*.url' => 'URL link extern',
+
+ 'videos.*.url' => 'link video',
+
],
];
diff --git a/resources/js/Pages/AdminOng/Projects/AddProject.vue b/resources/js/Pages/AdminOng/Projects/AddProject.vue
index 1644125c..5ea8aa2e 100644
--- a/resources/js/Pages/AdminOng/Projects/AddProject.vue
+++ b/resources/js/Pages/AdminOng/Projects/AddProject.vue
@@ -142,82 +142,84 @@
{{ $t('project.labels.videos') }}
+{{ $t('project.labels.videos_extra') }}
+{{ $t('external_links_title') }}
{{ $t('external_links_text') }}