ranjith-dev #1408

Merged
jothi merged 3 commits from ranjith-dev into master 2026-11-12 09:01:15 +00:00
3 changed files with 30 additions and 33 deletions

View File

@@ -723,7 +723,6 @@ class MotorTestingMasterResource extends Resource
}
})
->afterStateUpdated(function ($state, callable $set, callable $get) {
if ($state == 'Single' && $get('connection_type') == 'Star-Delta') {
$set('phase_type', 'Three');
}

View File

@@ -231,13 +231,9 @@ class TestingPanelController extends Controller
$uniqueInvalidCodes = array_unique($missedItemCodes);
if (! empty($uniqueInvalidCodes)) {
// return response("Item codes : ". implode(', ', $uniqueInvalidCodes)." not found in motor testing master for the specified plant {$plantName}", 400)
// ->header('Content-Type', 'text/plain');
return response()->json([
'status_code' => 'ERROR',
'status_description' => 'Item codes : '.implode(', ', $uniqueInvalidCodes)." not found in master for the specified plant : '{$plantName}'!",
'status_description' => 'Item codes : '.implode(', ', $uniqueInvalidCodes)." not found in motor testing master for the plant : '{$plantName}'!",
], 404);
}
@@ -895,13 +891,9 @@ class TestingPanelController extends Controller
$uniqueInvalidCodes = array_unique($missedItemCodes);
if (! empty($uniqueInvalidCodes)) {
// return response("Item codes : ". implode(', ', $uniqueInvalidCodes)." not found in motor testing master for the specified plant {$plantName}", 400)
// ->header('Content-Type', 'text/plain');
return response()->json([
'status_code' => 'ERROR',
'status_description' => 'Item codes : '.implode(', ', $uniqueInvalidCodes)." not found in master for the specified plant : '{$plantName}'!",
'status_description' => 'Item codes : '.implode(', ', $uniqueInvalidCodes)." not found in motor testing master table for the plant : '{$plantName}'!",
], 404);
}
@@ -1079,7 +1071,7 @@ class TestingPanelController extends Controller
if (! $motorTestingMaster) {
return response()->json([
'status_code' => 'ERROR',
'status_description' => "Item code not found in motor testing master table for the plant : '$plantName'!",
'status_description' => "Item code not found in motor testing master table for the plant : '{$plantName}'!",
], 404);
}

View File

@@ -1614,29 +1614,8 @@ class StickerPdfService
$stickerHeight = (float) $template['height'];
$stickerId = $template['sticker_id'] ?? null;
// $gap = 5.0;
// $count = ($toSerial - $fromSerial) + 1;
// $totalHeight =
// ($stickerHeight * $count)
// +
// ($gap * ($count - 1));
$orientation = $stickerWidth > $stickerHeight ? 'L' : 'P';
// $pdf = new TCPDF(
// 'P',
// 'mm',
// [
// $stickerWidth,
// $stickerHeight
// ],
// true,
// 'UTF-8',
// false
// );
$pdf = new TCPDF($orientation, 'mm', [$stickerWidth, $stickerHeight], true, 'UTF-8', false);
$pdf->setPrintHeader(false);
@@ -1714,6 +1693,18 @@ class StickerPdfService
$pdf->SetFont($element['font'], '', $element['size']);
$font = $element['font'] ?? 'helvetica';
$fontSize = (float) ($element['size'] ?? 10);
// if (
// ($element['characteristics_type'] ?? '') == 'feed_address'
// && mb_strlen((string) $textValue) > 61
// ) {
// $fontSize = max(6, $fontSize - 2);
// }
$pdf->SetFont($font, '', $fontSize);
$x = (float) $element['x'];
$y = $element['y'] + $currentY;
@@ -1737,7 +1728,22 @@ class StickerPdfService
$x = $leftMargin;
}
}
if($stickerId == 'SelfPriming Monoblock Pump'){
$leftMargin = 10;
$rightMargin = 10;
$usableWidth = 85 - $leftMargin - $rightMargin; // 65mm
$textWidth = $pdf->GetStringWidth((string) $textValue);
// Center the address within the available width
$x = $leftMargin + (($usableWidth - $textWidth) / 2);
// Prevent the address from starting before the left margin
if ($textWidth > $usableWidth) {
$x = $leftMargin;
}
}
}
$pdf->Text($x, $y, (string) $textValue);