209 lines
6.9 KiB
PHP
209 lines
6.9 KiB
PHP
<?php
|
|
|
|
if ( ! defined( 'ABSPATH' ) ) {
|
|
exit;
|
|
}
|
|
|
|
/**
|
|
* WC_Order $order
|
|
*
|
|
*/
|
|
|
|
$delivery_process = Wiaas_Delivery_Process::get_order_delivery_process_entry($order->get_id());
|
|
|
|
if ( ! empty($delivery_process)) {
|
|
|
|
$form_id = $delivery_process['form_id'];
|
|
$workflow_api = new Gravity_Flow_API($form_id);
|
|
|
|
$current_step = $workflow_api->get_current_step($delivery_process);
|
|
|
|
$steps = $workflow_api->get_steps();
|
|
}
|
|
|
|
?>
|
|
|
|
<div class="wrap">
|
|
<form name="delivery" action="" method="post">
|
|
<input type="hidden" name="page" value="wiaas-order-delivery"/>
|
|
<input type="hidden" name="id" value="<?php echo esc_attr($order->get_id()) ?>"/>
|
|
<div id="poststuff">
|
|
<div id="post-body" class="metabox-holder columns-2">
|
|
|
|
<div id="postbox-container-1" class="postbox-container">
|
|
<div class="postbox">
|
|
<div class="inside">
|
|
|
|
<?php require 'html-order-notes.php' ?>
|
|
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div id="postbox-container-2" class="postbox-container">
|
|
|
|
<div class="postbox">
|
|
<div class="inside">
|
|
<div class="panel-wrap">
|
|
<div class="panel">
|
|
<h1>
|
|
Delivery Order
|
|
<?php
|
|
if (current_user_can('edit_others_shop_orders')) {
|
|
echo '<a href="' . esc_url( admin_url( 'post.php?post=' . absint( $order->get_id() ) ) . '&action=edit' ) . '">#' . esc_attr( $order->get_order_number() ) . '</a>';
|
|
} else {
|
|
echo '#' . esc_attr($order->get_order_number());
|
|
}
|
|
?>
|
|
   
|
|
<mark class="wiaas-order-status <?php esc_attr_e( sanitize_html_class( 'wiaas-order-status-' . $order->get_status() ), 'wiaas' ) ?>">
|
|
<span>
|
|
<?php esc_html_e( wc_get_order_status_name( $order->get_status() ) ) ?>
|
|
</span>
|
|
</mark>
|
|
</h1>
|
|
|
|
<?php
|
|
if (GFAPI::current_user_can_any( 'manage_wiaas_order_delivery_process' )) {
|
|
|
|
?>
|
|
<p>
|
|
<a
|
|
id="wiaas_download_procurement_order_btn"
|
|
href="<?php echo admin_url() . '?wiaas-procurement-order-id=' . $order->get_id() ?>"
|
|
download
|
|
class="button"
|
|
>
|
|
<span><?php esc_html_e('Download procurement report', 'wiaas') ?></span>
|
|
</a>
|
|
</p>
|
|
<?php
|
|
}
|
|
?>
|
|
|
|
<?php
|
|
|
|
if (empty($delivery_process)) {
|
|
|
|
echo '<h2>Delivery process has not been assigned.</h2>';
|
|
}
|
|
|
|
if (! empty($delivery_process)) {
|
|
|
|
$is_disabled = ! Wiaas_Delivery_Process::can_delivery_dates_be_set($order->get_id(), $delivery_process, $steps);
|
|
|
|
require 'html-order-suppliers-delivery-dates.php';
|
|
}
|
|
|
|
?>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<?php
|
|
|
|
|
|
if (! empty($delivery_process)) {
|
|
|
|
if ($current_step && GFAPI::current_user_can_any( 'manage_wiaas_order_delivery_process' )) {
|
|
|
|
require 'html-delivery-process-navigation.php';
|
|
}
|
|
|
|
?>
|
|
|
|
<div class="postbox">
|
|
<h3>
|
|
<i class="dashicons dashicons-marker" style="font-size: 22px; margin-right: 10px;color: #34C388; "></i>
|
|
<span>Order placed </span>
|
|
</h3>
|
|
</div>
|
|
|
|
<div class="postbox">
|
|
<h3>
|
|
<i class="dashicons dashicons-marker" style="font-size: 22px; margin-right: 10px;color: #34C388; "></i>
|
|
<span> Assign process </span>
|
|
</h3>
|
|
</div>
|
|
|
|
<?php
|
|
|
|
foreach ($steps as $step) {
|
|
$step = $workflow_api->get_step($step->get_id(), $delivery_process);
|
|
|
|
require 'html-delivery-process-step.php';
|
|
}
|
|
|
|
?>
|
|
|
|
<div id="postbox-container-2" class="postbox-container">
|
|
<div id="wiaas-delivery-process-timeline" class="postbox">
|
|
<h3>
|
|
<label for="name"><?php esc_html_e( 'Timeline', 'gravityflow' ); ?></label>
|
|
</h3>
|
|
|
|
<div class="inside">
|
|
<?php
|
|
|
|
$notes = Gravity_Flow_Common::get_timeline_notes( $delivery_process );
|
|
|
|
foreach ( $notes as $note ) {
|
|
$user_id = $note->user_id;
|
|
$step = Gravity_Flow_Common::get_timeline_note_step( $note );
|
|
$display_name = Gravity_Flow_Common::get_timeline_note_display_name( $note, $step );
|
|
$step_type = $step ? $step->get_type() : $display_name;
|
|
|
|
if ( $user_id ) {
|
|
$avatar = get_avatar( $user_id, 65 );
|
|
} else {
|
|
$step_icon = $step ? $step->get_icon_url() : gravity_flow()->get_base_url() . '/images/gravityflow-icon-blue.svg';
|
|
|
|
if ( strpos( $step_icon, 'http' ) !== false ) {
|
|
$avatar = sprintf( '<img class="avatar avatar-65 photo" src="%s" style="width:65px;height:65px;" />', $step_icon );
|
|
} else {
|
|
$avatar = sprintf( '<span class="avatar avatar-65 photo">%s</span>', $step_icon );
|
|
}
|
|
}
|
|
|
|
?>
|
|
<div class="wiaas-delivery-process-timeline-note">
|
|
<div class="wiaas-delivery-process-timeline-note-avatar">
|
|
<?php echo $avatar ?>
|
|
</div>
|
|
<div class="wiaas-delivery-process-timeline-note-body-wrap">
|
|
<div class="wiaas-delivery-process-timeline-note-body">
|
|
<div>
|
|
<div class="wiaas-delivery-process-timeline-note-title">
|
|
<?php esc_html_e( $display_name, 'wiaas' ) ?>
|
|
</div>
|
|
<div class="wiaas-delivery-process-timeline-note-date">
|
|
<?php esc_html_e( Gravity_Flow_Common::format_date( $note->date_created ), 'wiaas' ) ?>
|
|
</div>
|
|
</div>
|
|
<div class="wiaas-delivery-process-timeline-note-body">
|
|
<?php echo nl2br( esc_html( $note->value ) ) ?>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<?php
|
|
}
|
|
|
|
?>
|
|
</div>
|
|
|
|
</div>
|
|
</div>
|
|
|
|
<?php
|
|
}
|
|
?>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
</div>
|
|
</form>
|
|
</div>
|