diff --git a/includes/gestion.php b/includes/gestion.php new file mode 100644 index 0000000..dc43ac8 --- /dev/null +++ b/includes/gestion.php @@ -0,0 +1,25 @@ + '; + $icon = 'data:image/svg+xml;base64,' . base64_encode($svg); + + add_menu_page( + 'Gestion', // Titre de la page + 'Gestion', // Titre dans le menu + 'edit_pages', + 'gestion-artisans', // Slug du menu + 'afficher_page_gestion_artisans', // Fonction de callback + $icon, // Icône + 2 // Position + ); +} + +function afficher_page_gestion_artisans() +{ + // Charge le template part pour la page d'options + get_template_part('template-parts/admin/page', 'options'); +} diff --git a/template-parts/admin/artisans-section-group.php b/template-parts/admin/artisans-section-group.php new file mode 100644 index 0000000..95f5d53 --- /dev/null +++ b/template-parts/admin/artisans-section-group.php @@ -0,0 +1,75 @@ + 'artisans', + 'posts_per_page' => -1, + 'meta_query' => array( + array( + 'key' => 'mdp_status', + 'value' => $status, + 'compare' => '=' + ) + ) +); +$queryArgsActionRequired = array( + 'post_type' => 'artisans', + 'posts_per_page' => -1, + 'meta_query' => array( + array( + 'key' => 'required_action', + 'value' => true, + 'compare' => '=' + ) + ) +); + +$currentQueryArgs = $status ? $queryArgsWithStatus : $queryArgsActionRequired; + +if ($use_current_user && $current_user_id) { + $currentQueryArgs['meta_value'] = $current_user_id; + $currentQueryArgs['meta_key'] = 'conseiller'; +} + + + +$artisans = new WP_Query($currentQueryArgs); + +?> + +
+

(found_posts ?>)

+ +
\ No newline at end of file diff --git a/template-parts/admin/page-options.php b/template-parts/admin/page-options.php new file mode 100644 index 0000000..c4a657a --- /dev/null +++ b/template-parts/admin/page-options.php @@ -0,0 +1,78 @@ +display_name; +?> + +
+

Gestion

+
+ + + + + +
+

Artisans de

+ + 'action-required', + 'status_class' => 'action-required ', + 'title' => 'Action requise', + 'use_current_user' => true, + 'current_user_id' => $current_user->ID, + 'not_found_message' => 'Aucun artisan avec une action requise', + )); + + //===== SECTION : À ACTUALISER =====// + get_template_part('template-parts/admin/artisans-section-group', null, array( + 'status' => 'to_actualize', + 'status_class' => 'to-actualize', + 'title' => 'À actualiser', + 'use_current_user' => true, + 'current_user_id' => $current_user->ID, + 'not_found_message' => 'Aucun artisan à actualiser', + )); + + //===== SECTION : À CONTACTER =====// + get_template_part('template-parts/admin/artisans-section-group', null, array( + 'status' => 'to_contact', + 'status_class' => 'to-contact', + 'title' => 'À contacter', + 'use_current_user' => true, + 'current_user_id' => $current_user->ID, + 'not_found_message' => 'Aucun artisan à contacter', + )); + + //===== SECTION : EN ATTENTE DE RETOUR =====// + get_template_part('template-parts/admin/artisans-section-group', null, array( + 'status' => 'waiting_feedback', + 'status_class' => 'waiting-feedback', + 'title' => 'En attente de retour', + 'use_current_user' => true, + 'current_user_id' => $current_user->ID, + 'not_found_message' => 'Aucun artisan en attente de retour', + )); + + //===== SECTION : EN COURS =====// + get_template_part('template-parts/admin/artisans-section-group', null, array( + 'status' => 'ongoing', + 'status_class' => 'ongoing', + 'title' => 'En cours', + 'use_current_user' => true, + 'current_user_id' => $current_user->ID, + 'not_found_message' => 'Aucun artisan en cours', + )); + + //===== SECTION : OK =====// + get_template_part('template-parts/admin/artisans-section-group', null, array( + 'status' => 'ok', + 'status_class' => 'ok', + 'title' => 'OK', + 'use_current_user' => true, + 'current_user_id' => $current_user->ID, + 'not_found_message' => 'Aucun artisan OK', + )); + ?> +
\ No newline at end of file