Skip to content

Commit

Permalink
Fixed #4374 - Add option to display company names to labels (#4405)
Browse files Browse the repository at this point in the history
* Migration - Labels Display Company Name setting

* Add Company Name to Labels

Add company name if it is turned on in settings and asset has a valid company

* Add Company Name checkbox to Label settings

* Add Company Name Lang

* Add display company name to postLabels

* Revert Add Company Name Lang

* Fix display company name in postLabels

* Change tinyInt to boolean for display company name

* Simplify checking for company and getting the name

* Change to square brackets for array notation

* Move divs inside if statements on optional fields
  • Loading branch information
madd15 authored and snipe committed Nov 9, 2017
1 parent 487fd17 commit 172c7c7
Show file tree
Hide file tree
Showing 4 changed files with 66 additions and 23 deletions.
1 change: 1 addition & 0 deletions app/Http/Controllers/SettingsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -748,6 +748,7 @@ public function postLabels(Request $request)
$setting->labels_fontsize = $request->input('labels_fontsize');
$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');



Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class LabelsDisplayCompanyName extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('settings', function (Blueprint $table) {
$table->boolean('labels_display_company_name')->default(0);
});
}

/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('settings', function ($table) {
$table->dropColumn(
'labels_display_company_name'
);
});
}
}
20 changes: 12 additions & 8 deletions resources/views/hardware/labels.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -112,28 +112,32 @@
@endif

<div class="qr_text">
<div class="pull-left">
@if ($settings->qr_text!='')
<div class="pull-left">
<strong>{{ $settings->qr_text }}</strong>
<br>
@endif
</div>
@endif
@if (($settings->labels_display_company_name=='1') && ($asset->company))
<div class="pull-left">
C: {{ $asset->company->name }}
</div>
@endif
@if (($settings->labels_display_name=='1') && ($asset->name!=''))
<div class="pull-left">
N: {{ $asset->name }}
@endif
</div>
<div class="pull-left">
@endif
@if (($settings->labels_display_tag=='1') && ($asset->asset_tag!=''))
<div class="pull-left">
T: {{ $asset->asset_tag }}
@endif
</div>
<div class="pull-left">
@endif
@if (($settings->labels_display_serial=='1') && ($asset->serial!=''))
<div class="pull-left">
S: {{ $asset->serial }}
</div>
@endif
</div>

</div>

