| 1 |
<?php |
| 2 |
/** |
| 3 |
* The template for Edit Search Form. |
| 4 |
* |
| 5 |
* This is the template that form edit |
| 6 |
* |
| 7 |
*/ |
| 8 |
|
| 9 |
if ( ! defined( 'ABSPATH' ) ) { |
| 10 |
exit; // Exit if accessed directly. |
| 11 |
} |
| 12 |
?> |
| 13 |
|
| 14 |
<!-- This file should primarily consist of HTML with a little bit of PHP. --> |
| 15 |
|
| 16 |
<div class="wrap wdk-wrap"> |
| 17 |
|
| 18 |
<h1 class="wp-heading-inline"><?php echo __('Search Form Designer','wpdirectorykit'); ?></h1> |
| 19 |
<br /><br /> |
| 20 |
|
| 21 |
<div class="wdk-body"> |
| 22 |
<form method="post" action="<?php echo wmvc_current_edit_url(); ?>" novalidate="novalidate"> |
| 23 |
<?php wp_nonce_field( 'wdk-searchform-edit_'.wmvc_show_data('idsearchform', $db_data, 0), '_wpnonce'); ?> |
| 24 |
<div class="postbox" style="display: block;"> |
| 25 |
<div class="postbox-header"> |
| 26 |
<h3><?php echo __('Main info','wpdirectorykit'); ?></h3> |
| 27 |
</div> |
| 28 |
<div class="inside"> |
| 29 |
<?php |
| 30 |
$form->messages('class="alert alert-danger"', __('Successfully saved', 'wpdirectorykit')); |
| 31 |
?> |
| 32 |
|
| 33 |
<table class="form-table" role="presentation"> |
| 34 |
<tbody> |
| 35 |
<tr> |
| 36 |
<th scope="row"><label for="searchform_name"><?php echo __('Name','wpdirectorykit'); ?></label></th> |
| 37 |
<td><input name="searchform_name" type="text" id="searchform_name" value="<?php echo wmvc_show_data('searchform_name', $db_data, ''); ?>" class="regular-text"></td> |
| 38 |
</tr> |
| 39 |
<tr class="hidden"> |
| 40 |
<th scope="row"><label for="searchform_json"><?php echo __('Search Form Json/Structure','wpdirectorykit'); ?></label></th> |
| 41 |
<td> |
| 42 |
<textarea readonly="readonly" name="searchform_json" type="text" id="searchform_json" class="regular-text"><?php echo esc_textarea(wmvc_show_data('searchform_json', $db_data, '')); ?></textarea> |
| 43 |
</td> |
| 44 |
</tr> |
| 45 |
</tbody> |
| 46 |
</table> |
| 47 |
</div> |
| 48 |
</div> |
| 49 |
|
| 50 |
<div class="postbox" style="display: block;"> |
| 51 |
<div class="postbox-header"> |
| 52 |
<h3><?php echo __('Helper Classes','wpdirectorykit'); ?></h3> |
| 53 |
</div> |
| 54 |
<div class="inside"> |
| 55 |
<div class="" style="border: 1px solid rgb(207, 210, 210); background-color: #eee;padding: 10px 15px;"> |
| 56 |
<dl class="dl-helper"> |
| 57 |
<dt>hidden</dt> |
| 58 |
<dd style="margin-left: 25px;"><?php echo __('Hide field on all','wpdirectorykit'); ?></dd> |
| 59 |
<dt>wdk-col-1,wdk-col-2,wdk-col-3,wdk-col-4, wdk-col-n ... 12</dt> |
| 60 |
<dd style="margin-left: 25px;"><?php echo __('Grid classes from 1 to 12','wpdirectorykit'); ?></dd> |
| 61 |
</dl> |
| 62 |
</div> |
| 63 |
</div> |
| 64 |
</div> |
| 65 |
|
| 66 |
<?php |
| 67 |
$main_fields = array(); |
| 68 |
$predefined_fields_array = array( |
| 69 |
'search'=> array( |
| 70 |
'idfield'=> 'search', |
| 71 |
'field_type'=> 'SMART_SEARCH', |
| 72 |
'field_label'=> '', |
| 73 |
), |
| 74 |
'post_title'=>array( |
| 75 |
'idfield'=> 'post_title', |
| 76 |
'field_type'=> 'INPUTBOX', |
| 77 |
'field_label'=> 'Title', |
| 78 |
), |
| 79 |
'address'=>array( |
| 80 |
'idfield'=> 'address', |
| 81 |
'field_type'=> 'INPUTBOX', |
| 82 |
'field_label'=> '', |
| 83 |
), |
| 84 |
'cat'=>array( |
| 85 |
'idfield'=> 'cat', |
| 86 |
'field_type'=> 'CATEGORY', |
| 87 |
'field_label'=> '', |
| 88 |
), |
| 89 |
'loc'=>array( |
| 90 |
'idfield'=> 'loc', |
| 91 |
'field_type'=> 'LOCATION', |
| 92 |
'field_label'=> '', |
| 93 |
), |
| 94 |
'more'=>array( |
| 95 |
'idfield'=> 'more', |
| 96 |
'field_type'=> 'MORE', |
| 97 |
'field_label'=> '', |
| 98 |
), |
| 99 |
); |
| 100 |
|
| 101 |
if(function_exists('run_wdk_bookings')) { |
| 102 |
$predefined_fields_array['booking_date'] = array( |
| 103 |
'idfield'=> 'booking_date', |
| 104 |
'field_type'=> 'BOOKINGS_DATE', |
| 105 |
'field_label'=> '', |
| 106 |
); |
| 107 |
} |
| 108 |
|
| 109 |
foreach ($predefined_fields_array as $value) { |
| 110 |
$predefined_field = new stdClass(); |
| 111 |
$predefined_field->idfield = $value['idfield']; |
| 112 |
$predefined_field->lang_code = NULL; |
| 113 |
$predefined_field->field_type = $value['field_type']; |
| 114 |
$predefined_field->field_label = $value['field_label']; |
| 115 |
|
| 116 |
$fields [] = $predefined_field ; |
| 117 |
$main_fields [] = $predefined_field; |
| 118 |
} |
| 119 |
?> |
| 120 |
|
| 121 |
<div class="postbox" style="display: block;"> |
| 122 |
<div class="postbox-header"><h3><?php echo __('Drag & Drop Builder','wpdirectorykit'); ?></h3> |
| 123 |
</div> |
| 124 |
<div class="inside"> |
| 125 |
<p class="alert alert-info"><?php echo __('Drag fields from left side to right side, right side represents search form','wpdirectorykit'); ?></p> |
| 126 |
<div class="wdk-builder-container"> |
| 127 |
<div class="wdk-builder-elements-column"> |
| 128 |
<div class="wdk-builder-elements-box"> |
| 129 |
<h3 class="sec-title"><?php echo __('Custom fields','wpdirectorykit'); ?></h3> |
| 130 |
<div id="wdk-drag" class="wdk-builder-elements wdk-drop section_fields"> |
| 131 |
<?php foreach($main_fields as $key => $field): |
| 132 |
if(isset($used_fields[$field->idfield]))continue; // skip if field is used |
| 133 |
?> |
| 134 |
<div id="fid_<?php echo esc_attr($field->idfield); ?>" class="widget ui-draggable" rel="<?php echo esc_attr($field->idfield); ?>"> |
| 135 |
<div class="widget-top"> |
| 136 |
<div class="widget-title-action"> |
| 137 |
<button type="button" class="widget-action hide-if-no-js" aria-expanded="false"> |
| 138 |
<span class="toggle-indicator" aria-hidden="true"></span> |
| 139 |
</button> |
| 140 |
</div> |
| 141 |
<div class="widget-title ui-draggable-handle"><h3>#<?php echo esc_html($field->idfield); ?> [<?php echo esc_html($field->field_type); ?>] <?php echo esc_html($field->field_label); ?><span class="in-widget-title"></span></h3></div> |
| 142 |
</div> |
| 143 |
<div class="widget-inside"> |
| 144 |
<div class="widget-content"> |
| 145 |
<p> |
| 146 |
<label for="fid_<?php echo esc_attr($field->idfield); ?>-class"><?php echo __('CSS Class:','wpdirectorykit'); ?></label> |
| 147 |
<input class="widefat class" id="fid_<?php echo esc_attr($field->idfield); ?>-class" name="fid_<?php echo esc_attr($field->idfield); ?>-class" type="text" value=""> |
| 148 |
</p> |
| 149 |
<p> |
| 150 |
<label for="fid_<?php echo esc_attr($field->idfield); ?>-columns"><?php echo __('Columns/Width:','wpdirectorykit'); ?></label> |
| 151 |
<input class="widefat columns" id="fid_<?php echo esc_attr($field->idfield); ?>-columns" name="fid_<?php echo esc_attr($field->idfield); ?>-columns" type="number" value=""> |
| 152 |
</p> |
| 153 |
<p> |
| 154 |
<label for="fid_<?php echo esc_attr($field->idfield); ?>-query_type"><?php echo __('Search type:','wpdirectorykit'); ?></label> |
| 155 |
<select class="widefat query_type" id="fid_<?php echo esc_attr($field->idfield); ?>-query_type" name="fid_<?php echo esc_attr($field->idfield); ?>-query_type"> |
| 156 |
<option value=""><?php echo __('None','wpdirectorykit'); ?></option> |
| 157 |
<option value="exactly"><?php echo __('Exactly','wpdirectorykit'); ?></option> |
| 158 |
</select> |
| 159 |
</p> |
| 160 |
</div> |
| 161 |
</div> |
| 162 |
</div> |
| 163 |
<?php endforeach; ?> |
| 164 |
<?php foreach($fields as $key => $field): |
| 165 |
if(isset($used_fields[$field->idfield]))continue; // skip if field is used |
| 166 |
|
| 167 |
if(in_array($field->idfield, array('search','loc','cat','address','post_title','more','booking_date')) !== FALSE)continue; // skip if field is used |
| 168 |
?> |
| 169 |
<?php if($field->field_type=='SECTION'):?> |
| 170 |
</div> |
| 171 |
</div> |
| 172 |
<div class="wdk-builder-elements-box"> |
| 173 |
<h3 class="sec-title"><?php echo esc_html($field->field_label); ?></h3> |
| 174 |
<div id="wdk-drag" class="wdk-builder-elements wdk-drop section_fields" data-name="<?php echo esc_html($field->field_label); ?>"> |
| 175 |
<?php continue; endif;?> |
| 176 |
|
| 177 |
<div id="fid_<?php echo esc_attr($field->idfield); ?>" class="widget ui-draggable" rel="<?php echo esc_attr($field->idfield); ?>"> |
| 178 |
<div class="widget-top"> |
| 179 |
<div class="widget-title-action"> |
| 180 |
<button type="button" class="widget-action hide-if-no-js" aria-expanded="false"> |
| 181 |
<span class="toggle-indicator" aria-hidden="true"></span> |
| 182 |
</button> |
| 183 |
</div> |
| 184 |
<div class="widget-title ui-draggable-handle"><h3>#<?php echo esc_html($field->idfield); ?> [<?php echo esc_html($field->field_type); ?>] <?php echo esc_html($field->field_label); ?><span class="in-widget-title"></span></h3></div> |
| 185 |
</div> |
| 186 |
<div class="widget-inside"> |
| 187 |
<div class="widget-content"> |
| 188 |
<p> |
| 189 |
<label for="fid_<?php echo esc_attr($field->idfield); ?>-class"><?php echo __('CSS Class:','wpdirectorykit'); ?></label> |
| 190 |
<input class="widefat class" id="fid_<?php echo esc_attr($field->idfield); ?>-class" name="fid_<?php echo esc_attr($field->idfield); ?>-class" type="text" value=""> |
| 191 |
</p> |
| 192 |
<p> |
| 193 |
<label for="fid_<?php echo esc_attr($field->idfield); ?>-columns"><?php echo __('Columns/Width:','wpdirectorykit'); ?></label> |
| 194 |
<input class="widefat columns" id="fid_<?php echo esc_attr($field->idfield); ?>-columns" name="fid_<?php echo esc_attr($field->idfield); ?>-columns" type="number" value=""> |
| 195 |
</p> |
| 196 |
<p class=" <?php if($field->field_type =='CHECKBOX' || $field->field_type =='MORE' || $field->field_type =='TEXTAREA' || $field->field_type =='TEXTAREA_WYSIWYG' || $field->field_type =='CATEGORY' || $field->field_type =='LOCATION'):?> hidden <?php endif;?>"> |
| 197 |
<label for="fid_<?php echo esc_attr($field->idfield); ?>-query_type"><?php echo __('Search type:','wpdirectorykit'); ?></label> |
| 198 |
<select class="widefat query_type" id="fid_<?php echo esc_attr($field->idfield); ?>-query_type" name="fid_<?php echo esc_attr($field->idfield); ?>-query_type"> |
| 199 |
<option value=""><?php echo __('None','wpdirectorykit'); ?></option> |
| 200 |
<option value="exactly"><?php echo __('Exactly','wpdirectorykit'); ?></option> |
| 201 |
<?php if(in_array($field->idfield, array('search','loc','cat','address','post_title')) == FALSE && $field->field_type !='CHECKBOX'):?> |
| 202 |
<option value="min"><?php echo __('Min','wpdirectorykit'); ?></option> |
| 203 |
<option value="max"><?php echo __('Max','wpdirectorykit'); ?></option> |
| 204 |
<option value="min_max"><?php echo __('Min/Max','wpdirectorykit'); ?></option> |
| 205 |
<?php endif;?> |
| 206 |
<?php if(in_array($field->idfield, array('search','loc','cat','address','post_title')) == FALSE && $field->field_type =='NUMBER'):?> |
| 207 |
<option value="slider_range"><?php echo __('Slider Range','wpdirectorykit'); ?></option> |
| 208 |
<?php endif;?> |
| 209 |
</select> |
| 210 |
</p> |
| 211 |
<?php if(in_array($field->idfield, array('search','loc','cat','address','post_title')) == FALSE && $field->field_type =='NUMBER'):?> |
| 212 |
<p class="is_slider_range <?php if($field->query_type !='slider_range'):?> hidden <?php endif;?>"> |
| 213 |
<label for="fid_<?php echo esc_attr($field->idfield); ?>-value_min"><?php echo __('Value Min:','wpdirectorykit'); ?></label> |
| 214 |
<input class="widefat value_min" id="fid_<?php echo esc_attr($field->idfield); ?>-value_min" name="fid_<?php echo esc_attr($field->idfield); ?>-value_min" type="number" value=""> |
| 215 |
</p> |
| 216 |
<p class="is_slider_range <?php if($field->query_type !='slider_range'):?> hidden <?php endif;?>"> |
| 217 |
<label for="fid_<?php echo esc_attr($field->idfield); ?>-value_max"><?php echo __('Value Max:','wpdirectorykit'); ?></label> |
| 218 |
<input class="widefat value_max" id="fid_<?php echo esc_attr($field->idfield); ?>-value_max" name="fid_<?php echo esc_attr($field->idfield); ?>-value_max" type="number" value=""> |
| 219 |
</p> |
| 220 |
<?php endif;?> |
| 221 |
</div> |
| 222 |
</div> |
| 223 |
</div> |
| 224 |
<?php endforeach; ?> |
| 225 |
</div> |
| 226 |
</div> |
| 227 |
</div> |
| 228 |
<div class="drop-container"> |
| 229 |
<?php |
| 230 |
$WMVC = &wdk_get_instance(); |
| 231 |
$WMVC->model('field_m'); |
| 232 |
|
| 233 |
|
| 234 |
?> |
| 235 |
<div id="wdk-drop" class="wdk-builder-selected wdk-drop"> |
| 236 |
<?php if(is_array($used_fields)) |
| 237 |
foreach($used_fields as $used_field): |
| 238 |
if(isset($predefined_fields_array[$used_field->field_id])) { |
| 239 |
$field = $predefined_fields_array[$used_field->field_id]; |
| 240 |
} else { |
| 241 |
$field = $WMVC->field_m->get_fields_data($used_field->field_id); |
| 242 |
} |
| 243 |
|
| 244 |
//if(!isset($used_fields[$field->idfield]))continue; // skip if field is not used |
| 245 |
?> |
| 246 |
<div id="fid_<?php echo esc_attr(wmvc_show_data('idfield', $field)); ?>" class="widget ui-draggable" rel="<?php echo esc_attr(wmvc_show_data('idfield', $field)); ?>"> |
| 247 |
<div class="widget-top"> |
| 248 |
<div class="widget-title-action"> |
| 249 |
<button type="button" class="widget-action hide-if-no-js" aria-expanded="false"> |
| 250 |
<span class="toggle-indicator" aria-hidden="true"></span> |
| 251 |
</button> |
| 252 |
</div> |
| 253 |
<div class="widget-title ui-draggable-handle"><h3>#<?php echo esc_html(wmvc_show_data('idfield', $field)); ?> [<?php echo esc_html(wmvc_show_data('field_type', $field)); ?>] <?php echo esc_html(wmvc_show_data('field_label', $field)); ?><span class="in-widget-title"></span></h3></div> |
| 254 |
</div> |
| 255 |
<div class="widget-inside"> |
| 256 |
<div class="widget-content"> |
| 257 |
<p> |
| 258 |
<label for="fid_<?php echo esc_attr(wmvc_show_data('idfield', $field)); ?>-class"><?php echo __('CSS Class:','wpdirectorykit'); ?></label> |
| 259 |
<input class="widefat class" id="fid_<?php echo esc_attr(wmvc_show_data('idfield', $field)); ?>-class" name="fid_<?php echo esc_attr(wmvc_show_data('idfield', $field)); ?>-class" type="text" value="<?php echo wmvc_show_data('class', $used_fields[wmvc_show_data('idfield', $field)], ''); ?>"> |
| 260 |
</p> |
| 261 |
<p> |
| 262 |
<label for="fid_<?php echo esc_attr(wmvc_show_data('idfield', $field)); ?>-columns"><?php echo __('Columns/Width:','wpdirectorykit'); ?></label> |
| 263 |
<input class="widefat columns" id="fid_<?php echo esc_attr(wmvc_show_data('idfield', $field)); ?>-columns" name="fid_<?php echo esc_attr(wmvc_show_data('idfield', $field)); ?>-columns" type="number" value="<?php echo wmvc_show_data('columns', $used_fields[wmvc_show_data('idfield', $field)], ''); ?>"> |
| 264 |
</p> |
| 265 |
<p class=" <?php if(wmvc_show_data('field_type', $field) =='CHECKBOX' || wmvc_show_data('field_type', $field) =='TEXTAREA' || wmvc_show_data('field_type', $field) =='TEXTAREA_WYSIWYG' || wmvc_show_data('field_type', $field) =='CATEGORY' || wmvc_show_data('field_type', $field) =='LOCATION'):?> hidden <?php endif;?>"> |
| 266 |
<label for="fid_<?php echo esc_attr(wmvc_show_data('idfield', $field)); ?>-query_type"><?php echo __('Search type:','wpdirectorykit'); ?></label> |
| 267 |
<select class="widefat query_type" id="fid_<?php echo esc_attr(wmvc_show_data('idfield', $field)); ?>-query_type" name="fid_<?php echo esc_attr(wmvc_show_data('idfield', $field)); ?>-query_type"> |
| 268 |
<option value=""><?php echo __('None','wpdirectorykit'); ?></option> |
| 269 |
<option value="exactly" <?php if(wmvc_show_data('query_type', $used_fields[wmvc_show_data('idfield', $field)]) == 'exactly'): ?> selected="selected" <?php endif;?>><?php echo __('Exactly','wpdirectorykit'); ?></option> |
| 270 |
<?php if(in_array(wmvc_show_data('idfield', $field), array('search','loc','cat','address','post_title')) == FALSE && wmvc_show_data('field_type', $field) !='CHECKBOX'):?> |
| 271 |
<option value="min" <?php if(wmvc_show_data('query_type', $used_fields[wmvc_show_data('idfield', $field)]) == 'min'): ?> selected="selected" <?php endif;?>><?php echo __('Min','wpdirectorykit'); ?></option> |
| 272 |
<option value="max" <?php if(wmvc_show_data('query_type', $used_fields[wmvc_show_data('idfield', $field)]) == 'max'): ?> selected="selected" <?php endif;?>><?php echo __('Max','wpdirectorykit'); ?></option> |
| 273 |
<option value="min_max" <?php if(wmvc_show_data('query_type', $used_fields[wmvc_show_data('idfield', $field)]) == 'min_max'): ?> selected="selected" <?php endif;?>><?php echo __('Min/Max','wpdirectorykit'); ?></option> |
| 274 |
<?php endif;?> |
| 275 |
<?php if(in_array(wmvc_show_data('idfield', $field), array('search','loc','cat','address','post_title')) == FALSE && wmvc_show_data('field_type', $field) =='NUMBER'):?> |
| 276 |
<option value="slider_range" <?php if(wmvc_show_data('query_type', $used_fields[wmvc_show_data('idfield', $field)]) == 'slider_range'): ?> selected="selected" <?php endif;?>><?php echo __('Slider Range','wpdirectorykit'); ?></option> |
| 277 |
<?php endif;?> |
| 278 |
</select> |
| 279 |
</p> |
| 280 |
<?php if(in_array(wmvc_show_data('idfield', $field), array('search','loc','cat','address','post_title')) == FALSE && wmvc_show_data('field_type', $field) =='NUMBER'):?> |
| 281 |
<p class="is_slider_range <?php if(wmvc_show_data('query_type', $used_fields[wmvc_show_data('idfield', $field)]) !='slider_range'):?> hidden <?php endif;?>"> |
| 282 |
<label for="fid_<?php echo esc_attr(wmvc_show_data('idfield', $field)); ?>-value_min"><?php echo __('Value Min:','wpdirectorykit'); ?></label> |
| 283 |
<input class="widefat value_min" id="fid_<?php echo esc_attr(wmvc_show_data('idfield', $field)); ?>-value_min" name="fid_<?php echo esc_attr(wmvc_show_data('idfield', $field)); ?>-value_min" type="number" value="<?php echo wmvc_show_data('value_min', $used_fields[wmvc_show_data('idfield', $field)], ''); ?>"> |
| 284 |
</p> |
| 285 |
<p class="is_slider_range <?php if(wmvc_show_data('query_type', $used_fields[wmvc_show_data('idfield', $field)]) !='slider_range'):?> hidden <?php endif;?>"> |
| 286 |
<label for="fid_<?php echo esc_attr(wmvc_show_data('idfield', $field)); ?>-value_max"><?php echo __('Value Max:','wpdirectorykit'); ?></label> |
| 287 |
<input class="widefat value_max" id="fid_<?php echo esc_attr(wmvc_show_data('idfield', $field)); ?>-value_max" name="fid_<?php echo esc_attr(wmvc_show_data('idfield', $field)); ?>-value_max" type="number" value="<?php echo wmvc_show_data('value_max', $used_fields[wmvc_show_data('idfield', $field)], ''); ?>"> |
| 288 |
</p> |
| 289 |
<?php endif;?> |
| 290 |
</div> |
| 291 |
</div> |
| 292 |
</div> |
| 293 |
<?php endforeach; ?> |
| 294 |
</div> |
| 295 |
</div> |
| 296 |
<br style="clear:both;" /> |
| 297 |
</div> |
| 298 |
<input type="submit" name="submit" id="submit" class="button button-primary" value="<?php echo esc_html__('Save Changes','wpdirectorykit'); ?>"> |
| 299 |
</div> |
| 300 |
</div> |
| 301 |
</form> |
| 302 |
</div> |
| 303 |
|
| 304 |
</div> |
| 305 |
|
| 306 |
<?php |
| 307 |
wp_enqueue_script( 'jquery-ui-core', false, array('jquery') ); |
| 308 |
wp_enqueue_script( 'jquery-ui-sortable', false, array('jquery') ); |
| 309 |
?> |
| 310 |
|
| 311 |
<script> |
| 312 |
// Generate table |
| 313 |
jQuery(document).ready(function($) { |
| 314 |
|
| 315 |
$( "#wdk-drag, #wdk-drop" ).sortable({ |
| 316 |
connectWith: ".wdk-drop", |
| 317 |
placeholder: "ui-sortable-placeholder widget-placeholder", |
| 318 |
update: function(event, ui) { |
| 319 |
save_data(); |
| 320 |
} |
| 321 |
}).disableSelection(); |
| 322 |
|
| 323 |
$('button.widget-action').on('click', function(){ |
| 324 |
if($(this).attr("aria-expanded") == 'true') |
| 325 |
{ |
| 326 |
$(this).attr("aria-expanded", 'false'); |
| 327 |
$(this).parent().parent().parent().find('.widget-inside').hide(); |
| 328 |
} |
| 329 |
else |
| 330 |
{ |
| 331 |
$(this).attr("aria-expanded", 'true'); |
| 332 |
$(this).parent().parent().parent().find('.widget-inside').show(); |
| 333 |
} |
| 334 |
}); |
| 335 |
|
| 336 |
$('.wdk-builder-container').find('input,select').on('input', save_data); |
| 337 |
|
| 338 |
$('.wdk-builder-container').find('select.query_type').on('input', function(e){ |
| 339 |
if($(this).find('option:selected').attr('value') == 'slider_range') { |
| 340 |
$(this).closest('.widget-content').find('.is_slider_range').removeClass('hidden'); |
| 341 |
} else { |
| 342 |
$(this).closest('.widget-content').find('.is_slider_range').addClass('hidden'); |
| 343 |
} |
| 344 |
}); |
| 345 |
|
| 346 |
|
| 347 |
function save_data() |
| 348 |
{ |
| 349 |
var data_fields_list = []; |
| 350 |
|
| 351 |
$('#wdk-drop .widget.ui-draggable').each(function( index ) { |
| 352 |
data_fields_list.push({'field_id': $( this ).attr('rel'), |
| 353 |
'class': $( this ).find('input.class').val(), |
| 354 |
'query_type': $( this ).find('select.query_type').val(), |
| 355 |
'value_min': $( this ).find('input.value_min').val(), |
| 356 |
'value_max': $( this ).find('input.value_max').val(), |
| 357 |
'columns': $( this ).find('input.columns').val()}); |
| 358 |
}); |
| 359 |
|
| 360 |
$('#searchform_json').val(JSON.stringify(data_fields_list)); |
| 361 |
} |
| 362 |
}); |
| 363 |
|
| 364 |
</script> |
| 365 |
<?php $this->view('general/footer', $data); ?> |