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

@ -1147,3 +1147,18 @@ function opalestate_get_measurement_units() {
'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' ),
] );
}

@ -6,21 +6,13 @@ if ( ! defined( 'ABSPATH' ) ) {
$property = opalesetate_property( get_the_ID() );
global $property, $post;
$meta = $property->get_meta_shortinfo();
$status = get_post_status( get_the_ID() );
$statuses = opalestate_get_property_statuses();
$meta = $property->get_meta_shortinfo();
?>
<article itemscope itemtype="http://schema.org/Property" <?php post_class( 'my-property-list' ); ?>>
<div class="property-list container-cols-2">
<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' ) ); ?>
<div class="property-meta-bottom">
<?php echo do_shortcode( '[opalestate_favorite_button property_id=' . get_the_ID() . ']' ); ?>
@ -49,7 +41,10 @@ $meta = $property->get_meta_shortinfo();
</div>
<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 class="property-meta">
<ul class="property-meta-list list-inline">
@ -91,7 +86,6 @@ $meta = $property->get_meta_shortinfo();
<?php
}
} ?>
</div>
</div>

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