Commit 7000c83f authored by arneyva's avatar arneyva
Browse files

fixing revisi qrcode after sidang

1 merge request!331fixing revisi qrcode after sidang
Showing with 28 additions and 29 deletions
+28 -29
......@@ -533,6 +533,14 @@ public function show(string $id)
$item['type'] = $product->type;
$item['image'] = $product->image ?? 'no-image.png';
$item['code'] = $product->code;
// buat QR Code
$qrCode = QrCode::create($product->code)
->setEncoding(new Encoding('ISO-8859-1'))
->setErrorCorrectionLevel(ErrorCorrectionLevel::Low)
->setSize(125)
->setMargin(10);
// Simpan data URI QR Code dalam item array
$item['qrCode'] = (new PngWriter())->write($qrCode)->getDataUri();
$item['Type_barcode'] = $product->Type_barcode;
$item['name'] = $product->name;
$item['cost'] = 'Rp ' . number_format($product->cost, 2, ',', '.');
......@@ -555,6 +563,14 @@ public function show(string $id)
$productVariants = ProductVariant::where('product_id', $product->id)->where('deleted_at', '=', null)->get();
foreach ($productVariants as $variant) {
$ProductVariant['code'] = $variant->code;
// buat QR Code
$qrCodeVariant = QrCode::create($variant->code)
->setEncoding(new Encoding('ISO-8859-1'))
->setErrorCorrectionLevel(ErrorCorrectionLevel::Low)
->setSize(75)
->setMargin(10);
// Simpan data URI QR Code dalam item array
$ProductVariant['qrCodeVariant'] = (new PngWriter())->write($qrCodeVariant)->getDataUri();
$ProductVariant['name'] = $variant->name;
$ProductVariant['cost'] = 'Rp ' . number_format($variant->cost, 2, ',', '.');
$ProductVariant['price'] = 'Rp ' . number_format($variant->price, 2, ',', '.');
......
......@@ -59,7 +59,8 @@ class="form-control"
id="discount_percentagevariant{{ $variant['variant-id'] }}_{{ $variant['mag'] }}"
class="form-control"
style="padding: 7px; border-radius: 7px; background-color: #eff3ff; color: #3b39d0;"
value="{{ $variant['discount_percentage'] ?? 0 }}" min="0" max="100">
value="{{ $variant['discount_percentage'] ?? 0 }}" min="0"
max="100">
</div>
<div class="form-group input-group">
<span class="input-group-text" id="basic-addon1"><svg
......@@ -105,7 +106,8 @@ class="form-control"
<input type="number" name="discount_percentage[{{ $qty['mag'] }}]"
id="discount_percentage{{ $qty['mag'] }}" class="form-control"
style="padding: 7px; border-radius: 7px; background-color: #eff3ff; color: #3b39d0;"
value="{{ $qty['discount_percentage'] ?? 0 }}" min="0" max="100">
value="{{ $qty['discount_percentage'] ?? 0 }}" min="0"
max="100">
</div>
<div class="form-group input-group">
<span class="input-group-text" id="basic-addon1"><svg
......@@ -144,20 +146,6 @@ class="form-control"
<div class="header-title">
<h4 class="card-title">{{ __('Product Information') }}</h4>
</div>
<span style="text-align: center; vertical-align: middle;margin-top: 30px">
@php
$generatorPNG = new Picqer\Barcode\BarcodeGeneratorPNG();
$barcodeData = base64_encode(
$generatorPNG->getBarcode($data[0]['code'], $generatorPNG::TYPE_CODE_128),
);
$barcodeUrl = 'data:image/png;base64,' . $barcodeData;
@endphp
<div style="display: flex; flex-direction: column; align-items: center;">
<img src="{{ $barcodeUrl }}" alt="Barcode" style="margin-bottom: 5px;">
<span>{{ $data[0]['code'] }}</span>
</div>
</span>
<a href="#"><button type="button" class="btn btn-soft-primary">Print</button></a>
</div>
<div class="card-body">
<div class="table-responsive mt-4">
......@@ -177,7 +165,13 @@ class="form-control"
@else
<td>{{ __('Code Base Product') }}</td>
@endif
<th>{{ $data[0]['code'] }}</th>
<th>
<div style="display: flex; flex-direction: column; align-items: center;"> <img
src="{{ $data[0]['qrCode'] }}" alt="QR Code"
style="margin-bottom: 5px;">
<span>{{ $data[0]['code'] }}</span>
</div>
</th>
</tr>
<tr>
<td>{{ __('Category') }}</td>
......@@ -237,20 +231,9 @@ class="form-control"
@foreach ($data[0]['products_variants_data'] as $variant)
<tr>
<td>{{ $variant['name'] }}</td>
{{-- <td>{{ $variant['code'] }}</td> --}}
<td style="text-align: center; vertical-align: middle;">
@php
$generatorPNG = new Picqer\Barcode\BarcodeGeneratorPNG();
$barcodeData = base64_encode(
$generatorPNG->getBarcode(
$variant['code'],
$generatorPNG::TYPE_CODE_128,
),
);
$barcodeUrl = 'data:image/png;base64,' . $barcodeData;
@endphp
<div style="display: flex; flex-direction: column; align-items: center;">
<img src="{{ $barcodeUrl }}" alt="Barcode"
<img src="{{ $variant['qrCodeVariant'] }}" alt="QR Code"
style="margin-bottom: 5px;">
<span>{{ $variant['code'] }}</span>
</div>
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment