diff --git a/.planning/phases/04-job-deactivation-system/04-01-PLAN.md b/.planning/phases/04-job-deactivation-system/04-01-PLAN.md new file mode 100644 index 0000000..b379275 --- /dev/null +++ b/.planning/phases/04-job-deactivation-system/04-01-PLAN.md @@ -0,0 +1,115 @@ +--- +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). + diff --git a/.planning/phases/04-job-deactivation-system/04-02-PLAN.md b/.planning/phases/04-job-deactivation-system/04-02-PLAN.md new file mode 100644 index 0000000..aec0e64 --- /dev/null +++ b/.planning/phases/04-job-deactivation-system/04-02-PLAN.md @@ -0,0 +1,103 @@ +--- +phase: 04-job-deactivation-system +plan: 02 +type: execute +depends_on: ["04-01"] +files_modified: [includes/class-notifications.php] +--- + + +Notify admin when provider deactivates a job, including the deactivation reason for business intelligence and quality monitoring. + +Purpose: Give admins visibility into deactivation patterns - whether jobs are being filled successfully, withdrawn due to problems, or removed for other reasons. This intelligence helps assess platform effectiveness. +Output: Email notification sent to admin on job deactivation with reason included. + + + +~/.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-03-SUMMARY.md +@.planning/phases/04-job-deactivation-system/04-01-SUMMARY.md + +# Source files: +@includes/class-notifications.php + +**Tech stack available:** wp_mail, transition_post_status hook, ACF field access +**Established patterns:** +- transition_post_status hook with status guards (new_status, old_status checks) +- German email templates with job details and context +- Error logging for wp_mail failures + +**Constraining decisions:** +- Phase 03-03: transition_post_status used to detect status changes, prevents spam on updates +- Phase 03-03: Email sent to admin_email option, includes direct edit link +- Phase 04-01: Deactivation reason stored in ACF field 'job_deactivation_reason' +- Phase 04-01: Deactivation changes post status from publish to draft + + + + + + Task 1: Add deactivation notification method to notifications class + includes/class-notifications.php + Add send_admin_job_deactivation_notification() method following same pattern as send_admin_new_job_notification(). Hook to transition_post_status with guards: post_type === 'job_offer' AND new_status === 'draft' AND old_status === 'publish' (detects only deactivations, not initial drafts). Extract deactivation reason from ACF field: get_field('job_deactivation_reason', $post_id). Email subject: "Stellenangebot deaktiviert: {job_title}". Email body (German): "Ein Stellenangebot wurde vom Anbieter deaktiviert.\n\nTitel: {job_title}\nAnbieter: {author_name} ({author_organization})\nStandort: {job_location}\nArt: {job_type}\nDeaktiviert am: {deactivation_date}\n\nGrund für Deaktivierung:\n{deactivation_reason}\n\nStelle ansehen:\n{edit_link}\n\n---\nDiese E-Mail wurde automatisch gesendet." Send to admin_email. Include error_log for missing admin_email or wp_mail failure. Register hook in setup_hooks() method following existing pattern. + Check includes/class-notifications.php contains send_admin_job_deactivation_notification() method. Verify hook registered in setup_hooks(). Confirm email includes deactivation reason field. + Notification method exists, hook registered, email template includes all job context plus deactivation reason, error logging present + + + + + +Before declaring plan complete: +- [ ] Deactivation notification method exists in notifications class +- [ ] Hook registered for transition_post_status with correct guards +- [ ] Email includes deactivation reason from ACF field +- [ ] Email sent only when status changes from publish to draft +- [ ] Error logging handles missing data or wp_mail failures + + + + +- Admin receives email when provider deactivates published job +- Email includes job details (title, provider, location, type, date) +- Email includes deactivation reason captured from form +- Email sent only on publish→draft transitions (not draft→draft) +- Phase 4 complete - deactivation workflow functional end-to-end + + + +After completion, create `.planning/phases/04-job-deactivation-system/04-02-SUMMARY.md`: + +# Phase 4 Plan 2: Deactivation Notifications Summary + +**[Substantive one-liner - what shipped, not "phase complete"]** + +## Accomplishments + +- [Key outcome 1] +- [Key outcome 2] + +## Files Created/Modified + +- `includes/class-notifications.php` - Description + +## Decisions Made + +[Key decisions and rationale, or "None"] + +## Issues Encountered + +[Problems and resolutions, or "None"] + +## Next Step + +Phase 4 complete. Ready for Phase 5: Mentor Job Board. +