Home / Admin / ACF_KEYSMST_MSTCASECPT – TAB: Case Status & Tracking (v3.0 Modular)
Duplicate Snippet

Embed Snippet on Your Site

ACF_KEYSMST_MSTCASECPT – TAB: Case Status & Tracking (v3.0 Modular)

ismail daugherty PRO
<10
Code Preview
php
<?php
/**
 * ============================================
 * MST CASE - TAB: Case Status & Tracking (v3.0 Modular)
 * ============================================
 * 
 * Purpose: Workflow status, treatment phase, MSTI assignment
 * Fields: 25 fields
 * Parent: group_mst_case_master
 * Priority: 10 (must load AFTER master container)
 * 
 * Field Groups:
 * - Case Identification (MSTI#, assignments)
 * - Status & Phase Tracking
 * - Onboarding Progress
 * - Date Tracking
 * - Supervision Status
 * ============================================
 */
if (!defined('ABSPATH')) {
    exit; // Exit if accessed directly
}
add_action('acf/init', 'mst_add_tab_case_status_tracking', 10);
function mst_add_tab_case_status_tracking() {
    
    if (!function_exists('acf_add_local_field')) {
        return;
    }
    
    // ============================================
    // TAB HEADER
    // ============================================
    
    acf_add_local_field(array(
        'key' => 'field_tab_case_status_tracking',
        'label' => 'Case Status & Tracking',
        'name' => '',
        'type' => 'tab',
        'parent' => 'group_mst_case_master',
        'placement' => 'top',
        'endpoint' => 0,
    ));
    
    // ============================================
    // SECTION: Case Identification
    // ============================================
    
    acf_add_local_field(array(
        'key' => 'field_section_case_identification',
        'label' => 'Case Identification',
        'name' => '',
        'type' => 'message',
        'parent' => 'group_mst_case_master',
        'message' => 'Core case identification and assignment information',
        'new_lines' => 'wpautop',
        'esc_html' => 0,
    ));
    
    // Field 1: MSTI Number
    acf_add_local_field(array(
        'key' => 'field_msti_number',
        'label' => 'MSTI Case Number',
        'name' => 'msti_number',
        'type' => 'text',
        'parent' => 'group_mst_case_master',
        'instructions' => 'Primary case identifier (Format: YYYY-XXX)',
        'required' => 1,
        'wrapper' => array(
            'width' => '33',
            'class' => '',
            'id' => '',
        ),
        'default_value' => '',
        'placeholder' => 'e.g., 2024-001',
        'prepend' => 'MSTI#',
        'append' => '',
        'maxlength' => 8,
    ));
    
    // Field 2: Assigned Therapist ID
    acf_add_local_field(array(
        'key' => 'field_assigned_therapist_id',
        'label' => 'Assigned Therapist',
        'name' => 'assigned_therapist_id',
        'type' => 'user',
        'parent' => 'group_mst_case_master',
        'instructions' => 'Select the therapist assigned to this case',
        'required' => 1,
        'wrapper' => array(
            'width' => '33',
            'class' => '',
            'id' => '',
        ),
        'role' => array('mst_therapist', 'mst_supervisor'),
        'allow_null' => 0,
        'multiple' => 0,
        'return_format' => 'id',
    ));
    
    // Field 3: Assigned Therapist Name (read-only display)
    acf_add_local_field(array(
        'key' => 'field_assigned_therapist_name',
        'label' => 'Therapist Name',
        'name' => 'assigned_therapist_name',
        'type' => 'text',
        'parent' => 'group_mst_case_master',
        'instructions' => 'Auto-populated from therapist user account',
        'required' => 0,
        'wrapper' => array(
            'width' => '34',
            'class' => '',
            'id' => '',
        ),
        'readonly' => 1,
        'disabled' => 0,
    ));
    
    // ============================================
    // SECTION: Status & Phase Tracking
    // ============================================
    
    acf_add_local_field(array(
        'key' => 'field_section_status_phase',
        'label' => 'Status & Treatment Phase',
        'name' => '',
        'type' => 'message',
        'parent' => 'group_mst_case_master',
        'message' => 'Current case status and treatment phase tracking',
        'new_lines' => 'wpautop',
        'esc_html' => 0,
    ));
    
    // Field 4: Case Status
    acf_add_local_field(array(
        'key' => 'field_case_status',
        'label' => 'Case Status',
        'name' => 'case_status',
        'type' => 'select',
        'parent' => 'group_mst_case_master',
        'instructions' => 'Current status in the MST workflow',
        'required' => 1,
        'wrapper' => array(
            'width' => '33',
            'class' => '',
            'id' => '',
        ),
        'choices' => array(
            'referred' => 'Referred',
            'assigned' => 'Assigned',
            'active' => 'Active',
            'on_hold' => 'On Hold',
            'closing' => 'Closing',
            'closed' => 'Closed',
        ),
        'default_value' => 'referred',
        'allow_null' => 0,
        'multiple' => 0,
        'ui' => 1,
        'ajax' => 0,
        'return_format' => 'value',
    ));
    
    // Field 5: Treatment Phase
    acf_add_local_field(array(
        'key' => 'field_treatment_phase',
        'label' => 'Treatment Phase',
        'name' => 'treatment_phase',
        'type' => 'select',
        'parent' => 'group_mst_case_master',
        'instructions' => 'Current MST treatment phase',
        'required' => 1,
        'wrapper' => array(
            'width' => '33',
            'class' => '',
            'id' => '',
        ),
        'choices' => array(
            'engagement' => 'Engagement Phase (Days 1-14)',
            'assessment' => 'Assessment Phase (Days 15-28)',
            'intervention' => 'Intervention Phase (Days 29-84)',
            'generalization' => 'Generalization Phase (Days 85-112)',
            'termination' => 'Termination Phase (Day 113+)',
        ),
        'default_value' => 'engagement',
        'allow_null' => 0,
        'multiple' => 0,
        'ui' => 1,
        'ajax' => 0,
        'return_format' => 'value',
    ));
    
    // Field 6: Week Number
    acf_add_local_field(array(
        'key' => 'field_week_number',
        'label' => 'Current Week Number',
        'name' => 'week_number',
        'type' => 'number',
        'parent' => 'group_mst_case_master',
        'instructions' => 'Current week in treatment (0 = pre-treatment)',
        'required' => 1,
        'wrapper' => array(
            'width' => '34',
            'class' => '',
            'id' => '',
        ),
        'default_value' => 0,
        'placeholder' => '',
        'prepend' => 'Week',
        'append' => '',
        'min' => 0,
        'max' => 20,
        'step' => 1,
    ));
    
    // ============================================
    // SECTION: Onboarding Progress
    // ============================================
    
    acf_add_local_field(array(
        'key' => 'field_section_onboarding',
        'label' => 'Onboarding Progress',
        'name' => '',
        'type' => 'message',
        'parent' => 'group_mst_case_master',
        'message' => 'Track completion of initial assessment forms',
        'new_lines' => 'wpautop',
        'esc_html' => 0,
    ));
    
    // Field 7: Onboarding Status
    acf_add_local_field(array(
        'key' => 'field_onboarding_status',
        'label' => 'Onboarding Status',
        'name' => 'onboarding_status',
        'type' => 'select',
        'parent' => 'group_mst_case_master',
        'instructions' => 'Overall onboarding completion status',
        'required' => 1,
        'wrapper' => array(
            'width' => '50',
            'class' => '',
            'id' => '',
        ),
        'choices' => array(
            'not_started' => 'Not Started',
            'in_progress' => 'In Progress',
            'complete' => 'Complete',
        ),
        'default_value' => 'not_started',
        'allow_null' => 0,
        'ui' => 1,
        'return_format' => 'value',
    ));
    
    // Field 8: Onboarding Percentage
    acf_add_local_field(array(
        'key' => 'field_onboarding_percentage',
        'label' => 'Onboarding Completion %',
        'name' => 'onboarding_percentage',
        'type' => 'number',
        'parent' => 'group_mst_case_master',
        'instructions' => 'Calculated based on forms completed (0-100%)',
        'required' => 0,
        'wrapper' => array(
            'width' => '50',
            'class' => '',
            'id' => '',
        ),
        'default_value' => 0,
        'placeholder' => '',
        'prepend' => '',
        'append' => '%',
        'min' => 0,
        'max' => 100,
        'step' => 1,
        'readonly' => 1,
    ));
    
    // Field 9: Baseline Complete
    acf_add_local_field(array(
        'key' => 'field_baseline_complete',
        'label' => 'Baseline Assessments Complete',
        'name' => 'baseline_complete',
        'type' => 'true_false',
        'parent' => 'group_mst_case_master',
        'instructions' => 'All initial assessments completed',
        'required' => 0,
        'wrapper' => array(
            'width' => '50',
            'class' => '',
            'id' => '',
        ),
        'message' => 'All baseline assessments completed',
        'default_value' => 0,
        'ui' => 1,
        'ui_on_text' => 'Yes',
        'ui_off_text' => 'No',
    ));
    
    // Field 10: Forms Completed Checklist
    acf_add_local_field(array(
        'key' => 'field_forms_completed',
        'label' => 'Forms Completed',
        'name' => 'forms_completed',
        'type' => 'checkbox',
        'parent' => 'group_mst_case_master',
        'instructions' => 'Check off completed onboarding forms',
        'required' => 0,
        'wrapper' => array(
            'width' => '50',
            'class' => '',
            'id' => '',
        ),
        'choices' => array(
            'form_239' => 'Form 239 - Initial Visit Scheduled',
            'form_244' => 'Form 244 - Fit Assessment',
            'form_245' => 'Form 245 - Safety Assessment',
            'form_240' => 'Form 240 - Genogram',
            'form_241' => 'Form 241 - Family Members',
            'form_218' => 'Form 218 - Secondary Assessment',
        ),
        'default_value' => array(),
        'layout' => 'vertical',
        'toggle' => 0,
        'return_format' => 'value',
        'allow_custom' => 0,
    ));
    
    // ============================================
    // SECTION: Important Dates
    // ============================================
    
    acf_add_local_field(array(
        'key' => 'field_section_dates',
        'label' => 'Important Dates',
        'name' => '',
        'type' => 'message',
        'parent' => 'group_mst_case_master',
        'message' => 'Key milestone dates for compliance tracking',
        'new_lines' => 'wpautop',
        'esc_html' => 0,
    ));
    
    // Field 11: Referral Date
    acf_add_local_field(array(
        'key' => 'field_referral_date',
        'label' => 'Referral Date',
        'name' => 'referral_date',
        'type' => 'date_picker',
        'parent' => 'group_mst_case_master',
        'instructions' => 'Date referral was received (from Form 223)',
        'required' => 1,
        'wrapper' => array(
            'width' => '33',
            'class' => '',
            'id' => '',
        ),
        'display_format' => 'm/d/Y',
        'return_format' => 'Y-m-d',
        'first_day' => 0,
    ));
    
    // Field 12: Assignment Date
    acf_add_local_field(array(
        'key' => 'field_assignment_date',
        'label' => 'Assignment Date',
        'name' => 'assignment_date',
        'type' => 'date_picker',
        'parent' => 'group_mst_case_master',
        'instructions' => 'Date case was assigned to therapist',
        'required' => 0,
        'wrapper' => array(
            'width' => '33',
            'class' => '',
            'id' => '',
        ),
        'display_format' => 'm/d/Y',
        'return_format' => 'Y-m-d',
        'first_day' => 0,
    ));
    
    // Field 13: First Contact Date
    acf_add_local_field(array(
        'key' => 'field_first_contact_date',
        'label' => 'First Family Contact',
        'name' => 'first_contact_date',
        'type' => 'date_picker',
        'parent' => 'group_mst_case_master',
        'instructions' => 'Date of first contact with family',
        'required' => 0,
        'wrapper' => array(
            'width' => '34',
            'class' => '',
            'id' => '',
        ),
        'display_format' => 'm/d/Y',
        'return_format' => 'Y-m-d',
        'first_day' => 0,
    ));
    
    // Field 14: Last Contact Date
    acf_add_local_field(array(
        'key' => 'field_last_contact_date',
        'label' => 'Last Contact Date',
        'name' => 'last_contact_date',
        'type' => 'date_picker',
        'parent' => 'group_mst_case_master',
        'instructions' => 'Most recent family contact (auto-updated from Form 301)',
        'required' => 0,
        'wrapper' => array(
            'width' => '33',
            'class' => '',
            'id' => '',
        ),
        'display_format' => 'm/d/Y',
        'return_format' => 'Y-m-d',
        'first_day' => 0,
        'readonly' => 1,
    ));
    
    // Field 15: Next Scheduled Visit
    acf_add_local_field(array(
        'key' => 'field_next_scheduled_visit',
        'label' => 'Next Scheduled Visit',
        'name' => 'next_scheduled_visit',
        'type' => 'date_time_picker',
        'parent' => 'group_mst_case_master',
        'instructions' => 'Next scheduled appointment',
        'required' => 0,
        'wrapper' => array(
            'width' => '33',
            'class' => '',
            'id' => '',
        ),
        'display_format' => 'm/d/Y g:i a',
        'return_format' => 'Y-m-d H:i:s',
        'first_day' => 0,
    ));
    
    // Field 16: Treatment Start Date
    acf_add_local_field(array(
        'key' => 'field_treatment_start_date',
        'label' => 'Treatment Start Date',
        'name' => 'treatment_start_date',
        'type' => 'date_picker',
        'parent' => 'group_mst_case_master',
        'instructions' => 'Official start of active treatment (Week 1)',
        'required' => 0,
        'wrapper' => array(
            'width' => '34',
            'class' => '',
            'id' => '',
        ),
        'display_format' => 'm/d/Y',
        'return_format' => 'Y-m-d',
        'first_day' => 0,
    ));
    
    // ============================================
    // SECTION: Supervision & Compliance
    // ============================================
    
    acf_add_local_field(array(
        'key' => 'field_section_supervision',
        'label' => 'Supervision & Compliance',
        'name' => '',
        'type' => 'message',
        'parent' => 'group_mst_case_master',
        'message' => 'Supervision status and compliance tracking',
        'new_lines' => 'wpautop',
        'esc_html' => 0,
    ));
    
    // Field 17: Supervision Status
    acf_add_local_field(array(
        'key' => 'field_supervision_status',
        'label' => 'Supervision Status',
        'name' => 'supervision_status',
        'type' => 'select',
        'parent' => 'group_mst_case_master',
        'instructions' => 'Current supervision compliance status',
        'required' => 0,
        'wrapper' => array(
            'width' => '33',
            'class' => '',
            'id' => '',
        ),
        'choices' => array(
            'current' => 'Current',
            'behind' => 'Behind Schedule',
            'critical' => 'Critical - Immediate Attention',
        ),
        'default_value' => 'current',
        'allow_null' => 0,
        'ui' => 1,
        'return_format' => 'value',
    ));
    
    // Field 18: Last Supervision Date
    acf_add_local_field(array(
        'key' => 'field_last_supervision_date',
        'label' => 'Last Supervision',
        'name' => 'last_supervision_date',
        'type' => 'date_picker',
        'parent' => 'group_mst_case_master',
        'instructions' => 'Date of last supervision session',
        'required' => 0,
        'wrapper' => array(
            'width' => '33',
            'class' => '',
            'id' => '',
        ),
        'display_format' => 'm/d/Y',
        'return_format' => 'Y-m-d',
        'first_day' => 0,
    ));
    
    // Field 19: Next Supervision Due
    acf_add_local_field(array(
        'key' => 'field_next_supervision_due',
        'label' => 'Next Supervision Due',
        'name' => 'next_supervision_due',
        'type' => 'date_picker',
        'parent' => 'group_mst_case_master',
        'instructions' => 'When next supervision is due',
        'required' => 0,
        'wrapper' => array(
            'width' => '34',
            'class' => '',
            'id' => '',
        ),
        'display_format' => 'm/d/Y',
        'return_format' => 'Y-m-d',
        'first_day' => 0,
    ));
    
    // ============================================
    // SECTION: Form Entry Links
    // ============================================
    
    acf_add_local_field(array(
        'key' => 'field_section_form_links',
        'label' => 'Linked Form Entries',
        'name' => '',
        'type' => 'message',
        'parent' => 'group_mst_case_master',
        'message' => 'Gravity Forms entry IDs for reference',
        'new_lines' => 'wpautop',
        'esc_html' => 0,
    ));
    
    // Field 20: Referral Entry ID
    acf_add_local_field(array(
        'key' => 'field_referral_entry_id',
        'label' => 'Form 223 Entry ID',
        'name' => 'referral_entry_id',
        'type' => 'number',
        'parent' => 'group_mst_case_master',
        'instructions' => 'Referral form entry ID',
        'required' => 0,
        'wrapper' => array(
            'width' => '33',
            'class' => '',
            'id' => '',
        ),
        'default_value' => '',
        'placeholder' => '',
        'prepend' => 'Entry #',
        'min' => 1,
        'step' => 1,
    ));
    
    // Field 21: Initial Visit Entry ID
    acf_add_local_field(array(
        'key' => 'field_initial_visit_entry_id',
        'label' => 'Form 239 Entry ID',
        'name' => 'initial_visit_entry_id',
        'type' => 'number',
        'parent' => 'group_mst_case_master',
        'instructions' => 'Initial visit form entry ID',
        'required' => 0,
        'wrapper' => array(
            'width' => '33',
            'class' => '',
            'id' => '',
        ),
        'prepend' => 'Entry #',
        'min' => 1,
        'step' => 1,
    ));
    
    // Field 22: Fit Assessment Entry ID
    acf_add_local_field(array(
        'key' => 'field_fit_assessment_entry_id',
        'label' => 'Form 244 Entry ID',
        'name' => 'fit_assessment_entry_id',
        'type' => 'number',
        'parent' => 'group_mst_case_master',
        'instructions' => 'Fit assessment form entry ID',
        'required' => 0,
        'wrapper' => array(
            'width' => '34',
            'class' => '',
            'id' => '',
        ),
        'prepend' => 'Entry #',
        'min' => 1,
        'step' => 1,
    ));
    
    // Field 23: Safety Assessment Entry ID
    acf_add_local_field(array(
        'key' => 'field_safety_assessment_entry_id',
        'label' => 'Form 245 Entry ID',
        'name' => 'safety_assessment_entry_id',
        'type' => 'number',
        'parent' => 'group_mst_case_master',
        'instructions' => 'Safety assessment form entry ID',
        'required' => 0,
        'wrapper' => array(
            'width' => '33',
            'class' => '',
            'id' => '',
        ),
        'prepend' => 'Entry #',
        'min' => 1,
        'step' => 1,
    ));
    
    // Field 24: Genogram Entry ID
    acf_add_local_field(array(
        'key' => 'field_genogram_entry_id',
        'label' => 'Form 240 Entry ID',
        'name' => 'genogram_entry_id',
        'type' => 'number',
        'parent' => 'group_mst_case_master',
        'instructions' => 'Genogram form entry ID',
        'required' => 0,
        'wrapper' => array(
            'width' => '33',
            'class' => '',
            'id' => '',
        ),
        'prepend' => 'Entry #',
        'min' => 1,
        'step' => 1,
    ));
    
    // Field 25: Secondary Assessment Entry ID
    acf_add_local_field(array(
        'key' => 'field_secondary_assessment_entry_id',
        'label' => 'Form 218 Entry ID',
        'name' => 'secondary_assessment_entry_id',
        'type' => 'number',
        'parent' => 'group_mst_case_master',
        'instructions' => 'Secondary assessment form entry ID',
        'required' => 0,
        'wrapper' => array(
            'width' => '34',
            'class' => '',
            'id' => '',
        ),
        'prepend' => 'Entry #',
        'min' => 1,
        'step' => 1,
    ));
}

Comments

Add a Comment