ok
Direktori : /home2/selectio/www/subamangala/admin/api/backups/ |
Current File : /home2/selectio/www/subamangala/admin/api/backups/booking_view_seats.php |
<?php ob_start(); session_start(); include "../config/config.php"; /*$return_date = $_REQUEST['return_date'];*/ /*if(isset($return_date) && $return_date!=""){ $conditions.=" and (t.trip_status=1 OR t.trip_status=2 AND t.trip_on_start_date <= '".$return_date."' AND t.trip_on_end_date >= '".$return_date."' ) and ('".$journey_date."' != CURDATE() OR '".$journey_date."' = CURDATE() and CURTIME() < t.pickup_time)"; }*/ $pickup_city = $_REQUEST['pickup_city']; $drop_city = $_REQUEST['drop_city']; $journey_date = $_REQUEST['journey_date']; $trip_id = $_REQUEST['trip_id']; $conditions=""; /*if(isset($pickup_city) && $pickup_city!="" && $drop_city!=""){ $conditions.=" and t.pickup_city=".$pickup_city." and t.drop_city=".$drop_city.""; }*/ if(isset($journey_date) && $journey_date!=""){ $conditions.=" and (t.trip_status=1 OR t.trip_status=2 AND t.trip_on_start_date <= '".$journey_date."' AND t.trip_on_end_date >= '".$journey_date."' ) and ('".$journey_date."' != CURDATE() OR '".$journey_date."' = CURDATE() and CURTIME() < t.pickup_time)"; } if(isset($trip_id) && $trip_id!=""){ $conditions.=" and t.id=".$trip_id.""; } $statement = $pdo->prepare("SELECT t.*, tbl_bus_details.bus_code, pc.name as pickup_city_name, dc.name as drop_city_name, tbl_bus_details.bus_name,t.id as trip_id FROM `tbl_trips` t LEFT JOIN tbl_bus_details ON tbl_bus_details.id=t.bus_id LEFT JOIN tbl_cities pc ON pc.id=t.pickup_city LEFT JOIN tbl_cities dc ON dc.id=t.drop_city WHERE t.trip_status!=3 ".$conditions); $statement->execute(); $emp_data = $statement->fetchAll(PDO::FETCH_ASSOC); $totalData = $statement->rowCount(); if($totalData>0){ foreach ($emp_data as $data){ $offer_per_seat=""; // Offer Type 1=Default, 2=Offer if($data['offer_type']==1){ $price = "<span style='font-size: 18px; font-weight: 600;'>INR</span> <span style='font-size: 27px; font-weight: 900;'>".number_format($data['ticket_amount'])."</span>"; }else if($data['offer_type']==2){ $offer_price = $data['ticket_amount']-$data['offer_amount']; $offer_per_seat = "<span style='float: right;color: white;font-weight: 500;background: crimson;font-size: 14px;border-radius: 5px;padding: 0px 10px 0px 10px;'>Offer <i class='fa fa-inr'></i> ".$offer_price." Per Seat</span>"; $price = "<span style='font-size: 18px; font-weight: 600;'>INR <s>".number_format($data['ticket_amount'])."</s></span> <span style='font-size: 27px; font-weight: 900;'>".number_format($data['offer_amount'])."</span>"; } ?> <form method="post" id="" action="bookings-passenger-info.php"> <div id="seat_append_section_<?=$data['trip_id']?>" > <div class="row" style="padding-top: 25px;"> <div class="col-md-8" style="/*display: flex; justify-content: center;*/"> <div class="row"> <div class="col-md-12" style="margin-left: 26%;"> <table> <?php $statement = $pdo->prepare("SELECT * FROM `tbl_bus_seats` WHERE bus_id=".$data['bus_id'].""); $statement->execute(); $datas = $statement->fetchAll(PDO::FETCH_ASSOC); $totalData = $statement->rowCount(); $i=1; foreach($datas as $data_bus){ $style_class = "span"; $title = "Available"; $disable = "seat_available"; $statement_tickets = $pdo->prepare("SELECT * FROM `tbl_tickets` WHERE bus_id=".$data['bus_id']." and trip_id=".$data['trip_id']." and trip_date='".$journey_date."'"); error_log("SELECT * FROM `tbl_tickets` WHERE bus_id=".$data['bus_id']." and trip_id=".$data['trip_id']." and trip_date='".$journey_date."'"); $statement_tickets->execute(); $result = $statement_tickets->fetchAll(PDO::FETCH_ASSOC); foreach($result as $res){ if($res['seat_id']==$data_bus['id']){ if($res['gender']=="M"){ $style_class = "male"; $title = "Male : Booked"; $disable = "disable"; }else if($res['gender']=="F"){ $style_class = "female"; $title = "Female : Booked"; $disable = "disable"; } } } if($data_bus['seat_no']==""){ $seat = "<td> </td>"; }else{ $seat = "<td> <input class='form-check-input name_of_seat_numbers ".$disable."' type='checkbox' value='".$data_bus['id']."' id='seat_".$data_bus['id']."' style='display: none;'> <label class='form-check-label' for='seat_".$data_bus['id']."'><span value='".$data_bus['id']."' data-tooltip='".$title."' class='btn btn-xs title ".$style_class."' style=''>".$data_bus['seat_no']."</span></label> </td>"; } if($i==1){ $seat = "<td><img src='icons/steering-wheel.png' style='width: 18px; rotate: -90deg;'></td>"; } if($i%11==1 || $i==1){ echo "<tr>"; } echo $seat; if($i%11==0){ echo "</tr>"; } ?> <?php $i++; } ?> </table> </div> </div> <div class="row" style="padding-top: 10px;"> <div class="col-md-12" style="text-align: center;display: flex;margin-left: 35%;padding-top: 10px;"> <span style="display: flex;"><h6 style="background: #f3f2f2; color: #f3f2f2;padding: 0px 10px 20px 10px;height: 0px; border: 1px solid #877a7a;"></h6> <b style="padding-top: 10px;">Available</b></span> <span style="display: flex;"><h6 style="background: #00dbff; color: #00dbff; padding: 0px 10px 20px 10px;height: 0px; border: 1px solid #877a7a;"></h6> <b style="padding-top: 10px;">Selected</b></span> <span style="display: flex;"><h6 style="background: blue;color: blue;padding: 0px 10px 20px 10px;height: 0px; border: 1px solid #877a7a;"></h6> <b style="padding-top: 10px;">Male</b></span> <span style="display: flex;"><h6 style="background: deeppink;color: deeppink;padding: 0px 10px 20px 10px;height: 0px; border: 1px solid #877a7a;"></h6> <b style="padding-top: 10px;">Female</b></span> </div> </div> </div> <!-- General Details Here --> <input type="hidden" name="passenger_info"> <!-------- Trip Journey Date Details Starts Here --------> <input type="hidden" name="bus_id" value="<?=$data['bus_id']?>"> <input type="hidden" name="trip_id" value="<?=$data['trip_id']?>"> <input type="hidden" name="trip_date" value="<?=$journey_date?>"> <input type="hidden" name="pickup_city" value="<?=$data['pickup_city']?>"> <input type="hidden" name="drop_city" value="<?=$data['drop_city']?>"> <!-- Journey Date Seat Details Here --> <input type="hidden" name="seat_ids" id="seat_ids"> <input type="hidden" name="name_of_seats" id="name_of_seats"> <input type="hidden" name="seat_amt" id="ticket_rate" value="<?=$data['ticket_amount']?>"> <input type="hidden" name="total_no_seats" id="total_no_seats"> <input type="hidden" name="offer_ticket_amt" id="offer_ticket_amt" value="<?=$data['offer_amount']?>" <!-------- Trip Journey Date Details Endsss Here --------> <!-- Trip Return Date Details Here --> <!--<input type="hidden" name="return_date" value="<?=$return_date?>">--> <div class="col-md-4" id="points_section" style="display: none;"> <div class="form-group"> <label class="control-label required" for="pickup_city">Boarding Point</label> <select name="boarding_point" class="form-control select2" style="width:100%" id="boarding_point" required="required"> <option value="">Select Boarding Point</option> <?php $statement = $pdo->prepare("SELECT * FROM `tbl_points` WHERE city=".$pickup_city.""); $statement->execute(); $location_result = $statement->fetchAll(PDO::FETCH_ASSOC); foreach ($location_result as $result) { ?> <option value="<?=$result['id']?>"><?=$result['name']?></option> <?php } ?> </select> </div> <div class="form-group"> <label class="control-label required" for="pickup_city">Dropping Point</label> <select name="dropping_point" class="form-control select2 " style="width:100%" id="dropping_point" required="required"> <option value="">Select Dropping Point</option> <?php $statement = $pdo->prepare("SELECT * FROM `tbl_points` WHERE city=".$drop_city.""); $statement->execute(); $location_result = $statement->fetchAll(PDO::FETCH_ASSOC); foreach ($location_result as $result) { ?> <option value="<?=$result['id']?>"><?=$result['name']?></option> <?php } ?> </select> </div> <div class="col-md-6"> Seat(s): </div> <div class="col-md-6"> <b> <span id="name_of_the_seats"></span></b> </div> <div class="col-md-6"> Fare: </div> <div class="col-md-6"> <b><i class="fa fa-inr"></i> <span id="grand_total">0.00</span></b> </div> <div class="form-group" style="float: right;padding-top: 10px;"> <button type="sumbit" class="btn btn-warning">Continue</button> </div> </div> </div> </div> </form> <?php } }else{ ?> <?php } ?> <script> $(document).ready(function() { $(".name_of_seat_numbers").on("change", function() { var checkedCount = $(".name_of_seat_numbers:checked").length; if(checkedCount!=0){ $("#points_section").css({ 'display': 'block' }); }else if(checkedCount==0){ $("#points_section").css({ 'display': 'none' }); } if (checkedCount>5) { $(this).prop("checked", false); } SeatNumbers(); }); }); $(document).ready(function() { $('.span').click(function () { var qty = Number($(this).val()); var span_val = $(".span").text(); console.log("Seat Value: "+$(this).text()); if($(this).hasClass('select')) { var rowCount = $('.select').length; $(this).removeClass("select"); console.log("Selected Seats: "+rowCount); } else { $(this).addClass("select"); var rowCount = $('.select').length; console.log("Selected Seats: "+rowCount); if(rowCount>5){ alert("Maximum No of Seats Allowed is 5") $(this).removeClass("select"); console.log("Selected Seats: "+rowCount); }else{ $(this).addClass("select"); console.log("Selected Seats: "+rowCount); } } SeatNumbers(); SelectCount(); SeatName(); }); }); function SelectCount(){ var rowCount = $('.select').length; $("#total_no_seats").val(rowCount); console.log("Selected Seats: "+rowCount); } function SeatNumbers(){ var checkValues = $('.seat_available:checked').map(function(){ return $(this).val(); }).get(); console.log("Value: " +checkValues); $("#seat_ids").val(checkValues); } function SeatName(){ var SeatValues = $('.select').map(function(){ return $(this).text(); }).get(); console.log("SeatValues Value: " +SeatValues); console.log($(this).text()); $("#name_of_the_seats").text(SeatValues); $("#name_of_seats").val(SeatValues); grand_total(); } function grand_total(){ var ticket_rate = Number($("#ticket_rate").val()); console.log("Ticket Rate: "+ticket_rate); var tot=0; $(".select").each(function(){ var selectedSeats = $('.span').length; console.log("Seat Count: "+selectedSeats); tot+=ticket_rate; }); $("#grand_total").text(tot.toFixed(2)); console.log("Grand Total: "+tot); } $(document).ready(function() { // Disable Female Seats and Checkbox $('.female').prop('disabled', true); // Disable Male Seats and Checkbox $('.male').prop('disabled', true); // Disable Booked Check Box $('.disable').prop('disabled', true); $('.only_show').prop('disabled', true); }); </script> <style> .title::after { content: attr(data-tooltip); position: absolute; top: 100%; left: 50%; transform: translateX(-50%); background-color: black; color: white; padding: 5px 10px; border-radius: 4px; white-space: nowrap; visibility: hidden; opacity: 0; transition: visibility 0s, opacity 0.3s ease-in-out; } .title:hover::after { visibility: visible; opacity: 1; } .male{ cursor: default; background: blue; color: white; font-weight: 600; width: 35px; text-align: center; } .male:hover{ cursor: default; background: blue; color: white; font-weight: 600; } .female{ background: deeppink; color: white; font-weight: 600; cursor: default; width: 35px; text-align: center; } .female:hover{ background: deeppink; color: white; font-weight: 600; cursor: default; } li{ text-decoration: none; } .select{ background: #00dbff !important; color: #2f2c2c; font-weight: 700; } .select:hover { background: #00dbff !important; color: #2f2c2c; font-weight: 700; } .card_container { border-radius: 10px; margin: 15px auto; color: black; border: 1px solid #d9c6c6; padding: 10px; background: beige; box-shadow: rgba(50, 50, 93, 0.25) 0px 6px 12px -2px, rgba(0, 0, 0, 0.3) 0px 3px 7px -3px; } td{ width: 40px; padding: 1px; text-align: center; } .span{ width: 35px; text-align: center; background: #f3f2f2; color: black; border-color: #d5c3c3; } </style>