From a90827365b2e889e0472c20c828754e0124c7c3b Mon Sep 17 00:00:00 2001 From: Ale Date: Wed, 1 Sep 2021 19:22:40 -0300 Subject: [PATCH] se eliminan los horario-container clickeando en la x --- app/Http/Controllers/EventoController.php | 2 +- public/css/edit.css | 23 +++++++++++++++++++++ public/js/edit.js | 25 +++++++++++++---------- resources/views/edit.blade.php | 20 +++++++++++++++--- routes/web.php | 2 ++ 5 files changed, 57 insertions(+), 15 deletions(-) diff --git a/app/Http/Controllers/EventoController.php b/app/Http/Controllers/EventoController.php index acdb007..ee919e9 100644 --- a/app/Http/Controllers/EventoController.php +++ b/app/Http/Controllers/EventoController.php @@ -75,7 +75,7 @@ class EventoController extends Controller */ public function update(Request $request, Evento $evento) { - // + dd($request); } /** diff --git a/public/css/edit.css b/public/css/edit.css index 69be13a..c949f65 100644 --- a/public/css/edit.css +++ b/public/css/edit.css @@ -22,4 +22,27 @@ input.formulario.dia { .horario-container { margin-bottom: 30px; + display: -webkit-inline-box; + text-align: center; + display: flex; +} + +.columna1 { + width: -webkit-fill-available; +} + +.columna2 { + width: 20%; + position: relative; +} + +button.cerrar { + width: 40px; + height: 40px; + margin: 0; + position: absolute; + top: 50%; + -ms-transform: translateY(-50%); + transform: translateY(-50%); + right: 0%; } diff --git a/public/js/edit.js b/public/js/edit.js index 409ca63..ee8cf07 100644 --- a/public/js/edit.js +++ b/public/js/edit.js @@ -9,18 +9,21 @@ function copiarEnlace() { document.execCommand("copy"); alert("ok"); } -const HORARIO_CONTAINER = '
\n' + - ' \n' + - '
\n' + - ' \n' + - ' \n' + - '
\n' + - '
'; -function agregarHorarioContainer() { - $('#horarios').append(HORARIO_CONTAINER); -} +let HORARIO_CONTAINER = null; $( document ).ready(function() { - agregarHorarioContainer(); + HORARIO_CONTAINER = $(".horario-container"); }); + +function agregarHorarioContainer() { + var aux = HORARIO_CONTAINER.clone(); + aux.find("input").each(function () { + $(this).val(null); + }); + $('#horarios').append(aux); +} + +function borrarHorarioContainer(event) { + event.target.closest(".horario-container").remove(); +} diff --git a/resources/views/edit.blade.php b/resources/views/edit.blade.php index d9fdebc..0dec3de 100644 --- a/resources/views/edit.blade.php +++ b/resources/views/edit.blade.php @@ -57,8 +57,22 @@
-
- + + @csrf +
+
+ +
+
+ + +
+
+
+
+ +
+
@@ -67,7 +81,7 @@
- +
diff --git a/routes/web.php b/routes/web.php index 307383b..34681dc 100644 --- a/routes/web.php +++ b/routes/web.php @@ -21,3 +21,5 @@ Route::get('/', function () { Route::post('/eventos',[EventoController::class, 'store'])->name('store'); Route::get('/eventos/{evento}',[EventoController::class, 'edit'])->name('edit'); + +Route::post('/eventos/{evento}', [EventoController::class, 'update'])->name('update');