<?php
if ( ! defined( 'ABSPATH' ) ) {
	exit; // Exit if accessed directly.
}

$order_id                 = $args['order_id'] ?? 0;
$profile_id               = $args['profile_id'] ?? 0;
$profile_type             = $args['profile_type'] ?? '';
$freelancer_profile_id    = $args['freelancer_profile_id'] ?? 0;
$employer_profile_id      = $args['employer_profile_id'] ?? 0;
$participant_profile_id   = $args['participant_profile_id'] ?? 0;
$participant_profile_type = $args['participant_profile_type'] ?? '';
$order_status             = get_post_status( $order_id );

$date_format = get_option( 'date_format' );
$time_format = get_option( 'time_format' );

$date_time_format = $date_format . ' ' . $time_format;
$price_plan       = gigneo_post_meta( $order_id, '_gigneo_pm_price_plan' );
$total_revision   = ! empty( $price_plan['revisions'] ) ? $price_plan['revisions'] : 'unlimited';
$revision_used    = gigneo_post_meta( $order_id, '_gigneo_pm_revision_used' );

$revision_used = ! empty( $revision_used ) ? absint( $revision_used ) : 0;
$revision_left = is_numeric( $total_revision ) ? absint( $total_revision ) - $revision_used : 0;

$current_stage           = gigneo_post_meta( $order_id, '_gigneo_pm_activity_stage' );
$final_delivery_activity = gigneo_post_meta( $order_id, '_gigneo_pm_delivery_activity' );

$status_labels = gigneo_status_label();

// Get comments for this order
$activity_comments = get_comments(
	array(
		'post_id' => $order_id,
		'type'    => 'order_activity',
		'orderby' => 'comment_date',
		'order'   => 'DESC',
		'parent'  => 0,
	)
);

//Thumbnails
$freelancer_profile_thumbnail_id = ! empty( $freelancer_profile_id ) ? get_post_thumbnail_id( $freelancer_profile_id ) : 0;
$employer_profile_thumbnail_id   = ! empty( $employer_profile_id ) ? get_post_thumbnail_id( $employer_profile_id ) : 0;

//Activities
$freelancer_review_activity   = gigneo_post_meta( $order_id, '_gigneo_pm_freelancer_review_activity' );
$employer_review_activity     = gigneo_post_meta( $order_id, '_gigneo_pm_employer_review_activity' );
$cancel_request_activity      = gigneo_post_meta( $order_id, '_gigneo_pm_cancel_request_activity' );
$extend_date_request_activity = gigneo_post_meta( $order_id, '_gigneo_pm_extend_delivery_date_activity' );

$service_order_extensions = gigneo_option( '_gigneo_ts_service_order_extensions', array( 'jpg', 'jpeg', 'png', 'doc' ) );
$service_order_max_files  = gigneo_option( '_gigneo_ts_service_order_max_files', '3' );
$service_order_max_size   = gigneo_option( '_gigneo_ts_service_order_max_size', '1' );

$requirement_url = gigneo_dashboard_url(
	'order',
	'service-detail',
	array(
		'tab'  => 'requirements',
		'p_id' => $order_id,
	)
);
$attachment_url  = gigneo_dashboard_url(
	'order',
	'service-detail',
	array(
		'tab'  => 'attachments',
		'p_id' => $order_id,
	)
);

