forked from thephpleague/config
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request thephpleague#7 from BryanGuapulema/surveysView
Surveys view
- Loading branch information
Showing
11 changed files
with
201 additions
and
57 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
<x-app-layout> | ||
<x-slot name="header"> | ||
<h2 class="font-semibold text-xl text-gray-800 leading-tight"> | ||
Encuesta Creada | ||
</h2> | ||
</x-slot> | ||
|
||
<div class="py-6"> | ||
<div class="max-w-7xl mx-auto sm:px-6 lg:px-8"> | ||
<div class="bg-white overflow-hidden shadow-sm sm:rounded-lg"> | ||
<div class="p-6 text-gray-900"> | ||
<h3 class="text-lg font-semibold mb-4">¡Tu encuesta ha sido creada!</h3> | ||
<p>Comparte este enlace con tus estudiantes para que respondan la encuesta:</p> | ||
<div class="mt-4 bg-gray-100 p-4 rounded-md flex justify-between items-center"> | ||
<a href="{{ url('/survey/' . $survey->uuid) }}" id="survey-link" | ||
class="text-blue-600 underline flex-1 mr-4"> | ||
{{ url('/survey/' . $survey->uuid) }} | ||
</a> | ||
<!-- Botón para copiar la URL --> | ||
<button id="copy-button" | ||
class="ml-4 text-white bg-indigo-600 px-4 py-2 rounded-md hover:bg-indigo-500 focus:outline-none"> | ||
Copiar | ||
</button> | ||
|
||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
|
||
<script> | ||
document.getElementById('copy-button').addEventListener('click', function() { | ||
const url = document.getElementById('survey-link').textContent; | ||
navigator.clipboard.writeText(url).then(function() { | ||
alert('URL copiada al portapapeles'); | ||
}).catch(function(error) { | ||
alert('Error al copiar la URL: ' + error); | ||
}); | ||
}); | ||
</script> | ||
</x-app-layout> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
<x-app-layout> | ||
<x-slot name="header"> | ||
<h2 class="font-semibold text-xl text-gray-800 leading-tight"> | ||
{{ __('Mis Encuestas') }} | ||
</h2> | ||
</x-slot> | ||
|
||
<div class="py-6"> | ||
<div class="max-w-7xl mx-auto sm:px-6 lg:px-8"> | ||
<div class="bg-white overflow-hidden shadow-sm sm:rounded-lg"> | ||
<div class="p-6 bg-white border-b border-gray-200"> | ||
<div class="flex justify-between items-center mb-4"> | ||
<h3 class="text-lg font-semibold">Encuestas Creadas</h3> | ||
<a href="{{ route('surveys.create') }}" class="bg-blue-500 hover:bg-blue-600 text-white font-bold py-2 px-4 rounded"> | ||
Crear Nueva Encuesta | ||
</a> | ||
</div> | ||
|
||
<table class="min-w-full border border-gray-300"> | ||
<thead> | ||
<tr class="bg-gray-100"> | ||
<th class="px-4 py-2 border-b text-left">Título</th> | ||
<th class="px-4 py-2 border-b text-left">Link</th> | ||
<th class="px-4 py-2 border-b text-center">Acciones</th> | ||
</tr> | ||
</thead> | ||
<tbody> | ||
@forelse ($surveys as $survey) | ||
<tr> | ||
<td class="px-4 py-2 border-b">{{ $survey->title }}</td> | ||
<td class="px-4 py-2 border-b">{{ url('/survey/' . $survey->uuid) }}</td> | ||
<td class="px-4 py-2 border-b text-center"> | ||
<a href="{{ route('surveys.show', $survey->id) }}" class="rounded-md bg-cyan-600 px-3 py-2 text-center text-sm font-semibold text-white shadow-sm hover:bg-cyan-500 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-cyan-600">Ver</a> | ||
<form action="{{ route('surveys.destroy', $survey->id) }}" method="POST" class="inline"> | ||
@csrf | ||
@method('DELETE') | ||
<button type="submit" class=" rounded-md bg-red-600 px-3 py-2 text-center text-sm font-semibold text-white shadow-sm hover:bg-red-500 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-red-600" onclick="return confirm('¿Estás seguro de que deseas eliminar esta encuesta?')">Eliminar</button> | ||
</form> | ||
</td> | ||
</tr> | ||
@empty | ||
<tr> | ||
<td colspan="3" class="text-center py-4 text-gray-500"> | ||
No has creado encuestas aún. | ||
</td> | ||
</tr> | ||
@endforelse | ||
</tbody> | ||
</table> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
</x-app-layout> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,41 +1,35 @@ | ||
<x-app-layout> | ||
|
||
<x-slot name="header"> | ||
<h2 class="font-semibold text-xl text-gray-800 leading-tight"> | ||
Encuesta Creada | ||
Respuestas de la Encuesta | ||
</h2> | ||
</x-slot> | ||
|
||
<div class="py-6"> | ||
<div class="py-12"> | ||
<div class="max-w-7xl mx-auto sm:px-6 lg:px-8"> | ||
<div class="bg-white overflow-hidden shadow-sm sm:rounded-lg"> | ||
<div class="p-6 text-gray-900"> | ||
<h3 class="text-lg font-semibold mb-4">¡Tu encuesta ha sido creada!</h3> | ||
<p>Comparte este enlace con tus estudiantes para que respondan la encuesta:</p> | ||
<div class="mt-4 bg-gray-100 p-4 rounded-md flex justify-between items-center"> | ||
<a href="{{ url('/survey/' . $survey->uuid) }}" id="survey-link" | ||
class="text-blue-600 underline flex-1 mr-4"> | ||
{{ url('/survey/' . $survey->uuid) }} | ||
</a> | ||
<!-- Botón para copiar la URL --> | ||
<button id="copy-button" | ||
class="ml-4 text-white bg-indigo-600 px-4 py-2 rounded-md hover:bg-indigo-500 focus:outline-none"> | ||
Copiar | ||
</button> | ||
|
||
<div class="bg-white overflow-hidden shadow-xl sm:rounded-lg p-6"> | ||
<h3 class="text-lg font-bold mb-4">Resultados de la Encuesta: {{ $survey->title }}</h3> | ||
|
||
@foreach ($questions as $index => $question) | ||
<div class="mb-8"> | ||
<label class="block text-gray-700 font-semibold mb-2">{{ $index + 1 }}. {{ $question['question'] }}</label> | ||
|
||
<div class="space-y-2"> | ||
@foreach ($responses as $response) | ||
<div class="flex items-center p-4 bg-gray-50 border border-gray-200 rounded-md shadow-sm"> | ||
<span class="text-gray-600">{{ $response[$index] ?? 'No respondida' }}</span> | ||
</div> | ||
@endforeach | ||
</div> | ||
</div> | ||
</div> | ||
@endforeach | ||
|
||
<a href="{{ route('surveys.index') }}" class="mt-4 inline-block px-4 py-2 bg-blue-500 text-white rounded hover:bg-blue-700"> | ||
Volver a Encuestas | ||
</a> | ||
</div> | ||
</div> | ||
</div> | ||
|
||
<script> | ||
document.getElementById('copy-button').addEventListener('click', function() { | ||
const url = document.getElementById('survey-link').textContent; | ||
navigator.clipboard.writeText(url).then(function() { | ||
alert('URL copiada al portapapeles'); | ||
}).catch(function(error) { | ||
alert('Error al copiar la URL: ' + error); | ||
}); | ||
}); | ||
</script> | ||
</x-app-layout> |
Oops, something went wrong.