996: 997: // Question headers — tipe text: hanya kolom Jawaban (tanpa Catatan) 998: $qColMap = []; 999: 1000: foreach ($panelTest->questions as $q) { 1001: $isText = $q->question_type === 'text'; 1002: $c = $this->col($colIdx); 1003: if ($isText) { 1004: $sheet->setCellValue("{$c}5", $q->question_text); 1005: $sheet->setCellValue("{$c}6", 'Jawaban'); 1006: $this->fill($sheet, "{$c}5", 'FF334155'); 1007: $this->fill($sheet, "{$c}6", 'FFF1F5F9'); 1008: $this->font($sheet, "{$c}5", ['bold' => true, 'size' => 9, 'color' => 'FFFFFFFF']); 1009: $this->font($sheet, "{$c}6", ['bold' => true, 'size' => 9, 'color' => 'FF475569']); 1010: $this->align($sheet, "{$c}5", 'center', 'center', true); 1011: $this->align($sheet, "{$c}6", 'center', 'center'); 1012: $sheet->getColumnDimension($c)->setWidth(35); 1013: $qColMap[$q->id] = ['ans' => $c, 'note' => null, 'si' => null]; 1014: $colIdx += 1; 1015: } else { 1016: $cN = $this->col($colIdx + 1); 1017: $sheet->mergeCells("{$c}5:{$cN}5"); 1018: $sheet->setCellValue("{$c}5", $q->question_text); 1019: $this->fill($sheet, "{$c}5:{$cN}5", 'FF334155'); 1020: $this->font($sheet, "{$c}5", ['bold' => true, 'size' => 9, 'color' => 'FFFFFFFF']); 1021: $this->align($sheet, "{$c}5:{$cN}5", 'center', 'center', true); 1022: $sheet->setCellValue("{$c}6", 'Jawaban'); 1023: $sheet->setCellValue("{$cN}6", 'Catatan'); 1024: $this->fill($sheet, "{$c}6:{$cN}6", 'FFF1F5F9'); 1025: $this->font($sheet, "{$c}6:{$cN}6", ['bold' => true, 'size' => 9, 'color' => 'FF475569']); 1026: $this->align($sheet, "{$c}6:{$cN}6", 'center', 'center'); 1027: $sheet->getColumnDimension($c)->setWidth(20); 1028: $sheet->getColumnDimension($cN)->setWidth(14); 1029: $qColMap[$q->id] = ['ans' => $c, 'note' => $cN, 'si' => null]; 1030: $colIdx += 2; 1031: } 1032: } 1033: 1034: foreach ($panelTest->samples as $si => $sample) { 1035: $sc = $this->palette[$si % 5]; 1036: foreach ($sample->questions as $q) { 1037: $isText = $q->question_type === 'text'; 1038: $c = $this->col($colIdx); 1039: $label = '[' . strtoupper($sample->name) . '] ' . $q->question_text; 1040: if ($isText) { 1041: $sheet->setCellValue("{$c}5", $label); 1042: $sheet->setCellValue("{$c}6", 'Jawaban'); 1043: $this->fill($sheet, "{$c}5", $sc['dark']); 1044: $this->fill($sheet, "{$c}6", $sc['light']); 1045: $this->font($sheet, "{$c}5", ['bold' => true, 'size' => 9, 'color' => 'FFFFFFFF']); 1046: $this->font($sheet, "{$c}6", ['bold' => true, 'size' => 9, 'color' => $sc['dark']]); 1047: $this->align($sheet, "{$c}5", 'center', 'center', true); 1048: $this->align($sheet, "{$c}6", 'center', 'center'); 1049: $sheet->getColumnDimension($c)->setWidth(35); 1050: $qColMap[$q->id] = ['ans' => $c, 'note' => null, 'si' => $si]; 1051: $colIdx += 1; 1052: } else { 1053: $cN = $this->col($colIdx + 1); 1054: $sheet->mergeCells("{$c}5:{$cN}5"); 1055: $sheet->setCellValue("{$c}5", $label); 1056: $this->fill($sheet, "{$c}5:{$cN}5", $sc['dark']); 1057: $this->font($sheet, "{$c}5", ['bold' => true, 'size' => 9, 'color' => 'FFFFFFFF']); 1058: $this->align($sheet, "{$c}5:{$cN}5", 'center', 'center', true); 1059: $sheet->setCellValue("{$c}6", 'Jawaban'); 1060: $sheet->setCellValue("{$cN}6", 'Catatan'); 1061: $this->fill($sheet, "{$c}6:{$cN}6", $sc['light']); 1062: $this->font($sheet, "{$c}6:{$cN}6", ['bold' => true, 'size' => 9, 'color' => $sc['dark']]); 1063: $this->align($sheet, "{$c}6:{$cN}6", 'center', 'center'); 1064: $sheet->getColumnDimension($c)->setWidth(20); 1065: $sheet->getColumnDimension($cN)->setWidth(14); 1066: $qColMap[$q->id] = ['ans' => $c, 'note' => $cN, 'si' => $si]; 1067: $colIdx += 2; 1068: } 1069: } 1070: } 1071: 1072: $lastCol = $this->col($colIdx - 1); 1073: $sheet->getRowDimension(5)->setRowHeight(40); 1074: $sheet->getRowDimension(6)->setRowHeight(18); 1075: