PluginProbe
Welcart e-Commerce / 2.12.4
Welcart e-Commerce v2.12.4
2.12.4 2.12.3 2.11.35 2.12.2 2.12.1 2.11.34 2.11.33 2.11.32 2.11.31 2.11.30 1.3.16 1.3.17 1.3.2 1.3.3 1.3.4 1.3.5 1.3.6 1.3.7 1.3.8 1.3.9 1.4.0 1.4.1 1.4.10 1.4.11 1.4.12 All 292 releases
usc-e-shop / includes / order_edit_form.php

order_edit_form.php in Welcart e-Commerce 2.12.4, at includes/order_edit_form.php

2,330 lines 100.8 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Order Edit Screen
4 *
5 * @package Welcart
6 */
7
8 if ( ! current_user_can( 'wel_manage_order' ) ) {
9 wp_die( __( 'You do not have sufficient privileges to perform this operation.', 'usces' ) );
10 }
11 if ( ! ( isset( $_GET['page'] ) && 'usces_ordernew' === $_GET['page'] ) ) {
12 check_admin_referer( 'order_edit', 'wc_nonce' );
13 }
14
15 $pname = array();
16 $payment_method = array();
17 $csod_meta = array();
18 $usces_tax = Welcart_Tax::get_instance();
19
20 $add_html_email_option = (int) $this->options['add_html_email_option'];
21 $management_status = apply_filters( 'usces_filter_management_status', get_option( 'usces_management_status' ) );
22 $payment_method = usces_get_system_option( 'usces_payment_method', 'sort' );
23
24 foreach ( $payment_method as $pmet ) {
25 $pname[] = $pmet['name'];
26 }
27 if ( ! in_array( __( 'Transfer (prepayment)', 'usces' ), $pname, true ) ) {
28 $newp['name'] = __( 'Transfer (prepayment)', 'usces' );
29 $newp['explanation'] = '';
30 $newp['settlement'] = 'transferAdvance';
31 $newp['module'] = '';
32 $payment_method[] = $newp;
33 }
34 if ( ! in_array( __( 'Transfer (postpay)', 'usces' ), $pname, true ) ) {
35 $newp['name'] = __( 'Transfer (postpay)', 'usces' );
36 $newp['explanation'] = '';
37 $newp['settlement'] = 'transferDeferred';
38 $newp['module'] = '';
39 $payment_method[] = $newp;
40 }
41 if ( ! in_array( __( 'COD', 'usces' ), $pname, true ) ) {
42 $newp['name'] = __( 'COD', 'usces' );
43 $newp['explanation'] = '';
44 $newp['settlement'] = 'COD';
45 $newp['module'] = '';
46 $payment_method[] = $newp;
47 }
48
49 if ( 'new' === $order_action ) {
50
51 $oa = 'newpost';
52 $taio = 'new';
53 $admin = 'adminorder';
54 $receipt = '';
55 $ordercheck = array();
56 $order_delivery_method = -1;
57 $order_id = null;
58
59 $csod_meta = usces_has_custom_field_meta( 'order' );
60 if ( is_array( $csod_meta ) ) {
61 $keys = array_keys( $csod_meta );
62 foreach ( $keys as $key ) {
63 $csod_key = 'csod_' . $key;
64
65 $csod_meta[ $key ]['data'] = null;
66 }
67 }
68 $cscs_meta = usces_has_custom_field_meta( 'customer' );
69 if ( is_array( $cscs_meta ) ) {
70 $keys = array_keys( $cscs_meta );
71 foreach ( $keys as $key ) {
72 $cscs_key = 'cscs_' . $key;
73
74 $cscs_meta[ $key ]['data'] = null;
75 }
76 }
77 $csde_meta = usces_has_custom_field_meta( 'delivery' );
78 if ( is_array( $csde_meta ) ) {
79 $keys = array_keys( $csde_meta );
80 foreach ( $keys as $key ) {
81 $csde_key = 'csde_' . $key;
82
83 $csde_meta[ $key ]['data'] = null;
84 }
85 }
86
87 $condition = $this->get_condition();
88
89 $data = array(
90 'mem_name1' => '',
91 'mem_name2' => '',
92 'mem_name3' => '',
93 'mem_name4' => '',
94 'mem_zip' => '',
95 'mem_address1' => '',
96 'mem_address2' => '',
97 'mem_address3' => '',
98 'mem_tel' => '',
99 'mem_fax' => '',
100 'mem_country' => '',
101 'mem_pref' => '',
102 'order_name1' => '',
103 'order_name2' => '',
104 'order_name3' => '',
105 'order_name4' => '',
106 'order_zip' => '',
107 'order_address1' => '',
108 'order_address2' => '',
109 'order_address3' => '',
110 'order_tel' => '',
111 'order_fax' => '',
112 'order_country' => '',
113 'order_pref' => '',
114 'ID' => '',
115 'order_condition' => $condition,
116 'order_date' => current_time( 'mysql' ),
117 'order_delivery_date' => '',
118 );
119 $deli = array(
120 'name1' => '',
121 'name2' => '',
122 'name3' => '',
123 'name4' => '',
124 'zipcode' => '',
125 'address1' => '',
126 'address2' => '',
127 'address3' => '',
128 'tel' => '',
129 'fax' => '',
130 'country' => '',
131 'pref' => '',
132 );
133
134 $cart = array();
135 $navibutton = '';
136
137 $order_subtotal_standard = 0;
138 $order_subtotal_reduced = 0;
139 $order_discount_standard = 0;
140 $order_discount_reduced = 0;
141 $include_tax = '';
142 $include_tax_standard = '';
143 $include_tax_reduced = '';
144 $tax_target = usces_get_tax_target();
145 $tax_mode = usces_get_tax_mode();
146 $reduced_taxrate = $this->is_reduced_taxrate();
147 $tax_readonly = ( 'include' === $tax_mode ) ? ' readonly' : '';
148 $change_taxrate = '';
149 $tax_label = ( 'exclude' === $tax_mode ) ? __( 'consumption tax', 'usces' ) : __( 'Internal tax', 'usces' );
150 $mem_point = 0;
151
152 } else {
153
154 $oa = 'editpost';
155
156 $order_id = isset( $_REQUEST['order_id'] ) ? (int) wp_kses( wp_unslash( $_REQUEST['order_id'] ), array() ) : 0;
157 $data = $this->get_order_data( $order_id, 'direct' );
158
159 $deli = stripslashes_deep( wel_safe_maybe_unserialize( $data['order_delivery'] ) );
160 $seriarized_cart = stripslashes_deep( wel_safe_maybe_unserialize( $data['order_cart'] ) );
161 $cart = usces_get_ordercartdata( $order_id );
162 $condition = stripslashes_deep( wel_safe_maybe_unserialize( $data['order_condition'] ) );
163 $ordercheck = stripslashes_deep( wel_safe_maybe_unserialize( $data['order_check'] ) );
164
165 if ( ! is_array( $ordercheck ) ) {
166 $ordercheck = array();
167 }
168
169 $order_delivery_method = $data['order_delivery_method'];
170
171 if ( ! empty( $data ) ) {
172 $data = stripslashes_deep( $data );
173 }
174
175 $exclusion_status = apply_filters( 'usces_filter_taio_exclusion_status', array( 'noreceipt', 'receipted', 'pending', 'estimate', 'adminorder' ) );
176 foreach ( $management_status as $status_key => $status_name ) {
177 if ( in_array( $status_key, $exclusion_status, true ) ) {
178 continue;
179 }
180
181 if ( $this->is_status( $status_key, $data['order_status'] ) ) {
182 $taio = $status_key;
183 break;
184 } else {
185 $taio = 'new';
186 }
187 }
188
189 if ( $this->is_status( 'estimate', $data['order_status'] ) ) {
190 $admin = 'estimate';
191 } elseif ( $this->is_status( 'adminorder', $data['order_status'] ) ) {
192 $admin = 'adminorder';
193 } else {
194 $admin = '';
195 }
196
197 if ( $this->is_status( 'noreceipt', $data['order_status'] ) ) {
198 $receipt = 'noreceipt';
199 } elseif ( $this->is_status( 'receipted', $data['order_status'] ) ) {
200 $receipt = 'receipted';
201 } elseif ( $this->is_status( 'pending', $data['order_status'] ) ) {
202 $receipt = 'pending';
203 } else {
204 $receipt = '';
205 }
206
207 $csod_meta = usces_has_custom_field_meta( 'order' );
208 if ( is_array( $csod_meta ) ) {
209 $keys = array_keys( $csod_meta );
210 foreach ( $keys as $key ) {
211 $csod_key = 'csod_' . $key;
212 $csod_meta[ $key ]['data'] = wel_safe_maybe_unserialize( $this->get_order_meta_value( $csod_key, $order_id ) );
213 }
214 }
215 // Start - Display data of the deleted order custom fields.
216 global $wpdb;
217 $deleted_csod_meta_display = '';
218 $order_meta_table = $wpdb->prefix . 'usces_order_meta';
219 $query = $wpdb->prepare(
220 "SELECT * FROM {$order_meta_table} WHERE order_id = %d AND meta_key LIKE 'csod_%'",
221 $order_id
222 );
223 $order_meta_data = $wpdb->get_results( $query, ARRAY_A );
224 if ( ! empty( $order_meta_data ) ) {
225 foreach ( $order_meta_data as $order_meta ) {
226 $order_meta_key = str_replace( 'csod_', '', $order_meta['meta_key'] );
227 $deleted = ! isset( $csod_meta[ $order_meta_key ] );
228 if ( $deleted ) {
229 $display_order_meta = wel_safe_maybe_unserialize( $order_meta['meta_value'] );
230 if ( is_array( $display_order_meta ) ) {
231 $display_order_meta = implode( ',', $display_order_meta );
232 }
233 $deleted_csod_meta_display .= '<tr><td class="label">' . esc_html( $order_meta_key ) . '</td><td>' . esc_html( $display_order_meta ) . '</td></tr>';
234 }
235 }
236 }
237 // End - Display data of the deleted order custom fields.
238 $cscs_meta = usces_has_custom_field_meta( 'customer' );
239 if ( is_array( $cscs_meta ) ) {
240 $keys = array_keys( $cscs_meta );
241 foreach ( $keys as $key ) {
242 $cscs_key = 'cscs_' . $key;
243 $cscs_meta[ $key ]['data'] = wel_safe_maybe_unserialize( $this->get_order_meta_value( $cscs_key, $order_id ) );
244 }
245 }
246 $csde_meta = usces_has_custom_field_meta( 'delivery' );
247 if ( is_array( $csde_meta ) ) {
248 $keys = array_keys( $csde_meta );
249 foreach ( $keys as $key ) {
250 $csde_key = 'csde_' . $key;
251 $csde_meta[ $key ]['data'] = wel_safe_maybe_unserialize( $this->get_order_meta_value( $csde_key, $order_id ) );
252 }
253 }
254
255 $exopt = get_option( 'usces_ex', array() );
256 if ( isset( $exopt['system']['datalistup']['orderlist_flag'] ) && $exopt['system']['datalistup']['orderlist_flag'] ) {
257 $navibutton = '';
258 $navibutton .= '<a href="javascript:;" class="prev-page" style="display:none"><span class="dashicons dashicons-arrow-left-alt2"></span>' . __( 'to prev page', 'usces' ) . '</a>';
259 $navibutton .= '<a href="' . admin_url( 'admin.php?page=usces_orderlist&returnList=1&wc_nonce=' . wp_create_nonce( 'order_list' ) ) . '" class="back-list"><span class="dashicons dashicons-list-view"></span>' . __( 'to order list', 'usces' ) . '</a>';
260 $navibutton .= '<a href="javascript:;" class="next-page" style="display:none">' . __( 'to next page', 'usces' ) . '<span class="dashicons dashicons-arrow-right-alt2"></span></a>';
261 } else {
262 $navibutton = '<a href="' . admin_url( 'admin.php?page=usces_orderlist&returnList=1&wc_nonce=' . wp_create_nonce( 'order_list' ) ) . '" class="back-list"><span class="dashicons dashicons-list-view"></span>' . __( 'to order list', 'usces' ) . '</a>';
263 }
264
265 $order_subtotal_standard = 0;
266 $order_subtotal_reduced = 0;
267 $order_discount_standard = 0;
268 $order_discount_reduced = 0;
269 $include_tax = '';
270 $include_tax_standard = '';
271 $include_tax_reduced = '';
272
273 $tax_target = ( isset( $condition['tax_target'] ) ) ? $condition['tax_target'] : $this->options['tax_target'];
274 $tax_mode = ( isset( $condition['tax_mode'] ) ) ? $condition['tax_mode'] : $this->options['tax_mode'];
275 $tax_label = ( 'exclude' === $tax_mode ) ? __( 'consumption tax', 'usces' ) : __( 'Internal tax', 'usces' );
276
277 $reduced_taxrate = ( isset( $condition['applicable_taxrate'] ) && 'reduced' === $condition['applicable_taxrate'] ) ? true : false;
278 if ( $reduced_taxrate ) {
279 $materials = array(
280 'total_items_price' => $data['order_item_total_price'],
281 'discount' => $data['order_discount'],
282 'shipping_charge' => $data['order_shipping_charge'],
283 'cod_fee' => $data['order_cod_fee'],
284 'use_point' => $data['order_usedpoint'],
285 'carts' => $cart,
286 'condition' => $condition,
287 'order_id' => $order_id,
288 );
289 $usces_tax->get_order_tax( $materials );
290 $order_subtotal_standard = $usces_tax->subtotal_standard;
291 $order_subtotal_reduced = $usces_tax->subtotal_reduced;
292 $order_discount_standard = $usces_tax->discount_standard;
293 $order_discount_reduced = $usces_tax->discount_reduced;
294 if ( 'exclude' === $tax_mode ) {
295 $order_tax_standard = $usces_tax->tax_standard;
296 $order_tax_reduced = $usces_tax->tax_reduced;
297 }
298 }
299 if ( 'include' === $tax_mode ) {
300 if ( $reduced_taxrate ) {
301 $include_tax_standard = '(' . usces_crform( $usces_tax->tax_standard, false, false, 'return', true ) . ')';
302 $include_tax_reduced = '(' . usces_crform( $usces_tax->tax_reduced, false, false, 'return', true ) . ')';
303 $include_tax = '(' . usces_crform( $usces_tax->tax_standard + $usces_tax->tax_reduced, false, false, 'return', true ) . ')';
304 } else {
305 $materials = array(
306 'total_items_price' => $data['order_item_total_price'],
307 'discount' => $data['order_discount'],
308 'shipping_charge' => $data['order_shipping_charge'],
309 'cod_fee' => $data['order_cod_fee'],
310 'use_point' => $data['order_usedpoint'],
311 'condition' => $condition,
312 );
313
314 $include_tax = '(' . usces_crform( usces_internal_tax( $materials, 'return' ), false, false, 'return', true ) . ')';
315 }
316 }
317 $tax_readonly = ( 'include' === $tax_mode ) ? ' readonly' : '';
318 $change_taxrate = '<span><label><input type="checkbox" name="change_taxrate" id="change_taxrate" value="change">' . __( 'Apply the changed tax rate', 'usces' ) . '</label></span>';
319
320 if ( isset( $data['mem_id'] ) ) {
321 $member_info = $this->get_member_info( $data['mem_id'] );
322 $mem_point = ( isset( $member_info['mem_point'] ) ) ? (int) $member_info['mem_point'] : 0;
323 } else {
324 $mem_point = 0;
325 }
326 }
327
328 $delivery_after_days = apply_filters( 'usces_filter_delivery_after_days', ( ! empty( $this->options['delivery_after_days'] ) ? (int) $this->options['delivery_after_days'] : 100 ) );
329 $delivery_date = ( isset( $data['order_delivery_date'] ) && usces_is_date( $data['order_delivery_date'] ) ) ? $data['order_delivery_date'] : '';
330 $delidue_date = ( isset( $data['order_delidue_date'] ) && usces_is_date( $data['order_delidue_date'] ) ) ? $data['order_delidue_date'] : '';
331 $order_date_time = explode( ' ', $data['order_date'] );
332 $order_date = explode( '-', $order_date_time[0] );
333 $order_yy = (int) $order_date[0];
334 $order_mm = (int) $order_date[1] - 1;
335 $order_dd = (int) $order_date[2];
336
337 $noreceipt_status = apply_filters( 'usces_filter_noreceipt_status', get_option( 'usces_noreceipt_status' ) );
338 $filter_args = compact( 'order_action', 'order_id', 'data', 'cart' );
339 $action_args = compact( 'order_action', 'order_id', 'cart' );
340
341 $payments_str = '';
342 $payments = usces_get_system_option( 'usces_payment_method', 'sort' );
343 foreach ( (array) $payments as $array ) {
344 $payments_str .= "'" . esc_js( $array['name'] ) . "': '" . esc_js( $array['settlement'] ) . "', ";
345 }
346 $payments_str .= "'" . __( 'Transfer (prepayment)', 'usces' ) . "': 'transferAdvance', ";
347 $payments_str .= "'" . __( 'Transfer (postpay)', 'usces' ) . "': 'transferDeferred', ";
348 $payments_str .= "'" . __( 'COD', 'usces' ) . "': 'COD', ";
349 $payments_str = rtrim( $payments_str, ', ' );
350
351 $no_preference = apply_filters( 'usces_filter_label_delivery_date_no_preference', __( 'Non-request', 'usces_dual' ) );
352
353 $mailsenddialog_height = ( 1 === $this->options['email_attach_feature'] || 1 === $add_html_email_option ) ? 628 : 578;
354 $mailsenddialog_width = 700;
355 $mail_data = usces_mail_data();
356
357 $usedpoint_readonly = ( usces_is_membersystem_point() && ! empty( $data['mem_id'] ) ) ? '' : ' readonly';
358 $getpoint_readonly = ( usces_is_membersystem_point() ) ? '' : ' readonly';
359
360 $email_attach_file_extension = wel_email_attach_file_extension( explode( ',', strtolower( $this->options['email_attach_file_extension'] ) ) );
361 ?>
362 <style>
363 .usces_tablenav #mailVisiLink {
364 width: auto;
365 min-width: 190px;
366 }
367 #wrap_icon_loading {
368 display: inline-block;
369 width: 20px;
370 height: 20px;
371 position: relative;
372 }
373 #wrap_icon_loading > img {
374 position: absolute;
375 top: 10px;
376 }
377 </style>
378 <script type='text/javascript'>
379 /* <![CDATA[ */
380 uscesPayments = {<?php echo wp_kses_data( $payments_str ); ?>};
381 /* ]]> */
382 </script>
383 <script type="text/javascript">
384 jQuery(function($){
385 var selected_delivery_time = '<?php echo ( isset( $data['order_delivery_time'] ) ? esc_js( $data['order_delivery_time'] ) : '' ); ?>';
386 var delivery_time = [];
387 <?php if ( 1 === $add_html_email_option ) { ?>
388 var usceAdminUrl = '<?php echo esc_url_raw( USCES_ADMIN_URL ); ?>';
389 <?php } ?>
390 <?php
391 foreach ( (array) $this->options['delivery_method'] as $dmid => $dm ) {
392 $dm['time'] = usces_change_line_break( $dm['time'] );
393 $lines = explode( "\n", $dm['time'] );
394 ?>
395 delivery_time[<?php echo wp_kses_data( $dm['id'] ); ?>] = [];
396 <?php
397 foreach ( (array) $lines as $line ) {
398 if ( trim( $line ) !== '' ) {
399 ?>
400 delivery_time[<?php echo wp_kses_data( $dm['id'] ); ?>].push("<?php echo wp_kses_data( trim( $line ) ); ?>");
401 <?php
402 }
403 }
404 }
405 ?>
406
407 $("#order_payment_name").change(function () {
408 var pay_name = $("select[name='offer\[payment_name\]'] option:selected").val();
409 var noreceipt_status = [ '<?php echo wp_kses_data( implode( "','", $noreceipt_status ) ); ?>' ];
410 if( $.inArray( uscesPayments[pay_name], noreceipt_status ) >= 0 ) {
411 var label = '<?php esc_html_e( 'transfer statement', 'usces' ); ?>';
412 var html = "<select name='offer[receipt]'>\n";
413 html += "<option value='noreceipt'><?php echo wp_kses_data( $management_status['noreceipt'] ); ?></option>\n";
414 html += "<option value='receipted'><?php echo wp_kses_data( $management_status['receipted'] ); ?></option>\n";
415 html += "</select>\n";
416 $("#receiptlabel").html(label);
417 $("#receiptbox").html(html);
418 <?php do_action( 'usces_change_payment_terms_js', $management_status, $data ); ?>
419 }else{
420 $("#receiptlabel").html('');
421 $("#receiptbox").html('');
422 }
423 });
424
425 $("#addItemDialog").dialog({
426 bgiframe: true,
427 autoOpen: false,
428 height: 500,
429 width: 700,
430 resizable: true,
431 modal: true,
432 appendTo: "#dialog_parent",
433 buttons: [
434 {
435 text: "<?php esc_html_e( 'close', 'usces' ); ?>",
436 "class": "button",
437 click: function() {
438 $(this).dialog('close');
439 }
440 }
441 ],
442 close: function() {
443 $("#newitemcategory").val( "-1" );
444 $("#newitemform").html( "" );
445 $('#newitemcode').val('');
446 }
447 });
448 $('#addCartButton').click(function() {
449 if($("input[name='order_id']").val() == ''){
450 alert("<?php esc_html_e( "Push 'change decision' button, to be settled with an order number.", 'usces' ); ?>");
451 return;
452 }
453 $('#addItemDialog').dialog('open');
454 });
455 $('#delivery_method_select').change(function() {
456 orderfunc.make_delivery_time($('#delivery_method_select option:selected').val());
457 });
458
459 $("#mailSendDialog").dialog({
460 bgiframe: true,
461 autoOpen: false,
462 height: <?php echo wp_kses_data( $mailsenddialog_height ); ?>,
463 width: <?php echo wp_kses_data( $mailsenddialog_width ); ?>,
464 resizable: true,
465 modal: true,
466 buttons: [
467 <?php if ( 1 === $add_html_email_option ) { ?>
468 {
469 text: "<?php esc_html_e( 'Preview', 'usces' ); ?>",
470 "class": 'button',
471 "id": 'usces_email_bnt_preview',
472 click: function() {
473 uscesMail.previewMail();
474 }
475 },
476 <?php } ?>
477 {
478 text: "<?php esc_html_e( 'send', 'usces' ); ?>",
479 "class": 'button',
480 "id": 'usces_email_bnt_send',
481 click: function() {
482 uscesMail.sendmail();
483 }
484 },
485 {
486 text: "<?php esc_html_e( 'close', 'usces' ); ?>",
487 "class": 'button',
488 click: function() {
489 $(this).dialog('close');
490 }
491 }
492 ],
493 appendTo:"#dialog_parent",
494 close: function() {
495 <?php if ( 1 === $add_html_email_option ) { ?>
496 $('#iframeLoadEditor').attr('src', '');
497 <?php } else { ?>
498 $("#sendmailmessage").html( "" );
499 <?php } ?>
500 $('#sendmailaddress').val('');
501 }
502 });
503 <?php if ( 1 === $add_html_email_option ) { ?>
504 $("#previewEmailDialog").dialog({
505 bgiframe: true,
506 autoOpen: false,
507 height: <?php echo wp_kses_data( $mailsenddialog_height ); ?>,
508 width: <?php echo wp_kses_data( $mailsenddialog_width ); ?>,
509 resizable: true,
510 modal: true,
511 buttons: [
512 {
513 text: "<?php esc_html_e( 'close', 'usces' ); ?>",
514 "class": 'button',
515 click: function() {
516 $(this).dialog('close');
517 }
518 }
519 ],
520 appendTo:"#dialog_parent",
521 close: function() {
522 $('#previewEmailDialog').dialog('option', 'title', "");
523 var dstFrame = document.getElementById('iframePreviewEmail');
524 var dstDoc = dstFrame.contentDocument || dstFrame.contentWindow.document;
525 dstDoc.write("");
526 dstDoc.close();
527 }
528 });
529 <?php } ?>
530 $('#completionMail').click(function() {
531 var mode = 'completionMail';
532 <?php if ( 1 === $add_html_email_option ) { ?>
533 orderItem.getMailMessageRichEditor(usceAdminUrl, mode);
534 <?php } else { ?>
535 orderItem.getmailmessage(mode);
536 <?php } ?>
537 $("#sendmailaddress").val($("input[name='customer\[mailaddress\]']").val());
538 $("#sendmailname").val($("input[name='customer\[name1\]']").val()+$("input[name='customer\[name2\]']").val());
539 $("#sendmailsubject").val('<?php echo esc_js( apply_filters( 'usces_filter_order_confirm_mail_subject', $mail_data['title']['completionmail'], $data, 'completionMail' ) ); ?>');
540 $('#mailChecked').val('completionmail');
541 $('#sendmailattachfile').val('');
542 $('#mailSendDialog').dialog('option', 'title', '<?php esc_html_e( 'Mail for Shipping', 'usces' ); ?>');
543 $('#mailSendDialog').dialog('open');
544 });
545 $('#orderConfirmMail').click(function() {
546 var mode = 'orderConfirmMail';
547 <?php if ( 1 === $add_html_email_option ) { ?>
548 orderItem.getMailMessageRichEditor(usceAdminUrl, mode);
549 <?php } else { ?>
550 orderItem.getmailmessage(mode);
551 <?php } ?>
552 $("#sendmailaddress").val($("input[name='customer\[mailaddress\]']").val());
553 $("#sendmailname").val($("input[name='customer\[name1\]']").val()+$("input[name='customer\[name2\]']").val());
554 $("#sendmailsubject").val('<?php echo esc_js( apply_filters( 'usces_filter_order_confirm_mail_subject', $mail_data['title']['ordermail'], $data, 'orderConfirmMail' ) ); ?>');
555 $('#mailChecked').val('ordermail');
556 $('#sendmailattachfile').val('');
557 $('#mailSendDialog').dialog('option', 'title', '<?php esc_html_e( 'Mail for confirmation of order', 'usces' ); ?>');
558 $('#mailSendDialog').dialog('open');
559 });
560 $('#changeConfirmMail').click(function() {
561 var mode = 'changeConfirmMail';
562 <?php if ( 1 === $add_html_email_option ) { ?>
563 orderItem.getMailMessageRichEditor(usceAdminUrl, mode);
564 <?php } else { ?>
565 orderItem.getmailmessage(mode);
566 <?php } ?>
567 $("#sendmailaddress").val($("input[name='customer\[mailaddress\]']").val());
568 $("#sendmailname").val($("input[name='customer\[name1\]']").val()+$("input[name='customer\[name2\]']").val());
569 $("#sendmailsubject").val('<?php echo esc_js( apply_filters( 'usces_filter_order_confirm_mail_subject', $mail_data['title']['changemail'], $data, 'changeConfirmMail' ) ); ?>');
570 $('#mailChecked').val('changemail');
571 $('#sendmailattachfile').val('');
572 $('#mailSendDialog').dialog('option', 'title', '<?php esc_html_e( 'Mail for confiemation of change', 'usces' ); ?>');
573 $('#mailSendDialog').dialog('open');
574 });
575 $('#receiptConfirmMail').click(function() {
576 var mode = 'receiptConfirmMail';
577 <?php if ( 1 === $add_html_email_option ) { ?>
578 orderItem.getMailMessageRichEditor(usceAdminUrl, mode);
579 <?php } else { ?>
580 orderItem.getmailmessage(mode);
581 <?php } ?>
582 $("#sendmailaddress").val($("input[name='customer\[mailaddress\]']").val());
583 $("#sendmailname").val($("input[name='customer\[name1\]']").val()+$("input[name='customer\[name2\]']").val());
584 $("#sendmailsubject").val('<?php echo esc_js( apply_filters( 'usces_filter_order_confirm_mail_subject', $mail_data['title']['receiptmail'], $data, 'receiptConfirmMail' ) ); ?>');
585 $('#mailChecked').val('receiptmail');
586 $('#sendmailattachfile').val('');
587 $('#mailSendDialog').dialog('option', 'title', '<?php esc_html_e( 'Mail for confirmation of transter', 'usces' ); ?>');
588 $('#mailSendDialog').dialog('open');
589 });
590 $('#mitumoriConfirmMail').click(function() {
591 var mode = 'mitumoriConfirmMail';
592 <?php if ( 1 === $add_html_email_option ) { ?>
593 orderItem.getMailMessageRichEditor(usceAdminUrl, mode);
594 <?php } else { ?>
595 orderItem.getmailmessage(mode);
596 <?php } ?>
597 $("#sendmailaddress").val($("input[name='customer\[mailaddress\]']").val());
598 $("#sendmailname").val($("input[name='customer\[name1\]']").val()+$("input[name='customer\[name2\]']").val());
599 $("#sendmailsubject").val('<?php echo esc_js( apply_filters( 'usces_filter_order_confirm_mail_subject', $mail_data['title']['mitumorimail'], $data, 'mitumoriConfirmMail' ) ); ?>');
600 $('#mailChecked').val('mitumorimail');
601 $('#sendmailattachfile').val('');
602 $('#mailSendDialog').dialog('option', 'title', '<?php esc_html_e( 'estimate mail', 'usces' ); ?>');
603 $('#mailSendDialog').dialog('open');
604 });
605 $('#cancelConfirmMail').click(function() {
606 var mode = 'cancelConfirmMail';
607 <?php if ( 1 === $add_html_email_option ) { ?>
608 orderItem.getMailMessageRichEditor(usceAdminUrl, mode);
609 <?php } else { ?>
610 orderItem.getmailmessage(mode);
611 <?php } ?>
612 $("#sendmailaddress").val($("input[name='customer\[mailaddress\]']").val());
613 $("#sendmailname").val($("input[name='customer\[name1\]']").val()+$("input[name='customer\[name2\]']").val());
614 $("#sendmailsubject").val('<?php echo esc_js( apply_filters( 'usces_filter_order_confirm_mail_subject', $mail_data['title']['cancelmail'], $data, 'cancelConfirmMail' ) ); ?>');
615 $('#mailChecked').val('cancelmail');
616 $('#sendmailattachfile').val('');
617 $('#mailSendDialog').dialog('option', 'title', '<?php esc_html_e( 'Cancelling mail', 'usces' ); ?>');
618 $('#mailSendDialog').dialog('open');
619 });
620 $('#otherConfirmMail').click(function() {
621 var mode = 'otherConfirmMail';
622 <?php if ( 1 === $add_html_email_option ) { ?>
623 orderItem.getMailMessageRichEditor(usceAdminUrl, mode);
624 <?php } else { ?>
625 orderItem.getmailmessage(mode);
626 <?php } ?>
627 $("#sendmailaddress").val($("input[name='customer\[mailaddress\]']").val());
628 $("#sendmailname").val($("input[name='customer\[name1\]']").val()+$("input[name='customer\[name2\]']").val());
629 $("#sendmailsubject").val('<?php echo esc_js( apply_filters( 'usces_filter_order_confirm_mail_subject', $mail_data['title']['othermail'], $data, 'otherConfirmMail' ) ); ?>');
630 $('#mailChecked').val('othermail');
631 $('#sendmailattachfile').val('');
632 $('#mailSendDialog').dialog('option', 'title', '<?php esc_html_e( 'Other mail', 'usces' ); ?>');
633 $('#mailSendDialog').dialog('open');
634 });
635
636 $("#mailSendAlert").dialog({
637 bgiframe: true,
638 autoOpen: false,
639 height: 200,
640 width: 200,
641 resizable: false,
642 appendTo: "#mailSendDialog",
643 modal: false
644 });
645
646 $("#PDFDialog").dialog({
647 bgiframe: true,
648 autoOpen: false,
649 height: 800,
650 width: 700,
651 resizable: true,
652 modal: true,
653 buttons: {
654 '<?php esc_html_e( 'close', 'usces' ); ?>': function() {
655 $(this).dialog('close');
656 }
657 },
658 close: function() {
659 $("#new_pdf").html( "" );
660 }
661 });
662 $('#mitumoriprint').click(function() {
663 uscesMail.ordercheckpost('mitumoriprint');
664 window.open ( "<?php echo esc_url_raw( USCES_ADMIN_URL . '?page=usces_orderlist&order_action=pdfout&noheader=true&order_id=' . $order_id . '&wc_nonce=' . wp_create_nonce( 'order_edit' ) ); ?>&type=mitumori", '_blank');
665 });
666 $('#nohinprint').click(function() {
667 uscesMail.ordercheckpost('nohinprint');
668 window.open ( "<?php echo esc_url_raw( USCES_ADMIN_URL . '?page=usces_orderlist&order_action=pdfout&noheader=true&order_id=' . $order_id . '&wc_nonce=' . wp_create_nonce( 'order_edit' ) ); ?>&type=nohin", '_blank');
669 });
670 $('#receiptprint').click(function() {
671 uscesMail.ordercheckpost('receiptprint');
672 window.open ( "<?php echo esc_url_raw( USCES_ADMIN_URL . '?page=usces_orderlist&order_action=pdfout&noheader=true&order_id=' . $order_id . '&wc_nonce=' . wp_create_nonce( 'order_edit' ) ); ?>&type=receipt", '_blank');
673 });
674 $('#billprint').click(function() {
675 uscesMail.ordercheckpost('billprint');
676 window.open ( "<?php echo esc_url_raw( USCES_ADMIN_URL . '?page=usces_orderlist&order_action=pdfout&noheader=true&order_id=' . $order_id . '&wc_nonce=' . wp_create_nonce( 'order_edit' ) ); ?>&type=bill", '_blank');
677 });
678
679 orderfunc = {
680 sumPrice : function(obj) {
681 if(obj != null) {
682 if(!checkNumMinus(obj.val())) {
683 alert('<?php esc_html_e( 'Please enter a numeric value.', 'usces' ); ?>');
684 obj.focus();
685 return false;
686 }
687 <?php if ( usces_is_membersystem_point() ) : ?>
688 if( false == check_usedPoint( $("#order_usedpoint").val() ) ){
689 $("#order_usedpoint").css({'background-color': '#FFA'}).click(function() {
690 $(this).css({'background-color': '#FFF'});
691 });
692 document.getElementById('order_usedpoint').focus();
693 return false;
694 }
695 <?php endif; ?>
696 }
697
698 <?php
699 if ( $reduced_taxrate ) :
700 ?>
701 var p = $( "input[name*='skuPrice']" );
702 var q = $( "input[name*='quant']" );
703 var t = $( "p[id*='sub_total']" );
704 var db = $( "input[name*='delButton']" );
705 var applicable_taxrate = $( "input[name*='applicable_taxrate']" );
706 var subtotal_standard = 0;
707 var subtotal_reduced = 0;
708 var discount_standard = parseFloat( $( "#order_discount_standard" ).val() );
709 var discount_reduced = parseFloat( $( "#order_discount_reduced" ).val() );
710 var total_full = 0;
711 var n = <?php echo wp_kses_data( $this->get_currency_decimal() ); ?>;
712 var order_usedpoint = $( "#order_usedpoint" ).val()*1;
713 var order_discount = parseFloat( $( "#order_discount" ).val() );
714 var order_shipping_charge = parseFloat( $( "#order_shipping_charge" ).val() );
715 var order_cod_fee = parseFloat( $( "#order_cod_fee" ).val() );
716 var order_tax = parseFloat( $( "#order_tax" ).val() );
717
718 for( var i = 0; i < p.length; i++ ) {
719 v = parseFloat( $( p[i] ).val() ) * $( q[i] ).val();
720 if( 0 < n ) {
721 v = Math.round( v * Math.pow( 10, n ) ) / Math.pow( 10, n );
722 }
723 $( t[i] ).html( addComma( v+'' ) );
724
725 if( 'reduced' == $( applicable_taxrate[i] ).val() ) {
726 subtotal_reduced += v;
727 subtotal_reduced = Math.round( subtotal_reduced * Math.pow( 10, n ) ) / Math.pow( 10, n );
728 } else {
729 subtotal_standard += v;
730 subtotal_standard = Math.round( subtotal_standard * Math.pow( 10, n ) ) / Math.pow( 10, n );
731 }
732 }
733 var sub_total = subtotal_standard + subtotal_reduced;
734 $( "#item_total" ).html( addComma( sub_total + '' ) );
735 <?php
736 if ( 'all' === $tax_target ) :
737 ?>
738 $( "#subtotal_standard" ).html( addComma( subtotal_standard + discount_standard + order_shipping_charge + order_cod_fee + '' ) );
739 $( "#order_subtotal_standard" ).val( subtotal_standard + order_shipping_charge + order_cod_fee );
740 <?php
741 else :
742 ?>
743 $( "#subtotal_standard" ).html( addComma( subtotal_standard + discount_standard + '' ) );
744 $( "#order_subtotal_standard" ).val( subtotal_standard );
745 <?php
746 endif;
747 ?>
748 $( "#subtotal_reduced" ).html( addComma( subtotal_reduced + discount_reduced + '' ) );
749 $( "#order_subtotal_reduced" ).val( subtotal_reduced );
750 total_full = sub_total - order_usedpoint + order_discount + order_shipping_charge + order_cod_fee + order_tax;
751 if( 0 < n ) {
752 total_full = Math.round( total_full * Math.pow( 10, n ) ) / Math.pow( 10, n );
753 }
754 $( "#total_full" ).html( addComma( total_full + '' ) );
755 $( "#total_full_top" ).html( addComma( total_full + '' ) );
756 <?php
757 else :
758 ?>
759 var p = $("input[name*='skuPrice']");
760 var q = $("input[name*='quant']");
761 var t = $("p[id*='sub_total']");
762 var db = $("input[name*='delButton']");
763 var sub_total = <?php echo apply_filters( 'order_edit_form_sub_total', 0, $data ); ?>;
764 var total_full = 0;
765 var n = <?php echo wp_kses_data( $this->get_currency_decimal() ); ?>;
766
767 for( var i = 0; i < p.length; i++ ) {
768 v = parseFloat($(p[i]).val()) * $(q[i]).val();
769 if( 0 < n ) {
770 v = Math.round( v * Math.pow( 10, n ) ) / Math.pow( 10, n );
771 }
772 $(t[i]).html(addComma(v+''));
773 sub_total += v;
774 sub_total = Math.round( sub_total * Math.pow( 10, n ) ) / Math.pow( 10, n );
775 }
776
777 $("#item_total").html(addComma(sub_total+''));
778 var order_usedpoint = $("#order_usedpoint").val()*1;
779 var order_discount = parseFloat($("#order_discount").val());
780 var order_shipping_charge = parseFloat($("#order_shipping_charge").val());
781 var order_cod_fee = parseFloat($("#order_cod_fee").val());
782 var order_tax = parseFloat($("#order_tax").val());
783 total_full = sub_total - order_usedpoint + order_discount + order_shipping_charge + order_cod_fee + order_tax;
784 if( 0 < n ) {
785 total_full = Math.round( total_full * Math.pow( 10, n ) ) / Math.pow( 10, n );
786 }
787 $("#total_full").html(addComma(total_full+''));
788 $("#total_full_top").html(addComma(total_full+''));
789 <?php
790 endif;
791 ?>
792 <?php do_action( 'order_edit_form_sumPrice', $data ); ?>
793 },
794 make_delivery_time : function(selected) {
795 var option = '';
796 if(selected == -1 || delivery_time[selected] == undefined || 0 == delivery_time[selected].length){
797 option += '<option value="<?php esc_html_e( 'Non-request', 'usces_dual' ); ?>"><?php esc_html_e( 'Non-request', 'usces_dual' ); ?></option>' + "\n";
798 }else{
799 for(var i=0; i<delivery_time[selected].length; i++){
800 if( delivery_time[selected][i] == selected_delivery_time ) {
801 option += '<option value="' + delivery_time[selected][i] + '" selected="selected">' + delivery_time[selected][i] + '</option>' + "\n";
802 }else{
803 option += '<option value="' + delivery_time[selected][i] + '">' + delivery_time[selected][i] + '</option>' + "\n";
804 }
805 }
806 }
807 $("#delivery_time_select").html(option);
808 },
809 getMember : function( email ) {
810 var s = orderfunc.settings;
811 var wc_nonce = $("#wc_nonce").val();
812 s.url = uscesL10n.requestFile;
813 s.data = "action=order_item_ajax&mode=getmember&email=" + encodeURIComponent(email) + "&wc_nonce=" + wc_nonce;
814 $.ajax( s ).done(function( data ){
815 if(data.status_code === 'ok'){
816 for (var key in data) {
817 if ( 'status_code' == key ) {
818 continue;
819 }
820 value = data[key];
821 if('member_id' == key){
822 $("#member_id_label").html(value);
823 $("#member_id").val(value);
824 continue;
825 }
826 if ( $(":input[name='" + key + "']").length ) {
827 $(":input[name='" + key + "']").val(value);
828 }
829 }
830 }else if(data.status_code === 'none'){
831 alert( '<?php esc_html_e( 'The relevant membership information does not exist.', 'usces' ); ?>' );
832 }else{
833 alert( '<?php esc_html_e( 'Membership information could not be retrieved.', 'usces' ); ?>' );
834 }
835 }).fail(function( data ){
836 alert( '<?php esc_html_e( 'Membership information could not be retrieved.', 'usces' ); ?>' );
837 });
838 return false;
839 },
840 recalculation : function() {
841 <?php if ( usces_is_membersystem_point() ) : ?>
842 if( false == check_usedPoint( $("#order_usedpoint").val() ) ){
843 $("#order_usedpoint").css({'background-color': '#FFA'}).click(function() {
844 $(this).css({'background-color': '#FFF'});
845 });
846 document.getElementById('order_usedpoint').focus();
847 return false;
848 }
849 <?php
850 endif;
851 if ( $reduced_taxrate ) :
852 $script = "
853 var p = $( \"input[name*='skuPrice']\" );
854 var q = $( \"input[name*='quant']\" );
855 var pi = $( \"input[name*='postId']\" );
856 var post_ids = [];
857 var prices = [];
858 var quants = [];
859 var cart_ids = [];
860 for( var i = 0; i < p.length; i++ ) {
861 var piname = $( pi[i] ).attr( 'name' );
862 namestrs = piname.split( '[' );
863 post_ids.push( $( pi[i] ).val() );
864 prices.push( parseFloat( $(p[i]).val() ) );
865 quants.push( $( q[i] ).val() );
866 cart_ids.push( namestrs[1].replace( /[\]]+$/g, '' ) );
867 }
868 var order_usedpoint = $( '#order_usedpoint' ).val()*1;
869 var order_shipping_charge = parseFloat( $( '#order_shipping_charge' ).val() );
870 var order_cod_fee = parseFloat( $( '#order_cod_fee' ).val() );
871 var discount_standard = parseFloat( $( '#order_discount_standard' ).val() );
872 var discount_reduced = parseFloat( $( '#order_discount_reduced' ).val() );
873 var change_taxrate = $( \"input[name='change_taxrate']:checked\" ).val();
874 var s = orderfunc.settings;
875 s.url = uscesL10n.requestFile;
876 s.data = {
877 action: 'order_item_ajax',
878 mode: 'recalculation_reduced',
879 wc_nonce: $( '#wc_nonce' ).val(),
880 order_id: $( '#order_id' ).val(),
881 mem_id: $( '#member_id_label' ).html(),
882 post_ids: post_ids,
883 prices: prices,
884 quants: quants,
885 cart_ids: cart_ids,
886 upoint: order_usedpoint,
887 shipping_charge: order_shipping_charge,
888 cod_fee: order_cod_fee,
889 discount_standard: discount_standard,
890 discount_reduced: discount_reduced,
891 change_taxrate: change_taxrate
892 }
893 s.dataType = 'json';
894 $.ajax( s ).done(function( data ) {
895 if( 'ok' == data.status ) {
896 //console.log( data );
897 $( '#order_discount' ).val( data.discount );
898 $( '#order_tax' ).val( data.tax );
899 $( '#order_getpoint' ).val( data.point );
900 $( '#total_full' ).html( addComma( data.total_full_price+'' ) );
901 $( '#total_full_top' ).html( addComma( data.total_full_price+'' ) );
902 $( '#subtotal_standard' ).html( addComma( parseFloat( data.subtotal_standard )+parseFloat( data.discount_standard )+'' ) );
903 $( '#subtotal_reduced' ).html( addComma( parseFloat( data.subtotal_reduced )+parseFloat( data.discount_reduced )+'' ) );
904 if( 'change' == change_taxrate ) {
905 $( '#order_discount_standard' ).val( data.discount_standard );
906 $( '#order_discount_reduced' ).val( data.discount_reduced );
907 }
908 $( '#order_subtotal_standard' ).val( data.subtotal_standard );
909 $( '#order_subtotal_reduced' ).val( data.subtotal_reduced );
910 if( 0 < data.tax ) {
911 $( '#order_tax_standard' ).val( data.tax_standard );
912 $( '#order_tax_reduced' ).val( data.tax_reduced );
913 } else {
914 $( '#include_tax_standard' ).html( '(' + addComma( data.tax_standard+'' ) + ')' );
915 $( '#include_tax_reduced' ).html( '(' + addComma( data.tax_reduced+'' ) + ')' );
916 $( '#include_tax' ).html( '(' + addComma( data.include_tax+'' ) + ')' );
917 }
918 $( \"input[name='change_taxrate']\" ).prop( 'checked', false );
919 } else {
920 console.log( data );
921 //alert( 'ERROR1' );
922 }
923 }).fail(function( data ) {
924 console.log( data );
925 //alert( 'ERROR2' );
926 });
927 return false;";
928 echo apply_filters( 'order_edit_form_recalculation_reduced', $script, $data );
929 else :
930 $script = "
931 var p = $( \"input[name*='skuPrice']\" );
932 var q = $( \"input[name*='quant']\" );
933 var pi = $( \"input[name*='postId']\" );
934 var post_ids = [];
935 var prices = [];
936 var quants = [];
937 var cart_ids = [];
938 for( var i = 0; i < p.length; i++ ) {
939 var piname = $( pi[i] ).attr( 'name' );
940 namestrs = piname.split( '[' );
941 post_ids.push( $( pi[i] ).val() );
942 prices.push( parseFloat( $(p[i]).val() ) );
943 quants.push( $( q[i] ).val() );
944 cart_ids.push( namestrs[1].replace( /[\]]+$/g, '' ) );
945 }
946 var order_usedpoint = $( '#order_usedpoint' ).val()*1;
947 var order_shipping_charge = parseFloat( $( '#order_shipping_charge' ).val() );
948 var order_cod_fee = parseFloat( $( '#order_cod_fee' ).val() );
949 var order_discount = parseFloat( $( '#order_discount' ).val() );
950 var change_taxrate = $( \"input[name='change_taxrate']:checked\" ).val();
951 var s = orderfunc.settings;
952 s.url = uscesL10n.requestFile;
953 s.dataType = 'json';
954 s.data = {
955 action: 'order_item_ajax',
956 mode: 'recalculation',
957 wc_nonce: $( '#wc_nonce' ).val(),
958 order_id: $( '#order_id' ).val(),
959 mem_id: $( '#member_id_label' ).html(),
960 post_ids: post_ids,
961 prices: prices,
962 quants: quants,
963 cart_ids: cart_ids,
964 upoint: order_usedpoint,
965 shipping_charge: order_shipping_charge,
966 cod_fee: order_cod_fee,
967 discount: order_discount,
968 change_taxrate: change_taxrate
969 }
970 $.ajax( s ).done(function( data ) {
971 if( 'ok' == data.status ) {
972 //console.log( data );
973 if( 'reduced' == data.tax_mode ) {
974 window.location.reload();
975 } else {
976 $( '#order_discount' ).val( data.discount );
977 $( '#order_tax' ).val( data.tax );
978 $( '#include_tax' ).html( data.include_tax );
979 $( '#order_getpoint' ).val( data.point );
980 $( '#total_full' ).html( addComma( data.total_full_price+'' ) );
981 $( '#total_full_top' ).html( addComma( data.total_full_price+'' ) );
982 }
983 $( \"input[name='change_taxrate']\" ).prop( 'checked', false );
984 } else {
985 console.log( data );
986 //alert( 'ERROR1' );
987 }
988 }).fail(function( data ) {
989 console.log( data );
990 //alert( 'ERROR2' );
991 });
992 return false;";
993 echo apply_filters( 'order_edit_form_recalculation', $script, $data );
994 endif;
995 ?>
996 },
997 <?php
998 if ( $reduced_taxrate ) :
999 ?>
1000 sumDiscount : function() {
1001 if( "" == $( "#order_discount_standard" ).val() || !checkNumMinus( $( "#order_discount_standard" ).val() ) ) {
1002 $( "#order_discount_standard" ).val( "0" );
1003 }
1004 if( "" == $( "#order_discount_reduced" ).val() || !checkNumMinus( $( "#order_discount_reduced" ).val() ) ) {
1005 $( "#order_discount_reduced" ).val( "0" );
1006 }
1007 var n = <?php echo esc_js( $this->get_currency_decimal() ); ?>;
1008 var order_discount = parseFloat( $( "#order_discount_standard" ).val() ) + parseFloat( $( "#order_discount_reduced" ).val() );
1009 order_discount = Math.round( order_discount * Math.pow( 10, n ) ) / Math.pow( 10, n );
1010 $( '#order_discount' ).val( order_discount );
1011 },
1012 sumTax : function() {
1013 if( "" == $( "#order_tax_standard" ).val() || !checkNum( $( "#order_tax_standard" ).val() ) ) {
1014 $( "#order_tax_standard" ).val( "0" );
1015 }
1016 if( "" == $( "#order_tax_reduced" ).val() || !checkNum( $( "#order_tax_reduced" ).val() ) ) {
1017 $( "#order_tax_reduced" ).val( "0" );
1018 }
1019 var n = <?php echo esc_js( $this->get_currency_decimal() ); ?>;
1020 var order_tax = parseFloat( $( "#order_tax_standard" ).val() ) + parseFloat( $( "#order_tax_reduced" ).val() );
1021 order_tax = Math.round( order_tax * Math.pow( 10, n ) ) / Math.pow( 10, n );
1022 $( '#order_tax' ).val( order_tax );
1023 },
1024 <?php
1025 endif;
1026 ?>
1027 settings: {
1028 url: uscesL10n.requestFile,
1029 type: 'POST',
1030 cache: false
1031 }
1032 };
1033
1034 uscesMail = {
1035 sendmail : function() {
1036 if($("#sendmailaddress").val() == "") return;
1037 var email_attach_feature = <?php echo (int) $this->options['email_attach_feature']; ?>;
1038 if (email_attach_feature == 1) {
1039 if(!uscesMail.validateFileAttach()) return;
1040 }
1041
1042 var address = encodeURIComponent($("#sendmailaddress").val());
1043 <?php if ( 1 === $add_html_email_option ) { ?>
1044 var iframe = document.getElementById("iframeLoadEditor");
1045 var message = encodeURIComponent(iframe.contentWindow.getContentEditor());
1046 <?php } else { ?>
1047 var message = encodeURIComponent($("#sendmailmessage").val());
1048 <?php } ?>
1049 var name = encodeURIComponent($("#sendmailname").val());
1050 var subject = encodeURIComponent($("#sendmailsubject").val());
1051 var order_id = $("#order_id").val();
1052 var checked = $("#mailChecked").val();
1053 var attachFile = document.getElementById("sendmailattachfile");
1054
1055 var s = Object.assign({}, uscesMail.settings);
1056 s.contentType = false;
1057 s.processData = false;
1058
1059 var formData = new FormData();
1060 formData.append('action', 'order_item_ajax');
1061 formData.append('mode', 'sendmail');
1062 formData.append('wc_nonce', '<?php echo wp_create_nonce( 'wc_send_mail_order_nonce' ); ?>');
1063 formData.append('mailaddress', address);
1064 formData.append('message', message);
1065 formData.append('name', name);
1066 formData.append('subject', subject);
1067 formData.append('order_id', order_id);
1068 formData.append('checked', checked);
1069 // Attach file
1070 if (email_attach_feature == 1) {
1071 if (attachFile.files[0]) {
1072 formData.append('attachFile', attachFile.files[0]);
1073 } else {
1074 if (!confirm('<?php esc_html_e( 'Are you sure you want to send it without attachments?', 'usces' ); ?>')) return;
1075 }
1076 }
1077 s.data = formData;
1078
1079 <?php echo apply_filters( 'usces_filter_sendmail_js', '' ); ?>
1080
1081 // add loading gif
1082 var img_loading = '<div id="wrap_icon_loading"><img src="' + uscesL10n.USCES_PLUGIN_URL + 'images/loading.gif" /></div>';
1083 $("#usces_email_bnt_send").prop("disabled", true);
1084 $(img_loading).insertBefore("#usces_email_bnt_send");
1085
1086 $.ajax( s ).done(function( data ){
1087 $("#wrap_icon_loading").remove();
1088 $("#usces_email_bnt_send").removeAttr('disabled');
1089 if( $.trim(data) == 'success') {
1090 if(checked == 'completionmail'){
1091 $("input[name='check\[completionmail\]']").prop( "checked", true );
1092 }else if(checked == 'ordermail'){
1093 $("input[name='check\[ordermail\]']").prop( "checked", true );
1094 }else if(checked == 'changemail'){
1095 $("input[name='check\[changemail\]']").prop( "checked", true );
1096 }else if(checked == 'receiptmail'){
1097 $("input[name='check\[receiptmail\]']").prop( "checked", true );
1098 }else if(checked == 'mitumorimail'){
1099 $("input[name='check\[mitumorimail\]']").prop( "checked", true );
1100 }else if(checked == 'cancelmail'){
1101 $("input[name='check\[cancelmail\]']").prop( "checked", true );
1102 }else if(checked == 'othermail'){
1103 $("input[name='check\[othermail\]']").prop( "checked", true );
1104 }
1105 <?php echo apply_filters( 'usces_filter_order_check_mail_js', '' ); ?>
1106
1107 $('#mailSendAlert').dialog('option', 'buttons', [
1108 {
1109 text: 'OK',
1110 "class": 'button',
1111 click: function() {
1112 $(this).dialog('close');
1113 $('#mailSendDialog').dialog('close');
1114 }
1115 }
1116 ]);
1117 $('#mailSendAlert').dialog('option', 'title', 'SUCCESS');
1118 $('#mailSendAlert fieldset').html('<p><?php esc_html_e( 'E-mail has been sent.', 'usces' ); ?></p>');
1119 $('#mailSendAlert').dialog('option', 'close', function() {
1120 $(this).dialog('close');
1121 $('#mailSendDialog').dialog('close');
1122 });
1123 $('#mailSendAlert').dialog( "option", "modal", true );
1124 $('#mailSendAlert').dialog('open');
1125
1126 }else if(data == 'error'){
1127 $('#mailSendAlert').dialog('option', 'buttons', [
1128 {
1129 text: 'OK',
1130 "class": 'button',
1131 click: function() {
1132 $(this).dialog('close');
1133 }
1134 }
1135 ]);
1136 $('#mailSendAlert').dialog('option', 'title', 'ERROR');
1137 $('#mailSendAlert fieldset').html('<p><?php _e( 'Failure in sending e-mails.', 'usces' ); ?></p>');
1138 $('#mailSendAlert').dialog('option', 'close', function() {
1139 $(this).dialog('close');
1140 });
1141 $('#mailSendAlert').dialog( "option", "modal", true );
1142 $('#mailSendAlert').dialog('open');
1143
1144 }else if(data == 'attachFileError'){
1145 $('#mailSendAlert').dialog('option', 'buttons', [
1146 {
1147 text: 'OK',
1148 "class": 'button',
1149 click: function() {
1150 $(this).dialog('close');
1151 }
1152 }
1153 ]);
1154 $('#mailSendAlert').dialog('option', 'title', 'ERROR');
1155 $('#mailSendAlert fieldset').html('<p><?php esc_html_e( 'Failure in attach file e-mails.', 'usces' ); ?></p>');
1156 $('#mailSendAlert').dialog('option', 'close', function() {
1157 $(this).dialog('close');
1158 });
1159 $('#mailSendAlert').dialog( "option", "modal", true );
1160 $('#mailSendAlert').dialog('open');
1161 }
1162 }).fail(function( data ){
1163 $("#wrap_icon_loading").remove();
1164 $("#usces_email_bnt_send").removeAttr('disabled');
1165 $('#mailSendAlert').dialog('option', 'buttons', [
1166 {
1167 text: 'OK',
1168 "class": 'button',
1169 click: function() {
1170 $(this).dialog('close');
1171 }
1172 }
1173 ]);
1174 $('#mailSendAlert').dialog('option', 'title', 'ERROR');
1175 $('#mailSendAlert fieldset').html('<p><?php esc_html_e( 'Failure in sending e-mails.', 'usces' ); ?></p>');
1176 $('#mailSendAlert').dialog('option', 'close', function() {
1177 $(this).dialog('close');
1178 });
1179 $('#mailSendAlert').dialog( "option", "modal", true );
1180 $('#mailSendAlert').dialog('open');
1181 });
1182 return false;
1183 },
1184 ordercheckpost : function( checked ) {
1185 var p = uscesMail.settings;
1186 var order_id = $("#order_id").val();
1187 var wc_nonce = $("#wc_nonce").val();
1188 p.url = uscesL10n.requestFile;
1189 p.data = "action=order_item_ajax&mode=ordercheckpost&order_id=" + order_id + "&checked=" + checked + "&wc_nonce=" + wc_nonce;
1190 $.ajax( p ).done(function( data ){
1191 if($.trim(data) == 'mitumoriprint'){
1192 $("input[name='check\[mitumoriprint\]']").prop( "checked", true );
1193 }else if($.trim(data) == 'nohinprint'){
1194 $("input[name='check\[nohinprint\]']").prop( "checked", true );
1195 }else if($.trim(data) == 'billprint'){
1196 $("input[name='check\[billprint\]']").prop( "checked", true );
1197 }else if($.trim(data) == 'receiptprint'){
1198 $("input[name='check\[receiptprint\]']").prop( "checked", true );
1199 }
1200 <?php echo apply_filters( 'usces_filter_order_check_print_js', '' ); ?>
1201 }).fail(function( data ){ });
1202 return false;
1203 },
1204 settings: {
1205 url: uscesL10n.requestFile,
1206 type: 'POST',
1207 cache: false
1208 },
1209 validateFileAttach: function() {
1210 var checkValidSize = true;
1211 var checkValidExtension = true;
1212 var attachFile = document.getElementById("sendmailattachfile");
1213 var maximunFileSize = <?php echo (int) $this->options['email_attach_file_size']; ?>; // unit is Mb
1214 var validFileExtensions = <?php echo json_encode( $email_attach_file_extension ); ?>; // file extension
1215 if (attachFile && attachFile.files[0]) {
1216 // validate file size
1217 if (maximunFileSize > 0) {
1218 if(attachFile.files[0].size > (maximunFileSize*1000000)){
1219 checkValidSize = false;
1220 };
1221 }
1222 // validate file extension
1223 if (validFileExtensions.length > 0) {
1224 checkValidExtension = false;
1225 var filename = attachFile.files[0].name;
1226 var aux = filename.split('.');
1227 if (aux.length > 1) {
1228 var extension = aux[aux.length -1].toLowerCase();
1229 for (var j = 0; j < validFileExtensions.length; j++) {
1230 var sCurExtension = validFileExtensions[j];
1231 if (extension == sCurExtension.toLowerCase()) {
1232 checkValidExtension = true;
1233 break;
1234 }
1235 }
1236 }
1237 }
1238 }
1239
1240 if (!checkValidSize || !checkValidExtension) {
1241 var msgSize = '';
1242 var msgExtension = '';
1243 attachFile.value = "";
1244 $('#mailSendAlert').dialog('option', 'buttons', [
1245 {
1246 text: 'OK',
1247 "class": 'button',
1248 click: function() {
1249 $(this).dialog('close');
1250 }
1251 }
1252 ]);
1253 if (!checkValidSize) {
1254 msgSize = "<p><?php esc_html_e( 'The maximum file size that can be attached has been exceeded.', 'usces' ); ?></p>";
1255 }
1256 if (!checkValidExtension) {
1257 msgExtension = "<p><?php esc_html_e( 'This is not a file extension that can be attached.', 'usces' ); ?></p>";
1258 }
1259 var content = msgSize + msgExtension;
1260 $('#mailSendAlert').dialog('option', 'title', 'ERROR');
1261 $('#mailSendAlert fieldset').html(content);
1262 $('#mailSendAlert').dialog('option', 'close', function() {
1263 $(this).dialog('close');
1264 });
1265 $('#mailSendAlert').dialog( "option", "modal", true );
1266 $('#mailSendAlert').dialog('open');
1267 return false;
1268 }
1269 return true;
1270 },
1271 previewMail: function() {
1272 var iframe = document.getElementById("iframeLoadEditor");
1273 var content = iframe.contentWindow.getContentEditor();
1274 var img_loading = '<div id="wrap_icon_loading"><img src="' + uscesL10n.USCES_PLUGIN_URL + 'images/loading.gif" /></div>';
1275 $(img_loading).insertBefore("#usces_email_bnt_preview");
1276 $("#usces_email_bnt_preview").prop("disabled", true);
1277
1278 var setting = Object.assign({}, uscesMail.settings);
1279 setting.data = {
1280 'action': 'usces_filter_content_wp_editor_preview',
1281 'mode': 'preview_email_order_detail',
1282 'wc_nonce': '<?php echo wp_create_nonce( 'wc_preview_editor_nonce' ); ?>',
1283 'content': content,
1284 };
1285 $.ajax(setting).done(function(res) {
1286 $("#wrap_icon_loading").remove();
1287 if (res && res.status) {
1288 var dstFrame = document.getElementById('iframePreviewEmail');
1289 var dstDoc = dstFrame.contentDocument || dstFrame.contentWindow.document;
1290 dstDoc.write(res.content);
1291 dstDoc.close();
1292
1293 $('#previewEmailDialog').dialog('option', 'title', "<?php esc_html_e( 'Preview email content', 'usces' ); ?>");
1294 $('#previewEmailDialog').dialog('open');
1295 } else {
1296 uscesMail.contentPreviewErrorShow( '<?php esc_html_e( 'Failure preview email.', 'usces' ); ?>' );
1297 }
1298 $("#usces_email_bnt_preview").removeAttr('disabled');
1299 }).fail(function(msg) {
1300 $("#usces_email_bnt_preview").removeAttr('disabled');
1301 $("#wrap_icon_loading").remove();
1302 uscesMail.contentPreviewErrorShow( msg );
1303 });
1304 },
1305 contentPreviewErrorShow: function( msg ) {
1306 var dstFrame = document.getElementById('iframePreviewEmail');
1307 var dstDoc = dstFrame.contentDocument || dstFrame.contentWindow.document;
1308 dstDoc.write( msg );
1309 dstDoc.close();
1310 jQuery('#previewEmailDialog').dialog('option', 'title', 'ERROR');
1311 jQuery('#previewEmailDialog').dialog('open');
1312 }
1313 };
1314
1315 $('form').submit(function() {
1316 var error = 0;
1317 <?php if ( usces_is_membersystem_point() ) : ?>
1318 if( false == check_usedPoint( $("#order_usedpoint").val() ) ){
1319 error++;
1320 $("#order_usedpoint").css({'background-color': '#FFA'}).click(function() {
1321 $(this).css({'background-color': '#FFF'});
1322 });
1323 }
1324 <?php endif; ?>
1325 if( !checkNum( $("#order_getdpoint").val() ) ) {
1326 error++;
1327 $("#order_getdpoint").css({'background-color': '#FFA'}).click(function() {
1328 $(this).css({'background-color': '#FFF'});
1329 });
1330 }
1331 if( !checkPrice( $("#order_discount").val() ) ) {
1332 error++;
1333 $("#order_discount").css({'background-color': '#FFA'}).click(function() {
1334 $(this).css({'background-color': '#FFF'});
1335 });
1336 }
1337 if( !checkPrice( $("#order_shipping_charge").val() ) ) {
1338 error++;
1339 $("#order_shipping_charge").css({'background-color': '#FFA'}).click(function() {
1340 $(this).css({'background-color': '#FFF'});
1341 });
1342 }
1343 if( !checkPrice( $("#order_cod_fee").val() ) ) {
1344 error++;
1345 $("#order_cod_fee").css({'background-color': '#FFA'}).click(function() {
1346 $(this).css({'background-color': '#FFF'});
1347 });
1348 }
1349 if( !checkPrice( $("#order_tax").val() ) ) {
1350 error++;
1351 $("#order_tax").css({'background-color': '#FFA'}).click(function() {
1352 $(this).css({'background-color': '#FFF'});
1353 });
1354 }
1355
1356 if( 0 < error ) {
1357 $("#aniboxStatus").removeClass("none");
1358 $("#aniboxStatus").addClass("error");
1359 $("#info_image").attr("src", "<?php echo esc_url_raw( USCES_PLUGIN_URL ); ?>/images/list_message_error.gif");
1360 $("#info_massage").html("<?php esc_html_e( 'Data have deficiency.', 'usces' ); ?>");
1361 $("#anibox").animate({ backgroundColor: "#FFE6E6" }, 2000);
1362 return false;
1363 } else {
1364 return true;
1365 }
1366 });
1367
1368 $( document ).on( 'click', '.delCartButton', function() {
1369 if( confirm( "<?php esc_html_e( 'Are you sure of deleting items?', 'usces' ); ?>" ) ) {
1370 return true;
1371 } else {
1372 return false;
1373 }
1374 });
1375 <?php
1376 do_action( 'usces_action_order_edit_page_js', $order_id, $data );
1377 echo apply_filters( 'usces_filter_order_edit_page_js', '', $order_id );
1378
1379 $delivery_date_select_script = "
1380 $( function() {
1381 $.datepicker.setDefaults( $.datepicker.regional['ja'] );
1382 $( '#delivery_date_select' ).datepicker({
1383 dateFormat: 'yy-mm-dd',
1384 minDate: new Date( " . $order_yy . ', ' . $order_mm . ', ' . $order_dd . " )
1385 });
1386 $( '#delidue_date_select' ).datepicker({
1387 dateFormat: 'yy-mm-dd',
1388 minDate: new Date( " . $order_yy . ', ' . $order_mm . ', ' . $order_dd . " )
1389 });
1390 });\n";
1391 echo apply_filters( 'usces_filter_order_edit_delivery_days_select_script', $delivery_date_select_script );
1392 ?>
1393 });
1394
1395 function addComma(str) {
1396 var strs = str.split('.');
1397 cnt = 0;
1398 n = "";
1399 m = "";
1400 if( strs[0].substr(0, 1) == "-" ) {
1401 m = "-";
1402 strs[0] = strs[0].substr(1);
1403 }
1404 for (i=strs[0].length-1; i>=0; i--)
1405 {
1406 n = strs[0].charAt(i) + n;
1407 cnt++;
1408 if (((cnt % 3) == 0) && (i != 0)) n = ","+n;
1409 }
1410 n = m + n;
1411 if(undefined != strs[1]){
1412 res = n + '.' + strs[1];
1413 }else{
1414 res = n;
1415 }
1416 return res;
1417 }
1418
1419 function removeComma(str) {
1420 var removed = str.split(',').join('');
1421 return parseInt(removed);
1422 }
1423
1424 function pdfWindow( type ) {
1425 var wx = 800;
1426 var wy = 900;
1427 var x = (screen.width- wx) / 2;
1428 var y = (screen.height - wy) / 2;
1429 x = 0;
1430 y = 0;
1431 printWin = window.open("<?php echo esc_url_raw( USCES_ADMIN_URL . '?page=usces_orderlist&order_action=pdfout&order_id=' . $order_id ); ?>"+"&type="+type,"sub","left="+x+",top="+y+",width="+wx+",height="+wy+",scrollbars=yes");
1432 }
1433
1434 function checkNumMinus( argValue ) {
1435 if( argValue.match(/[^0-9|^\-|^\.]/g) ) {
1436 return false;
1437 }
1438 return true;
1439 }
1440
1441 function check_usedPoint( usedpoint ) {
1442 var ret = true;
1443 if( undefined == usedpoint || 0 == parseInt(usedpoint) ) {
1444 return ret;
1445 }
1446 if( !checkNum(usedpoint) ) {
1447 alert('<?php esc_html_e( 'Please enter a numeric value.', 'usces' ); ?>');
1448 ret = false;
1449 }
1450 var mem_id = <?php echo ( isset( $data['mem_id'] ) ? esc_js( $data['mem_id'] ) : 0 ); ?>;
1451 if( 0 == mem_id && 0 != usedpoint ){
1452 alert('<?php esc_html_e( 'As a non-member, points cannot be entered.', 'usces' ); ?>');
1453 ret = false;
1454 }
1455 if( 0 > usedpoint ){
1456 alert('<?php esc_html_e( 'Invalid value. Please enter in the numbers.', 'usces' ); ?>');
1457 ret = false;
1458 }
1459 if( 0 != mem_id ){
1460 var mem_point = <?php echo esc_js( $mem_point ); ?> + <?php echo ( isset( $data['order_usedpoint'] ) ? esc_js( $data['order_usedpoint'] ) : 0 ); ?>;
1461 var point_coverage = <?php echo ( isset( $this->options['point_coverage'] ) ? esc_js( $this->options['point_coverage'] ) : 0 ); ?>;
1462 var total_items_price = removeComma(document.getElementById("item_total").innerHTML);
1463 var discount = parseFloat(document.getElementById("order_discount").value );
1464 var shipping_charge = parseFloat(document.getElementById("order_shipping_charge").value );
1465 var cod_fee = parseFloat(document.getElementById("order_cod_fee").value );
1466 var tax = parseFloat(document.getElementById("order_tax").value );
1467 var tax_target = '<?php echo ( isset( $tax_target ) ? esc_js( $tax_target ) : '' ); ?>';
1468 if( mem_point < usedpoint ){
1469 alert('<?php esc_html_e( 'You have exceeded the maximum available.', 'usces' ) . ' ' . esc_html_e( 'Max', 'usces' ); ?>' + mem_point + '<?php esc_html_e( 'points', 'usces' ); ?>' );
1470 ret = false;
1471 }
1472 else{
1473 if( point_coverage == 1 ){
1474 target_full_price = total_items_price + discount + shipping_charge + cod_fee + tax;
1475 if( usedpoint > target_full_price ){
1476 alert('<?php esc_html_e( 'You have exceeded the maximum available.', 'usces' ) . ' ' . esc_html_e( 'Max', 'usces' ); ?>' + target_full_price + '<?php esc_html_e( 'points', 'usces' ); ?>' );
1477 ret = false;
1478 }
1479 }
1480 else{
1481 target_item_price = total_items_price + discount;
1482 if( tax_target == 'products' ){
1483 target_item_price += tax;
1484 }
1485 if( usedpoint > target_item_price ){
1486 alert('<?php esc_html_e( 'You have exceeded the maximum available.', 'usces' ) . ' ' . esc_html_e( 'Max', 'usces' ); ?>' + target_item_price + '<?php esc_html_e( 'points', 'usces' ); ?>' );
1487 ret = false;
1488 }
1489 }
1490 }
1491 }
1492 return ret;
1493 }
1494
1495 function delConfirm(){
1496 if(confirm('<?php esc_html_e( 'Are you sure of deleting items?', 'usces' ); ?>')){
1497 return true;
1498 }else{
1499 return false;
1500 }
1501 }
1502
1503 jQuery(document).ready(function($){
1504 // load show nav prev, next link.
1505 <?php
1506 $nonce_url = esc_url_raw( USCES_ADMIN_URL ) . '?page=usces_orderlist&order_action=edit&wc_nonce=' . wp_create_nonce( 'order_edit' ) . '&order_id=';
1507 ?>
1508 var sub_uri_link = '<?php echo $nonce_url; ?>';
1509
1510 welPageNav.checkShowNextprevPage( 'wel_order_current_page_ids', sub_uri_link, <?php echo esc_attr( $order_id ); ?> );
1511
1512 $(document).on( "click", "#mailVisiLink", function() {
1513 if( $("#mailBox").css("display") == "block" ) {
1514 $("#mailBox").css("display", "none");
1515 $("#mailVisiLink").html('<?php esc_html_e( 'Show the mail/print field', 'usces' ); ?><span class="dashicons dashicons-arrow-down"></span>');
1516 } else {
1517 $("#mailBox").css("display", "block");
1518 $("#mailVisiLink").html('<?php esc_html_e( 'Hide the mail/print field', 'usces' ); ?><span class="dashicons dashicons-arrow-up"></span>');
1519 }
1520 });
1521
1522 orderfunc.sumPrice(null);
1523
1524 $( document ).on( "change", "input[name*='skuPrice']", function() {
1525 orderfunc.sumPrice( $(this) );
1526 });
1527 $( document ).on( "change", "input[name*='quant']", function() {
1528 orderfunc.sumPrice( $(this) );
1529 });
1530 $( document ).on( "click", "input[name*='delButton']", function() {
1531 orderfunc.sumPrice( null );
1532 });
1533 $( document ).on( "change", "#order_usedpoint", function() {
1534 orderfunc.sumPrice( $("#order_usedpoint") );
1535 });
1536 <?php
1537 if ( $reduced_taxrate ) :
1538 ?>
1539 $( document ).on( "change", "#order_discount_standard", function() {
1540 orderfunc.sumDiscount();
1541 orderfunc.sumPrice( null );
1542 });
1543 $( document ).on( "change", "#order_discount_reduced", function() {
1544 orderfunc.sumDiscount();
1545 orderfunc.sumPrice( null );
1546 });
1547 <?php
1548 endif;
1549 ?>
1550 $( document ).on( "change", "#order_discount", function() {
1551 orderfunc.sumPrice( $("#order_discount") );
1552 });
1553 $( document ).on( "change", "#order_shipping_charge", function() {
1554 orderfunc.sumPrice( $("#order_shipping_charge") );
1555 });
1556 $( document ).on( "change", "#order_cod_fee", function() {
1557 orderfunc.sumPrice( $("#order_cod_fee") );
1558 });
1559 <?php
1560 if ( $reduced_taxrate ) :
1561 ?>
1562 $( document ).on( "change", "#order_tax_standard", function() {
1563 orderfunc.sumTax();
1564 orderfunc.sumPrice( null );
1565 });
1566 $( document ).on( "change", "#order_tax_reduced", function() {
1567 orderfunc.sumTax();
1568 orderfunc.sumPrice( null );
1569 });
1570 <?php
1571 endif;
1572 ?>
1573 $( document ).on( "change", "#order_tax", function() {
1574 orderfunc.sumPrice( $("#order_tax") );
1575 });
1576 $( document ).on( "click", "input[name*='update_order_edit']", function() {
1577 if( ('completion' == $("#order_taio option:selected").val() || 'continuation' == $("#order_taio option:selected").val()) && '<?php echo substr( get_date_from_gmt( gmdate( 'Y-m-d H:i:s', time() ) ), 0, 10 ); ?>' != $('#modified').val() ){
1578 if( confirm("<?php esc_html_e( "Are you sure you want to change to today's date Date of renovation?", 'usces' ); ?>\n<?php esc_html_e( 'Please press the cancel If you want to update without changing the modified date.', 'usces' ); ?>") ){
1579 $('#up_modified').val('update');
1580 }else{
1581 $('#up_modified').val('');
1582 }
1583 }
1584 <?php do_action( 'usces_action_update_order_edit_js', $order_id, $data ); ?>
1585 return true;
1586 });
1587 orderfunc.make_delivery_time(<?php echo esc_js( $order_delivery_method ); ?>);
1588
1589 $( document ).on( "click", "#get_member", function() {
1590 if( '' == $("input[name='customer[mailaddress]']").val() ){
1591 alert("<?php esc_html_e( 'Enter the e-mail.', 'usces' ); ?>");
1592 return;
1593 }
1594 if( '' != $("input[name='customer[name1]']").val() || '' != $("input[name='delivery[name1]']").val() ){
1595 if( !confirm("<?php esc_html_e( "I will overwrite the ship-to address the customer's address. Would you like?", 'usces' ); ?>") ){
1596 return;
1597 }
1598 }
1599 orderfunc.getMember($("input[name='customer[mailaddress]']").val());
1600 });
1601 <?php
1602 if ( 'new' === $order_action ) :
1603 ?>
1604 $( document ).on( "click", "#customercopy", function() {
1605 if( '' != $("input[name='delivery[name1]']").val() ||
1606 '' != $("input[name='delivery[name2]']").val() ||
1607 '' != $("input[name='delivery[name3]']").val() ||
1608 '' != $("input[name='delivery[name4]']").val() ||
1609 '' != $("input[name='delivery[zipcode]']").val() ||
1610 '' != $("input[name='delivery[address1]']").val() ||
1611 '' != $("input[name='delivery[address2]']").val() ||
1612 '' != $("input[name='delivery[address3]']").val() ||
1613 '' != $("input[name='delivery[tel]']").val() ||
1614 '' != $("input[name='delivery[fax]']").val() ) {
1615 if( !confirm("<?php esc_html_e( 'I will overwrite the ship-to address the customer\'s address. Would you like?', 'usces' ); ?>") ) {
1616 return;
1617 }
1618 }
1619 $("input[name='delivery[name1]']").val($("input[name='customer[name1]']").val());
1620 $("input[name='delivery[name2]']").val($("input[name='customer[name2]']").val());
1621 $("input[name='delivery[name3]']").val($("input[name='customer[name3]']").val());
1622 $("input[name='delivery[name4]']").val($("input[name='customer[name4]']").val());
1623 $("input[name='delivery[zipcode]']").val($("input[name='customer[zipcode]']").val());
1624 $("#delivery_country").val($("#customer_country option:selected").val());
1625 $("#delivery_pref").val($("#customer_pref option:selected").val());
1626 $("input[name='delivery[address1]']").val($("input[name='customer[address1]']").val());
1627 $("input[name='delivery[address2]']").val($("input[name='customer[address2]']").val());
1628 $("input[name='delivery[address3]']").val($("input[name='customer[address3]']").val());
1629 $("input[name='delivery[tel]']").val($("input[name='customer[tel]']").val());
1630 $("input[name='delivery[fax]']").val($("input[name='customer[fax]']").val());
1631 });
1632 <?php
1633 endif;
1634 ?>
1635
1636 $( document ).on( "click", "#recalc", function() {
1637 orderfunc.recalculation();
1638 });
1639 <?php
1640 if ( $reduced_taxrate ) :
1641 if ( ! $usces_tax->was_reduced_taxrate_before( $order_id ) ) :
1642 ?>
1643 jQuery.event.add( window, "load", function() {
1644 orderfunc.sumDiscount();
1645 orderfunc.sumTax();
1646 orderfunc.sumPrice();
1647 });
1648 <?php
1649 endif;
1650 endif;
1651 ?>
1652 });
1653 </script>
1654 <script type="text/javascript">
1655 jQuery(document).ready(function($) {
1656 var formChanged = false;
1657
1658 $('#order_editpost_form').change(function() {
1659 formChanged = true;
1660 });
1661
1662 window.onbeforeunload = function() {
1663 if (formChanged) {
1664 return true;
1665 }
1666 };
1667
1668 $('#order_editpost_form').submit(function() {
1669 formChanged = false;
1670 });
1671 });
1672 </script>
1673
1674 <div class="wrap">
1675 <div class="usces_admin">
1676 <form id="order_editpost_form" action="<?php echo esc_url_raw( USCES_ADMIN_URL . '?page=usces_orderlist&order_action=' . $oa ); ?>" method="post" name="editpost">
1677 <h1>Welcart Management <?php esc_html_e( 'Edit order data', 'usces' ); ?></h1>
1678 <p class="version_info">Version <?php echo esc_html( USCES_VERSION ); ?></p>
1679 <?php
1680 usces_admin_action_status();
1681 if ( $navibutton ) {
1682 echo '<div class="edit_pagenav">' . $navibutton . '</div>';
1683 }
1684 ?>
1685 <div class="usces_tablenav usces_tablenav_top">
1686 <div class="ordernavi"><input name="update_order_edit" class="button button-primary" type="submit" value="<?php esc_attr_e( 'change decision', 'usces' ); ?>" /><?php esc_html_e( "When you change amount, please click 'Edit' before you finish your process.", 'usces' ); ?></div>
1687 <div id="mailVisiLink" class="screen-field"><?php esc_html_e( 'Show the mail/print field', 'usces' ); ?><span class="dashicons dashicons-arrow-down"></span></div>
1688 </div><!-- .usces_tablenav .usces_tablenav_top -->
1689 <div id="mailBox">
1690 <?php
1691 $chk_ordermail = ( isset( $ordercheck['ordermail'] ) ) ? ' checked="checked"' : '';
1692 $chk_changemail = ( isset( $ordercheck['changemail'] ) ) ? ' checked="checked"' : '';
1693 $chk_receiptmail = ( isset( $ordercheck['receiptmail'] ) ) ? ' checked="checked"' : '';
1694 $chk_mitumorimail = ( isset( $ordercheck['mitumorimail'] ) ) ? ' checked="checked"' : '';
1695 $chk_cancelmail = ( isset( $ordercheck['cancelmail'] ) ) ? ' checked="checked"' : '';
1696 $chk_othermail = ( isset( $ordercheck['othermail'] ) ) ? ' checked="checked"' : '';
1697 $chk_completionmail = ( isset( $ordercheck['completionmail'] ) ) ? ' checked="checked"' : '';
1698 $chk_mitumoriprint = ( isset( $ordercheck['mitumoriprint'] ) ) ? ' checked="checked"' : '';
1699 $chk_nohinprint = ( isset( $ordercheck['nohinprint'] ) ) ? ' checked="checked"' : '';
1700 $chk_billprint = ( isset( $ordercheck['billprint'] ) ) ? ' checked="checked"' : '';
1701 $chk_receiptprint = ( isset( $ordercheck['receiptprint'] ) ) ? ' checked="checked"' : '';
1702 ?>
1703 <table>
1704 <tr>
1705 <td><input name="check[ordermail]" type="checkbox" value="ordermail"<?php echo esc_attr( $chk_ordermail ); ?> /><a href="#" id="orderConfirmMail"><?php esc_html_e( 'Mail for confirmation of order', 'usces' ); ?></a></td>
1706 <td><input name="check[changemail]" type="checkbox" value="changemail"<?php echo esc_attr( $chk_changemail ); ?> /><a href="#" id="changeConfirmMail"><?php esc_html_e( 'Mail for confiemation of change', 'usces' ); ?></a></td>
1707 <td><input name="check[receiptmail]" type="checkbox" value="receiptmail"<?php echo esc_attr( $chk_receiptmail ); ?> /><a href="#" id="receiptConfirmMail"><?php esc_html_e( 'Mail for confirmation of transter', 'usces' ); ?></a></td>
1708 <td><input name="check[mitumorimail]" type="checkbox" value="mitumorimail"<?php echo esc_attr( $chk_mitumorimail ); ?> /><a href="#" id="mitumoriConfirmMail"><?php esc_html_e( 'estimate mail', 'usces' ); ?></a></td>
1709 <td><input name="check[cancelmail]" type="checkbox" value="cancelmail"<?php echo esc_attr( $chk_cancelmail ); ?> /><a href="#" id="cancelConfirmMail"><?php esc_html_e( 'Cancelling mail', 'usces' ); ?></a></td>
1710 <td><input name="check[othermail]" type="checkbox" value="othermail"<?php echo esc_attr( $chk_othermail ); ?> /><a href="#" id="otherConfirmMail"><?php esc_html_e( 'Other mail', 'usces' ); ?></a></td>
1711 </tr>
1712 <tr>
1713 <td><input name="check[completionmail]" type="checkbox" value="completionmail"<?php echo esc_attr( $chk_completionmail ); ?> /><a href="#" id="completionMail"><?php esc_html_e( 'Mail for Shipping', 'usces' ); ?></a></td>
1714 <td><input name="check[mitumoriprint]" type="checkbox" value="mitumoriprint"<?php echo esc_attr( $chk_mitumoriprint ); ?> /><a href="#" id="mitumoriprint"><?php esc_html_e( 'print out the estimate', 'usces' ); ?></a></td>
1715 <td><input name="check[nohinprint]" type="checkbox" value="nohinprint"<?php echo esc_attr( $chk_nohinprint ); ?> /><a href="#" id="nohinprint"><?php esc_html_e( 'print out Delivery Statement', 'usces' ); ?></a></td>
1716 <td><input name="check[billprint]" type="checkbox" value="billprint"<?php echo esc_attr( $chk_billprint ); ?> /><a href="#" id="billprint"><?php esc_html_e( 'Print Invoice', 'usces' ); ?></a></td>
1717 <td><input name="check[receiptprint]" type="checkbox" value="receiptprint"<?php echo esc_attr( $chk_receiptprint ); ?> /><a href="#" id="receiptprint"><?php esc_html_e( 'Print Receipt', 'usces' ); ?></a></td>
1718 <?php echo apply_filters( 'usces_filter_admin_ordernavi', '<td colspan="2">&nbsp;</td>', $ordercheck ); ?>
1719 </tr>
1720 <tr>
1721 <td colspan="12"><span style="color:#CC3300"><?php esc_html_e( "When there is any change, please press the 'change decision' before you send or print.", 'usces' ); ?></span></td>
1722 </tr>
1723 </table>
1724 </div><!-- #mailBox -->
1725 <?php
1726 $dsp_order_id = ( isset( $data['ID'] ) ) ? $data['ID'] : '';
1727 $dsp_order_deco_id = ( isset( $data['ID'] ) ) ? usces_get_deco_order_id( $data['ID'] ) : '';
1728 $dsp_order_date = ( isset( $data['order_date'] ) ) ? $data['order_date'] : '';
1729 $dsp_order_modified = ( isset( $data['order_modified'] ) ) ? $data['order_modified'] : '';
1730 $dsp_member_id = ( ! empty( $data['mem_id'] ) ) ? $data['mem_id'] : '-';
1731 $hdn_member_id = ( isset( $data['mem_id'] ) ) ? $data['mem_id'] : '';
1732 $hdn_getpoint = ( isset( $data['order_getpoint'] ) ) ? $data['order_getpoint'] : '';
1733 $hdn_usedpoint = ( isset( $data['order_usedpoint'] ) ) ? $data['order_usedpoint'] : '';
1734 $usces_referer = ( isset( $_REQUEST['usces_referer'] ) ) ? $_REQUEST['usces_referer'] : '';
1735 ?>
1736 <div class="info_head">
1737 <table>
1738
1739 <tr>
1740 <td colspan="6" class="midasi0"><?php esc_html_e( 'order details', 'usces' ); ?></td>
1741 </tr>
1742
1743 <?php do_action( 'usces_action_order_edit_form_detail_top', $data, $csod_meta, $filter_args ); ?>
1744
1745 <tr>
1746 <td class="label border"><?php esc_html_e( 'Order number', 'usces' ); ?><br />(<?php echo esc_html( $dsp_order_id ); ?>)</td>
1747 <td class="col1 border"><div class="rod"><?php echo esc_html( $dsp_order_deco_id ); ?></div></td>
1748 <td class="col3 label border"><?php esc_html_e( 'order date', 'usces' ); ?></td>
1749 <td class="col2 border"><div class="rod long"><?php echo esc_html( $dsp_order_date ); ?></div></td>
1750 <td class="label border"><?php echo apply_filters( 'usces_filter_admin_modified_label', __( 'shpping date', 'usces' ) ); ?></td>
1751 <td class="border"><div id="order_modified" class="rod long"><?php echo esc_html( $dsp_order_modified ); ?></div></td>
1752 </tr>
1753
1754 <tr>
1755 <td class="label"><?php esc_html_e( 'membership number', 'usces' ); ?></td>
1756 <td class="col1"><div id="member_id_label" class="rod large short"><?php echo esc_html( $dsp_member_id ); ?></div>
1757 <?php if ( 'new' === $order_action ) { ?>
1758 <input name="member_id" id="member_id" type="hidden" />
1759 <?php } else { ?>
1760 <input name="member_id" id="member_id" type="hidden" value="<?php echo esc_attr( $hdn_member_id ); ?>" />
1761 <?php } ?>
1762 </td>
1763
1764 <td colspan="2" class="wrap_td">
1765 <table border="0" cellspacing="0" class="cus_info">
1766 <tr>
1767 <td class="label"><?php esc_html_e( 'e-mail adress', 'usces' ); ?></td>
1768 <td class="col2"><input name="customer[mailaddress]" type="text" class="text long" value="<?php echo esc_attr( isset( $data['order_email'] ) ? $data['order_email'] : '' ); ?>" />
1769 <input name="get_member" type="button" class="button" id="get_member" value="<?php esc_attr_e( 'Membership information acquisition', 'usces' ); ?>" />
1770 </td>
1771 </tr>
1772 </table>
1773 </td>
1774
1775 <?php
1776 if ( 'new' === $order_action ) :
1777 ?>
1778 <td colspan="2" class="midasi1"><?php esc_html_e( 'shipping address', 'usces' ); ?><input type="button" class="button" id="customercopy" value="<?php esc_attr_e( 'Same shipping address', 'usces' ); ?>"></td>
1779 <?php else : ?>
1780 <td colspan="2" class="midasi1"><?php esc_html_e( 'shipping address', 'usces' ); ?></td>
1781 <?php endif; ?>
1782 </tr>
1783
1784 <tr>
1785 <td colspan="2" class="wrap_td right_area">
1786 <!-- Delivery brock -->
1787 <table border="0" cellspacing="0" class="cus_info">
1788 <tr>
1789 <td class="label"><?php esc_html_e( 'payment method', 'usces' ); ?></td>
1790 <td class="col1">
1791 <select name="offer[payment_name]" id="order_payment_name">
1792 <option value="#none#"><?php esc_html_e( '-- Select --', 'usces' ); ?></option>
1793 <?php
1794 if ( $payment_method ) {
1795 foreach ( (array) $payment_method as $payments ) {
1796 if ( '' != $payments['name'] ) {
1797 $selected = ( isset( $data['order_payment_name'] ) && $payments['name'] === $data['order_payment_name'] ) ? ' selected="selected"' : '';
1798 ?>
1799 <option value="<?php echo esc_attr( $payments['name'] ); ?>"<?php echo esc_attr( $selected ); ?>><?php echo esc_attr( $payments['name'] ); ?></option>
1800 <?php
1801 }
1802 }
1803 }
1804 ?>
1805 </select>
1806 </td>
1807 </tr>
1808 <tr>
1809 <td class="label"><?php esc_html_e( 'shipping option', 'usces' ); ?></td>
1810 <td class="col1">
1811 <select name="offer[delivery_method]" id="delivery_method_select">
1812 <option value="-1"><?php esc_html_e( 'Non-request', 'usces_dual' ); ?></option>
1813 <?php
1814 foreach ( (array) $this->options['delivery_method'] as $dkey => $delivery ) {
1815 $selected = ( $order_delivery_method == $delivery['id'] ) ? ' selected="selected"' : '';
1816 echo "\t<option value='" . esc_attr( $delivery['id'] ) . "'{$selected}>" . esc_attr( $delivery['name'] ) . "</option>\n";
1817 }
1818 ?>
1819 </select>
1820 </td>
1821 </tr>
1822 <tr>
1823 <td class="label"><?php esc_html_e( 'Delivery date', 'usces' ); ?></td>
1824 <td class="col1">
1825 <?php
1826 $delivery_days_select = '<input type="text" name="offer[delivery_date]" id="delivery_date_select" style="width:100%;" value="' . $delivery_date . '" />';
1827 echo apply_filters( 'usces_filter_order_edit_delivery_days_select', $delivery_days_select, $data, $delivery_after_days, $no_preference );
1828 ?>
1829 </td>
1830 </tr>
1831 <tr>
1832 <td class="label"><?php esc_html_e( 'delivery time', 'usces' ); ?></td>
1833 <td class="col1">
1834 <select name="offer[delivery_time]" id="delivery_time_select">
1835 <option value="<?php esc_html_e( 'Non-request', 'usces_dual' ); ?>"><?php esc_html_e( 'Non-request', 'usces_dual' ); ?></option>
1836 </select>
1837 </td>
1838 </tr>
1839 <tr>
1840 <td class="label"><?php esc_html_e( 'Shipping date', 'usces' ); ?></td>
1841 <td class="col1">
1842 <input type="text" name="offer[delidue_date]" id="delidue_date_select" style="width:100%;" value="<?php echo esc_attr( $delidue_date ); ?>" />
1843 </td>
1844 </tr>
1845 <?php do_action( 'usces_action_order_edit_form_delivery_block', $data, $cscs_meta, $action_args ); ?>
1846 </table>
1847 </td>
1848
1849 <td colspan="2" rowspan="2" class="wrap_td">
1850 <table border="0" cellspacing="0" class="cus_info">
1851 <?php echo uesces_get_admin_addressform( 'customer', $data, $cscs_meta ); ?>
1852 </table>
1853 </td>
1854
1855 <td colspan="2" rowspan="2" class="wrap_td">
1856 <table border="0" cellspacing="0" class="deli_info">
1857 <?php echo uesces_get_admin_addressform( 'delivery', $deli, $csde_meta ); ?>
1858 </table>
1859 </td>
1860 </tr>
1861
1862 <tr>
1863 <td colspan="2" rowspan="2" class="wrap_td">
1864 <!-- Status brock -->
1865 <table border="0" cellspacing="0" class="cus_info">
1866 <tr>
1867 <td colspan="2" class="midasi3"><?php esc_html_e( 'Status', 'usces' ); ?></td>
1868 </tr>
1869 <tr>
1870 <td class="label status"><?php esc_html_e( 'The correspondence situation', 'usces' ); ?></td>
1871 <td class="col1 status">
1872 <select name="offer[taio]" id="order_taio">
1873 <option value='#none#'><?php esc_html_e( 'new order', 'usces' ); ?></option>
1874 <?php
1875 $exclusion_status = apply_filters( 'usces_filter_taio_exclusion_status', array( 'noreceipt', 'receipted', 'pending', 'estimate', 'adminorder' ) );
1876 foreach ( $management_status as $status_key => $status_name ) :
1877 if ( in_array( $status_key, $exclusion_status ) ) {
1878 continue;
1879 }
1880 ?>
1881 <option value="<?php echo esc_attr( $status_key ); ?>"<?php selected( $taio, $status_key ); ?>><?php echo esc_html( $status_name ); ?></option>
1882 <?php
1883 endforeach;
1884 ?>
1885 </select>
1886 </td>
1887 </tr>
1888 <?php
1889 $receiptlabel = '&nbsp;';
1890 $receiptbox = '&nbsp;';
1891 if ( '' != $receipt ) {
1892 $receiptlabel = __( 'transfer statement', 'usces' );
1893 $selected = array( 'noreceipt' => '', 'receipted' => '', 'pending' => '' );
1894 if ( array_key_exists( $receipt, $selected ) ) {
1895 $selected[ $receipt ] = ' selected="selected"';
1896 }
1897 $receiptbox = '
1898 <select name="offer[receipt]">
1899 <option value="noreceipt"' . $selected['noreceipt'] . '>' . $management_status['noreceipt'] . '</option>
1900 <option value="receipted"' . $selected['receipted'] . '>' . $management_status['receipted'] . '</option>
1901 <option value="pending"' . $selected['pending'] . '>' . $management_status['pending'] . '</option>
1902 </select>';
1903 }
1904 ?>
1905 <tr>
1906 <td class="label status" id="receiptlabel"><?php echo $receiptlabel; ?></td>
1907 <td class="col1 status" id="receiptbox"><?php echo $receiptbox; ?></td>
1908 </tr>
1909 <?php
1910 if ( '' != $admin ) :
1911 ?>
1912 <tr>
1913 <td class="label status"><?php esc_html_e( 'estimate order', 'usces' ); ?></td>
1914 <td class="col1 status">
1915 <select name="offer[admin]">
1916 <option value='adminorder'<?php selected( $admin, 'adminorder' ); ?>><?php echo esc_html( $management_status['adminorder'] ); ?></option>
1917 <option value='estimate'<?php selected( $admin, 'estimate' ); ?>><?php echo esc_html( $management_status['estimate'] ); ?></option>
1918 </select>
1919 </td>
1920 </tr>
1921 <?php endif; ?>
1922 <?php do_action( 'usces_action_order_edit_form_status_block_middle', $data, $cscs_meta, $action_args ); ?>
1923 <tr>
1924 <td colspan="2" class="status">
1925 <div class="midasi2">
1926 <?php
1927 if ( isset( $condition['display_mode'] ) ) {
1928 if ( 'Usualsale' == $condition['display_mode'] ) {
1929 esc_html_e( 'normal sale', 'usces' );
1930 } elseif ( 'Promotionsale' == $condition['display_mode'] ) {
1931 esc_html_e( 'Sale Campaign', 'usces' );
1932 }
1933 }
1934 ?>
1935 </div>
1936 <div class="condition">
1937 <?php
1938 if ( isset( $condition['display_mode'] ) && isset( $condition['campaign_privilege'] ) ) :
1939 if ( 'Promotionsale' == $condition['display_mode'] ) :
1940 if ( 'discount' == $condition['campaign_privilege'] && isset( $condition['privilege_discount'] ) ) {
1941 $dsp_campaign_privilege = $condition['privilege_discount'] . __( '% Discount', 'usces' );
1942 } elseif ( 'point' == $condition['campaign_privilege'] && isset( $condition['privilege_point'] ) ) {
1943 $dsp_campaign_privilege = $condition['privilege_point'] . __( ' times (limited to members)', 'usces' );
1944 } else {
1945 $dsp_campaign_privilege = '';
1946 }
1947 if ( ! isset( $condition['campaign_category'] ) || 0 == $condition['campaign_category'] ) {
1948 $dsp_campaign_category = __( 'all the items', 'usces' );
1949 } else {
1950 $dsp_campaign_category = get_cat_name( $condition['campaign_category'] );
1951 }
1952 ?>
1953 <span><?php esc_html_e( 'Special Benefits', 'usces' ); ?> : </span><?php echo esc_html( $condition['campaign_privilege'] ); ?> (<?php echo esc_html( $dsp_campaign_privilege ); ?>) <br />
1954 <span><?php esc_html_e( 'applied material', 'usces' ); ?> : </span><?php echo esc_html( $dsp_campaign_category ); ?><br />
1955 <?php
1956 endif;
1957 endif;
1958 ?>
1959 </div></td>
1960 </tr>
1961 <?php do_action( 'usces_action_order_edit_form_status_block', $data, $cscs_meta, $action_args ); ?>
1962 </table>
1963 </td>
1964 </tr>
1965
1966 <tr>
1967 <td class="label cus_note_label"><?php esc_html_e( 'Notes', 'usces' ); ?></td>
1968 <td colspan="3" class="cus_note_value"><textarea name="offer[note]"><?php echo esc_attr( isset( $data['order_note'] ) ? $data['order_note'] : '' ); ?></textarea></td>
1969 </tr>
1970 <?php do_action( 'usces_action_order_edit_form_detail_bottom', $data, $cscs_meta, $action_args ); ?>
1971 </table>
1972 </div><!-- .info_head -->
1973
1974 <div class="info_head">
1975 <table>
1976 <tr>
1977 <td class="midasi0"><?php esc_html_e( 'Custom order field', 'usces' ); ?></td>
1978 <td class="midasi0"><?php esc_html_e( 'Payment information', 'usces' ); ?></td>
1979 </tr>
1980 <tr>
1981 <td class="wrap_td">
1982 <table class="order_custom_wrap">
1983 <tr>
1984 <?php
1985 do_action( 'usces_action_order_edit_form_custom', $data, $csod_meta );
1986 usces_admin_custom_field_input( $csod_meta, 'order', '' );
1987 if ( ! empty( $deleted_csod_meta_display ) ) {
1988 wel_esc_script_e( $deleted_csod_meta_display );
1989 }
1990 ?>
1991 </tr>
1992 </table><!-- .order_custom_wrap -->
1993 </td>
1994 <td class="wrap_td">
1995 <table class="settle_info_wrap">
1996 <?php usces_settle_info_field( $order_id, 'tr' ); ?>
1997 </table><!-- .settle_info_wrap -->
1998 <?php do_action( 'usces_action_order_edit_form_settle_info', $data, $action_args ); ?>
1999 </td>
2000 </tr>
2001 </table>
2002 </div><!-- .info_head -->
2003
2004 <div id="cart">
2005 <?php
2006 ob_start();
2007 ?>
2008 <table cellspacing="0" id="cart_table">
2009 <thead>
2010 <tr>
2011 <th colspan="5" class="aright"><?php esc_html_e( 'Total Amount', 'usces' ); ?></th>
2012 <th id="total_full_top" class="aright">&nbsp;</th>
2013 <th colspan="2">&nbsp;<?php esc_html_e( 'Currency', 'usces' ); ?>(<?php usces_crcode(); ?>)</th>
2014 </tr>
2015 <tr>
2016 <th scope="row" class="num"><?php esc_html_e( 'No.', 'usces' ); ?></th>
2017 <th class="thumbnail"> <?php // esc_html_e( 'thumbnail', 'usces' ); ?></th>
2018 <th class="productname"><?php esc_html_e( 'Items', 'usces' ); ?></th>
2019 <th class="price"><?php esc_html_e( 'Unit price', 'usces' ); ?></th>
2020 <th class="quantity"><?php esc_html_e( 'Quantity', 'usces' ); ?></th>
2021 <th class="subtotal"><?php esc_html_e( 'Amount', 'usces' ); ?>(<?php usces_crcode(); ?>)</th>
2022 <th class="stock"><?php esc_html_e( 'Current stock', 'usces' ); ?></th>
2023 <th class="action"><input name="addButton" id="addCartButton" class="button" type="button" value="<?php esc_html_e( 'Add item', 'usces' ); ?>" /></th>
2024 </tr>
2025 </thead>
2026 <tbody id="orderitemlist">
2027 <?php echo usces_get_ordercart_row( $order_id, $cart ); ?>
2028 </tbody>
2029 <tfoot>
2030 <tr>
2031 <th colspan="5" class="aright"><?php esc_html_e( 'total items', 'usces' ); ?></th>
2032 <th id="item_total" class="aright">&nbsp;</th>
2033 <?php echo apply_filters( 'usces_filter_ordereditform_item_total_td', '<th colspan="2">&nbsp;</th>', $order_id, $cart ); ?>
2034 </tr>
2035 <?php
2036 if ( $reduced_taxrate ) :
2037 if ( 'products' == $tax_target ) :
2038 $dsp_subtotal_standard = ( ! empty( $order_subtotal_standard ) ) ? usces_crform( $order_subtotal_standard, false, false, 'return', false ) : '0';
2039 $dsp_subtotal_reduced = ( ! empty( $order_subtotal_reduced ) ) ? usces_crform( $order_subtotal_reduced, false, false, 'return', false ) : '0';
2040 ?>
2041 <tr>
2042 <th colspan="5" class="aright"><?php printf( __( 'Applies to %s%%', 'usces' ), $usces_tax->tax_rate_standard ); ?></th>
2043 <th id="subtotal_standard" class="aright">&nbsp;</th>
2044 <th colspan="2"><input type="hidden" name="order_subtotal_standard" id="order_subtotal_standard" value="<?php echo esc_attr( $dsp_subtotal_standard ); ?>">&nbsp;</th>
2045 </tr>
2046 <tr>
2047 <th colspan="5" class="aright"></span><?php printf( __( 'Applies to %s%%', 'usces' ), $usces_tax->tax_rate_reduced ); ?></th>
2048 <th id="subtotal_reduced" class="aright">&nbsp;</th>
2049 <th colspan="2"><input type="hidden" name="order_subtotal_reduced" id="order_subtotal_reduced" value="<?php echo esc_attr( $dsp_subtotal_reduced ); ?>">&nbsp;</th>
2050 </tr>
2051 <?php
2052 endif;
2053 $dsp_discount_standard = ( ! empty( $order_discount_standard ) ) ? usces_crform( $order_discount_standard, false, false, 'return', false ) : '0';
2054 $dsp_discount_reduced = ( ! empty( $order_discount_reduced ) ) ? usces_crform( $order_discount_reduced, false, false, 'return', false ) : '0';
2055 $dsp_discount = ( isset( $data['order_discount'] ) && ! empty( $data['order_discount'] ) ) ? usces_crform( $data['order_discount'], false, false, 'return', false ) : '0';
2056 ?>
2057 <tr>
2058 <td colspan="5" class="aright"><?php printf( __( 'Discount from the subtotal applies to %s%%', 'usces' ), $usces_tax->tax_rate_standard ); ?></td>
2059 <td class="aright"><input name="order_discount_standard" id="order_discount_standard" type="text" class="text price" value="<?php echo esc_attr( $dsp_discount_standard ); ?>" /></td>
2060 <td colspan="2"><?php esc_html_e( 'Discounted amount should be shown by -(Minus)', 'usces' ); ?>&nbsp;</td>
2061 </tr>
2062 <tr>
2063 <td colspan="5" class="aright"><?php printf( __( 'Discount from the subtotal applies to %s%%', 'usces' ), $usces_tax->tax_rate_reduced ); ?></td>
2064 <td class="aright"><input name="order_discount_reduced" id="order_discount_reduced" type="text" class="text price" value="<?php echo esc_attr( $dsp_discount_reduced ); ?>" /></td>
2065 <td colspan="2"><?php esc_html_e( 'Discounted amount should be shown by -(Minus)', 'usces' ); ?>&nbsp;</td>
2066 </tr>
2067 <tr>
2068 <td colspan="5" class="aright"><?php echo apply_filters( 'usces_confirm_discount_label', __( 'Discount', 'usces' ), $order_id ); ?></td>
2069 <td class="aright"><input name="offer[discount]" id="order_discount" class="text price" type="text" value="<?php echo esc_attr( $dsp_discount ); ?>" readonly /></td>
2070 <td colspan="2">&nbsp;</td>
2071 </tr>
2072 <?php
2073 else :
2074 $dsp_discount = ( isset( $data['order_discount'] ) && ! empty( $data['order_discount'] ) ) ? usces_crform( $data['order_discount'], false, false, 'return', false ) : '0';
2075 ?>
2076 <tr>
2077 <td colspan="5" class="aright"><?php echo apply_filters( 'usces_confirm_discount_label', __( 'Campaign discount', 'usces' ), $order_id ); ?></td>
2078 <td class="aright"><input name="offer[discount]" id="order_discount" class="text price" type="text" value="<?php echo esc_attr( $dsp_discount ); ?>" /></td>
2079 <td colspan="2"><?php esc_html_e( 'Discounted amount should be shown by -(Minus)', 'usces' ); ?>&nbsp;</td>
2080 </tr>
2081 <?php
2082 endif;
2083 if ( $reduced_taxrate ) :
2084 if ( 'products' == $tax_target ) :
2085 if ( 'exclude' == $tax_mode ) {
2086 if ( empty( $order_tax_standard ) && empty( $order_tax_reduced ) ) {
2087 $order_tax_standard = ( isset( $data['order_tax'] ) && ! empty( $data['order_tax'] ) ) ? $data['order_tax'] : 0;
2088 }
2089 $msg_notice = __( 'It will be not caluculated automatically.', 'usces' );
2090 } else {
2091 $msg_notice = '';
2092 }
2093 $dsp_tax_standard = ( ! empty( $order_tax_standard ) ) ? usces_crform( $order_tax_standard, false, false, 'return', false ) : '0';
2094 $dsp_tax_reduced = ( ! empty( $order_tax_reduced ) ) ? usces_crform( $order_tax_reduced, false, false, 'return', false ) : '0';
2095 $dsp_tax = ( isset( $data['order_tax'] ) && ! empty( $data['order_tax'] ) ) ? usces_crform( $data['order_tax'], false, false, 'return', false ) : '0';
2096 ?>
2097 <tr>
2098 <td colspan="5" class="aright"><?php printf( __( '%s%% consumption tax', 'usces' ), $usces_tax->tax_rate_standard ); ?><span id="include_tax_standard"><?php echo esc_html( $include_tax_standard ); ?></span></td>
2099 <td class="aright"><input name="order_tax_standard" id="order_tax_standard" type="text" class="text price" value="<?php echo esc_attr( $dsp_tax_standard ); ?>"<?php echo esc_html( $tax_readonly ); ?> /></td>
2100 <td colspan="2"><?php echo esc_html( $msg_notice ); ?>&nbsp;</td>
2101 </tr>
2102 <tr>
2103 <td colspan="5" class="aright"><?php printf( __( '%s%% consumption tax', 'usces' ), $usces_tax->tax_rate_reduced ); ?><span id="include_tax_reduced"><?php echo esc_html( $include_tax_reduced ); ?></span></td>
2104 <td class="aright"><input name="order_tax_reduced" id="order_tax_reduced" type="text" class="text price" value="<?php echo esc_attr( $dsp_tax_reduced ); ?>"<?php echo esc_html( $tax_readonly ); ?> /></td>
2105 <td colspan="2"><?php echo esc_html( $msg_notice ); ?>&nbsp;</td>
2106 </tr>
2107 <tr>
2108 <td colspan="5" class="aright"><?php echo esc_html( $tax_label ); ?><span id="include_tax"><?php echo esc_html( $include_tax ); ?></span></td>
2109 <td class="aright"><input name="offer[tax]" id="order_tax" type="text" class="text price" value="<?php echo esc_attr( $dsp_tax ); ?>" readonly /></td>
2110 <td colspan="2"></td>
2111 </tr>
2112 <?php
2113 endif;
2114 else :
2115 if ( 'products' == $tax_target ) :
2116 $dsp_tax = ( isset( $data['order_tax'] ) && ! empty( $data['order_tax'] ) ) ? usces_crform( $data['order_tax'], false, false, 'return', false ) : '0';
2117 ?>
2118 <tr>
2119 <td colspan="5" class="aright"><?php echo esc_html( $tax_label ); ?><span id="include_tax"><?php echo esc_html( $include_tax ); ?></span></td>
2120 <td class="aright"><input name="offer[tax]" id="order_tax" type="text" class="text price" value="<?php echo esc_attr( $dsp_tax ); ?>"<?php echo esc_html( $tax_readonly ); ?> /></td>
2121 <td colspan="2"><?php esc_html_e( 'It will be not caluculated automatically.', 'usces' ); ?>&nbsp;</td>
2122 </tr>
2123 <?php
2124 endif;
2125 endif;
2126 $dsp_shipping_charge = ( isset( $data['order_shipping_charge'] ) && ! empty( $data['order_shipping_charge'] ) ) ? usces_crform( $data['order_shipping_charge'], false, false, 'return', false ) : '0';
2127 $dsp_cod_fee = ( isset( $data['order_cod_fee'] ) && ! empty( $data['order_cod_fee'] ) ) ? usces_crform( $data['order_cod_fee'], false, false, 'return', false ) : '0';
2128 ?>
2129 <tr>
2130 <td colspan="5" class="aright"><?php esc_html_e( 'Shipping', 'usces' ); ?></td>
2131 <td class="aright"><input name="offer[shipping_charge]" id="order_shipping_charge" class="text price" type="text" value="<?php echo esc_attr( $dsp_shipping_charge ); ?>" /></td>
2132 <td colspan="2"><?php esc_html_e( 'It will be not caluculated automatically.', 'usces' ); ?>&nbsp;</td>
2133 </tr>
2134 <tr>
2135 <td colspan="5" class="aright"><?php echo apply_filters( 'usces_filter_cod_label', __( 'COD fee', 'usces' ), $order_id ); ?></td>
2136 <td class="aright"><input name="offer[cod_fee]" id="order_cod_fee" class="text price" type="text" value="<?php echo esc_attr( $dsp_cod_fee ); ?>" /></td>
2137 <td colspan="2"><?php esc_html_e( 'It will be not caluculated automatically.', 'usces' ); ?>&nbsp;</td>
2138 </tr>
2139 <?php
2140 if ( $reduced_taxrate ) :
2141 if ( 'all' == $tax_target ) :
2142 if ( 'exclude' == $tax_mode ) {
2143 if ( empty( $order_tax_standard ) && empty( $order_tax_reduced ) ) {
2144 $order_tax_standard = ( isset( $data['order_tax'] ) && ! empty( $data['order_tax'] ) ) ? $data['order_tax'] : 0;
2145 }
2146 $msg_notice = __( 'It will be not caluculated automatically.', 'usces' );
2147 } else {
2148 $msg_notice = '';
2149 }
2150 $dsp_tax_standard = ( ! empty( $order_tax_standard ) ) ? usces_crform( $order_tax_standard, false, false, 'return', false ) : '0';
2151 $dsp_tax_reduced = ( ! empty( $order_tax_reduced ) ) ? usces_crform( $order_tax_reduced, false, false, 'return', false ) : '0';
2152 $dsp_tax = ( isset( $data['order_tax'] ) && ! empty( $data['order_tax'] ) ) ? usces_crform( $data['order_tax'], false, false, 'return', false ) : '0';
2153 ?>
2154 <tr>
2155 <td colspan="5" class="aright"><?php printf( __( '%s%% consumption tax', 'usces' ), $usces_tax->tax_rate_standard ); ?><span id="include_tax_standard"><?php echo esc_html( $include_tax_standard ); ?></span></td>
2156 <td class="aright"><input name="order_tax_standard" id="order_tax_standard" type="text" class="text price" value="<?php echo esc_attr( $dsp_tax_standard ); ?>"<?php echo esc_html( $tax_readonly ); ?> /></td>
2157 <td colspan="2"><?php echo esc_html( $msg_notice ); ?>&nbsp;</td>
2158 </tr>
2159 <tr>
2160 <td colspan="5" class="aright"><?php printf( __( '%s%% consumption tax', 'usces' ), $usces_tax->tax_rate_reduced ); ?><span id="include_tax_reduced"><?php echo esc_html( $include_tax_reduced ); ?></span></td>
2161 <td class="aright"><input name="order_tax_reduced" id="order_tax_reduced" type="text" class="text price" value="<?php echo esc_attr( $dsp_tax_reduced ); ?>"<?php echo esc_html( $tax_readonly ); ?> /></td>
2162 <td colspan="2"><?php echo esc_html( $msg_notice ); ?>&nbsp;</td>
2163 </tr>
2164 <tr>
2165 <td colspan="5" class="aright"><?php echo esc_html( $tax_label ); ?><span id="include_tax"><?php echo esc_html( $include_tax ); ?></span></td>
2166 <td class="aright"><input name="offer[tax]" id="order_tax" type="text" class="text price" value="<?php echo esc_attr( $dsp_tax ); ?>" readonly /></td>
2167 <td colspan="2"></td>
2168 </tr>
2169 <?php
2170 endif;
2171 else :
2172 if ( 'all' == $tax_target ) :
2173 $dsp_tax = ( isset( $data['order_tax'] ) && ! empty( $data['order_tax'] ) ) ? usces_crform( $data['order_tax'], false, false, 'return', false ) : '0';
2174 ?>
2175 <tr>
2176 <td colspan="5" class="aright"><?php echo esc_html( $tax_label ); ?><span id="include_tax"><?php echo esc_html( $include_tax ); ?></span></td>
2177 <td class="aright"><input name="offer[tax]" id="order_tax" type="text" class="text price" value="<?php echo esc_attr( $dsp_tax ); ?>"<?php echo esc_html( $tax_readonly ); ?> /></td>
2178 <td colspan="2"><?php esc_html_e( 'It will be not caluculated automatically.', 'usces' ); ?>&nbsp;</td>
2179 </tr>
2180 <?php
2181 endif;
2182 endif;
2183 $dsp_usedpoint = ( isset( $data['order_usedpoint'] ) && ! empty( $data['order_usedpoint'] ) ) ? $data['order_usedpoint'] : '0';
2184 $dsp_getpoint = ( isset( $data['order_getpoint'] ) && ! empty( $data['order_getpoint'] ) ) ? $data['order_getpoint'] : '0';
2185 ?>
2186 <tr>
2187 <td colspan="5" class="aright"><?php esc_html_e( 'Used points', 'usces' ); ?></td>
2188 <td class="aright"><input name="offer[usedpoint]" id="order_usedpoint" class="text price red" type="text" value="<?php echo esc_attr( $dsp_usedpoint ); ?>"<?php echo esc_html( $usedpoint_readonly ); ?> /></td>
2189 <td><?php esc_html_e( 'granted points', 'usces' ); ?></td>
2190 <td class="aright"><input name="offer[getpoint]" id="order_getpoint" class="text price" type="text" value="<?php echo esc_attr( $dsp_getpoint ); ?>"<?php echo esc_html( $getpoint_readonly ); ?> /></td>
2191 </tr>
2192 <?php
2193 if ( $reduced_taxrate && 'all' == $tax_target ) :
2194 $dsp_subtotal_standard = ( ! empty( $order_subtotal_standard ) ) ? usces_crform( $order_subtotal_standard, false, false, 'return', false ) : '0';
2195 $dsp_subtotal_reduced = ( ! empty( $order_subtotal_reduced ) ) ? usces_crform( $order_subtotal_reduced, false, false, 'return', false ) : '0';
2196 ?>
2197 <tr>
2198 <th colspan="5" class="aright"><?php printf( __( 'Applies to %s%%', 'usces' ), $usces_tax->tax_rate_standard ); ?></th>
2199 <th id="subtotal_standard" class="aright">&nbsp;</th>
2200 <th colspan="2"><input type="hidden" name="order_subtotal_standard" id="order_subtotal_standard" value="<?php echo esc_attr( $dsp_subtotal_standard ); ?>">&nbsp;</th>
2201 </tr>
2202 <tr>
2203 <th colspan="5" class="aright"></span><?php printf( __( 'Applies to %s%%', 'usces' ), $usces_tax->tax_rate_reduced ); ?></th>
2204 <th id="subtotal_reduced" class="aright">&nbsp;</th>
2205 <th colspan="2"><input type="hidden" name="order_subtotal_reduced" id="order_subtotal_reduced" value="<?php echo esc_attr( $dsp_subtotal_reduced ); ?>">&nbsp;</th>
2206 </tr>
2207 <?php
2208 endif;
2209 ?>
2210 <tr>
2211 <th colspan="5" class="aright"><?php esc_html_e( 'Total Amount', 'usces' ); ?></th>
2212 <th id="total_full" class="aright">&nbsp;</th>
2213 <th colspan="2"><input name="recalc" id="recalc" class="button" type="button" value="<?php esc_attr_e( 'Recalculation', 'usces' ); ?>" /><?php wel_esc_script_e( $change_taxrate ); ?></th>
2214 </tr>
2215 </tfoot>
2216 </table>
2217 <?php
2218 $cart_table = ob_get_contents();
2219 ob_end_clean();
2220 echo apply_filters( 'usces_filter_ordereditform_carttable', $cart_table, $filter_args );
2221 ?>
2222 </div>
2223 <?php
2224 if ( $reduced_taxrate ) :
2225 ?>
2226 <div class="order_edit_notice_reduced_tax_rate"><span class="reduced_taxrate_mark"><?php echo esc_html( $usces_tax->reduced_taxrate_mark ); ?></span><?php esc_html_e( ' is reduced tax rate', 'usces' ); ?></div>
2227 <?php
2228 endif;
2229 ?>
2230 <div class="usces_tablenav usces_tablenav_bottom">
2231 <div class="ordernavi"><input name="update_order_edit2" class="button button-primary" type="submit" value="<?php esc_attr_e( 'change decision', 'usces' ); ?>" /><?php esc_html_e( "When you change amount, please click 'Edit' before you finish your process.", 'usces' ); ?></div>
2232 </div>
2233
2234 <?php if ( 'new' !== $order_action ) : ?>
2235 <div class="metabox-holder wp-core-ui ">
2236 <?php do_meta_boxes( 'order', 'edit', $data ); ?>
2237 </div>
2238 <?php endif; ?>
2239
2240 <input name="order_action" type="hidden" value="<?php echo esc_attr( $oa ); ?>" />
2241 <input name="order_id" id="order_id" type="hidden" value="<?php echo esc_attr( $dsp_order_id ); ?>" />
2242 <input name="old_getpoint" type="hidden" value="<?php echo esc_attr( $hdn_getpoint ); ?>" />
2243 <input name="old_usedpoint" type="hidden" value="<?php echo esc_attr( $hdn_usedpoint ); ?>" />
2244 <input name="up_modified" id="up_modified" type="hidden" value="" />
2245 <?php $hdn_modified = ( isset( $data['order_modified'] ) ) ? $data['order_modified'] : ''; ?>
2246 <input name="modified" id="modified" type="hidden" value="<?php echo esc_attr( $hdn_modified ); ?>" />
2247
2248 <div id="dialog_parent" style="position:fixed"></div>
2249 <div id="addItemDialog" title="<?php esc_attr_e( 'Add item', 'usces' ); ?>">
2250 <div id="order-response"></div>
2251 <fieldset>
2252 <div class="clearfix">
2253 <div class="dialogsearch">
2254 <label><?php esc_html_e( 'Item Category', 'usces' ); ?></label>
2255 <?php
2256 $idobj = get_category_by_slug( 'item' );
2257 $dropdown_options = apply_filters( 'usces_filter_ordereditform_dropdown_options', array( 'show_option_none' => __( 'Select a category', 'usces' ), 'name' => 'newitemcategory', 'id' => 'newitemcategory', 'hide_empty' => 1, 'hierarchical' => 1, 'orderby' => 'name', 'child_of' => $idobj->term_id ) );
2258 wp_dropdown_categories( $dropdown_options );
2259 ?>
2260 <br />
2261 <label><?php esc_html_e( 'Item to be added', 'usces' ); ?></label><select name="newitemcode" id="newitemcode"></select><br />
2262 <div id="loading"></div>
2263 <label for="name"><?php esc_html_e( 'item code', 'usces' ); ?></label>
2264 <input type="text" name="newitemcodein" id="newitemcodein" class="text" />
2265 <input name="getitem" id="getitembutton" type="button" class="button" value="<?php esc_attr_e( 'Obtain', 'usces' ); ?>" onclick="if( jQuery('#newitemcodein').val() == '' ) return; orderItem.getitem(encodeURIComponent(jQuery('#newitemcodein').val()));" />
2266 </div>
2267 <div id="newitemform"></div>
2268 </div>
2269 </fieldset>
2270 </div>
2271
2272 <div id="mailSendDialog" title="">
2273 <div id="order-response"></div>
2274 <fieldset>
2275 <p><?php esc_html_e( "Check the mail and click 'send'", 'usces' ); ?></p>
2276 <label><?php esc_html_e( 'e-mail adress', 'usces' ); ?></label><input type="text" name="sendmailaddress" id="sendmailaddress" class="text" /><br />
2277 <label><?php esc_html_e( 'Client name', 'usces' ); ?></label><input type="text" name="sendmailname" id="sendmailname" class="text" /><br />
2278 <label><?php esc_html_e( 'subject', 'usces' ); ?></label><input type="text" name="sendmailsubject" id="sendmailsubject" class="text" /><br />
2279 <?php if ( 1 === (int) $this->options['email_attach_feature'] ) { ?>
2280 <label><?php esc_html_e( 'Attachment file', 'usces' ); ?></label><input type="file" name="sendmailattachfile" id="sendmailattachfile" class="text" />
2281 <div class="attachment-extension">
2282 <?php
2283 if ( $this->options['email_attach_file_size'] > 0 ) {
2284 esc_html_e( 'Maximum size of email attachment', 'usces' );
2285 echo ': ' . $this->options['email_attach_file_size'] . 'MB. ';
2286 }
2287 if ( ! empty( $email_attach_file_extension ) ) {
2288 esc_html_e( 'File extension support', 'usces' );
2289 echo ' (' . implode( ',', $email_attach_file_extension ) . ')';
2290 }
2291 ?>
2292 </div>
2293 <?php } ?>
2294 <?php if ( 1 === (int) $add_html_email_option ) { ?>
2295 <div id="wrap_load_rich_editor" style="margin-top: 10px">
2296 <div id="loading_iframe"></div>
2297 <iframe style="display:none" width="<?php echo esc_attr( $mailsenddialog_width - 40 ); ?>" height="700" id="iframeLoadEditor" src="" ></iframe>
2298 </div>
2299 <?php } else { ?>
2300 <textarea name="sendmailmessage" id="sendmailmessage"></textarea>
2301 <?php } ?>
2302 <input name="mailChecked" id="mailChecked" type="hidden" />
2303 </fieldset>
2304 </div>
2305
2306 <?php if ( 1 === (int) $add_html_email_option ) { ?>
2307 <div id="previewEmailDialog" title="">
2308 <iframe src="" width="<?php echo esc_attr( $mailsenddialog_width - 40 ); ?>" height="4000" frameborder="0" class="content_email_preview" id='iframePreviewEmail'></iframe>
2309 </div>
2310 <?php } ?>
2311
2312 <div id="mailSendAlert" title="">
2313 <div id="order-response"></div>
2314 <fieldset>
2315 </fieldset>
2316 </div>
2317 <input name="usces_referer" type="hidden" id="usces_referer" value="<?php echo esc_url( $usces_referer ); ?>" />
2318 <?php wp_nonce_field( 'order_edit', 'wc_nonce' ); ?>
2319 </form>
2320
2321 <div id="PDFDialog" title="">
2322 <div id="pdf_response"></div>
2323 <fieldset>
2324 <div id="new_pdf"></div>
2325 </fieldset>
2326 </div>
2327 <?php do_action( 'usces_action_endof_order_edit_form', $data, $action_args ); ?>
2328 </div><!--usces_admin-->
2329 </div><!--wrap-->
2330