Add emojis to pain scale for clear black & white printing

PROBLEM: Color coding not visible in black & white printers

SOLUTION:
- Added emoji indicators: 😊 😐 😣 😖 😭 for pain levels 0-4
- Changed colors to black/white/gray for B&W compatibility
- Emoji shows above selected pain level (larger size)
- Bold 3px border on selected box (visible in B&W)
- Light gray background on selected box

Now pain scale is clear even in monochrome printing!
This commit is contained in:
DevSoftTech Server 2026-06-06 04:14:12 +05:30
parent cad5730182
commit a047955c7c

View File

@ -3880,30 +3880,31 @@ class Opd extends BaseController
if ($painImageHtml === '' && $painIndex !== null) {
$labels = ['No Pain', 'Mild', 'Moderate', 'Intense', 'Worst'];
$colors = ['#22c55e', '#84cc16', '#eab308', '#f97316', '#ef4444']; // green to red gradient
$emojis = ['😊', '😐', '😣', '😖', '😭']; // Visual indicators for black & white printing
// Add debug info at top showing which pain level is selected
$painImageHtml = '<div style="font-size:10px;color:#666;margin-bottom:2px;">Pain Level: ' . $painIndex . ' - ' . esc($labels[$painIndex]) . '</div>';
$painImageHtml .= '<table width="100%" border="0" cellpadding="0" cellspacing="0" style="border-collapse:collapse;margin:4px 0 4px 0;">';
// Row 1: Down arrow indicator above selected level (more visible than checkmark)
// Row 1: Emoji indicators (visible in black & white printing)
$painImageHtml .= '<tr>';
for ($i = 0; $i <= 4; $i++) {
$active = ($painIndex === $i);
$arrow = $active ? '▼' : '&nbsp;';
$painImageHtml .= '<td width="20%" style="text-align:center;height:20px;font-size:20px;font-weight:700;color:' . $colors[$i] . ';line-height:1;">' . $arrow . '</td>';
$emoji = $active ? $emojis[$i] : '&nbsp;';
$fontSize = $active ? '24px' : '16px';
$painImageHtml .= '<td width="20%" style="text-align:center;height:28px;font-size:' . $fontSize . ';line-height:1;">' . $emoji . '</td>';
}
$painImageHtml .= '</tr>';
// Row 2: Number boxes with strong color coding and border
// Row 2: Number boxes with bold border for selected (visible in B&W)
$painImageHtml .= '<tr>';
for ($i = 0; $i <= 4; $i++) {
$active = ($painIndex === $i);
$bg = $active ? $colors[$i] : '#ffffff';
$borderColor = $active ? '#000000' : '#d1d5db';
$bg = $active ? '#e5e5e5' : '#ffffff'; // Light gray for selected (visible in B&W)
$borderColor = '#000000';
$borderWidth = $active ? '3px' : '1px';
$color = $active ? '#ffffff' : '#374151';
$color = '#000000';
$painImageHtml .= '<td width="20%" style="text-align:center;border:' . $borderWidth . ' solid ' . $borderColor . ';background:' . $bg . ';color:' . $color . ';font-size:13px;font-weight:' . ($active ? '700' : '500') . ';padding:6px 0;">' . $i . '</td>';
}
$painImageHtml .= '</tr>';
@ -3913,9 +3914,8 @@ class Opd extends BaseController
for ($i = 0; $i <= 4; $i++) {
$active = ($painIndex === $i);
$fontWeight = $active ? '700' : '400';
$textColor = $active ? '#000000' : '#6b7280';
$fontSize = $active ? '9px' : '8px';
$painImageHtml .= '<td width="20%" style="text-align:center;color:' . $textColor . ';font-size:' . $fontSize . ';line-height:1.4;padding-top:3px;font-weight:' . $fontWeight . ';">' . esc($labels[$i]) . '</td>';
$painImageHtml .= '<td width="20%" style="text-align:center;color:#000000;font-size:' . $fontSize . ';line-height:1.4;padding-top:3px;font-weight:' . $fontWeight . ';">' . esc($labels[$i]) . '</td>';
}
$painImageHtml .= '</tr></table>';
}