PluginProbe
SupportCandy – AI Customer Support Ticket System & Live Chatbot Agent / 3.5.4
SupportCandy – AI Customer Support Ticket System & Live Chatbot Agent v3.5.4
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
← All changes | includes/admin/custom-fields/class-wpsc-aof.php +42 -3 3.4.6 → 3.5.4 View file →
@@ -62,9 +62,11 @@
62 62 public static function get_agent_only_fields() {
63 63
64 64 if ( ! WPSC_Functions::is_site_admin() ) {
65 65 wp_send_json_error( __( 'Unauthorized access!', 'supportcandy' ), 401 );
66 - }?>
66 + }
67 + $custom_fields_types = array_merge( WPSC_Custom_Field::$cf_types, WPSC_Custom_Field::$default_cf_types );
68 + ?>
67 69
68 70 <div class="wpsc-setting-header">
69 71 <h2><?php esc_attr_e( 'Agent Only Fields', 'supportcandy' ); ?></h2>
70 72 </div>
@@ -80,10 +82,13 @@
80 82 </div>
81 83 <table class="ticket-fields wpsc-setting-tbl">
82 84 <thead>
83 85 <tr>
86 + <th style="width: 30px;"><?php esc_attr_e( 'Sort', 'supportcandy' ); ?></th>
84 87 <th><?php esc_attr_e( 'Field', 'supportcandy' ); ?></th>
85 88 <th><?php esc_attr_e( 'Extra info', 'supportcandy' ); ?></th>
89 + <th><?php esc_attr_e( 'Type', 'supportcandy' ); ?></th>
90 + <th><?php esc_attr_e( 'Personal Info', 'supportcandy' ); ?></th>
86 91 <th><?php esc_attr_e( 'Actions', 'supportcandy' ); ?></th>
87 92 </tr>
88 93 </thead>
89 94 <tbody>
@@ -92,11 +97,14 @@
92 97 if ( $cf->field != 'agentonly' ) {
93 98 continue;
94 99 }
95 100 ?>
96 - <tr>
101 + <tr data-id="<?php echo esc_attr( $cf->id ); ?>">
102 + <td class="sort-handle"><?php WPSC_Icons::get( 'sort' ); ?></td>
97 103 <td><?php echo esc_attr( $cf->name ); ?></td>
98 104 <td><?php echo esc_attr( $cf->extra_info ); ?></td>
105 + <td><?php echo esc_attr( $custom_fields_types[ $cf->type::$slug ]['label'] ); ?></td>
106 + <td><?php echo esc_attr( $cf->is_personal_info ? __( 'Yes', 'supportcandy' ) : __( 'No', 'supportcandy' ) ); ?></td>
99 107 <td>
100 108 <span class="wpsc-link" onclick="wpsc_get_edit_custom_field(<?php echo esc_attr( $cf->id ); ?>, '<?php echo esc_attr( wp_create_nonce( 'wpsc_get_edit_custom_field' ) ); ?>');"><?php esc_attr_e( 'Edit', 'supportcandy' ); ?></span>
101 109 <?php
102 110 if ( ! $cf->type::$is_default ) {
@@ -115,11 +123,13 @@
115 123 </table>
116 124 <script>
117 125 jQuery('table.ticket-fields').DataTable({
118 126 ordering: false,
127 + autoWidth: false,
119 128 pageLength: 20,
120 129 bLengthChange: false,
121 - columnDefs: [
130 + columnDefs: [
131 + { targets: 0, width: '30px', searchable: false },
122 132 { targets: -1, searchable: false },
123 133 { targets: '_all', className: 'dt-left' }
124 134 ],
125 135 layout: {
@@ -135,8 +145,37 @@
135 145 ],
136 146 },
137 147 },
138 148 language: supportcandy.translations.datatables
149 + });
150 +
151 + jQuery(function() {
152 + // Enable sorting with jQuery UI.
153 + jQuery('table.ticket-fields tbody').sortable({
154 + handle: '.sort-handle',
155 + helper: function(e, tr) {
156 + var $originals = tr.children();
157 + var $helper = tr.clone();
158 + $helper.children().each(function(index) {
159 + jQuery(this).width($originals.eq(index).width());
160 + });
161 + return $helper;
162 + },
163 + update: function(event, ui) {
164 + var ids = jQuery(this).sortable('toArray', { attribute: 'data-id' });
165 + jQuery.post(
166 + supportcandy.ajax_url,
167 + {
168 + action: 'wpsc_set_custom_field_load_order',
169 + _ajax_nonce: '<?php echo esc_attr( wp_create_nonce( 'wpsc_set_custom_field_load_order' ) ); ?>',
170 + ids: ids
171 + },
172 + function(response) {
173 +
174 + }
175 + );
176 + }
177 + });
139 178 });
140 179 </script>
141 180 </div>
142 181 <?php