Update dashboard.

This commit is contained in:
Hoang Huu
2019-09-25 08:44:27 +07:00
parent 0611233dee
commit 585df648b9
10 changed files with 166 additions and 161 deletions

View File

@@ -18,8 +18,16 @@ if ( ! class_exists( 'OpalEstate_User' ) ) {
}
get_header( 'no-sidebar' );
$user_id = get_current_user_id();
$current_user = wp_get_current_user();
$user_info = "<span class='display-name'>{$current_user->display_name}</span>";
if ( $current_user->display_name !== $current_user->user_login ) {
$user_info .= "<span class='username'>{$current_user->user_login}</span>";
}
?>
<?php if ( get_current_user_id() ): ?>
<?php if ( $user_id ): ?>
<div class="dashboard-navbar">
<div class="clearfix">
<div class="pull-left navbar-left">
@@ -52,12 +60,13 @@ get_header( 'no-sidebar' );
<ul class="list-inline">
<li>
<div class="opalestate-user-greeting opalestate-popup hover-align-right">
<div class="popup-head"><a href="#"><?php $user_id = get_current_user_id(); ?>
<span class="howdy"><?php printf( __( 'Howdy, %s', 'opalestate-pro' ), '<span class="display-name">' . $current_user->display_name . '</span>' ); ?></span>
<div class="popup-head">
<a href="#">
<div class="opalestate-user-image">
<img src="<?php echo esc_url( OpalEstate_User::get_author_picture( $user_id ) ); ?>" alt="<?php esc_attr_e( 'Avatar image', 'opalestate-pro' ); ?>"/>
</div>
<span class="notify active"></span>
</a>
</div>
<div class="popup-body">

View File

@@ -1,79 +1,78 @@
<?php
<?php
$agency = OpalEstate_Agency::get_instance( $post_id );
$users = $agency->get_members();
$users = $agency->get_members();
$sender_id = '';
$prefix = '';
$prefix = '';
$fields = array(
array(
'id' => "sender_id",
'name' => esc_html__( 'Sender ID', 'opalestate-pro' ),
'type' => 'hidden',
'default' => "",
'description' => "",
),
array(
'id' => "{$prefix}user_id",
'name' => esc_html__( 'Name', 'opalestate-pro' ),
'type' => 'select',
'class' => 'form-control opalesate-find-user',
'default' => "",
'required' => 'required',
'description' => "",
),
);
$fields = [
[
'id' => 'sender_id',
'name' => esc_html__( 'Sender ID', 'opalestate-pro' ),
'type' => 'hidden',
],
[
'id' => "{$prefix}user_id",
'name' => esc_html__( 'Name', 'opalestate-pro' ),
'type' => 'select',
'class' => 'form-control opalesate-find-user',
'required' => 'required',
],
];
$form = OpalEstate()->html->render_form( $fields );
$id = 'agency-add-member';
$id = 'agency-add-member';
?>
<div class="opalestate-agency-team">
<h3><?php esc_html_e( 'Agency Team' , 'opalestate-pro' ); ?></h3>
<div class="opal-row">
<div class="col-lg-4 col-md-3">
<div class="agency-add-team">
<p><?php esc_html_e( "As an author, you can add other users to your agency.", "opalestate" ); ?></p>
<p><?php esc_html_e( "Add someone to your agency, please enter extractly username in below input:", "opalestate" ); ?></p>
<form method="post" id="opalestate-add-team-form">
<?php echo $form;?>
<?php wp_nonce_field( $id, 'add_team_action' ); ?>
<button class="button btn btn-primary btn-3d" data-loading-text="<i class='fa fa-circle-o-notch fa-spin'></i> <?php esc_html_e( 'Processing', 'opalestate-pro' ); ?>" type="submit" name="contact-form"><?php echo esc_html__( 'Send message', 'opalestate-pro' ); ?></button>
<h3><a href="<?php echo esc_url( get_the_permalink( $post_id ) ); ?>" title="<?php echo esc_attr( get_the_title( $post_id ) ); ?>" target="_blank"><?php esc_html_e( 'Agency Team', 'opalestate-pro' );
?></a></h3>
<div class="opal-row">
<div class="col-lg-4 col-md-3">
<div class="agency-add-team">
<p><?php esc_html_e( 'As an author, you can add other users to your agency.', 'opalestate-pro' ); ?></p>
<p><?php esc_html_e( 'Add someone to your agency, please enter extractly username in below input:', 'opalestate-pro' ); ?></p>
<form method="post" id="opalestate-add-team-form">
<?php echo $form; ?>
<?php wp_nonce_field( $id, 'add_team_action' ); ?>
<button class="button btn btn-primary btn-3d" data-loading-text="<i class='fa fa-circle-o-notch fa-spin'></i> <?php esc_html_e( 'Processing', 'opalestate-pro' ); ?>" type="submit"
name="contact-form"><?php esc_html_e( 'Add', 'opalestate-pro' ); ?></button>
</form>
</div>
</div>
</div>
</div>
<div class="col-lg-8 col-md-9">
<div class="agency-listing-team">
<table>
<tr>
<th><?php esc_html_e('Users in your team'); ?></th>
<th width="100"><?php esc_html_e('Action'); ?></th>
</tr>
<?php foreach( $users as $user ): // echo '<pre>' . print_r( $user, 1);die; ?>
<tr>
<td>
<div class="media">
<img src="<?php echo $user['avatar_url'];?>" width="80">
<div class="fullname"><?php echo $user['name']; ?> (<?php echo $user['username']; ?> )</div>
</div>
</td>
<td>
<a href="<?php echo opalestate_get_user_management_page_uri( array('tab' => 'agency_team', 'remove_id' => $user['id'] ) ); ?>" title="<?php esc_html_e( "Remove" , "opalestate" ); ?>">
<i class="fa fa-trash"></i>
</a>
</td>
</tr>
<div class="col-lg-8 col-md-9">
<div class="agency-listing-team">
<table>
<tr>
<th><?php esc_html_e( 'Users in your team', 'opalestate-pro' ); ?></th>
<th width="100"><?php esc_html_e( 'Action', 'opalestate-pro' ); ?></th>
</tr>
<?php foreach ( $users as $user ) : ?>
<?php
$agent_id = get_user_meta( $user['id'], OPALESTATE_USER_PROFILE_PREFIX . 'related_id', true );
$url = $agent_id ? get_the_permalink( $agent_id ) : '#';
?>
<tr>
<td>
<div class="media">
<a href="<?php echo esc_url( $url ); ?>" title="<?php echo esc_attr( $user['name'] ); ?>" target="_blank">
<img src="<?php echo esc_url( $user['avatar_url'] ); ?>" width="80">
<div class="fullname"><?php echo esc_html( $user['name'] ); ?> (<?php echo esc_html( $user['username'] ); ?> )</div>
</a>
</div>
</td>
<td>
<a href="<?php echo opalestate_get_user_management_page_uri( [ 'tab' => 'agency_team', 'remove_id' => $user['id'] ] ); ?>"
title="<?php esc_html_e( 'Remove', 'opalestate-pro' ); ?>">
<i class="fa fa-trash"></i>
</a>
</td>
</tr>
<?php endforeach; ?>
</table>
</div>
</div>
</div>
</table>
</div>
</div>
</div>
</div>

View File

