diff --git a/app/Services/StickerPdfService.php b/app/Services/StickerPdfService.php index c9b617d2..9fe0a077 100644 --- a/app/Services/StickerPdfService.php +++ b/app/Services/StickerPdfService.php @@ -1098,6 +1098,7 @@ class StickerPdfService if ($row->design_element_type == 'Text') { $textValue = $row->string_value ?? ''; + $configuredTextValue = $textValue; if ($row->element_type == 'Dynamic' && isset($dynamicValueMap[$row->id]) && !in_array($row->characteristics_type, [ @@ -1282,6 +1283,32 @@ class StickerPdfService $textValue = $cName->name; } } + if ($row->characteristics_type == 'brand_plant_name') { + + $column = 'zmm_brand'; + + $textValue = $itemCharacteristic?->{$column} != null + ? $itemCharacteristic->{$column} + : ''; + if($textValue == 'TORMAC'){ + $cName = Company::where('name', 'TORMAC')->first(); + $pName = Plant::where('company_id', $cName->id)->first(); + $textValue = $pName->name; + } + else if($textValue == 'CRI'){ + $textValue = $configuredTextValue ?? 'CRI'; + } + else if($textValue == 'GENVIK'){ + $cName = Company::where('name', 'GENVIK')->first(); + $pName = Plant::where('company_id', $cName->id)->first(); + $textValue = $pName->name; + } + else if($textValue == 'ZIRANTEC'){ + $cName = Company::where('name', 'ZIRANTEC')->first(); + $pName = Plant::where('company_id', $cName->id)->first(); + $textValue = $pName->name; + } + } if ($row->characteristics_type == 'tollfree') { $column = 'zmm_brand'; @@ -1748,11 +1775,16 @@ class StickerPdfService // ); $alignment = strtolower($element['string_align'] ?? ''); - $pdf->SetFont($element['font'], '', $element['size']); + // $pdf->SetFont($element['font'], '', $element['size']); - $font = $element['font'] ?? 'helvetica'; + // $font = $element['font'] ?? 'helvetica'; + // $fontSize = (float) ($element['size'] ?? 10); + + $font = 'dejavusans'; $fontSize = (float) ($element['size'] ?? 10); + $pdf->SetFont($font, '', $fontSize); + // if ( // ($element['characteristics_type'] ?? '') == 'feed_address' // && mb_strlen((string) $textValue) > 61