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