2013-08-06 10:41:20 +00:00
< ? php
/**
2015-11-03 13:53:50 +00:00
* Order Notes
2013-08-06 10:41:20 +00:00
*
2014-08-31 07:18:21 +00:00
* @ author WooThemes
* @ category Admin
* @ package WooCommerce / Admin / Meta Boxes
2013-08-06 10:41:20 +00:00
* @ version 2.1 . 0
*/
2014-09-20 20:05:06 +00:00
if ( ! defined ( 'ABSPATH' ) ) {
exit ; // Exit if accessed directly
}
2013-08-06 10:41:20 +00:00
/**
2015-11-03 12:28:01 +00:00
* WC_Meta_Box_Order_Notes Class .
2013-08-06 10:41:20 +00:00
*/
class WC_Meta_Box_Order_Notes {
/**
2015-11-03 12:28:01 +00:00
* Output the metabox .
2016-01-04 21:31:36 +00:00
*
* @ param WP_Post $post
2013-08-06 10:41:20 +00:00
*/
public static function output ( $post ) {
2014-06-08 20:33:11 +00:00
global $post ;
2013-08-06 10:41:20 +00:00
$args = array (
2017-07-13 22:33:20 +00:00
'order_id' => $post -> ID ,
2013-08-06 10:41:20 +00:00
);
2017-07-13 22:33:20 +00:00
$notes = wc_get_order_notes ( $args );
2014-03-18 17:49:15 +00:00
2013-08-06 10:41:20 +00:00
echo '<ul class="order_notes">' ;
if ( $notes ) {
2014-08-31 07:18:21 +00:00
2016-08-27 04:23:02 +00:00
foreach ( $notes as $note ) {
2014-08-31 07:18:21 +00:00
2016-02-08 11:39:31 +00:00
$note_classes = array ( 'note' );
2017-07-13 22:33:20 +00:00
$note_classes [] = $note -> customer_note ? 'customer-note' : '' ;
$note_classes [] = 'system' === $note -> added_by ? 'system-note' : '' ;
2016-02-08 11:39:31 +00:00
$note_classes = apply_filters ( 'woocommerce_order_note_class' , array_filter ( $note_classes ), $note );
2013-08-06 10:41:20 +00:00
?>
2017-07-13 22:33:20 +00:00
< li rel = " <?php echo absint( $note->id ); ?> " class = " <?php echo esc_attr( implode( ' ', $note_classes ) ); ?> " >
2013-08-06 10:41:20 +00:00
< div class = " note_content " >
2017-07-13 22:33:20 +00:00
< ? php echo wpautop ( wptexturize ( wp_kses_post ( $note -> content ) ) ); ?>
2013-08-06 10:41:20 +00:00
</ div >
< p class = " meta " >
2017-07-13 22:33:20 +00:00
< abbr class = " exact-date " title = " <?php echo $note->date_created ->date( 'y-m-d h:i:s' ); ?> " >< ? php printf ( __ ( 'added on %1$s at %2$s' , 'woocommerce' ), $note -> date_created -> date_i18n ( wc_date_format () ), $note -> date_created -> date_i18n ( wc_time_format () ) ); ?> </abbr>
2016-10-29 10:16:03 +00:00
< ? php
2017-07-13 22:33:20 +00:00
if ( 'system' !== $note -> added_by ) :
2016-10-29 10:16:03 +00:00
/* translators: %s: note author */
2017-07-13 22:33:20 +00:00
printf ( ' ' . __ ( 'by %s' , 'woocommerce' ), $note -> added_by );
2016-10-29 10:16:03 +00:00
endif ;
?>
2016-11-05 17:12:04 +00:00
< a href = " # " class = " delete_note " role = " button " >< ? php _e ( 'Delete note' , 'woocommerce' ); ?> </a>
2013-08-06 10:41:20 +00:00
</ p >
</ li >
< ? php
}
} else {
2014-11-26 21:35:17 +00:00
echo '<li>' . __ ( 'There are no notes yet.' , 'woocommerce' ) . '</li>' ;
2013-08-06 10:41:20 +00:00
}
echo '</ul>' ;
?>
< div class = " add_note " >
< p >
2016-11-05 16:56:03 +00:00
< label for = " add_order_note " >< ? php _e ( 'Add note' , 'woocommerce' ); ?> <?php echo wc_help_tip( __( 'Add a note for your reference, or add a customer note (the user will be notified).', 'woocommerce' ) ); ?></label>
2013-08-06 10:41:20 +00:00
< textarea type = " text " name = " order_note " id = " add_order_note " class = " input-text " cols = " 20 " rows = " 5 " ></ textarea >
</ p >
< p >
2016-11-05 16:56:03 +00:00
< label for = " order_note_type " class = " screen-reader-text " >< ? php _e ( 'Note type' , 'woocommerce' ); ?> </label>
2013-08-06 10:41:20 +00:00
< select name = " order_note_type " id = " order_note_type " >
< option value = " " >< ? php _e ( 'Private note' , 'woocommerce' ); ?> </option>
2015-03-24 11:27:33 +00:00
< option value = " customer " >< ? php _e ( 'Note to customer' , 'woocommerce' ); ?> </option>
2013-08-06 10:41:20 +00:00
</ select >
2016-11-05 16:56:03 +00:00
< button type = " button " class = " add_note button " >< ? php _e ( 'Add' , 'woocommerce' ); ?> </button>
2013-08-06 10:41:20 +00:00
</ p >
</ div >
< ? php
}
2014-08-31 07:18:21 +00:00
}