Merge pull request #15446 from Godmartinz/barcode_settings_hide
Refactored Barcode Settings into Label Settings
This commit is contained in:
commit
edacc4eb54
9 changed files with 256 additions and 339 deletions
|
@ -538,7 +538,7 @@ class AssetsController extends Controller
|
|||
if ($settings->qr_code == '1') {
|
||||
$asset = Asset::withTrashed()->find($assetId);
|
||||
if ($asset) {
|
||||
$size = Helper::barcodeDimensions($settings->barcode_type);
|
||||
$size = Helper::barcodeDimensions($settings->label2_2d_type);
|
||||
$qr_file = public_path().'/uploads/barcodes/qr-'.str_slug($asset->asset_tag).'-'.str_slug($asset->id).'.png';
|
||||
|
||||
if (isset($asset->id, $asset->asset_tag)) {
|
||||
|
@ -548,7 +548,7 @@ class AssetsController extends Controller
|
|||
return response()->file($qr_file, $header);
|
||||
} else {
|
||||
$barcode = new \Com\Tecnick\Barcode\Barcode();
|
||||
$barcode_obj = $barcode->getBarcodeObj($settings->barcode_type, route('hardware.show', $asset->id), $size['height'], $size['width'], 'black', [-2, -2, -2, -2]);
|
||||
$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());
|
||||
|
||||
return response($barcode_obj->getPngData())->header('Content-type', 'image/png');
|
||||
|
@ -573,7 +573,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)) {
|
||||
|
@ -586,7 +586,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');
|
||||
|
|
|
@ -695,48 +695,6 @@ class SettingsController extends Controller
|
|||
return redirect()->back()->withInput()->withErrors($setting->getErrors());
|
||||
}
|
||||
|
||||
/**
|
||||
* Return a form to allow a super admin to update settings.
|
||||
*
|
||||
* @author [A. Gianotto] [<snipe@snipe.net>]
|
||||
*
|
||||
* @since [v1.0]
|
||||
*/
|
||||
public function getBarcodes() : View
|
||||
{
|
||||
$setting = Setting::getSettings();
|
||||
$is_gd_installed = extension_loaded('gd');
|
||||
|
||||
return view('settings.barcodes', compact('setting'))->with('is_gd_installed', $is_gd_installed);
|
||||
}
|
||||
|
||||
/**
|
||||
* Saves settings from form.
|
||||
*
|
||||
* @author [A. Gianotto] [<snipe@snipe.net>]
|
||||
*
|
||||
* @since [v1.0]
|
||||
*/
|
||||
public function postBarcodes(Request $request) : RedirectResponse
|
||||
{
|
||||
if (is_null($setting = Setting::getSettings())) {
|
||||
return redirect()->to('admin')->with('error', trans('admin/settings/message.update.error'));
|
||||
}
|
||||
|
||||
$setting->qr_code = $request->input('qr_code', '0');
|
||||
$setting->alt_barcode = $request->input('alt_barcode');
|
||||
$setting->alt_barcode_enabled = $request->input('alt_barcode_enabled', '0');
|
||||
$setting->barcode_type = $request->input('barcode_type');
|
||||
$setting->qr_text = $request->input('qr_text');
|
||||
|
||||
if ($setting->save()) {
|
||||
return redirect()->route('settings.index')
|
||||
->with('success', trans('admin/settings/message.update.success'));
|
||||
}
|
||||
|
||||
return redirect()->back()->withInput()->withErrors($setting->getErrors());
|
||||
}
|
||||
|
||||
/**
|
||||
* Return a form to allow a super admin to update settings.
|
||||
*
|
||||
|
@ -762,8 +720,11 @@ class SettingsController extends Controller
|
|||
*/
|
||||
public function getLabels() : View
|
||||
{
|
||||
$is_gd_installed = extension_loaded('gd');
|
||||
|
||||
return view('settings.labels')
|
||||
->with('setting', Setting::getSettings())
|
||||
->with('is_gd_installed', $is_gd_installed)
|
||||
->with('customFields', CustomField::where('field_encrypted', '=', 0)->get());
|
||||
}
|
||||
|
||||
|
@ -799,9 +760,13 @@ class SettingsController extends Controller
|
|||
$setting->labels_pagewidth = $request->input('labels_pagewidth');
|
||||
$setting->labels_pageheight = $request->input('labels_pageheight');
|
||||
$setting->labels_display_company_name = $request->input('labels_display_company_name', '0');
|
||||
$setting->labels_display_company_name = $request->input('labels_display_company_name', '0');
|
||||
|
||||
|
||||
//Barcodes
|
||||
$setting->qr_code = $request->input('qr_code', '0');
|
||||
//1D-Barcode
|
||||
$setting->alt_barcode_enabled = $request->input('alt_barcode_enabled', '0');
|
||||
//QR-Code
|
||||
$setting->qr_text = $request->input('qr_text');
|
||||
|
||||
if ($request->filled('labels_display_name')) {
|
||||
$setting->labels_display_name = 1;
|
||||
|
|
|
@ -0,0 +1,46 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
// Copy values if target columns are blank
|
||||
DB::table('settings')->whereNull('label2_2d_type')->orWhere('label2_2d_type', '')->update([
|
||||
'label2_2d_type' => DB::raw('barcode_type')
|
||||
]);
|
||||
|
||||
DB::table('settings')->whereNull('label2_1d_type')->orWhere('label2_1d_type', '')->update([
|
||||
'label2_1d_type' => DB::raw('alt_barcode')
|
||||
]);
|
||||
|
||||
|
||||
Schema::table('settings', function (Blueprint $table) {
|
||||
$table->dropColumn(['barcode_type', 'alt_barcode']);
|
||||
});
|
||||
}
|
||||
|
||||
public function down()
|
||||
{
|
||||
Schema::table('settings', function (Blueprint $table) {
|
||||
// Re-add the columns that were dropped in case of rollback
|
||||
$table->string('barcode_type')->nullable();
|
||||
$table->string('alt_barcode')->nullable();
|
||||
});
|
||||
|
||||
DB::table('settings')->whereNull('barcode_type')->orWhere('barcode_type', '')->update([
|
||||
'barcode_type' => DB::raw('label2_2d_type')
|
||||
]);
|
||||
|
||||
DB::table('settings')->whereNull('alt_barcode')->orWhere('alt_barcode', '')->update([
|
||||
'alt_barcode' => DB::raw('label2_1d_type')
|
||||
]);
|
||||
}
|
||||
};
|
|
@ -55,7 +55,7 @@ return [
|
|||
'display_asset_name' => 'Display Asset Name',
|
||||
'display_checkout_date' => 'Display Checkout Date',
|
||||
'display_eol' => 'Display EOL in table view',
|
||||
'display_qr' => 'Display Square Codes',
|
||||
'display_qr' => 'Display 2D barcode',
|
||||
'display_alt_barcode' => 'Display 1D barcode',
|
||||
'email_logo' => 'Email Logo',
|
||||
'barcode_type' => '2D Barcode Type',
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
$settings->labels_width = $settings->labels_width - $settings->labels_display_sgutter;
|
||||
$settings->labels_height = $settings->labels_height - $settings->labels_display_bgutter;
|
||||
// Leave space on bottom for 1D barcode if necessary
|
||||
$qr_size = ($settings->alt_barcode_enabled=='1') && ($settings->alt_barcode!='') ? $settings->labels_height - .3 : $settings->labels_height - 0.1;
|
||||
$qr_size = ($settings->alt_barcode_enabled=='1') && ($settings->label2_1d_type!='') ? $settings->labels_height - .3 : $settings->labels_height - 0.1;
|
||||
?>
|
||||
|
||||
<style>
|
||||
|
@ -156,7 +156,7 @@ $qr_size = ($settings->alt_barcode_enabled=='1') && ($settings->alt_barcode!='')
|
|||
|
||||
</div>
|
||||
|
||||
@if ((($settings->alt_barcode_enabled=='1') && $settings->alt_barcode!=''))
|
||||
@if ((($settings->alt_barcode_enabled=='1') && $settings->label2_1d_type!=''))
|
||||
<div class="barcode_container">
|
||||
<img src="{{ config('app.url') }}/hardware/{{ $asset->id }}/barcode" class="barcode">
|
||||
</div>
|
||||
|
|
|
@ -1,213 +0,0 @@
|
|||
@extends('layouts/default')
|
||||
|
||||
{{-- Page title --}}
|
||||
@section('title')
|
||||
{{ trans('admin/settings/general.barcode_title') }}
|
||||
@parent
|
||||
@stop
|
||||
|
||||
@section('header_right')
|
||||
<a href="{{ route('settings.index') }}" class="btn btn-primary"> {{ trans('general.back') }}</a>
|
||||
@stop
|
||||
|
||||
|
||||
{{-- Page content --}}
|
||||
@section('content')
|
||||
|
||||
<style>
|
||||
.checkbox label {
|
||||
padding-right: 40px;
|
||||
}
|
||||
</style>
|
||||
|
||||
|
||||
{{ Form::open(['method' => 'POST', 'files' => false, 'autocomplete' => 'off', 'class' => 'form-horizontal', 'role' => 'form' ]) }}
|
||||
<!-- CSRF Token -->
|
||||
{{csrf_field()}}
|
||||
|
||||
<div class="row">
|
||||
<div class="col-sm-10 col-sm-offset-1 col-md-8 col-md-offset-2">
|
||||
|
||||
|
||||
<div class="panel box box-default">
|
||||
<div class="box-header with-border">
|
||||
<h2 class="box-title">
|
||||
<x-icon type="assets"/>
|
||||
{{ trans('admin/settings/general.barcodes') }}
|
||||
</h2>
|
||||
</div>
|
||||
<div class="box-body">
|
||||
|
||||
|
||||
<div class="col-md-11 col-md-offset-1">
|
||||
|
||||
@if ($is_gd_installed)
|
||||
<!-- 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>
|
||||
|
||||
<!-- square barcode type -->
|
||||
<div class="form-group{{ $errors->has('barcode_type') ? ' has-error' : '' }}">
|
||||
<div class="col-md-3">
|
||||
{{ Form::label('barcode_type', trans('admin/settings/general.barcode_type')) }}
|
||||
</div>
|
||||
<div class="col-md-9">
|
||||
{!! Form::barcode_types('barcode_type', old('barcode_type', $setting->barcode_type), 'select2 col-md-4') !!}
|
||||
{!! $errors->first('barcode_type', '<span class="alert-msg" aria-hidden="true"><i class="fas fa-times" aria-hidden="true"></i> :message</span>') !!}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 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>
|
||||
|
||||
<!-- barcode type -->
|
||||
<div class="form-group{{ $errors->has('alt_barcode') ? ' has-error' : '' }}">
|
||||
<div class="col-md-3">
|
||||
{{ Form::label('alt_barcode', trans('admin/settings/general.alt_barcode_type')) }}
|
||||
</div>
|
||||
<div class="col-md-9">
|
||||
{!! Form::alt_barcode_types('alt_barcode', old('alt_barcode', $setting->alt_barcode), 'select2 col-md-4') !!}
|
||||
{!! $errors->first('barcode_type', '<span class="alert-msg" aria-hidden="true"><i class="fas fa-times" aria-hidden="true"></i> :message</span>') !!}
|
||||
</div>
|
||||
</div>
|
||||
@else
|
||||
<span class="help-block col-md-offset-3 col-md-12">
|
||||
{{ trans('admin/settings/general.php_gd_warning') }}
|
||||
<br>
|
||||
{{ trans('admin/settings/general.php_gd_info') }}
|
||||
</span>
|
||||
@endif
|
||||
|
||||
<!-- qr text -->
|
||||
<div class="form-group {{ $errors->has('qr_text') ? 'error' : '' }}">
|
||||
<div class="col-md-3">
|
||||
{{ Form::label('qr_text', trans('admin/settings/general.qr_text')) }}
|
||||
</div>
|
||||
<div class="col-md-9">
|
||||
@if ($setting->qr_code == 1)
|
||||
{{ Form::text('qr_text', old('qr_text', $setting->qr_text), array('class' => 'form-control','placeholder' => 'Property of Your Company',
|
||||
'rel' => 'txtTooltip',
|
||||
'title' =>'Extra text that you would like to display on your labels. ',
|
||||
'data-toggle' =>'tooltip',
|
||||
'data-placement'=>'top')) }}
|
||||
{!! $errors->first('qr_text', '<span class="alert-msg" aria-hidden="true">:message</span>') !!}
|
||||
@else
|
||||
{{ Form::text('qr_text', old('qr_text', $setting->qr_text), array('class' => 'form-control', 'disabled'=>'disabled','placeholder' => 'Property of Your Company')) }}
|
||||
<p class="help-block">{{ trans('admin/settings/general.qr_help') }}</p>
|
||||
@endif
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Nuke barcode cache -->
|
||||
<div class="form-group">
|
||||
<div class="col-md-3">
|
||||
{{ Form::label('purge_barcodes', 'Purge Barcodes') }}
|
||||
</div>
|
||||
<div class="col-md-9" id="purgebarcodesrow">
|
||||
<a class="btn btn-default btn-sm pull-left" id="purgebarcodes" style="margin-right: 10px;">
|
||||
{{ trans('admin/settings/general.barcode_delete_cache') }}</a>
|
||||
<span id="purgebarcodesicon"></span>
|
||||
<span id="purgebarcodesresult"></span>
|
||||
<span id="purgebarcodesstatus"></span>
|
||||
</div>
|
||||
<div class="col-md-9 col-md-offset-3">
|
||||
<div id="purgebarcodesstatus-error" class="text-danger"></div>
|
||||
</div>
|
||||
<div class="col-md-9 col-md-offset-3">
|
||||
<p class="help-block">{{ trans('admin/settings/general.barcodes_help') }}</p>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
</div> <!--/.box-body-->
|
||||
<div class="box-footer">
|
||||
<div class="text-left col-md-6">
|
||||
<a class="btn btn-link text-left" href="{{ route('settings.index') }}">{{ trans('button.cancel') }}</a>
|
||||
</div>
|
||||
<div class="text-right col-md-6">
|
||||
<button type="submit" class="btn btn-success"><x-icon type="checkmark" /> {{ trans('general.save') }}</button>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div> <!-- /box -->
|
||||
</div> <!-- /.col-md-8-->
|
||||
</div> <!-- /.row-->
|
||||
|
||||
{{Form::close()}}
|
||||
|
||||
@stop
|
||||
|
||||
@push('js')
|
||||
|
||||
<script nonce="{{ csrf_token() }}">
|
||||
// Delete barcodes
|
||||
$("#purgebarcodes").click(function(){
|
||||
$("#purgebarcodesrow").removeClass('text-success');
|
||||
$("#purgebarcodesrow").removeClass('text-danger');
|
||||
$("#purgebarcodesicon").html('');
|
||||
$("#purgebarcodesstatus").html('');
|
||||
$('#purgebarcodesstatus-error').html('');
|
||||
$("#purgebarcodesicon").html('<i class="fas fa-spinner spin"></i> {{ trans('admin/settings/general.barcodes_spinner') }}');
|
||||
$.ajax({
|
||||
url: '{{ route('api.settings.purgebarcodes') }}',
|
||||
type: 'POST',
|
||||
headers: {
|
||||
"X-Requested-With": 'XMLHttpRequest',
|
||||
"X-CSRF-TOKEN": $('meta[name="csrf-token"]').attr('content')
|
||||
},
|
||||
data: {},
|
||||
dataType: 'json',
|
||||
|
||||
success: function (data) {
|
||||
console.dir(data);
|
||||
$("#purgebarcodesicon").html('');
|
||||
$("#purgebarcodesstatus").html('');
|
||||
$('#purgebarcodesstatus-error').html('');
|
||||
$("#purgebarcodesstatus").removeClass('text-danger');
|
||||
$("#purgebarcodesstatus").addClass('text-success');
|
||||
if (data.message) {
|
||||
$("#purgebarcodesstatus").html('<i class="fas fa-check text-success"></i> ' + data.message);
|
||||
}
|
||||
},
|
||||
|
||||
error: function (data) {
|
||||
|
||||
$("#purgebarcodesicon").html('');
|
||||
$("#purgebarcodesstatus").html('');
|
||||
$('#purgebarcodesstatus-error').html('');
|
||||
$("#purgebarcodesstatus").removeClass('text-success');
|
||||
$("#purgebarcodesstatus").addClass('text-danger');
|
||||
$("#purgebarcodesicon").html('<i class="fas fa-exclamation-triangle text-danger"></i>');
|
||||
$('#purgebarcodesstatus').html('Files could not be deleted.');
|
||||
if (data.responseJSON) {
|
||||
$('#purgebarcodesstatus-error').html('Error: ' + data.responseJSON.messages);
|
||||
} else {
|
||||
console.dir(data);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
});
|
||||
});
|
||||
|
||||
</script>
|
||||
|
||||
@endpush
|
|
@ -187,21 +187,6 @@
|
|||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-md-4 col-lg-3 col-sm-6 col-xl-1">
|
||||
<div class="admin box box-default">
|
||||
<div class="box-body text-center">
|
||||
<h5>
|
||||
<a href="{{ route('settings.barcodes.index') }}" class="settings_button">
|
||||
<x-icon type="assets" class="fa-4x"/>
|
||||
<br><br>
|
||||
<span class="name">{{ trans('admin/settings/general.barcodes') }}</span>
|
||||
</a>
|
||||
</h5>
|
||||
<p class="help-block">{!! trans('admin/settings/general.barcodes_help_overview') !!}</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-md-4 col-lg-3 col-sm-6 col-xl-1">
|
||||
<div class="admin box box-default">
|
||||
<div class="box-body text-center">
|
||||
|
|
|
@ -138,66 +138,141 @@
|
|||
|
||||
</div>
|
||||
</div>
|
||||
@endif
|
||||
@if($setting->label2_enable == 0)
|
||||
@if ($is_gd_installed)
|
||||
<!-- barcode -->
|
||||
<div class="form-group">
|
||||
|
||||
<!-- 1D Barcode Type -->
|
||||
<div class="form-group{{ $errors->has('label2_1d_type') ? ' has-error' : '' }}">
|
||||
<div class="col-md-3 text-right">
|
||||
{{ Form::label('label2_1d_type', trans('admin/settings/general.label2_1d_type'), ['class'=>'control-label']) }}
|
||||
</div>
|
||||
<div class="col-md-7">
|
||||
@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', '<span class="alert-msg" aria-hidden="true"><i class="fas fa-times" aria-hidden="true"></i> :message</span>') !!}
|
||||
<p class="help-block">
|
||||
{{ 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'),
|
||||
])
|
||||
!!}
|
||||
</p>
|
||||
<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' : '' }}">
|
||||
<div class="col-md-3 text-right">
|
||||
{{ Form::label('label2_1d_type', trans('admin/settings/general.label2_1d_type'), ['class'=>'control-label']) }}
|
||||
</div>
|
||||
<div class="col-md-7">
|
||||
@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', '<span class="alert-msg" aria-hidden="true"><i class="fas fa-times" aria-hidden="true"></i> :message</span>') !!}
|
||||
<p class="help-block">
|
||||
{{ 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'),
|
||||
])
|
||||
!!}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
@if($setting->label2_enable == 0)
|
||||
|
||||
<!-- 2D Barcode Type -->
|
||||
<div class="form-group{{ $errors->has('label2_2d_type') ? ' has-error' : '' }}">
|
||||
<div class="col-md-3 text-right">
|
||||
{{ Form::label('label2_2d_type', trans('admin/settings/general.label2_2d_type'), ['class'=>'control-label']) }}
|
||||
</div>
|
||||
<div class="col-md-7">
|
||||
@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', '<span class="alert-msg" aria-hidden="true"><i class="fas fa-times" aria-hidden="true"></i> :message</span>') !!}
|
||||
<p class="help-block">
|
||||
{{ 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'),
|
||||
])
|
||||
!!}
|
||||
</p>
|
||||
</div>
|
||||
<!-- 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">
|
||||
{{ Form::label('label2_2d_type', trans('admin/settings/general.label2_2d_type'), ['class'=>'control-label']) }}
|
||||
</div>
|
||||
<div class="col-md-7">
|
||||
@php
|
||||
$select2DValues = [
|
||||
'QRCODE' => 'QRCODE',
|
||||
];
|
||||
if ($setting->label2_enable == 1) {
|
||||
$select2DValues['PDF417'] = 'PDF417';
|
||||
}
|
||||
$select2DValues = array_merge($select2DValues, [
|
||||
'DATAMATRIX' => 'DATAMATRIX',
|
||||
'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', '<span class="alert-msg" aria-hidden="true"><i class="fas fa-times" aria-hidden="true"></i> :message</span>') !!}
|
||||
<p class="help-block">
|
||||
{{ 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'),
|
||||
])
|
||||
!!}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@if($setting->label2_enable == 0)
|
||||
<!-- QR Text -->
|
||||
<div class="form-group{{ $errors->has('qr_text') ? ' has-error' : '' }}">
|
||||
<div class="col-md-3 text-right">
|
||||
{{ Form::label('qr_text', trans('admin/settings/general.qr_text'), ['class'=>'control-label']) }}
|
||||
</div>
|
||||
<div class="col-md-7">
|
||||
@if ($setting->qr_code == 1)
|
||||
{{ Form::text('qr_text', old('qr_text', $setting->qr_text), array(
|
||||
'class' => 'form-control',
|
||||
'placeholder' => 'Property of Your Company',
|
||||
'rel' => 'txtTooltip',
|
||||
'title' =>'Extra text that you would like to display on your labels.',
|
||||
'data-toggle' =>'tooltip',
|
||||
'data-placement'=>'top'
|
||||
)) }}
|
||||
@else
|
||||
{{ Form::text('qr_text', old('qr_text', $setting->qr_text), array(
|
||||
'class' => 'form-control',
|
||||
'disabled' => 'disabled',
|
||||
'placeholder' => 'Property of Your Company'
|
||||
)) }}
|
||||
<p class="help-block">{{ trans('admin/settings/general.qr_help') }}</p>
|
||||
@endif
|
||||
{!! $errors->first('qr_text', '<span class="alert-msg" aria-hidden="true"><i class="fas fa-times" aria-hidden="true"></i> :message</span>') !!}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Nuke barcode cache -->
|
||||
<div class="form-group">
|
||||
<div class="col-md-3 text-right">
|
||||
{{ Form::label('purge_barcodes', 'Purge Barcodes', ['class'=>'control-label']) }}
|
||||
</div>
|
||||
<div class="col-md-7">
|
||||
<a class="btn btn-default btn-sm pull-left" id="purgebarcodes" style="margin-right: 10px;">
|
||||
{{ trans('admin/settings/general.barcode_delete_cache') }}
|
||||
</a>
|
||||
<span id="purgebarcodesicon"></span>
|
||||
<span id="purgebarcodesresult"></span>
|
||||
<span id="purgebarcodesstatus"></span>
|
||||
{!! $errors->first('purgebarcodes', '<span class="alert-msg" aria-hidden="true"><i class="fas fa-times" aria-hidden="true"></i> :message</span>') !!}
|
||||
<p class="help-block">{{ trans('admin/settings/general.barcodes_help') }}</p>
|
||||
</div>
|
||||
</div>
|
||||
@endif
|
||||
@if ($setting->label2_enable)
|
||||
<!-- 2D Barcode Target -->
|
||||
<div class="form-group{{ $errors->has('label2_2d_target') ? ' has-error' : '' }}">
|
||||
<div class="col-md-3 text-right">
|
||||
|
@ -227,13 +302,11 @@
|
|||
@include('partials.bootstrap-table')
|
||||
|
||||
@else
|
||||
|
||||
<!-- Hidden version of new settings -->
|
||||
{{ 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
|
||||
|
||||
|
@ -258,6 +331,17 @@
|
|||
{{ Form::hidden('labels_display_company_name', old('labels_display_company_name', $setting->labels_display_company_name)) }}
|
||||
@else
|
||||
<!-- Legacy settings -->
|
||||
<style>
|
||||
.checkbox label {
|
||||
padding-right: 40px;
|
||||
}
|
||||
</style>
|
||||
|
||||
|
||||
{{ Form::open(['method' => 'POST', 'files' => false, 'autocomplete' => 'off', 'class' => 'form-horizontal', 'role' => 'form' ]) }}
|
||||
<!-- CSRF Token -->
|
||||
{{csrf_field()}}
|
||||
|
||||
<div class="form-group{{ $errors->has('labels_per_page') ? ' has-error' : '' }}">
|
||||
<div class="col-md-3 text-right">
|
||||
{{ Form::label('labels_per_page', trans('admin/settings/general.labels_per_page'), ['class'=>'control-label']) }}
|
||||
|
@ -430,6 +514,59 @@
|
|||
@stop
|
||||
|
||||
@push('js')
|
||||
<script nonce="{{ csrf_token() }}">
|
||||
// Delete barcodes
|
||||
$("#purgebarcodes").click(function(){
|
||||
$("#purgebarcodesrow").removeClass('text-success');
|
||||
$("#purgebarcodesrow").removeClass('text-danger');
|
||||
$("#purgebarcodesicon").html('');
|
||||
$("#purgebarcodesstatus").html('');
|
||||
$('#purgebarcodesstatus-error').html('');
|
||||
$("#purgebarcodesicon").html('<i class="fas fa-spinner spin"></i> {{ trans('admin/settings/general.barcodes_spinner') }}');
|
||||
$.ajax({
|
||||
url: '{{ route('api.settings.purgebarcodes') }}',
|
||||
type: 'POST',
|
||||
headers: {
|
||||
"X-Requested-With": 'XMLHttpRequest',
|
||||
"X-CSRF-TOKEN": $('meta[name="csrf-token"]').attr('content')
|
||||
},
|
||||
data: {},
|
||||
dataType: 'json',
|
||||
|
||||
success: function (data) {
|
||||
console.dir(data);
|
||||
$("#purgebarcodesicon").html('');
|
||||
$("#purgebarcodesstatus").html('');
|
||||
$('#purgebarcodesstatus-error').html('');
|
||||
$("#purgebarcodesstatus").removeClass('text-danger');
|
||||
$("#purgebarcodesstatus").addClass('text-success');
|
||||
if (data.message) {
|
||||
$("#purgebarcodesstatus").html('<i class="fas fa-check text-success"></i> ' + data.message);
|
||||
}
|
||||
},
|
||||
|
||||
error: function (data) {
|
||||
|
||||
$("#purgebarcodesicon").html('');
|
||||
$("#purgebarcodesstatus").html('');
|
||||
$('#purgebarcodesstatus-error').html('');
|
||||
$("#purgebarcodesstatus").removeClass('text-success');
|
||||
$("#purgebarcodesstatus").addClass('text-danger');
|
||||
$("#purgebarcodesicon").html('<i class="fas fa-exclamation-triangle text-danger"></i>');
|
||||
$('#purgebarcodesstatus').html('Files could not be deleted.');
|
||||
if (data.responseJSON) {
|
||||
$('#purgebarcodesstatus-error').html('Error: ' + data.responseJSON.messages);
|
||||
} else {
|
||||
console.dir(data);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
});
|
||||
});
|
||||
|
||||
</script>
|
||||
{{-- Can't use @script here because we're not in a livewire component so let's manually load --}}
|
||||
@livewireScripts
|
||||
@endpush
|
||||
|
|
|
@ -200,9 +200,6 @@ Route::group(['prefix' => 'admin', 'middleware' => ['auth', 'authorize:superuser
|
|||
Route::get('asset_tags', [SettingsController::class, 'getAssetTags'])->name('settings.asset_tags.index');
|
||||
Route::post('asset_tags', [SettingsController::class, 'postAssetTags'])->name('settings.asset_tags.save');
|
||||
|
||||
Route::get('barcodes', [SettingsController::class, 'getBarcodes'])->name('settings.barcodes.index');
|
||||
Route::post('barcodes', [SettingsController::class, 'postBarcodes'])->name('settings.barcodes.save');
|
||||
|
||||
Route::get('labels', [SettingsController::class, 'getLabels'])->name('settings.labels.index');
|
||||
Route::post('labels', [SettingsController::class, 'postLabels'])->name('settings.labels.save');
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue