This commit is contained in:
2025-10-07 18:35:31 +02:00
parent 1bc3056c77
commit 5c98259148
21 changed files with 1237 additions and 99 deletions
@@ -0,0 +1,196 @@
<?php
namespace App\Http\Controllers;
use App\Models\PageContent;
use Illuminate\Http\Request;
use Illuminate\Http\JsonResponse;
use Illuminate\Validation\ValidationException;
class PageContentController extends Controller
{
/**
* Display a listing of the resource.
*/
public function index(): JsonResponse
{
try {
$content = PageContent::all();
return response()->json($content);
} catch (\Exception $e) {
return response()->json([
'message' => 'Pagina-inhoud ophalen mislukt',
'error' => $e->getMessage()
], 500);
}
}
/**
* Store a newly created resource in storage.
*/
public function store(Request $request): JsonResponse
{
try {
$validated = $request->validate([
'key' => 'required|string|max:255|unique:page_content,key',
'value' => 'required|string',
'description' => 'nullable|string',
], [
'key.required' => 'Sleutel is verplicht',
'key.unique' => 'Deze sleutel bestaat al',
'key.max' => 'Sleutel mag maximaal 255 karakters bevatten',
'value.required' => 'Waarde is verplicht',
]);
$content = PageContent::create($validated);
return response()->json($content, 201);
} catch (ValidationException $e) {
return response()->json([
'message' => 'Validatie mislukt',
'errors' => $e->errors()
], 422);
} catch (\Exception $e) {
return response()->json([
'message' => 'Pagina-inhoud aanmaken mislukt',
'error' => $e->getMessage()
], 500);
}
}
/**
* Display the specified resource.
*/
public function show(PageContent $pageContent): JsonResponse
{
try {
return response()->json($pageContent);
} catch (\Exception $e) {
return response()->json([
'message' => 'Pagina-inhoud ophalen mislukt',
'error' => $e->getMessage()
], 500);
}
}
/**
* Update the specified resource in storage.
*/
public function update(Request $request, PageContent $pageContent): JsonResponse
{
try {
$validated = $request->validate([
'value' => 'required|string',
'description' => 'nullable|string',
], [
'value.required' => 'Waarde is verplicht',
]);
$pageContent->update($validated);
return response()->json($pageContent);
} catch (ValidationException $e) {
return response()->json([
'message' => 'Validatie mislukt',
'errors' => $e->errors()
], 422);
} catch (\Exception $e) {
return response()->json([
'message' => 'Pagina-inhoud bijwerken mislukt',
'error' => $e->getMessage()
], 500);
}
}
/**
* Remove the specified resource from storage.
*/
public function destroy(PageContent $pageContent): JsonResponse
{
try {
$pageContent->delete();
return response()->json([
'message' => 'Pagina-inhoud succesvol verwijderd'
]);
} catch (\Exception $e) {
return response()->json([
'message' => 'Pagina-inhoud verwijderen mislukt',
'error' => $e->getMessage()
], 500);
}
}
/**
* Get a specific content by key
*/
public function getByKey(string $key): JsonResponse
{
try {
$content = PageContent::where('key', $key)->first();
if (!$content) {
return response()->json([
'message' => 'Pagina-inhoud niet gevonden'
], 404);
}
return response()->json($content);
} catch (\Exception $e) {
return response()->json([
'message' => 'Pagina-inhoud ophalen mislukt',
'error' => $e->getMessage()
], 500);
}
}
/**
* Update or create content by key
*/
public function updateByKey(Request $request, string $key): JsonResponse
{
try {
$validated = $request->validate([
'value' => 'required|string',
'description' => 'nullable|string',
], [
'value.required' => 'Waarde is verplicht',
]);
$content = PageContent::updateOrCreate(
['key' => $key],
[
'value' => $validated['value'],
'description' => $validated['description'] ?? null
]
);
return response()->json($content);
} catch (ValidationException $e) {
return response()->json([
'message' => 'Validatie mislukt',
'errors' => $e->errors()
], 422);
} catch (\Exception $e) {
return response()->json([
'message' => 'Pagina-inhoud bijwerken mislukt',
'error' => $e->getMessage()
], 500);
}
}
/**
* Get all content as key-value pairs for public access
*/
public function getPublicContent(): JsonResponse
{
try {
$content = PageContent::all()->pluck('value', 'key');
return response()->json($content);
} catch (\Exception $e) {
return response()->json([
'message' => 'Pagina-inhoud ophalen mislukt',
'error' => $e->getMessage()
], 500);
}
}
}
@@ -5,6 +5,7 @@ namespace App\Http\Controllers;
use App\Models\ServiceRequest;
use App\Models\Setting;
use App\Models\Communication;
use App\Mail\ServiceRequestNotification;
use Illuminate\Http\Request;
use Illuminate\Http\JsonResponse;
use Illuminate\Validation\ValidationException;
@@ -277,10 +278,11 @@ class ServiceRequestController extends Controller
{
try {
$adminEmail = Setting::getValue('admin_notification_email');
if ($adminEmail) {
// TODO: Implement actual email sending logic
// For now, we'll just log it
// Send email to admin
Mail::to($adminEmail)->send(new ServiceRequestNotification($serviceRequest));
Log::info('Notificatie e-mail verzonden naar beheerder', [
'service_request_id' => $serviceRequest->id,
'admin_email' => $adminEmail,
@@ -0,0 +1,55 @@
<?php
namespace App\Mail;
use App\Models\ServiceRequest;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Mail\Mailable;
use Illuminate\Mail\Mailables\Content;
use Illuminate\Mail\Mailables\Envelope;
use Illuminate\Queue\SerializesModels;
class ServiceRequestNotification extends Mailable
{
use Queueable, SerializesModels;
/**
* Create a new message instance.
*/
public function __construct(
public ServiceRequest $serviceRequest
) {
//
}
/**
* Get the message envelope.
*/
public function envelope(): Envelope
{
return new Envelope(
subject: 'Nieuwe Service Aanvraag - ' . $this->serviceRequest->name,
);
}
/**
* Get the message content definition.
*/
public function content(): Content
{
return new Content(
view: 'emails.service-request-notification',
);
}
/**
* Get the attachments for the message.
*
* @return array<int, \Illuminate\Mail\Mailables\Attachment>
*/
public function attachments(): array
{
return [];
}
}
+24
View File
@@ -0,0 +1,24 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class PageContent extends Model
{
use HasFactory;
protected $table = 'page_content';
protected $fillable = [
'key',
'value',
'description',
];
protected $casts = [
'created_at' => 'datetime',
'updated_at' => 'datetime',
];
}
@@ -0,0 +1,150 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('page_content', function (Blueprint $table) {
$table->id();
$table->string('key')->unique();
$table->text('value');
$table->string('description')->nullable();
$table->timestamps();
});
// Insert default content
DB::table('page_content')->insert([
// Home page - Hero section
[
'key' => 'home_hero_title',
'value' => '🚲 Welkom bij Fiets Service Centrum',
'description' => 'Home page hero title',
'created_at' => now(),
'updated_at' => now(),
],
[
'key' => 'home_hero_subtitle',
'value' => 'Professionele fietsreparatie en onderhoudsdiensten',
'description' => 'Home page hero subtitle',
'created_at' => now(),
'updated_at' => now(),
],
// Home page - Feature panels
[
'key' => 'home_feature_1_title',
'value' => '🔧 Deskundige Reparaties',
'description' => 'Home page feature 1 title',
'created_at' => now(),
'updated_at' => now(),
],
[
'key' => 'home_feature_1_text',
'value' => 'Professionele fietsmonteurs met jarenlange ervaring',
'description' => 'Home page feature 1 caption',
'created_at' => now(),
'updated_at' => now(),
],
[
'key' => 'home_feature_2_title',
'value' => '⚡ Snelle Service',
'description' => 'Home page feature 2 title',
'created_at' => now(),
'updated_at' => now(),
],
[
'key' => 'home_feature_2_text',
'value' => 'Snelle doorlooptijden voor de meeste reparaties',
'description' => 'Home page feature 2 caption',
'created_at' => now(),
'updated_at' => now(),
],
[
'key' => 'home_feature_3_title',
'value' => '💰 Eerlijke Prijzen',
'description' => 'Home page feature 3 title',
'created_at' => now(),
'updated_at' => now(),
],
[
'key' => 'home_feature_3_text',
'value' => 'Concurrerende tarieven zonder verborgen kosten',
'description' => 'Home page feature 3 caption',
'created_at' => now(),
'updated_at' => now(),
],
[
'key' => 'home_feature_4_title',
'value' => '📅 Eenvoudig Boeken',
'description' => 'Home page feature 4 title',
'created_at' => now(),
'updated_at' => now(),
],
[
'key' => 'home_feature_4_text',
'value' => 'Eenvoudig online boekingssysteem',
'description' => 'Home page feature 4 caption',
'created_at' => now(),
'updated_at' => now(),
],
// Home page - CTA section
[
'key' => 'home_cta_title',
'value' => 'Klaar om je fiets te laten repareren?',
'description' => 'Home page CTA title',
'created_at' => now(),
'updated_at' => now(),
],
[
'key' => 'home_cta_subtitle',
'value' => 'Boek je afspraak online en krijg je fiets weer in topconditie.',
'description' => 'Home page CTA subtitle',
'created_at' => now(),
'updated_at' => now(),
],
[
'key' => 'home_cta_button_1_text',
'value' => 'Nu Service Boeken',
'description' => 'Home page CTA button 1 text',
'created_at' => now(),
'updated_at' => now(),
],
[
'key' => 'home_cta_button_2_text',
'value' => '💰 Prijslijst Bekijken',
'description' => 'Home page CTA button 2 text',
'created_at' => now(),
'updated_at' => now(),
],
// Booking page
[
'key' => 'booking_header_title',
'value' => '🚲 Boek Je Fiets Service',
'description' => 'Booking page header title',
'created_at' => now(),
'updated_at' => now(),
],
[
'key' => 'booking_header_subtitle',
'value' => 'Vul het onderstaande formulier in om je fietsreparatie of onderhoud in te plannen',
'description' => 'Booking page header subtitle',
'created_at' => now(),
'updated_at' => now(),
],
]);
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('page_content');
}
};
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -0,0 +1,45 @@
<svg viewBox="0 0 600 250" xmlns="http://www.w3.org/2000/svg">
<!-- Main Logo Group -->
<g transform="translate(300, 125)">
<!-- Bike Icon -->
<g transform="translate(-180, -30)">
<!-- Rear wheel -->
<circle cx="40" cy="45" r="30" fill="none" stroke="#ffffff" stroke-width="5"/>
<circle cx="40" cy="45" r="20" fill="none" stroke="#ffffff" stroke-width="2" opacity="0.3"/>
<circle cx="40" cy="45" r="3" fill="#ffffff"/>
<!-- Front wheel -->
<circle cx="160" cy="45" r="30" fill="none" stroke="#ffffff" stroke-width="5"/>
<circle cx="160" cy="45" r="20" fill="none" stroke="#ffffff" stroke-width="2" opacity="0.3"/>
<circle cx="160" cy="45" r="3" fill="#ffffff"/>
<!-- Frame -->
<path d="M 40 45 L 100 45 L 130 5 M 100 45 L 160 45"
fill="none" stroke="#ffffff" stroke-width="5"
stroke-linejoin="round" stroke-linecap="round"/>
<!-- Seat post and seat -->
<path d="M 70 45 L 90 10" fill="none" stroke="#ffffff" stroke-width="5" stroke-linecap="round"/>
<ellipse cx="90" cy="5" rx="12" ry="5" fill="#f0d9b5"/>
<!-- Handlebars -->
<path d="M 130 5 L 145 5" fill="none" stroke="#ffffff" stroke-width="5" stroke-linecap="round"/>
<circle cx="128" cy="5" r="4" fill="#ffffff"/>
<!-- Pedal area -->
<circle cx="100" cy="45" r="8" fill="#f0d9b5"/>
<path d="M 95 50 L 105 50" fill="none" stroke="#ffffff" stroke-width="3" stroke-linecap="round"/>
</g>
<!-- Text -->
<text x="30" y="0" font-family="Arial, Helvetica, sans-serif" font-size="52" font-weight="bold" fill="#ffffff" letter-spacing="3">BIKE</text>
<text x="30" y="50" font-family="Arial, Helvetica, sans-serif" font-size="48" font-weight="600" fill="#f0d9b5" letter-spacing="2">SERVICE</text>
<!-- Accent lines -->
<line x1="-185" y1="68" x2="250" y2="68" stroke="#ffffff" stroke-width="3"/>
<line x1="-185" y1="72" x2="250" y2="72" stroke="#f0d9b5" stroke-width="1.5"/>
<!-- Tagline -->
<text x="32" y="100" font-family="Arial, Helvetica, sans-serif" font-size="16" font-style="italic" fill="#f0f0f0" letter-spacing="0.5">Jouw fiets, onze zorg</text>
</g>
</svg>

After

Width:  |  Height:  |  Size: 2.2 KiB

@@ -0,0 +1,48 @@
<svg viewBox="0 0 600 250" xmlns="http://www.w3.org/2000/svg">
<!-- White background for clean export -->
<rect width="600" height="250" fill="white"/>
<!-- Main Logo Group -->
<g transform="translate(300, 125)">
<!-- Bike Icon -->
<g transform="translate(-180, -30)">
<!-- Rear wheel -->
<circle cx="40" cy="45" r="30" fill="none" stroke="#2c5f5d" stroke-width="5"/>
<circle cx="40" cy="45" r="20" fill="none" stroke="#2c5f5d" stroke-width="2" opacity="0.3"/>
<circle cx="40" cy="45" r="3" fill="#2c5f5d"/>
<!-- Front wheel -->
<circle cx="160" cy="45" r="30" fill="none" stroke="#2c5f5d" stroke-width="5"/>
<circle cx="160" cy="45" r="20" fill="none" stroke="#2c5f5d" stroke-width="2" opacity="0.3"/>
<circle cx="160" cy="45" r="3" fill="#2c5f5d"/>
<!-- Frame -->
<path d="M 40 45 L 100 45 L 130 5 M 100 45 L 160 45"
fill="none" stroke="#2c5f5d" stroke-width="5"
stroke-linejoin="round" stroke-linecap="round"/>
<!-- Seat post and seat -->
<path d="M 70 45 L 90 10" fill="none" stroke="#2c5f5d" stroke-width="5" stroke-linecap="round"/>
<ellipse cx="90" cy="5" rx="12" ry="5" fill="#8b6f47"/>
<!-- Handlebars -->
<path d="M 130 5 L 145 5" fill="none" stroke="#2c5f5d" stroke-width="5" stroke-linecap="round"/>
<circle cx="128" cy="5" r="4" fill="#2c5f5d"/>
<!-- Pedal area -->
<circle cx="100" cy="45" r="8" fill="#8b6f47"/>
<path d="M 95 50 L 105 50" fill="none" stroke="#2c5f5d" stroke-width="3" stroke-linecap="round"/>
</g>
<!-- Text -->
<text x="30" y="0" font-family="Arial, Helvetica, sans-serif" font-size="52" font-weight="bold" fill="#2c5f5d" letter-spacing="3">BIKE</text>
<text x="30" y="50" font-family="Arial, Helvetica, sans-serif" font-size="48" font-weight="600" fill="#8b6f47" letter-spacing="2">SERVICE</text>
<!-- Accent lines -->
<line x1="-185" y1="68" x2="250" y2="68" stroke="#2c5f5d" stroke-width="3"/>
<line x1="-185" y1="72" x2="250" y2="72" stroke="#8b6f47" stroke-width="1.5"/>
<!-- Tagline -->
<text x="32" y="100" font-family="Arial, Helvetica, sans-serif" font-size="16" font-style="italic" fill="#666666" letter-spacing="0.5">Jouw fiets, onze zorg</text>
</g>
</svg>

After

Width:  |  Height:  |  Size: 2.3 KiB

+15
View File
@@ -0,0 +1,15 @@
<!DOCTYPE html>
<html lang="nl">
<head>
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/images/bikeservice_logo_primary.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="description" content="Professionele fietsreparatie en onderhoudsdiensten" />
<title>Bike Service - Jouw fiets, onze zorg</title>
<script type="module" crossorigin src="/assets/index-_eFKiDPi.js"></script>
<link rel="stylesheet" crossorigin href="/assets/index-Dg5tUgMl.css">
</head>
<body>
<div id="app"></div>
</body>
</html>
@@ -0,0 +1,115 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Nieuwe Service Aanvraag</title>
<style>
body {
font-family: Arial, Helvetica, sans-serif;
line-height: 1.6;
color: #333;
max-width: 600px;
margin: 0 auto;
padding: 20px;
}
.header {
background: linear-gradient(135deg, #2c5f5d 0%, #3d7a77 100%);
color: white;
padding: 20px;
border-radius: 8px 8px 0 0;
text-align: center;
}
.content {
background: #f8f9fa;
padding: 30px;
border-radius: 0 0 8px 8px;
}
.info-row {
margin-bottom: 15px;
padding: 10px;
background: white;
border-radius: 5px;
}
.label {
font-weight: bold;
color: #2c5f5d;
margin-bottom: 5px;
}
.value {
color: #666;
}
.footer {
text-align: center;
margin-top: 20px;
padding-top: 20px;
border-top: 1px solid #ddd;
color: #999;
font-size: 12px;
}
</style>
</head>
<body>
<div class="header">
<h1>🚲 Nieuwe Service Aanvraag</h1>
</div>
<div class="content">
<p>Er is een nieuwe service aanvraag ontvangen via de website:</p>
<div class="info-row">
<div class="label">Naam:</div>
<div class="value">{{ $serviceRequest->name }}</div>
</div>
<div class="info-row">
<div class="label">Adres:</div>
<div class="value">{{ $serviceRequest->address }}, {{ $serviceRequest->place }}</div>
</div>
@if($serviceRequest->email)
<div class="info-row">
<div class="label">E-mail:</div>
<div class="value">{{ $serviceRequest->email }}</div>
</div>
@endif
@if($serviceRequest->phone)
<div class="info-row">
<div class="label">Telefoon:</div>
<div class="value">{{ $serviceRequest->phone }}</div>
</div>
@endif
<div class="info-row">
<div class="label">Gewenste datum:</div>
<div class="value">{{ \Carbon\Carbon::parse($serviceRequest->requested_date)->format('d-m-Y') }} om {{ $serviceRequest->requested_time }}</div>
</div>
<div class="info-row">
<div class="label">Reparatie beschrijving:</div>
<div class="value">{{ $serviceRequest->repair_description }}</div>
</div>
<div class="info-row">
<div class="label">Status:</div>
<div class="value">{{ ucfirst($serviceRequest->status) }}</div>
</div>
<div class="info-row">
<div class="label">Aangemaakt op:</div>
<div class="value">{{ $serviceRequest->created_at->format('d-m-Y H:i') }}</div>
</div>
<p style="margin-top: 20px;">
<a href="{{ config('app.url') }}/admin" style="background-color: #2c5f5d; color: white; padding: 12px 24px; text-decoration: none; border-radius: 5px; display: inline-block;">
Bekijk in Admin Paneel
</a>
</p>
</div>
<div class="footer">
<p>Dit is een automatisch gegenereerde e-mail van uw Fiets Service systeem.</p>
</div>
</body>
</html>
+9
View File
@@ -7,6 +7,7 @@ use App\Http\Controllers\BlockedDateController;
use App\Http\Controllers\SettingController;
use App\Http\Controllers\AuthController;
use App\Http\Controllers\PricelistController;
use App\Http\Controllers\PageContentController;
/*
|--------------------------------------------------------------------------
@@ -31,6 +32,9 @@ Route::get('/public/blocked-dates', [BlockedDateController::class, 'publicIndex'
// Public service request creation (customers can submit requests)
Route::post('/public/service-requests', [ServiceRequestController::class, 'store']);
// Public page content (customers can view page text)
Route::get('/public/page-content', [PageContentController::class, 'getPublicContent']);
// Protected routes (require authentication)
Route::middleware('auth:sanctum')->group(function () {
Route::get('/user', function (Request $request) {
@@ -56,4 +60,9 @@ Route::middleware('auth:sanctum')->group(function () {
// Admin pricelist management
Route::get('/admin/pricelist', [PricelistController::class, 'adminIndex']);
Route::apiResource('pricelist', PricelistController::class)->except(['index']);
// Admin page content management
Route::apiResource('page-content', PageContentController::class);
Route::get('page-content/key/{key}', [PageContentController::class, 'getByKey']);
Route::put('page-content/key/{key}', [PageContentController::class, 'updateByKey']);
});