Add timeline

This commit is contained in:
Almira Krdzic
2018-12-03 13:13:03 +01:00
parent c5f590c3fe
commit 8476529bb4
2 changed files with 107 additions and 1 deletions

View File

@@ -38,4 +38,48 @@
#wiaas_delivery_process_order_notes .add-note textarea {
width: 100%;
height: 50px;
}
.wiaas-delivery-process-timeline-note {
margin: 20px 0 30px;
clear: both;
width: 100%;
}
.wiaas-delivery-process-timeline-note > div.wiaas-delivery-process-timeline-note-body-wrap {
border: 1px solid #E0E0E0;
margin-left: 100px;
padding: 10px;
display: block;
}
.wiaas-delivery-process-timeline-note > div .wiaas-delivery-process-timeline-note-body {
overflow-y: hidden;
display: block;
line-height: 1.3em;
width: 100%;
word-wrap: break-word;
}
.wiaas-delivery-process-timeline-note-title {
float: left;
margin-bottom: 0.5em;
font-size: 1.2em;
color: #939FA5;
}
.wiaas-delivery-process-timeline-note-date {
color: #939FA5;
float: right;
font-size: 11px;
text-align: right;
display: block;
}
.wiaas-delivery-process-timeline-note-avatar {
float: left;
width: 84px;
text-align: center;
padding-right: 10px;
}

View File

@@ -128,12 +128,74 @@ if ( ! empty($delivery_process)) {
</div>
<?php
foreach ($steps as $step) {
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
}
?>