<?php $__env->startSection('css'); ?>
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.13.2/themes/base/jquery-ui.min.css"
          integrity="sha512-ELV+xyi8IhEApPS/pSj66+Jiw+sOT1Mqkzlh8ExXihe4zfqbWkxPRi8wptXIO9g73FSlhmquFlUOuMSoXz5IRw=="
          crossorigin="anonymous" referrerpolicy="no-referrer" />
    <link rel="stylesheet" href="<?php echo e(asset('assets/web/css/book_now.css')); ?>">
    <!-- ----- new style ----- -->
    <!--    <style>-->

    <!--    </style>-->
<?php $__env->stopSection(); ?>


<?php $__env->startSection('content'); ?>
<section class="hotel_request section-padding bg-light">
        <div class="container">
            <div class="hotel_request_form">
                <div class="form_title">
                    <h3> <?php echo e(__('bookings.customer_info')); ?> </h3>
                    <div class="steps">
                        <span class="active"></span>
                        <span class=""></span>
                        <span class=""></span>
                        <span class=""></span>
                    </div>
                </div>
                <form action="<?php echo e(route('checkStep_1')); ?>" method="post" class="add_form">
                    <?php echo csrf_field(); ?>
                <div class="form_body">
                    <div class="row">
                        <div class="col-lg-4">
                            <div class="form-group">
                                <label for=""> <?php echo e(__('bookings.name')); ?> <span class="text-danger"> * </span> </label>
                                <input type="text" name="name" class="form-control" placeholder=" ... ">
                            </div>
                        </div>
                        <div class="col-lg-4">
                            <div class="form-group">
                                <label for=""> <?php echo e(__('bookings.phone')); ?> <span class="text-danger"> * </span> </label>
                                <input type="tel" name="phone" class="form-control" placeholder=" ... ">
                            </div>
                        </div>
                        <div class="col-lg-4">
                            <div class="form-group">
                                <label for=""> <?php echo e(__('bookings.country_id')); ?> <span class="text-danger"> * </span> </label>
                                <div class="ui-widget">
                                    <select id="country_id" name="country_id">
                                      <?php $__currentLoopData = $countries; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $country): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                        <option value=""> </option>
                                        <option value="<?php echo e($country->id); ?>"><?php echo e($country->name); ?></option>
                                     <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                    </select>
                                  </div>
                            </div>
                        </div>
                        <div class="col-lg-4">
                            <div class="form-group">
                                <label for=""> <?php echo e(__('bookings.email')); ?> <span class="text-danger"> * </span> </label>
                                <input type="email" name="email" class="form-control" placeholder=" ... ">
                            </div>
                        </div>
                        <div class="col-lg-4">
                            <div class="form-group">
                                <label for=""> <?php echo e(__('bookings.agency')); ?> <span class="text-danger"> * </span> </label>
                                <input type="text" name="agency" class="form-control" placeholder=" ... ">
                            </div>
                        </div>
                        <div class="col-lg-4">
                            <div class="form-group">
                                <label for=""> <?php echo e(__('bookings.iata_no')); ?> </label>
                                <input type="text" name="iata_no" class="form-control" placeholder=" ... ">
                            </div>
                        </div>
                    </div>
                    <!-- ----- -->
                    <div class="text-center">
                        <button class="butn color my-4 rounded-lg py-3 px-5 w-25 add_button">
                            <span> <i class="fas fa-angle-right mr-2"></i> <?php echo e(__('bookings.next')); ?> </span>
                        </button>
                    </div>
                </div>
                </form>
            </div>
        </div>
    </section>
    <?php $__env->stopSection(); ?>

