Padraig

Padraig

Member Since 1 Month Ago

Experience Points 70
Experience Level 1

4,930 experience to go until the next level!

In case you were wondering, you earn Laracasts experience when you:

  • Complete a lesson — 100pts
  • Create a forum thread — 50pts
  • Reply to a thread — 10pts
  • Leave a reply that is liked — 50pts
  • Receive a "Best Reply" award — 500pts
Lessons Completed 0
Lessons
Completed
Best Reply Awards 0
Best Reply
Awards
  • start-engines Created with Sketch.

    Start Your Engines

    Earned once you have completed your first Laracasts lesson.

  • first-thousand Created with Sketch.

    First Thousand

    Earned once you have earned your first 1000 experience points.

  • 1-year Created with Sketch.

    One Year Member

    Earned when you have been with Laracasts for 1 year.

  • 2-years Created with Sketch.

    Two Year Member

    Earned when you have been with Laracasts for 2 years.

  • 3-years Created with Sketch.

    Three Year Member

    Earned when you have been with Laracasts for 3 years.

  • 4-years Created with Sketch.

    Four Year Member

    Earned when you have been with Laracasts for 4 years.

  • 5-years Created with Sketch.

    Five Year Member

    Earned when you have been with Laracasts for 5 years.

  • school-session Created with Sketch.

    School In Session

    Earned when at least one Laracasts series has been fully completed.

  • welcome-newcomer Created with Sketch.

    Welcome To The Community

    Earned after your first post on the Laracasts forum.

  • full-time-student Created with Sketch.

    Full Time Learner

    Earned once 100 Laracasts lessons have been completed.

  • pay-it-forward Created with Sketch.

    Pay It Forward

    Earned once you receive your first "Best Reply" award on the Laracasts forum.

  • subscriber-token Created with Sketch.

    Subscriber

    Earned if you are a paying Laracasts subscriber.

  • lifer-token Created with Sketch.

    Lifer

    Earned if you have a lifetime subscription to Laracasts.

  • lara-evanghelist Created with Sketch.

    Laracasts Evangelist

    Earned if you share a link to Laracasts on social media. Please email [email protected] with your username and post URL to be awarded this badge.

  • chatty-cathy Created with Sketch.

    Chatty Cathy

    Earned once you have achieved 500 forum replies.

  • lara-veteran Created with Sketch.

    Laracasts Veteran

    Earned once your experience points passes 100,000.

  • 10k-strong Created with Sketch.

    Ten Thousand Strong

    Earned once your experience points hits 10,000.

  • lara-master Created with Sketch.

    Laracasts Master

    Earned once 1000 Laracasts lessons have been completed.

  • laracasts-tutor Created with Sketch.

    Laracasts Tutor

    Earned once your "Best Reply" award count is 100 or more.

  • laracasts-sensei Created with Sketch.

    Laracasts Sensei

    Earned once your experience points passes 1 million.

  • top-50 Created with Sketch.

    Top 50

    Earned once your experience points ranks in the top 50 of all Laracasts users.

02 Jun
1 month ago

Padraig left a reply on Pass Input From Dropdown Selection To Confirmation Page

Thanks for having a look.

It's not my code and I'm not a coder but I was trying to get it to work on my site. It works apart from the boarding point. I maintain my own site and didn't realise the code was as bad as that. It's the first time I've come across lavarel which brought me here. I'll have a look at the links you suggested.

Thanks again for taking the time to give feedback. ??

Padraig left a reply on Pass Input From Dropdown Selection To Confirmation Page

Thanks for the tip Snapey and thanks for the help Tray2. Unfortunately, I still can't get it to work. Here is the full page.

@extends('layout')
@section('force-css','bc blog')
@section('style')
    <link rel="stylesheet" type="text/css" href="{{asset('assets/front/css/jquery.autocomplete.css')}}">
    <link rel="stylesheet" type="text/css" href="{{asset('assets/admin/css/select2.min.css')}}">
    <link rel="stylesheet" type="text/css" href="{{asset('assets/front/css/flatpickr.min.css')}}">
    <link rel="stylesheet" type="text/css" href="{{asset('assets/front/css/seat-custom.css')}}">
