
<?php $__env->startSection('content'); ?>
<div class="main-header">
    <div class="admin-header">
        <div class="uk-grid">
            <div class="uk-width-1-2">
                <h1 class="uk-margin-small-top main-heading"><?php echo e($title); ?></h1>
            </div>
            <div class="uk-width-1-2 uk-text-right">
                <a class="uk-button uk-button-default" href="<?php echo e(url('seller-request')); ?>"> Back</a>
            </div>
        </div> 
    </div>
</div>
<div class="uk-margin uk-width-1-1 uk-margin-auto uk-card uk-card-default uk-card-body small-padding">
	<?php echo $__env->make('partials.messages', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?>
	<?php echo e(Form::open(array('route' => 'seller-request.store','method' => 'POST', 'class' => 'uk-form-stacked','id' => 'create_form'))); ?>

    <?php echo csrf_field(); ?>
    <ul class="uk-subnav uk-subnav-pill uk-margin-remove-top" uk-switcher>
        <li><a href="javascript:void(0)">1</a></li>
        <li><a href="javascript:void(0)">2</a></li>
    </ul>
    <ul class="uk-switcher uk-margin">
        <li>
            <h4 class="uk-margin-small">Where do you want to buy?</h4>
        	<div uk-grid>
            	<div class="uk-width-1-3@m">  
                    <div class="uk-margin-small">
                        <label for="province" class="uk-form-label">Province <span class="uk-text-danger">*</span></label>
                        <div class="uk-form-controls">
                            <?php echo e(Form::select('province', $provinces, '', ['class' => 'uk-select location','autocomplete' => 'off', 'id' => 'province'])); ?>

                            <div class="province-error"></div>
                        </div>    
                    </div>
                    <div class="custom-location">
                        <div class="uk-margin-small">
                            <label for="location" class="uk-form-label">Location <span class="uk-text-danger">*</span></label>
                            <div class="uk-form-controls">
                                <?php echo e(Form::select('location', ['' => 'Select a Location'], '', ['class' => 'uk-select','autocomplete' => 'off', 'id' => 'location'])); ?>

                                <div class="location-error"></div>
                            </div>    
                        </div>
                    </div>
                </div>    
            </div>   
            <h4 class="uk-margin-small-top">Set approximate price range</h4>
            <div class="uk-grid-small" uk-grid>
                <div class="uk-width-1-6@m">
                    <div class="uk-margin-small">
                        <label for="min_price_range" class="uk-form-label">Min <span class="uk-text-danger">*</span></label>
                        <div class="uk-form-controls">
                            <?php echo e(Form::number('min_price_range', '', ['class' => 'uk-input','autocomplete' => 'off', 'id' => 'min_price_range'])); ?>

                            <div class="min-price-error"></div>
                        </div>    
                    </div>
                </div>
                <div class="uk-width-1-6@m">
                    <div class="uk-margin-small">
                        <label for="max_price_range" class="uk-form-label">Max <span class="uk-text-danger">*</span></label>
                        <div class="uk-form-controls">
                            <?php echo e(Form::number('max_price_range', '', ['class' => 'uk-input','autocomplete' => 'off', 'id' => 'max_price_range'])); ?>

                            <div class="max-price-error"></div>
                        </div>    
                    </div>
                </div>
            </div>
            <div class="uk-margin">
                <a type="submit" href="javascript:void(0)" class="uk-button uk-button-primary" id="next" name="submit" uk-switcher-item="next">Next</a>
            </div>
        </li>
        
        <li>
            <h4>Let's get to the details</h4> 
            <div class="uk-width-1-4@m">
                <div class="uk-margin-small">
                    <label for="bedrooms" class="uk-form-label">How many bedrooms do you need? <span class="uk-text-danger">*</span></label>
                    <div class="uk-form-controls">
                        <?php echo e(Form::number('bedrooms', '', ['class' => 'uk-input','autocomplete' => 'off'])); ?>

                    </div>    
                </div>
            </div>
            <div class="uk-width-1-4@m">
                <div class="uk-margin-small">
                    <label for="bathrooms" class="uk-form-label">How many bathrooms? <span class="uk-text-danger">*</span></label>
                    <div class="uk-form-controls">
                        <?php echo e(Form::number('bathrooms', '', ['class' => 'uk-input','autocomplete' => 'off'])); ?>

                    </div>    
                </div>
            </div>
            <div class="uk-width-1-4@m">
                <div class="uk-margin-small">
                    <label for="type_of_house" class="uk-form-label">Type of house? <span class="uk-text-danger">*</span></label>
                    <div class="uk-form-controls">
                        <?php echo e(Form::select('type_of_house', $houseType, '', ['class' => 'uk-select','autocomplete' => 'off'])); ?>

                    </div>    
                </div>
            </div>
            <div class="uk-width-1-4@m">
                <div class="uk-margin">
                    <label for="build" class="uk-form-label">New or old build? <span class="uk-text-danger">*</span></label>
                    <div class="uk-form-controls uk-flex">
                        <label><?php echo e(Form::checkbox('build', 'new', '1', ['class' => 'uk-checkbox','autocomplete' => 'off'])); ?> New</label>
                        <label><?php echo e(Form::checkbox('build', 'old', '', ['class' => 'uk-checkbox uk-margin-left','autocomplete' => 'off'])); ?> Old</label>
                    </div>    
                    <span class="uk-text-danger build-error"></span>
                </div>
            </div>
            <div class="uk-width-1-4@m">
                <div class="uk-margin-small">
                    <label for="heating_fuel" class="uk-form-label">Heating Fuel <span class="uk-text-danger">*</span></label>
                    <div class="uk-form-controls">
                        <?php echo e(Form::select('heating_fuel', $heatingFuel, '', ['class' => 'uk-select','autocomplete' => 'off'])); ?>

                    </div>    
                </div>
            </div>
            <div class="uk-width-1-4@m">
                <div class="uk-margin-small">
                    <label for="cooling_type" class="uk-form-label">Cooling Type <span class="uk-text-danger">*</span></label>
                    <div class="uk-form-controls">
                        <?php echo e(Form::select('cooling_type', $coolingType, '', ['class' => 'uk-select','autocomplete' => 'off'])); ?>

                    </div>    
                </div>
            </div>
            <div class="uk-margin">
                <a href="javascript:void(0)" class="uk-button uk-button-primary" uk-switcher-item="previous">Previous</a> <?php echo e(Form::submit('Submit', array('class' => 'uk-button uk-button-primary','name' => 'save', 'id' => 'create_submit'))); ?>

            </div>
        </li>
    </ul>
    <?php echo e(Form::close()); ?>

</div>                   
<?php $__env->stopSection(); ?>
<?php $__env->startSection('footer-script'); ?>
<script>
    
    $('input[name="build"]').click(function() {
        $('input[name="build"]').not(this).prop('checked', false);
    });
    

    $("#next").click(function() {
        var province        = $("#province").val();
        var location        = $("#location").val();
        var min_price_range = $("#min_price_range").val();
        var max_price_range = $("#max_price_range").val();
        
        if (province == "" || location == "" || min_price_range == "" || max_price_range == "") {
          $('#create_form').find('.province-error').html('<p class="uk-text-danger">Complete this required field.</p>');
          $('#create_form').find('.location-error').html('<p class="uk-text-danger">Complete this required field.</p>');
          $('#create_form').find('.min-price-error').html('<p class="uk-text-danger">Complete this required field.</p>');
          $('#create_form').find('.max-price-error').html('<p class="uk-text-danger">Complete this required field.</p>');
          return false;
          
        }else{
            $('#create_form').find('.province-error').html('');
            $('#create_form').find('.location-error').html('');
            $('#create_form').find('.min-price-error').html('');
            $('#create_form').find('.max-price-error').html('');
        }

    });
    
    $("#create_form").validate({
        errorClass: "uk-text-danger",
        rules:{
            bedrooms:"required",
            bathrooms:"required",
            type_of_house:"required",
            heating_fuel:"required",
            cooling_type:"required",
            build: "required",
        },
        messages: {
            bedrooms: {
                required: "Complete this required field."
            },
            bathrooms: {
                required: "Complete this required field."
            },
            type_of_house: {
                required: "Complete this required field."
            },
            heating_fuel: {
                required: "Complete this required field."
            },
            cooling_type: {
                required: "Complete this required field."
            },
            build: {
                required: "Complete this required field."
            },
        },
        errorPlacement: function(error, element) {
            if (element.attr("name") == "build") {
                error.insertBefore('.build-error');
            }else {
                error.insertAfter(element);
            }
        },
        submitHandler: function(form) {
            $('#create_submit').attr('disabled',true);
            form.submit();
        }
    });
    
    $(document).on('change','.location',function(){
        var province = $(this).val();

        $.ajax(
        {
            url: url + "/seller-change-location",
            type: 'POST',
            dataType: "JSON",
            data: {
                province: province,
            },
            success: function (res)
            {
                if(res.success == 1){
                    $('.custom-location').html(res.html);
                }
            },
            error: function () {
                UIkit.modal.alert('Oops there was an error! Please try again.');
            }
        });
    });
    
</script>
<?php $__env->stopSection(); ?>
<?php echo $__env->make('layouts.app', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?><?php /**PATH /home/kelowna/public_html/listingllama.kelowna.website/resources/views/seller_request/create.blade.php ENDPATH**/ ?>