Merge pull request #927 from denisdulici/master
Removed enabled column from reports
This commit is contained in:
commit
6842e10e31
@ -62,32 +62,6 @@ class Reports extends ApiController
|
|||||||
return $this->item($report->fresh(), new Transformer());
|
return $this->item($report->fresh(), new Transformer());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Enable the specified resource in storage.
|
|
||||||
*
|
|
||||||
* @param Report $report
|
|
||||||
* @return \Dingo\Api\Http\Response
|
|
||||||
*/
|
|
||||||
public function enable(Report $report)
|
|
||||||
{
|
|
||||||
$report = $this->dispatch(new UpdateReport($report, request()->merge(['enabled' => 1])));
|
|
||||||
|
|
||||||
return $this->item($report->fresh(), new Transformer());
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Disable the specified resource in storage.
|
|
||||||
*
|
|
||||||
* @param Report $report
|
|
||||||
* @return \Dingo\Api\Http\Response
|
|
||||||
*/
|
|
||||||
public function disable(Report $report)
|
|
||||||
{
|
|
||||||
$report = $this->dispatch(new UpdateReport($report, request()->merge(['enabled' => 0])));
|
|
||||||
|
|
||||||
return $this->item($report->fresh(), new Transformer());
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Remove the specified resource from storage.
|
* Remove the specified resource from storage.
|
||||||
*
|
*
|
||||||
|
@ -153,42 +153,6 @@ class Reports extends Controller
|
|||||||
return response()->json($response);
|
return response()->json($response);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Enable the specified resource.
|
|
||||||
*
|
|
||||||
* @param Report $report
|
|
||||||
*
|
|
||||||
* @return Response
|
|
||||||
*/
|
|
||||||
public function enable(Report $report)
|
|
||||||
{
|
|
||||||
$response = $this->ajaxDispatch(new UpdateReport($report, request()->merge(['enabled' => 1])));
|
|
||||||
|
|
||||||
if ($response['success']) {
|
|
||||||
$response['message'] = trans('messages.success.enabled', ['type' => $report->name]);
|
|
||||||
}
|
|
||||||
|
|
||||||
return response()->json($response);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Disable the specified resource.
|
|
||||||
*
|
|
||||||
* @param Report $report
|
|
||||||
*
|
|
||||||
* @return Response
|
|
||||||
*/
|
|
||||||
public function disable(Report $report)
|
|
||||||
{
|
|
||||||
$response = $this->ajaxDispatch(new UpdateReport($report, request()->merge(['enabled' => 0])));
|
|
||||||
|
|
||||||
if ($response['success']) {
|
|
||||||
$response['message'] = trans('messages.success.disabled', ['type' => $report->name]);
|
|
||||||
}
|
|
||||||
|
|
||||||
return response()->json($response);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Remove the specified resource from storage.
|
* Remove the specified resource from storage.
|
||||||
*
|
*
|
||||||
|
@ -22,7 +22,6 @@ class Report extends FormRequest
|
|||||||
'period' => 'required|string',
|
'period' => 'required|string',
|
||||||
'basis' => 'required|string',
|
'basis' => 'required|string',
|
||||||
'chart' => 'required|string',
|
'chart' => 'required|string',
|
||||||
'enabled' => 'integer|boolean',
|
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
31
app/Listeners/Update/V20/Version201.php
Normal file
31
app/Listeners/Update/V20/Version201.php
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Listeners\Update\V13;
|
||||||
|
|
||||||
|
use App\Events\Install\UpdateFinished as Event;
|
||||||
|
use App\Listeners\Update\Listener;
|
||||||
|
use Artisan;
|
||||||
|
|
||||||
|
class Version201 extends Listener
|
||||||
|
{
|
||||||
|
const ALIAS = 'core';
|
||||||
|
|
||||||
|
const VERSION = '2.0.1';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Handle the event.
|
||||||
|
*
|
||||||
|
* @param $event
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function handle(Event $event)
|
||||||
|
{
|
||||||
|
// Check if should listen
|
||||||
|
if (!$this->check($event)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Update database
|
||||||
|
Artisan::call('migrate', ['--force' => true]);
|
||||||
|
}
|
||||||
|
}
|
@ -14,5 +14,5 @@ class Report extends Model
|
|||||||
*
|
*
|
||||||
* @var array
|
* @var array
|
||||||
*/
|
*/
|
||||||
protected $fillable = ['company_id', 'name', 'description', 'class', 'group', 'period', 'basis', 'chart', 'enabled'];
|
protected $fillable = ['company_id', 'name', 'description', 'class', 'group', 'period', 'basis', 'chart'];
|
||||||
}
|
}
|
||||||
|
@ -36,6 +36,7 @@ class Event extends Provider
|
|||||||
'App\Listeners\Update\V13\Version1313',
|
'App\Listeners\Update\V13\Version1313',
|
||||||
'App\Listeners\Update\V13\Version1316',
|
'App\Listeners\Update\V13\Version1316',
|
||||||
'App\Listeners\Update\V20\Version200',
|
'App\Listeners\Update\V20\Version200',
|
||||||
|
'App\Listeners\Update\V20\Version201',
|
||||||
],
|
],
|
||||||
'Illuminate\Auth\Events\Login' => [
|
'Illuminate\Auth\Events\Login' => [
|
||||||
'App\Listeners\Auth\Login',
|
'App\Listeners\Auth\Login',
|
||||||
|
@ -24,7 +24,6 @@ class Report extends TransformerAbstract
|
|||||||
'period' => $model->period,
|
'period' => $model->period,
|
||||||
'basis' => $model->basis,
|
'basis' => $model->basis,
|
||||||
'graph' => $model->graph,
|
'graph' => $model->graph,
|
||||||
'enabled' => $model->enabled,
|
|
||||||
'created_at' => $model->created_at ? $model->created_at->toIso8601String() : '',
|
'created_at' => $model->created_at ? $model->created_at->toIso8601String() : '',
|
||||||
'updated_at' => $model->updated_at ? $model->updated_at->toIso8601String() : '',
|
'updated_at' => $model->updated_at ? $model->updated_at->toIso8601String() : '',
|
||||||
];
|
];
|
||||||
|
@ -53,9 +53,6 @@ class Reports
|
|||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
'category' => trans_choice('general.categories', 1),
|
'category' => trans_choice('general.categories', 1),
|
||||||
'account' => trans_choice('general.accounts', 1),
|
|
||||||
'customer' => trans_choice('general.customers', 1),
|
|
||||||
'vendor' => trans_choice('general.vendors', 1),
|
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -0,0 +1,32 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
|
||||||
|
class DropEnabledColumnReportsTable extends Migration
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Run the migrations.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function up()
|
||||||
|
{
|
||||||
|
Schema::table('reports', function (Blueprint $table) {
|
||||||
|
$table->dropColumn('enabled');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function down()
|
||||||
|
{
|
||||||
|
Schema::table('reports', function (Blueprint $table) {
|
||||||
|
$table->boolean('enabled');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
@ -36,7 +36,6 @@ class Reports extends Seeder
|
|||||||
'period' => 'monthly',
|
'period' => 'monthly',
|
||||||
'basis' => 'accrual',
|
'basis' => 'accrual',
|
||||||
'chart' => 'line',
|
'chart' => 'line',
|
||||||
'enabled' => 1,
|
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
'company_id' => $company_id,
|
'company_id' => $company_id,
|
||||||
@ -47,7 +46,6 @@ class Reports extends Seeder
|
|||||||
'period' => 'monthly',
|
'period' => 'monthly',
|
||||||
'basis' => 'accrual',
|
'basis' => 'accrual',
|
||||||
'chart' => 'line',
|
'chart' => 'line',
|
||||||
'enabled' => 1,
|
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
'company_id' => $company_id,
|
'company_id' => $company_id,
|
||||||
@ -58,7 +56,6 @@ class Reports extends Seeder
|
|||||||
'period' => 'monthly',
|
'period' => 'monthly',
|
||||||
'basis' => 'accrual',
|
'basis' => 'accrual',
|
||||||
'chart' => 'line',
|
'chart' => 'line',
|
||||||
'enabled' => 1,
|
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
'company_id' => $company_id,
|
'company_id' => $company_id,
|
||||||
@ -69,7 +66,6 @@ class Reports extends Seeder
|
|||||||
'period' => 'quarterly',
|
'period' => 'quarterly',
|
||||||
'basis' => 'accrual',
|
'basis' => 'accrual',
|
||||||
'chart' => '0',
|
'chart' => '0',
|
||||||
'enabled' => 1,
|
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
'company_id' => $company_id,
|
'company_id' => $company_id,
|
||||||
@ -80,7 +76,6 @@ class Reports extends Seeder
|
|||||||
'period' => 'quarterly',
|
'period' => 'quarterly',
|
||||||
'basis' => 'accrual',
|
'basis' => 'accrual',
|
||||||
'chart' => '0',
|
'chart' => '0',
|
||||||
'enabled' => 1,
|
|
||||||
],
|
],
|
||||||
];
|
];
|
||||||
|
|
||||||
|
@ -29,8 +29,6 @@
|
|||||||
{{ Form::selectGroup('basis', trans('general.basis'), 'file', $basises, 'accrual') }}
|
{{ Form::selectGroup('basis', trans('general.basis'), 'file', $basises, 'accrual') }}
|
||||||
|
|
||||||
{{ Form::selectGroup('chart', trans_choice('general.charts', 1), 'chart-pie', $charts, 'line') }}
|
{{ Form::selectGroup('chart', trans_choice('general.charts', 1), 'chart-pie', $charts, 'line') }}
|
||||||
|
|
||||||
{{ Form::radioGroup('enabled', trans('general.enabled')) }}
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@ -30,8 +30,6 @@
|
|||||||
{{ Form::selectGroup('basis', trans('general.basis'), 'file', $basises, $report->basis) }}
|
{{ Form::selectGroup('basis', trans('general.basis'), 'file', $basises, $report->basis) }}
|
||||||
|
|
||||||
{{ Form::selectGroup('chart', trans_choice('general.charts', 1), 'chart-pie', $charts, $report->chart) }}
|
{{ Form::selectGroup('chart', trans_choice('general.charts', 1), 'chart-pie', $charts, $report->chart) }}
|
||||||
|
|
||||||
{{ Form::radioGroup('enabled', trans('general.enabled')) }}
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@ -46,7 +44,7 @@
|
|||||||
|
|
||||||
@push('scripts_start')
|
@push('scripts_start')
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
var class =
|
var class = '';
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<script src="{{ asset('public/js/common/reports.js?v=' . version('short')) }}"></script>
|
<script src="{{ asset('public/js/common/reports.js?v=' . version('short')) }}"></script>
|
||||||
|
@ -35,8 +35,6 @@ Route::group(['prefix' => 'common'], function () {
|
|||||||
|
|
||||||
Route::get('reports/{report}/print', 'Common\Reports@print')->name('reports.print');
|
Route::get('reports/{report}/print', 'Common\Reports@print')->name('reports.print');
|
||||||
Route::get('reports/{report}/export', 'Common\Reports@export')->name('reports.export');
|
Route::get('reports/{report}/export', 'Common\Reports@export')->name('reports.export');
|
||||||
Route::get('reports/{report}/enable', 'Common\Reports@enable')->name('reports.enable');
|
|
||||||
Route::get('reports/{report}/disable', 'Common\Reports@disable')->name('reports.disable');
|
|
||||||
Route::get('reports/groups', 'Common\Reports@groups')->name('reports.groups');
|
Route::get('reports/groups', 'Common\Reports@groups')->name('reports.groups');
|
||||||
Route::resource('reports', 'Common\Reports');
|
Route::resource('reports', 'Common\Reports');
|
||||||
});
|
});
|
||||||
|
Loading…
x
Reference in New Issue
Block a user