@stop
@section('content')
   
   @php
        $ticket = \App\TicketPrice::where('fleet_type_id',$tripAssign->fleetRegistration->fleet_type_id)->where('trip_route_id',$tripAssign->trip_route_id)->first();
        if($ticket){
          $ticketPrice = $ticket->price;
        }else{
        $ticketPrice = 0;
        }
        $bookArray = array_map('trim', explode(',', $booked_serial));
        $seatArray = array();
        $seatArray = array_map('trim', explode(',', $tripAssign->fleetRegistration->seat_numbers));

        $seatlayout= $tripAssign->fleetRegistration->layout;
        $layoutLastSeat= $tripAssign->fleetRegistration->lastseat;

        $data['seats'] = "";
        $rowSeat    = 1;
        $totalSeats = 1;
        $lastSeats  = ((sizeof($seatArray)>=3)?(sizeof($seatArray)-5):sizeof($seatArray));



 if($seatlayout == '3-2'){
    array_pop($seatArray);

    foreach ($seatArray as $seat){
            if ($rowSeat == 1){
                $data['seats'] .= "<div class='row'>";
            }

            $data['seats'] .= "<div class='col-2'>
                                    <div class='".(in_array($seat, $bookArray)?("seat ladies"):("seat occupied ChooseSeat")).(($seat == 'M') ?  (" last-seat-32 "):(" "))."' data-item=''>
                                        <div class='seat-body'>
                                            $seat
                                            <span class='seat-handle-left'></span>
                                            <span class='seat-handle-right'></span>
                                            <span class='seat-bottom'></span>
                                        </div>
                                    </div>
                            </div> ";

            if ($rowSeat == 3){
                //adding a cental row
                if ((sizeof($seatArray)&0) == 2 && ($lastSeats == 0 || $lastSeats < $totalSeats)) {
                    continue;
                } else {
                    $data['seats'] .= "<div class='col-2'>&nbsp;</div>";
                }
            } else if ($rowSeat == 5 || $rowSeat == sizeof($seatArray)) {
                //ends of each row
                $data['seats'] .= "</div>";
                $rowSeat = 0;
            }
            $rowSeat++;
            $totalSeats++;
    }
 }else if($seatlayout == '2-3'){
    array_pop($seatArray);

    foreach ($seatArray as $seat){
            if ($rowSeat == 1){
                $data['seats'] .= "<div class='row'>";
            }

            $data['seats'] .= "<div class='col-2'>
                <div class='".(in_array($seat, $bookArray)?("seat ladies"):("seat occupied ChooseSeat")).(($seat == 'M') ?  (" last-seat-21 "):(" "))."' data-item=''>
                    <div class='seat-body'>
                        $seat
                        <span class='seat-handle-left'></span>
                        <span class='seat-handle-right'></span>
                        <span class='seat-bottom'></span>
                    </div>
                </div>
            </div>";

            if ($rowSeat == 2){
                //adding a cental row
                if ((sizeof($seatArray)&0) == 2 && ($lastSeats == 0 || $lastSeats < $totalSeats)) {
                    continue;
                } else {
                    $data['seats'] .= "<div class='col-2'>&nbsp;</div>";
                }
            } else if ($rowSeat == 5 || $rowSeat == sizeof($seatArray)) {
                //ends of each row
                $data['seats'] .= "</div>";
                $rowSeat = 0;
            }
            $rowSeat++;
            $totalSeats++;
    }
 }else if($seatlayout == '2-2'){
    array_pop($seatArray);
    foreach ($seatArray as $seat){

            if ($rowSeat == 1){
                $data['seats'] .= "<div class='row'>";
            }

            $data['seats'] .= "<div class='col-2'>
                                    <div class='".(in_array($seat, $bookArray)?("seat ladies"):("seat occupied ChooseSeat")). (($seat == 'M') ?  (" last-seat-21 "):(" "))."' data-item=''>
                                        <div class='seat-body'>
                                            $seat
                                            <span class='seat-handle-left'></span>
                                            <span class='seat-handle-right'></span>
                                            <span class='seat-bottom'></span>
                                        </div>
                                    </div>
                                </div>";

            if ($rowSeat == 2){
                //adding a cental row
                if ((sizeof($seatArray)&0) == 2 && ($lastSeats == 0 || $lastSeats < $totalSeats)) {
                    continue;
                } else {
                    $data['seats'] .= "<div class='col-2'>&nbsp;</div>";
                }
            } else if ($rowSeat == 4 || $rowSeat == sizeof($seatArray)) {
                //ends of each row
                $data['seats'] .= "</div>";
                $rowSeat = 0;
            }
            $rowSeat++;
            $totalSeats++;
    }
 }else if($seatlayout == '1-1'){
    array_pop($seatArray);
    foreach ($seatArray as $seat){

            if ($rowSeat == 1){
                $data['seats'] .= "<div class='row'>";
            }

            $data['seats'] .= "<div class='col-2'>
                                    <div class='".(in_array($seat, $bookArray)?("seat  ladies"):("seat occupied ChooseSeat")). (($seat == 'M') ?  (" last-seat-11 "):(" "))."' data-item=''>
                                        <div class='seat-body'>
                                            $seat
                                            <span class='seat-handle-left'></span>
                                            <span class='seat-handle-right'></span>
                                            <span class='seat-bottom'></span>
                                        </div>
                                    </div>
                               </div>";

            if ($rowSeat == 1)
            {
                //adding a cental row
                if ((sizeof($seatArray)&0) == 2 && ($lastSeats == 0 || $lastSeats < $totalSeats)) {
                    continue;
                } else {
                    $data['seats'] .= "<div class='col-2'>&nbsp;</div>";
                }
            } else if ($rowSeat == 2 || $rowSeat == sizeof($seatArray)) {
                //ends of each row
                $data['seats'] .= "</div>";
                $rowSeat = 0;
            }
            $rowSeat++;
            $totalSeats++;
    }
 }else if($seatlayout == '2-1'){
     array_pop($seatArray);

    foreach ($seatArray as $seat){
            if ($rowSeat == 1){
                $data['seats'] .= "<div class='row'>";
            }

            $data['seats'] .= "<div class='col-2'>
                <div class='".(in_array($seat, $bookArray)?("seat ladies "):("seat occupied ChooseSeat ")).  (($seat == 'M') ?  (" last-seat-21 "):(" ")). "' data-item=''>
                <div class='seat-body'>
                    $seat
                    <span class='seat-handle-left'></span>
                    <span class='seat-handle-right'></span>
                    <span class='seat-bottom'></span>
                </div>
                </div>
            </div>";

            if ($rowSeat == 2)
            {
                //adding a cental row
                if ((sizeof($seatArray)&0) == 2 && ($lastSeats == 0 || $lastSeats < $totalSeats)) {
                    continue;
                }else{
                    $data['seats'] .= "<div class='col-2'>&nbsp;</div>";
                }
            } else if ($rowSeat == 3 || $rowSeat == sizeof($seatArray)) {
                //ends of each row
                $data['seats'] .= "</div>";
                $rowSeat = 0;
            }

            $rowSeat++;
            $totalSeats++;
    }
 }else if($seatlayout == '1-2'){
    array_pop($seatArray);
    foreach ($seatArray as $seat){
            if ($rowSeat == 1){
                $data['seats'] .= "<div class='row'>";
            }

            $data['seats'] .= "<div class='col-2 col-xs-12'>
                <div class='".(in_array($seat, $bookArray)?("seat ladies"):("seat occupied ChooseSeat")). (($seat == 'M') ?  (" last-seat-12 "):(" ")). "' data-item=''>
                    <div class='seat-body'>
                        $seat
                        <span class='seat-handle-left'></span>
                        <span class='seat-handle-right'></span>
                        <span class='seat-bottom'></span>
                    </div>
                </div>
            </div> ";

            if ($rowSeat == 1){
                //adding a cental row
                if ((sizeof($seatArray)&0) == 2 && ($lastSeats == 0 || $lastSeats < $totalSeats)) {
                    continue;
                }else{
                    $data['seats'] .= "<div class='col-2'>&nbsp;</div>";
                }
            } else if ($rowSeat == 3 || $rowSeat == sizeof($seatArray)) {
                //ends of each row
                $data['seats'] .= "</div>";
                $rowSeat = 0;
            }
            $rowSeat++;
            $totalSeats++;
    }
 }else{
    foreach ($seatArray as $seat){
        array_pop($seatArray);

            if ($rowSeat == 1){
                $data['seats'] .= "<div class='row'>";
            }

            $data['seats'] .= "<div class='col-2'>
                                    <div class='".(in_array($seat, $bookArray)?("seat ladies last-seat"):("seat occupied ChooseSeat last-seat")).  " ' data-item=''>
                                        <div class='seat-body'>
                                            $seat
                                            <span class='seat-handle-left'></span>
                                            <span class='seat-handle-right'></span>
                                            <span class='seat-bottom'></span>
                                        </div>
                                    </div>
                                </div>";

            if ($rowSeat == 1){
                //adding a cental row
                if ((sizeof($seatArray)&0) == 2 && ($lastSeats == 0 || $lastSeats < $totalSeats)) {
                    continue;
                } else {
                    $data['seats'] .= "<div class='col-2'>&nbsp;</div>";
                }
            }else if ($rowSeat == 3 || $rowSeat == sizeof($seatArray)) {
                //ends of each row
                $data['seats'] .= "</div>";
                $rowSeat = 0;
            }
            $rowSeat++;
            $totalSeats++;
    }
 }
    @endphp
    <!-- =========== Main Ticket Booking Area Start ===================== -->
    <div id="ticket-booking">
        <div class="container">
            <div class="row">
                <div class="col-12 text-center">
                    @if($tripAssign->fleetRegistration->company != null)
                        <h4>{{$tripAssign->fleetRegistration->company}}</h4>
                        <div class="margin-bottom-10"></div>
                    @endif
                    @if($tripAssign->fleetRegistration->owner != null)
                        <h6>{{$tripAssign->fleetRegistration->owner}}</h6>
                        <div class="margin-bottom-10"></div>
                    @endif

                    @if($tripAssign->tripRoute->name != null)
                        <p><strong><span class="text-danger">Route Name:</span> {{$tripAssign->tripRoute->name}}
                            </strong></p>
                        <div class="margin-bottom-10"></div>
                    @endif

                    <p>Dep Time: {{date('h:s A',strtotime($tripAssign->start_date))}} <span
                                class="text-success">({{date('d M Y',strtotime($tripAssign->start_date))}})</span></p>
                    <div class="margin-bottom-5"></div>
                    <strong>Total Seat: {{$tripAssign->fleetRegistration->total_seat}}</strong>
                    <div class="margin-bottom-5"></div>
                    <strong>Ticket Price : {{$ticketPrice}} {{$basic->currency}}</strong>
                </div>
            </div>

            <div class="margin-bottom-60"></div>

            <div class="row">
                <div class="offset-md-1 col-md-5 col-sm-10 ">
                    <div class="row text-center">
                        <div class="col-4">
                            <div class="seat  ">
                                <div class='seat-body'>
                                    <span class='seat-handle-left'></span>
                                    <span class='seat-handle-right'></span>
                                    <span class='seat-bottom'></span>
                                </div>
                            </div>
                            <p>@lang('Available Seat')</p>
                        </div>
                        <div class="col-md-4 col-sm-4">
                            <div class="seat ChooseSeat selected ">
                                <div class='seat-body'>
                                    <span class='seat-handle-left'></span>
                                    <span class='seat-handle-right'></span>
                                    <span class='seat-bottom'></span>
                                </div>
                            </div>
                            <p>@lang('Selected Seat')</p>
                        </div>


                        <div class="col-md-4 col-sm-4">
                            <div class="seat ladies last-seat seat occupied ChooseSeat ">
                                <div class='seat-body'>
                                    <span class='seat-handle-left'></span>
                                    <span class='seat-handle-right'></span>
                                    <span class='seat-bottom'></span>
                                </div>
                            </div>
                            <p>@lang('Booked Seat')</p>
                        </div>
                    </div>
                    <div class="margin-bottom-40"></div>

                    <div class="all-seats">
                        {!! $data['seats'] !!}
                    </div>
                </div>

                @if(in_array('M', $seatArray))
            </div>
            @endif


            <div class="col-md-6 col-sm-12">

                <form action="" class="price-details" id="bookingFrm" method="post" accept-charset="utf-8">
                    @csrf

                        <div class="form-group">
                        <label><strong>Choose Boarding Point <span class="text-danger">*</span></strong></label>
                        <select name="boarding" id="stoppage" class="form-control form-control-lg boarding_point">
                            <option value="">Boarding Point</option>
                            @foreach($stoppage as $board)
                                <option value="{{$board}}">{{$board}}</option>
                            @endforeach
                        </select>
                    </div>

                    @if($tripAssign->fleetRegistration->fleet_facilities != null)
                        <div class="form-group">
                            <h4> @lang('Facilities')</h4>
                            <div id="facilities">
                                @php
                                    $facilities = array_map('trim', explode(',', $tripAssign->fleetRegistration->fleet_facilities));
                                @endphp
                                @foreach($facilities as $val)
                                    <div class="funkyradio">
                                        <div class="funkyradio-default">
                                            <input type="radio" checked/>
                                            <label>{{$val}}</label>
                                        </div>
                                    </div>
                                @endforeach
                            </div>
                        </div>
                    @endif

                    <div class="table-responsive ">
                        <table class="table table table-bordered table-striped">
                            <tbody>
                            <tr>
                                <td class="text-right" style="width: 30%;">Seat(s)</td>
                                <th id="seatPreview">---</th>
                            </tr>
                            <tr>
                                <td class="text-right"><b> Total</b></td>
                                <th id="grandTotalPreview">0</th>
                            </tr>
                            </tbody>
                        </table>

                        <input type="hidden" name="trip_route_id" value="{{$tripAssign->trip_route_id}}">
                        <input type="hidden" name="fleet_registration_id"
                               value="{{$tripAssign->fleet_registration_id}}">
                        <input type="hidden" name="trip_id_no" value="{{$tripAssign->id}}">
                        <input type="hidden" name="id_no" value="{{$tripAssign->id_no}}">
                        <input type="hidden" name="fleet_type_id"
                               value="{{$tripAssign->fleetRegistration->fleet_type_id}}">
                        <input type="hidden" name="total_seat">
                        <input type="hidden" name="seat_number">
                        <input type="hidden" name="price" value="{{$ticketPrice}}">
                        <input type="hidden" name="total_fare">
                        <input type="hidden" name="booking_date" value="{{$tripAssign->start_date}}">

                    </div>
                    <button id="submit-btn" class="btn btn-block">@lang('Continue')</button>
                </form>

                @if(in_array('M', $seatArray))

                @else
            </div>
            @endif

        </div>


    </div>
    </div>
    <!-- =========== Main Ticket Booking Area End ===================== -->
    <div class="margin-bottom-60"></div>
