Updated alignment on controller
All checks were successful
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 11s
All checks were successful
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 11s
This commit is contained in:
@@ -2,10 +2,8 @@
|
|||||||
|
|
||||||
namespace App\Http\Controllers;
|
namespace App\Http\Controllers;
|
||||||
|
|
||||||
use Filament\Facades\Filament;
|
|
||||||
use Filament\Notifications\Notification;
|
use Filament\Notifications\Notification;
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
|
|
||||||
use Mpdf\Mpdf;
|
use Mpdf\Mpdf;
|
||||||
use Mpdf\QrCode\Output;
|
use Mpdf\QrCode\Output;
|
||||||
use Mpdf\QrCode\QrCode;
|
use Mpdf\QrCode\QrCode;
|
||||||
@@ -23,11 +21,11 @@ class PalletController extends Controller
|
|||||||
public function downloadReprintQrPdf($palletNo)
|
public function downloadReprintQrPdf($palletNo)
|
||||||
{
|
{
|
||||||
$qrCode = new QrCode($palletNo);
|
$qrCode = new QrCode($palletNo);
|
||||||
$output = new Output\Png();
|
$output = new Output\Png;
|
||||||
$qrBinary = $output->output($qrCode, 100);
|
$qrBinary = $output->output($qrCode, 100);
|
||||||
$qrBase64 = base64_encode($qrBinary);
|
$qrBase64 = base64_encode($qrBinary);
|
||||||
|
|
||||||
return '
|
return '
|
||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<style>
|
<style>
|
||||||
@@ -42,10 +40,10 @@ class PalletController extends Controller
|
|||||||
<table class="sticker-table">
|
<table class="sticker-table">
|
||||||
<tr>
|
<tr>
|
||||||
<td class="qr-cell">
|
<td class="qr-cell">
|
||||||
<img class="qr" src="data:image/png;base64,' . $qrBase64 . '" alt="QR" />
|
<img class="qr" src="data:image/png;base64,'.$qrBase64.'" alt="QR" />
|
||||||
</td>
|
</td>
|
||||||
<td class="text-cell">
|
<td class="text-cell">
|
||||||
' . htmlspecialchars($palletNo) . '
|
'.htmlspecialchars($palletNo).'
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
@@ -76,8 +74,7 @@ class PalletController extends Controller
|
|||||||
// $mpdf->Output('qr-label.pdf', 'I');
|
// $mpdf->Output('qr-label.pdf', 'I');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function downloadReprintProcess($plant, $item, $process_order, $coil_number, $name)
|
||||||
public function downloadReprintProcess($plant,$item,$process_order,$coil_number,$name)
|
|
||||||
{
|
{
|
||||||
// dd($plant,$item,$process_order,$coil_number);
|
// dd($plant,$item,$process_order,$coil_number);
|
||||||
|
|
||||||
@@ -87,13 +84,13 @@ class PalletController extends Controller
|
|||||||
->where('coil_number', $coil_number)
|
->where('coil_number', $coil_number)
|
||||||
->first();
|
->first();
|
||||||
|
|
||||||
if (!$processOrder) {
|
if (! $processOrder) {
|
||||||
return response()->json(['error' => 'Process order not found'], 404);
|
return response()->json(['error' => 'Process order not found'], 404);
|
||||||
}
|
}
|
||||||
|
|
||||||
$receivedQuantity = $processOrder->received_quantity;
|
$receivedQuantity = $processOrder->received_quantity;
|
||||||
$machineName = $processOrder->machine_name;
|
$machineName = $processOrder->machine_name;
|
||||||
$user = $processOrder->created_by;
|
$user = $processOrder->created_by;
|
||||||
|
|
||||||
$icode = \App\Models\Item::find($item);
|
$icode = \App\Models\Item::find($item);
|
||||||
|
|
||||||
@@ -101,20 +98,20 @@ class PalletController extends Controller
|
|||||||
|
|
||||||
$plCode = $pCode->code;
|
$plCode = $pCode->code;
|
||||||
|
|
||||||
if (!$plCode) {
|
if (! $plCode) {
|
||||||
Notification::make()
|
Notification::make()
|
||||||
->title('Unknown Plant')
|
->title('Unknown Plant')
|
||||||
->body('Plant not found.')
|
->body('Plant not found.')
|
||||||
->warning()
|
->warning()
|
||||||
->send();
|
->send();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$icode) {
|
if (! $icode) {
|
||||||
Notification::make()
|
Notification::make()
|
||||||
->title('Unknown Item')
|
->title('Unknown Item')
|
||||||
->body('Item not found.')
|
->body('Item not found.')
|
||||||
->warning()
|
->warning()
|
||||||
->send();
|
->send();
|
||||||
}
|
}
|
||||||
|
|
||||||
$itCode = $icode->code;
|
$itCode = $icode->code;
|
||||||
@@ -123,16 +120,13 @@ class PalletController extends Controller
|
|||||||
->where('plant_id', $plant)
|
->where('plant_id', $plant)
|
||||||
->first();
|
->first();
|
||||||
|
|
||||||
|
if (! $itemAgaPlant) {
|
||||||
if (!$itemAgaPlant) {
|
Notification::make()
|
||||||
Notification::make()
|
->title('Unknown Item')
|
||||||
->title('Unknown Item')
|
->body("Item not found against plant code $plCode.")
|
||||||
->body("Item not found against plant code $plCode.")
|
->warning()
|
||||||
->warning()
|
->send();
|
||||||
->send();
|
} else {
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$itemDescription = $itemAgaPlant->description;
|
$itemDescription = $itemAgaPlant->description;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -142,11 +136,11 @@ class PalletController extends Controller
|
|||||||
$qrContent = "{$receivedQuantity}|{$itCode}|{$process_order}-{$coil_number}";
|
$qrContent = "{$receivedQuantity}|{$itCode}|{$process_order}-{$coil_number}";
|
||||||
|
|
||||||
$qrCode = new QrCode($qrContent);
|
$qrCode = new QrCode($qrContent);
|
||||||
$output = new Output\Png();
|
$output = new Output\Png;
|
||||||
$qrBinary = $output->output($qrCode, 100);
|
$qrBinary = $output->output($qrCode, 100);
|
||||||
$qrBase64 = base64_encode($qrBinary);
|
$qrBase64 = base64_encode($qrBinary);
|
||||||
|
|
||||||
return '
|
return '
|
||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<style>
|
<style>
|
||||||
@@ -159,15 +153,14 @@ class PalletController extends Controller
|
|||||||
margin: 0;
|
margin: 0;
|
||||||
padding: 0;
|
padding: 0;
|
||||||
width: 60mm;
|
width: 60mm;
|
||||||
height: 30mm;
|
|
||||||
font-size: 9pt;
|
font-size: 9pt;
|
||||||
font-family: "DejaVu Sans Condensed", "FreeSans", sans-serif;
|
font-family: "DejaVu Sans Condensed", "FreeSans", sans-serif;
|
||||||
}
|
}
|
||||||
|
|
||||||
.sticker-table {
|
.sticker-table {
|
||||||
width: 60mm;
|
width: 60mm;
|
||||||
height: 30mm;
|
|
||||||
border-collapse: collapse;
|
border-collapse: collapse;
|
||||||
|
page-break-inside: avoid;
|
||||||
}
|
}
|
||||||
|
|
||||||
.text-cell {
|
.text-cell {
|
||||||
@@ -175,16 +168,15 @@ class PalletController extends Controller
|
|||||||
vertical-align: top;
|
vertical-align: top;
|
||||||
font-size: 9pt;
|
font-size: 9pt;
|
||||||
padding-left: 2mm;
|
padding-left: 2mm;
|
||||||
padding-top: 6mm;
|
padding-top: 2mm; /* was 6mm ❌ */
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
|
line-height: 1.1; /* IMPORTANT */
|
||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
overflow: hidden;
|
width: 40mm;
|
||||||
text-overflow: ellipsis;
|
|
||||||
width: 40mm; /* Left side for text */
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.qr-cell {
|
.qr-cell {
|
||||||
width: 20mm; /* Right side for QR */
|
width: 20mm;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
vertical-align: middle;
|
vertical-align: middle;
|
||||||
}
|
}
|
||||||
@@ -196,16 +188,15 @@ class PalletController extends Controller
|
|||||||
}
|
}
|
||||||
|
|
||||||
.text-cell b {
|
.text-cell b {
|
||||||
font-size: 12pt;
|
font-size: 10pt; /* was 12pt ❌ */
|
||||||
font-weight: bold; /* bold value, same font size */
|
font-weight: bold;
|
||||||
}
|
}
|
||||||
|
|
||||||
img.qr {
|
img.qr {
|
||||||
width: 12mm;
|
width: 12mm;
|
||||||
height: 12mm;
|
height: 12mm;
|
||||||
display: block;
|
display: block;
|
||||||
margin-left: auto;
|
margin: auto;
|
||||||
margin-right: auto;
|
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
</head>
|
</head>
|
||||||
@@ -213,16 +204,16 @@ class PalletController extends Controller
|
|||||||
<table class="sticker-table">
|
<table class="sticker-table">
|
||||||
<tr>
|
<tr>
|
||||||
<td class="text-cell">
|
<td class="text-cell">
|
||||||
<span class="lbl">D/T</span>: ' . htmlspecialchars($nowDT) . '<br>
|
<span class="lbl">D/T</span>: '.htmlspecialchars($nowDT).'<br>
|
||||||
<span class="lbl">OP ID</span>: ' . htmlspecialchars($user) . '<br>
|
<span class="lbl">OP ID</span>: '.htmlspecialchars($user).'<br>
|
||||||
<span class="lbl">PO NO</span>: ' . htmlspecialchars($process_order) . '<br>
|
<span class="lbl">PO NO</span>: '.htmlspecialchars($process_order).'<br>
|
||||||
<span class="lbl">M/C</span>: ' . htmlspecialchars($itCode) . '<br>
|
<span class="lbl">M/C</span>: '.htmlspecialchars($itCode).'<br>
|
||||||
<span class="lbl">DES</span>: ' . htmlspecialchars($itemDescription) . '<br>
|
<span class="lbl">DES</span>: '.htmlspecialchars($itemDescription).'<br>
|
||||||
<span class="lbl">WGT</span>: <b>' . htmlspecialchars($receivedQuantity) . ' KGS</b><br>
|
<span class="lbl">WGT</span>: <b>'.htmlspecialchars($receivedQuantity).' KGS</b><br>
|
||||||
<span class="lbl">MAC</span>: ' . htmlspecialchars($machineName) . '
|
<span class="lbl">MAC</span>: '.htmlspecialchars($machineName).'
|
||||||
</td>
|
</td>
|
||||||
<td class="qr-cell">
|
<td class="qr-cell">
|
||||||
<img class="qr" src="data:image/png;base64,' . $qrBase64 . '" alt="QR" />
|
<img class="qr" src="data:image/png;base64,'.$qrBase64.'" alt="QR" />
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
@@ -236,28 +227,29 @@ class PalletController extends Controller
|
|||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
';
|
';
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function downloadQrPdf($palletNo)
|
public function downloadQrPdf($palletNo)
|
||||||
{
|
{
|
||||||
$qrCode = new QrCode($palletNo);
|
$qrCode = new QrCode($palletNo);
|
||||||
$output = new Output\Png();
|
$output = new Output\Png;
|
||||||
$qrBinary = $output->output($qrCode, 100);
|
$qrBinary = $output->output($qrCode, 100);
|
||||||
$qrBase64 = base64_encode($qrBinary);
|
$qrBase64 = base64_encode($qrBinary);
|
||||||
|
|
||||||
$htmlBlock = '
|
$htmlBlock = '
|
||||||
<table class="sticker-table">
|
<table class="sticker-table">
|
||||||
<tr>
|
<tr>
|
||||||
<td class="qr-cell">
|
<td class="qr-cell">
|
||||||
<img class="qr" src="data:image/png;base64,' . $qrBase64 . '" alt="QR" />
|
<img class="qr" src="data:image/png;base64,'.$qrBase64.'" alt="QR" />
|
||||||
</td>
|
</td>
|
||||||
<td class="text-cell">
|
<td class="text-cell">
|
||||||
' . htmlspecialchars($palletNo) . '
|
'.htmlspecialchars($palletNo).'
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>';
|
</table>';
|
||||||
|
|
||||||
return '
|
return '
|
||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<style>
|
<style>
|
||||||
@@ -269,7 +261,7 @@ class PalletController extends Controller
|
|||||||
</style>
|
</style>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
' . $htmlBlock . $htmlBlock . '
|
'.$htmlBlock.$htmlBlock.'
|
||||||
<script>
|
<script>
|
||||||
window.onload = function () {
|
window.onload = function () {
|
||||||
window.print();
|
window.print();
|
||||||
|
|||||||
Reference in New Issue
Block a user