@if ((($settings->alt_barcode_enabled=='1') && $settings->alt_barcode!=''))
Expand Down
34 changes: 19 additions & 15 deletions resources/views/settings/labels.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
{{ Form::label('labels_per_page', trans('admin/settings/general.labels_per_page')) }}
</div>
<div class="col-md-9">
{{ Form::text('labels_per_page', Input::old('labels_per_page', $setting->labels_per_page), array('class' => 'form-control','style' => 'width: 100px;')) }}
{{ Form::text('labels_per_page', Input::old('labels_per_page', $setting->labels_per_page), ['class' => 'form-control','style' => 'width: 100px;']) }}
{!! $errors->first('labels_per_page', '<span class="alert-msg">:message</span>') !!}
</div>
</div>
Expand All @@ -56,7 +56,7 @@
</div>
<div class="col-md-2 form-group">
<div class="input-group">
{{ Form::text('labels_fontsize', Input::old('labels_fontsize', $setting->labels_fontsize), array('class' => 'form-control')) }}
{{ Form::text('labels_fontsize', Input::old('labels_fontsize', $setting->labels_fontsize), ['class' => 'form-control']) }}
<div class="input-group-addon">{{ trans('admin/settings/general.text_pt') }}</div>
</div>
</div>
Expand All @@ -71,13 +71,13 @@
</div>
<div class="col-md-3 form-group">
<div class="input-group">
{{ Form::text('labels_width', Input::old('labels_width', $setting->labels_width), array('class' => 'form-control')) }}
{{ Form::text('labels_width', Input::old('labels_width', $setting->labels_width), ['class' => 'form-control']) }}
<div class="input-group-addon">{{ trans('admin/settings/general.width_w') }}</div>
</div>
</div>
<div class="col-md-3 form-group" style="margin-left: 10px">
<div class="input-group">
{{ Form::text('labels_height', Input::old('labels_height', $setting->labels_height), array('class' => 'form-control')) }}
{{ Form::text('labels_height', Input::old('labels_height', $setting->labels_height), ['class' => 'form-control']) }}
<div class="input-group-addon">{{ trans('admin/settings/general.height_h') }}</div>
</div>
</div>
Expand All @@ -93,13 +93,13 @@
</div>
<div class="col-md-3 form-group">
<div class="input-group">
{{ Form::text('labels_display_sgutter', Input::old('labels_display_sgutter', $setting->labels_display_sgutter), array('class' => 'form-control')) }}
{{ Form::text('labels_display_sgutter', Input::old('labels_display_sgutter', $setting->labels_display_sgutter), ['class' => 'form-control']) }}
<div class="input-group-addon">{{ trans('admin/settings/general.horizontal') }}</div>
</div>
</div>
<div class="col-md-3 form-group" style="margin-left: 10px">
<div class="input-group">
{{ Form::text('labels_display_bgutter', Input::old('labels_display_bgutter', $setting->labels_display_bgutter), array('class' => 'form-control')) }}
{{ Form::text('labels_display_bgutter', Input::old('labels_display_bgutter', $setting->labels_display_bgutter), ['class' => 'form-control']) }}
<div class="input-group-addon">{{ trans('admin/settings/general.vertical') }}</div>
</div>
</div>
Expand All @@ -115,21 +115,21 @@
</div>
<div class="col-md-3 form-group">
<div class="input-group" style="margin-bottom: 15px;">
{{ Form::text('labels_pmargin_top', Input::old('labels_pmargin_top', $setting->labels_pmargin_top), array('class' => 'form-control')) }}
{{ Form::text('labels_pmargin_top', Input::old('labels_pmargin_top', $setting->labels_pmargin_top), ['class' => 'form-control']) }}
<div class="input-group-addon">{{ trans('admin/settings/general.top') }}</div>
</div>
<div class="input-group">
{{ Form::text('labels_pmargin_right', Input::old('labels_pmargin_right', $setting->labels_pmargin_right), array('class' => 'form-control')) }}
{{ Form::text('labels_pmargin_right', Input::old('labels_pmargin_right', $setting->labels_pmargin_right), ['class' => 'form-control']) }}
<div class="input-group-addon">{{ trans('admin/settings/general.right') }}</div>
</div>
</div>
<div class="col-md-3 form-group" style="margin-left: 10px; ">
<div class="input-group" style="margin-bottom: 15px;">
{{ Form::text('labels_pmargin_bottom', Input::old('labels_pmargin_bottom', $setting->labels_pmargin_bottom), array('class' => 'form-control')) }}
{{ Form::text('labels_pmargin_bottom', Input::old('labels_pmargin_bottom', $setting->labels_pmargin_bottom), ['class' => 'form-control']) }}
<div class="input-group-addon">{{ trans('admin/settings/general.bottom') }}</div>
</div>
<div class="input-group">
{{ Form::text('labels_pmargin_left', Input::old('labels_pmargin_left', $setting->labels_pmargin_left), array('class' => 'form-control')) }}
{{ Form::text('labels_pmargin_left', Input::old('labels_pmargin_left', $setting->labels_pmargin_left), ['class' => 'form-control']) }}
<div class="input-group-addon">{{ trans('admin/settings/general.left') }}</div>
</div>
</div>
Expand All @@ -145,13 +145,13 @@
</div>
<div class="col-md-3 form-group">
<div class="input-group">
{{ Form::text('labels_pagewidth', Input::old('labels_pagewidth', $setting->labels_pagewidth), array('class' => 'form-control')) }}
{{ Form::text('labels_pagewidth', Input::old('labels_pagewidth', $setting->labels_pagewidth), ['class' => 'form-control']) }}
<div class="input-group-addon">{{ trans('admin/settings/general.width_w') }}</div>
</div>
</div>
<div class="col-md-3 form-group" style="margin-left: 10px">
<div class="input-group">
{{ Form::text('labels_pageheight', Input::old('labels_pageheight', $setting->labels_pageheight), array('class' => 'form-control')) }}
{{ Form::text('labels_pageheight', Input::old('labels_pageheight', $setting->labels_pageheight), ['class' => 'form-control']) }}
<div class="input-group-addon">{{ trans('admin/settings/general.height_h') }}</div>
</div>
</div>
Expand All @@ -168,17 +168,21 @@
<div class="col-md-9">
<div class="checkbox">
<label>
{{ Form::checkbox('labels_display_name', '1', Input::old('labels_display_name', $setting->labels_display_name),array('class' => 'minimal')) }}
{{ Form::checkbox('labels_display_name', '1', Input::old('labels_display_name', $setting->labels_display_name),['class' => 'minimal']) }}
{{ trans('admin/hardware/form.name') }}
</label>
<label>
{{ Form::checkbox('labels_display_serial', '1', Input::old('labels_display_serial', $setting->labels_display_serial),array('class' => 'minimal')) }}
{{ Form::checkbox('labels_display_serial', '1', Input::old('labels_display_serial', $setting->labels_display_serial),['class' => 'minimal']) }}
{{ trans('admin/hardware/form.serial') }}
</label>
<label>
{{ Form::checkbox('labels_display_tag', '1', Input::old('labels_display_tag', $setting->labels_display_tag),array('class' => 'minimal')) }}
{{ Form::checkbox('labels_display_tag', '1', Input::old('labels_display_tag', $setting->labels_display_tag),['class' => 'minimal']) }}
{{ trans('admin/hardware/form.tag') }}
</label>
<label>
{{ Form::checkbox('labels_display_company_name', '1', Input::old('labels_display_company_name', $setting->labels_display_company_name),['class' => 'minimal']) }}
{{ trans('admin/companies/table.name') }}
</label>
</div> <!--/.CHECKBOX-->
</div> <!--/.col-md-9-->
</div> <!--/.form-group-->
Expand Down

0 comments on commit 172c7c7

Please sign in to comment.