<?php $__env->startSection('title'); ?> <?php if( ! empty($title)): ?> <?php echo e($title); ?> | <?php endif; ?> ##parent-placeholder-3c6de1b7dd91465d437ef415f94f36afc1fbc8a8## <?php $__env->stopSection(); ?>


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

        <div id="wrapper">

            <?php echo $__env->make('admin.sidebar_menu', \Illuminate\Support\Arr::except(get_defined_vars(), array('__data', '__path')))->render(); ?>

            <div id="page-wrapper">
                <?php if( ! empty($title)): ?>
                    <div class="row">
                        <div class="col-lg-12">
                            <h1 class="page-header"> <?php echo e($title); ?>  </h1>
                        </div> <!-- /.col-lg-12 -->
                    </div> <!-- /.row -->
                <?php endif; ?>

                <div class="row">
                    <div class="col-md-10 col-xs-12">

                        <?php echo e(Form::open(['route'=>'save_settings','class' => 'form-horizontal', 'files' => true])); ?>



                        <div class="form-group <?php echo e($errors->has('site_name')? 'has-error':''); ?>">
                            <label for="site_name" class="col-sm-4 control-label"><?php echo app('translator')->getFromJson('app.site_name'); ?></label>
                            <div class="col-sm-8">
                                <input type="text" class="form-control" id="site_name" value="<?php echo e(old('site_name')? old('site_name') : get_option('site_name')); ?>" name="site_name" placeholder="<?php echo app('translator')->getFromJson('app.site_name'); ?>">
                                <?php echo $errors->has('site_name')? '<p class="help-block">'.$errors->first('site_name').'</p>':''; ?>

                            </div>
                        </div>

                        <div class="form-group <?php echo e($errors->has('site_title')? 'has-error':''); ?>">
                            <label for="site_title" class="col-sm-4 control-label"><?php echo app('translator')->getFromJson('app.site_title'); ?></label>
                            <div class="col-sm-8">
                                <input type="text" class="form-control" id="site_title" value="<?php echo e(old('site_title')? old('site_title') : get_option('site_title')); ?>" name="site_title" placeholder="<?php echo app('translator')->getFromJson('app.site_title'); ?>">
                                <?php echo $errors->has('site_title')? '<p class="help-block">'.$errors->first('site_title').'</p>':''; ?>

                            </div>
                        </div>

                        <div class="form-group <?php echo e($errors->has('email_address')? 'has-error':''); ?>">
                            <label for="email_address" class="col-sm-4 control-label"><?php echo app('translator')->getFromJson('app.email_address'); ?></label>
                            <div class="col-sm-8">
                                <input type="text" class="form-control" id="email_address" value="<?php echo e(old('email_address')? old('email_address') : get_option('email_address')); ?>" name="email_address" placeholder="<?php echo app('translator')->getFromJson('app.email_address'); ?>">
                                <?php echo $errors->has('email_address')? '<p class="help-block">'.$errors->first('email_address').'</p>':''; ?>

                                <p class="text-info"> <?php echo app('translator')->getFromJson('app.email_address_help_text'); ?></p>
                            </div>
                        </div>



                        <div class="form-group">
                            <label for="default_timezone" class="col-sm-4 control-label">
                                <?php echo app('translator')->getFromJson('app.default_timezone'); ?>
                            </label>
                            <div class="col-sm-8 <?php echo e($errors->has('default_timezone')? 'has-error':''); ?>">
                                <select class="form-control select2" name="default_timezone" id="default_timezone">
                                    <?php $saved_timezone = get_option('default_timezone'); ?>
                                    <?php $__currentLoopData = timezone_identifiers_list(); $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $key=>$value): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                        <option value="<?php echo e($value); ?>" <?php echo e($saved_timezone == $value? 'selected':''); ?>><?php echo e($value); ?></option>
                                    <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>

                                </select>


                                <?php echo $errors->has('default_timezone')? '<p class="help-block">'.$errors->first('default_timezone').'</p>':''; ?>

                                <p class="text-info"><?php echo app('translator')->getFromJson('app.default_timezone_help_text'); ?></p>
                            </div>
                        </div>



                        <div class="form-group <?php echo e($errors->has('date_format')? 'has-error':''); ?>">
                            <label for="email_address" class="col-sm-4 control-label"><?php echo app('translator')->getFromJson('app.date_format'); ?></label>
                            <div class="col-sm-8">
                                <fieldset>
                                    <?php $saved_date_format = get_option('date_format'); ?>

                                    <label><input type="radio" value="F j, Y" name="date_format" <?php echo e($saved_date_format == 'F j, Y'? 'checked':''); ?>> <?php echo e(date('F j, Y')); ?><code>F j, Y</code></label> <br />
                                    <label><input type="radio" value="Y-m-d" name="date_format" <?php echo e($saved_date_format == 'Y-m-d'? 'checked':''); ?>> <?php echo e(date('Y-m-d')); ?><code>Y-m-d</code></label> <br />

                                    <label><input type="radio" value="m/d/Y" name="date_format" <?php echo e($saved_date_format == 'm/d/Y'? 'checked':''); ?>> <?php echo e(date('m/d/Y')); ?><code>m/d/Y</code></label> <br />

                                    <label><input type="radio" value="d/m/Y" name="date_format" <?php echo e($saved_date_format == 'd/m/Y'? 'checked':''); ?>> <?php echo e(date('d/m/Y')); ?><code>d/m/Y</code></label> <br />

                                    <label><input type="radio" value="custom" name="date_format" <?php echo e($saved_date_format == 'custom'? 'checked':''); ?>> Custom:</label>
                                    <input type="text" value="<?php echo e(get_option('date_format_custom')); ?>" id="date_format_custom" name="date_format_custom" />
                                    <span>example: <?php echo e(date(get_option('date_format_custom'))); ?></span>
                                </fieldset>
                                <p class="text-info"> <?php echo app('translator')->getFromJson('app.date_format_help_text'); ?></p>
                            </div>
                        </div>



                        <div class="form-group <?php echo e($errors->has('time_format')? 'has-error':''); ?>">
                            <label for="email_address" class="col-sm-4 control-label"><?php echo app('translator')->getFromJson('app.time_format'); ?></label>
                            <div class="col-sm-8">
                                <fieldset>
                                    <label><input type="radio" value="g:i a" name="time_format" <?php echo e(get_option('time_format') == 'g:i a'? 'checked':''); ?>> <?php echo e(date('g:i a')); ?><code>g:i a</code></label> <br />
                                    <label><input type="radio" value="g:i A" name="time_format" <?php echo e(get_option('time_format') == 'g:i A'? 'checked':''); ?>> <?php echo e(date('g:i A')); ?><code>g:i A</code></label> <br />

                                    <label><input type="radio" value="H:i" name="time_format" <?php echo e(get_option('time_format') == 'H:i'? 'checked':''); ?>> <?php echo e(date('H:i')); ?><code>H:i</code></label> <br />

                                    <label><input type="radio" value="custom" name="time_format" <?php echo e(get_option('time_format') == 'custom'? 'checked':''); ?>> Custom:</label>
                                    <input type="text" value="<?php echo e(get_option('time_format_custom')); ?>" id="time_format_custom" name="time_format_custom" />
                                    <span>example: <?php echo e(date(get_option('time_format_custom'))); ?></span>
                                </fieldset>
                                <p><a href="http://php.net/manual/en/function.date.php" target="_blank"><?php echo app('translator')->getFromJson('app.date_time_read_more'); ?></a> </p>
                            </div>
                        </div>

                        <div class="form-group <?php echo e($errors->has('currency_sign')? 'has-error':''); ?>">
                            <label for="currency_sign" class="col-sm-4 control-label"><?php echo app('translator')->getFromJson('app.currency_sign'); ?></label>
                            <div class="col-sm-8">
                                


                                <?php $current_currency = get_option('currency_sign'); ?>
                                <select name="currency_sign" class="form-control select2">
                                    <?php $__currentLoopData = themeqx_classifieds_currencies(); $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $code => $name): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                        <option value="<?php echo e($code); ?>"  <?php echo e($current_currency == $code? 'selected':''); ?>> <?php echo e($code); ?> </option>
                                    <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                </select>


                            </div>
                        </div>


                        <div class="form-group <?php echo e($errors->has('logo_settings')? 'has-error':''); ?>">
                            <label for="email_address" class="col-sm-4 control-label"><?php echo app('translator')->getFromJson('app.logo_settings'); ?></label>
                            <div class="col-sm-8">
                                <fieldset>
                                    <label><input type="radio" value="show_site_name" name="logo_settings" <?php echo e(get_option('logo_settings') == 'show_site_name'? 'checked':''); ?>> <?php echo app('translator')->getFromJson('app.show_site_name'); ?> </label> <br />
                                    <label><input type="radio" value="show_image" name="logo_settings" <?php echo e(get_option('logo_settings') == 'show_image'? 'checked':''); ?>> <?php echo app('translator')->getFromJson('app.show_image'); ?> </label> <br />
                                </fieldset>
                            </div>
                        </div>


                        <div class="form-group <?php echo e($errors->has('google_map_api_key')? 'has-error':''); ?>">
                            <label for="google_map_api_key" class="col-sm-4 control-label"><?php echo app('translator')->getFromJson('app.google_map_api_key'); ?></label>
                            <div class="col-sm-8">
                                <input type="text" class="form-control" id="google_map_api_key" value="<?php echo e(old('google_map_api_key')? old('google_map_api_key') : get_option('google_map_api_key')); ?>" name="google_map_api_key" placeholder="<?php echo app('translator')->getFromJson('app.google_map_api_key'); ?>">
                                <p class="help-block"> <?php echo app('translator')->getFromJson('app.google_map_api_key_get_info'); ?> <a href="https://developers.google.com/maps/documentation/javascript/get-api-key" target="_blank">https://developers.google.com/maps/documentation/javascript/get-api-key</a> </p>
                                <?php echo $errors->has('google_map_api_key')? '<p class="help-block">'.$errors->first('google_map_api_key').'</p>':''; ?>

                            </div>
                        </div>



                        <div class="form-group <?php echo e($errors->has('default_latitude')? 'has-error':''); ?>">
                            <label for="ad_title" class="col-sm-4 control-label"><?php echo app('translator')->getFromJson('app.default_latitude'); ?></label>
                            <div class="col-sm-8">
                                <input type="text" class="form-control" id="default_latitude" value="<?php echo e(old('default_latitude')? old('default_latitude') : get_option('default_latitude')); ?>" name="default_latitude" placeholder="<?php echo app('translator')->getFromJson('app.default_latitude'); ?>">
                                <?php echo $errors->has('default_latitude')? '<p class="help-block">'.$errors->first('default_latitude').'</p>':''; ?>

                            </div>
                        </div>

                        <div class="form-group <?php echo e($errors->has('default_longitude')? 'has-error':''); ?>">
                            <label for="ad_title" class="col-sm-4 control-label"><?php echo app('translator')->getFromJson('app.default_longitude'); ?></label>
                            <div class="col-sm-8">
                                <input type="text" class="form-control" id="default_longitude" value="<?php echo e(old('default_longitude')? old('default_longitude') : get_option('default_longitude')); ?>" name="default_longitude" placeholder="<?php echo app('translator')->getFromJson('app.default_longitude'); ?>">
                                <?php echo $errors->has('default_longitude')? '<p class="help-block">'.$errors->first('default_longitude').'</p>':''; ?>

                            </div>
                        </div>

                        <div class="alert alert-info">
                            <p><i class="fa fa-info-circle"></i> <?php echo app('translator')->getFromJson('app.map_click_help'); ?> </p>
                        </div>

                        <input id="pac-input" class="controls" type="text" placeholder="Search Box">
                        <div id="dvMap" style="width: 100%; height: 400px; margin: 20px 0;"></div>


                        <hr />
                        <div class="form-group">
                            <div class="col-sm-offset-4 col-sm-8">
                                <button type="submit" id="settings_save_btn" class="btn btn-primary"><?php echo app('translator')->getFromJson('app.save_settings'); ?></button>
                            </div>
                        </div>

                        <?php echo e(Form::close()); ?>

                    </div>
                </div>

            </div>   <!-- /#page-wrapper -->

        </div>   <!-- /#wrapper -->
