--- phase: 04-job-deactivation-system plan: 01 type: execute depends_on: [] files_modified: [includes/class-formidable.php, templates/provider-dashboard.php] --- Create deactivation form allowing providers to deactivate published jobs with required reason field, updating post status to draft. Purpose: Give providers control to remove jobs from public view when positions are filled or no longer available, while capturing business intelligence about why jobs are being deactivated. Output: Formidable deactivation form integrated into provider dashboard with reason capture. ~/.claude/get-shit-done/workflows/execute-plan.md ./summary.md @.planning/PROJECT.md @.planning/ROADMAP.md @.planning/STATE.md # Prior work this plan builds on: @.planning/phases/03-job-management-core/03-01-SUMMARY.md @.planning/phases/03-job-management-core/03-02-SUMMARY.md # Source files: @includes/class-formidable.php @templates/provider-dashboard.php **Tech stack available:** formidable-post-creation-action, formidable-update-post, acf-field-mapping **Established patterns:** - Formidable form creation with duplicate prevention via form key - Post status updates via Formidable Update Post action - Ownership validation in frm_validate_entry hook - Conditional dashboard rendering based on URL parameters **Constraining decisions:** - Phase 03-01: Form fields map directly to ACF meta fields using Formidable's actions - Phase 03-02: Dashboard shows form OR listings based on URL parameters (action=X&job_id=Y) - Phase 03-02: Ownership validation prevents URL parameter tampering Task 1: Create job deactivation form with reason field includes/class-formidable.php Add create_job_deactivation_form() method following established pattern from create_job_edit_form(). Check for existing form by key 'job_deactivation' to prevent duplicates. Include 2 fields: (1) deactivation_reason textarea (required, German label "Grund für Deaktivierung", description "Bitte geben Sie an, warum Sie dieses Stellenangebot deaktivieren möchten"), (2) hidden field for job_id. Configure Update Post action: post_type='job_offer', post_status='draft' (removes from public view), id_param from URL parameter 'job_id'. Map deactivation_reason field to ACF meta field 'job_deactivation_reason'. Add ownership validation hook validate_job_deactivation_ownership() following same pattern as validate_job_ownership() from Phase 03-02 - check post exists, post_type is job_offer, post_author matches current user. Submit button: "Stellenangebot deaktivieren". Success message: "Ihr Stellenangebot wurde deaktiviert." Success action: Redirect to /anbieter-dashboard/. Add get_job_deactivation_form_id() helper following established pattern. Check class-formidable.php contains create_job_deactivation_form(), validate_job_deactivation_ownership(), and get_job_deactivation_form_id() methods. Confirm form configured with draft status update and reason field mapping. Deactivation form created programmatically, ownership validation hook registered, form ID getter exists, Update Post action configured for draft status Task 2: Add deactivate action to provider dashboard templates/provider-dashboard.php Add deactivate mode detection alongside existing edit mode: check for action=deactivate_job and job_id parameter. When in deactivate mode, render deactivation form section similar to edit section structure - heading "Stellenangebot deaktivieren", back link to dashboard, form shortcode with id_param={job_id}. In job listings table, add "Deaktivieren" button in Actions column only for published jobs (status === 'publish') - deactivate URL: add_query_arg with action=deactivate_job and job_id. Style deactivate button differently from edit/view buttons (use warning/destructive color like red/orange background). Follow same conditional rendering pattern as edit mode - show deactivation form OR listings, not both. Dashboard template includes deactivate mode detection, deactivation form section, and deactivate button for published jobs. Verify deactivate button appears only when post_status === 'publish'. Dashboard supports deactivation mode via URL parameters, deactivate button visible only on published jobs, form renders in place of listings when in deactivate mode Before declaring plan complete: - [ ] Deactivation form exists with key 'job_deactivation' - [ ] Form has deactivation_reason textarea field (required) - [ ] Update Post action configured to set status='draft' - [ ] Ownership validation prevents unauthorized deactivations - [ ] Dashboard shows "Deaktivieren" button only for published jobs - [ ] Deactivate mode renders form instead of listings - Deactivation form created programmatically in class-formidable.php - Form includes required reason field with German labels - Ownership validation hook prevents URL tampering - Dashboard integrates deactivation workflow with conditional rendering - Published jobs show deactivate button in actions column - Form submission updates job to draft status After completion, create `.planning/phases/04-job-deactivation-system/04-01-SUMMARY.md`: # Phase 4 Plan 1: Job Deactivation Form Summary **[Substantive one-liner - what shipped, not "phase complete"]** ## Accomplishments - [Key outcome 1] - [Key outcome 2] ## Files Created/Modified - `includes/class-formidable.php` - Description - `templates/provider-dashboard.php` - Description ## Decisions Made [Key decisions and rationale, or "None"] ## Issues Encountered [Problems and resolutions, or "None"] ## Next Step Ready for 04-02-PLAN.md (admin notification on deactivation with reason).