mirror of
https://github.com/snipe/snipe-it.git
synced 2025-02-01 08:00:58 -08:00
added front end barcodes to labels
This commit is contained in:
parent
df8b1c0240
commit
ce987b4f6d
|
@ -769,8 +769,11 @@ class SettingsController extends Controller
|
||||||
*/
|
*/
|
||||||
public function getLabels() : View
|
public function getLabels() : View
|
||||||
{
|
{
|
||||||
|
$is_gd_installed = extension_loaded('gd');
|
||||||
|
|
||||||
return view('settings.labels')
|
return view('settings.labels')
|
||||||
->with('setting', Setting::getSettings())
|
->with('setting', Setting::getSettings())
|
||||||
|
->with('is_gd_installed', $is_gd_installed)
|
||||||
->with('customFields', CustomField::where('field_encrypted', '=', 0)->get());
|
->with('customFields', CustomField::where('field_encrypted', '=', 0)->get());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -186,7 +186,7 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@if($settings->label2_enable == 0)
|
|
||||||
<div class="col-md-4 col-lg-3 col-sm-6 col-xl-1">
|
<div class="col-md-4 col-lg-3 col-sm-6 col-xl-1">
|
||||||
<div class="admin box box-default">
|
<div class="admin box box-default">
|
||||||
<div class="box-body text-center">
|
<div class="box-body text-center">
|
||||||
|
@ -201,7 +201,7 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@endif
|
|
||||||
|
|
||||||
<div class="col-md-4 col-lg-3 col-sm-6 col-xl-1">
|
<div class="col-md-4 col-lg-3 col-sm-6 col-xl-1">
|
||||||
<div class="admin box box-default">
|
<div class="admin box box-default">
|
||||||
|
|
|
@ -138,7 +138,7 @@
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@endif
|
||||||
<!-- 1D Barcode Type -->
|
<!-- 1D Barcode Type -->
|
||||||
<div class="form-group{{ $errors->has('label2_1d_type') ? ' has-error' : '' }}">
|
<div class="form-group{{ $errors->has('label2_1d_type') ? ' has-error' : '' }}">
|
||||||
<div class="col-md-3 text-right">
|
<div class="col-md-3 text-right">
|
||||||
|
@ -197,7 +197,52 @@
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
</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 -->
|
<!-- 2D Barcode Target -->
|
||||||
<div class="form-group{{ $errors->has('label2_2d_target') ? ' has-error' : '' }}">
|
<div class="form-group{{ $errors->has('label2_2d_target') ? ' has-error' : '' }}">
|
||||||
<div class="col-md-3 text-right">
|
<div class="col-md-3 text-right">
|
||||||
|
@ -227,6 +272,7 @@
|
||||||
@include('partials.bootstrap-table')
|
@include('partials.bootstrap-table')
|
||||||
|
|
||||||
@else
|
@else
|
||||||
|
|
||||||
<!-- Hidden version of new settings -->
|
<!-- Hidden version of new settings -->
|
||||||
{{ Form::hidden('label2_template', old('label2_template', $setting->label2_template)) }}
|
{{ Form::hidden('label2_template', old('label2_template', $setting->label2_template)) }}
|
||||||
{{ Form::hidden('label2_title', old('label2_title', $setting->label2_title)) }}
|
{{ Form::hidden('label2_title', old('label2_title', $setting->label2_title)) }}
|
||||||
|
@ -258,6 +304,17 @@
|
||||||
{{ Form::hidden('labels_display_company_name', old('labels_display_company_name', $setting->labels_display_company_name)) }}
|
{{ Form::hidden('labels_display_company_name', old('labels_display_company_name', $setting->labels_display_company_name)) }}
|
||||||
@else
|
@else
|
||||||
<!-- Legacy settings -->
|
<!-- 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="form-group{{ $errors->has('labels_per_page') ? ' has-error' : '' }}">
|
||||||
<div class="col-md-3 text-right">
|
<div class="col-md-3 text-right">
|
||||||
{{ Form::label('labels_per_page', trans('admin/settings/general.labels_per_page'), ['class'=>'control-label']) }}
|
{{ Form::label('labels_per_page', trans('admin/settings/general.labels_per_page'), ['class'=>'control-label']) }}
|
||||||
|
@ -430,6 +487,59 @@
|
||||||
@stop
|
@stop
|
||||||
|
|
||||||
@push('js')
|
@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 --}}
|
{{-- Can't use @script here because we're not in a livewire component so let's manually load --}}
|
||||||
@livewireScripts
|
@livewireScripts
|
||||||
@endpush
|
@endpush
|
||||||
|
|
|
@ -204,7 +204,7 @@ Route::group(['prefix' => 'admin', 'middleware' => ['auth', 'authorize:superuser
|
||||||
Route::get('barcodes', [SettingsController::class, 'getBarcodes'])->name('settings.barcodes.index');
|
Route::get('barcodes', [SettingsController::class, 'getBarcodes'])->name('settings.barcodes.index');
|
||||||
Route::post('barcodes', [SettingsController::class, 'postBarcodes'])->name('settings.barcodes.save');
|
Route::post('barcodes', [SettingsController::class, 'postBarcodes'])->name('settings.barcodes.save');
|
||||||
|
|
||||||
Route::get('labels', [SettingsController::class, 'getLabels'])->name('settings.labels.index');
|
Route::get('labels', [SettingsController::class, 'getLabels', 'getBarcodes'])->name('settings.labels.index');
|
||||||
Route::post('labels', [SettingsController::class, 'postLabels'])->name('settings.labels.save');
|
Route::post('labels', [SettingsController::class, 'postLabels'])->name('settings.labels.save');
|
||||||
|
|
||||||
Route::get('ldap', [SettingsController::class, 'getLdapSettings'])->name('settings.ldap.index');
|
Route::get('ldap', [SettingsController::class, 'getLdapSettings'])->name('settings.ldap.index');
|
||||||
|
|
Loading…
Reference in a new issue