Browse Source

240624-0822-Kim

hokky 5 months ago
parent
commit
85ad4cf076

+ 5 - 2
pro/app/Http/Controllers/Page/SiseController.php

@@ -16,7 +16,7 @@ class SiseController extends Controller
         $this->callApiService = $callApiService;
     }
 
-    public function index($siseType, $area=null)
+    public function index($siseType, $area=null, $memberbershipname=null)
     {
 
         // siseType별로 title 변수 생성
@@ -40,6 +40,9 @@ class SiseController extends Controller
                 $query .= " and pc2='$area'";
             }
         }
+        if($memberbershipname){
+            $query .= " and postTitle like '%$memberbershipname%'";
+        }
         // dd($query);
         $limit = (int)request('limit', 12);
         $page = (int)request('page', 1);
@@ -85,7 +88,7 @@ class SiseController extends Controller
             ['path' => request()->url()]
         );
 
-        return view('views.page.sise', compact('siseList', 'siseItems', 'title', "title_dir", "siseType"));
+        return view('views.page.sise', compact('siseList', 'siseItems', 'title', "title_dir", "siseType", "area"));
     }
 
 }

+ 19 - 7
pro/resources/views/page/sise.blade.php

@@ -2,11 +2,9 @@
 @section('content')
 
 @php
-
     //var_dump($siseList['Page']);
     //var_dump($siseItems)
-
-
+    var_dump($area);
 @endphp
 <div class="sub golf">
 	<div class="container">
@@ -22,8 +20,8 @@
 	<div class="search_ticket">
 		<div class="container">
 			<label>회원권 검색</label>
-			<input type="text" placeholder="회원권명">
-			<button type="button" class="btn">검색</button>
+			<input type="text" id="membership-name" placeholder="회원권명">
+			<button type="button" class="btn" onclick="searchMemberShip()">검색</button>
 		</div>
 	</div>
 	<!--// 회원권 검색 끝 -->
@@ -103,11 +101,25 @@
 @push('js')
 <script>
     $(document).ready(function() {
-
+        console.log('siseList : ', siseList);
         if ($('div').hasClass('chatbot') == true) {
             $('.main-footer').addClass('chatbot');
         }
-});
+    });
+
+    function searchMemberShip(){
+        var membershipName = document.getElementById('membership-name').value;
+        console.log('membership-name : ', membershipName)
+        // var siseType = '{{ $siseType} }';
+        // var area = '{{ $area} }';
+
+        if (membershipName) {
+            window.location.href = `{{ route('sise', ['${siseType}', '${membershipName}']) }}`;
+        } else {
+            alert('회원권명을 입력해주세요.');
+        }
+    }
+const siseList = {!! json_encode($siseList['Page']) !!}; // JavaScript에서 PHP 배열을 변환하여 변수에 할당
 </script>
 @endpush
 @endsection

+ 2 - 1
pro/routes/web.php

@@ -350,7 +350,8 @@ Route::middleware(['check.device.scale', 'check.gate.token'])->group(function ()
         });
     });
 
-    Route::get('/sise/{sisetype}/{area?}', [SiseController::class, 'index'])->name('sise');
+    // Route::get('/sise/{sisetype}/{area?}', [SiseController::class, 'index'])->name('sise');
+    Route::get('/sise/{sisetype}/{area?}/{memberbershipname?}', [SiseController::class, 'index'])->name('sise');
 
     Route::get('/contactus-custom/{sisetype?}/{postTitle?}', function($siseType = null, $postTitle = null) {
         return view('views.page.contactus-custom', [