Add a setting for the depreciation method

This commit is contained in:
Minaev Dmitriy 2018-08-23 20:49:20 +03:00
parent 49ecc08398
commit 8d3b201a49
3 changed files with 48 additions and 0 deletions

View file

@ -351,6 +351,8 @@ class SettingsController extends Controller
$setting->thumbnail_max_h = $request->input('thumbnail_max_h');
$setting->privacy_policy_link = $request->input('privacy_policy_link');
$setting->depreciation_method = $request->input('depreciation_method');
if (Input::get('per_page')!='') {
$setting->per_page = $request->input('per_page');
} else {

View file

@ -0,0 +1,32 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class AddDepreciationOptionToSettings extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('settings', function (Blueprint $table) {
$table->char('depreciation_method', 10)->nullable()->default('default');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('settings', function (Blueprint $table) {
$table->dropColumn('depreciation_method');
});
}
}

View file

@ -281,6 +281,20 @@
{{ Form::checkbox('show_in_model_list[]', 'model_number', Input::old('show_in_model_list', $snipeSettings->modellistCheckedValue('model_number')),array('class' => 'minimal')) }} {{ trans('general.model_no') }}<br>
</div>
</div>
<!-- Depreciation method -->
<div class="form-group {{ $errors->has('depreciation_method') ? 'error' : '' }}">
<div class="col-md-3">
{{ Form::label('depreciation_method', trans('Depreciation method')) }}
</div>
<div class="col-md-9">
{{ Form::select('depreciation_method', array(
'default' => 'Linear (default)',
'half_1' => 'Half-year convention, always applied',
'half_2' => 'Half-year convention, applied with condition',
), Input::old('username_format', $setting->depreciation_method)) }}
</div>
</div>
<!-- /.form-group -->
<!-- Privacy Policy Footer-->