diff --git a/app/Http/Controllers/FormController.php b/app/Http/Controllers/FormController.php index 7c5028d..ee950cf 100644 --- a/app/Http/Controllers/FormController.php +++ b/app/Http/Controllers/FormController.php @@ -20,7 +20,7 @@ class FormController extends Controller $publishedForms = Form::where('is_published', true)->count(); $totalResponses = Response::count(); - $forms = Form::where('user_id', Auth::id())->get(); + $forms = Form::where('user_id', Auth::id())->orderBy('created_at', 'desc')->get(); return view('forms.index', [ 'forms' => $forms, 'totalForms' => $totalForms, @@ -54,6 +54,55 @@ class FormController extends Controller } + public function createWithTemplate($template) +{ + $data = []; + + switch ($template) { + case 'contact': + $data = [ + 'title' => 'Contact Information', + 'description' => 'Template for collecting contact information.', + 'questions' => [ + ['type' => 'text', 'question_text' => 'Name'], + ['type' => 'text', 'question_text' => 'Email'], + // Add more questions as needed + ], + ]; + break; + + case 'rsvp': + $data = [ + 'title' => 'RSVP', + 'description' => 'Event Address: 123 Your Street Your City, ST 12345 +Contact us at (123) 456-7890 or no_reply@example.com +', + 'questions' => [ + ['type' => 'text', 'question_text' => 'Can you attend?'], + ['type' => 'text', 'question_text' => 'Number of Guests'], + // Add more questions as needed + ], + ]; + break; + + case 'party': + $data = [ + 'title' => 'Party Invite', + 'description' => 'Template for party invitations.', + 'questions' => [ + ['type' => 'text', 'question_text' => 'Name'], + ['type' => 'text', 'question_text' => 'RSVP Status'], + // Add more questions as needed + ], + ]; + break; + } + + return view('forms.create', ['data' => $data]); +} + + + public function store(Request $request) { diff --git a/app/Http/Controllers/ResponseController.php b/app/Http/Controllers/ResponseController.php index 94c5fe2..88e154c 100644 --- a/app/Http/Controllers/ResponseController.php +++ b/app/Http/Controllers/ResponseController.php @@ -21,6 +21,12 @@ class ResponseController extends Controller return view('responses.index', compact('form', 'responses')); } + public function showSuccess(Form $form) +{ + return view('responses.success', compact('form')); +} + + // Display a specific response public function viewResponse(Form $form, $responseId) { diff --git a/public/images/add.png b/public/images/add.png index 3d0b46f..8b5f3cd 100644 Binary files a/public/images/add.png and b/public/images/add.png differ diff --git a/public/images/bin.png b/public/images/bin.png index 81e7c49..1a51853 100644 Binary files a/public/images/bin.png and b/public/images/bin.png differ diff --git a/resources/views/forms/create.blade.php b/resources/views/forms/create.blade.php index bbee8e6..716bc8a 100644 --- a/resources/views/forms/create.blade.php +++ b/resources/views/forms/create.blade.php @@ -48,8 +48,8 @@
Use this template to create a contact information form.
+ + +Use this template to create an RSVP form for events.
+ + +Use this template to create a party invite form.
+ +No forms available.
+ @else +Form Title | +Created At | +Responses | +Status | ++ | + |
---|---|---|---|---|---|
+ {{ $form->title }}
+ {{ $form->description }} + |
+ {{ $form->created_at->format('M d, Y') }} | ++ View Responses + | ++ @if ($form->is_published) + Published + @else + Unpublished + @endif + | ++ @if (!$form->is_published) + Edit + @else + Edit + @endif + | ++ + | +