@stop


@section('script')
    <script src="{{asset('assets/front/js/jquery.autocomplete.js')}}"></script>
    <script src="{{asset('assets/admin/js/select2.min.js')}}"></script>
    <script src="{{asset('assets/front/js/flatpickr.js')}}"></script>
@stop
@section('js')
    <script>
        $(document).ready(function () {

            $('.boarding_point').select2();


            /*
            *------------------------------------------------------
            * @function: findBookingInformation()
            * @return  : location, facilities, seatsList
            *------------------------------------------------------
            */
            var total_seat = $('input[name=total_seat]');
            var total_fare = $('input[name=total_fare]');
            var seat_number = $('input[name=seat_number]');

            var price = $('input[name=price]').val();
            var booking_date = $('input[name=booking_date]');

            var seatPreview = $('#seatPreview');
            var pricePreview = $('#pricePreview');
            var grandTotalPreview = $('#grandTotalPreview');
            var outputPreview = $('#outputPreview');

            if (total_seat.val() == '') {
                $("#submit-btn").attr('disabled', true);
            }

            /*
            *------------------------------------------------------
            * Choose seat(s)
            * @function: findPriceBySeat
            * @return : selected seat(s), price and group price
            *------------------------------------------------------
            */

            $('body').on('click', '.ChooseSeat', function () {
                var seat = $(this);
                if (seat.attr('data-item') != "selected") {
                    seat.removeClass('occupied').addClass('selected').attr('data-item', 'selected');
                } else if (seat.attr('data-item') == "selected") {
                    seat.removeClass('selected').addClass('occupied').attr('data-item', '');
                }
                //reset seat serial for each click
                var seatSerial = "";
                var countSeats = 0;

                $("div[data-item=selected]").each(function (i, x) {
                    countSeats = i + 1;
                    seatSerial += $(this).text().trim() + ", ";
                });

                total_fare.val(countSeats * price);
                $("#grandTotalPreview").text((countSeats * price) + " {{$basic->currency}}");
                total_seat.val(countSeats);
                seat_number.val(seatSerial);
                seatPreview.html(seatSerial);

                if (countSeats > 0) {
                    $("#submit-btn").attr('disabled', false);
                } else {
                    $("#submit-btn").attr('disabled', true);
                }
            });


            $(document).on('click', "#submit-btn", function (e) {
                e.preventDefault();
                var boarding = $("input[name=boarding]").val();
                var trip_route_id = $("input[name=trip_route_id]").val();
                var fleet_registration_id = $("input[name=fleet_registration_id]").val();
                var trip_assign_id_no = $("input[name=trip_id_no]").val();
                var id_no = $("input[name=id_no]").val();
                var fleet_type_id = $("input[name=fleet_type_id]").val();
                var total_seat = $("input[name=total_seat]").val();
                var seat_number = $("input[name=seat_number]").val();
                var price = $("input[name=price]").val();
                var total_fare = $("input[name=total_fare]").val();
                var booking_date = $("input[name=booking_date]").val();

                $.ajax({
                    type: "post",
                    url: "{{route('checked-seat')}}",
                    //contentType: false,
                    //processData: false,
                    data: {
                        boarding: boarding,
                        trip_route_id: trip_route_id,
                        fleet_registration_id: fleet_registration_id,
                        trip_assign_id_no: trip_assign_id_no,
                        id_no: id_no,
                        fleet_type_id: fleet_type_id,
                        total_seat: total_seat,
                        seat_number: seat_number,
                        price: price,
                        total_fare: total_fare,
                        booking_date: booking_date
                    },

                    success: function (data) {
                        console.log(data)
                        if (data.status == 1000) {
                            toastr.error(data.arr + " Seat Booked Yet. <br> Please select another seat");
                        }
                        if (data.pnr) {
                            window.location.href = "{{url('/seat-book/details/')}}" + '/' + data.pnr;
                        }
                    },

                    error: function (res) {
                        //console.log(res);
                    }
                });

            });
        });
    </script>
@stop

The Boarding Point is not passing to the following confirmation page.

@extends('layout')
@section('force-css','bc blog blogdetails')
@section('style')
    <link rel="stylesheet" type="text/css" href="{{asset('assets/front/css/blog.css')}}">
    <link rel="stylesheet" type="text/css" href="{{asset('assets/front/css/otherPageResponsive.css')}}">
    <style>
        .margin-top-10 {
            margin-top: 10px !important;
        }
        .padding-left-10 {
            padding-left: 10px !important;
        }
        .sidebar {
            background: #fff;
            padding: 20px 0px 10px 15px;
        }
    </style>

@stop

@section('content')
    <section id="latest_news">
        <div class="container">
            <div class="row">
                <div class="col-lg-8">
                    <div class="row">
                        <div class="col-lg-12 col-md-12">
                            <div class="c-box blog-3">
                                <article>
                                    <a href="javascript:void(0)">
                                        <h3>@lang('Passenger Contact Information') </h3>
                                    </a>


                                    <div class="margin-top-10">
                                            <div class="form-group">
                                                <label>@lang('Name') <span class="text-danger">*</span></label>
                                                @auth
                                                    <input type="text" name="passenger_name" class="form-control form-control-lg" autocomplete="off" placeholder="@lang('Enter Name')"
                                                           @if($bookTic->passenger_name != null)  value="{{$bookTic->passenger_name}}"  @else value="{{Auth::user()->fname}} {{Auth::user()->lname}}" @endif>
                                                @else
                                                    <input type="text" name="passenger_name" class="form-control form-control-lg" placeholder="@lang('Enter Name')" autocomplete="off"
                                                           @if($bookTic->passenger_name != null)  value="{{$bookTic->passenger_name}}" @else value="" @endif>
                                                @endauth
                                            </div>

                                            <div class="form-group">
                                                <label>E-Mail <span class="text-danger">*</span></label>
                                                @auth
                                                    <input type="text" name="email" class="form-control form-control-lg" placeholder="@lang('Enter E-mail')" autocomplete="off"
                                                           @if($bookTic->email != null)  value="{{$bookTic->email}}" @else value="{{Auth::user()->email}}" @endif >
                                                @else
                                                    <input type="text" name="email" class="form-control form-control-lg checkUserEmail" placeholder="@lang('Enter E-mail')" autocomplete="off"
                                                           @if($bookTic->email != null)  value="{{$bookTic->email}}" @else value="" @endif>

                                                           <span class="checkUserEmailMsg text-danger"></span>
                                                @endauth
                                            </div>


                                            <div class="form-group">
                                                <label>Mobile <span class="text-danger">*</span></label>
                                                @auth
                                                    <input type="text" name="phone" class="form-control form-control-lg" placeholder="@lang('Enter Mobile No.')" autocomplete="off"
                                                           @if($bookTic->phone != null)  value="{{$bookTic->phone}}" @else value="{{Auth::user()->phone}}" @endif>
                                                @else
                                                    <input type="text" name="phone" class="form-control form-control-lg" placeholder="@lang('Enter Mobile No.')" autocomplete="off"
                                                           @if($bookTic->phone != null)  value="{{$bookTic->phone}}" @else value="" @endif>
                                                @endauth
                                            </div>

                                        <input type="hidden" name="gate_id" class="gate-id">
                                    </div>


                                </article>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="col-md-4">
                    <div class="sidebar">
                        <div class="recent-posts-widget sidebar-widget sidebar-widget4">
                            <h3>@lang('Journey Details')</h3>
                            <h4 class="text-success margin-top-10">{{$bookTic->tripRoute->start_point_name}}
                                - {{$bookTic->tripRoute->end_point_name}}</h4>
                            <ul>
                                <li>{{date('D, d M Y, h:i A',strtotime($bookTic->booking_date))}}</li>
                                <li>@lang('Seat Number')(s): <strong class="padding-left-10 text-success ">{{$bookTic->seat_number}}</strong></li>
                                <li>@lang('Boarding'): <strong>{{$bookTic->boarding}}</strong></li>
                            </ul>
                        </div>
                    </div>
                </div>
            </div>


            <!-- Tab content -->
            <div class="row">
                <div class="col-12 bhoechie-tab-container text-center">
                    <div class="row">
                        <div class="col-3 bhoechie-tab-menu">
                            <div class="list-group">
                                @foreach($gateway as $k=>$data)
                                    <a href="#" class="list-group-item @if($k == 0) active @endif text-center" data-id="{{$data->id}}" >
                                        <h4 class="glyphicon glyphicon-plane"></h4><br/>
                                        {{$data->name}}
                                    </a>
                                @endforeach
                            </div>
                        </div>
                        <div class="col-9  bhoechie-tab">
                            @foreach($gateway as $k=>$data)
                                <div class="bhoechie-tab-content @if($k == 0) active @endif" >
                                    <div class="card ">
                                        <div class="card-header text-center">
                                            <h4 class="card-title">@lang('Pay With')  <strong>{{ $data->name }}</strong></h4>
                                        </div>
                                            <div class="card-body text-center">
                                                <img src="{{asset('assets/images/gateway')}}/{{$data->id}}.jpg" style="width: 150px;height:150px;border-radius: 5px ; margin: 10px 25%;"/>
                                                <ul style='font-size: 15px;' class="list-group text-center ">
                                                    <li class="list-group-item"> @lang('Total Fare'): <strong>{{$bookTic->total_fare}} {{$basic->currency}}</strong> </li>
                                                    <li class="list-group-item">@lang('Payment is processed using the Gortskehy National School PayPal account. Payment will be listed as "Gortskehy" on your statement.') 
                                                        </li>
                                                </ul>

                                            </div>
                                            <div class="card-footer">
                                                <button  class="btn btn-block btn-success btn-lg btn-continue"> @lang('Continue')</button>
                                            </div>

                                    </div>
                                </div>
                            @endforeach
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </section>
@stop


