From b33c0fc4dd48d894d744c83cae2d914c7c35c2eb Mon Sep 17 00:00:00 2001 From: Godfrey M Date: Tue, 17 Sep 2024 16:15:56 -0700 Subject: [PATCH] updates getbarcode method and labels view --- .../Controllers/Assets/AssetsController.php | 4 +- resources/views/settings/labels.blade.php | 139 ++++++++++-------- 2 files changed, 83 insertions(+), 60 deletions(-) diff --git a/app/Http/Controllers/Assets/AssetsController.php b/app/Http/Controllers/Assets/AssetsController.php index 2a15747d33..075a499345 100755 --- a/app/Http/Controllers/Assets/AssetsController.php +++ b/app/Http/Controllers/Assets/AssetsController.php @@ -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'); diff --git a/resources/views/settings/labels.blade.php b/resources/views/settings/labels.blade.php index e7f352c01b..6746f3626f 100644 --- a/resources/views/settings/labels.blade.php +++ b/resources/views/settings/labels.blade.php @@ -139,64 +139,90 @@ @endif - -
-
- {{ Form::label('label2_1d_type', trans('admin/settings/general.label2_1d_type'), ['class'=>'control-label']) }} -
-
- @php - $select1DValues = [ - 'C128' => 'C128', - 'C39' => 'C39', - 'EAN5' => 'EAN5', - 'EAN13' => 'EAN13', - 'UPCA' => 'UPCA', - 'UPCE' => 'UPCE', - 'none' => trans('admin/settings/general.none'), - ]; - @endphp - {{ Form::select('label2_1d_type', $select1DValues, old('label2_1d_type', $setting->label2_1d_type), [ 'class'=>'select2 col-md-4', 'aria-label'=>'label2_1d_type' ]) }} - {!! $errors->first('label2_1d_type', '') !!} -

- {{ trans('admin/settings/general.label2_1d_type_help') }}. - {!! - trans('admin/settings/general.help_default_will_use', [ - 'default' => trans('admin/settings/general.default'), - 'setting_name' => trans('admin/settings/general.barcodes').' > '.trans('admin/settings/general.alt_barcode_type'), - ]) - !!} -

-
-
+ @if($setting->label2_enable == 0) + @if ($is_gd_installed) + +
- -
-
- {{ Form::label('label2_2d_type', trans('admin/settings/general.label2_2d_type'), ['class'=>'control-label']) }} -
-
- @php - $select2DValues = [ - 'QRCODE' => 'QRCODE', - 'DATAMATRIX' => 'DATAMATRIX', - 'PDF417' => 'PDF417', - 'none' => trans('admin/settings/general.none'), - ]; - @endphp - {{ Form::select('label2_2d_type', $select2DValues, old('label2_2d_type', $setting->label2_2d_type), [ 'class'=>'select2 col-md-4', 'aria-label'=>'label2_2d_type' ]) }} - {!! $errors->first('label2_2d_type', '') !!} -

- {{ trans('admin/settings/general.label2_2d_type_help', ['current' => $setting->barcode_type]) }}. - {!! - trans('admin/settings/general.help_default_will_use', [ - 'default' => trans('admin/settings/general.default'), - 'setting_name' => trans('admin/settings/general.barcodes').' > '.trans('admin/settings/general.barcode_type'), - ]) - !!} -

+
+ +
+
+ @endif + @endif + +
+
+ {{ Form::label('label2_1d_type', trans('admin/settings/general.label2_1d_type'), ['class'=>'control-label']) }} +
+
+ @php + $select1DValues = [ + 'C128' => 'C128', + 'C39' => 'C39', + 'EAN5' => 'EAN5', + 'EAN13' => 'EAN13', + 'UPCA' => 'UPCA', + 'UPCE' => 'UPCE', + 'none' => trans('admin/settings/general.none'), + ]; + @endphp + {{ Form::select('label2_1d_type', $select1DValues, old('label2_1d_type', $setting->label2_1d_type), [ 'class'=>'select2 col-md-4', 'aria-label'=>'label2_1d_type' ]) }} + {!! $errors->first('label2_1d_type', '') !!} +

+ {{ trans('admin/settings/general.label2_1d_type_help') }}. + {!! + trans('admin/settings/general.help_default_will_use', [ + 'default' => trans('admin/settings/general.default'), + 'setting_name' => trans('admin/settings/general.barcodes').' > '.trans('admin/settings/general.alt_barcode_type'), + ]) + !!} +

+
+ @if($setting->label2_enable == 0) + + +
+
+
+
+ @endif + +
+
+ {{ Form::label('label2_2d_type', trans('admin/settings/general.label2_2d_type'), ['class'=>'control-label']) }} +
+
+ @php + $select2DValues = [ + 'QRCODE' => 'QRCODE', + 'DATAMATRIX' => 'DATAMATRIX', + 'PDF417' => 'PDF417', + 'none' => trans('admin/settings/general.none'), + ]; + @endphp + {{ Form::select('label2_2d_type', $select2DValues, old('label2_2d_type', $setting->label2_2d_type), [ 'class'=>'select2 col-md-4', 'aria-label'=>'label2_2d_type' ]) }} + {!! $errors->first('label2_2d_type', '') !!} +

+ {{ trans('admin/settings/general.label2_2d_type_help', ['current' => $setting->barcode_type]) }}. + {!! + trans('admin/settings/general.help_default_will_use', [ + 'default' => trans('admin/settings/general.default'), + 'setting_name' => trans('admin/settings/general.barcodes').' > '.trans('admin/settings/general.barcode_type'), + ]) + !!} +

+
+
+ @if($setting->label2_enable == 0)
@@ -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