From fbbd44a07b0bc8c2450eedb1a92e84bc37960a34 Mon Sep 17 00:00:00 2001 From: Viktor Miller Date: Wed, 14 Jan 2026 20:03:09 +0900 Subject: [PATCH] feat(04-01): add deactivate action to provider dashboard Add deactivate mode detection alongside existing edit mode checking for action=deactivate_job and job_id parameter. When in deactivate mode, render deactivation form section similar to edit section structure with heading "Stellenangebot deaktivieren", back link to dashboard, and form shortcode with id_param={job_id}. In job listings table, add "Deaktivieren" button in Actions column only for published jobs (status === 'publish'). Deactivate button uses warning/destructive color (red background) to differentiate from edit/view buttons. Follow same conditional rendering pattern as edit mode showing deactivation form OR listings, not both. Co-Authored-By: Claude Sonnet 4.5 --- templates/provider-dashboard.php | 48 ++++++++++++++++++++++++++++++-- 1 file changed, 46 insertions(+), 2 deletions(-) diff --git a/templates/provider-dashboard.php b/templates/provider-dashboard.php index 102bbd6..792b99f 100644 --- a/templates/provider-dashboard.php +++ b/templates/provider-dashboard.php @@ -29,6 +29,9 @@ if ( ! in_array( 'ddhh_provider', $current_user->roles, true ) ) { // Check if we're in edit mode $is_edit_mode = isset( $_GET['action'] ) && $_GET['action'] === 'edit_job' && isset( $_GET['job_id'] ); +// Check if we're in deactivate mode +$is_deactivate_mode = isset( $_GET['action'] ) && $_GET['action'] === 'deactivate_job' && isset( $_GET['job_id'] ); + if ( $is_edit_mode ) { $job_id = absint( $_GET['job_id'] ); $form_id = DDHH_JM_Formidable::get_job_edit_form_id(); @@ -47,6 +50,24 @@ if ( $is_edit_mode ) { } } +if ( $is_deactivate_mode ) { + $job_id = absint( $_GET['job_id'] ); + $form_id = DDHH_JM_Formidable::get_job_deactivation_form_id(); + + if ( $form_id ) { + ?> +
+
+

Stellenangebot deaktivieren

+

← Zurück zur Übersicht

+ +
+
+ 'job_offer', @@ -130,6 +151,18 @@ $job_query = new WP_Query( $args ); if ( 'publish' === $post_status ) { echo ' Ansehen'; } + + // Deactivate link - only for published posts + if ( 'publish' === $post_status ) { + $deactivate_url = add_query_arg( + array( + 'action' => 'deactivate_job', + 'job_id' => $post_id, + ), + get_permalink() + ); + echo ' Deaktivieren'; + } ?> @@ -167,14 +200,16 @@ $job_query = new WP_Query( $args ); color: #333; } -.ddhh-job-edit-section { +.ddhh-job-edit-section, +.ddhh-job-deactivate-section { padding: 2rem; background: #fff; border-radius: 8px; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1); } -.ddhh-job-edit-section h2 { +.ddhh-job-edit-section h2, +.ddhh-job-deactivate-section h2 { margin-top: 0; margin-bottom: 1rem; font-size: 1.5rem; @@ -291,6 +326,15 @@ $job_query = new WP_Query( $args ); background-color: #059669; } +.deactivate-link { + background-color: #ef4444; + margin-left: 0.5rem; +} + +.deactivate-link:hover { + background-color: #dc2626; +} + .ddhh-empty-state, .ddhh-error-message { padding: 3rem;