Added setting to choose dashboard type

Signed-off-by: snipe <snipe@snipe.net>
This commit is contained in:
snipe 2022-09-29 04:16:46 -07:00
parent 0b2ce7be07
commit 70c766e8b3
5 changed files with 55 additions and 2 deletions

View file

@ -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');

View file

@ -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');
}
});
}
}

View file

@ -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',
];

View file

@ -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')

View file

@ -288,6 +288,21 @@
</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' : '' }}">
<div class="col-md-3">