'Wizard edited for spa'
This commit is contained in:
		| @@ -33,7 +33,7 @@ class Companies extends Controller | ||||
|     { | ||||
|         $company = Company::find(company_id()); | ||||
|  | ||||
|         return view('wizard.companies.edit', compact('company')); | ||||
|         return $this->response('wizard.companies.edit', compact('company')); | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|   | ||||
| @@ -44,7 +44,7 @@ class Currencies extends Controller | ||||
|             $codes[$key] = $key; | ||||
|         } | ||||
|  | ||||
|         return view('wizard.currencies.index', compact('currencies', 'codes')); | ||||
|         return $this->response('wizard.currencies.index', compact('currencies', 'codes')); | ||||
|     } | ||||
|  | ||||
|     /** | ||||
| @@ -58,19 +58,21 @@ class Currencies extends Controller | ||||
|     { | ||||
|         $response = $this->ajaxDispatch(new CreateCurrency($request)); | ||||
|  | ||||
|         $response['redirect'] = route('wizard.currencies.index'); | ||||
|         //$response['redirect'] = route('wizard.currencies.index'); | ||||
|  | ||||
|         if ($response['success']) { | ||||
|  | ||||
|             $message = trans('messages.success.added', ['type' => trans_choice('general.currencies', 1)]); | ||||
|  | ||||
|             flash($message)->success(); | ||||
|             //flash($message)->success(); | ||||
|         } else { | ||||
|             $message = $response['message']; | ||||
|  | ||||
|             flash($message)->error()->important(); | ||||
|             //flash($message)->error()->important(); | ||||
|         } | ||||
|  | ||||
|         $response['message'] = $message; | ||||
|  | ||||
|         return response()->json($response); | ||||
|     } | ||||
|  | ||||
| @@ -86,18 +88,20 @@ class Currencies extends Controller | ||||
|     { | ||||
|         $response = $this->ajaxDispatch(new UpdateCurrency($currency, $request)); | ||||
|  | ||||
|         $response['redirect'] = route('wizard.currencies.index'); | ||||
|         // $response['redirect'] = route('wizard.currencies.index'); | ||||
|  | ||||
|         if ($response['success']) { | ||||
|             $message = trans('messages.success.updated', ['type' => $currency->name]); | ||||
|  | ||||
|             flash($message)->success(); | ||||
|             // flash($message)->success(); | ||||
|         } else { | ||||
|             $message = $response['message']; | ||||
|  | ||||
|             flash($message)->error()->important(); | ||||
|             // flash($message)->error()->important(); | ||||
|         } | ||||
|  | ||||
|         $response['message'] = $message; | ||||
|          | ||||
|         return response()->json($response); | ||||
|     } | ||||
|  | ||||
| @@ -110,20 +114,19 @@ class Currencies extends Controller | ||||
|      */ | ||||
|     public function destroy(Currency $currency) | ||||
|     { | ||||
|         $response = $this->ajaxDispatch(new DeleteCurrency($currency)); | ||||
|         $currency_id = $currency->id; | ||||
|  | ||||
|         $response['redirect'] = route('wizard.currencies.index'); | ||||
|         $response = $this->ajaxDispatch(new DeleteCurrency($currency)); | ||||
|  | ||||
|         if ($response['success']) { | ||||
|             $message = trans('messages.success.deleted', ['type' => $currency->name]); | ||||
|  | ||||
|             flash($message)->success(); | ||||
|         } else { | ||||
|             $message = $response['message']; | ||||
|  | ||||
|             flash($message)->error()->important(); | ||||
|         } | ||||
|  | ||||
|         $response['currency_id'] = $currency_id; | ||||
|         $response['message'] = $message; | ||||
|  | ||||
|         return response()->json($response); | ||||
|     } | ||||
| } | ||||
|   | ||||
							
								
								
									
										140
									
								
								app/Http/Controllers/Wizard/Data.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										140
									
								
								app/Http/Controllers/Wizard/Data.php
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,140 @@ | ||||
| <?php | ||||
|  | ||||
| namespace App\Http\Controllers\Wizard; | ||||
|  | ||||
| use App\Abstracts\Http\Controller; | ||||
|  | ||||
| use Akaunting\Money\Currency as MoneyCurrency; | ||||
| use App\Models\Setting\Currency; | ||||
| use App\Models\Setting\Tax; | ||||
| use App\Traits\Modules; | ||||
| use App\Models\Common\Company; | ||||
|  | ||||
| class Data extends Controller | ||||
| { | ||||
|     use Modules; | ||||
|  | ||||
|     /** | ||||
|      * Instantiate a new controller instance. | ||||
|      */ | ||||
|     public function __construct() | ||||
|     { | ||||
|         // Add CRUD permission check | ||||
|         $this->middleware('permission:create-common-companies')->only('create', 'store', 'duplicate', 'import'); | ||||
|         $this->middleware('permission:read-common-companies')->only('index', 'show', 'edit', 'export'); | ||||
|         $this->middleware('permission:update-common-companies')->only('update', 'enable', 'disable'); | ||||
|         $this->middleware('permission:delete-common-companies')->only('destroy'); | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * Show the form for creating a new resource. | ||||
|      * | ||||
|      * @return Response | ||||
|      */ | ||||
|     public function index() | ||||
|     { | ||||
|         $translations = [ | ||||
|             'companies' => [ | ||||
|                 'title' => trans_choice('general.companies', 1), | ||||
|                 'api_key' => trans('modules.api_key'), | ||||
|                 'form_enter' => trans('general.form.enter'), | ||||
|                 'get_api_key' => trans('modules.get_api_key'), | ||||
|                 'tax_number' => trans('general.tax_number'), | ||||
|                 'financial_start' => trans('settings.localisation.financial_start'), | ||||
|                 'address' => trans('settings.company.address'), | ||||
|                 'logo' => trans('settings.company.logo'), | ||||
|                 'skip' => trans('general.skip'), | ||||
|                 'save' => trans('general.save'), | ||||
|             ], | ||||
|  | ||||
|             'currencies' => [ | ||||
|                 'title' => trans_choice('general.currencies', 2), | ||||
|                 'add_new' => trans('general.add_new'), | ||||
|                 'name' => trans('general.name'), | ||||
|                 'code' => trans('currencies.code'), | ||||
|                 'rate' => trans('currencies.rate'), | ||||
|                 'enabled' => trans('general.enabled'), | ||||
|                 'actions' =>  trans('general.actions') , | ||||
|                 'yes' => trans('general.yes'), | ||||
|                 'no' => trans('general.no'), | ||||
|                 'edit' => trans('general.edit'), | ||||
|                 'delete' => trans('general.delete'), | ||||
|                 'save' => trans('general.save'), | ||||
|                 'precision' => trans('currencies.precision'), | ||||
|                 'symbol' => trans('currencies.symbol.symbol'), | ||||
|                 'position' => trans('currencies.symbol.position'), | ||||
|                 'decimal_mark' => trans('currencies.decimal_mark'), | ||||
|                 'thousands_separator' => trans('currencies.thousands_separator'), | ||||
|                 'previous' => trans('pagination.previous'), | ||||
|                 'next' => trans('pagination.next'), | ||||
|                 'delete_confirm' => trans('general.delete_confirm'), | ||||
|                 'cancel' => trans('general.cancel'), | ||||
|             ], | ||||
|  | ||||
|             'taxes' => [ | ||||
|                 'title' => trans_choice('general.taxes', 2), | ||||
|                 'add_new' =>  trans('general.add_new'), | ||||
|                 '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_choice('general.finish', 1), | ||||
|                 'recommended_apps' => trans('modules.recommended_apps'), | ||||
|                 'no_apps' =>  trans('modules.no_apps'), | ||||
|                 'developer' => trans('modules.developer'), | ||||
|                 'previous' => trans('pagination.previous'), | ||||
|                 'go_to_dashboard' => trans('general.go_to_dashboard'), | ||||
|             ] | ||||
|         ]; | ||||
|  | ||||
|         $currencies = Currency::collect(); | ||||
|  | ||||
|         // Prepare codes | ||||
|         $codes = []; | ||||
|         $money_currencies = MoneyCurrency::getCurrencies(); | ||||
|  | ||||
|         foreach ($money_currencies as $key => $item) { | ||||
|             $codes[$key] = $key; | ||||
|         } | ||||
|  | ||||
|         $taxes = Tax::collect(); | ||||
|          | ||||
|         $data = [ | ||||
|             'query' => [ | ||||
|                 'limit' => 4 | ||||
|             ] | ||||
|         ]; | ||||
|  | ||||
|         $modules = $this->getFeaturedModules($data); | ||||
|  | ||||
|         $company = Company::find(company_id()); | ||||
|  | ||||
|         return response()->json([ | ||||
|             'success' => true, | ||||
|             'errors' => false, | ||||
|             'message' => 'Get languages text..', | ||||
|             'data' => [ | ||||
|                 'currencies' => $currencies, | ||||
|                 'currency_codes' => $codes, | ||||
|                 'taxes' => $taxes, | ||||
|                 'modules' => $modules, | ||||
|                 'translations' => $translations, | ||||
|                 'companies' => $company, | ||||
|             ], | ||||
|         ]); | ||||
|     } | ||||
| } | ||||
| @@ -2,7 +2,7 @@ | ||||
|  | ||||
| namespace App\Http\Controllers\Wizard; | ||||
|  | ||||
| use Illuminate\Routing\Controller; | ||||
| use App\Abstracts\Http\Controller; | ||||
| use App\Traits\Modules; | ||||
|  | ||||
| class Finish extends Controller | ||||
| @@ -38,6 +38,21 @@ class Finish extends Controller | ||||
|  | ||||
|         $modules = $this->getFeaturedModules($data); | ||||
|  | ||||
|         return view('wizard.finish.index', compact('modules')); | ||||
|         return $this->response('wizard.finish.index', compact('modules')); | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * Show the form for creating a new resource. | ||||
|      * | ||||
|      * @return Response | ||||
|      */ | ||||
|     public function update() | ||||
|     { | ||||
|         setting()->set('wizard.completed', 1); | ||||
|  | ||||
|         // Save all settings | ||||
|         setting()->save(); | ||||
|  | ||||
|         return response()->json([]); | ||||
|     } | ||||
| } | ||||
|   | ||||
| @@ -32,7 +32,7 @@ class Taxes extends Controller | ||||
|     { | ||||
|         $taxes = Tax::collect(); | ||||
|  | ||||
|         return view('wizard.taxes.index', compact('taxes')); | ||||
|         return $this->response('wizard.taxes.index', compact('taxes')); | ||||
|     } | ||||
|  | ||||
|     /** | ||||
| @@ -46,17 +46,18 @@ class Taxes extends Controller | ||||
|     { | ||||
|         $response = $this->ajaxDispatch(new CreateTax($request)); | ||||
|  | ||||
|         $response['redirect'] = route('wizard.taxes.index'); | ||||
|         // $response['redirect'] = route('wizard.taxes.index'); | ||||
|  | ||||
|         if ($response['success']) { | ||||
|             $message = trans('messages.success.added', ['type' => trans_choice('general.taxes', 1)]); | ||||
|  | ||||
|             flash($message)->success(); | ||||
|             // flash($message)->success(); | ||||
|         } else { | ||||
|             $message = $response['message']; | ||||
|  | ||||
|             flash($message)->error()->important(); | ||||
|             // flash($message)->error()->important(); | ||||
|         } | ||||
|         $response['message'] = $message; | ||||
|  | ||||
|         return response()->json($response); | ||||
|     } | ||||
| @@ -73,18 +74,20 @@ class Taxes extends Controller | ||||
|     { | ||||
|         $response = $this->ajaxDispatch(new UpdateTax($tax, $request)); | ||||
|  | ||||
|         $response['redirect'] = route('wizard.taxes.index'); | ||||
|         // $response['redirect'] = route('wizard.taxes.index'); | ||||
|  | ||||
|         if ($response['success']) { | ||||
|             $message = trans('messages.success.updated', ['type' => $tax->name]); | ||||
|  | ||||
|             flash($message)->success(); | ||||
|             // flash($message)->success(); | ||||
|         } else { | ||||
|             $message = $response['message']; | ||||
|  | ||||
|             flash($message)->error()->important(); | ||||
|             // flash($message)->error()->important(); | ||||
|         } | ||||
|  | ||||
|         $response['message'] = $message; | ||||
|          | ||||
|         return response()->json($response); | ||||
|     } | ||||
|  | ||||
| @@ -97,19 +100,23 @@ class Taxes extends Controller | ||||
|      */ | ||||
|     public function destroy(Tax $tax) | ||||
|     { | ||||
|         $tax_id = $tax->id; | ||||
|  | ||||
|         $response = $this->ajaxDispatch(new DeleteTax($tax)); | ||||
|  | ||||
|         $response['redirect'] = route('wizard.taxes.index'); | ||||
|         // $response['redirect'] = route('wizard.taxes.index'); | ||||
|  | ||||
|         if ($response['success']) { | ||||
|             $message = trans('messages.success.deleted', ['type' => $tax->name]); | ||||
|  | ||||
|             flash($message)->success(); | ||||
|             // flash($message)->success(); | ||||
|         } else { | ||||
|             $message = $response['message']; | ||||
|  | ||||
|             flash($message)->error()->important(); | ||||
|             // flash($message)->error()->important(); | ||||
|         } | ||||
|         $response['tax_id'] = $tax_id; | ||||
|         $response['message'] = $message; | ||||
|  | ||||
|         return response()->json($response); | ||||
|     } | ||||
|   | ||||
							
								
								
									
										102
									
								
								app/Http/Controllers/Wizard/Translations.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										102
									
								
								app/Http/Controllers/Wizard/Translations.php
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,102 @@ | ||||
| <?php | ||||
|  | ||||
| namespace App\Http\Controllers\Wizard; | ||||
|  | ||||
| use App\Abstracts\Http\Controller; | ||||
|  | ||||
| class Translations extends Controller | ||||
| { | ||||
|     /** | ||||
|      * Instantiate a new controller instance. | ||||
|      */ | ||||
|     public function __construct() | ||||
|     { | ||||
|         // Add CRUD permission check | ||||
|         $this->middleware('permission:create-common-companies')->only('create', 'store', 'duplicate', 'import'); | ||||
|         $this->middleware('permission:read-common-companies')->only('index', 'show', 'edit', 'export'); | ||||
|         $this->middleware('permission:update-common-companies')->only('update', 'enable', 'disable'); | ||||
|         $this->middleware('permission:delete-common-companies')->only('destroy'); | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * Show the form for creating a new resource. | ||||
|      * | ||||
|      * @return Response | ||||
|      */ | ||||
|     public function index() | ||||
|     { | ||||
|         $translations = [ | ||||
|             'companies' => [ | ||||
|                 'title' => trans_choice('general.companies', 1), | ||||
|                 'api_key' => trans('modules.api_key'), | ||||
|                 'form_enter' => trans('general.form.enter'), | ||||
|                 'get_api_key' => trans('modules.get_api_key'), | ||||
|                 'tax_number' => trans('general.tax_number'), | ||||
|                 'financial_start' => trans('settings.localisation.financial_start'), | ||||
|                 'address' => trans('settings.company.address'), | ||||
|                 'logo' => trans('settings.company.logo'), | ||||
|                 'skip' => trans('general.skip'), | ||||
|                 'save' => trans('general.save'), | ||||
|             ], | ||||
|  | ||||
|             'currencies' => [ | ||||
|                 'title' => trans_choice('general.currencies', 2), | ||||
|                 'add_new' => trans('general.add_new'), | ||||
|                 'name' => trans('general.name'), | ||||
|                 'code' => trans('currencies.code'), | ||||
|                 'rate' => trans('currencies.rate'), | ||||
|                 'enabled' => trans('general.enabled'), | ||||
|                 'actions' =>  trans('general.actions') , | ||||
|                 'yes' => trans('general.yes'), | ||||
|                 'no' => trans('general.no'), | ||||
|                 'edit' => trans('general.edit'), | ||||
|                 'delete' => trans('general.delete'), | ||||
|                 'save' => trans('general.save'), | ||||
|                 'precision' => trans('currencies.precision'), | ||||
|                 'symbol' => trans('currencies.symbol.symbol'), | ||||
|                 'position' => trans('currencies.symbol.position'), | ||||
|                 'decimal_mark' => trans('currencies.decimal_mark'), | ||||
|                 'thousands_separator' => trans('currencies.thousands_separator'), | ||||
|                 'previous' => trans('pagination.previous'), | ||||
|                 'next' => trans('pagination.next'), | ||||
|                 'delete_confirm' => trans('general.delete_confirm'), | ||||
|                 'cancel' => trans('general.cancel'), | ||||
|             ], | ||||
|  | ||||
|             'taxes' => [ | ||||
|                 'title' => trans_choice('general.taxes', 2), | ||||
|                 'add_new' =>  trans('general.add_new'), | ||||
|                 '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_choice('general.finish', 1), | ||||
|                 'recommended_apps' => trans('modules.recommended_apps'), | ||||
|                 'no_apps' =>  trans('modules.no_apps'), | ||||
|                 'developer' => trans('modules.developer'), | ||||
|                 'previous' => trans('pagination.previous'), | ||||
|                 'go_to_dashboard' => trans('general.go_to_dashboard'), | ||||
|             ] | ||||
|         ]; | ||||
|  | ||||
|         return response()->json([ | ||||
|             'success' => true, | ||||
|             'errors' => false, | ||||
|             'message' => 'Get languages text..', | ||||
|             'data' => $translations, | ||||
|         ]); | ||||
|     } | ||||
| } | ||||
		Reference in New Issue
	
	Block a user