<section id='order_form' class="container">
    <div class="row">
        <h1 class="section_head">
            Order Details
        </h1>
    </div>
    <div class="row">
        <div class="col-md-4 col-md-push-8">
            <div class="panel">
                <div class="panel-heading">
                    <h3 class="panel-title">
                        <i class="ico-cart mr5"></i>
                        Order Summary
                    </h3>
                </div>

                <div class="panel-body pt0">
                    <table class="table mb0 table-condensed">
                        @foreach($tickets as $ticket)
                        <tr>
                            <td class="pl0">{{{$ticket['ticket']['title']}}} X <b>{{$ticket['qty']}}</b></td>
                            <td style="text-align: right;">
                                @if((int)ceil($ticket['full_price']) === 0)
                                FREE
                                @else
                                {{ money($ticket['full_price'], $event->currency->code) }}
                                @endif
                            </td>
                        </tr>
                        @endforeach
                    </table>
                </div>
                @if($order_total > 0)
                <div class="panel-footer">
                    <h5>
                        Total: <span style="float: right;"><b>{{ money($order_total + $total_booking_fee,$event->currency->code) }}</b></span>
                    </h5>
                </div>
                @endif

            </div>
            <div class="help-block">
                Please note you only have <span id='countdown'></span> to complete this transaction before your tickets are re-released.
            </div>
        </div>
        <div class="col-md-8 col-md-pull-4">
            <div class="event_order_form">
                {!! Form::open(['url' => route('postCreateOrder', ['event_id' => $event->id]), 'class' => $order_requires_payment ? 'ajax payment-form' : 'ajax', 'data-stripe-pub-key' => $event->account->stripe_publishable_key]) !!}

                {!! Form::hidden('event_id', $event->id) !!}

                <h3>Your Information</h3>

                <div class="row">
                    <div class="col-xs-6">
                        <div class="form-group">
                            {!! Form::label("order_first_name", 'First Name') !!}
                            {!! Form::text("order_first_name", null, ['required' => 'required', 'class' => 'form-control']) !!}
                        </div>
                    </div>
                    <div class="col-xs-6">
                        <div class="form-group">
                            {!! Form::label("order_last_name", 'Last Name') !!}
                            {!! Form::text("order_last_name", null, ['required' => 'required', 'class' => 'form-control']) !!}
                        </div>
                    </div>
                </div>

                <div class="row">
                    <div class="col-md-12">
                        <div class="form-group">
                            {!! Form::label("order_email", 'Email') !!}
                            {!! Form::text("order_email", null, ['required' => 'required', 'class' => 'form-control']) !!}
                        </div>
                    </div>
                </div>

                @if($event->ask_for_all_attendees_info)
                <div class="p20 pl0">
                   {!! Form::label("mirror_buyer_info", 'Use buyer details for all ticket holders') !!}
                   {!! Form::checkbox("mirror_buyer_info", 'on', false) !!}
                </div>
                @endif

                @if($event->ask_for_all_attendees_info)

                <div class="row">
                    <div class="col-md-12">
                        <div class="ticket_holders_details" >
                            <h3>Ticket Holder Information</h3>
                            @foreach($tickets as $ticket)
                            @for($i=0; $i<=$ticket['qty']-1; $i++)
                            <div class="panel panel-primary">
                                <div class="panel-heading">
                                    <h3 class="panel-title">
                                        <b>{{{$ticket['ticket']['title']}}}</b>: Ticket Holder {{$i+1}} Details
                                    </h3>
                                </div>

                                <div class="panel-body">
                                    <div class="row">
                                        <div class="col-md-6">
                                            <div class="form-group">
                                                {!! Form::label("ticket_holder_first_name[{$i}][{$ticket['ticket']['id']}]", 'First Name') !!}
                                                {!! Form::text("ticket_holder_first_name[{$i}][{$ticket['ticket']['id']}]", null, ['required' => 'required', 'class' => "ticket_holder_first_name.$i.{$ticket['ticket']['id']} ticket_holder_first_name form-control"]) !!}
                                            </div>
                                        </div>
                                        <div class="col-md-6">
                                            <div class="form-group">
                                                {!! Form::label("ticket_holder_last_name[{$i}][{$ticket['ticket']['id']}]", 'Last Name') !!}
                                                {!! Form::text("ticket_holder_last_name[{$i}][{$ticket['ticket']['id']}]", null, ['required' => 'required', 'class' => "ticket_holder_last_name.$i.{$ticket['ticket']['id']} ticket_holder_last_name form-control"]) !!}
                                            </div>
                                        </div>
                                        <div class="col-md-12">
                                            <div class="form-group">
                                                {!! Form::label("ticket_holder_email[{$i}][{$ticket['ticket']['id']}]", 'Email Address') !!}
                                                {!! Form::text("ticket_holder_email[{$i}][{$ticket['ticket']['id']}]", null, ['required' => 'required', 'class' => "ticket_holder_email.$i.{$ticket['ticket']['id']} ticket_holder_email form-control"]) !!}
                                            </div>
                                        </div>
                                    </div>
                                </div>
                            </div>
                            @endfor

                            @endforeach
                        </div>
                    </div>
                </div>

                @endif

                @if($order_requires_payment)

                <h3>Payment Information</h3>

                <div class="row">
                    <div class="col-md-12">
                        <div class="form-group">
                            {!! Form::label('card-number', 'Card Number') !!}
                            <input required="required" name="card-number" type="text" autocomplete="off" placeholder="**** **** **** ****" class="form-control card-number" size="20" data-stripe="number">
                        </div>
                    </div>
                </div>
                <div class="row">
                    <div class="col-xs-6">
                        <div class="form-group">
                            {!! Form::label('card-expiry-month', 'Exipry Month') !!}
                            {!!  Form::selectRange('card-expiry-month',1,12,null, [
                                    'class' => 'form-control card-expiry-month',
                                    'data-stripe' => 'exp_month'
                                ] )  !!}
                        </div>
                    </div>
                    <div class="col-xs-6">
                        <div class="form-group">
                            {!! Form::label('card-expiry-year', 'Exipry Year') !!}
                            {!!  Form::selectRange('card-expiry-year',14,24,null, [
                                    'class' => 'form-control card-expiry-year',
                                    'data-stripe' => 'exp_year'
                                ] )  !!}</div>
                    </div>
                </div>
                <div class="row">
                    <div class="col-md-12">
                        <div class="form-group">
                            {!! Form::label('card-expiry-year', 'CVC Number') !!}
                            <input required="required" name="card-cvc" type="password" placeholder="***"  class="form-control card-cvc" size="4" data-stripe="cvc">
                        </div>
                    </div>
                </div>

                @endif

                @if($event->pre_order_display_message)
                <div class="well well-small">
                    {{ nl2br(e($event->pre_order_display_message)) }}
                </div>
                @endif

               {!! Form::hidden('is_embedded', $is_embedded) !!}
               {!! Form::submit('Register Securely', ['class' => 'btn btn-lg btn-success card-submit', 'style' => 'width:100%;']) !!}

                <div style="display: none; opacity: .56; text-align: right; padding: 10px; padding-right: 0;">
                    <img alt="Powered By Stripe Payments" src="{{asset('assets/images/powered-by-stripe.png')}}"/>
                </div>
            </div>
        </div>
</section>