//Moderator
$gn_moderator_name     = gigneo_moderator_name();
$moderator_designation = gigneo_moderator_label();
$moderator_avatar_id   = gigneo_moderator_avatar_id();
?>
<div class="gn-order-section gn-order-activity">
	<div class="gn-head">
		<h3 class="gn-title"><?php esc_html_e( 'Recent activity', 'gigneo' ); ?></h3>
	</div>
	<div class="gn-body">
		<?php if ( ! empty( $activity_comments ) ) : ?>
			<div class="gn-activity-logs">
				<?php
				$current_date = '';
				foreach ( $activity_comments as $activity ) {
					$activity_date              = gigneo_datetime( $activity->comment_date_gmt, $date_format );
					$activity_time              = gigneo_datetime( $activity->comment_date_gmt, $time_format );
					$activity_profile_id        = get_comment_meta( $activity->comment_ID, '_gigneo_cm_profile_id', true );
					$activity_profile_id        = absint( $activity_profile_id );
					$activity_type              = get_comment_meta( $activity->comment_ID, '_gigneo_cm_activity_type', true );
					$activity_meta              = get_comment_meta( $activity->comment_ID, '_gigneo_cm_activity_meta', true );
					$message                    = gigneo_activity_message( $activity_type );
					$message                    = ! empty( $message ) && is_string( $message ) ? $message : $activity->comment_content;
					$activity_profile_thumbnail = ! empty( $activity_profile_id ) ? get_post_thumbnail_id( $activity_profile_id ) : '';
					$activity_profile_name      = ! empty( $activity_profile_id ) ? gigneo_profile_name( $activity_profile_id ) : '';
					$icon                       = gigneo_activity_icon( $activity_type );
					$icon_class                 = ! empty( $icon['icon'] ) ? $icon['icon'] : 'hi hi-exclamation-circle';
					$icon_status                = ! empty( $icon['status'] ) ? $icon['status'] : 'info';
					//Date
					if ( $activity_date !== $current_date ) {
						$current_date = $activity_date;
						?>
						<div class="gn-activity-date">
							<span class="gn-date"><?php echo esc_html( $current_date ); ?></span>
						</div>
						<?php
					}
					$is_system = in_array( $activity_type, array( 'requirement_pending', 'order_started', 'order_completed', 'order_payment_released', 'order_cancelled', 'order_payment_refunded' ), true );
					?>
					<div class="gn-activity-log gn-<?php echo esc_attr( ! $is_system && $participant_profile_id === $activity_profile_id ? 'general' : 'system' ); ?>-activity gn-activity-type-<?php echo esc_html( $activity_type ?? 'info' ); ?>" id="<?php echo esc_attr( 'gn-activity-' . $activity->comment_ID ); ?>">
						<div class="gn-activity-info">
							<?php
							if ( ! $is_system && $profile_id !== $activity_profile_id ) {
								if ( in_array( $activity_type, array( 'order_completed_by_moderator', 'order_cancelled_by_moderator', 'order_dispute_approved_by_moderator', 'order_dispute_rejected_by_moderator', 'order_continue_and_dispute_rejected_by_moderator' ), true ) ) {
									$activity_profile_name      = $gn_moderator_name;
									$activity_profile_thumbnail = $moderator_avatar_id;
								}
								?>
								<div class="gn-author-info">
									<figure class="gn-avatar">
										<?php gigneo_attachment_image_src( $activity_profile_thumbnail, 'thumbnail', 'profile' ); ?>
									</figure>
									<div class="gn-info">
										<span class="gn-name"><?php echo esc_html( $activity_profile_name ); ?></span>
									</div>
								</div>
							<?php } else { ?>
								<span class="gn-icon gn-status-<?php echo esc_attr( $icon_status ); ?>">
									<i class="<?php echo esc_attr( $icon_class ); ?>" aria-hidden="true"></i>
								</span>
							<?php } ?>
							<div class="gn-detail">
								<p class="gn-description"><?php echo esc_html( $message ); ?></p>
								<?php
								if ( 'order_final_delivery' === $activity_type ) {
										$order_delivered_info   = get_comment_meta( $activity->comment_ID, '_gigneo_cm_order_delivery_info', true );
										$order_delivered_status = $order_delivered_info['status'] ?? '';
									if ( isset( $status_labels[ $order_delivered_status ] ) ) {
										?>
											<span class="gn-status-tag <?php echo esc_attr( gigneo_status_class( $order_delivered_status ) ); ?>"><?php echo esc_html( $status_labels[ $order_delivered_status ] ); ?></span>
											<?php
									}
								}

								if ( 'order_revision_requested' === $activity_type ) {
									$order_revision_info = get_comment_meta( $activity->comment_ID, '_gigneo_cm_revision_info', true );
									$order_revision_info = $order_revision_info['status'] ?? '';
									if ( isset( $status_labels[ $order_revision_info ] ) ) {
										?>
										<span class="gn-status-tag <?php echo esc_attr( gigneo_status_class( $order_revision_info ) ); ?>"><?php echo esc_html( $status_labels[ $order_revision_info ] ); ?></span>
									<?php } ?>
									<?php
								}

								if ( 'order_cancel_requested' === $activity_type ) {
									$order_cancel_info        = get_comment_meta( $activity->comment_ID, '_gigneo_cm_cancel_request_info', true );
									$order_cancel_info_status = $order_cancel_info['status'] ?? '';
									if ( isset( $status_labels[ $order_cancel_info_status ] ) ) {
										?>
										<span class="gn-status-tag <?php echo esc_attr( gigneo_status_class( $order_cancel_info_status ) ); ?>"><?php echo esc_html( $status_labels[ $order_cancel_info_status ] ); ?></span>
									<?php } ?>
									<?php
								}

								if ( 'delivery_date_extend_request' === $activity_type ) {
									$extend_delivery_info        = get_comment_meta( $activity->comment_ID, '_gigneo_cm_extend_delivery_date_info', true );
									$extend_delivery_info_status = $extend_delivery_info['status'] ?? '';
									if ( isset( $status_labels[ $extend_delivery_info_status ] ) ) {
										?>
										<span class="gn-status-tag <?php echo esc_attr( gigneo_status_class( $extend_delivery_info_status ) ); ?>"><?php echo esc_html( $status_labels[ $extend_delivery_info_status ] ); ?></span>
									<?php } ?>
									<?php
								}

								if ( 'order_disputed_by_freelancer' === $activity_type || 'order_disputed_by_employer' === $activity_type ) {
									$order_dispute_profile_id = get_comment_meta( $activity->comment_ID, '_gigneo_cm_profile_id', true );
									$order_disputed_info      = get_comment_meta( $activity->comment_ID, '_gigneo_cm_dispute_info', true );
									$order_disputed_status    = $order_disputed_info['status'] ?? '';
									if ( isset( $status_labels[ $order_disputed_status ] ) ) {
										?>
										<span class="gn-status-tag <?php echo esc_attr( gigneo_status_class( $order_disputed_status ) ); ?>"><?php echo esc_html( $status_labels[ $order_disputed_status ] ); ?></span>
										<?php
									}
								}

								?>
							</div>
							<?php if ( 'requirement_pending' === $activity_type && 'employer' === $profile_type && 'requirement_pending' === $current_stage ) { ?>
								<a href="<?php echo esc_url( $requirement_url ); ?>" class="gn-link gn-link-sm gn-link-primary"><?php esc_html_e( 'Submit requirements', 'gigneo' ); ?></a>
							<?php } ?>
							<?php if ( 'requirement_submitted' === $activity_type || 'requirement_updated' === $activity_type ) { ?>
								<a href="<?php echo esc_url( $requirement_url ); ?>" class="gn-link gn-link-sm gn-link-primary"><?php esc_html_e( 'View requirements', 'gigneo' ); ?></a>
							<?php } ?>
							<?php if ( 'attachment_upload' === $activity_type ) { ?>
								<a href="<?php echo esc_url( $attachment_url ); ?>" class="gn-link gn-link-sm gn-link-primary"><?php esc_html_e( 'View attachments', 'gigneo' ); ?></a>
							<?php } ?>
						</div>
						<?php
						//Delivery
						if ( 'order_draft_delivery' === $activity_type || 'order_final_delivery' === $activity_type ) {
							$order_delivered_info        = get_comment_meta( $activity->comment_ID, '_gigneo_cm_order_delivery_info', true );
							$order_delivered_description = ! empty( $order_delivered_info['description'] ) ? $order_delivered_info['description'] : '';
							$order_delivered_attachments = ! empty( $order_delivered_info['attachments'] ) ? $order_delivered_info['attachments'] : '';

							if ( ! empty( $order_delivered_description ) ) {
								?>
								<div class="gn-activity-detail-wrapper gn-activity-detail-delivery">
									<div class="gn-activity-detail">
										<div class="gn-head">
											<h4 class="gn-title"><?php echo 'order_final_delivery' === $activity_type ? esc_html__( 'Delivery details', 'gigneo' ) : esc_html__( 'Draft Delivery', 'gigneo' ); ?></h4>
										</div>
										<div class="gn-body">
											<div class="gn-info">
												<pre class="gn-pre"><?php echo wp_kses_post( $order_delivered_description ); ?></pre>
												<?php if ( ! empty( $order_delivered_attachments ) ) { ?>
													<div class="gn-attachments">
														<h6 class="gn-title"><?php echo esc_html__( 'Attached files', 'gigneo' ); ?></h6>
														<?php
														global $wpdb;
														foreach ( $order_delivered_attachments as $at => $attachment ) {
															// phpcs:disable WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching
															$attachment = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM {$wpdb->prefix}gigneo_attachments WHERE id = %d LIMIT 1", $attachment ) );
															// phpcs:enable WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching
															if ( $attachment ) {
																$attachment_path = gigneo_upload_dir_path( $attachment->path );
																$attachment_url  = gigneo_upload_dir_url( $attachment->path );
																if ( file_exists( $attachment_path ) ) {
																	?>
																	<div class="gn-attachment">
																		<div class="gn-attachment-info">
																			<i class="hi hi-link" aria-hidden="true"></i>
																			<h6 class="gn-name"><?php echo esc_html( $attachment->name ); ?></h6>
																		</div>
																		<a href="<?php echo esc_url( $attachment_url ); ?>" class="gn-btn-download" download>
																			<i class="hi hi-arrow-down-tray" aria-hidden="true"></i>
																		</a>
																	</div>
																	<?php
																}
															}
															?>
														<?php } ?>
													</div>
												<?php } ?>
											</div>
										</div>
										<?php if ( 'employer' === $profile_type && absint( $final_delivery_activity ) === absint( $activity->comment_ID ) && ( 'order_delivered' === $current_stage || 'order_revision_delivered' === $current_stage ) ) { ?>
										<div class="gn-footer">
											<div class="gn-actions">
												<?php if ( in_array( $order_status, array( 'publish', 'delivered' ), true ) && 'unlimited' === $total_revision || $revision_left > 0 ) { ?>
													<button type="button" data-gn-modal-toggle="gn-order-revision" class="gn-btn gn-btn-sm gn-btn-outline-grey"><?php echo esc_html__( 'Request revision', 'gigneo' ); ?></button>
													<!--Revision Modal-->
													<div id="gn-order-revision" class="gn-modal-wrapper gn-order-revision">
														<div class="gn-modal-dialog">
															<div class="gn-modal-content">
																<div class="gn-modal-info">
																	<div class="gn-modal-header">
																		<h4 class="gn-title"><?php echo esc_html__( 'Request revision', 'gigneo' ); ?></h4>
																		<p class="gn-description"><?php echo esc_html__( 'Did not receive what you expected or facing any issues.', 'gigneo' ); ?></p>
																		<button type="button" data-gn-modal-close="gn-order-revision" class="gn-modal-close">
																			<i class="hi hi-x-mark" aria-hidden="true"></i>
																		</button>
																	</div>
																	<form id="gn-service-order-revision-form" class="gn-theme-form">
																		<div class="gn-modal-body gn-custom-scrollbar">
																			<div class="gn-notices-wrapper">
																				<div class="gn-notice gn-notice-info">
																					<div class="gn-notice-content">
																						<div class="gn-notice-icon">
																							<i class="hi hi-exclamation-circle" aria-hidden="true"></i>
																						</div>
																						<div class="gn-notice-info">
																							<p class="gn-description"><?php echo esc_html__( 'Clearly describe the changes you want. Include specific sections, examples, or corrections if possible.', 'gigneo' ); ?></p>
																						</div>
																					</div>
																				</div>
																			</div>
																			<fieldset class="gn-form-fields">
																				<div class="row g-4">
																					<div class="col-md-12">
																						<div class="gn-form-field gn-plupload">
																							<label for="gn-order-delivery-attachments"><?php echo esc_html__( 'Attachments', 'gigneo' ); ?></label>
																							<div id="gn-service-order-attachment-container"
																								class="gn-plupload-container">
																								<div id="gn-service-order-attachment-drop-area" class="gn-plupload-drop-area">
																									<i class="hi hi-cloud-arrow-up" aria-hidden="true"></i>
																									<div class="gn-action-info">
																										<p class="gn-message"><?php echo esc_html__( 'Click here to upload.', 'gigneo' ); ?></p>
																										<button id="gn-service-order-attachment-uploader" type="button" class="gn-upload"></button>
																										<p class="gn-note">
																											<?php
																											printf(
																											// translators: %1$s: Valid extensions %2$s Maximum files %3$s Maximum file size.
																												esc_html__( '%1$s — Up to %2$s files (Max. %3$s MB)', 'gigneo' ),
																												esc_html( strtoupper( implode( ',', $service_order_extensions ) ) ),
																												esc_html( $service_order_max_files ),
																												esc_html( $service_order_max_size )
																											);
																											?>
																										</p>
																									</div>
																								</div>
																								<div id="gn-service-order-attachment-list" class="gn-plupload-attachments"></div>
																							</div>
																						</div>
																					</div>
																					<div class="col-md-12">
																						<div class="gn-form-field gn-wysiwyg-editor-two">
																							<label for="gn-order-revision-description" class="gn-required-field-label"><?php echo esc_html__( 'Description', 'gigneo' ); ?></label>
																							<?php
																							wp_editor(
																								'',
																								'gn-order-revision-description',
																								array(
																									'textarea_name' => 'order_revision_description',
																									'media_buttons' => false,
																									'quicktags'     => false,
																									'textarea_rows' => 7,
																									'editor_class'  => 'gn-wp-editor gn-required-field',
																									'tinymce'      => array(
																										'toolbar1' => 'bold italic bullist numlist link unlink',
																										'toolbar2' => '',
																										'plugins'  => 'lists link',
																										'directionality' => is_rtl() ? 'rtl' : 'ltr',
																										'forced_root_block' => false,
																										'force_br_newlines' => true,
																										'force_p_newlines' => false,
																										'convert_newlines_to_brs' => true,
																										'valid_elements' => 'strong/b,em/i,ul,ol,li,a[href|target],br,hr',
																										'invalid_elements' => 'p,pre,h1,h2,h3,h4,h5,h6,img',
																										'content_style' => 'body { font-size: 14px; background-color: transparent; font-family: var(--gigneo-primary-font,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji) }',
																									),
																								)
																							);
																							?>
																						</div>
																					</div>
																				</div>
																			</fieldset>
																		</div>
																		<div class="gn-modal-footer">
																			<input type="hidden" name="order_id" value="<?php echo esc_attr( $order_id ); ?>"/>
																			<button type="button" class="gn-btn gn-btn-outline-grey" data-gn-modal-close="gn-order-revision"><?php echo esc_html__( 'Close', 'gigneo' ); ?></button>
																			<button type="submit" class="gn-btn gn-btn-primary"><?php echo esc_html__( 'Submit', 'gigneo' ); ?></button>
																		</div>
																	</form>
																</div>
															</div>
														</div>
													</div>
												<?php } else { ?>
													<button type="button" class="gn-btn gn-btn-outline-grey gn-btn-sm"  data-gn-modal-toggle="gn-service-order-cancel-request"><?php echo esc_html__( 'Cancel order', 'gigneo' ); ?></button>
												<?php } ?>
												<button type="button" id="gn-service-order-delivery-approve" class="gn-btn gn-btn-primary gn-btn-sm" data-gn-order-id="<?php echo esc_attr( $order_id ); ?>"><?php echo esc_html__( 'Approve delivery', 'gigneo' ); ?></button>
											</div>
										</div>
										<?php } ?>
									</div>
								</div>
								<?php
							}
						}
						//Revision Requested
						if ( 'order_revision_requested' === $activity_type ) {
							$order_revision_info        = get_comment_meta( $activity->comment_ID, '_gigneo_cm_revision_info', true );
							$order_revision_description = ! empty( $order_revision_info['description'] ) ? $order_revision_info['description'] : '';
							$order_revision_attachments = ! empty( $order_revision_info['attachments'] ) ? $order_revision_info['attachments'] : '';
							if ( ! empty( $order_revision_description ) ) {
								?>
								<div class="gn-activity-detail-wrapper gn-activity-detail-revision">
									<div class="gn-activity-detail">
										<div class="gn-head">
											<h4 class="gn-title"><?php echo esc_html__( 'Revision details', 'gigneo' ); ?></h4>
										</div>
										<div class="gn-body">
											<div class="gn-info">
												<pre class="gn-pre"><?php echo wp_kses_post( $order_revision_description ); ?></pre>
												<?php if ( ! empty( $order_revision_attachments ) ) { ?>
													<div class="gn-attachments">
														<h6 class="gn-title"><?php echo esc_html__( 'Attached files', 'gigneo' ); ?></h6>
														<?php
														global $wpdb;
														foreach ( $order_revision_attachments as $at => $attachment ) {
															// phpcs:disable WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching
															$attachment = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM {$wpdb->prefix}gigneo_attachments WHERE id = %d LIMIT 1", $attachment ) );
															// phpcs:enable WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching
															if ( $attachment ) {
																$attachment_path = gigneo_upload_dir_path( $attachment->path );
																$attachment_url  = gigneo_upload_dir_url( $attachment->path );
																if ( file_exists( $attachment_path ) ) {
																	?>
																	<div class="gn-attachment">
																		<div class="gn-attachment-info">
																			<i class="hi hi-link" aria-hidden="true"></i>
																			<h6 class="gn-name"><?php echo esc_html( $attachment->name ); ?></h6>
																		</div>
																		<a href="<?php echo esc_url( $attachment_url ); ?>" class="gn-btn-download" download>
																			<i class="hi hi-arrow-down-tray" aria-hidden="true"></i>
																		</a>
																	</div>
																	<?php
																}
															}
															?>
														<?php } ?>
													</div>
												<?php } ?>
											</div>
										</div>
									</div>
								</div>
								<?php
							}
						}
						//Give Review to Freelancer
						if ( 'order_completed' === $activity_type && 'order_completed' === $current_stage && 'employer' === $profile_type && empty( $freelancer_review_activity ) ) {
							?>
							<div class="gn-activity-log gn-activity-type-review-request">
								<div class="gn-activity-detail-wrapper gn-activity-detail-review">
									<div class="gn-activity-detail">
										<div class="gn-head">
											<h4 class="gn-title"><?php echo esc_html__( 'Describe your experience', 'gigneo' ); ?></h4>
										</div>
										<form id="gn-freelancer-review-form" class="gn-theme-form gn-order-review-form">
											<div class="gn-body">
												<div class="gn-form-fields">
													<fieldset>
														<ul class="gn-review-options">
															<li>
																<h6 class="gn-label"><?php echo esc_html__( 'Communication level', 'gigneo' ); ?></h6>
																<div class="gn-review-stars">
																	<i class="hi hi-star-alt" aria-hidden="true"></i>
																	<i class="hi hi-star-alt" aria-hidden="true"></i>
																	<i class="hi hi-star-alt" aria-hidden="true"></i>
																	<i class="hi hi-star-alt" aria-hidden="true"></i>
																	<i class="hi hi-star-alt" aria-hidden="true"></i>
																</div>
																<input type="hidden" class="gn-required-field gn-review-stars-input" name="communication_level" />
															</li>
															<li>
																<h6 class="gn-label"><?php echo esc_html__( 'Quality of work', 'gigneo' ); ?></h6>
																<div class="gn-review-stars">
																	<i class="hi hi-star-alt" aria-hidden="true"></i>
																	<i class="hi hi-star-alt" aria-hidden="true"></i>
																	<i class="hi hi-star-alt" aria-hidden="true"></i>
																	<i class="hi hi-star-alt" aria-hidden="true"></i>
																	<i class="hi hi-star-alt" aria-hidden="true"></i>
																</div>
																<input type="hidden" class="gn-required-field gn-review-stars-input" name="quality_work" />
															</li>
															<li>
																<h6 class="gn-label"><?php echo esc_html__( 'Understanding of needs', 'gigneo' ); ?></h6>
																<div class="gn-review-stars">
																	<i class="hi hi-star-alt" aria-hidden="true"></i>
																	<i class="hi hi-star-alt" aria-hidden="true"></i>
																	<i class="hi hi-star-alt" aria-hidden="true"></i>
																	<i class="hi hi-star-alt" aria-hidden="true"></i>
																	<i class="hi hi-star-alt" aria-hidden="true"></i>
																</div>
																<input type="hidden" class="gn-required-field gn-review-stars-input" name="understanding"/>
															</li>
														</ul>
														<div class="gn-form-field gn-wysiwyg-editor-two">
															<label for="gn-order-review-feedback" class="gn-required-field-label"><?php echo esc_html__( 'Feedback', 'gigneo' ); ?></label>
															<?php
															wp_editor(
																'',
																'gn-order-review-feedback',
																array(
																	'textarea_name' => 'review_feedback',
																	'media_buttons' => false,
																	'quicktags'    => false,
																	'textarea_rows' => 7,
																	'editor_class' => 'gn-wp-editor gn-required-field',
																	'tinymce'      => array(
																		'toolbar1' => 'bold italic bullist numlist link unlink',
																		'toolbar2' => '',
																		'plugins'  => 'lists link',
																		'directionality' => is_rtl() ? 'rtl' : 'ltr',
																		'forced_root_block' => false,
																		'force_br_newlines' => true,
																		'force_p_newlines' => false,
																		'convert_newlines_to_brs' => true,
																		'valid_elements' => 'strong/b,em/i,ul,ol,li,a[href|target],br,hr',
																		'invalid_elements' => 'p,pre,h1,h2,h3,h4,h5,h6,img',
																		'content_style' => 'body { font-size: 14px; background-color: transparent; font-family: var(--gigneo-primary-font,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji) }',
																	),
																)
															);
															?>
														</div>
													</fieldset>
												</div>
											</div>
											<div class="gn-footer">
												<div class="gn-actions">
													<input type="hidden" name="review_for" value="freelancer"/>
													<input type="hidden" name="order_id" value="<?php echo esc_attr( $order_id ); ?>"/>
													<button type="submit" class="gn-btn gn-btn-primary"><?php echo esc_html__( 'Submit review', 'gigneo' ); ?></button>
												</div>
											</div>
										</form>
									</div>
								</div>
							</div>
							<?php
						}
						//View Freelancer Review
						if ( 'freelancer_review' === $activity_type && ! empty( $freelancer_review_activity ) ) {
							$freelancer_review_meta                = get_comment_meta( $freelancer_review_activity, '_gigneo_cm_review_info', true );
							$freelancer_review_communication_level = ! empty( $freelancer_review_meta['communication_level'] ) ? absint( $freelancer_review_meta['communication_level'] ) : 0;
							$freelancer_review_quality_work        = ! empty( $freelancer_review_meta['quality_work'] ) ? absint( $freelancer_review_meta['quality_work'] ) : 0;
							$freelancer_review_understanding       = ! empty( $freelancer_review_meta['understanding'] ) ? absint( $freelancer_review_meta['understanding'] ) : 0;
							$freelancer_review_feedback            = ! empty( $freelancer_review_meta['feedback'] ) ? $freelancer_review_meta['feedback'] : '';
							$freelancer_review_stars               = $freelancer_review_communication_level + $freelancer_review_quality_work + $freelancer_review_understanding;
							$freelancer_review_star_average        = number_format( $freelancer_review_stars / 3, 1 );
							?>
						<div class="gn-activity-detail-wrapper gn-activity-detail-freelancer-review">
							<div class="gn-activity-detail">
								<div class="gn-head">
									<h4 class="gn-title"><?php echo esc_html__( 'Review details', 'gigneo' ); ?></h4>
								</div>
								<div class="gn-body">
									<div class="gn-info">
										<div class="gn-review-stars">
											<?php
											for ( $i = 1; $i <= 5; $i++ ) {
												if ( $freelancer_review_star_average >= $i ) {
													echo '<i class="hi hi-star-alt gn-filled"></i>';
												} elseif ( $freelancer_review_star_average >= ( $i - 0.5 ) ) {
													echo '<i class="hi hi-star-half-alt gn-filled"></i>';
												} else {
													echo '<i class="hi hi-star-alt"></i>';
												}
											}
											?>
										</div>
										<pre class="gn-pre"><?php echo wp_kses_post( $freelancer_review_feedback ); ?></pre>
										<div class="gn-review-details">
											<div class="gn-review">
												<span class="gn-label"><?php echo esc_html__( 'Communication Level', 'gigneo' ); ?></span>
												<span class="gn-value"><i class="hi hi-star-alt"></i><?php echo esc_attr( number_format( $freelancer_review_communication_level, 1 ) ); ?></span>
											</div>
											<div class="gn-review">
												<span class="gn-label"><?php echo esc_html__( 'Quality of Work', 'gigneo' ); ?></span>
												<span class="gn-value"><i class="hi hi-star-alt"></i><?php echo esc_attr( number_format( $freelancer_review_quality_work, 1 ) ); ?></span>
											</div>
											<div class="gn-review">
												<span class="gn-label"><?php echo esc_html__( 'Understanding of Needs', 'gigneo' ); ?></span>
												<span class="gn-value"><i class="hi hi-star-alt"></i><?php echo esc_attr( number_format( $freelancer_review_understanding, 1 ) ); ?></span>
											</div>
										</div>
									</div>
								</div>
							</div>
						</div>
							<?php
						}
						//Give Feedback to Employer
						if ( 'freelancer_review' === $activity_type && 'order_completed' === $current_stage && 'freelancer' === $profile_type && empty( $employer_review_activity ) && ! empty( $freelancer_review_activity ) ) {
							?>
							<div class="gn-activity-log gn-activity-type-review-request">
								<div class="gn-activity-info">
									<span class="gn-icon gn-status-warning">
										<i class="hi hi-star" aria-hidden="true"></i>
									</span>
									<div class="gn-detail">
										<p class="gn-description"><?php echo esc_html__( 'Share your experience.', 'gigneo' ); ?></p>
									</div>
								</div>
								<div class="gn-activity-detail-wrapper gn-activity-detail-review">
									<div class="gn-activity-detail">
										<div class="gn-head">
											<h4 class="gn-title"><?php echo esc_html__( 'Share feedback', 'gigneo' ); ?></h4>
										</div>
										<form id="gn-employer-review-form" class="gn-theme-form gn-order-review-form">
											<div class="gn-body">
												<div class="gn-form-fields">
													<fieldset>
														<ul class="gn-review-options">
															<li>
																<h6 class="gn-label"><?php echo esc_html__( 'Communication Level', 'gigneo' ); ?></h6>
																<div class="gn-review-stars">
																	<i class="hi hi-star-alt" aria-hidden="true"></i>
																	<i class="hi hi-star-alt" aria-hidden="true"></i>
																	<i class="hi hi-star-alt" aria-hidden="true"></i>
																	<i class="hi hi-star-alt" aria-hidden="true"></i>
																	<i class="hi hi-star-alt" aria-hidden="true"></i>
																</div>
																<input type="hidden" class="gn-required-field gn-review-stars-input" name="communication_level"/>
															</li>
															<li>
																<h6 class="gn-label"><?php echo esc_html__( 'Clarity of Requirements', 'gigneo' ); ?></h6>
																<div class="gn-review-stars">
																	<i class="hi hi-star-alt" aria-hidden="true"></i>
																	<i class="hi hi-star-alt" aria-hidden="true"></i>
																	<i class="hi hi-star-alt" aria-hidden="true"></i>
																	<i class="hi hi-star-alt" aria-hidden="true"></i>
																	<i class="hi hi-star-alt" aria-hidden="true"></i>
																</div>
																<input type="hidden" class="gn-required-field gn-review-stars-input" name="clarity_of_requirements" />
															</li>
															<li>
																<h6 class="gn-label"><?php echo esc_html__( 'Professionalism', 'gigneo' ); ?></h6>
																<div class="gn-review-stars">
																	<i class="hi hi-star-alt" aria-hidden="true"></i>
																	<i class="hi hi-star-alt" aria-hidden="true"></i>
																	<i class="hi hi-star-alt" aria-hidden="true"></i>
																	<i class="hi hi-star-alt" aria-hidden="true"></i>
																	<i class="hi hi-star-alt" aria-hidden="true"></i>
																</div>
																<input type="hidden" class="gn-required-field gn-review-stars-input" name="professionalism" />
															</li>
														</ul>
														<div class="gn-form-field gn-wysiwyg-editor-two">
															<label for="gn-order-review-feedback" class="gn-required-field-label"><?php echo esc_html__( 'Reply', 'gigneo' ); ?></label>
															<?php
															wp_editor(
																'',
																'gn-order-review-feedback',
																array(
																	'textarea_name' => 'review_feedback',
																	'media_buttons' => false,
																	'quicktags'    => false,
																	'textarea_rows' => 7,
																	'editor_class' => 'gn-wp-editor gn-required-field',
																	'tinymce'      => array(
																		'toolbar1' => 'bold italic bullist numlist link unlink',
																		'toolbar2' => '',
																		'plugins'  => 'lists link',
																		'directionality' => is_rtl() ? 'rtl' : 'ltr',
																		'forced_root_block' => false,
																		'force_br_newlines' => true,
																		'force_p_newlines' => false,
																		'convert_newlines_to_brs' => true,
																		'valid_elements' => 'strong/b,em/i,ul,ol,li,a[href|target],br,hr',
																		'invalid_elements' => 'p,pre,h1,h2,h3,h4,h5,h6,img',
																		'content_style' => 'body { font-size: 14px; background-color: transparent; font-family: var(--gigneo-primary-font,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji) }',
																	),
																)
															);
															?>
														</div>
													</fieldset>
												</div>
											</div>
											<div class="gn-footer">
												<div class="gn-actions">
													<input type="hidden" name="review_for" value="employer"/>
													<input type="hidden" name="order_id" value="<?php echo esc_attr( $order_id ); ?>"/>
													<button type="submit" class="gn-btn gn-btn-primary"><?php echo esc_html__( 'Submit feedback', 'gigneo' ); ?></button>
												</div>
											</div>
										</form>
									</div>
								</div>
							</div>
							<?php
						}
						//View Employer Review
						if ( 'employer_review' === $activity_type && ! empty( $employer_review_activity ) ) {
							$employer_review_meta                    = get_comment_meta( $employer_review_activity, '_gigneo_cm_employer_review_info', true );
							$employer_review_feedback                = ! empty( $employer_review_meta['feedback'] ) ? $employer_review_meta['feedback'] : '';
							$employer_review_communication_level     = ! empty( $employer_review_meta['communication_level'] ) ? $employer_review_meta['communication_level'] : '';
							$employer_review_clarity_of_requirements = ! empty( $employer_review_meta['clarity_of_requirements'] ) ? $employer_review_meta['clarity_of_requirements'] : '';
							$employer_review_professionalism         = ! empty( $employer_review_meta['professionalism'] ) ? $employer_review_meta['professionalism'] : '';
							$employer_review_stars                   = $employer_review_communication_level + $employer_review_clarity_of_requirements + $employer_review_professionalism;
							$employer_review_star_average            = number_format( $employer_review_stars / 3, 1 );
							if ( ! empty( $employer_review_feedback || $employer_review_communication_level || $employer_review_clarity_of_requirements || $employer_review_professionalism ) ) {
								?>
								<div class="gn-activity-detail-wrapper gn-activity-detail-freelancer-review">
									<div class="gn-activity-detail">
										<div class="gn-head">
											<h4 class="gn-title"><?php echo esc_html__( 'Review details', 'gigneo' ); ?></h4>
										</div>
										<div class="gn-body">
											<div class="gn-info">
												<div class="gn-review-stars">
													<?php
													for ( $i = 1; $i <= 5; $i++ ) {
														if ( $employer_review_star_average >= $i ) {
															echo '<i class="hi hi-star-alt gn-filled"></i>';
														} elseif ( $employer_review_star_average >= ( $i - 0.5 ) ) {
															echo '<i class="hi hi-star-half-alt gn-filled"></i>';
														} else {
															echo '<i class="hi hi-star-alt"></i>';
														}
													}
													?>
												</div>
												<pre class="gn-pre"><?php echo wp_kses_post( $employer_review_feedback ); ?></pre>
												<div class="gn-review-details">
													<div class="gn-review">
														<span class="gn-label"><?php echo esc_html__( 'Communication Level', 'gigneo' ); ?></span>
														<span class="gn-value"><i
																	class="hi hi-star-alt"></i><?php echo esc_attr( number_format( $employer_review_communication_level, 1 ) ); ?></span>
													</div>
													<div class="gn-review">
														<span class="gn-label"><?php echo esc_html__( 'Clarity of Requirements', 'gigneo' ); ?></span>
														<span class="gn-value"><i
																	class="hi hi-star-alt"></i><?php echo esc_attr( number_format( $employer_review_clarity_of_requirements, 1 ) ); ?></span>
													</div>
													<div class="gn-review">
														<span class="gn-label"><?php echo esc_html__( 'Professionalism', 'gigneo' ); ?></span>
														<span class="gn-value"><i
																	class="hi hi-star-alt"></i><?php echo esc_attr( number_format( $employer_review_professionalism, 1 ) ); ?></span>
													</div>
												</div>
											</div>
										</div>
									</div>
								</div>
									<?php
							}
							?>
							<?php
						}
						//Cancel Request
						if ( 'order_cancel_requested' === $activity_type ) {
							$cancel_activity_meta  = get_comment_meta( $activity->comment_ID, '_gigneo_cm_cancel_request_info', true );
							$cancel_request_status = $cancel_activity_meta['status'] ?? '';
							$cancel_reason         = $cancel_activity_meta['reason'] ?? esc_html__( 'Cancel order request', 'gigneo' );
							$cancel_description    = $cancel_activity_meta['description'] ?? '';
							if ( ! empty( $cancel_description ) ) {
								?>
								<div class="gn-activity-detail-wrapper gn-activity-detail-cancel-request">
									<div class="gn-activity-detail">
										<div class="gn-head">
											<h4 class="gn-title"><?php echo esc_html( $cancel_reason ); ?></h4>
										</div>
										<div class="gn-body">
											<div class="gn-info">
												<pre class="gn-pre"><?php echo wp_kses_post( $cancel_description ); ?></pre>
											</div>
										</div>
										<?php if ( in_array( $order_status, array( 'publish', 'delivered' ), true ) && 'freelancer' === $profile_type && ! empty( $cancel_request_activity ) && 'requested' === $cancel_request_status ) { ?>
											<div class="gn-footer">
												<div class="gn-actions">
													<button id="gn-order-cancel-decline" type="button" data-gn-order-id="<?php echo esc_attr( $order_id ); ?>" class="gn-btn gn-btn-sm gn-btn-outline-grey"><?php echo esc_html__( 'Decline', 'gigneo' ); ?></button>
													<button id="gn-order-cancel-approve" type="button" data-gn-order-id="<?php echo esc_attr( $order_id ); ?>" class="gn-btn gn-btn-sm gn-btn-primary"><?php echo esc_html__( 'Approve', 'gigneo' ); ?></button>
												</div>
											</div>
										<?php } ?>
									</div>
								</div>
								<?php
							}
						}
						//Extend Delivery Request
						if ( 'delivery_date_extend_request' === $activity_type ) {
							$extend_delivery_meta_info = get_comment_meta( $activity->comment_ID, '_gigneo_cm_extend_delivery_date_info', true );
							$extend_delivery_status    = ! empty( $extend_delivery_meta_info['status'] ) ? $extend_delivery_meta_info['status'] : '';
							$extend_delivery_reason    = ! empty( $extend_delivery_meta_info['reason'] ) ? $extend_delivery_meta_info['reason'] : '';
							$extend_delivery_old_date  = ! empty( $extend_delivery_meta_info['old_date_time_gmt'] ) ? $extend_delivery_meta_info['old_date_time_gmt'] : '';
							$extend_delivery_new_date  = ! empty( $extend_delivery_meta_info['new_date_time_gmt'] ) ? $extend_delivery_meta_info['new_date_time_gmt'] : '';

							if ( ! empty( $extend_delivery_old_date ) && ! empty( $extend_delivery_new_date ) && ! empty( $extend_delivery_reason ) ) {
								?>
								<div class="gn-activity-detail-wrapper gn-activity-detail-extend-delivery-request">
									<div class="gn-activity-detail">
										<div class="gn-head">
											<h4 class="gn-title"><?php echo esc_html__( 'Extend delivery request', 'gigneo' ); ?></h4>
										</div>
										<div class="gn-body">
											<div class="gn-info">
												<pre class="gn-pre"><?php echo wp_kses( $extend_delivery_reason , gigneo_allowed_html_tags()); ?></pre>
												<ul class="gn-dates">
													<li>
														<span class="gn-label">
															<i class="hi hi-calendar" aria-hidden="true"></i>
															<?php echo esc_html__( 'Current Due Date:', 'gigneo' ); ?>
														</span>
														<span class="gn-value"><?php echo esc_html( gigneo_datetime( $extend_delivery_old_date, $date_time_format ) ); ?></span>
													</li>
													<li>
														<span class="gn-label"><i class="hi hi-calendar" aria-hidden="true"></i><?php echo esc_html__( 'New Requested Date:', 'gigneo' ); ?></span>
														<span class="gn-value"><?php echo esc_html( gigneo_datetime( $extend_delivery_new_date, $date_time_format ) ); ?></span>
													</li>
												</ul>
												<?php if ( in_array( $order_status, array( 'publish', 'delivered' ), true ) && 'employer' === $profile_type && $extend_date_request_activity === $activity->comment_ID && 'requested' === $extend_delivery_status ) { ?>
													<div class="gn-actions">
														<button id="gn-order-extend-delivery-date-decline" type="button" data-gn-order-id="<?php echo esc_attr( $order_id ); ?>" class="gn-btn gn-btn-outline-grey"><?php echo esc_html__( 'Decline', 'gigneo' ); ?></button>
														<button id="gn-order-extend-delivery-date-approve" type="button" data-gn-order-id="<?php echo esc_attr( $order_id ); ?>" class="gn-btn gn-btn-primary"><?php echo esc_html__( 'Approve', 'gigneo' ); ?></button>
													</div>
												<?php } ?>
											</div>
										</div>
									</div>
								</div>
								<?php
							}
						}
						//Disputed Freelancer
						if ( 'order_disputed_by_freelancer' === $activity_type && 'freelancer' === $profile_type ) {
							$dispute_profile_id           = get_comment_meta( $activity->comment_ID, '_gigneo_cm_profile_id', true );
							$dispute_activity_meta        = get_comment_meta( $activity->comment_ID, '_gigneo_cm_dispute_info', true );
							$dispute_activity_status      = $cancel_activity_meta['status'] ?? '';
							$dispute_activity_reason      = $dispute_activity_meta['reason'] ?? '';
							$dispute_activity_description = $dispute_activity_meta['description'] ?? '';

							if ( ! empty( $dispute_activity_reason ) || ! empty( $dispute_activity_description ) || absint( $profile_id ) !== absint( $dispute_profile_id ) ) {
								?>
								<div class="gn-activity-detail-wrapper gn-activity-detail-dispute">
									<div class="gn-activity-detail">
										<div class="gn-head">
											<h4 class="gn-title"><?php echo esc_html( $dispute_activity_reason ); ?></h4>
										</div>
										<div class="gn-body">
											<div class="gn-info">
												<pre class="gn-pre"><?php echo wp_kses_post( $dispute_activity_description ); ?></pre>
											</div>
										</div>
									</div>
								</div>
								<?php
							}
						}
						//Disputed employer
						if ( 'order_disputed_by_employer' === $activity_type && 'employer' === $profile_type ) {
							$dispute_profile_id           = get_comment_meta( $activity->comment_ID, '_gigneo_cm_profile_id', true );
							$dispute_activity_meta        = get_comment_meta( $activity->comment_ID, '_gigneo_cm_dispute_info', true );
							$dispute_activity_status      = $cancel_activity_meta['status'] ?? '';
							$dispute_activity_reason      = $dispute_activity_meta['reason'] ?? '';
							$dispute_activity_description = $dispute_activity_meta['description'] ?? '';

							if ( ! empty( $dispute_activity_reason ) || ! empty( $dispute_activity_description ) || absint( $profile_id ) !== intdiv( $dispute_profile_id ) ) {
								?>
								<div class="gn-activity-detail-wrapper gn-activity-detail-dispute">
									<div class="gn-activity-detail">
										<div class="gn-head">
											<h4 class="gn-title"><?php echo esc_html( $dispute_activity_reason ); ?></h4>
										</div>
										<div class="gn-body">
											<div class="gn-info">
												<pre class="gn-pre"><?php echo wp_kses_post( $dispute_activity_description ); ?></pre>
											</div>
										</div>
									</div>
								</div>
								<?php
							}
						}
						//Cancelled by Moderator
						if ( 'order_cancelled_by_moderator' === $activity_type ) {
							$moderator_cancel_activity_meta        = get_comment_meta( $activity->comment_ID, '_gigneo_cm_cancel_info', true );
							$moderator_cancel_activity_reason      = $moderator_cancel_activity_meta['reason'] ?? esc_html__( 'Cancelled by Moderator', 'gigneo' );
							$moderator_cancel_activity_description = $moderator_cancel_activity_meta['description'] ?? '';
							if ( ! empty( $moderator_cancel_activity_description ) ) {
								?>
								<div class="gn-activity-detail-wrapper gn-activity-detail-dispute">
									<div class="gn-activity-detail">
										<div class="gn-head">
											<h4 class="gn-title"><?php echo esc_html( $moderator_cancel_activity_reason ); ?></h4>
										</div>
										<div class="gn-body">
											<div class="gn-info">
												<pre class="gn-pre"><?php echo wp_kses( $moderator_cancel_activity_description, gigneo_allowed_html_tags() ); ?></pre>
											</div>
										</div>
									</div>
								</div>
								<?php
							}
						}
						//Completed by Moderator
						if ( 'order_completed_by_moderator' === $activity_type ) {
							$moderator_completed_activity_meta        = get_comment_meta( $activity->comment_ID, '_gigneo_cm_complete_info', true );
							$moderator_completed_activity_reason      = $moderator_completed_activity_meta['reason'] ?? esc_html__( 'Completed by Moderator', 'gigneo' );
							$moderator_completed_activity_description = $moderator_completed_activity_meta['description'] ?? '';
							if ( ! empty( $moderator_completed_activity_description ) ) {
								?>
								<div class="gn-activity-detail-wrapper gn-activity-detail-dispute">
									<div class="gn-activity-detail">
										<div class="gn-head">
											<h4 class="gn-title"><?php echo esc_html( $moderator_completed_activity_reason ); ?></h4>
										</div>
										<div class="gn-body">
											<div class="gn-info">
												<pre class="gn-pre"><?php echo wp_kses( $moderator_completed_activity_description, gigneo_allowed_html_tags() ); ?></pre>
											</div>
										</div>
									</div>
								</div>
								<?php
							}
						}
						//Freelancer dispute Actions
						if ( 'moderator_freelancer_dispute_complete_order' === $activity_type && 'freelancer' === $profile_type ) {
							$moderator_freelancer_activity_meta      = get_comment_meta( $activity->comment_ID, '_gigneo_cm_info_meta', true );
							$moderator_freelancer_activity_status    = $moderator_freelancer_activity_meta['status'] ?? '';
							$moderator_freelancer_activity_disputed  = $moderator_freelancer_activity_meta['disputed_by'] ?? '';
							$moderator_freelancer_activity_meta_desc = $moderator_freelancer_activity_meta['description'] ?? '';
							if ( absint( $moderator_freelancer_activity_disputed ) === $profile_id && ! empty( $moderator_freelancer_activity_meta_desc ) ) {
								?>
										<div class="gn-activity-detail-wrapper gn-activity-detail-dispute">
											<div class="gn-activity-detail">
												<div class="gn-head">
													<h4 class="gn-title">
														<?php
														printf(
														// translators: %s dispute status
															esc_html__( 'Dispute %s', 'gigneo' ),
															esc_html( ucfirst( $moderator_freelancer_activity_status ) )
														);
														?>
													</h4>
												</div>
												<div class="gn-body">
													<div class="gn-info">
														<pre class="gn-pre"><?php echo wp_kses( $moderator_freelancer_activity_meta_desc, gigneo_allowed_html_tags() ); ?></pre>
													</div>
												</div>
											</div>
										</div>
										<?php
							}
						}
						//Common Moderator dispute Actions
						if ( 'order_continue_and_dispute_rejected_by_moderator' === $activity_type || 'order_dispute_approved_by_moderator' === $activity_type ) {
							$moderator_activity_meta      = get_comment_meta( $activity->comment_ID, '_gigneo_cm_info_meta', true );
							$moderator_activity_status    = $moderator_activity_meta['status'] ?? '';
							$moderator_activity_disputed  = $moderator_activity_meta['disputed_by'] ?? '';
							$moderator_activity_meta_desc = $moderator_activity_meta['description'] ?? '';
							if ( absint( $moderator_activity_disputed ) === $profile_id && ! empty( $moderator_activity_meta_desc ) ) {
								?>
								<div class="gn-activity-detail-wrapper gn-activity-detail-dispute">
									<div class="gn-activity-detail">
										<div class="gn-head">
											<h4 class="gn-title">
											<?php
											printf(
												// translators: %s dispute status
												esc_html__( 'Dispute %s', 'gigneo' ),
												esc_html( ucfirst( $moderator_activity_status ) )
											);
											?>
											</h4>
										</div>
										<div class="gn-body">
											<div class="gn-info">
												<pre class="gn-pre"><?php echo wp_kses( $moderator_activity_meta_desc, gigneo_allowed_html_tags() ); ?></pre>
											</div>
										</div>
									</div>
								</div>
								<?php
							}
						}
						//Employer dispute Actions
						if ( 'order_dispute_rejected_by_moderator' === $activity_type && 'employer' === $profile_type ) {
							$moderator_employer_activity_meta      = get_comment_meta( $activity->comment_ID, '_gigneo_cm_info_meta', true );
							$moderator_employer_activity_status    = $moderator_employer_activity_meta['status'] ?? '';
							$moderator_employer_activity_disputed  = $moderator_employer_activity_meta['disputed_by'] ?? '';
							$moderator_employer_activity_meta_desc = $moderator_employer_activity_meta['description'] ?? '';
							if ( absint( $moderator_employer_activity_disputed ) === $profile_id && ! empty( $moderator_employer_activity_meta_desc ) ) {
								?>
								<div class="gn-activity-detail-wrapper gn-activity-detail-dispute">
									<div class="gn-activity-detail">
										<div class="gn-head">
											<h4 class="gn-title">
												<?php
												sprintf(
														// translators: %s is dispute status
													esc_html__( 'Dispute %s', 'gigneo' ),
													esc_html( ucfirst( $moderator_employer_activity_status ) )
												);
												?>
											</h4>
										</div>
										<div class="gn-body">
											<div class="gn-info">
												<pre class="gn-pre"><?php echo wp_kses( $moderator_employer_activity_meta_desc, gigneo_allowed_html_tags() ); ?></pre>
											</div>
										</div>
									</div>
								</div>
								<?php
							}
						}
						?>
						<div class="gn-activity-time"><span><?php echo esc_html( $activity_time ); ?></span></div>
					</div>
				<?php } ?>
			</div>
		<?php endif; ?>
	</div>
</div>
