public function filterTransaction() { $rType = Input::get('rType'); $sType = Input::get('sType'); $response = array(); if (empty($sType) && !empty($rType)) { $transactions = CottageReservation::where('reservation_type', '=', $rType)->get(); } elseif (!empty($sType) && !empty($rType)) { $transactions = CottageReservation::where('reservation_type', '=', $rType)->where('status', '=', $sType)->get(); } else { $transactions = CottageReservation::where('status', '=', $sType)->get(); } foreach ($transactions as $transaction) { $roomname = Room::where('rnid', '=', $transaction['room_id'])->first(); $userInfo = UserInfo::where('user_id', '=', $transaction['user_id'])->first(); $reservation_type = ReservationType::find($transaction['reservation_type'])->first(); if ($transaction['reservation_type'] == "1") { if ($transaction['day_type'] == 1) { $time = "Morning"; } else { $time = "Overnight"; } } else { $time = date("g:i a", strtotime($transaction['check_in_datetime'])); } //cottage list /* $cottagelists = explode(",", $transaction['cottagelist_id']); foreach($cottagelists as $list) { $cottagename = CottageList::where('cottagelist_id','=',$list)->first(); if(!in_array($cottagename['cottagename'], $cottagelists)) { $a[count($cottagelists)] = $cottagename['cottagename']; } }*/ $all = CottageList::all(); $cottagelists = explode(",", $transaction['cottagelist_id']); $cottagelists2 = array(); foreach ($all as $cottagename) { if (in_array($cottagename['cottagelist_id'], $cottagelists)) { $cottagelists2[count($cottagelists2)] = $cottagename['cottagename'] . "<br>"; } } $a = $cottagelists2; $response[] = array("id" => $transaction['id'], "fname" => $userInfo['firstname'], "lname" => $userInfo['lastname'], "rtpe" => $reservation_type['name'], "rdate" => $transaction['reservation_date'], "status" => $transaction['status'], "room_name" => !empty($roomname) ? $roomname['roomname'] : "", "cottage_name" => $a, "ttime" => $time); } return $response; }
<div class="col-md-6" style="padding:0px 5px !important;"> <div class="form-group"> <label class="control-label" for="inputDefault">Date</label> <input type="text" class="form-control input-sm" id="date"name="date" style="font-size:9pt;" placeholder=" "> <input type="hidden" id="seasoncode" name="seasoncode"> </div> </div> <div class="col-md-6" style="padding:0px 5px !important;"> <div class="form-group" id="forTime"> <label class="control-label" for="inputDefault">Time</label> <input type="text" class="form-control input-sm" id="time" name="time" style="font-size:9pt;" placeholder="time" > </div> </div> </div> <?php $reservationTypes = ReservationType::all(); ?> <div id="pT"class="form-group" style="position:relative;"> <label class="control-label" for="inputDefault">Reservation Type</label> <i class="fa fa-2x fa-caret-down" style="position:absolute;right:10px;bottom:2px;color:#000;pointer-events:none;"></i> <select class="form-control input-sm" id="rType" name="rType" style="padding-top:0px;padding-left:5px;line-height:20pt;" > <option value="" disabled selected style="display:none;">Choose type</option> @foreach($reservationTypes as $type) <option value = "{{$type['id']}}">{{$type['name']}}</option> @endforeach </select> </div> <div id="forCottage"> <div id="pT"class="form-group" style="position:relative;"> <label class="control-label" for="inputDefault">Category type</label> <i class="fa fa-2x fa-caret-down" style="position:absolute;right:10px;bottom:2px;color:#000;pointer-events:none;"></i>