From 62edca53359633858db7ceaf20342ee0f05d61e6 Mon Sep 17 00:00:00 2001 From: Juan Pablo Vial Date: Tue, 23 Jan 2024 20:41:52 -0300 Subject: [PATCH] Simplify set post or query --- app/resources/views/search.blade.php | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/app/resources/views/search.blade.php b/app/resources/views/search.blade.php index a1edf69..7bd41b6 100644 --- a/app/resources/views/search.blade.php +++ b/app/resources/views/search.blade.php @@ -309,17 +309,23 @@ } } }, + set: function() { + return { + query: value => { + $("[name='query']").val(value) + this.get().results() + } + } + }, setup: function(id) { this.id = id this.get().results() $('#tipo').dropdown().dropdown('set selected', '*') @if (trim($post) !== '') - $("[name='query']").val('{!! $post !!}') - this.get().results() + this.set().query('{!! $post !!}') @elseif (trim($query) !== '') - $("[name='query']").val('{!! $query !!}') - this.get().results() + this.set().query('{!! $query !!}') @endif @if (trim($tipo) !== '') $('#tipo').dropdown('set selected', '{{$tipo}}')