A free open source IT asset/license management system
Added setting to choose dashboard type
snipe70c766e8b3ee
diff --git a/app/Http/Controllers/SettingsController.php b/app/Http/Controllers/SettingsController.phpindex 33afd47f83..14d0904226 100755--- a/app/Http/Controllers/SettingsController.php+++ b/app/Http/Controllers/SettingsController.php@@ -349,6 +349,7 @@ class SettingsController extends Controller$setting->privacy_policy_link = $request->input('privacy_policy_link');$setting->depreciation_method = $request->input('depreciation_method');+ $setting->dash_chart_type = $request->input('dash_chart_type');if ($request->input('per_page') != '') {$setting->per_page = $request->input('per_page');diff --git a/database/migrations/2022_09_29_040231_add_chart_type_to_settings.php b/database/migrations/2022_09_29_040231_add_chart_type_to_settings.phpnew file mode 100644index 0000000000..1e69b66f2a--- /dev/null+++ b/database/migrations/2022_09_29_040231_add_chart_type_to_settings.php@@ -0,0 +1,34 @@+<?php++use Illuminate\Database\Migrations\Migration;+use Illuminate\Database\Schema\Blueprint;+use Illuminate\Support\Facades\Schema;++class AddChartTypeToSettings extends Migration+{+ /**+ * Run the migrations.+ *+ * @return void+ */+ public function up()+ {+ Schema::table('settings', function (Blueprint $table) {+ $table->string('dash_chart_type')->nullable()->default('name');+ });+ }++ /**+ * Reverse the migrations.+ *+ * @return void+ */+ public function down()+ {+ Schema::table('settings', function (Blueprint $table) {+ if (Schema::hasColumn('settings', 'dash_chart_type')) {+ $table->dropColumn('dash_chart_type');+ }+ });+ }+}diff --git a/resources/lang/en/general.php b/resources/lang/en/general.phpindex d4db6b2b82..ba2cb77a6d 100644--- a/resources/lang/en/general.php+++ b/resources/lang/en/general.php@@ -375,6 +375,7 @@ return ['na_no_purchase_date' => 'N/A - No purchase date provided','assets_by_status' => 'Assets by Status','assets_by_status_type' => 'Assets by Status Type',+ 'pie_chart_type' => 'Dashboard Pie Chart Type',];\ No newline at end of filediff --git a/resources/views/dashboard.blade.php b/resources/views/dashboard.blade.phpindex ff95530002..fe6f2ac0dd 100755--- a/resources/views/dashboard.blade.php+++ b/resources/views/dashboard.blade.php@@ -248,7 +248,9 @@<div class="col-md-4"><div class="box box-default"><div class="box-header with-border">- <h2 class="box-title">{{ trans('general.assets_by_status_type') }}</h2>+ <h2 class="box-title">+ {{ (\App\Models\Setting::getSettings()->dash_chart_type == 'name') ? trans('general.assets_by_status') : trans('general.assets_by_status_type') }}+ </h2><div class="box-tools pull-right"><button type="button" class="btn btn-box-tool" data-widget="collapse" aria-hidden="true"><i class="fas fa-minus" aria-hidden="true"></i>@@ -430,7 +432,7 @@$.ajax({type: 'GET',- url: '{{ route('api.statuslabels.assets.bytype') }}',+ url: '{{ (\App\Models\Setting::getSettings()->dash_chart_type == 'name') ? route('api.statuslabels.assets.byname') : route('api.statuslabels.assets.bytype') }}',headers: {"X-Requested-With": 'XMLHttpRequest',"X-CSRF-TOKEN": $('meta[name="csrf-token"]').attr('content')diff --git a/resources/views/settings/general.blade.php b/resources/views/settings/general.blade.phpindex 6982adc1a9..6c0655abd5 100644--- a/resources/views/settings/general.blade.php+++ b/resources/views/settings/general.blade.php@@ -287,6 +287,21 @@{{ Form::checkbox('show_in_model_list[]', 'model_number', old('show_in_model_list', $snipeSettings->modellistCheckedValue('model_number')),array('class' => 'minimal', 'aria-label'=>'show_in_model_list' )) }} {{ trans('general.model_no') }}<br></div></div>+++ <!-- dash chart -->+ <div class="form-group {{ $errors->has('dash_chart_type') ? 'error' : '' }}">+ <div class="col-md-3">+ {{ Form::label('show_in_model_list',+ trans('general.pie_chart_type')) }}+ </div>+ <div class="col-md-9">+ {{ Form::select('dash_chart_type', array(+ 'name' => 'Status Label Name',+ 'type' => 'Status Label Type'), Request::old('dash_chart_type', $setting->dash_chart_type), ['class' =>'select2', 'style' => 'width: 80%']) }}+ </div>+ </div>+<!-- Depreciation method --><div class="form-group {{ $errors->has('depreciation_method') ? 'error' : '' }}">