| 1 |
<?php |
| 2 |
/** |
| 3 |
* The template for Edit Location. |
| 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 |
<!-- This file should primarily consist of HTML with a little bit of PHP. --> |
| 14 |
|
| 15 |
<div class="wrap wdk-wrap"> |
| 16 |
<h1 class="wp-heading-inline"><?php echo __('Location Management','wpdirectorykit'); ?></h1> |
| 17 |
<br /><br /> |
| 18 |
<div class="wdk-body"> |
| 19 |
<div class="postbox" style="display: block;"> |
| 20 |
<div class="postbox-header"><h3><?php echo __('Add/Edit Location','wpdirectorykit'); ?></h3> |
| 21 |
|
| 22 |
<?php if(function_exists('run_wdk_svg_map') && wmvc_show_data('idlocation', $db_data, false)):?> |
| 23 |
<a href="<?php echo esc_url(admin_url( 'admin.php?page=wdk_location&function=import_from_svg&id='. wmvc_show_data('idlocation', $db_data, false) )); ?>" class="wdk-mr-5 button button-secondary alignright"> |
| 24 |
<span class="dashicons dashicons-admin-page" style="margin-top: 4px;"></span><?php echo esc_html__('Import sublocations from SVG Map','wpdirectorykit'); ?> |
| 25 |
</a> |
| 26 |
<?php endif;?> |
| 27 |
</div> |
| 28 |
<div class="inside"> |
| 29 |
|
| 30 |
<form method="post" action="<?php echo esc_url(wmvc_current_edit_url()); ?>" novalidate="novalidate"> |
| 31 |
<?php wp_nonce_field( 'wdk-location-edit_'.wmvc_show_data('idlocation', $db_data, 0), '_wpnonce'); ?> |
| 32 |
<?php |
| 33 |
$form->messages('class="alert alert-danger"', __('Successfully saved', 'wpdirectorykit')); |
| 34 |
?> |
| 35 |
|
| 36 |
<table class="form-table" role="presentation"> |
| 37 |
<tbody> |
| 38 |
<tr> |
| 39 |
<th scope="row"><label for="parent_id"><?php echo __('Parent','wpdirectorykit'); ?></label></th> |
| 40 |
<td> |
| 41 |
<?php |
| 42 |
echo wmvc_select_option('parent_id', $parents, wmvc_show_data('parent_id', $db_data, ''), NULL, __('Root','wpdirectorykit'), '0'); |
| 43 |
?> |
| 44 |
|
| 45 |
</td> |
| 46 |
</tr> |
| 47 |
<tr> |
| 48 |
<th scope="row"><label for="location_title"><?php echo __('Title','wpdirectorykit'); ?></label></th> |
| 49 |
<td><input name="location_title" type="text" id="location_title" value="<?php echo wmvc_show_data('location_title', $db_data, ''); ?>" class="regular-text"></td> |
| 50 |
</tr> |
| 51 |
|
| 52 |
<tr> |
| 53 |
<th scope="row"><label for="order_index"><?php echo __('Order Index','wpdirectorykit'); ?></label></th> |
| 54 |
<td> |
| 55 |
<input name="order_index" type="text" id="order_index" value="<?php echo wmvc_show_data('order_index', $db_data, ''); ?>" class="regular-text"> |
| 56 |
<p class="description" id="order_index-description"><?php echo __('Index for sorting/ordering, you can leave it empty and will be auto added to end of parent list','wpdirectorykit'); ?></p> |
| 57 |
</td> |
| 58 |
</tr> |
| 59 |
<?php if(function_exists('run_wdk_svg_map')):?> |
| 60 |
<tr> |
| 61 |
<th scope="row"><label for="related_svg_map"><?php echo __('Related SVG Map','wpdirectorykit'); ?></label></th> |
| 62 |
<td> |
| 63 |
<?php |
| 64 |
echo wmvc_select_option('related_svg_map', $maps_list, wmvc_show_data('related_svg_map', $db_data, ''), "id='related_svg_map'", __('Not Selected','wpdirectorykit'), '0'); |
| 65 |
?> |
| 66 |
</td> |
| 67 |
</tr> |
| 68 |
<tr> |
| 69 |
<th scope="row"><label for="related_svg_map_location"><?php echo __('Related SVG Map Location','wpdirectorykit'); ?></label></th> |
| 70 |
<td> |
| 71 |
<?php |
| 72 |
echo wmvc_select_option('related_svg_map_location', $map_related_locations, wmvc_show_data('related_svg_map_location', $db_data, ''), "id='related_svg_map_location'", __('Not Selected','wpdirectorykit'), '0'); |
| 73 |
?> |
| 74 |
</td> |
| 75 |
</tr> |
| 76 |
<?php endif;?> |
| 77 |
<tr> |
| 78 |
<th scope="row"><label for="icon_id"><?php echo __('Icon','wpdirectorykit'); ?></label></th> |
| 79 |
<td> |
| 80 |
<?php |
| 81 |
echo wmvc_upload_media('icon_id', wmvc_show_data('icon_id', $db_data, '')); |
| 82 |
?> |
| 83 |
<p class="description" id="icon_id-description"><?php echo __('Icon used for marker/pin on map or special places on website','wpdirectorykit'); ?></p> |
| 84 |
</td> |
| 85 |
</tr> |
| 86 |
<tr> |
| 87 |
<th scope="row"><label for="image_id"><?php echo __('Image','wpdirectorykit'); ?></label></th> |
| 88 |
<td> |
| 89 |
<?php |
| 90 |
echo wmvc_upload_media('image_id', wmvc_show_data('image_id', $db_data, '')); |
| 91 |
?> |
| 92 |
<p class="description" id="image_id-description"><?php echo __('Image used for widgets or elements where categories are visible','wpdirectorykit'); ?></p> |
| 93 |
</td> |
| 94 |
</tr> |
| 95 |
</tbody> |
| 96 |
</table> |
| 97 |
<input type="submit" name="submit" id="submit" class="button button-primary" value="<?php echo esc_html__('Save Changes','wpdirectorykit'); ?>"> |
| 98 |
</form> |
| 99 |
</div> |
| 100 |
</div> |
| 101 |
|
| 102 |
<div class="alert alert-info" role="alert"><?php echo sprintf(__('%1$s How to add new country in locations? %2$s', 'wpdirectorykit'),'<a href="//wpdirectorykit.com/documentation/#add-new-country" target="_blank">','</a>'); ?></div> |
| 103 |
</div> |
| 104 |
</div> |
| 105 |
|
| 106 |
<script> |
| 107 |
var jqxhr = null; |
| 108 |
jQuery(document).ready(function($) { |
| 109 |
$('#related_svg_map').on('input', function(e){ |
| 110 |
e.preventDefault(); |
| 111 |
e.stopPropagation(); |
| 112 |
var self = $(this); |
| 113 |
|
| 114 |
jQuery('#related_svg_map_location').closest('tr').find('label').addClass('wdk_btn_load_indicator out'); |
| 115 |
|
| 116 |
var ajax_param = { |
| 117 |
"action": 'wdk_svg_map_public_action', |
| 118 |
"page": 'wdk_svg_map_frontendajax', |
| 119 |
"function": 'get_map_data', |
| 120 |
}; |
| 121 |
ajax_param['related_svg_map'] = $(this).val(); |
| 122 |
|
| 123 |
// Assign handlers immediately after making the request, |
| 124 |
// and remember the jqxhr object for this request |
| 125 |
if (jqxhr != null) |
| 126 |
jqxhr.abort(); |
| 127 |
|
| 128 |
jqxhr = $.post("<?php echo admin_url( 'admin-ajax.php' );?>", ajax_param, |
| 129 |
function(data){ |
| 130 |
var select_list = '<option value=""> <?php echo esc_js('Not Selected','wpdirectorykit');?> </option>'; |
| 131 |
jQuery.each(data.output.locations, function(i,v){ |
| 132 |
select_list += '<option value="'+i+'"> '+v+' </option>'; |
| 133 |
}); |
| 134 |
|
| 135 |
jQuery('#related_svg_map_location').html(select_list); |
| 136 |
|
| 137 |
}).always(function(data) { |
| 138 |
jQuery('#related_svg_map_location').closest('tr').find('label').removeClass('wdk_btn_load_indicator out'); |
| 139 |
}); |
| 140 |
return false; |
| 141 |
}) |
| 142 |
}) |
| 143 |
|
| 144 |
</script> |
| 145 |
|
| 146 |
<?php $this->view('general/footer', $data); ?> |