Skip to content

Commit

Permalink
qr code warning
Browse files Browse the repository at this point in the history
  • Loading branch information
spencerrlongg committed Jan 29, 2025
1 parent fd60ce1 commit 4e3e247
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 2 deletions.
5 changes: 4 additions & 1 deletion app/Http/Controllers/Assets/AssetsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -531,7 +531,7 @@ public function getAssetByTag(Request $request, $tag=null) : RedirectResponse
* @param int $assetId
* @since [v1.0]
*/
public function getQrCode($assetId = null) : Response | BinaryFileResponse | string | bool
public function getQrCode($assetId = null): Response|BinaryFileResponse|string|bool
{
$settings = Setting::getSettings();

Expand All @@ -548,6 +548,9 @@ public function getQrCode($assetId = null) : Response | BinaryFileResponse | str
return response()->file($qr_file, $header);
} else {
$barcode = new \Com\Tecnick\Barcode\Barcode();
if ($settings->label2_2d_type == 'none') {
return false;
}
$barcode_obj = $barcode->getBarcodeObj($settings->label2_2d_type, route('hardware.show', $asset->id), $size['height'], $size['width'], 'black', [-2, -2, -2, -2]);
file_put_contents($qr_file, $barcode_obj->getPngData());

Expand Down
1 change: 1 addition & 0 deletions resources/lang/en-US/admin/settings/general.php
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,7 @@
'labels_pagewidth' => 'Label sheet width',
'labels_pageheight' => 'Label sheet height',
'label_gutters' => 'Label spacing (inches)',
'label_qr_setting_invalid' => 'Your QR Code type is set to \'None\', but you have enabled QR Codes. Please select a QR Code type.',
'page_dimensions' => 'Page dimensions (inches)',
'label_fields' => 'Label visible fields',
'inches' => 'inches',
Expand Down
12 changes: 11 additions & 1 deletion resources/views/hardware/labels.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,10 @@
.next-padding {
margin: {{ $settings->labels_pmargin_top }}in {{ $settings->labels_pmargin_right }}in {{ $settings->labels_pmargin_bottom }}in {{ $settings->labels_pmargin_left }}in;
}
.qr-warning {
color: red;
}
@media print {
.noprint {
display: none !important;
Expand All @@ -105,12 +109,18 @@
{!! $snipeSettings->show_custom_css() !!}
@endif
</style>
@if ($settings->qr_code=='1' && ($settings->label2_2d_type == 'none'))
<div class="qr-warning">
<p></p>
{{ __('admin/settings/general.label_qr_setting_invalid') }}
</div>
@endif

@foreach ($assets as $asset)
<?php $count++; ?>
<div class="label">

@if ($settings->qr_code=='1')
@if ($settings->qr_code=='1' && (!$settings->label2_2d_type == 'none'))
<div class="qr_img">
<img src="{{ config('app.url') }}/hardware/{{ $asset->id }}/qr_code" class="qr_img">
</div>
Expand Down

0 comments on commit 4e3e247

Please sign in to comment.