refining personnal widget
This commit is contained in:
parent
95fe6bb1e6
commit
cea0d1d010
|
|
@ -16,9 +16,70 @@ function custom_dashboard_widget_display()
|
|||
{
|
||||
$current_user = wp_get_current_user();
|
||||
$user_name = $current_user->user_login;
|
||||
|
||||
|
||||
|
||||
$args = array(
|
||||
'post_type' => 'artisans',
|
||||
'meta_key' => 'conseiller',
|
||||
'meta_value' => $current_user->ID,
|
||||
'posts_per_page' => -1
|
||||
);
|
||||
|
||||
$user_attached_artisans = new WP_Query($args);
|
||||
|
||||
|
||||
|
||||
$required_actions_artisans = new WP_Query(
|
||||
array(
|
||||
'post_type' => 'artisans',
|
||||
'meta_key' => 'conseiller',
|
||||
'meta_value' => $current_user->ID,
|
||||
'meta_query' => array(
|
||||
array(
|
||||
'key' => 'required_action',
|
||||
'value' => true,
|
||||
'compare' => '='
|
||||
)
|
||||
),
|
||||
'posts_per_page' => -1
|
||||
)
|
||||
);
|
||||
|
||||
?>
|
||||
<h3>Bonjour <?php echo $user_name ?> !</h3>
|
||||
<p>Ceci est un widget personnalisé. Vous pouvez afficher ici des infos utiles, des liens ou tout autre contenu.</p>
|
||||
<div class="total-attached">
|
||||
<p> Artisans associés : <?php echo count($user_attached_artisans->posts) ?></p>
|
||||
</div>
|
||||
<div class="required-actions">
|
||||
<?php
|
||||
$total = count($required_actions_artisans->posts);
|
||||
?>
|
||||
<?php if ($total == 0) : ?>
|
||||
<p>Aucun artisan en attente d'action</p>
|
||||
"count"><?php echo $total ?></span> action requise </h4>
|
||||
<?php else : ?>
|
||||
<h4>Actions requises<span class="count">(<?php echo $total ?>)</span></h4>
|
||||
<?php endif; ?>
|
||||
|
||||
<ul>
|
||||
<?php foreach ($required_actions_artisans->posts as $index => $artisan) : ?>
|
||||
<?php if ($index >= 4) break; ?>
|
||||
|
||||
<?php $mdp_status = get_field('mdp_status', $artisan->ID);
|
||||
write_log($mdp_status);
|
||||
?>
|
||||
<li>
|
||||
<a href="<?php echo get_edit_post_link($artisan->ID) ?>">
|
||||
<?php echo $artisan->post_title ?>
|
||||
</a>
|
||||
<span class="status-state status-state--<?php echo $mdp_status['value'] ?>"><?php echo $mdp_status['label'] ?></span>
|
||||
</li>
|
||||
<?php endforeach; ?>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<a class="cta cta--button" href="<?php echo home_url('/wp-admin/admin.php?page=mdp-dashboard') ?>">Pannel de gestion</a>
|
||||
<?php
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,55 @@
|
|||
#advisor-dashboard-widget {
|
||||
inside {
|
||||
@apply !p-6;
|
||||
}
|
||||
h3 {
|
||||
@apply text-3xl text-patrimoine-sante-securite;
|
||||
@apply text-3xl text-patrimoine-sante-securite my-0;
|
||||
}
|
||||
h4 {
|
||||
@apply text-lg text-patrimoine-sante-securite font-normal;
|
||||
}
|
||||
.count {
|
||||
@apply font-medium;
|
||||
}
|
||||
.required-actions h4 {
|
||||
@apply text-white bg-patrimoine-sante-securite p-2 rounded-t-md;
|
||||
.count {
|
||||
@apply inline-block ml-2;
|
||||
text-decoration: none !important;
|
||||
}
|
||||
}
|
||||
/* .required-actions h4:after {
|
||||
@apply content-[':'] text-patrimoine-sante-securite;
|
||||
} */
|
||||
ul {
|
||||
@apply text-lg;
|
||||
}
|
||||
li {
|
||||
@apply flex justify-between;
|
||||
}
|
||||
.status-state {
|
||||
@apply mx-0;
|
||||
}
|
||||
a {
|
||||
@apply text-patrimoine-sante-securite !underline;
|
||||
}
|
||||
|
||||
.total-attached {
|
||||
@apply pb-4;
|
||||
p {
|
||||
@apply pt-2 mt-0;
|
||||
}
|
||||
}
|
||||
|
||||
.cta--button {
|
||||
@apply bg-patrimoine-sante-securite text-white px-4 py-2 rounded-md mt-16 block w-fit;
|
||||
text-decoration: none !important;
|
||||
}
|
||||
|
||||
.status-state {
|
||||
@apply px-3 py-2 flex items-center justify-center gap-2;
|
||||
&:before {
|
||||
@apply content-[''] block w-2 h-2 rounded-full;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user