@section('script')
@stop
@section('js')
    <script>


        $(document).ready(function () {
            var tt =  $("div.bhoechie-tab-menu>div.list-group>a").data('id');
            $('.gate-id').val(tt);


            $("div.bhoechie-tab-menu>div.list-group>a").click(function (e) {
                e.preventDefault();
                $(this).siblings('a.active').removeClass("active");
                $(this).addClass("active");
                var index = $(this).index();
                $("div.bhoechie-tab>div.bhoechie-tab-content").removeClass("active");
                $("div.bhoechie-tab>div.bhoechie-tab-content").eq(index).addClass("active");
                $('.gate-id').val($(this).data('id'));
            });


            $('.btn-continue').on('click', function (e) {
                e.preventDefault();
                var passenger_name = $("input[name=passenger_name]").val();
                var email = $("input[name=email]").val();
                var phone = $("input[name=phone]").val();
                var gatewayId = $("input[name=gate_id]").val();
                var bookTicId = "{{$bookTic->id}}";

                if (phone.length == 0) {
                    toastr.error("Enter Mobile Number");
                }
                if (email.length == 0) {
                    toastr.error("Enter E-mail Address");
                }
                if (passenger_name.length == 0) {
                    toastr.error("Enter Passenger Name");
                }
                if (gatewayId.length == 0) {
                    toastr.error("You could not Change  Gateway Id");
                }

                if ((phone.length != 0) && (email.length != 0) && (passenger_name.length != 0) && (gatewayId.length != 0))
                {

                    $.ajax({
                        type: "post",
                        url: "{{route('ticketPayment')}}",
                        data: {
                            passenger_name:passenger_name,
                            email:email,
                            phone:phone,
                            bookTicId:bookTicId,
                            gatewayId:gatewayId
                        },

                        success:function(data){
                            if(data.status === "unknownGateway"){
                                toastr.error("Unknown Gateway!!");
                            }
                            if(data.status === "invalidEmail"){
                                toastr.error("Invalid E-mail !!");
                            }
                            if(data.status === "invalidTicket"){
                                toastr.error("Invalid Ticket Request !!");
                            }
                            if(data.status === "depositLimit"){
                                toastr.error(data.msg);
                            }
                            if(data.status === "confirmPayment"){
                                window.location.href = data.url;
                            }

                        },
                        error:function (res) {
                            console.log(res);
                        }

                    });
                }
            });


            $(".checkUserEmail").on('keyup', function(){

                var email = $('.checkUserEmail').val();

                $.ajax({
                    type: "post",
                    url: "{{route('checkMail')}}",
                    data: {
                        email : email
                    },
                    success:function(data){
                        if(data.status == "existEmail")
                        {
                            $('.checkUserEmailMsg').text("This Email already registered. Please Sign In Your Account");
                            $('.btn-continue').attr('disabled',true);
                        }else{
                             $('.checkUserEmailMsg').text("");
                             $('.btn-continue').attr('disabled',false);
                        }
                        console.log(data)
                    },
                    error:function(data){

                    }
                })

                //console.log()

            });



        });
    </script>
@stop

01 Jun
1 month ago

Padraig started a new conversation Pass Input From Dropdown Selection To Confirmation Page

Any help with the following would be appreciated.

I have a seat-plan.blade.php file with a form (excerpt below)

@csrf
                <div required class="form-group">
                    <label><strong>Choose Boarding Point <span class="text-danger">*</span></strong></label>
                    <select name="boarding" id="stoppage" class="form-control form-control-lg boarding_point">
                        <option value="">Boarding Point</option>
                        @foreach($stoppage as $board)
                            <option value="{{$board}}">{{$board}}</option>
                        @endforeach
                    </select>
    
                </div>

Further down the page I have...

On submission of the form the following confirmation page shows the input details correctly except for the borading details.

The problem is with

It just takes the last option from the dropdown menu regardless of how many options there are. How can I change it to pass the user selected option?