updates getbarcode method and labels view

This commit is contained in:
Godfrey M 2024-09-17 16:15:56 -07:00
parent 033a56fe6d
commit b33c0fc4dd
2 changed files with 83 additions and 60 deletions

View file

@ -543,7 +543,7 @@ class AssetsController extends Controller
{
$settings = Setting::getSettings();
if ($asset = Asset::withTrashed()->find($assetId)) {
$barcode_file = public_path().'/uploads/barcodes/'.str_slug($settings->alt_barcode).'-'.str_slug($asset->asset_tag).'.png';
$barcode_file = public_path().'/uploads/barcodes/'.str_slug($settings->label2_1d_type).'-'.str_slug($asset->asset_tag).'.png';
if (isset($asset->id, $asset->asset_tag)) {
if (file_exists($barcode_file)) {
@ -556,7 +556,7 @@ class AssetsController extends Controller
$barcode = new \Com\Tecnick\Barcode\Barcode();
try {
$barcode_obj = $barcode->getBarcodeObj($settings->alt_barcode, $asset->asset_tag, ($barcode_width < 300 ? $barcode_width : 300), 50);
$barcode_obj = $barcode->getBarcodeObj($settings->label2_1d_type, $asset->asset_tag, ($barcode_width < 300 ? $barcode_width : 300), 50);
file_put_contents($barcode_file, $barcode_obj->getPngData());
return response($barcode_obj->getPngData())->header('Content-type', 'image/png');

View file

@ -138,6 +138,20 @@
</div>
</div>
@endif
@if($setting->label2_enable == 0)
@if ($is_gd_installed)
<!-- barcode -->
<div class="form-group">
<div class="col-md-9 col-md-offset-3">
<label class="form-control">
{{ Form::checkbox('alt_barcode_enabled', '1', old('alt_barcode_enabled', $setting->alt_barcode_enabled),array( 'aria-label'=>'alt_barcode_enabled')) }}
{{ trans('admin/settings/general.display_alt_barcode') }}
</label>
</div>
</div>
@endif
@endif
<!-- 1D Barcode Type -->
<div class="form-group{{ $errors->has('label2_1d_type') ? ' has-error' : '' }}">
@ -169,7 +183,18 @@
</p>
</div>
</div>
@if($setting->label2_enable == 0)
<!-- qr code -->
<div class="form-group">
<div class="col-md-9 col-md-offset-3">
<label class="form-control">
{{ Form::checkbox('qr_code', '1', old('qr_code', $setting->qr_code),array('aria-label'=>'qr_code')) }}
{{ trans('admin/settings/general.display_qr') }}
</label>
</div>
</div>
@endif
<!-- 2D Barcode Type -->
<div class="form-group{{ $errors->has('label2_2d_type') ? ' has-error' : '' }}">
<div class="col-md-3 text-right">
@ -197,6 +222,7 @@
</p>
</div>
</div>
@if($setting->label2_enable == 0)
<!-- QR Text -->
<div class="form-group{{ $errors->has('qr_text') ? ' has-error' : '' }}">
@ -277,9 +303,6 @@
{{ Form::hidden('label2_template', old('label2_template', $setting->label2_template)) }}
{{ Form::hidden('label2_title', old('label2_title', $setting->label2_title)) }}
{{ Form::hidden('label2_asset_logo', old('label2_asset_logo', $setting->label2_asset_logo)) }}
{{ Form::hidden('label2_1d_type', old('label2_1d_type', $setting->label2_1d_type)) }}
{{ Form::hidden('label2_2d_type', old('label2_2d_type', $setting->label2_2d_type)) }}
{{ Form::hidden('label2_2d_target', old('label2_2d_target', $setting->label2_2d_target)) }}
{{ Form::hidden('label2_fields', old('label2_fields', $setting->label2_fields)) }}
@endif