<?php $__env->stopSection(); ?>


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

    <script src="https://maps.googleapis.com/maps/api/js?key=<?php echo e(get_option('google_map_api_key')); ?>&libraries=places&callback=initAutocomplete" async defer></script>

    <script>
        // This example adds a search box to a map, using the Google Place Autocomplete
        // feature. People can enter geographical searches. The search box will return a
        // pick list containing a mix of places and predicted search terms.

        function initAutocomplete() {
            var map = new google.maps.Map(document.getElementById('dvMap'), {
                center: {lat: <?php echo e((get_option('default_latitude') != 'default_latitude' ) ? get_option('default_latitude') : 40.715); ?>, lng: <?php echo e((get_option('default_longitude') != 'default_longitude')? get_option('default_longitude') : -74.009); ?> },
                zoom: 15,
                mapTypeId: google.maps.MapTypeId.ROADMAP
            });

            // Create the search box and link it to the UI element.
            var input = document.getElementById('pac-input');
            var searchBox = new google.maps.places.SearchBox(input);
            map.controls[google.maps.ControlPosition.TOP_LEFT].push(input);

            // Bias the SearchBox results towards current map's viewport.
            map.addListener('bounds_changed', function() {
                searchBox.setBounds(map.getBounds());
            });

            //Click event for getting lat lng
            google.maps.event.addListener(map, 'click', function (e) {
                $('input#default_latitude').val(e.latLng.lat());
                $('input#default_longitude').val(e.latLng.lng());
            });

            var markers = [];
            // [START region_getplaces]
            // Listen for the event fired when the user selects a prediction and retrieve
            // more details for that place.
            searchBox.addListener('places_changed', function() {
                var places = searchBox.getPlaces();

                if (places.length == 0) {
                    return;
                }

                // Clear out the old markers.
                markers.forEach(function(marker) {
                    marker.setMap(null);
                });
                markers = [];

                // For each place, get the icon, name and location.
                var bounds = new google.maps.LatLngBounds();
                places.forEach(function(place) {
                    var icon = {
                        url: place.icon,
                        size: new google.maps.Size(71, 71),
                        origin: new google.maps.Point(0, 0),
                        anchor: new google.maps.Point(17, 34),
                        scaledSize: new google.maps.Size(25, 25)
                    };

                    // Create a marker for each place.
                    markers.push(new google.maps.Marker({
                        map: map,
                        icon: icon,
                        title: place.name,
                        position: place.geometry.location
                    }));

                    if (place.geometry.viewport) {
                        // Only geocodes have viewport.
                        bounds.union(place.geometry.viewport);
                    } else {
                        bounds.extend(place.geometry.location);
                    }
                });
                map.fitBounds(bounds);
            });
            // [END region_getplaces]
        }

    </script>



    <script>
        $(document).ready(function(){

            $('input[type="checkbox"], input[type="radio"]').click(function(){
                var input_name = $(this).attr('name');
                var input_value = 0;
                if ($(this).prop('checked')){
                    input_value = $(this).val();
                }
                $.ajax({
                    url : '<?php echo e(route('save_settings')); ?>',
                    type: "POST",
                    data: { [input_name]: input_value, '_token': '<?php echo e(csrf_token()); ?>' },
                });
            });


            $('input[name="date_format"]').click(function(){
                $('#date_format_custom').val($(this).val());
            });
            $('input[name="time_format"]').click(function(){
                $('#time_format_custom').val($(this).val());
            });

            /**
             * Send settings option value to server
             */
            $('#settings_save_btn').click(function(e){
                e.preventDefault();

                var this_btn = $(this);
                this_btn.attr('disabled', 'disabled');

                var form_data = this_btn.closest('form').serialize();
                $.ajax({
                    url : '<?php echo e(route('save_settings')); ?>',
                    type: "POST",
                    data: form_data,
                    success : function (data) {
                        if (data.success == 1){
                            this_btn.removeAttr('disabled');
                            toastr.success(data.msg, '<?php echo app('translator')->getFromJson('app.success'); ?>', toastr_options);
                        }
                    }
                });
            });

        });
    </script>
<?php $__env->stopSection(); ?>
<?php echo $__env->make('layout.main', \Illuminate\Support\Arr::except(get_defined_vars(), array('__data', '__path')))->render(); ?>