<?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 class="">

        <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; ?>

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

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

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


                        <legend><?php echo app('translator')->getFromJson('app.ad_info'); ?></legend>

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

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

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

                        <div class="form-group <?php echo e($errors->has('ad_description')? 'has-error':''); ?>">
                            <label for="ad_title" class="col-sm-4 control-label"><?php echo app('translator')->getFromJson('app.ad_description'); ?></label>
                            <div class="col-sm-8">
                                <textarea name="ad_description" class="form-control" rows="8"><?php echo e(old('ad_description')?  old('ad_description') : $ad->description); ?></textarea>
                                <?php echo $errors->has('ad_description')? '<p class="help-block">'.$errors->first('ad_description').'</p>':''; ?>

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



                        <div class="form-group required <?php echo e($errors->has('type')? 'has-error':''); ?>">
                            <label class="col-md-4 control-label"><?php echo app('translator')->getFromJson('app.property_type'); ?> </label>
                            <div class="col-md-8">
                                <label for="type_apartment" class="radio-inline">
                                    <input type="radio" value="apartment" id="type_apartment" name="type"  <?php echo e($ad->type == 'apartment'? 'checked="checked"' : ''); ?>>
                                    <?php echo app('translator')->getFromJson('app.apartment'); ?>
                                </label>

                                <label for="type_condos" class="radio-inline">
                                    <input type="radio" value="condos" id="type_condos" name="type"  <?php echo e($ad->type == 'condos'? 'checked="checked"' : ''); ?>>
                                    <?php echo app('translator')->getFromJson('app.condos'); ?>
                                </label>

                                <label for="type_house" class="radio-inline">
                                    <input type="radio" value="house" id="type_house" name="type" <?php echo e($ad->type == 'house'? 'checked="checked"' : ''); ?>>
                                    <?php echo app('translator')->getFromJson('app.house'); ?>
                                </label>

                                <label for="type_land" class="radio-inline">
                                    <input type="radio" value="land" id="type_land" name="type" <?php echo e($ad->type == 'land'? 'checked="checked"' : ''); ?>>
                                    <?php echo app('translator')->getFromJson('app.land'); ?>
                                </label>

                                <label for="type_commercial_space" class="radio-inline">
                                    <input type="radio" value="commercial_space" id="type_commercial_space" name="type" <?php echo e($ad->type == 'commercial_space'? 'checked="checked"' : ''); ?>>
                                    <?php echo app('translator')->getFromJson('app.commercial_space'); ?>
                                </label>

                                <label for="type_villa" class="radio-inline">
                                    <input type="radio" value="villa" id="type_villa" name="type" <?php echo e($ad->type == 'villa'? 'checked="checked"' : ''); ?>>
                                    <?php echo app('translator')->getFromJson('app.villa'); ?>
                                </label>

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

                            </div>
                        </div>

                        <div class="form-group <?php echo e($errors->has('purpose')? 'has-error':''); ?>">
                            <label for="purpose" class="col-sm-4 control-label"><?php echo app('translator')->getFromJson('app.purpose'); ?></label>
                            <div class="col-sm-8">
                                <select class="form-control select2NoSearch" name="purpose" id="purpose">
                                    <option value="sale" <?php echo e($ad->purpose == 'sale' ? 'selected':''); ?>><?php echo app('translator')->getFromJson('app.sale'); ?></option>
                                    <option value="rent" <?php echo e($ad->purpose == 'rent' ? 'selected':''); ?>><?php echo app('translator')->getFromJson('app.rent'); ?></option>
                                </select>
                                <?php echo $errors->has('purpose')? '<p class="help-block">'.$errors->first('purpose').'</p>':''; ?>

                            </div>
                        </div>
                        <div class="form-group <?php echo e($errors->has('currency_type')? 'has-error':''); ?>">
                            <label for="currency_type" class="col-sm-4 control-label">Currency Type*</label>
                            <div class="col-sm-8">
                                <select class="form-control select2NoSearch" name="currency_type" id="currency_type">
                                    <option value="kwacha" <?php echo e($ad->currency_type == 'kwacha' ? 'selected':''); ?>>KWACHA (ZMK)</option>
                                    <option value="dollar" <?php echo e($ad->currency_type == 'dollar' ? 'selected':''); ?>>DOLLAR (USD)</option>
                                </select>
                                <?php echo $errors->has('currency_type')? '<p class="help-block">'.$errors->first('currency_type').'</p>':''; ?>

                            </div>
                        </div>


                        <div class="form-group  <?php echo e($errors->has('price')? 'has-error':''); ?>">
                            <label for="price" class="col-md-4 control-label"><?php echo app('translator')->getFromJson('app.price'); ?></label>
                            <div class="col-md-4">
                                <div class="input-group">
                                    <!--<span class="input-group-addon">$</span>-->
                                    <input type="text" placeholder="<?php echo app('translator')->getFromJson('app.ex_price'); ?>" class="form-control" name="price" id="price" value="<?php echo e(old('price')? old('price') : $ad->price); ?>">
                                </div>
                            </div>
                            <div class="col-md-4">
                                <div class="checkbox">
                                    <label>
                                        <input type="checkbox" value="1" name="negotiable" id="negotiable" <?php echo e($ad->is_negotiable == 1 ? 'checked':''); ?>>
                                        <?php echo app('translator')->getFromJson('app.negotiable'); ?>
                                    </label>
                                </div>
                            </div>

                            <div class="col-sm-8 col-md-offset-4">
                                <?php echo $errors->has('price')? '<p class="help-block">'.$errors->first('price').'</p>':''; ?>

                                <p class="text-info">Pick a good price. </p>
                            </div>
                        </div>


                        <div class="form-group">
                            <label class="col-sm-4 control-label"><?php echo app('translator')->getFromJson('app.price_per_unit'); ?>:</label>
                            <div class="col-sm-4">
                                <div class="input-group">
                                    <!--<span class="input-group-addon"><?php echo e(get_option('currency_sign')); ?></span>-->
                                    <input type="text" class="form-control input-sm" placeholder="<?php echo app('translator')->getFromJson('app.price_per_unit'); ?>" value="<?php echo e($ad->price_per_unit); ?>" name="price_per_unit" id="price_per_unit">
                                </div>
                                <span class="help-inline">&nbsp;</span>
                            </div>
                            <div class="col-sm-4">
                                <select class="form-control select2NoSearch" name="price_unit">
                                    <option value="sqft" <?php echo e($ad->unit_type == 'sqft' ? 'selected':''); ?> ><?php echo app('translator')->getFromJson('app.square_feet'); ?></option>
                                    <option value="sqmeter" <?php echo e($ad->unit_type == 'sqmeter' ? 'selected':''); ?> ><?php echo app('translator')->getFromJson('app.square_meter'); ?></option>
                                    <option value="acre" <?php echo e($ad->unit_type == 'acre' ? 'selected':''); ?> ><?php echo app('translator')->getFromJson('app.acre'); ?></option>
                                    <option value="hector" <?php echo e($ad->unit_type == 'hector' ? 'selected':''); ?> ><?php echo app('translator')->getFromJson('app.hector'); ?></option>
                                </select>
                                <span class="help-inline">&nbsp;</span>
                            </div>
                        </div>


                        <legend><?php echo app('translator')->getFromJson('app.property_detail'); ?></legend>

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

                                <p class="help-block"><?php echo app('translator')->getFromJson('app.square_unit_space_help_text'); ?> </p>
                            </div>
                        </div>

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

                            </div>
                        </div>

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

                            </div>
                        </div>

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

                            </div>
                        </div>

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

                            </div>
                        </div>

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

                            </div>
                        </div>


                        <div class="form-group">
                            <label for="additional_details" class="col-sm-4 control-label"><?php echo app('translator')->getFromJson('app.additional_details'); ?></label>
                            <div class="col-sm-8">
                                <label><input type="checkbox" value="1" name="dining_space" <?php if($ad->dining_space == 1): ?> checked="checked" <?php endif; ?>  /> <?php echo app('translator')->getFromJson('app.dining_space'); ?> </label>
                                <label><input type="checkbox" value="1" name="living_room"  <?php if($ad->living_room == 1): ?> checked="checked" <?php endif; ?> /> <?php echo app('translator')->getFromJson('app.living_room'); ?> </label>
                            </div>
                        </div>

                        <legend><?php echo app('translator')->getFromJson('app.amenities'); ?></legend>

                        <?php $saved_amenities = (array) unserialize($ad->amenities); ?>
                        <div class="form-group type_checkbox">
                            <div class="col-sm-12">
                                <?php if($categories->count() > 0): ?>
                                    <?php $__currentLoopData = $categories; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $category): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                        <label> <input type="checkbox" value="<?php echo e($category->id); ?>" name="amenities[<?php echo e($category->id); ?>]" <?php if(in_array($category->id ,$saved_amenities)): ?> checked="checked" <?php endif; ?> > <?php echo e($category->category_name); ?> </label>
                                    <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                <?php endif; ?>
                            </div>
                        </div>

                        <?php if($distances->count() > 0): ?>

                            <legend><?php echo app('translator')->getFromJson('app.distances'); ?></legend>

                            <?php $saved_distances = unserialize($ad->distances); ?>
                            <?php $__currentLoopData = $distances; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $distance): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                <?php $existing_value = (! empty($saved_distances[$distance->id]) ) ? $saved_distances[$distance->id] : '';  ?>
                                <div class="form-group">
                                    <label class="col-lg-3 control-label"><?php echo e($distance->brand_name); ?></label>
                                    <div class="col-lg-6">
                                        <input type="text" placeholder="<?php echo e($distance->brand_name); ?>"  class="form-control" value="<?php echo e($existing_value); ?>" name="distances[<?php echo e($distance->id); ?>]">
                                    </div>
                                    <div class="col-lg-3">
                                        meters
                                    </div>
                                </div>
                            <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                        <?php endif; ?>

                        <legend><?php echo app('translator')->getFromJson('app.image'); ?></legend>

                        <div class="form-group <?php echo e($errors->has('images')? 'has-error':''); ?>">
                            <div class="col-sm-12">

                                <?php if($ad->media_img->count() > 0): ?>
                                    <?php $__currentLoopData = $ad->media_img; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $img): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                        <div class="creating-ads-img-wrap">
                                            <img src="<?php echo e(media_url($img, false)); ?>" class="img-responsive" />
                                            <div class="img-action-wrap" id="<?php echo e($img->id); ?>">
                                                <a href="javascript:;" class="imgDeleteBtn"><i class="fas fa-trash-alt"></i> </a>
                                            <a href="javascript:;" class="imgFeatureBtn"><i class="<?php echo e($img->is_feature ==1 ? 'fas':'far'); ?> fa-star"></i> </a>
                                            </div>
                                        </div>
                                    <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                <?php endif; ?>

                                <div id="uploaded-ads-image-wrap">

                                    <?php if($ads_images->count() > 0): ?>
                                        <?php $__currentLoopData = $ads_images; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $img): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                            <div class="creating-ads-img-wrap">
                                                <img src="<?php echo e(media_url($img, false)); ?>" class="img-responsive" />
                                                <div class="img-action-wrap" id="<?php echo e($img->id); ?>">
                                                    <a href="javascript:;" class="imgDeleteBtn"><i class="fas fa-trash-alt"></i> </a>
                                                    <a href="javascript:;" class="imgFeatureBtn"><i class="<?php echo e($img->is_feature ==1 ? 'fas':'far'); ?> fa-star"></i> </a>
                                                    
                                                </div>
                                            </div>
                                        <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                    <?php endif; ?>
                                </div>

                                <div class="file-upload-wrap">
                                    <label>
                                        <input type="file" name="images" id="images" style="display: none;" />
                                        <i class="fas fa-cloud-upload-alt"></i>
                                        <p><?php echo app('translator')->getFromJson('app.upload_image'); ?></p>

                                        <div class="progress" style="display: none;"></div>

                                    </label>
                                </div>

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

                            </div>
                        </div>

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

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


                        <legend><?php echo app('translator')->getFromJson('app.location_info'); ?></legend>

                        <div class="form-group  <?php echo e($errors->has('country')? 'has-error':''); ?>">
                            <label for="category_name" class="col-sm-4 control-label"><?php echo app('translator')->getFromJson('app.country'); ?></label>
                            <div class="col-sm-8">
                                <select class="form-control select2" name="country">
                                    <option value=""><?php echo app('translator')->getFromJson('app.select_a_country'); ?></option>

                                    <?php $__currentLoopData = $countries; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $country): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                        <option value="<?php echo e($country->id); ?>" <?php echo e($ad->country_id == $country->id ? 'selected' :''); ?>><?php echo e($country->country_name); ?></option>
                                    <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                </select>
                                <?php echo $errors->has('country')? '<p class="help-block">'.$errors->first('country').'</p>':''; ?>

                            </div>
                        </div>

                        <div class="form-group  <?php echo e($errors->has('state')? 'has-error':''); ?>">
                            <label for="category_name" class="col-sm-4 control-label"><?php echo app('translator')->getFromJson('app.state'); ?></label>
                            <div class="col-sm-8">
                                <select class="form-control select2" id="state_select" name="state">
                                    <?php if($previous_states->count() > 0): ?>
                                        <?php $__currentLoopData = $previous_states; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $state): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                        <option value="<?php echo e($state->id); ?>" <?php echo e($ad->state_id == $state->id ? 'selected' :''); ?>><?php echo e($state->state_name); ?></option>
                                        <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                    <?php endif; ?>
                                </select>
                                <p class="text-info">
                                    <span id="state_loader" style="display: none;"><i class="fa fa-spin fa-spinner"></i> </span>
                                </p>
                            </div>
                        </div>

                        <div class="form-group  <?php echo e($errors->has('city')? 'has-error':''); ?>">
                            <label for="category_name" class="col-sm-4 control-label"><?php echo app('translator')->getFromJson('app.city'); ?></label>
                            <div class="col-sm-8">
                                <select class="form-control select2" id="city_select" name="city">
                                    <?php if($previous_cities->count() > 0): ?>
                                        <?php $__currentLoopData = $previous_cities; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $city): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                        <option value="<?php echo e($city->id); ?>" <?php echo e($ad->city_id == $city->id ? 'selected':''); ?>><?php echo e($city->city_name); ?></option>
                                        <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                    <?php endif; ?>
                                </select>
                                <p class="text-info">
                                    <span id="city_loader" style="display: none;"><i class="fa fa-spin fa-spinner"></i> </span>
                                </p>
                            </div>
                        </div>


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

                            </div>
                        </div>

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


                        <legend style="display:none;"><?php echo app('translator')->getFromJson('app.seller_info'); ?></legend>

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

                            </div>
                        </div>

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

                            </div>
                        </div>


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

                            </div>
                        </div>

                   


                        <div class="form-group <?php echo e($errors->has('price_plan')? 'has-error':''); ?>" style="display:none;">
                            <label for="price_plan" class="col-sm-4 control-label"><?php echo app('translator')->getFromJson('app.price_plan'); ?></label>
                            <select value="<?php echo e(ucfirst($ad->price_plan)); ?>">
                            <option value ='regular'><div class="col-sm-8">
                                regular
                            </div></option>
                            <option value='premium'><div class="col-sm-8">
                                premium
                            </div></option>
                            </select>
                        </div>

                        <hr />

                        <div class="form-group">
                            <div class="col-sm-offset-4 col-sm-8">
                                <button type="submit" class="btn btn-primary"><?php echo app('translator')->getFromJson('app.edit_ad'); ?></button>
                            </div>
                        </div>
                        <?php echo e(Form::close()); ?>


                    </div>

                </div>

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

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


    </div> <!-- /#container -->

