PluginProbe
SupportCandy – AI Customer Support Ticket System & Live Chatbot Agent / 2.3.1
SupportCandy – AI Customer Support Ticket System & Live Chatbot Agent v2.3.1
3.5.4 3.5.3 3.5.2 3.5.1 3.4.9 3.5.0 3.4.8 3.4.7 trunk 2.3.1 3.3.6 3.3.7 3.3.8 3.3.9 3.4.0 3.4.1 3.4.2 3.4.3 3.4.4 3.4.5 3.4.6
supportcandy / includes / admin / custom_fields / get_add_agentonly_field.php

get_add_agentonly_field.php in SupportCandy – AI Customer Support Ticket System & Live Chatbot Agent 2.3.1, at includes/admin/custom_fields/get_add_agentonly_field.php

156 lines 6.3 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 if ( ! defined( 'ABSPATH' ) ) {
3 exit; // Exit if accessed directly
4 }
5
6 global $current_user, $wpscfunction;
7 $wpsc_date_range = '';
8 if (!($current_user->ID && $current_user->has_cap('manage_options'))) {exit;}
9
10 $field_types = $wpscfunction->get_custom_field_types();
11
12 $conditional_types = array();
13 foreach ($field_types as $key => $field) {
14 if ($field['has_options']) {
15 $conditional_types[]=$key;
16 }
17 }
18
19 ob_start();
20 ?>
21 <div class="form-group">
22 <label for="wpsc_tf_label"><?php _e('Field Label','supportcandy');?></label>
23 <p class="help-block"><?php _e('Insert field label. Please make sure label you are entering should not already exist in agent only as well as ticket form fields.','supportcandy');?></p>
24 <input id="wpsc_tf_label" class="form-control" name="wpsc_tf_label" value="" />
25 </div>
26 <div class="form-group">
27 <label for="wpsc_tf_extra_info"><?php _e('Extra Information','supportcandy');?></label>
28 <p class="help-block"><?php _e('Extra information about the field. Useful if you want to give instructions or information about the field for agent. Keep this empty if not needed.','supportcandy');?></p>
29 <input id="wpsc_tf_extra_info" class="form-control" name="wpsc_tf_extra_info" value="" />
30 </div>
31 <div class="form-group">
32 <label for="wpsc_tf_personal_info"><?php _e('Personal Information','supportcandy');?></label>
33 <p class="help-block"><?php _e('Enable or disable personal information in ticket form.','supportcandy');?></p>
34 <select id="wpsc_tf_personal_info" class="form-control" name="wpsc_tf_personal_info">
35 <option value="0"><?php _e('No','supportcandy');?></option>
36 <option value="1"><?php _e('Yes','supportcandy');?></option>
37 </select>
38 </div>
39 <div class="form-group">
40 <label for="wpsc_tf_type"><?php _e('Field Type','supportcandy');?></label>
41 <p class="help-block"><?php _e('Select field type.','supportcandy');?></p>
42 <select id="wpsc_tf_type" class="form-control" name="wpsc_tf_type">
43 <?php foreach ($field_types as $key => $field) :?>
44 <?php if($key == 22) continue;?>
45 <option data-options="<?php echo esc_attr($field['has_options'])?>" value="<?php echo esc_attr($key)?>"><?php echo esc_attr($field['label'])?></option>
46 <?php endforeach;?>
47 </select>
48 </div>
49 <div class="form-group" id="wpsc_tf_options_container" style="display:none;">
50 <label for="wpsc_tf_options"><?php _e('Field Options','supportcandy');?></label>
51 <p class="help-block"><?php _e('Insert field options. New option should begin on new line.','supportcandy');?></p>
52 <textarea style="height:80px !important;" id="wpsc_tf_options" class="form-control" name="wpsc_tf_options"></textarea>
53 </div>
54
55 <div class="form-group" id ="wpsc_add_limit">
56 <label for="wpsc_tf_add_limit"><?php _e('Character Limit','supportcandy');?></label>
57 <p class="help-block"><?php _e('Limit number of characters to be accepted for this field.Enter 0 for unlimited characters.','supportcandy');?></p>
58 <input type = "number" id="wpsc_cf_limit" class="form-control" name="wpsc_add_limit" value="" />
59 </div>
60
61 <div class="form-group" id="wpsc_date_range_container" style="display:none;">
62 <label for="wpsc_date_range"><?php _e('Allowed Dates','supportcandy');?></label>
63 <p class="help-block"><?php _e('Please select date range.','supportcandy');?></p>
64 <select id="wpsc_date_range" class="form-control" name="wpsc_date_range">
65 <option value="all"><?php _e('All','supportcandy');?></option>
66 <option value="past"><?php _e('Past','supportcandy');?></option>
67 <option value="future"><?php _e('Future','supportcandy');?></option>
68 <option value="range"><?php _e('Date range','supportcandy');?></option>
69 </select>
70 </div>
71
72 <div class="form-group" id="wpsc_date_range_option" style="display:none">
73 <label for="wpsc_date_range"><?php _e('Date Range','supportcandy');?></label>
74 <p class="help-block"><?php _e('Please select date range.','supportcandy');?></p>
75 <div class="row">
76 <div class="col-sm-6" style="padding-left:0">
77 <input type="text" autocomplete="off" class="form-control wpsc_dcf_rs" id="wpsc_dcf_from" value="" placeholder="<?php _e('From','supportcandy')?>">
78 </div>
79 <div class="col-sm-6" style="padding-right:0">
80 <input type="text" autocomplete="off" class="form-control wpsc_dcf_rs" id="wpsc_dcf_to" value="" placeholder="<?php _e('To','supportcandy')?>">
81 </div>
82 </div>
83 </div>
84
85 <div class="form-group" id="wpsc_time_fields_container" style="display:none;">
86 <label for="wpsc_time_content"><?php _e('Time Format','supportcandy');?></label>
87 <p class="help-block"><?php _e('Please select the time format','supportcandy'); ?></p>
88 <select id="wpsc_tf_time_format" class="form-control" name="wpsc_tf_time_format">
89 <option value="12"><?php _e('12 Hrs','supportcandy');?></option>
90 <option value="24"><?php _e('24 Hrs','supportcandy');?></option>
91 </select>
92 </div>
93 <script>
94 jQuery('#wpsc_tf_type').change(function(){
95 var has_options = jQuery('option:selected',this).data('options');
96 if(has_options=='1'){
97 jQuery('#wpsc_tf_options_container').show();
98 } else {
99 jQuery('#wpsc_tf_options_container').hide();
100 }
101
102 var option = Number(jQuery(this).val());
103 var opt_arr = [1,5,7,8,9];
104 if ( jQuery.inArray( option, opt_arr) >= 0) {
105 jQuery('#wpsc_add_limit').show();
106 }else{
107 jQuery('#wpsc_add_limit').hide();
108 }
109
110 var poption = Number(jQuery(this).val());
111 var popt_arr = [6];
112 if (jQuery.inArray( poption, popt_arr) >= 0) {
113 jQuery('#wpsc_date_range_container').show();
114 }else{
115 jQuery('#wpsc_date_range_container').hide();
116 }
117
118 if(option == 21){
119 jQuery('#wpsc_time_fields_container').show();
120 }else{
121 jQuery('#wpsc_time_fields_container').hide();
122 }
123 });
124
125 jQuery('#wpsc_date_range').on('change', function() {
126 if(this.value == 'range'){
127 jQuery('#wpsc_date_range_option').show();
128 }else{
129 jQuery('#wpsc_date_range_option').hide();
130 }
131 });
132
133 jQuery(".wpsc_dcf_rs").datepicker({
134 dateFormat : '<?php echo esc_attr(get_option('wpsc_calender_date_format'))?>',
135 showAnim : 'slideDown',
136 changeMonth: true,
137 changeYear: true,
138 yearRange: "-100:+100"
139 });
140 </script>
141 <?php
142 $body = ob_get_clean();
143 ob_start();
144 ?>
145 <button type="button" class="btn wpsc_popup_close" onclick="wpsc_modal_close();"><?php _e('Close','supportcandy');?></button>
146 <button type="button" class="btn wpsc_popup_action" onclick="wpsc_set_add_agentonly_field();"><?php _e('Submit','supportcandy');?></button>
147 <?php
148 $footer = ob_get_clean();
149
150 $output = array(
151 'body' => $body,
152 'footer' => $footer
153 );
154
155 wp_send_json($output);
156