close #2687 Enhancement: Remove wizard taxes step
This commit is contained in:
@ -1,117 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Wizard;
|
||||
|
||||
use App\Abstracts\Http\Controller;
|
||||
use App\Http\Requests\Setting\Tax as Request;
|
||||
use App\Jobs\Setting\CreateTax;
|
||||
use App\Jobs\Setting\DeleteTax;
|
||||
use App\Jobs\Setting\UpdateTax;
|
||||
use App\Models\Setting\Tax;
|
||||
|
||||
class Taxes extends Controller
|
||||
{
|
||||
/**
|
||||
* Instantiate a new controller instance.
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
// Add CRUD permission check
|
||||
$this->middleware('permission:create-settings-taxes')->only('create', 'store', 'duplicate', 'import');
|
||||
$this->middleware('permission:read-settings-taxes')->only('index', 'show', 'edit', 'export');
|
||||
$this->middleware('permission:update-settings-taxes')->only('update', 'enable', 'disable');
|
||||
$this->middleware('permission:delete-settings-taxes')->only('destroy');
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for editing the specified resource.
|
||||
*
|
||||
* @return Response
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
$taxes = Tax::collect();
|
||||
|
||||
return $this->response('wizard.taxes.index', compact('taxes'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for viewing the specified resource.
|
||||
*
|
||||
* @return Response
|
||||
*/
|
||||
public function show()
|
||||
{
|
||||
return redirect()->route('wizard.taxes.index');
|
||||
}
|
||||
|
||||
/**
|
||||
* Store a newly created resource in storage.
|
||||
*
|
||||
* @param Request $request
|
||||
*
|
||||
* @return Response
|
||||
*/
|
||||
public function store(Request $request)
|
||||
{
|
||||
$response = $this->ajaxDispatch(new CreateTax($request));
|
||||
|
||||
if ($response['success']) {
|
||||
$message = trans('messages.success.added', ['type' => trans_choice('general.taxes', 1)]);
|
||||
} else {
|
||||
$message = $response['message'];
|
||||
}
|
||||
|
||||
$response['message'] = $message;
|
||||
|
||||
return response()->json($response);
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the specified resource in storage.
|
||||
*
|
||||
* @param Tax $tax
|
||||
* @param Request $request
|
||||
*
|
||||
* @return Response
|
||||
*/
|
||||
public function update(Tax $tax, Request $request)
|
||||
{
|
||||
$response = $this->ajaxDispatch(new UpdateTax($tax, $request));
|
||||
|
||||
if ($response['success']) {
|
||||
$message = trans('messages.success.updated', ['type' => $tax->name]);
|
||||
} else {
|
||||
$message = $response['message'];
|
||||
}
|
||||
|
||||
$response['message'] = $message;
|
||||
|
||||
return response()->json($response);
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the specified resource from storage.
|
||||
*
|
||||
* @param Tax $tax
|
||||
*
|
||||
* @return Response
|
||||
*/
|
||||
public function destroy(Tax $tax)
|
||||
{
|
||||
$tax_id = $tax->id;
|
||||
|
||||
$response = $this->ajaxDispatch(new DeleteTax($tax));
|
||||
|
||||
if ($response['success']) {
|
||||
$message = trans('messages.success.deleted', ['type' => $tax->name]);
|
||||
} else {
|
||||
$message = $response['message'];
|
||||
}
|
||||
|
||||
$response['tax_id'] = $tax_id;
|
||||
$response['message'] = $message;
|
||||
|
||||
return response()->json($response);
|
||||
}
|
||||
}
|
@ -6,7 +6,6 @@ use Akaunting\Money\Currency as MoneyCurrency;
|
||||
use App\Abstracts\View\Component;
|
||||
use App\Models\Common\Media;
|
||||
use App\Models\Setting\Currency;
|
||||
use App\Models\Setting\Tax;
|
||||
use App\Traits\Modules;
|
||||
|
||||
class Scripts extends Component
|
||||
@ -21,8 +20,6 @@ class Scripts extends Component
|
||||
|
||||
public $currency_codes;
|
||||
|
||||
public $taxes;
|
||||
|
||||
public $modules;
|
||||
|
||||
/**
|
||||
@ -41,8 +38,6 @@ class Scripts extends Component
|
||||
// Prepare codes
|
||||
$this->currency_codes = $this->getCurrencyCodes();
|
||||
|
||||
$this->taxes = $this->getTaxes();
|
||||
|
||||
$this->modules = $this->getFeaturedModules([
|
||||
'query' => [
|
||||
'limit' => 5
|
||||
@ -122,29 +117,6 @@ class Scripts extends Component
|
||||
'cancel' => trans('general.cancel'),
|
||||
],
|
||||
|
||||
'taxes' => [
|
||||
'title' => trans_choice('general.taxes', 2),
|
||||
'add_new' => trans('general.add_new'),
|
||||
'no_taxes' => trans('taxes.no_taxes'),
|
||||
'create_task' => trans('taxes.create_task'),
|
||||
'new_tax' => trans('taxes.new_tax'),
|
||||
'name' => trans('general.name'),
|
||||
'rate_percent' => trans('taxes.rate_percent'),
|
||||
'enabled' => trans('general.enabled'),
|
||||
'actions' => trans('general.actions'),
|
||||
'yes' => trans('general.yes'),
|
||||
'no' => trans('general.no'),
|
||||
'edit' => trans('general.edit'),
|
||||
'delete' => trans('general.delete'),
|
||||
'name' => trans('general.name'),
|
||||
'rate' => trans('currencies.rate'),
|
||||
'enabled' => trans('general.enabled'),
|
||||
'save' => trans('general.save'),
|
||||
'previous' => trans('pagination.previous'),
|
||||
'next' => trans('pagination.next'),
|
||||
'cancel' => trans('general.cancel'),
|
||||
],
|
||||
|
||||
'finish' => [
|
||||
'title' => trans('modules.ready'),
|
||||
'recommended_apps' => trans('modules.recommended_apps'),
|
||||
@ -185,9 +157,4 @@ class Scripts extends Component
|
||||
|
||||
return $codes;
|
||||
}
|
||||
|
||||
protected function getTaxes()
|
||||
{
|
||||
return Tax::all();
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user