File size: 11,764 Bytes
c024705
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
c1ce623
c024705
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Test Admin Input Functionality</title>
    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@4.6.2/dist/css/bootstrap.min.css">
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0/css/all.min.css">
    <style>
        body {
            background-color: #f8f9fa;
            padding: 20px;
        }
        .test-container {
            max-width: 800px;
            margin: 0 auto;
            background: white;
            padding: 20px;
            border-radius: 8px;
            box-shadow: 0 2px 4px rgba(0,0,0,0.1);
        }
        .form-control {
            background-color: #fff !important;
            color: #497060 !important;
            border: 1px solid #ced4da !important;
            pointer-events: auto !important;
            user-select: text !important;
        }
        .form-control:focus {
            border-color: #7c3aed !important;
            box-shadow: 0 0 0 0.2rem rgba(124, 58, 237, 0.25) !important;
        }
        .test-result {
            margin-top: 20px;
            padding: 15px;
            border-radius: 5px;
            background-color: #f8f9fa;
        }
        .success { background-color: #d4edda; color: #155724; }
        .error { background-color: #f8d7da; color: #721c24; }
    </style>
</head>
<body>
    <div class="test-container">
        <h2><i class="fas fa-test-tube"></i> Admin Input Functionality Test</h2>
        <p>This page tests if the input fields work exactly like in the admin dashboard.</p>
        
        <!-- Test Form -->
        <form id="testForm">
            <div class="row">
                <div class="col-md-6">
                    <div class="form-group">
                        <label for="test_username">Username *</label>
                        <input type="text" class="form-control" id="test_username" name="username" required>
                    </div>
                </div>
                <div class="col-md-6">
                    <div class="form-group">
                        <label for="test_password">Password *</label>
                        <input type="password" class="form-control" id="test_password" name="password" required>
                    </div>
                </div>
            </div>
            
            <div class="row">
                <div class="col-md-6">
                    <div class="form-group">
                        <label for="test_first_name">First Name *</label>
                        <input type="text" class="form-control" id="test_first_name" name="first_name" required>
                    </div>
                </div>
                <div class="col-md-6">
                    <div class="form-group">
                        <label for="test_last_name">Last Name *</label>
                        <input type="text" class="form-control" id="test_last_name" name="last_name" required>
                    </div>
                </div>
            </div>
            
            <div class="row">
                <div class="col-md-6">
                    <div class="form-group">
                        <label for="test_email">Email *</label>
                        <input type="email" class="form-control" id="test_email" name="email" required>
                    </div>
                </div>
                <div class="col-md-6">
                    <div class="form-group">
                        <label for="test_phone">Phone</label>
                        <input type="tel" class="form-control" id="test_phone" name="phone">
                    </div>
                </div>
            </div>
            
            <div class="row">
                <div class="col-md-6">
                    <div class="form-group">
                        <label for="test_specialization">Specialization *</label>
                        <select class="form-control" id="test_specialization" name="specialization" required>
                            <option value="">Select Specialization</option>
                            <option value="psychiatrist">Psychiatrist</option>
                            <option value="psychologist">Psychologist</option>
                            <option value="counselor">Counselor</option>
                            <option value="social_worker">Social Worker</option>
                        </select>
                    </div>
                </div>
                <div class="col-md-6">
                    <div class="form-group">
                        <label for="test_experience">Experience (Years)</label>
                        <input type="number" class="form-control" id="test_experience" name="experience_years" min="0" value="0">
                    </div>
                </div>
            </div>
            
            <div class="form-group">
                <label>Expertise Areas *</label>
                <div class="row">
                    <div class="col-md-6">
                        <div class="form-check">
                            <input class="form-check-input" type="checkbox" name="expertise" value="depression" id="test_expertise_depression">
                            <label class="form-check-label" for="test_expertise_depression">Depression</label>
                        </div>
                        <div class="form-check">
                            <input class="form-check-input" type="checkbox" name="expertise" value="anxiety" id="test_expertise_anxiety">
                            <label class="form-check-label" for="test_expertise_anxiety">Anxiety</label>
                        </div>
                    </div>
                    <div class="col-md-6">
                        <div class="form-check">
                            <input class="form-check-input" type="checkbox" name="expertise" value="ptsd" id="test_expertise_ptsd">
                            <label class="form-check-label" for="test_expertise_ptsd">PTSD</label>
                        </div>
                        <div class="form-check">
                            <input class="form-check-input" type="checkbox" name="expertise" value="trauma" id="test_expertise_trauma">
                            <label class="form-check-label" for="test_expertise_trauma">Trauma</label>
                        </div>
                    </div>
                </div>
            </div>
            
            <div class="form-group">
                <label for="test_bio">Bio</label>
                <textarea class="form-control" id="test_bio" name="bio" rows="3" placeholder="Brief professional background..."></textarea>
            </div>
            
            <div class="form-group">
                <button type="submit" class="btn btn-primary">Test Submit</button>
                <button type="button" class="btn btn-secondary" onclick="clearForm()">Clear Form</button>
                <button type="button" class="btn btn-info" onclick="testInputs()">Test Input Functionality</button>
            </div>
        </form>
        
        <div id="testResults" class="test-result" style="display: none;">
            <h5>Test Results:</h5>
            <div id="testContent"></div>
        </div>
    </div>

    <script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
    <script src="https://cdn.jsdelivr.net/npm/bootstrap@4.6.2/dist/js/bootstrap.bundle.min.js"></script>
    <script>
        // Test form functionality
        $('#testForm').on('submit', function(e) {
            e.preventDefault();
            alert('Form submitted successfully! All inputs are working.');
        });
        
        function clearForm() {
            $('#testForm')[0].reset();
            $('#testResults').hide();
        }
        
        function testInputs() {
            const results = [];
            const inputs = $('#testForm input, #testForm select, #testForm textarea');
            
            results.push('<h6>Input Functionality Test:</h6>');
            results.push('<ul>');
            
            inputs.each(function(index) {
                const input = $(this);
                const type = input.attr('type') || input.prop('tagName').toLowerCase();
                const name = input.attr('name') || 'unnamed';
                const id = input.attr('id') || 'no-id';
                
                // Test if input is focusable
                let focusable = false;
                try {
                    input.focus();
                    focusable = document.activeElement === input[0];
                } catch (e) {
                    focusable = false;
                }
                
                // Test if input accepts typing
                let typeable = false;
                if (type === 'text' || type === 'email' || type === 'tel' || type === 'password') {
                    try {
                        const originalValue = input.val();
                        input.val(originalValue + 'test');
                        typeable = input.val().includes('test');
                        input.val(originalValue); // Restore original value
                    } catch (e) {
                        typeable = false;
                    }
                } else {
                    typeable = true; // For selects and textareas
                }
                
                const status = focusable && typeable ? '✅' : '❌';
                const statusText = focusable && typeable ? 'Working' : 'Not Working';
                
                results.push(`<li>${status} <strong>${name}</strong> (${type}): ${statusText}</li>`);
            });
            
            results.push('</ul>');
            
            // Overall test result
            const allWorking = inputs.toArray().every(input => {
                const $input = $(input);
                try {
                    $input.focus();
                    const focusable = document.activeElement === input;
                    return focusable;
                } catch (e) {
                    return false;
                }
            });
            
            const overallStatus = allWorking ? 'success' : 'error';
            const overallText = allWorking ? 'All inputs are working correctly!' : 'Some inputs are not working properly.';
            
            results.push(`<div class="${overallStatus}"><strong>Overall Result: ${overallText}</strong></div>`);
            
            $('#testContent').html(results.join(''));
            $('#testResults').show();
        }
        
        // Auto-test on page load
        $(document).ready(function() {
            console.log('🧪 Input functionality test page loaded');
            console.log('📝 Testing', $('#testForm input, #testForm select, #testForm textarea').length, 'inputs');
            
            // Test each input
            $('#testForm input, #testForm select, #testForm textarea').each(function(index) {
                const input = $(this);
                console.log(`Input ${index}:`, {
                    type: input.attr('type') || input.prop('tagName').toLowerCase(),
                    name: input.attr('name'),
                    id: input.attr('id'),
                    focusable: function() {
                        try {
                            input.focus();
                            return document.activeElement === input[0];
                        } catch (e) {
                            return false;
                        }
                    }()
                });
            });
        });
    </script>
</body>
</html>