<?php $__env->startSection('inner_js'); ?>

    <script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js"></script>

    <script>

        $('.add_button').click(async function (e) {
            e.preventDefault();

            $(this).prop('disabled', true);

            let form = $('.add_form'),
                data = new FormData(form[0]),
                url = form.attr('action'),
                method = form.attr('method');


            const response=await ajax({
                url,
                data,
                dataType: 'json',
                method
            });


            if (response.errors){
                $(this).prop('disabled', false);
                toasterError(response.errors);
            }

            if (response.url){
               window.location.href = response.url;
            }

        });


    </script>

    <script>
    $( function() {
      $.widget( "custom.combobox", {
        _create: function() {
          this.wrapper = $( "<span>" )
            .addClass( "custom-combobox" )
            .insertAfter( this.element );

          this.element.hide();
          this._createAutocomplete();
          this._createShowAllButton();
        },

        _createAutocomplete: function() {
          var selected = this.element.children( ":selected" ),
            value = selected.val() ? selected.text() : "";

          this.input = $( "<input>" )
            .appendTo( this.wrapper )
            .val( value )
            .attr( "title", "" )
            .addClass( "custom-combobox-input ui-widget ui-widget-content ui-state-default ui-corner-left" )
            .autocomplete({
              delay: 0,
              minLength: 0,
              source: this._source.bind( this )
            })
            .tooltip({
              classes: {
                "ui-tooltip": "ui-state-highlight"
              }
            });

          this._on( this.input, {
            autocompleteselect: function( event, ui ) {
              ui.item.option.selected = true;
              this._trigger( "select", event, {
                item: ui.item.option
              });
            },

            autocompletechange: "_removeIfInvalid"
          });
        },

        _createShowAllButton: function() {
          var input = this.input,
            wasOpen = false;

          $( "<a>" )
            .attr( "tabIndex", -1 )
            // .attr( "title", "Show All Items" )
            .tooltip()
            .appendTo( this.wrapper )
            .button({
              icons: {
                primary: "ui-icon-triangle-1-s"
              },
              text: false
            })
            .removeClass( "ui-corner-all" )
            .addClass( "custom-combobox-toggle ui-corner-right" )
            .on( "mousedown", function() {
              wasOpen = input.autocomplete( "widget" ).is( ":visible" );
            })
            .on( "click", function() {
              input.trigger( "focus" );

              // Close if already visible
              if ( wasOpen ) {
                return;
              }

              // Pass empty string as value to search for, displaying all results
              input.autocomplete( "search", "" );
            });
        },

        _source: function( request, response ) {
          var matcher = new RegExp( $.ui.autocomplete.escapeRegex(request.term), "i" );
          response( this.element.children( "option" ).map(function() {
            var text = $( this ).text();
            if ( this.value && ( !request.term || matcher.test(text) ) )
              return {
                label: text,
                value: text,
                option: this
              };
          }) );
        },

        _removeIfInvalid: function( event, ui ) {

          // Selected an item, nothing to do
          if ( ui.item ) {
            return;
          }

          // Search for a match (case-insensitive)
          var value = this.input.val(),
            valueLowerCase = value.toLowerCase(),
            valid = false;
          this.element.children( "option" ).each(function() {
            if ( $( this ).text().toLowerCase() === valueLowerCase ) {
              this.selected = valid = true;
              return false;
            }
          });

          // Found a match, nothing to do
          if ( valid ) {
            return;
          }

          // Remove invalid value
          this.input
            .val( "" )
            .attr( "title", value + " didn't match any item" )
            .tooltip( "open" );
          this.element.val( "" );
          this._delay(function() {
            this.input.tooltip( "close" ).attr( "title", "" );
          }, 2500 );
          this.input.autocomplete( "instance" ).term = "";
        },

        _destroy: function() {
          this.wrapper.remove();
          this.element.show();
        }
      });

      $( "#country_id" ).combobox();
      $( "#toggle" ).on( "click", function() {
        $( "#country_id" ).toggle();
      });
    } );
    </script>

<?php $__env->stopSection(); ?>

<?php echo $__env->make('web.layouts.container', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?><?php /**PATH /Applications/MAMP/htdocs/mawada/resources/views/web/bookings/step_1.blade.php ENDPATH**/ ?>