diff --git a/app/Http/Controllers/RateCardController.php b/app/Http/Controllers/RateCardController.php index 4b899fd..fad71d8 100644 --- a/app/Http/Controllers/RateCardController.php +++ b/app/Http/Controllers/RateCardController.php @@ -103,7 +103,8 @@ class RateCardController extends Controller public function profilePage(): View { $profile = RateCardProfile::getSingleton(); - return view('rate-cards.profile', compact('profile')); + $mediaFiles = \App\Models\MediaFile::latest()->get(); + return view('rate-cards.profile', compact('profile', 'mediaFiles')); } public function profileUpdate(Request $request): RedirectResponse @@ -125,6 +126,11 @@ class RateCardController extends Controller 'brand_logo_size' => 'nullable|in:small,medium,large', 'contact_person_html' => 'nullable|string', 'logo' => 'nullable|image|max:2048', + 'content_showcase' => 'nullable|array', + 'content_showcase.*.file_id' => 'required_with:content_showcase|string', + 'content_showcase.*.name' => 'required_with:content_showcase|string|max:255', + 'content_showcase.*.url' => 'nullable|url', + 'content_showcase.*.thumbnail_path' => 'nullable|string', ]); $profile = RateCardProfile::getSingleton(); @@ -135,6 +141,7 @@ class RateCardController extends Controller } $validated['show_prices'] = $request->has('show_prices'); + $validated['content_showcase'] = $request->input('content_showcase', []); unset($validated['logo']); $profile->update($validated); @@ -221,6 +228,17 @@ class RateCardController extends Controller // ── PDF Download ───────────────────────────────────────────── + public function uploadShowcaseThumbnail(Request $request) + { + $request->validate(['thumbnail' => 'required|image|max:2048']); + $path = $request->file('thumbnail')->store('showcase', 'public'); + + return response()->json([ + 'path' => $path, + 'url' => asset('storage/' . $path) + ]); + } + public function pdf(): \Illuminate\Http\Response { $profile = RateCardProfile::getSingleton(); diff --git a/app/Models/RateCardProfile.php b/app/Models/RateCardProfile.php index 0d82120..1e368ae 100644 --- a/app/Models/RateCardProfile.php +++ b/app/Models/RateCardProfile.php @@ -17,11 +17,13 @@ class RateCardProfile extends Model 'past_brands', 'brand_logo_size', 'contact_person_html', + 'content_showcase', ]; protected $casts = [ 'show_prices' => 'boolean', 'past_brands' => 'array', + 'content_showcase' => 'array', ]; /** Get the singleton profile, creating defaults if needed */ diff --git a/database/migrations/2026_04_05_155627_add_content_showcase_to_rate_card_profiles_table.php b/database/migrations/2026_04_05_155627_add_content_showcase_to_rate_card_profiles_table.php new file mode 100644 index 0000000..248fc88 --- /dev/null +++ b/database/migrations/2026_04_05_155627_add_content_showcase_to_rate_card_profiles_table.php @@ -0,0 +1,22 @@ +json('content_showcase')->nullable(); + }); + } + + public function down(): void + { + Schema::table('rate_card_profiles', function (Blueprint $table) { + $table->dropColumn('content_showcase'); + }); + } +}; diff --git a/resources/views/rate-cards/pdf.blade.php b/resources/views/rate-cards/pdf.blade.php index f7bf8a3..688bad5 100644 --- a/resources/views/rate-cards/pdf.blade.php +++ b/resources/views/rate-cards/pdf.blade.php @@ -299,6 +299,52 @@ @endif + @if(!empty($profile->content_showcase)) +
+
+
Content Showcase
+
+ @foreach($profile->content_showcase as $item) + @php + $isUrl = ($item['file_id'] === 'url'); + $file = !$isUrl ? \App\Models\MediaFile::find($item['file_id']) : null; + @endphp + @if($file || $isUrl) +
+
+ @if(!empty($item['thumbnail_path']) && file_exists(storage_path('app/public/' . $item['thumbnail_path']))) + + + @if(!$isUrl && $file->is_video) +
+
▶
+
+ @endif +
+ @elseif(!$isUrl && $file->is_image && file_exists(storage_path('app/private/' . $file->path))) + + + + @else + + {{ $isUrl ? '🌐' : ($file->is_video ? '🎬' : '📁') }} + {{ $isUrl ? 'Open Link' : 'View File' }} + + @endif +
+
+
{{ $item['name'] }}
+
+ {{ $isUrl ? 'External Link' : ($file->is_video ? 'Video' : ($file->is_image ? 'Image' : 'Document')) }} +
+
+
+ @endif + @endforeach +
+
+ @endif + @if($profile->terms_and_conditions)
diff --git a/resources/views/rate-cards/profile.blade.php b/resources/views/rate-cards/profile.blade.php index eaf4200..1ba7818 100644 --- a/resources/views/rate-cards/profile.blade.php +++ b/resources/views/rate-cards/profile.blade.php @@ -84,52 +84,52 @@
+ async removeLogo() { + if (!confirm('Remove this logo?')) return; + const fd = new FormData(); + fd.append('_token', document.querySelector('meta[name=csrf-token]').content); + fd.append('_method', 'DELETE'); + await fetch('{{ route('rate-cards.profile.delete-logo', [], false) }}', { + method: 'POST', + body: fd, + headers: { 'Accept': 'application/json' } + }); + this.logoUrl = ''; + } + }">