Merge pull request 'ranjith-dev' (#1536) from ranjith-dev into master
All checks were successful
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 26s
All checks were successful
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 26s
Reviewed-on: #1536
This commit was merged in pull request #1536.
This commit is contained in:
@@ -101,6 +101,7 @@ class StickerDetailResource extends Resource
|
||||
'id',
|
||||
'plant_id',
|
||||
'item_id',
|
||||
'machine_id',
|
||||
'class',
|
||||
'zz1_cn_bill_ord',
|
||||
'created_at',
|
||||
@@ -113,6 +114,7 @@ class StickerDetailResource extends Resource
|
||||
$column => ucfirst(str_replace('_', ' ', $column))
|
||||
])
|
||||
->prepend('Item Code', 'item_code')
|
||||
->prepend('Item Description', 'item_description')
|
||||
->prepend('Serial Number', 'serial_number')
|
||||
->prepend('Plant Name', 'plant_name')
|
||||
->prepend('Plant Address', 'plant_address')
|
||||
|
||||
@@ -1056,6 +1056,7 @@ class StickerPdfService
|
||||
$dynamicValueMap = [];
|
||||
|
||||
$itemCode = $itemCharacteristic?->item?->code ?? $itemCode ?? '';
|
||||
$itemDesc = $itemCharacteristic?->item?->description ?? $itemDesc ?? '';
|
||||
|
||||
$plantName = $itemCharacteristic?->plant?->name ?? '';
|
||||
$plantAddress = $itemCharacteristic?->plant?->address ?? '';
|
||||
@@ -1101,6 +1102,7 @@ class StickerPdfService
|
||||
if ($row->element_type == 'Dynamic' && isset($dynamicValueMap[$row->id]) &&
|
||||
!in_array($row->characteristics_type, [
|
||||
'item_code',
|
||||
'item_description',
|
||||
'serial_number',
|
||||
'plant_name',
|
||||
'plant_address',
|
||||
@@ -1114,6 +1116,9 @@ class StickerPdfService
|
||||
if ($row->characteristics_type == 'item_code') {
|
||||
$textValue = $itemCode;
|
||||
}
|
||||
if ($row->characteristics_type == 'item_description') {
|
||||
$textValue = chunk_split($itemDesc, 24, "\n");
|
||||
}
|
||||
if ($row->characteristics_type == 'serial_number') {
|
||||
$textValue = '__SERIAL_NUMBER__';
|
||||
}
|
||||
@@ -1306,7 +1311,7 @@ class StickerPdfService
|
||||
$cName = Company::where('name', 'ZIRANTEC')->first();
|
||||
$plantRegdUnit = Plant::where('company_id', $cName->id)->first();
|
||||
|
||||
$textValue = $plantRegdUnit->tollfree;
|
||||
$textValue = $plantRegdUnit->tollfree ?? '';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1391,6 +1396,8 @@ class StickerPdfService
|
||||
elseif ($row->design_element_type == 'Image') {
|
||||
|
||||
$imagePath = null;
|
||||
$xImage = null;
|
||||
$yImage = null;
|
||||
|
||||
$signOffTypes = ['tested_by', 'verified_by', 'approved_by'];
|
||||
|
||||
@@ -1418,15 +1425,65 @@ class StickerPdfService
|
||||
$imageName = strtolower($dynamicValueMap[$row->id]) . '.png';
|
||||
|
||||
$imagePath = public_path('images/' . ltrim($imageName, '/'));
|
||||
|
||||
// if($stickerId == 'SelfPriming Monoblock Pump' && $imageName == 'cri.png'){
|
||||
// $xImage = 5;
|
||||
// $yImage = 4;
|
||||
// }
|
||||
// else{
|
||||
// $xImage = (float) ($row->image_x ?? 0);
|
||||
// $yImage = (float) ($row->image_y ?? 0);
|
||||
// }
|
||||
if ($imageName == 'cri.png') {
|
||||
|
||||
$alignmentRow = $elements->firstWhere(
|
||||
'characteristics_type',
|
||||
'cri_image_alignment'
|
||||
);
|
||||
|
||||
$xImage = (float) ($alignmentRow->image_x ?? $row->image_x ?? 0);
|
||||
$yImage = (float) ($alignmentRow->image_y ?? $row->image_y ?? 0);
|
||||
|
||||
} else {
|
||||
|
||||
$xImage = (float) ($row->image_x ?? 0);
|
||||
$yImage = (float) ($row->image_y ?? 0);
|
||||
}
|
||||
}
|
||||
|
||||
$imageWidth = (float) ($row->image_width ?? 0);
|
||||
$imageHeight = (float) ($row->image_height ?? 0);
|
||||
|
||||
if (
|
||||
($imageWidth <= 0 || $imageHeight <= 0) &&
|
||||
$imagePath &&
|
||||
file_exists($imagePath)
|
||||
) {
|
||||
$imageSize = getimagesize($imagePath);
|
||||
|
||||
if ($imageSize) {
|
||||
if ($imageWidth <= 0) {
|
||||
$imageWidth = $imageSize[0] * 25.4 / 200;;
|
||||
}
|
||||
|
||||
if ($imageHeight <= 0) {
|
||||
$imageHeight = $imageSize[1] * 25.4 / 200;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$templateElements[] = [
|
||||
'type' => 'image',
|
||||
'path' => $imagePath,
|
||||
'x' => (float) ($row->image_x ?? 0),
|
||||
'y' => (float) ($row->image_y ?? 0),
|
||||
'width' => (float) ($row->image_width ?? 0),
|
||||
'height' => (float) ($row->image_height ?? 0),
|
||||
// 'x' => (float) ($row->image_x ?? 0),
|
||||
// 'y' => (float) ($row->image_y ?? 0),
|
||||
// 'width' => (float) ($row->image_width ?? 0),
|
||||
// 'height' => (float) ($row->image_height ?? 0),
|
||||
'x' => $xImage,
|
||||
'y' => $yImage,
|
||||
'width' => $imageWidth,
|
||||
'height' => $imageHeight,
|
||||
];
|
||||
}
|
||||
elseif ($row->design_element_type == 'Shape') {
|
||||
@@ -1746,7 +1803,33 @@ class StickerPdfService
|
||||
}
|
||||
}
|
||||
|
||||
$pdf->Text($x, $y, (string) $textValue);
|
||||
// $pdf->Text($x, $y, (string) $textValue);
|
||||
if (str_contains((string) $textValue, "\n")) {
|
||||
|
||||
$pdf->SetXY($x, $y);
|
||||
|
||||
$pdf->MultiCell(
|
||||
$stickerWidth - $x - 2,
|
||||
5,
|
||||
(string) $textValue,
|
||||
0,
|
||||
'L',
|
||||
false,
|
||||
1,
|
||||
$x,
|
||||
$y,
|
||||
true,
|
||||
0,
|
||||
false,
|
||||
true,
|
||||
0,
|
||||
'T',
|
||||
false
|
||||
);
|
||||
|
||||
} else {
|
||||
$pdf->Text($x, $y, (string) $textValue);
|
||||
}
|
||||
}
|
||||
elseif ($element['type'] == 'qr') {
|
||||
|
||||
|
||||
Reference in New Issue
Block a user