<?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 myLatLng = {lat: <?php echo e($ad->latitude ? $ad->latitude : get_option('default_latitude')); ?>, lng: <?php echo e($ad->longitude ? $ad->longitude : get_option('default_longitude')); ?> };

            var map = new google.maps.Map(document.getElementById('dvMap'), {
                center: myLatLng,
                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#latitude').val(e.latLng.lat());
                $('input#longitude').val(e.latLng.lng());
            });

            var marker = new google.maps.Marker({
                position: myLatLng,
                map: map,
                title: '<?php echo e($ad->title); ?>'
            });
            marker.setMap(map);

            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>

        function generate_option_from_json(jsonData, fromLoad){

            //Load Category Json Data To Brand Select
            if (fromLoad === 'category_to_brand'){
                var option = '';
                if (jsonData.length > 0) {
                    option += '<option value="0" selected> <?php echo trans('app.select_a_brand') ?> </option>';
                    for ( i in jsonData){
                        option += '<option value="'+jsonData[i].id+'"> '+jsonData[i].brand_name +' </option>';
                    }
                    $('#brand_select').html(option);
                    $('#brand_select').select2();
                }else {
                    $('#brand_select').html('');
                    $('#brand_select').select2();
                }
                $('#brand_loader').hide('slow');
            }else if(fromLoad === 'country_to_state'){
                var option = '';
                if (jsonData.length > 0) {
                    option += '<option value="0" selected> <?php echo app('translator')->getFromJson('app.select_state'); ?> </option>';
                    for ( i in jsonData){
                        option += '<option value="'+jsonData[i].id+'"> '+jsonData[i].state_name +' </option>';
                    }
                    $('#state_select').html(option);
                    $('#state_select').select2();
                }else {
                    $('#state_select').html('');
                    $('#state_select').select2();
                }
                $('#state_loader').hide('slow');

            }else if(fromLoad === 'state_to_city'){
                var option = '';
                if (jsonData.length > 0) {
                    option += '<option value="0" selected> <?php echo app('translator')->getFromJson('app.select_city'); ?> </option>';
                    for ( i in jsonData){
                        option += '<option value="'+jsonData[i].id+'"> '+jsonData[i].city_name +' </option>';
                    }
                    $('#city_select').html(option);
                    $('#city_select').select2();
                }else {
                    $('#city_select').html('');
                    $('#city_select').select2();
                }
                $('#city_loader').hide('slow');

            }

        }


        $(document).ready(function(){
            $('[name="category"]').change(function(){
                var category_id = $(this).val();
                $('#brand_loader').show();

                $.ajax({
                    type : 'POST',
                    url : '<?php echo e(route('get_brand_by_category')); ?>',
                    data : { category_id : category_id,  _token : '<?php echo e(csrf_token()); ?>' },
                    success : function (data) {
                        generate_option_from_json(data, 'category_to_brand');
                    }
                });
            });


            $('[name="country"]').change(function(){
                var country_id = $(this).val();
                $('#state_loader').show();
                $.ajax({
                    type : 'POST',
                    url : '<?php echo e(route('get_state_by_country')); ?>',
                    data : { country_id : country_id,  _token : '<?php echo e(csrf_token()); ?>' },
                    success : function (data) {
                        generate_option_from_json(data, 'country_to_state');
                    }
                });
            });

            $('[name="state"]').change(function(){
                var state_id = $(this).val();
                $('#city_loader').show();
                $.ajax({
                    type : 'POST',
                    url : '<?php echo e(route('get_city_by_state')); ?>',
                    data : { state_id : state_id,  _token : '<?php echo e(csrf_token()); ?>' },
                    success : function (data) {
                        generate_option_from_json(data, 'state_to_city');
                    }
                });
            });

            $("#images").change(function() {
                var fd = new FormData(document.querySelector("form#adsPostForm"));
                //$('#loadingOverlay').show();
                $('.progress').show();
                $.ajax({
                    url : '<?php echo e(route('upload_ads_image')); ?>',
                    type: "POST",
                    data: fd,

                    xhr: function() {
                        var xhr = new window.XMLHttpRequest();
                        xhr.upload.addEventListener("progress", function(evt) {
                            if (evt.lengthComputable) {
                                var percentComplete = evt.loaded / evt.total;
                                percentComplete = parseInt(percentComplete * 100);
                                //console.log(percentComplete);

                                var progress_bar = '<div class="progress-bar progress-bar-success" role="progressbar" aria-valuenow="0" aria-valuemin="0" aria-valuemax="100" style="width: '+percentComplete+'%">'+percentComplete+'% </div>';

                                if (percentComplete === 100) {
                                    $('.progress').hide();
                                }
                            }
                        }, false);

                        return xhr;
                    },

                    cache: false,
                    processData: false,  // tell jQuery not to process the data
                    contentType: false,   // tell jQuery not to set contentType
                    success : function (data) {
                        //$('#loadingOverlay').hide('slow');
                        if (data.success == 1){
                            $('#uploaded-ads-image-wrap').load('<?php echo e(route('append_media_image')); ?>');
                        } else{
                            toastr.error(data.msg, '<?php echo trans('app.error') ?>', toastr_options);
                        }
                    }
                });
            });


            $('body').on('click', '.imgDeleteBtn', function(){
                //Get confirm from user
                if ( ! confirm('<?php echo e(trans('app.are_you_sure')); ?>')){
                    return '';
                }

                var current_selector = $(this);
                var img_id = $(this).closest('.img-action-wrap').attr('id');
                $.ajax({
                    url : '<?php echo e(route('delete_media')); ?>',
                    type: "POST",
                    data: { media_id : img_id, _token : '<?php echo e(csrf_token()); ?>' },
                    success : function (data) {
                        if (data.success == 1){
                            current_selector.closest('.creating-ads-img-wrap').hide('slow');
                            toastr.success(data.msg, '<?php echo app('translator')->getFromJson('app.success'); ?>', toastr_options);
                        }
                    }
                });
            });
            $('body').on('click', '.imgFeatureBtn', function(){
                var img_id = $(this).closest('.img-action-wrap').attr('id');
                var current_selector = $(this);

                $.ajax({
                    url : '<?php echo e(route('feature_media_creating_ads')); ?>',
                    type: "POST",
                    data: { media_id : img_id, _token : '<?php echo e(csrf_token()); ?>' },
                    success : function (data) {
                        if (data.success == 1){
                            $('.imgFeatureBtn').html('<i class="fas fa-star"></i>');
                            current_selector.html('<i class="far fa-star"></i>');
                            toastr.success(data.msg, '<?php echo app('translator')->getFromJson('app.success'); ?>', toastr_options);
                        }
                    }
                });
            });

        });
    </script>


    <script>
        <?php if(session('success')): ?>
            toastr.success('<?php echo e(session('success')); ?>', '<?php echo trans('app.success') ?>', toastr_options);
        <?php endif; ?>
    </script>
<?php $__env->stopSection(); ?>
<?php echo $__env->make('layout.main', \Illuminate\Support\Arr::except(get_defined_vars(), array('__data', '__path')))->render(); ?>