Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed #5944 - added logo option for print-assets page #5950

Merged
merged 1 commit into from
Jul 24, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions app/Http/Controllers/SettingsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -169,11 +169,7 @@ public function postSaveFirstAdmin(SetupUserRequest $request)
$settings->alerts_enabled = 1;
$settings->pwd_secure_min = 10;
$settings->brand = 1;

if (!config('app.lock_passwords')) {
$settings->locale = $request->input('locale', 'en');
}

$settings->locale = $request->input('locale', 'en');
$settings->default_currency = $request->input('default_currency', "USD");
$settings->user_id = 1;
$settings->email_domain = $request->input('email_domain');
Expand Down Expand Up @@ -405,6 +401,8 @@ public function postBranding(ImageUploadRequest $request)
$setting->footer_text = $request->input('footer_text');
$setting->skin = $request->input('skin');
$setting->show_url_in_emails = $request->input('show_url_in_emails', '0');
$setting->logo_print_assets = $request->input('logo_print_assets', '0');



// Only allow the site name and CSS to be changed if lock_passwords is false
Expand Down Expand Up @@ -541,7 +539,9 @@ public function postLocalization(Request $request)
return redirect()->to('admin')->with('error', trans('admin/settings/message.update.error'));
}

$setting->locale = $request->input('locale', 'en');
if (!config('app.lock_passwords')) {
$setting->locale = $request->input('locale', 'en');
}
$setting->default_currency = $request->input('default_currency', '$');
$setting->date_display_format = $request->input('date_display_format');
$setting->time_display_format = $request->input('time_display_format');
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 AddLogoToPrintAssets extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('settings', function (Blueprint $table) {
$table->boolean('logo_print_assets')->default('0');
});


}

/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('settings', function (Blueprint $table) {
$table->dropColumn('logo_print_assets');
});
}
}
2 changes: 2 additions & 0 deletions resources/lang/en/admin/settings/general.php
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,8 @@
'login_remote_user_custom_logout_url_text' => 'Custom logout URL',
'login_remote_user_custom_logout_url_help' => 'If a url is provided here, users will get redirected to this URL after the user logs out of Snipe-IT. This is useful to close the user sessions of your Authentication provider correctly.',
'logo' => 'Logo',
'logo_print_assets' => 'Use in Print',
'logo_print_assets_help' => 'Use branding on printable asset lists ',
'full_multiple_companies_support_help_text' => 'Restricting users (including admins) assigned to companies to their company\'s assets.',
'full_multiple_companies_support_text' => 'Full Multiple Companies Support',
'show_in_model_list' => 'Show in Model Dropdowns',
Expand Down
15 changes: 14 additions & 1 deletion resources/views/settings/branding.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,20 @@
{!! $errors->first('brand', '<span class="alert-msg">:message</span>') !!}
</div>
</div>
<!-- remote load -->

<!-- Include logo in print assets -->
<div class="form-group">
<div class="col-md-3">
{{ Form::label('logo_print_assets', trans('admin/settings/general.logo_print_assets')) }}
</div>
<div class="col-md-9">
{{ Form::checkbox('logo_print_assets', '1', Input::old('logo_print_assets', $setting->logo_print_assets),array('class' => 'minimal')) }}
{{ trans('admin/settings/general.logo_print_assets_help') }}
</div>
</div>


<!-- show urls in emails-->
<div class="form-group">
<div class="col-md-3">
{{ Form::label('show_url_in_emails', trans('admin/settings/general.show_url_in_emails')) }}
Expand Down
2 changes: 1 addition & 1 deletion resources/views/settings/general.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@
</div>
<div class="col-md-9">
{{ Form::checkbox('load_remote', '1', Input::old('load_remote', $setting->load_remote),array('class' => 'minimal')) }}
{{ trans('admin/settings/general.load_remote_help_text') }}
<p class="help-block">{{ trans('admin/settings/general.load_remote_help_text') }}</p>
</div>
</div>

Expand Down
26 changes: 25 additions & 1 deletion resources/views/users/print.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,34 @@
padding: 3px;
font-size: 12px;
}

.print-logo {
max-height: 40px;
}

</style>
</head>
<body>
<h3>Assigned to {{ $show_user->present()->fullName() }}</h3>

@if ($snipeSettings->logo_print_assets=='1')
@if ($snipeSettings->brand == '3')

<h3>
@if ($snipeSettings->logo!='')
<img class="print-logo" src="{{ url('/') }}/uploads/{{ $snipeSettings->logo }}">
@endif
{{ $snipeSettings->site_name }}
</h3>
@elseif ($snipeSettings->brand == '2')
@if ($snipeSettings->logo!='')
<img class="print-logo" src="{{ url('/') }}/uploads/{{ $snipeSettings->logo }}">
@endif
@else
<h3>{{ $snipeSettings->site_name }}</h3>
@endif
@endif

<h4>Assigned to {{ $show_user->present()->fullName() }}</h4>

@if ($assets->count() > 0)
@php
Expand Down