Update dashbard properties.

This commit is contained in:
Hoang Huu 2019-09-25 17:07:35 +07:00
parent 82fa1a6d3d
commit 76feccd3d1
3 changed files with 66 additions and 60 deletions

View File

@ -1147,3 +1147,18 @@ function opalestate_get_measurement_units() {
'm2' => esc_html__( 'm2', 'opalestate-pro' ), 'm2' => esc_html__( 'm2', 'opalestate-pro' ),
] ); ] );
} }
/**
* Returns property statuses.
*
* @return array
*/
function opalestate_get_property_statuses() {
return apply_filters( 'opalestate_get_property_statuses', [
'all' => esc_html__( 'All', 'opalestate-pro' ),
'publish' => esc_html__( 'Published', 'opalestate-pro' ),
'published' => esc_html__( 'Published', 'opalestate-pro' ),
'pending' => esc_html__( 'Pending', 'opalestate-pro' ),
'expired' => esc_html__( 'Expired', 'opalestate-pro' ),
] );
}

View File

@ -6,21 +6,13 @@ if ( ! defined( 'ABSPATH' ) ) {
$property = opalesetate_property( get_the_ID() ); $property = opalesetate_property( get_the_ID() );
global $property, $post; global $property, $post;
$status = get_post_status( get_the_ID() );
$meta = $property->get_meta_shortinfo(); $statuses = opalestate_get_property_statuses();
$meta = $property->get_meta_shortinfo();
?> ?>
<article itemscope itemtype="http://schema.org/Property" <?php post_class( 'my-property-list' ); ?>> <article itemscope itemtype="http://schema.org/Property" <?php post_class( 'my-property-list' ); ?>>
<div class="property-list container-cols-2"> <div class="property-list container-cols-2">
<header> <header>
<div class="property-group-label">
<?php do_action( 'opalestate_before_property_loop_item' ); ?>
<?php if ( $property->featured != 1 ): ?>
<div class="property-toggle-featured hide" data-id="property-toggle-featured-<?php echo get_the_ID(); ?>">
<span class="label-featured label"><?php esc_html_e( 'Featured', 'opalestate-pro' ); ?></span>
</div>
<?php endif; ?>
</div>
<?php opalestate_get_loop_thumbnail( opalestate_get_option( 'loop_image_size', 'large' ) ); ?> <?php opalestate_get_loop_thumbnail( opalestate_get_option( 'loop_image_size', 'large' ) ); ?>
<div class="property-meta-bottom"> <div class="property-meta-bottom">
<?php echo do_shortcode( '[opalestate_favorite_button property_id=' . get_the_ID() . ']' ); ?> <?php echo do_shortcode( '[opalestate_favorite_button property_id=' . get_the_ID() . ']' ); ?>
@ -49,7 +41,10 @@ $meta = $property->get_meta_shortinfo();
</div> </div>
<div class="my-properties-bottom"> <div class="my-properties-bottom">
<span class="label-post-status label <?php if ( $post->post_status == 'pending' ): ?> label-danger <?php else : ?> label-info <?php endif; ?>"> <?php echo get_post_status( get_the_ID() ) ?> </span> <span class="label-post-status label <?php if ( $post->post_status == 'pending' ): ?> label-danger <?php else : ?> label-info <?php endif; ?>"> <?php echo esc_html( isset(
$statuses[ $status ] ) ? $statuses[ $status ] : $status );
?>
</span>
</div> </div>
<div class="property-meta"> <div class="property-meta">
<ul class="property-meta-list list-inline"> <ul class="property-meta-list list-inline">
@ -91,7 +86,6 @@ $meta = $property->get_meta_shortinfo();
<?php <?php
} }
} ?> } ?>
</div> </div>
</div> </div>

View File

@ -1,54 +1,51 @@
<?php <?php
$statuses = array( $statuses = [
'all' => esc_html__( 'All' ,'opalestate-pro' ), 'all' => esc_html__( 'All', 'opalestate-pro' ),
'published' => esc_html__( 'Published' ,'opalestate-pro' ), 'published' => esc_html__( 'Published', 'opalestate-pro' ),
'pending' => esc_html__( 'Pending' ,'opalestate-pro' ), 'pending' => esc_html__( 'Pending', 'opalestate-pro' ),
'expired' => esc_html__( 'Expired' ,'opalestate-pro' ), 'expired' => esc_html__( 'Expired', 'opalestate-pro' ),
); ];
$gstatus = isset( $_GET['status'] )? $_GET['status']:'all'; $gstatus = isset( $_GET['status'] ) ? $_GET['status'] : 'all';
?> ?>
<?php do_action( "opalestate_submission_listing_before" ); ?> <?php do_action( "opalestate_submission_listing_before" ); ?>
<div class="property-listing my-properties"> <div class="property-listing my-properties">
<div class="list-tabs"> <div class="list-tabs">
<div class="tabs"> <div class="tabs">
<ul class="clearfix"> <ul class="clearfix">
<?php foreach( $statuses as $status => $label ): ?> <?php foreach ( $statuses as $status => $label ): ?>
<li <?php if( $status==$gstatus ):?> class="active" <?php endif; ?>> <li <?php if ( $status == $gstatus ): ?> class="active" <?php endif; ?>>
<a href="<?php echo esc_url( opalestate_get_current_url( array( 'status' => $status) ) ); ?>" ><?php echo esc_attr($label); ?></a> <a href="<?php echo esc_url( opalestate_get_current_url( [ 'status' => $status ] ) ); ?>"><?php echo esc_attr( $label ); ?></a>
</li> </li>
<?php endforeach; ?> <?php endforeach; ?>
</ul> </ul>
</div>
</div> </div>
</div>
<div class="opalestate-admin-box"> <div class="opalestate-admin-box">
<div class="box-content">
<div class="box-content"> <?php if ( $loop->have_posts() ): ?>
<div class="opalestate-rows">
<?php if( $loop->have_posts() ): ?> <div class="<?php echo apply_filters( 'opalestate_row_container_class', 'opal-row' ); ?>">
<div class="opalestate-rows"> <?php $cnt = 0;
<div class="<?php echo apply_filters('opalestate_row_container_class', 'opal-row');?>"> while ( $loop->have_posts() ) : $loop->the_post();
<?php $cnt=0; while ( $loop->have_posts() ) : $loop->the_post(); global $post; ?> global $post; ?>
<div class="col-lg-12 col-md-12 col-sm-12">
<?php echo opalestate_load_template_path( 'user/content-property' ); ?>
<div class="col-lg-12 col-md-12 col-sm-12"> </div>
<?php echo opalestate_load_template_path( 'user/content-property' ); ?> <?php endwhile; ?>
</div> </div>
</div>
<?php endwhile; ?> <?php opalestate_pagination( $loop->max_num_pages ); ?>
</div>
</div>
<?php opalestate_pagination( $loop->max_num_pages ); ?>
<?php else : ?> <?php else : ?>
<div class="opalestate-message"> <div class="opalestate-message">
<?php esc_html_e( 'You have not submited any property.', 'opalestate-pro' ) ;?> <?php esc_html_e( 'You have not submited any property.', 'opalestate-pro' ); ?>
</div> </div>
<?php endif; ?> <?php endif; ?>
</div> </div>
</div> </div>
</div> </div>
<?php wp_reset_postdata(); ?> <?php wp_reset_postdata(); ?>
<?php do_action( "opalestate_submission_listing_after" ); ?> <?php do_action( 'opalestate_submission_listing_after' ); ?>