76 lines
2.0 KiB
PHP
76 lines
2.0 KiB
PHP
<?php
|
|
|
|
if ( ! defined( 'ABSPATH' ) ) {
|
|
exit;
|
|
}
|
|
|
|
$is_step_completed = $step->get_status() === 'complete' || $step->get_status() === 'approved';
|
|
$is_current_step = $current_step && $step->get_id() === $current_step->get_id();
|
|
|
|
if ($is_current_step) {
|
|
$style = 'color: #FD8049;';
|
|
} else if ($is_step_completed) {
|
|
$style = 'color: #34C388;';
|
|
} else {
|
|
$style = 'opacity: 0.5; color: #CCC;';
|
|
}
|
|
|
|
?>
|
|
|
|
<div class="postbox">
|
|
|
|
<h3>
|
|
<i class="dashicons dashicons-marker" style="font-size: 22px; margin-right: 10px; <?php esc_attr_e($style, 'wiaas') ?>"></i>
|
|
<span><?php esc_html_e($step->get_name(), 'wiaas') ?></span>
|
|
</h3>
|
|
|
|
<?php
|
|
|
|
if ($step->instructionsEnable) {
|
|
|
|
$instructions = $step->instructionsValue;
|
|
$instructions = GFCommon::replace_variables( $instructions, $step->get_form(), $step->get_entry(), false, false, true );
|
|
$instructions = do_shortcode( $instructions );
|
|
|
|
echo '<div class="wiaas-delivery-process-step-instructions">' . $instructions . '</div>';
|
|
}
|
|
|
|
$action_form = GFAPI::get_form( $step->target_form_id );
|
|
|
|
if (! empty($action_form)) {
|
|
|
|
$page_size = 20;
|
|
$search_criteria = array(
|
|
'status' => 'active',
|
|
'field_filters' => array(
|
|
array( 'key' => 'wiaas_delivery_process_id',
|
|
'value' => $delivery_process['id']
|
|
),
|
|
),
|
|
);
|
|
$sorting = array( 'key' => 'date_created', 'direction' => 'DESC' );
|
|
$paging = array( 'offset' => 0, 'page_size' => $page_size );
|
|
|
|
$entries = GFAPI::get_entries( $action_form['id'], $search_criteria, $sorting, $paging );
|
|
|
|
$action_workflow = new Gravity_Flow_API($action_form['id']);
|
|
$current_assignee_key = $step->get_current_assignee_key();
|
|
|
|
foreach ($entries as $action_entry) {
|
|
|
|
$action_entry_step = $action_workflow->get_current_step($action_entry);
|
|
|
|
$show_entry = GFAPI::current_user_can_any( 'manage_wiaas_order_delivery_process' ) ||
|
|
($action_entry_step &&
|
|
$action_entry_step->is_assignee($current_assignee_key));
|
|
|
|
if ($show_entry) {
|
|
require 'html-delivery-process-step-action.php';
|
|
}
|
|
}
|
|
}
|
|
|
|
?>
|
|
|
|
</div>
|