@@ -1,60 +1,69 @@
<?php
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
?>
<div class="property-submission-form">
<?php if ( ! empty( $_SESSION['messages'] ) ) : ?>
<div class="opalesate_messages">
<div class="opalesate_messages">
<?php foreach ( $_SESSION['messages'] as $message ) : ?>
<?php $status = isset( $message[0] ) ? $message[0] : 'success'; ?>
<?php $msg = isset( $message[1] ) ? $message[1] : ''; ?>
<div class="opalesate_message_line <?php echo esc_attr( $status ) ?>">
<div class="opalesate_message_line <?php echo esc_attr( $status ) ?>">
<?php printf( '%s', $msg ) ?>
</div>
</div>
<?php endforeach; unset( $_SESSION['messages'] ); ?>
</div>
<?php endforeach;
unset( $_SESSION['messages'] ); ?>
</div>
<?php endif; ?>
<div class="opalestate-admin-box">
<div class="box-content">
<h3><?php esc_html_e( 'Edit User Profile', 'opalestate-pro' ); ?></h3>
<div class="opalestate-admin-box">
<div class="box-content">
<?php
$current_user = wp_get_current_user();
$user_info = '';
if ( $current_user->display_name !== $current_user->user_login ) {
$user_info = "<span class='username'>({$current_user->user_login})</span>";
}
?>
<h3><?php esc_html_e( 'Edit User Profile', 'opalestate-pro' ); ?>&nbsp;<?php echo wp_kses_post( $user_info ); ?></h3>
<?php
do_action( 'opalestate_profile_form_before' );
do_action( 'opalestate_profile_form_before' );
if ( function_exists( 'cmb2_get_metabox_form' ) ) {
echo cmb2_get_metabox_form( $metaboxes[ OPALESTATE_USER_PROFILE_PREFIX . 'front' ], $user_id, array(
'form_format' => '<form action="//' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'] . '" class="cmb-form" method="post" id="%1$s" enctype="multipart/form-data" encoding="multipart/form-data"><input type="hidden" name="object_id" value="%2$s">%3$s<input type="submit" name="submit-cmb" value="%4$s" class="button-primary btn btn-primary"></form>',
'save_button' => esc_html__( 'Save Change', 'opalestate-pro' ),
) );
}
if ( function_exists( 'cmb2_get_metabox_form' ) ) {
echo cmb2_get_metabox_form( $metaboxes[ OPALESTATE_USER_PROFILE_PREFIX . 'front' ], $user_id, [
'form_format' => '<form action="//' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'] . '" class="cmb-form" method="post" id="%1$s" enctype="multipart/form-data" encoding="multipart/form-data"><input type="hidden" name="object_id" value="%2$s">%3$s<input type="submit" name="submit-cmb" value="%4$s" class="button-primary btn btn-primary"></form>',
'save_button' => esc_html__( 'Save Change', 'opalestate-pro' ),
] );
}
do_action( 'opalestate_profile_form_after' );
do_action( 'opalestate_profile_form_after' );
?>
</div>
</div>
</div>
</div>
<div class="opalestate-admin-box">
<div class="box-content">
<h3><?php esc_html_e( 'Change Password', 'opalestate-pro' ); ?></h3>
<div class="opalestate-admin-box">
<div class="box-content">
<h3><?php esc_html_e( 'Change Password', 'opalestate-pro' ); ?></h3>
<?php
do_action( 'opalestate_profile_form_before' );
do_action( 'opalestate_profile_form_before' );
if ( function_exists( 'cmb2_get_metabox_form' ) ) {
echo cmb2_get_metabox_form( $metaboxes[ OPALESTATE_USER_PROFILE_PREFIX . 'frontchangepass' ], $user_id, [
'form_format' => '<form action="//' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'] . '" class="cmb-form" method="post" id="%1$s" enctype="multipart/form-data" encoding="multipart/form-data"><input type="hidden" name="object_id" value="%2$s">%3$s<input type="submit" name="submit-cmb" value="%4$s" class="button-primary btn btn-primary"></form>',
'save_button' => esc_html__( 'Save Change', 'opalestate-pro' ),
] );
}
if ( function_exists( 'cmb2_get_metabox_form' ) ) {
echo cmb2_get_metabox_form( $metaboxes[ OPALESTATE_USER_PROFILE_PREFIX . 'frontchangepass' ], $user_id, [
'form_format' => '<form action="//' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'] . '" class="cmb-form" method="post" id="%1$s" enctype="multipart/form-data" encoding="multipart/form-data"><input type="hidden" name="object_id" value="%2$s">%3$s<input type="submit" name="submit-cmb" value="%4$s" class="button-primary btn btn-primary"></form>',
'save_button' => esc_html__( 'Save Change', 'opalestate-pro' ),
] );
}
do_action( 'opalestate_profile_form_after' );
do_action( 'opalestate_profile_form_after' );
?>
</div>
</div>
</div>
</div>
</div>