Home / Admin / ACF_KEYSMST_MSTCASECPT – TAB – ADMINISTRATIVE (v3.0 Modular)
Duplicate Snippet

Embed Snippet on Your Site

ACF_KEYSMST_MSTCASECPT – TAB – ADMINISTRATIVE (v3.0 Modular)

ismail daugherty PRO
<10
Code Preview
php
<?php
/**
 * ============================================
 * MST CASE - TAB: ADMINISTRATIVE (v3.0 Modular)
 * ============================================
 * 
 * Purpose: Adds Administrative tab to master field group
 * Parent: group_mst_case_master
 * Source: System metadata and internal tracking
 * Fields: 15 fields
 * 
 * VERSION: 3.0 - Modular Architecture
 * Priority: 18 (loads last - after all data tabs)
 * 
 * Purpose: System tracking, metadata, and internal management
 * - Case creation tracking
 * - Form entry ID links
 * - Billing and insurance
 * - Internal administrative notes
 * - System audit trail
 * 
 * CRITICAL: Read-only system fields for data integrity
 * 
 * IMPORTANT: Master field group snippet must be active first!
 * ============================================
 */
if (!defined('ABSPATH')) {
    exit; // Exit if accessed directly
}
add_action('acf/init', 'mst_add_administrative_tab', 18);
function mst_add_administrative_tab() {
    
    if (!function_exists('acf_add_local_field')) {
        return;
    }
    
    // ========================================
    // TAB: ADMINISTRATIVE
    // ========================================
    acf_add_local_field(array(
        'key' => 'field_tab_administrative',
        'label' => '⚙️ Administrative',
        'name' => '',
        'type' => 'tab',
        'parent' => 'group_mst_case_master',
        'placement' => 'top',
    ));
    
    // ========================================
    // SECTION 1: CASE CREATION METADATA
    // ========================================
    acf_add_local_field(array(
        'key' => 'field_section_case_metadata',
        'label' => 'Case Creation & Modification',
        'name' => '',
        'type' => 'message',
        'parent' => 'group_mst_case_master',
        'message' => '<strong style="color: #6b7280;">📋 SYSTEM METADATA</strong><br>Automated tracking of case creation and modifications (read-only)',
        'new_lines' => '',
        'esc_html' => 0,
    ));
    
    // Field 1: Created Date
    acf_add_local_field(array(
        'key' => 'field_case_created_date',
        'label' => 'Case Created Date',
        'name' => 'case_created_date',
        'type' => 'date_picker',
        'parent' => 'group_mst_case_master',
        'instructions' => 'Date this case record was created (auto-populated)',
        'required' => 0,
        'wrapper' => array('width' => '33'),
        'display_format' => 'm/d/Y',
        'return_format' => 'Y-m-d',
        'first_day' => 0,
        'readonly' => 1,
    ));
    
    // Field 2: Created By User
    acf_add_local_field(array(
        'key' => 'field_case_created_by',
        'label' => 'Case Created By',
        'name' => 'case_created_by',
        'type' => 'user',
        'parent' => 'group_mst_case_master',
        'instructions' => 'User who created this case record',
        'required' => 0,
        'wrapper' => array('width' => '33'),
        'role' => '',
        'allow_null' => 0,
        'multiple' => 0,
        'return_format' => 'array',
        'readonly' => 1,
    ));
    
    // Field 3: Last Modified Date
    acf_add_local_field(array(
        'key' => 'field_case_last_modified_date',
        'label' => 'Last Modified Date',
        'name' => 'case_last_modified_date',
        'type' => 'date_time_picker',
        'parent' => 'group_mst_case_master',
        'instructions' => 'Most recent modification timestamp',
        'required' => 0,
        'wrapper' => array('width' => '34'),
        'display_format' => 'm/d/Y g:i a',
        'return_format' => 'Y-m-d H:i:s',
        'first_day' => 0,
        'readonly' => 1,
    ));
    
    // Field 4: Last Modified By User
    acf_add_local_field(array(
        'key' => 'field_case_last_modified_by',
        'label' => 'Last Modified By',
        'name' => 'case_last_modified_by',
        'type' => 'user',
        'parent' => 'group_mst_case_master',
        'instructions' => 'User who last updated this case',
        'required' => 0,
        'wrapper' => array('width' => '50'),
        'role' => '',
        'allow_null' => 0,
        'multiple' => 0,
        'return_format' => 'array',
        'readonly' => 1,
    ));
    
    // Field 5: Modification Count
    acf_add_local_field(array(
        'key' => 'field_case_modification_count',
        'label' => 'Total Modifications',
        'name' => 'case_modification_count',
        'type' => 'number',
        'parent' => 'group_mst_case_master',
        'instructions' => 'Total number of times this case has been updated',
        'required' => 0,
        'wrapper' => array('width' => '50'),
        'default_value' => 0,
        'placeholder' => '',
        'prepend' => '',
        'append' => 'edits',
        'min' => 0,
        'step' => 1,
        'readonly' => 1,
    ));
    
    // ========================================
    // SECTION 2: FORM ENTRY LINKS (ADDITIONAL)
    // ========================================
    acf_add_local_field(array(
        'key' => 'field_section_additional_form_links',
        'label' => 'Additional Form Entry Links',
        'name' => '',
        'type' => 'message',
        'parent' => 'group_mst_case_master',
        'message' => '<strong>🔗 FORM ENTRY REFERENCES</strong><br>Links to ongoing documentation forms (Note: Initial assessment forms are tracked in Case Status & Tracking tab)',
        'new_lines' => '',
        'esc_html' => 0,
    ));
    
    // Field 6: Weekly Summaries Count
    acf_add_local_field(array(
        'key' => 'field_weekly_summaries_count',
        'label' => 'Weekly Summaries Submitted',
        'name' => 'weekly_summaries_count',
        'type' => 'number',
        'parent' => 'group_mst_case_master',
        'instructions' => 'Total number of Form 302 weekly summaries submitted',
        'required' => 0,
        'wrapper' => array('width' => '33'),
        'default_value' => 0,
        'placeholder' => '',
        'prepend' => '',
        'append' => 'summaries',
        'min' => 0,
        'step' => 1,
        'readonly' => 1,
    ));
    
    // Field 7: Contact Logs Count
    acf_add_local_field(array(
        'key' => 'field_contact_logs_count',
        'label' => 'Contact Logs Submitted',
        'name' => 'contact_logs_count',
        'type' => 'number',
        'parent' => 'group_mst_case_master',
        'instructions' => 'Total number of Form 301 contact logs submitted',
        'required' => 0,
        'wrapper' => array('width' => '33'),
        'default_value' => 0,
        'placeholder' => '',
        'prepend' => '',
        'append' => 'contacts',
        'min' => 0,
        'step' => 1,
        'readonly' => 1,
    ));
    
    // Field 8: Most Recent Weekly Summary Entry ID
    acf_add_local_field(array(
        'key' => 'field_most_recent_weekly_summary_id',
        'label' => 'Most Recent Weekly Summary',
        'name' => 'most_recent_weekly_summary_id',
        'type' => 'number',
        'parent' => 'group_mst_case_master',
        'instructions' => 'Entry ID of most recent Form 302 submission',
        'required' => 0,
        'wrapper' => array('width' => '34'),
        'default_value' => '',
        'placeholder' => '',
        'prepend' => 'Entry #',
        'min' => 1,
        'step' => 1,
    ));
    
    // ========================================
    // SECTION 3: BILLING & INSURANCE
    // ========================================
    acf_add_local_field(array(
        'key' => 'field_section_billing',
        'label' => 'Billing & Insurance',
        'name' => '',
        'type' => 'message',
        'parent' => 'group_mst_case_master',
        'message' => '<strong style="color: #059669;">💰 BILLING & INSURANCE TRACKING</strong><br>Manage billing status and insurance authorization',
        'new_lines' => '',
        'esc_html' => 0,
    ));
    
    // Field 9: Billing Status
    acf_add_local_field(array(
        'key' => 'field_billing_status',
        'label' => 'Billing Status',
        'name' => 'billing_status',
        'type' => 'select',
        'parent' => 'group_mst_case_master',
        'instructions' => 'Current billing status for this case',
        'required' => 0,
        'wrapper' => array('width' => '33'),
        'choices' => array(
            'current' => 'Current - Up to Date',
            'pending' => 'Pending - Awaiting Submission',
            'behind' => 'Behind - Action Needed',
            'hold' => 'On Hold - Insurance Issue',
            'closed' => 'Closed - Complete',
        ),
        'default_value' => 'current',
        'ui' => 1,
        'return_format' => 'value',
    ));
    
    // Field 10: Insurance Authorization Number
    acf_add_local_field(array(
        'key' => 'field_insurance_authorization_number',
        'label' => 'Insurance Authorization #',
        'name' => 'insurance_authorization_number',
        'type' => 'text',
        'parent' => 'group_mst_case_master',
        'instructions' => 'Insurance authorization/pre-certification number',
        'required' => 0,
        'wrapper' => array('width' => '33'),
        'default_value' => '',
        'placeholder' => '',
        'maxlength' => '',
    ));
    
    // Field 11: Insurance Authorization Expires
    acf_add_local_field(array(
        'key' => 'field_insurance_authorization_expires',
        'label' => 'Authorization Expires',
        'name' => 'insurance_authorization_expires',
        'type' => 'date_picker',
        'parent' => 'group_mst_case_master',
        'instructions' => 'Insurance authorization expiration date',
        'required' => 0,
        'wrapper' => array('width' => '34'),
        'display_format' => 'm/d/Y',
        'return_format' => 'Y-m-d',
        'first_day' => 0,
    ));
    
    // Field 12: Billing Notes
    acf_add_local_field(array(
        'key' => 'field_billing_notes',
        'label' => 'Billing Notes',
        'name' => 'billing_notes',
        'type' => 'textarea',
        'parent' => 'group_mst_case_master',
        'instructions' => 'Internal notes about billing, insurance issues, or payment status',
        'required' => 0,
        'wrapper' => array('width' => '100'),
        'rows' => 3,
        'placeholder' => 'Document any billing issues, insurance communications, or payment notes',
    ));
    
    // ========================================
    // SECTION 4: INTERNAL NOTES
    // ========================================
    acf_add_local_field(array(
        'key' => 'field_section_internal_notes',
        'label' => 'Internal Administrative Notes',
        'name' => '',
        'type' => 'message',
        'parent' => 'group_mst_case_master',
        'message' => '<strong style="color: #dc2626;">🔒 INTERNAL USE ONLY</strong><br>Administrative notes not visible to family',
        'new_lines' => '',
        'esc_html' => 0,
    ));
    
    // Field 13: Case Notes Internal
    acf_add_local_field(array(
        'key' => 'field_case_notes_internal',
        'label' => 'Internal Case Notes',
        'name' => 'case_notes_internal',
        'type' => 'textarea',
        'parent' => 'group_mst_case_master',
        'instructions' => 'Internal administrative notes (supervisor communications, special considerations, etc.)',
        'required' => 0,
        'wrapper' => array('width' => '100'),
        'rows' => 4,
        'placeholder' => 'Internal administrative notes, supervisor flags, special handling instructions, etc. NOT visible to family.',
    ));
    
    // Field 14: Case Flags / Alerts
    acf_add_local_field(array(
        'key' => 'field_case_flags_alerts',
        'label' => 'Case Flags / Alerts',
        'name' => 'case_flags_alerts',
        'type' => 'checkbox',
        'parent' => 'group_mst_case_master',
        'instructions' => 'Select any administrative flags that apply to this case',
        'required' => 0,
        'wrapper' => array('width' => '100'),
        'choices' => array(
            'high_priority' => '🔴 High Priority - Supervisor Attention Needed',
            'compliance_concern' => '⚠️ Compliance Concern',
            'billing_issue' => '💰 Billing Issue',
            'insurance_expiring' => '📅 Insurance Authorization Expiring Soon',
            'transfer_pending' => '🔄 Transfer Pending',
            'litigation' => '⚖️ Litigation / Legal Involvement',
            'media_attention' => '📰 Media Attention / High Profile',
            'language_barrier' => '🗣️ Significant Language Barrier',
            'transportation_issue' => '🚗 Transportation Challenges',
            'housing_unstable' => '🏠 Housing Instability',
        ),
        'default_value' => array(),
        'layout' => 'vertical',
        'toggle' => 0,
        'return_format' => 'value',
    ));
    
    // Field 15: Data Quality Audit
    acf_add_local_field(array(
        'key' => 'field_data_quality_audit',
        'label' => 'Data Quality Audit Log',
        'name' => 'data_quality_audit',
        'type' => 'textarea',
        'parent' => 'group_mst_case_master',
        'instructions' => 'Log of data quality checks, missing information, or corrections needed',
        'required' => 0,
        'wrapper' => array('width' => '100'),
        'rows' => 2,
        'placeholder' => 'Track data quality issues: missing forms, incomplete assessments, data corrections, etc.',
    ));
}

Comments

Add a Comment