commit
16abcb27f3
@ -15,4 +15,4 @@ class AdminMenuCreated
|
||||
{
|
||||
$this->menu = $menu;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -15,4 +15,4 @@ class BillCreated
|
||||
{
|
||||
$this->bill = $bill;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -15,4 +15,4 @@ class BillUpdated
|
||||
{
|
||||
$this->bill = $bill;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -15,4 +15,4 @@ class CompanySwitched
|
||||
{
|
||||
$this->company = $company;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -15,4 +15,4 @@ class CustomerMenuCreated
|
||||
{
|
||||
$this->menu = $menu;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -15,4 +15,4 @@ class InvoiceCreated
|
||||
{
|
||||
$this->invoice = $invoice;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -15,4 +15,4 @@ class InvoicePrinting
|
||||
{
|
||||
$this->invoice = $invoice;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -15,4 +15,4 @@ class InvoiceUpdated
|
||||
{
|
||||
$this->invoice = $invoice;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -19,4 +19,4 @@ class ModuleInstalled
|
||||
$this->alias = $alias;
|
||||
$this->company_id = $company_id;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -23,4 +23,4 @@ class UpdateFinished
|
||||
$this->old = $old;
|
||||
$this->new = $new;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -79,6 +79,11 @@ class Login extends Controller
|
||||
return redirect($path);
|
||||
}
|
||||
|
||||
// Check wizard
|
||||
if (!setting('general.wizard', false)) {
|
||||
return redirect('wizard');
|
||||
}
|
||||
|
||||
return redirect('/');
|
||||
}
|
||||
|
||||
|
@ -264,6 +264,11 @@ class Companies extends Controller
|
||||
event(new CompanySwitched($company));
|
||||
}
|
||||
|
||||
// Check wizard
|
||||
if (!setting('general.wizard', false)) {
|
||||
return redirect('wizard');
|
||||
}
|
||||
|
||||
return redirect('/');
|
||||
}
|
||||
|
||||
|
81
app/Http/Controllers/Wizard/Companies.php
Normal file
81
app/Http/Controllers/Wizard/Companies.php
Normal file
@ -0,0 +1,81 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Wizard;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Http\Requests\Wizard\Company as Request;
|
||||
use App\Models\Common\Company;
|
||||
use App\Traits\Uploads;
|
||||
|
||||
class Companies extends Controller
|
||||
{
|
||||
use Uploads;
|
||||
|
||||
/**
|
||||
* Show the form for creating a new resource.
|
||||
*
|
||||
* @return Response
|
||||
*/
|
||||
public function edit()
|
||||
{
|
||||
if (setting('general.wizard', false)) {
|
||||
return redirect('/');
|
||||
}
|
||||
|
||||
$company = Company::find(session('company_id'));
|
||||
|
||||
$company->setSettings();
|
||||
|
||||
return view('wizard.companies.edit', compact('company'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the specified resource in storage.
|
||||
*
|
||||
* @param Company $company
|
||||
* @param Request $request
|
||||
*
|
||||
* @return Response
|
||||
*/
|
||||
public function update(Request $request)
|
||||
{
|
||||
// Company
|
||||
$company = Company::find(session('company_id'));
|
||||
|
||||
$fields = $request->all();
|
||||
|
||||
$skip_keys = ['company_id', '_method', '_token'];
|
||||
$file_keys = ['company_logo', 'invoice_logo'];
|
||||
|
||||
foreach ($fields as $key => $value) {
|
||||
// Don't process unwanted keys
|
||||
if (in_array($key, $skip_keys)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// Process file uploads
|
||||
if (in_array($key, $file_keys)) {
|
||||
// Upload attachment
|
||||
if ($request->file($key)) {
|
||||
$media = $this->getMedia($request->file($key), 'settings');
|
||||
|
||||
$company->attachMedia($media, $key);
|
||||
|
||||
$value = $media->id;
|
||||
}
|
||||
|
||||
// Prevent reset
|
||||
if (empty($value)) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
setting()->set('general.' . $key, $value);
|
||||
}
|
||||
|
||||
// Save all settings
|
||||
setting()->save();
|
||||
|
||||
return redirect('wizard/currencies');
|
||||
}
|
||||
}
|
311
app/Http/Controllers/Wizard/Currencies.php
Normal file
311
app/Http/Controllers/Wizard/Currencies.php
Normal file
@ -0,0 +1,311 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Wizard;
|
||||
|
||||
use Akaunting\Money\Currency as MoneyCurrency;
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Http\Requests\Setting\Currency as Request;
|
||||
use App\Models\Banking\Account;
|
||||
use App\Models\Setting\Currency;
|
||||
|
||||
class Currencies extends Controller
|
||||
{
|
||||
/**
|
||||
* Show the form for editing the specified resource.
|
||||
*
|
||||
* @param Currency $currency
|
||||
*
|
||||
* @return Response
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
if (setting('general.wizard', false)) {
|
||||
return redirect('/');
|
||||
}
|
||||
|
||||
$currencies = Currency::all();
|
||||
|
||||
return view('wizard.currencies.index', compact('currencies'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for creating a new resource.
|
||||
*
|
||||
* @return Response
|
||||
*/
|
||||
public function create()
|
||||
{
|
||||
if (setting(setting('general.wizard', false))) {
|
||||
return redirect('/');
|
||||
}
|
||||
|
||||
// Get current currencies
|
||||
$current = Currency::pluck('code')->toArray();
|
||||
|
||||
// Prepare codes
|
||||
$codes = array();
|
||||
$currencies = MoneyCurrency::getCurrencies();
|
||||
foreach ($currencies as $key => $item) {
|
||||
// Don't show if already available
|
||||
if (in_array($key, $current)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$codes[$key] = $key;
|
||||
}
|
||||
|
||||
$html = view('wizard.currencies.create', compact('codes'))->render();
|
||||
|
||||
return response()->json([
|
||||
'success' => true,
|
||||
'error' => false,
|
||||
'message' => 'null',
|
||||
'html' => $html,
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Store a newly created resource in storage.
|
||||
*
|
||||
* @param Request $request
|
||||
*
|
||||
* @return Response
|
||||
*/
|
||||
public function store(Request $request)
|
||||
{
|
||||
// Force the rate to be 1 for default currency
|
||||
if ($request['default_currency']) {
|
||||
$request['rate'] = '1';
|
||||
}
|
||||
|
||||
$currency = Currency::create($request->all());
|
||||
|
||||
// Update default currency setting
|
||||
if ($request['default_currency']) {
|
||||
setting()->set('general.default_currency', $request['code']);
|
||||
setting()->save();
|
||||
}
|
||||
|
||||
$message = trans('messages.success.added', ['type' => trans_choice('general.currencies', 1)]);
|
||||
|
||||
return response()->json([
|
||||
'success' => true,
|
||||
'error' => false,
|
||||
'message' => $message,
|
||||
'data' => $currency,
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for editing the specified resource.
|
||||
*
|
||||
* @param Currency $currency
|
||||
*
|
||||
* @return Response
|
||||
*/
|
||||
public function edit(Currency $currency)
|
||||
{
|
||||
if (setting('general.wizard', false)) {
|
||||
return redirect('/');
|
||||
}
|
||||
|
||||
// Get current currencies
|
||||
$current = Currency::pluck('code')->toArray();
|
||||
|
||||
// Prepare codes
|
||||
$codes = array();
|
||||
$currencies = MoneyCurrency::getCurrencies();
|
||||
foreach ($currencies as $key => $item) {
|
||||
// Don't show if already available
|
||||
if (($key != $currency->code) && in_array($key, $current)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$codes[$key] = $key;
|
||||
}
|
||||
|
||||
$item = $currency;
|
||||
|
||||
$html = view('wizard.currencies.edit', compact('item', 'codes'))->render();
|
||||
|
||||
return response()->json([
|
||||
'success' => true,
|
||||
'error' => false,
|
||||
'message' => 'null',
|
||||
'html' => $html,
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the specified resource in storage.
|
||||
*
|
||||
* @param Currency $currency
|
||||
* @param Request $request
|
||||
*
|
||||
* @return Response
|
||||
*/
|
||||
public function update(Currency $currency, Request $request)
|
||||
{
|
||||
// Check if we can disable or change the code
|
||||
if (!$request['enabled'] || ($currency->code != $request['code'])) {
|
||||
$relationships = $this->countRelationships($currency, [
|
||||
'accounts' => 'accounts',
|
||||
'customers' => 'customers',
|
||||
'invoices' => 'invoices',
|
||||
'revenues' => 'revenues',
|
||||
'bills' => 'bills',
|
||||
'payments' => 'payments',
|
||||
]);
|
||||
|
||||
if ($currency->code == setting('general.default_currency')) {
|
||||
$relationships[] = strtolower(trans_choice('general.companies', 1));
|
||||
}
|
||||
}
|
||||
|
||||
if (empty($relationships)) {
|
||||
// Force the rate to be 1 for default currency
|
||||
if ($request['default_currency']) {
|
||||
$request['rate'] = '1';
|
||||
}
|
||||
|
||||
$currency->update($request->all());
|
||||
|
||||
// Update default currency setting
|
||||
if ($request['default_currency']) {
|
||||
setting()->set('general.default_currency', $request['code']);
|
||||
setting()->save();
|
||||
}
|
||||
|
||||
$message = trans('messages.success.updated', ['type' => trans_choice('general.currencies', 1)]);
|
||||
|
||||
return response()->json([
|
||||
'success' => true,
|
||||
'error' => false,
|
||||
'message' => $message,
|
||||
'data' => $currency,
|
||||
]);
|
||||
} else {
|
||||
$message = trans('messages.warning.disabled', ['name' => $currency->name, 'text' => implode(', ', $relationships)]);
|
||||
|
||||
return response()->json([
|
||||
'success' => true,
|
||||
'error' => false,
|
||||
'message' => $message,
|
||||
'data' => $currency,
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Enable the specified resource.
|
||||
*
|
||||
* @param Currency $currency
|
||||
*
|
||||
* @return Response
|
||||
*/
|
||||
public function enable(Currency $currency)
|
||||
{
|
||||
$currency->enabled = 1;
|
||||
$currency->save();
|
||||
|
||||
$message = trans('messages.success.enabled', ['type' => trans_choice('general.currencies', 1)]);
|
||||
|
||||
return response()->json([
|
||||
'success' => true,
|
||||
'error' => false,
|
||||
'message' => $message,
|
||||
'data' => $currency,
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Disable the specified resource.
|
||||
*
|
||||
* @param Currency $currency
|
||||
*
|
||||
* @return Response
|
||||
*/
|
||||
public function disable(Currency $currency)
|
||||
{
|
||||
$relationships = $this->countRelationships($currency, [
|
||||
'accounts' => 'accounts',
|
||||
'customers' => 'customers',
|
||||
'invoices' => 'invoices',
|
||||
'revenues' => 'revenues',
|
||||
'bills' => 'bills',
|
||||
'payments' => 'payments',
|
||||
]);
|
||||
|
||||
if ($currency->code == setting('general.default_currency')) {
|
||||
$relationships[] = strtolower(trans_choice('general.companies', 1));
|
||||
}
|
||||
|
||||
if (empty($relationships)) {
|
||||
$currency->enabled = 0;
|
||||
$currency->save();
|
||||
|
||||
$message = trans('messages.success.disabled', ['type' => trans_choice('general.currencies', 1)]);
|
||||
|
||||
return response()->json([
|
||||
'success' => true,
|
||||
'error' => false,
|
||||
'message' => $message,
|
||||
'data' => $currency,
|
||||
]);
|
||||
} else {
|
||||
$message = trans('messages.warning.disabled', ['name' => $currency->name, 'text' => implode(', ', $relationships)]);
|
||||
|
||||
return response()->json([
|
||||
'success' => false,
|
||||
'error' => true,
|
||||
'message' => $message,
|
||||
'data' => $currency,
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the specified resource from storage.
|
||||
*
|
||||
* @param Currency $currency
|
||||
*
|
||||
* @return Response
|
||||
*/
|
||||
public function destroy(Currency $currency)
|
||||
{
|
||||
$relationships = $this->countRelationships($currency, [
|
||||
'accounts' => 'accounts',
|
||||
'customers' => 'customers',
|
||||
'invoices' => 'invoices',
|
||||
'revenues' => 'revenues',
|
||||
'bills' => 'bills',
|
||||
'payments' => 'payments',
|
||||
]);
|
||||
|
||||
if ($currency->code == setting('general.default_currency')) {
|
||||
$relationships[] = strtolower(trans_choice('general.companies', 1));
|
||||
}
|
||||
|
||||
if (empty($relationships)) {
|
||||
$currency->delete();
|
||||
|
||||
$message = trans('messages.success.deleted', ['type' => trans_choice('general.currencies', 1)]);
|
||||
|
||||
return response()->json([
|
||||
'success' => true,
|
||||
'error' => false,
|
||||
'message' => $message,
|
||||
'data' => $currency,
|
||||
]);
|
||||
} else {
|
||||
$message = trans('messages.warning.deleted', ['name' => $currency->name, 'text' => implode(', ', $relationships)]);
|
||||
|
||||
return response()->json([
|
||||
'success' => false,
|
||||
'error' => true,
|
||||
'message' => $message,
|
||||
'data' => $currency,
|
||||
]);
|
||||
}
|
||||
}
|
||||
}
|
39
app/Http/Controllers/Wizard/Finish.php
Normal file
39
app/Http/Controllers/Wizard/Finish.php
Normal file
@ -0,0 +1,39 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Wizard;
|
||||
|
||||
use Illuminate\Routing\Controller;
|
||||
use App\Traits\Modules;
|
||||
use App\Models\Module\Module;
|
||||
|
||||
class Finish extends Controller
|
||||
{
|
||||
use Modules;
|
||||
|
||||
/**
|
||||
* Show the form for creating a new resource.
|
||||
*
|
||||
* @return Response
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
if (setting(setting('general.wizard', false))) {
|
||||
return redirect('/');
|
||||
}
|
||||
|
||||
setting()->set('general.wizard', true);
|
||||
|
||||
// Save all settings
|
||||
setting()->save();
|
||||
|
||||
$data = [
|
||||
'query' => [
|
||||
'limit' => 4
|
||||
]
|
||||
];
|
||||
|
||||
$modules = $this->getFeaturedModules($data);
|
||||
|
||||
return view('wizard.finish.index', compact('modules'));
|
||||
}
|
||||
}
|
224
app/Http/Controllers/Wizard/Taxes.php
Normal file
224
app/Http/Controllers/Wizard/Taxes.php
Normal file
@ -0,0 +1,224 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Wizard;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Http\Requests\Setting\Tax as Request;
|
||||
use App\Models\Setting\Tax;
|
||||
|
||||
class Taxes extends Controller
|
||||
{
|
||||
/**
|
||||
* Show the form for editing the specified resource.
|
||||
*
|
||||
* @return Response
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
if (setting(setting('general.wizard', false))) {
|
||||
return redirect('/');
|
||||
}
|
||||
|
||||
$taxes = Tax::all();
|
||||
|
||||
return view('wizard.taxes.index', compact('taxes'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for creating a new resource.
|
||||
*
|
||||
* @return Response
|
||||
*/
|
||||
public function create()
|
||||
{
|
||||
if (setting(setting('general.wizard', false))) {
|
||||
return redirect('/');
|
||||
}
|
||||
|
||||
$html = view('wizard.taxes.create', compact('codes'))->render();
|
||||
|
||||
return response()->json([
|
||||
'success' => true,
|
||||
'error' => false,
|
||||
'message' => 'null',
|
||||
'html' => $html,
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Store a newly created resource in storage.
|
||||
*
|
||||
* @param Request $request
|
||||
*
|
||||
* @return Response
|
||||
*/
|
||||
public function store(Request $request)
|
||||
{
|
||||
$tax = Tax::create($request->all());
|
||||
|
||||
$message = trans('messages.success.added', ['type' => trans_choice('general.tax_rates', 1)]);
|
||||
|
||||
return response()->json([
|
||||
'success' => true,
|
||||
'error' => false,
|
||||
'message' => $message,
|
||||
'data' => $tax,
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for editing the specified resource.
|
||||
*
|
||||
* @param Tax $tax
|
||||
*
|
||||
* @return Response
|
||||
*/
|
||||
public function edit(Tax $tax)
|
||||
{
|
||||
if (setting(setting('general.wizard', false))) {
|
||||
return redirect('/');
|
||||
}
|
||||
|
||||
$item = $tax;
|
||||
|
||||
return view('wizard.taxes.edit', compact('item'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the specified resource in storage.
|
||||
*
|
||||
* @param Tax $tax
|
||||
* @param Request $request
|
||||
*
|
||||
* @return Response
|
||||
*/
|
||||
public function update(Tax $tax, Request $request)
|
||||
{
|
||||
$relationships = $this->countRelationships($tax, [
|
||||
'items' => 'items',
|
||||
'invoice_items' => 'invoices',
|
||||
'bill_items' => 'bills',
|
||||
]);
|
||||
|
||||
if (empty($relationships) || $request['enabled']) {
|
||||
$tax->update($request->all());
|
||||
|
||||
$message = trans('messages.success.updated', ['type' => trans_choice('general.tax_rates', 1)]);
|
||||
|
||||
return response()->json([
|
||||
'success' => true,
|
||||
'error' => false,
|
||||
'message' => $message,
|
||||
'data' => $tax,
|
||||
]);
|
||||
} else {
|
||||
$message = trans('messages.warning.disabled', ['name' => $tax->name, 'text' => implode(', ', $relationships)]);
|
||||
|
||||
return response()->json([
|
||||
'success' => true,
|
||||
'error' => false,
|
||||
'message' => $message,
|
||||
'data' => $tax,
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Enable the specified resource.
|
||||
*
|
||||
* @param Tax $tax
|
||||
*
|
||||
* @return Response
|
||||
*/
|
||||
public function enable(Tax $tax)
|
||||
{
|
||||
$tax->enabled = 1;
|
||||
$tax->save();
|
||||
|
||||
$message = trans('messages.success.enabled', ['type' => trans_choice('general.tax_rates', 1)]);
|
||||
|
||||
return response()->json([
|
||||
'success' => true,
|
||||
'error' => false,
|
||||
'message' => $message,
|
||||
'data' => $tax,
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Disable the specified resource.
|
||||
*
|
||||
* @param Tax $tax
|
||||
*
|
||||
* @return Response
|
||||
*/
|
||||
public function disable(Tax $tax)
|
||||
{
|
||||
$relationships = $this->countRelationships($tax, [
|
||||
'items' => 'items',
|
||||
'invoice_items' => 'invoices',
|
||||
'bill_items' => 'bills',
|
||||
]);
|
||||
|
||||
if (empty($relationships)) {
|
||||
$tax->enabled = 0;
|
||||
$tax->save();
|
||||
|
||||
$message = trans('messages.success.disabled', ['type' => trans_choice('general.tax_rates', 1)]);
|
||||
|
||||
return response()->json([
|
||||
'success' => true,
|
||||
'error' => false,
|
||||
'message' => $message,
|
||||
'data' => $tax,
|
||||
]);
|
||||
} else {
|
||||
$message = trans('messages.warning.disabled', ['name' => $tax->name, 'text' => implode(', ', $relationships)]);
|
||||
|
||||
return response()->json([
|
||||
'success' => false,
|
||||
'error' => true,
|
||||
'message' => $message,
|
||||
'data' => $tax,
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the specified resource from storage.
|
||||
*
|
||||
* @param Tax $tax
|
||||
*
|
||||
* @return Response
|
||||
*/
|
||||
public function destroy(Tax $tax)
|
||||
{
|
||||
$relationships = $this->countRelationships($tax, [
|
||||
'items' => 'items',
|
||||
'invoice_items' => 'invoices',
|
||||
'bill_items' => 'bills',
|
||||
]);
|
||||
|
||||
if (empty($relationships)) {
|
||||
$tax->delete();
|
||||
|
||||
$message = trans('messages.success.deleted', ['type' => trans_choice('general.taxes', 1)]);
|
||||
|
||||
return response()->json([
|
||||
'success' => true,
|
||||
'error' => false,
|
||||
'message' => $message,
|
||||
'data' => $tax,
|
||||
]);
|
||||
} else {
|
||||
$message = trans('messages.warning.deleted', ['name' => $tax->name, 'text' => implode(', ', $relationships)]);
|
||||
|
||||
return response()->json([
|
||||
'success' => false,
|
||||
'error' => true,
|
||||
'message' => $message,
|
||||
'data' => $tax,
|
||||
]);
|
||||
}
|
||||
}
|
||||
}
|
@ -41,6 +41,13 @@ class Kernel extends HttpKernel
|
||||
'company.currencies',
|
||||
],
|
||||
|
||||
'wizard' => [
|
||||
'web',
|
||||
'language',
|
||||
'auth',
|
||||
'permission:read-admin-panel',
|
||||
],
|
||||
|
||||
'admin' => [
|
||||
'web',
|
||||
'language',
|
||||
|
@ -204,4 +204,4 @@ class AdminMenu
|
||||
|
||||
return $next($request);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
30
app/Http/Requests/Wizard/Company.php
Normal file
30
app/Http/Requests/Wizard/Company.php
Normal file
@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests\Wizard;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
class Company extends FormRequest
|
||||
{
|
||||
/**
|
||||
* Determine if the user is authorized to make this request.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function authorize()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the validation rules that apply to the request.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function rules()
|
||||
{
|
||||
return [
|
||||
'company_logo' => 'mimes:' . setting('general.file_types') . '|between:0,' . setting('general.file_size') * 1024,
|
||||
];
|
||||
}
|
||||
}
|
@ -3,6 +3,8 @@
|
||||
namespace App\Listeners\Updates;
|
||||
|
||||
use App\Events\UpdateFinished;
|
||||
use App\Models\Auth\Role;
|
||||
use App\Models\Auth\Permission;
|
||||
use Artisan;
|
||||
|
||||
class Version130 extends Listener
|
||||
@ -24,10 +26,110 @@ class Version130 extends Listener
|
||||
return;
|
||||
}
|
||||
|
||||
$permissions = $this->getPermissions();
|
||||
|
||||
// Attach permission to roles
|
||||
$roles = Role::all();
|
||||
|
||||
foreach ($roles as $role) {
|
||||
$allowed = ['admin'];
|
||||
|
||||
if (!in_array($role->name, $allowed)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
foreach ($permissions as $permission) {
|
||||
$role->attachPermission($permission);
|
||||
}
|
||||
}
|
||||
|
||||
// Set new Item Reminder settings
|
||||
setting(['general.send_item_reminder' => '0']);
|
||||
setting(['general.schedule_item_stocks' => '3,5,7']);
|
||||
setting(['general.wizard' => '1']);
|
||||
|
||||
setting()->save();
|
||||
}
|
||||
|
||||
protected function getPermissions()
|
||||
{
|
||||
$permissions = [];
|
||||
|
||||
// Create permissions
|
||||
$permissions[] = Permission::firstOrCreate([
|
||||
'name' => 'create-wizard-companies',
|
||||
'display_name' => 'Create Wizard Compaines',
|
||||
'description' => 'Create Wizard Compaines',
|
||||
]);
|
||||
|
||||
$permissions[] = Permission::firstOrCreate([
|
||||
'name' => 'create-wizard-currencies',
|
||||
'display_name' => 'Create Wizard Currencies',
|
||||
'description' => 'Create Wizard Currencies',
|
||||
]);
|
||||
|
||||
$permissions[] = Permission::firstOrCreate([
|
||||
'name' => 'create-wizard-taxes',
|
||||
'display_name' => 'Create Wizard Taxes',
|
||||
'description' => 'Create Wizard Taxes',
|
||||
]);
|
||||
|
||||
$permissions[] = Permission::firstOrCreate([
|
||||
'name' => 'create-wizard-finish',
|
||||
'display_name' => 'Create Wizard Finish',
|
||||
'description' => 'Create Wizard Finish',
|
||||
]);
|
||||
|
||||
// Read permissions
|
||||
$permissions[] = Permission::firstOrCreate([
|
||||
'name' => 'read-wizard-companies',
|
||||
'display_name' => 'Read Wizard Compaines',
|
||||
'description' => 'Read Wizard Compaines',
|
||||
]);
|
||||
|
||||
$permissions[] = Permission::firstOrCreate([
|
||||
'name' => 'read-wizard-currencies',
|
||||
'display_name' => 'Read Wizard Currencies',
|
||||
'description' => 'Read Wizard Currencies',
|
||||
]);
|
||||
|
||||
$permissions[] = Permission::firstOrCreate([
|
||||
'name' => 'read-wizard-taxes',
|
||||
'display_name' => 'Read Wizard Taxes',
|
||||
'description' => 'Read Wizard Taxes',
|
||||
]);
|
||||
|
||||
$permissions[] = Permission::firstOrCreate([
|
||||
'name' => 'read-wizard-finish',
|
||||
'display_name' => 'Read Wizard Finish',
|
||||
'description' => 'Read Wizard Finish',
|
||||
]);
|
||||
|
||||
// Update permissions
|
||||
$permissions[] = Permission::firstOrCreate([
|
||||
'name' => 'update-wizard-companies',
|
||||
'display_name' => 'Update Wizard Compaines',
|
||||
'description' => 'Update Wizard Compaines',
|
||||
]);
|
||||
|
||||
$permissions[] = Permission::firstOrCreate([
|
||||
'name' => 'update-wizard-currencies',
|
||||
'display_name' => 'Update Wizard Currencies',
|
||||
'description' => 'Update Wizard Currencies',
|
||||
]);
|
||||
|
||||
$permissions[] = Permission::firstOrCreate([
|
||||
'name' => 'update-wizard-taxes',
|
||||
'display_name' => 'Update Wizard Taxes',
|
||||
'description' => 'Update Wizard Taxes',
|
||||
]);
|
||||
|
||||
$permissions[] = Permission::firstOrCreate([
|
||||
'name' => 'update-wizard-finish',
|
||||
'display_name' => 'Update Wizard Finish',
|
||||
'description' => 'Update Wizard Finish',
|
||||
]);
|
||||
|
||||
return $permissions;
|
||||
}
|
||||
}
|
||||
|
@ -31,7 +31,7 @@ class ViewComposerServiceProvider extends ServiceProvider
|
||||
|
||||
// Add notifications to header
|
||||
View::composer(
|
||||
['partials.admin.header', 'partials.customer.header'], 'App\Http\ViewComposers\Header'
|
||||
['partials.wizard.header', 'partials.admin.header', 'partials.customer.header'], 'App\Http\ViewComposers\Header'
|
||||
);
|
||||
|
||||
// Add limits to index
|
||||
|
@ -200,6 +200,17 @@ trait Modules
|
||||
return [];
|
||||
}
|
||||
|
||||
public function getFeaturedModules($data = [])
|
||||
{
|
||||
$response = $this->getRemote('apps/featured', 'GET', $data);
|
||||
|
||||
if ($response && ($response->getStatusCode() == 200)) {
|
||||
return json_decode($response->getBody())->data;
|
||||
}
|
||||
|
||||
return [];
|
||||
}
|
||||
|
||||
public function getCoreVersion()
|
||||
{
|
||||
$data['query'] = Info::all();
|
||||
|
@ -157,7 +157,7 @@ class Installer
|
||||
|
||||
try {
|
||||
DB::connection('install_test')->getPdo();
|
||||
} catch (\Exception $e) {;
|
||||
} catch (\Exception $e) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -63,6 +63,10 @@ class Roles extends Seeder
|
||||
'reports-income-expense-summary' => 'r',
|
||||
'reports-profit-loss' => 'r',
|
||||
'reports-tax-summary' => 'r',
|
||||
'wizard-companies' => 'c,r,u',
|
||||
'wizard-currencies' => 'c,r,u',
|
||||
'wizard-taxes' => 'c,r,u',
|
||||
'wizard-finish' => 'c,r,u',
|
||||
],
|
||||
'manager' => [
|
||||
'admin-panel' => 'r',
|
||||
|
@ -51,7 +51,8 @@ class Settings extends Seeder
|
||||
'general.session_lifetime' => '30',
|
||||
'general.file_size' => '2',
|
||||
'general.file_types' => 'pdf,jpeg,jpg,png',
|
||||
'offlinepayment.methods' => '[{"code":"offlinepayment.cash.1","name":"Cash","order":"1","description":null},{"code":"offlinepayment.bank_transfer.2","name":"Bank Transfer","order":"2","description":null}]',
|
||||
'general.wizard' => '0',
|
||||
'offlinepayment.methods' => '[{"code":"offlinepayment.cash.1","name":"Cash","order":"1","description":null},{"code":"offlinepayment.bank_transfer.2","name":"Bank Transfer","order":"2","description":null}]',
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
60
public/css/app.css
vendored
60
public/css/app.css
vendored
@ -772,4 +772,62 @@ input[type="number"] {
|
||||
|
||||
#items .select2-search__field {
|
||||
padding-left: 15px;
|
||||
}
|
||||
}
|
||||
|
||||
.stepwizard-step p {
|
||||
margin-top: 5px;
|
||||
font-size: 16px;
|
||||
color:#666;
|
||||
}
|
||||
|
||||
.stepwizard-row {
|
||||
display: table-row;
|
||||
}
|
||||
|
||||
.stepwizard {
|
||||
display: table;
|
||||
width: 100%;
|
||||
position: relative;
|
||||
margin-top: 20px;
|
||||
}
|
||||
|
||||
.stepwizard-step button[disabled] {
|
||||
/*opacity: 1 !important;
|
||||
filter: alpha(opacity=100) !important;*/
|
||||
}
|
||||
|
||||
.stepwizard .btn.disabled, .stepwizard .btn[disabled], .stepwizard fieldset[disabled] .btn {
|
||||
opacity:1 !important;
|
||||
color:#bbb;
|
||||
}
|
||||
|
||||
.stepwizard-row:before {
|
||||
top: 26px;
|
||||
bottom: 0;
|
||||
position: absolute;
|
||||
content:" ";
|
||||
width: 100%;
|
||||
height: 1px;
|
||||
background-color: #ccc;
|
||||
z-index: 0;
|
||||
}
|
||||
|
||||
.stepwizard-step {
|
||||
display: table-cell;
|
||||
text-align: center;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.btn-circle.btn-success {
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
.btn-circle {
|
||||
width: 50px;
|
||||
height: 50px;
|
||||
text-align: center;
|
||||
padding: 1px 0;
|
||||
font-size: 30px;
|
||||
line-height: 1.428571;
|
||||
border-radius: 30px;
|
||||
}
|
||||
|
4
public/js/app.js
vendored
4
public/js/app.js
vendored
@ -198,7 +198,9 @@ $(document).ready(function () {
|
||||
return true;
|
||||
});
|
||||
|
||||
$('.input-group-invoice-text select').select2();
|
||||
if (document.getElementsByClassName('input-group-invoice-text').length) {
|
||||
$('.input-group-invoice-text select').select2();
|
||||
}
|
||||
});
|
||||
|
||||
function confirmDelete(form_id, title, message, button_cancel, button_delete) {
|
||||
|
@ -102,10 +102,14 @@ return [
|
||||
'partially' => 'Partially',
|
||||
'partially_paid' => 'Partially Paid',
|
||||
'export' => 'Export',
|
||||
'finish' => 'Finish',
|
||||
'wizard' => 'Wizard',
|
||||
'skip' => 'Skip',
|
||||
'enable' => 'Enable',
|
||||
'disable' => 'Disable',
|
||||
'select_all' => 'Select All',
|
||||
'unselect_all' => 'Unselect All',
|
||||
'go_to' => 'Go to :name',
|
||||
'title' => [
|
||||
'new' => 'New :type',
|
||||
'edit' => 'Edit :type',
|
||||
|
@ -16,6 +16,8 @@ return [
|
||||
'no_apps' => 'There are no apps in this category, yet.',
|
||||
'developer' => 'Are you a developer? <a href="https://akaunting.com/blog/akaunting-app-store" target="_blank">Here</a> you can learn how to create an app and start selling today!',
|
||||
|
||||
'recommended_apps' => 'Recommended Apps',
|
||||
|
||||
'about' => 'About',
|
||||
|
||||
'added' => 'Added',
|
||||
|
20
resources/views/layouts/wizard.blade.php
Normal file
20
resources/views/layouts/wizard.blade.php
Normal file
@ -0,0 +1,20 @@
|
||||
<html lang="{{ setting('general.default_locale') }}">
|
||||
@include('partials.wizard.head')
|
||||
|
||||
<body class="hold-transition {{ setting('general.admin_theme', 'skin-green-light') }} sidebar-mini fixed">
|
||||
@stack('body_start')
|
||||
|
||||
<!-- Site wrapper -->
|
||||
<div class="wrapper">
|
||||
@include('partials.wizard.content')
|
||||
</div>
|
||||
|
||||
@stack('body_end')
|
||||
|
||||
<script type="text/javascript">
|
||||
$('#wizard-skip, .stepwizard .btn.btn-default').on('click', function() {
|
||||
$('#wizard-loading').html('<span class="wizard-loading-bar"><span class="wizard-loading-spin"><i class="fa fa-spinner fa-spin"></i></span></span>');
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
39
resources/views/partials/wizard/content.blade.php
Normal file
39
resources/views/partials/wizard/content.blade.php
Normal file
@ -0,0 +1,39 @@
|
||||
@stack('content_start')
|
||||
|
||||
<!-- Content Wrapper. Contains page content -->
|
||||
<div class="content-wrapper no-margin">
|
||||
@stack('content_wrapper_start')
|
||||
|
||||
<!-- Content Header (Page header) -->
|
||||
<section class="content-header content-center">
|
||||
@stack('content_header_start')
|
||||
|
||||
<h1>
|
||||
@yield('title')
|
||||
@yield('new_button')
|
||||
</h1>
|
||||
|
||||
@stack('content_header_end')
|
||||
</section>
|
||||
|
||||
<!-- Main content -->
|
||||
<section class="content content-center">
|
||||
@include('flash::message')
|
||||
|
||||
@stack('content_content_start')
|
||||
|
||||
@yield('content')
|
||||
|
||||
@stack('content_content_end')
|
||||
</section>
|
||||
<!-- /.content -->
|
||||
|
||||
@stack('content_wrapper_end')
|
||||
</div>
|
||||
<!-- /.content-wrapper -->
|
||||
|
||||
<script type="text/javascript">
|
||||
$('div.alert').not('.alert-important').delay(3000).fadeOut(350);
|
||||
</script>
|
||||
|
||||
@stack('content_end')
|
101
resources/views/partials/wizard/head.blade.php
Normal file
101
resources/views/partials/wizard/head.blade.php
Normal file
@ -0,0 +1,101 @@
|
||||
<head>
|
||||
@stack('head_start')
|
||||
|
||||
<meta charset="utf-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<!-- Tell the browser to be responsive to screen width -->
|
||||
<meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">
|
||||
|
||||
<title>@yield('title') - @setting('general.company_name')</title>
|
||||
|
||||
<!-- Bootstrap 3.3.6 -->
|
||||
<link rel="stylesheet" href="{{ asset('vendor/almasaeed2010/adminlte/bootstrap/css/bootstrap.min.css') }}">
|
||||
<!-- Font Awesome -->
|
||||
<link rel="stylesheet" href="{{ asset('public/css/font-awesome.min.css') }}">
|
||||
<!-- Ionicons -->
|
||||
<link rel="stylesheet" href="{{ asset('public/css/ionicons.min.css') }}">
|
||||
<!-- Theme style -->
|
||||
<link rel="stylesheet" href="{{ asset('vendor/almasaeed2010/adminlte/dist/css/AdminLTE.min.css') }}">
|
||||
<!-- AdminLTE Skins -->
|
||||
@if (setting('general.admin_theme', 'skin-green-light') == 'skin-green-light')
|
||||
<link rel="stylesheet" href="{{ asset('vendor/almasaeed2010/adminlte/dist/css/skins/skin-green-light.min.css') }}">
|
||||
@else
|
||||
<link rel="stylesheet" href="{{ asset('vendor/almasaeed2010/adminlte/dist/css/skins/skin-black.min.css') }}">
|
||||
<link rel="stylesheet" href="{{ asset('public/css/skin-black.css?v=' . version('short')) }}">
|
||||
@endif
|
||||
<!-- Select2 -->
|
||||
<link rel="stylesheet" href="{{ asset('vendor/almasaeed2010/adminlte/plugins/select2/select2.min.css') }}">
|
||||
<!-- App style -->
|
||||
<link rel="stylesheet" href="{{ asset('public/css/app.css?v=' . version('short')) }}">
|
||||
<link rel="stylesheet" href="{{ asset('public/css/akaunting-green.css?v=' . version('short')) }}">
|
||||
|
||||
<link rel="shortcut icon" href="{{ asset('public/img/favicon.ico') }}">
|
||||
|
||||
@stack('css')
|
||||
|
||||
@stack('stylesheet')
|
||||
<style type="text/css">
|
||||
.wizard-loading-bar {
|
||||
font-size: 35px;
|
||||
position: absolute;
|
||||
z-index: 999999;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
background: rgb(136, 136, 136);
|
||||
opacity: 0.2;
|
||||
-moz-border-radius-bottomleft: 1px;
|
||||
-moz-border-radius-bottomright: 1px;
|
||||
border-bottom-left-radius: 1px;
|
||||
border-bottom-right-radius: 1px;font-size: 35px;
|
||||
position: absolute;
|
||||
z-index: 999999;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
background: rgb(136, 136, 136);
|
||||
opacity: 0.2;
|
||||
-moz-border-radius-bottomleft: 1px;
|
||||
-moz-border-radius-bottomright: 1px;
|
||||
border-bottom-left-radius: 1px;
|
||||
border-bottom-right-radius: 1px;
|
||||
}
|
||||
|
||||
.wizard-loading-spin {
|
||||
font-size: 100px;
|
||||
position: absolute;
|
||||
margin: auto;
|
||||
color: #fff;
|
||||
padding: 8% 40%;
|
||||
z-index: 9999;
|
||||
}
|
||||
</style>
|
||||
|
||||
<!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
|
||||
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
|
||||
<!--[if lt IE 9]>
|
||||
<script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script>
|
||||
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
|
||||
<![endif]-->
|
||||
|
||||
<!-- jQuery 2.2.3 -->
|
||||
<script src="{{ asset('vendor/almasaeed2010/adminlte/plugins/jQuery/jquery-2.2.3.min.js') }}"></script>
|
||||
<!-- Bootstrap 3.3.6 -->
|
||||
<script src="{{ asset('vendor/almasaeed2010/adminlte/bootstrap/js/bootstrap.min.js') }}"></script>
|
||||
<!-- SlimScroll -->
|
||||
<script src="{{ asset('vendor/almasaeed2010/adminlte/plugins/slimScroll/jquery.slimscroll.min.js') }}"></script>
|
||||
<!-- FastClick -->
|
||||
<script src="{{ asset('vendor/almasaeed2010/adminlte/plugins/fastclick/fastclick.js') }}"></script>
|
||||
<!-- AdminLTE App -->
|
||||
<script src="{{ asset('vendor/almasaeed2010/adminlte/dist/js/app.min.js') }}"></script>
|
||||
<!-- Select2 -->
|
||||
<script src="{{ asset('vendor/almasaeed2010/adminlte/plugins/select2/select2.min.js') }}"></script>
|
||||
<!-- Mask Money -->
|
||||
<script src="{{ asset('public/js/jquery/jquery.maskMoney.js') }}"></script>
|
||||
|
||||
<script src="{{ asset('public/js/app.js?v=' . version('short')) }}"></script>
|
||||
|
||||
@stack('js')
|
||||
|
||||
@stack('scripts')
|
||||
|
||||
@stack('head_end')
|
||||
</head>
|
16
resources/views/partials/wizard/pagination.blade.php
Normal file
16
resources/views/partials/wizard/pagination.blade.php
Normal file
@ -0,0 +1,16 @@
|
||||
@stack('pagination_start')
|
||||
|
||||
@if ($items->firstItem())
|
||||
<div class="pull-left" style="margin-top: 7px;">
|
||||
<small>{{ trans('pagination.showing', ['first' => $items->firstItem(), 'last' => $items->lastItem(), 'total' => $items->total(), 'type' => strtolower(trans_choice('general.' . $type, 2))]) }}</small>
|
||||
</div>
|
||||
<div class="pull-right">
|
||||
{!! $items->appends(request()->except('page'))->links() !!}
|
||||
</div>
|
||||
@else
|
||||
<div class="pull-left">
|
||||
<small>{{ trans('general.no_records') }}</small>
|
||||
</div>
|
||||
@endif
|
||||
|
||||
@stack('pagination_end')
|
@ -39,6 +39,8 @@
|
||||
{{ Form::textareaGroup('company_address', trans('settings.company.address')) }}
|
||||
|
||||
{{ Form::fileGroup('company_logo', trans('settings.company.logo')) }}
|
||||
|
||||
{!! Form::hidden('wizard', null, ['id' => 'wizard']) !!}
|
||||
</div>
|
||||
|
||||
<div class="tab-pane tab-margin" id="localisation">
|
||||
|
131
resources/views/wizard/companies/edit.blade.php
Normal file
131
resources/views/wizard/companies/edit.blade.php
Normal file
@ -0,0 +1,131 @@
|
||||
@extends('layouts.wizard')
|
||||
|
||||
@section('title', trans('general.wizard'))
|
||||
|
||||
@section('content')
|
||||
<!-- Default box -->
|
||||
<div class="box box-solid">
|
||||
<div class="box-body">
|
||||
<div class="stepwizard">
|
||||
<div class="stepwizard-row setup-panel">
|
||||
<div class="stepwizard-step col-xs-3">
|
||||
<a href="#step-1" type="button" class="btn btn-success btn-circle">1</a>
|
||||
<p><small>{{ trans_choice('general.companies', 1) }}</small></p>
|
||||
</div>
|
||||
<div class="stepwizard-step col-xs-3">
|
||||
<button type="button" class="btn btn-default btn-circle" disabled="disabled">2</button>
|
||||
<p><small>{{ trans_choice('general.currencies', 2) }}</small></p>
|
||||
</div>
|
||||
<div class="stepwizard-step col-xs-3">
|
||||
<button type="button" class="btn btn-default btn-circle" disabled="disabled">3</button>
|
||||
<p><small>{{ trans_choice('general.taxes', 2) }}</small></p>
|
||||
</div>
|
||||
<div class="stepwizard-step col-xs-3">
|
||||
<button type="button" class="btn btn-default btn-circle" disabled="disabled">4</button>
|
||||
<p><small>{{ trans_choice('general.finish', 1) }}</small></p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="box box-success">
|
||||
<div id="wizard-loading"></div>
|
||||
|
||||
{!! Form::model($company, ['method' => 'PATCH', 'files' => true, 'url' => ['wizard/companies'], 'role' => 'form', 'class' => 'form-loading-button']) !!}
|
||||
|
||||
<div class="box-header with-border">
|
||||
<h3 class="box-title">{{ trans_choice('general.companies', 1) }}</h3>
|
||||
</div>
|
||||
<!-- /.box-header -->
|
||||
|
||||
<div class="box-body">
|
||||
<div class="col-md-12 {!! (!setting('general.api_token', null)) ?: 'hidden' !!}">
|
||||
<div class="form-group required {{ $errors->has('api_token') ? 'has-error' : ''}}">
|
||||
{!! Form::label('sale_price', trans('modules.api_token'), ['class' => 'control-label']) !!}
|
||||
<div class="input-group">
|
||||
<span class="input-group-addon"><i class="fa fa-key"></i></span>
|
||||
{!! Form::text('api_token', setting('general.api_token', null), ['class' => 'form-control', 'required' => 'required', 'placeholder' => trans('general.form.enter', ['field' => trans('modules.api_token')])]) !!}
|
||||
</div>
|
||||
{!! $errors->first('api_token', '<p class="help-block">:message</p>') !!}
|
||||
</div>
|
||||
<p>
|
||||
{!! trans('modules.token_link') !!}
|
||||
</p>
|
||||
</br>
|
||||
</div>
|
||||
|
||||
{{ Form::textGroup('company_tax_number', trans('general.tax_number'), 'percent', []) }}
|
||||
|
||||
{{ Form::textGroup('company_phone', trans('settings.company.phone'), 'phone', []) }}
|
||||
|
||||
{{ Form::textareaGroup('company_address', trans('settings.company.address')) }}
|
||||
|
||||
{{ Form::fileGroup('company_logo', trans('settings.company.logo')) }}
|
||||
</div>
|
||||
<!-- /.box-body -->
|
||||
|
||||
<div class="box-footer">
|
||||
<div class="col-md-12">
|
||||
<div class="form-group no-margin">
|
||||
{!! Form::button('<span class="fa fa-save"></span> ' . trans('general.save'), ['type' => 'submit', 'class' => 'btn btn-success button-submit', 'data-loading-text' => trans('general.loading')]) !!}
|
||||
<a href="{{ url('wizard/currencies') }}" id="wizard-skip" class="btn btn-default"><span class="fa fa-share"></span> {{ trans('general.skip') }}</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- /.box-footer -->
|
||||
|
||||
{!! Form::close() !!}
|
||||
</div>
|
||||
@endsection
|
||||
|
||||
@push('js')
|
||||
<script src="{{ asset('public/js/bootstrap-fancyfile.js') }}"></script>
|
||||
@endpush
|
||||
|
||||
@push('css')
|
||||
<link rel="stylesheet" href="{{ asset('public/css/bootstrap-fancyfile.css') }}">
|
||||
@endpush
|
||||
|
||||
@push('scripts')
|
||||
<script type="text/javascript">
|
||||
var text_yes = '{{ trans('general.yes') }}';
|
||||
var text_no = '{{ trans('general.no') }}';
|
||||
|
||||
$(document).ready(function() {
|
||||
$('#company_logo').fancyfile({
|
||||
text : '{{ trans('general.form.select.file') }}',
|
||||
style : 'btn-default',
|
||||
@if($company->company_logo)
|
||||
placeholder : '{{ $company->company_logo->basename }}',
|
||||
@else
|
||||
placeholder : '{{ trans('general.form.no_file_selected') }}',
|
||||
@endif
|
||||
});
|
||||
|
||||
@if($company->company_logo)
|
||||
company_logo_html = '<span class="company_logo">';
|
||||
company_logo_html += ' <a href="{{ url('uploads/' . $company->company_logo->id . '/download') }}">';
|
||||
company_logo_html += ' <span id="download-company_logo" class="text-primary">';
|
||||
company_logo_html += ' <i class="fa fa-file-{{ $company->company_logo->aggregate_type }}-o"></i> {{ $company->company_logo->basename }}';
|
||||
company_logo_html += ' </span>';
|
||||
company_logo_html += ' </a>';
|
||||
company_logo_html += ' {!! Form::open(['id' => 'company_logo-' . $company->company_logo->id, 'method' => 'DELETE', 'url' => [url('uploads/' . $company->company_logo->id)], 'style' => 'display:inline']) !!}';
|
||||
company_logo_html += ' <a id="remove-company_logo" href="javascript:void();">';
|
||||
company_logo_html += ' <span class="text-danger"><i class="fa fa fa-times"></i></span>';
|
||||
company_logo_html += ' </a>';
|
||||
company_logo_html += ' <input type="hidden" name="page" value="setting" />';
|
||||
company_logo_html += ' <input type="hidden" name="key" value="general.company_logo" />';
|
||||
company_logo_html += ' <input type="hidden" name="value" value="{{ $company->company_logo->id }}" />';
|
||||
company_logo_html += ' {!! Form::close() !!}';
|
||||
company_logo_html += '</span>';
|
||||
|
||||
$('.form-group.col-md-6 .fancy-file .fake-file').append(company_logo_html);
|
||||
|
||||
$(document).on('click', '#remove-company_logo', function (e) {
|
||||
confirmDelete("#company_logo-{!! $company->company_logo->id !!}", "{!! trans('general.attachment') !!}", "{!! trans('general.delete_confirm', ['name' => '<strong>' . $company->company_logo->basename . '</strong>', 'type' => strtolower(trans('general.attachment'))]) !!}", "{!! trans('general.cancel') !!}", "{!! trans('general.delete') !!}");
|
||||
});
|
||||
@endif
|
||||
});
|
||||
</script>
|
||||
@endpush
|
30
resources/views/wizard/currencies/create.blade.php
Normal file
30
resources/views/wizard/currencies/create.blade.php
Normal file
@ -0,0 +1,30 @@
|
||||
<tr id="currency-create">
|
||||
<td>
|
||||
{{ Form::textGroup('name', trans('general.name'), 'id-card-o', ['required' => 'required'], null, '') }}
|
||||
</td>
|
||||
<td class="hidden-xs">
|
||||
{{ Form::selectGroup('code', trans('currencies.code'), 'code', $codes, null, ['required' => 'required'], '') }}
|
||||
</td>
|
||||
<td>
|
||||
{{ Form::textGroup('rate', trans('currencies.rate'), 'money', ['required' => 'required'], null, '') }}
|
||||
</td>
|
||||
<td class="hidden-xs">
|
||||
{{ Form::radioGroup('enabled', trans('general.enabled'), trans('general.yes'), trans('general.no'), [], 'col-md-12 currency-enabled-radio-group') }}
|
||||
</td>
|
||||
<td class="text-center">
|
||||
{!! Form::button('<span class="fa fa-save"></span>', ['type' => 'button', 'class' => 'btn btn-success currency-submit', 'data-loading-text' => trans('general.loading'), 'data-href' => url('wizard/currencies/'), 'style' => 'padding: 9px 14px; margin-top: 10px;']) !!}
|
||||
</td>
|
||||
<td class="hidden">
|
||||
{{ Form::numberGroup('precision', trans('currencies.precision'), 'bullseye') }}
|
||||
|
||||
{{ Form::textGroup('symbol', trans('currencies.symbol.symbol'), 'font') }}
|
||||
|
||||
{{ Form::selectGroup('symbol_first', trans('currencies.symbol.position'), 'text-width', ['1' => trans('currencies.symbol.before'), '0' => trans('currencies.symbol.after')]) }}
|
||||
|
||||
{{ Form::textGroup('decimal_mark', trans('currencies.decimal_mark'), 'columns') }}
|
||||
|
||||
{{ Form::textGroup('thousands_separator', trans('currencies.thousands_separator'), 'columns', []) }}
|
||||
|
||||
{{ Form::radioGroup('default_currency', trans('currencies.default')) }}
|
||||
</td>
|
||||
</tr>
|
32
resources/views/wizard/currencies/edit.blade.php
Normal file
32
resources/views/wizard/currencies/edit.blade.php
Normal file
@ -0,0 +1,32 @@
|
||||
<tr id="currency-edit">
|
||||
<td>
|
||||
{{ Form::textGroup('name', trans('general.name'), 'id-card-o', [], $item->name, '') }}
|
||||
</td>
|
||||
<td class="hidden-xs">
|
||||
{{ Form::selectGroup('code', trans('currencies.code'), 'code', $codes, $item->code, [], '') }}
|
||||
</td>
|
||||
<td>
|
||||
{{ Form::textGroup('rate', trans('currencies.rate'), 'money', [], $item->rate, '') }}
|
||||
</td>
|
||||
<td class="hidden-xs">
|
||||
{{ Form::radioGroup('enabled', trans('general.enabled'), trans('general.yes'), trans('general.no'), [], 'col-md-12') }}
|
||||
</td>
|
||||
<td class="text-center">
|
||||
{!! Form::button('<span class="fa fa-save"></span>', ['type' => 'button', 'class' => 'btn btn-success currency-updated', 'data-loading-text' => trans('general.loading'), 'data-href' => url('wizard/currencies/' . $item->id), 'style' => 'padding: 9px 14px; margin-top: 10px;']) !!}
|
||||
</td>
|
||||
<td class="hidden">
|
||||
{{ Form::numberGroup('precision', trans('currencies.precision'), 'bullseye', [], $item->precision) }}
|
||||
|
||||
{{ Form::textGroup('symbol', trans('currencies.symbol.symbol'), 'font', [], $item->symbol, '') }}
|
||||
|
||||
{{ Form::selectGroup('symbol_first', trans('currencies.symbol.position'), 'text-width', ['1' => trans('currencies.symbol.before'), '0' => trans('currencies.symbol.after')], $item->symbol_first) }}
|
||||
|
||||
{{ Form::textGroup('decimal_mark', trans('currencies.decimal_mark'), 'columns', [], $item->decimal_mark, '') }}
|
||||
|
||||
{{ Form::textGroup('thousands_separator', trans('currencies.thousands_separator'), 'columns', [], $item->thousands_separator) }}
|
||||
|
||||
{{ Form::radioGroup('default_currency', trans('currencies.default')) }}
|
||||
|
||||
{{ Form::hidden('id', $item->id) }}
|
||||
</td>
|
||||
</tr>
|
379
resources/views/wizard/currencies/index.blade.php
Normal file
379
resources/views/wizard/currencies/index.blade.php
Normal file
@ -0,0 +1,379 @@
|
||||
@extends('layouts.wizard')
|
||||
|
||||
@section('title', trans('general.wizard'))
|
||||
|
||||
@section('content')
|
||||
<!-- Default box -->
|
||||
<div class="box box-solid">
|
||||
<div class="box-body">
|
||||
<div class="stepwizard">
|
||||
<div class="stepwizard-row setup-panel">
|
||||
<div class="stepwizard-step col-xs-3">
|
||||
<a href="{{ url('wizard/companies') }}" type="button" class="btn btn-default btn-circle">1</a>
|
||||
<p><small>{{ trans_choice('general.companies', 1) }}</small></p>
|
||||
</div>
|
||||
<div class="stepwizard-step col-xs-3">
|
||||
<a href="#step-2" type="button" class="btn btn-success btn-circle">2</a>
|
||||
<p><small>{{ trans_choice('general.currencies', 2) }}</small></p>
|
||||
</div>
|
||||
<div class="stepwizard-step col-xs-3">
|
||||
<button type="button" class="btn btn-default btn-circle" disabled="disabled">3</button>
|
||||
<p><small>{{ trans_choice('general.taxes', 2) }}</small></p>
|
||||
</div>
|
||||
<div class="stepwizard-step col-xs-3">
|
||||
<button type="button" class="btn btn-default btn-circle" disabled="disabled">4</button>
|
||||
<p><small>{{ trans_choice('general.finish', 1) }}</small></p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="box box-success">
|
||||
<div id="wizard-loading"></div>
|
||||
|
||||
<div class="box-header with-border">
|
||||
<h3 class="box-title">{{ trans_choice('general.currencies', 1) }}</h3>
|
||||
<span class="new-button"><a href="javascript:void(0);" data-href="{{ url('wizard/currencies/create') }}" class="btn btn-success btn-sm currency-create"><span class="fa fa-plus"></span> {{ trans('general.add_new') }}</a></span>
|
||||
</div>
|
||||
<!-- /.box-header -->
|
||||
|
||||
<div class="box-body">
|
||||
<div class="table table-responsive">
|
||||
<table class="table table-striped table-hover" id="tbl-currencies">
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="col-md-4">@sortablelink('name', trans('general.name'))</th>
|
||||
<th class="col-md-3 hidden-xs">@sortablelink('code', trans('currencies.code'))</th>
|
||||
<th class="col-md-2">@sortablelink('rate', trans('currencies.rate'))</th>
|
||||
<th class="col-md-2 hidden-xs">@sortablelink('enabled', trans_choice('general.statuses', 1))</th>
|
||||
<th class="col-md-1 text-center">{{ trans('general.actions') }}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach($currencies as $item)
|
||||
<tr id="currency-{{ $item->id }}" data-href="{{ url('wizard/currencies/' . $item->id . '/delete') }}">
|
||||
<td class="currency-name"><a href="javascript:void(0);" data-id="{{ $item->id }}" data-href="{{ url('wizard/currencies/' . $item->id . '/edit') }}" class="currency-edit">{{ $item->name }}</a></td>
|
||||
<td class="currency-code hidden-xs">{{ $item->code }}</td>
|
||||
<td class="currency-rate">{{ $item->rate }}</td>
|
||||
<td class="currency-status hidden-xs">
|
||||
@if ($item->enabled)
|
||||
<span class="label label-success">{{ trans('general.enabled') }}</span>
|
||||
@else
|
||||
<span class="label label-danger">{{ trans('general.disabled') }}</span>
|
||||
@endif
|
||||
</td>
|
||||
<td class="currency-action text-center">
|
||||
<div class="btn-group">
|
||||
<button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown" data-toggle-position="left" aria-expanded="false">
|
||||
<i class="fa fa-ellipsis-h"></i>
|
||||
</button>
|
||||
<ul class="dropdown-menu dropdown-menu-right">
|
||||
<li><a href="javascript:void(0);" data-id="{{ $item->id }}" data-href="{{ url('wizard/currencies/' . $item->id . '/edit') }}" class="currency-edit">{{ trans('general.edit') }}</a></li>
|
||||
@if ($item->enabled)
|
||||
<li><a href="javascript:void(0);" data-href="{{ url('wizard/currencies/' . $item->id . '/disable') }}" class="currency-disable">{{ trans('general.disable') }}</a></li>
|
||||
@else
|
||||
<li><a href="javascript:void(0);" data-href="{{ url('wizard/currencies/' . $item->id . '/enable') }}" class="currency-enable">{{ trans('general.enable') }}</a></li>
|
||||
@endif
|
||||
@permission('delete-settings-currencies')
|
||||
<li class="divider"></li>
|
||||
<li>
|
||||
{!! Form::button(trans('general.delete'), array(
|
||||
'type' => 'button',
|
||||
'class' => 'delete-link',
|
||||
'title' => trans('general.delete'),
|
||||
'onclick' => 'confirmCurrency("' . '#currency-' . $item->id . '", "' . trans_choice('general.currencies', 2) . '", "' . trans('general.delete_confirm', ['name' => '<strong>' . $item->name . '</strong>', 'type' => mb_strtolower(trans_choice('general.currencies', 1))]) . '", "' . trans('general.cancel') . '", "' . trans('general.delete') . '")'
|
||||
)) !!}
|
||||
</li>
|
||||
@endpermission
|
||||
</ul>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
@endforeach
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
<!-- /.box-body -->
|
||||
|
||||
<div class="box-footer">
|
||||
<div class="col-md-12">
|
||||
<div class="form-group no-margin">
|
||||
<a href="{{ url('wizard/taxes') }}" id="wizard-skip" class="btn btn-default"><span class="fa fa-share"></span> {{ trans('general.skip') }}</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- /.box-footer -->
|
||||
</div>
|
||||
@endsection
|
||||
|
||||
@push('scripts')
|
||||
<script type="text/javascript">
|
||||
var text_yes = '{{ trans('general.yes') }}';
|
||||
var text_no = '{{ trans('general.no') }}';
|
||||
|
||||
$(document).on('click', '.currency-create', function (e) {
|
||||
$('#currency-create').remove();
|
||||
$('#currency-edit').remove();
|
||||
|
||||
data_href = $(this).data('href');
|
||||
|
||||
$.ajax({
|
||||
url: data_href,
|
||||
type: 'GET',
|
||||
dataType: 'JSON',
|
||||
success: function(json) {
|
||||
if (json['success']) {
|
||||
$('#tbl-currencies tbody').append(json['html']);
|
||||
|
||||
$("#code").select2({
|
||||
placeholder: "{{ trans('general.form.select.field', ['field' => trans('currencies.code')]) }}"
|
||||
});
|
||||
|
||||
$('.currency-enabled-radio-group #enabled_1').trigger('click');
|
||||
|
||||
$('#name').focus();
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
$(document).on('click', '.currency-submit', function (e) {
|
||||
$(this).html('<span class="fa fa-spinner fa-pulse"></span>');
|
||||
$('.help-block').remove();
|
||||
|
||||
data_href = $(this).data('href');
|
||||
|
||||
$.ajax({
|
||||
url: '{{ url("wizard/currencies") }}',
|
||||
type: 'POST',
|
||||
dataType: 'JSON',
|
||||
data: $('#tbl-currencies input[type=\'number\'], #tbl-currencies input[type=\'text\'], #tbl-currencies input[type=\'radio\'], #tbl-currencies input[type=\'hidden\'], #tbl-currencies textarea, #tbl-currencies select').serialize(),
|
||||
headers: { 'X-CSRF-TOKEN': '{{ csrf_token() }}' },
|
||||
success: function(json) {
|
||||
$('.currency-submit').html('<span class="fa fa-save"></span>');
|
||||
|
||||
if (json['success']) {
|
||||
currency = json['data'];
|
||||
$('#currency-create').remove();
|
||||
$('#currency-edit').remove();
|
||||
|
||||
html = '<tr id="currency-' + currency.id + '" data-href="wizard/currencies/' + currency.id + '/delete">';
|
||||
html += ' <td class="currency-name">';
|
||||
html += ' <a href="javascript:void(0);" data-id="' + currency.id + '" data-href="wizard/currencies/' + currency.id + '/edit" class="currency-edit">' + currency.name + '</a>';
|
||||
html += ' </td>';
|
||||
html += ' <td class="currency-code hidden-xs">' + currency.code + '</td>';
|
||||
html += ' <td class="currency-rate">' + currency.rate + '</td>';
|
||||
html += ' <td class="currency-status hidden-xs">';
|
||||
html += ' <span class="label label-success">Enabled</span>';
|
||||
html += ' </td>';
|
||||
html += ' <td class="currency-action text-center">';
|
||||
html += ' <div class="btn-group">';
|
||||
html += ' <button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown" data-toggle-position="left" aria-expanded="false">';
|
||||
html += ' <i class="fa fa-ellipsis-h"></i>';
|
||||
html += ' </button>';
|
||||
html += ' <ul class="dropdown-menu dropdown-menu-right">';
|
||||
html += ' <li><a href="javascript:void(0);" data-id="' + currency.id + '" data-href="wizard/currencies/' + currency.id + '/edit" class="currency-edit">{{ trans('general.edit') }}</a></li>';
|
||||
html += ' <li><a href="javascript:void(0);" data-href="wizard/currencies/' + currency.id + '/disable" class="currency-disable">{{ trans('general.disable') }}</a></li>';
|
||||
html += ' <li class="divider"></li>';
|
||||
html += ' <li>';
|
||||
html += ' <button type="button" class="delete-link" title="{{ trans('general.delete') }}" onclick="confirmCurrency("#currency-' + currency.id + '", "{{ trans_choice('general.currencies', 2) }}", "{{ trans('general.delete_confirm', ['name' => '<strong>' . $item->name . '</strong>', 'type' => mb_strtolower(trans_choice('general.currencies', 1))]) }}", "{{ trans('general.cancel') }}", "{{ trans('general.delete') }}")">{{ trans('general.delete') }}</button>';
|
||||
html += ' </li>';
|
||||
html += ' </ul>';
|
||||
html += ' </div>';
|
||||
html += ' </td>';
|
||||
html += '</tr>';
|
||||
|
||||
$('#tbl-currencies tbody').append(html);
|
||||
}
|
||||
},
|
||||
error: function(data){
|
||||
$('.currency-submit').html('<span class="fa fa-save"></span>');
|
||||
|
||||
var errors = data.responseJSON;
|
||||
|
||||
if (typeof errors !== 'undefined') {
|
||||
if (errors.name) {
|
||||
$('#tbl-currencies #name').parent().after('<p class="help-block" style="color: #ca1313;">' + errors.name + '</p>');
|
||||
}
|
||||
|
||||
if (errors.code) {
|
||||
$('#tbl-currencies #code').parent().after('<p class="help-block" style="color: #ca1313;">' + errors.code + '</p>');
|
||||
}
|
||||
|
||||
if (errors.rate) {
|
||||
$('#tbl-currencies #rate').parent().after('<p class="help-block" style="color: #ca1313;">' + errors.rate + '</p>');
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
$(document).on('click', '.currency-edit', function (e) {
|
||||
$('#currency-create').remove();
|
||||
$('#currency-edit').remove();
|
||||
|
||||
data_href = $(this).data('href');
|
||||
data_id = $(this).data('id');
|
||||
|
||||
$.ajax({
|
||||
url: data_href,
|
||||
type: 'GET',
|
||||
dataType: 'JSON',
|
||||
success: function(json) {
|
||||
if (json['success']) {
|
||||
$('#currency-' + data_id).after(json['html']);
|
||||
|
||||
$("#code").select2({
|
||||
placeholder: "{{ trans('general.form.select.field', ['field' => trans('currencies.code')]) }}"
|
||||
});
|
||||
|
||||
$('.currency-enabled-radio-group #enabled_1').trigger();
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
$(document).on('click', '.currency-updated', function (e) {
|
||||
$(this).html('<span class="fa fa-spinner fa-pulse"></span>');
|
||||
$('.help-block').remove();
|
||||
|
||||
data_href = $(this).data('href');
|
||||
|
||||
$.ajax({
|
||||
url: data_href,
|
||||
type: 'PATCH',
|
||||
dataType: 'JSON',
|
||||
data: $('#tbl-currencies input[type=\'number\'], #tbl-currencies input[type=\'text\'], #tbl-currencies input[type=\'radio\'], #tbl-currencies input[type=\'hidden\'], #tbl-currencies textarea, #tbl-currencies select').serialize(),
|
||||
headers: { 'X-CSRF-TOKEN': '{{ csrf_token() }}' },
|
||||
success: function(json) {
|
||||
$('.currency-updated').html('<span class="fa fa-save"></span>');
|
||||
|
||||
if (json['success']) {
|
||||
$('#currency-create').remove();
|
||||
$('#currency-edit').remove();
|
||||
}
|
||||
},
|
||||
error: function(data){
|
||||
$('.currency-updated').html('<span class="fa fa-save"></span>');
|
||||
|
||||
var errors = data.responseJSON;
|
||||
|
||||
if (typeof errors !== 'undefined') {
|
||||
if (errors.name) {
|
||||
$('#tbl-currencies #name').parent().after('<p class="help-block" style="color: #ca1313;">' + errors.name + '</p>');
|
||||
}
|
||||
|
||||
if (errors.code) {
|
||||
$('#tbl-currencies #code').parent().after('<p class="help-block" style="color: #ca1313;">' + errors.code + '</p>');
|
||||
}
|
||||
|
||||
if (errors.rate) {
|
||||
$('#tbl-currencies #rate').parent().after('<p class="help-block" style="color: #ca1313;">' + errors.rate + '</p>');
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
$(document).on('click', '.currency-disable', function (e) {
|
||||
data_href = $(this).data('href');
|
||||
|
||||
currency_tr = $(this).parent().parent().parent().parent().parent();
|
||||
|
||||
$.ajax({
|
||||
url: data_href,
|
||||
type: 'GET',
|
||||
dataType: 'JSON',
|
||||
success: function(json) {
|
||||
if (json['success']) {
|
||||
currency_tr.find('.currency-status').html('<span class="label label-danger">{{ trans('general.disabled') }}</span>');
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
$(document).on('click', '.currency-enable', function (e) {
|
||||
data_href = $(this).data('href');
|
||||
|
||||
currency_tr = $(this).parent().parent().parent().parent().parent();
|
||||
|
||||
$.ajax({
|
||||
url: data_href,
|
||||
type: 'GET',
|
||||
dataType: 'JSON',
|
||||
success: function(json) {
|
||||
if (json['success']) {
|
||||
currency_tr.find('.currency-status').html('<span class="label label-success">{{ trans('general.enabled') }}</span>');
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
$(document).on('change', '#code', function (e) {
|
||||
$.ajax({
|
||||
url: '{{ url("settings/currencies/config") }}',
|
||||
type: 'GET',
|
||||
dataType: 'JSON',
|
||||
data: 'code=' + $(this).val(),
|
||||
success: function(data) {
|
||||
$('#precision').val(data.precision);
|
||||
$('#symbol').val(data.symbol);
|
||||
$('#symbol_first').val(data.symbol_first);
|
||||
$('#decimal_mark').val(data.decimal_mark);
|
||||
$('#thousands_separator').val(data.thousands_separator);
|
||||
|
||||
// This event Select2 Stylesheet
|
||||
$('#symbol_first').trigger('change');
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
function confirmCurrency(tr_id, title, message, button_cancel, button_delete) {
|
||||
$('#confirm-modal').remove();
|
||||
|
||||
var html = '';
|
||||
|
||||
html += '<div class="modal fade" id="confirm-modal" tabindex="-1" role="dialog" aria-labelledby="confirmModalLabel" aria-hidden="true">';
|
||||
html += ' <div class="modal-dialog">';
|
||||
html += ' <div class="modal-content">';
|
||||
html += ' <div class="modal-header">';
|
||||
html += ' <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>';
|
||||
html += ' <h4 class="modal-title" id="confirmModalLabel">' + title + '</h4>';
|
||||
html += ' </div>';
|
||||
html += ' <div class="modal-body">';
|
||||
html += ' <p>' + message + '</p>';
|
||||
html += ' <p></p>';
|
||||
html += ' </div>';
|
||||
html += ' <div class="modal-footer">';
|
||||
html += ' <div class="pull-left">';
|
||||
html += ' <button type="button" class="btn btn-danger" onclick="deleteCurrency(\'' + tr_id + '\');">' + button_delete + '</button>';
|
||||
html += ' <button type="button" class="btn btn-default" data-dismiss="modal">' + button_cancel + '</button>';
|
||||
html += ' </div>';
|
||||
html += ' </div>';
|
||||
html += ' </div>';
|
||||
html += ' </div>';
|
||||
html += '</div>';
|
||||
|
||||
$('body').append(html);
|
||||
|
||||
$('#confirm-modal').modal('show');
|
||||
}
|
||||
|
||||
function deleteCurrency(tr_id) {
|
||||
data_href = $(tr_id).data('href');
|
||||
|
||||
$.ajax({
|
||||
url: data_href,
|
||||
type: 'GET',
|
||||
dataType: 'JSON',
|
||||
success: function(json) {
|
||||
if (json['success']) {
|
||||
$(tr_id).remove();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
</script>
|
||||
@endpush
|
88
resources/views/wizard/finish/index.blade.php
Normal file
88
resources/views/wizard/finish/index.blade.php
Normal file
@ -0,0 +1,88 @@
|
||||
@extends('layouts.wizard')
|
||||
|
||||
@section('title', trans('general.wizard'))
|
||||
|
||||
@section('content')
|
||||
<!-- Default box -->
|
||||
<div class="box box-solid">
|
||||
<div class="box-body">
|
||||
<div class="stepwizard">
|
||||
<div class="stepwizard-row setup-panel">
|
||||
<div class="stepwizard-step col-xs-3">
|
||||
<a href="{{ url('wizard/companies') }}" type="button" class="btn btn-default btn-circle">1</a>
|
||||
<p><small>{{ trans_choice('general.companies', 1) }}</small></p>
|
||||
</div>
|
||||
<div class="stepwizard-step col-xs-3">
|
||||
<a href="{{ url('wizard/currencies') }}" type="button" class="btn btn-default btn-circle">2</a>
|
||||
<p><small>{{ trans_choice('general.currencies', 2) }}</small></p>
|
||||
</div>
|
||||
<div class="stepwizard-step col-xs-3">
|
||||
<a href="{{ url('wizard/taxes') }}" type="button" class="btn btn-default btn-circle">3</a>
|
||||
<p><small>{{ trans_choice('general.taxes', 2) }}</small></p>
|
||||
</div>
|
||||
<div class="stepwizard-step col-xs-3">
|
||||
<a href="#step-4" type="button" class="btn btn-success btn-circle">4</a>
|
||||
<p><small>{{ trans_choice('general.finish', 1) }}</small></p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row" style="margin-top: 50px;">
|
||||
<div class="col-md-12 no-padding-right text-center">
|
||||
<a href="{{ url('/') }}" class="btn btn-lg btn-success"><span class="fa fa-dashboard"></span> {{ trans('general.go_to', ['name' => trans('general.dashboard')]) }}</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-12 no-padding-right">
|
||||
<div class="content-header no-padding-left">
|
||||
<h3>{{ trans('modules.recommended_apps') }}</h3>
|
||||
</div>
|
||||
|
||||
@if ($modules)
|
||||
@foreach ($modules->data as $module)
|
||||
@include('partials.modules.item')
|
||||
@endforeach
|
||||
<div class="col-md-12 no-padding-left">
|
||||
<ul class="pager nomargin">
|
||||
@if ($modules->current_page < $modules->last_page)
|
||||
<li class="next"><a href="{{ url(request()->path()) }}?page={{ $modules->current_page + 1 }}" class="btn btn-default btn-sm">{{ trans('pagination.next') }}</a></li>
|
||||
@endif
|
||||
@if ($modules->current_page > 1)
|
||||
<li class="previous"><a href="{{ url(request()->path()) }}?page={{ $modules->current_page - 1 }}" class="btn btn-default btn-sm">{{ trans('pagination.previous') }}</a></li>
|
||||
@endif
|
||||
</ul>
|
||||
</div>
|
||||
@else
|
||||
<div class="box box-success">
|
||||
<div class="box-body">
|
||||
<p class="col-md-12" style="margin-top: 15px">
|
||||
{{ trans('modules.no_apps') }}
|
||||
</p>
|
||||
<p class="col-md-12" style="margin-top: 20px">
|
||||
<small>{!! trans('modules.developer') !!}</small>
|
||||
</p>
|
||||
</div>
|
||||
<!-- /.box-body -->
|
||||
</div>
|
||||
@endif
|
||||
</div>
|
||||
</div>
|
||||
@endsection
|
||||
|
||||
@push('css')
|
||||
<link rel="stylesheet" href="{{ asset('public/css/modules.css?v=' . version('short')) }}">
|
||||
@endpush
|
||||
|
||||
@push('scripts')
|
||||
<script type="text/javascript">
|
||||
var text_yes = '{{ trans('general.yes') }}';
|
||||
var text_no = '{{ trans('general.no') }}';
|
||||
|
||||
$(document).ready(function() {
|
||||
|
||||
});
|
||||
</script>
|
||||
@endpush
|
14
resources/views/wizard/taxes/create.blade.php
Normal file
14
resources/views/wizard/taxes/create.blade.php
Normal file
@ -0,0 +1,14 @@
|
||||
<tr id="tax-create">
|
||||
<td>
|
||||
{{ Form::textGroup('name', trans('general.name'), 'id-card-o', ['required' => 'required'], null, '') }}
|
||||
</td>
|
||||
<td>
|
||||
{{ Form::textGroup('rate', trans('currencies.rate'), 'money', ['required' => 'required'], null, '') }}
|
||||
</td>
|
||||
<td class="hidden-xs">
|
||||
{{ Form::radioGroup('enabled', trans('general.enabled'), trans('general.yes'), trans('general.no'), [], 'col-md-12 tax-enabled-radio-group') }}
|
||||
</td>
|
||||
<td class="text-center">
|
||||
{!! Form::button('<span class="fa fa-save"></span>', ['type' => 'button', 'class' => 'btn btn-success tax-submit', 'data-loading-text' => trans('general.loading'), 'data-href' => url('wizard/taxes'), 'style' => 'padding: 9px 14px; margin-top: 10px;']) !!}
|
||||
</td>
|
||||
</tr>
|
14
resources/views/wizard/taxes/edit.blade.php
Normal file
14
resources/views/wizard/taxes/edit.blade.php
Normal file
@ -0,0 +1,14 @@
|
||||
<tr id="tax-edit">
|
||||
<td>
|
||||
{{ Form::textGroup('name', trans('general.name'), 'id-card-o', ['required' => 'required'], $item->name, '') }}
|
||||
</td>
|
||||
<td>
|
||||
{{ Form::textGroup('rate', trans('currencies.rate'), 'money', ['required' => 'required'], $item->rate, '') }}
|
||||
</td>
|
||||
<td class="hidden-xs">
|
||||
{{ Form::radioGroup('enabled', trans('general.enabled'), trans('general.yes'), trans('general.no'), [], 'col-md-12') }}
|
||||
</td>
|
||||
<td class="text-center">
|
||||
{!! Form::button('<span class="fa fa-save"></span>', ['type' => 'button', 'class' => 'btn btn-success tax-updated', 'data-loading-text' => trans('general.loading'), 'data-href' => url('wizard/taxes/' . $item->id), 'style' => 'padding: 9px 14px; margin-top: 10px;']) !!}
|
||||
</td>
|
||||
</tr>
|
377
resources/views/wizard/taxes/index.blade.php
Normal file
377
resources/views/wizard/taxes/index.blade.php
Normal file
@ -0,0 +1,377 @@
|
||||
@extends('layouts.wizard')
|
||||
|
||||
@section('title', trans('general.wizard'))
|
||||
|
||||
@section('content')
|
||||
<!-- Default box -->
|
||||
<div class="box box-solid">
|
||||
<div class="box-body">
|
||||
<div class="stepwizard">
|
||||
<div class="stepwizard-row setup-panel">
|
||||
<div class="stepwizard-step col-xs-3">
|
||||
<a href="{{ url('wizard/companies') }}" type="button" class="btn btn-default btn-circle">1</a>
|
||||
<p><small>{{ trans_choice('general.companies', 1) }}</small></p>
|
||||
</div>
|
||||
<div class="stepwizard-step col-xs-3">
|
||||
<a href="{{ url('wizard/currencies') }}" type="button" class="btn btn-default btn-circle">2</a>
|
||||
<p><small>{{ trans_choice('general.currencies', 2) }}</small></p>
|
||||
</div>
|
||||
<div class="stepwizard-step col-xs-3">
|
||||
<a href="#step-3" type="button" class="btn btn-success btn-circle">3</a>
|
||||
<p><small>{{ trans_choice('general.taxes', 2) }}</small></p>
|
||||
</div>
|
||||
<div class="stepwizard-step col-xs-3">
|
||||
<button type="button" class="btn btn-default btn-circle" disabled="disabled">4</button>
|
||||
<p><small>{{ trans_choice('general.finish', 1) }}</small></p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="box box-success">
|
||||
<div id="wizard-loading"></div>
|
||||
|
||||
<div class="box-header with-border">
|
||||
<h3 class="box-title">{{ trans_choice('general.taxes', 1) }}</h3>
|
||||
<span class="new-button"><a href="javascript:void(0);" data-href="{{ url('wizard/taxes/create') }}" class="btn btn-success btn-sm tax-create"><span class="fa fa-plus"></span> {{ trans('general.add_new') }}</a></span>
|
||||
</div>
|
||||
<!-- /.box-header -->
|
||||
|
||||
<div class="box-body">
|
||||
<div class="table table-responsive">
|
||||
<table class="table table-striped table-hover" id="tbl-taxes">
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="col-md-5">@sortablelink('name', trans('general.name'))</th>
|
||||
<th class="col-md-4">@sortablelink('rate', trans('taxes.rate_percent'))</th>
|
||||
<th class="col-md-2 hidden-xs">@sortablelink('enabled', trans_choice('general.statuses', 1))</th>
|
||||
<th class="col-md-1 text-center">{{ trans('general.actions') }}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach($taxes as $item)
|
||||
<tr id="tax-{{ $item->id }}" data-href="{{ url('wizard/taxes/' . $item->id . '/delete') }}">
|
||||
<td class="tax-name"><a href="javascript:void(0);" data-id="{{ $item->id }}" data-href="{{ url('wizard/taxes/' . $item->id . '/edit') }}" class="tax-edit">{{ $item->name }}</a></td>
|
||||
<td class="tax-rate">{{ $item->rate }}</td>
|
||||
<td class="tax-status hidden-xs">
|
||||
@if ($item->enabled)
|
||||
<span class="label label-success">{{ trans('general.enabled') }}</span>
|
||||
@else
|
||||
<span class="label label-danger">{{ trans('general.disabled') }}</span>
|
||||
@endif
|
||||
</td>
|
||||
<td class="tax-action text-center">
|
||||
<div class="btn-group">
|
||||
<button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown" data-toggle-position="left" aria-expanded="false">
|
||||
<i class="fa fa-ellipsis-h"></i>
|
||||
</button>
|
||||
<ul class="dropdown-menu dropdown-menu-right">
|
||||
<li><a href="javascript:void(0);" data-href="{{ url('wizard/taxes/' . $item->id . '/edit') }}" class="tax-edit">{{ trans('general.edit') }}</a></li>
|
||||
@if ($item->enabled)
|
||||
<li><a href="javascript:void(0);" data-href="{{ url('wizard/taxes/' . $item->id . '/disable') }}" class="tax-disable">{{ trans('general.disable') }}</a></li>
|
||||
@else
|
||||
<li><a href="javascript:void(0);" data-href="{{ url('wizard/taxes/' . $item->id . '/enable') }}" class="tax-enable">{{ trans('general.enable') }}</a></li>
|
||||
@endif
|
||||
@permission('delete-settings-taxes')
|
||||
<li class="divider"></li>
|
||||
<li>
|
||||
{!! Form::button(trans('general.delete'), array(
|
||||
'type' => 'button',
|
||||
'class' => 'delete-link',
|
||||
'title' => trans('general.delete'),
|
||||
'onclick' => 'confirmTax("' . '#tax-' . $item->id . '", "' . trans_choice('general.taxes', 2) . '", "' . trans('general.delete_confirm', ['name' => '<strong>' . $item->name . '</strong>', 'type' => mb_strtolower(trans_choice('general.taxes', 1))]) . '", "' . trans('general.cancel') . '", "' . trans('general.delete') . '")'
|
||||
)) !!}
|
||||
</li>
|
||||
@endpermission
|
||||
</ul>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
@endforeach
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
<!-- /.box-body -->
|
||||
|
||||
<div class="box-footer">
|
||||
<div class="col-md-12">
|
||||
<div class="form-group no-margin">
|
||||
<a href="{{ url('wizard/finish') }}" id="wizard-skip" class="btn btn-default"><span class="fa fa-share"></span> {{ trans('general.skip') }}</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- /.box-footer -->
|
||||
|
||||
</div>
|
||||
@endsection
|
||||
|
||||
@push('scripts')
|
||||
<script type="text/javascript">
|
||||
var text_yes = '{{ trans('general.yes') }}';
|
||||
var text_no = '{{ trans('general.no') }}';
|
||||
|
||||
$(document).on('click', '.tax-create', function (e) {
|
||||
$('#tax-create').remove();
|
||||
$('#tax-edit').remove();
|
||||
|
||||
data_href = $(this).data('href');
|
||||
|
||||
$.ajax({
|
||||
url: data_href,
|
||||
type: 'GET',
|
||||
dataType: 'JSON',
|
||||
success: function(json) {
|
||||
if (json['success']) {
|
||||
$('#tbl-taxes tbody').append(json['html']);
|
||||
|
||||
$("#code").select2({
|
||||
placeholder: "{{ trans('general.form.select.field', ['field' => trans('taxes.code')]) }}"
|
||||
});
|
||||
|
||||
$('.tax-enabled-radio-group #enabled_1').trigger('click');
|
||||
|
||||
$('#name').focus();
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
$(document).on('click', '.tax-submit', function (e) {
|
||||
$(this).html('<span class="fa fa-spinner fa-pulse"></span>');
|
||||
$('.help-block').remove();
|
||||
|
||||
data_href = $(this).data('href');
|
||||
|
||||
$.ajax({
|
||||
url: '{{ url("wizard/taxes") }}',
|
||||
type: 'POST',
|
||||
dataType: 'JSON',
|
||||
data: $('#tbl-taxes input[type=\'number\'], #tbl-taxes input[type=\'text\'], #tbl-taxes input[type=\'radio\'], #tbl-taxes input[type=\'hidden\'], #tbl-taxes textarea, #tbl-taxes select').serialize(),
|
||||
headers: { 'X-CSRF-TOKEN': '{{ csrf_token() }}' },
|
||||
success: function(json) {
|
||||
$('.tax-submit').html('<span class="fa fa-save"></span>');
|
||||
|
||||
if (json['success']) {
|
||||
tax = json['data'];
|
||||
$('#tax-create').remove();
|
||||
$('#tax-edit').remove();
|
||||
|
||||
html = '<tr id="tax-' + tax.id + '" data-href="wizard/taxes/' + tax.id + '/delete">';
|
||||
html += ' <td class="tax-name">';
|
||||
html += ' <a href="javascript:void(0);" data-id="' + tax.id + '" data-href="wizard/taxes/' + tax.id + '/edit" class="tax-edit">' + tax.name + '</a>';
|
||||
html += ' </td>';
|
||||
html += ' <td class="tax-rate">' + tax.rate + '</td>';
|
||||
html += ' <td class="tax-status hidden-xs">';
|
||||
html += ' <span class="label label-success">Enabled</span>';
|
||||
html += ' </td>';
|
||||
html += ' <td class="tax-action text-center">';
|
||||
html += ' <div class="btn-group">';
|
||||
html += ' <button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown" data-toggle-position="left" aria-expanded="false">';
|
||||
html += ' <i class="fa fa-ellipsis-h"></i>';
|
||||
html += ' </button>';
|
||||
html += ' <ul class="dropdown-menu dropdown-menu-right">';
|
||||
html += ' <li><a href="javascript:void(0);" data-id="' + tax.id + '" data-href="wizard/taxes/' + tax.id + '/edit" class="tax-edit">{{ trans('general.edit') }}</a></li>';
|
||||
html += ' <li><a href="javascript:void(0);" data-href="wizard/taxes/' + tax.id + '/disable" class="tax-disable">{{ trans('general.disable') }}</a></li>';
|
||||
html += ' <li class="divider"></li>';
|
||||
html += ' <li>';
|
||||
html += ' <button type="button" class="delete-link" title="{{ trans('general.delete') }}" onclick="confirmCurrency("#tax-' + tax.id + '", "{{ trans_choice('general.taxes', 2) }}", "{{ trans('general.delete_confirm', ['name' => '<strong>' . $item->name . '</strong>', 'type' => mb_strtolower(trans_choice('general.taxes', 1))]) }}", "{{ trans('general.cancel') }}", "{{ trans('general.delete') }}")">{{ trans('general.delete') }}</button>';
|
||||
html += ' </li>';
|
||||
html += ' </ul>';
|
||||
html += ' </div>';
|
||||
html += ' </td>';
|
||||
html += '</tr>';
|
||||
|
||||
$('#tbl-taxes tbody').append(html);
|
||||
}
|
||||
},
|
||||
error: function(data){
|
||||
$('.tax-submit').html('<span class="fa fa-save"></span>');
|
||||
|
||||
var errors = data.responseJSON;
|
||||
|
||||
if (typeof errors !== 'undefined') {
|
||||
if (errors.name) {
|
||||
$('#tbl-taxes #name').parent().after('<p class="help-block" style="color: #ca1313;">' + errors.name + '</p>');
|
||||
}
|
||||
|
||||
if (errors.code) {
|
||||
$('#tbl-taxes #code').parent().after('<p class="help-block" style="color: #ca1313;">' + errors.code + '</p>');
|
||||
}
|
||||
|
||||
if (errors.rate) {
|
||||
$('#tbl-taxes #rate').parent().after('<p class="help-block" style="color: #ca1313;">' + errors.rate + '</p>');
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
$(document).on('click', '.tax-edit', function (e) {
|
||||
$('#tax-create').remove();
|
||||
$('#tax-edit').remove();
|
||||
|
||||
data_href = $(this).data('href');
|
||||
data_id = $(this).data('id');
|
||||
|
||||
$.ajax({
|
||||
url: data_href,
|
||||
type: 'GET',
|
||||
dataType: 'JSON',
|
||||
success: function(json) {
|
||||
if (json['success']) {
|
||||
$('#tax-' + data_id).after(json['html']);
|
||||
|
||||
$("#code").select2({
|
||||
placeholder: "{{ trans('general.form.select.field', ['field' => trans('taxes.code')]) }}"
|
||||
});
|
||||
|
||||
$('.tax-enabled-radio-group #enabled_1').trigger();
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
$(document).on('click', '.tax-updated', function (e) {
|
||||
$(this).html('<span class="fa fa-spinner fa-pulse"></span>');
|
||||
$('.help-block').remove();
|
||||
|
||||
data_href = $(this).data('href');
|
||||
|
||||
$.ajax({
|
||||
url: data_href,
|
||||
type: 'PATCH',
|
||||
dataType: 'JSON',
|
||||
data: $('#tbl-taxes input[type=\'number\'], #tbl-taxes input[type=\'text\'], #tbl-taxes input[type=\'radio\'], #tbl-taxes input[type=\'hidden\'], #tbl-taxes textarea, #tbl-taxes select').serialize(),
|
||||
headers: { 'X-CSRF-TOKEN': '{{ csrf_token() }}' },
|
||||
success: function(json) {
|
||||
$('.tax-updated').html('<span class="fa fa-save"></span>');
|
||||
|
||||
if (json['success']) {
|
||||
$('#tax-create').remove();
|
||||
$('#tax-edit').remove();
|
||||
}
|
||||
},
|
||||
error: function(data){
|
||||
$('.tax-updated').html('<span class="fa fa-save"></span>');
|
||||
|
||||
var errors = data.responseJSON;
|
||||
|
||||
if (typeof errors !== 'undefined') {
|
||||
if (errors.name) {
|
||||
$('#tbl-taxes #name').parent().after('<p class="help-block" style="color: #ca1313;">' + errors.name + '</p>');
|
||||
}
|
||||
|
||||
if (errors.code) {
|
||||
$('#tbl-taxes #code').parent().after('<p class="help-block" style="color: #ca1313;">' + errors.code + '</p>');
|
||||
}
|
||||
|
||||
if (errors.rate) {
|
||||
$('#tbl-taxes #rate').parent().after('<p class="help-block" style="color: #ca1313;">' + errors.rate + '</p>');
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
$(document).on('click', '.tax-disable', function (e) {
|
||||
data_href = $(this).data('href');
|
||||
|
||||
tax_tr = $(this).parent().parent().parent().parent().parent();
|
||||
|
||||
$.ajax({
|
||||
url: data_href,
|
||||
type: 'GET',
|
||||
dataType: 'JSON',
|
||||
success: function(json) {
|
||||
if (json['success']) {
|
||||
tax_tr.find('.tax-status').html('<span class="label label-danger">{{ trans('general.disabled') }}</span>');
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
$(document).on('click', '.tax-enable', function (e) {
|
||||
data_href = $(this).data('href');
|
||||
|
||||
tax_tr = $(this).parent().parent().parent().parent().parent();
|
||||
|
||||
$.ajax({
|
||||
url: data_href,
|
||||
type: 'GET',
|
||||
dataType: 'JSON',
|
||||
success: function(json) {
|
||||
if (json['success']) {
|
||||
tax_tr.find('.tax-status').html('<span class="label label-success">{{ trans('general.enabled') }}</span>');
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
$(document).on('change', '#code', function (e) {
|
||||
$.ajax({
|
||||
url: '{{ url("settings/taxes/config") }}',
|
||||
type: 'GET',
|
||||
dataType: 'JSON',
|
||||
data: 'code=' + $(this).val(),
|
||||
success: function(data) {
|
||||
$('#precision').val(data.precision);
|
||||
$('#symbol').val(data.symbol);
|
||||
$('#symbol_first').val(data.symbol_first);
|
||||
$('#decimal_mark').val(data.decimal_mark);
|
||||
$('#thousands_separator').val(data.thousands_separator);
|
||||
|
||||
// This event Select2 Stylesheet
|
||||
$('#symbol_first').trigger('change');
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
function confirmCurrency(tr_id, title, message, button_cancel, button_delete) {
|
||||
$('#confirm-modal').remove();
|
||||
|
||||
var html = '';
|
||||
|
||||
html += '<div class="modal fade" id="confirm-modal" tabindex="-1" role="dialog" aria-labelledby="confirmModalLabel" aria-hidden="true">';
|
||||
html += ' <div class="modal-dialog">';
|
||||
html += ' <div class="modal-content">';
|
||||
html += ' <div class="modal-header">';
|
||||
html += ' <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>';
|
||||
html += ' <h4 class="modal-title" id="confirmModalLabel">' + title + '</h4>';
|
||||
html += ' </div>';
|
||||
html += ' <div class="modal-body">';
|
||||
html += ' <p>' + message + '</p>';
|
||||
html += ' <p></p>';
|
||||
html += ' </div>';
|
||||
html += ' <div class="modal-footer">';
|
||||
html += ' <div class="pull-left">';
|
||||
html += ' <button type="button" class="btn btn-danger" onclick="deleteCurrency(\'' + tr_id + '\');">' + button_delete + '</button>';
|
||||
html += ' <button type="button" class="btn btn-default" data-dismiss="modal">' + button_cancel + '</button>';
|
||||
html += ' </div>';
|
||||
html += ' </div>';
|
||||
html += ' </div>';
|
||||
html += ' </div>';
|
||||
html += '</div>';
|
||||
|
||||
$('body').append(html);
|
||||
|
||||
$('#confirm-modal').modal('show');
|
||||
}
|
||||
|
||||
function deleteCurrency(tr_id) {
|
||||
data_href = $(tr_id).data('href');
|
||||
|
||||
$.ajax({
|
||||
url: data_href,
|
||||
type: 'GET',
|
||||
dataType: 'JSON',
|
||||
success: function(json) {
|
||||
if (json['success']) {
|
||||
$(tr_id).remove();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
</script>
|
||||
@endpush
|
@ -7,6 +7,34 @@ Route::group(['middleware' => 'language'], function () {
|
||||
Route::get('{id}/download', 'Common\Uploads@download');
|
||||
});
|
||||
|
||||
Route::group(['middleware' => 'permission:read-admin-panel'], function () {
|
||||
Route::group(['prefix' => 'wizard'], function () {
|
||||
Route::get('/', 'Wizard\Companies@edit')->name('wizard.index');
|
||||
Route::get('companies', 'Wizard\Companies@edit')->name('wizard.companies.edit');
|
||||
Route::patch('companies', 'Wizard\Companies@update')->name('wizard.companies.update');
|
||||
|
||||
Route::get('currencies', 'Wizard\Currencies@index')->name('wizard.currencies.index');
|
||||
Route::get('currencies/create', 'Wizard\Currencies@create')->name('wizard.currencies.create');
|
||||
Route::get('currencies/{currency}/edit', 'Wizard\Currencies@edit')->name('wizard.currencies.edit');
|
||||
Route::get('currencies/{currency}/enable', 'Wizard\Currencies@enable')->name('wizard.currencies.enable');
|
||||
Route::get('currencies/{currency}/disable', 'Wizard\Currencies@disable')->name('wizard.currencies.disable');
|
||||
Route::get('currencies/{currency}/delete', 'Wizard\Currencies@destroy')->name('wizard.currencies.delete');
|
||||
Route::post('currencies', 'Wizard\Currencies@store')->name('wizard.currencies.store');
|
||||
Route::patch('currencies/{currency}', 'Wizard\Currencies@update')->name('wizard.currencies.update');
|
||||
|
||||
Route::get('taxes', 'Wizard\Taxes@index')->name('wizard.taxes.index');
|
||||
Route::get('taxes/create', 'Wizard\Taxes@create')->name('wizard.taxes.create');
|
||||
Route::get('taxes/{tax}/edit', 'Wizard\Taxes@edit')->name('wizard.taxes.edit');
|
||||
Route::get('taxes/{tax}/enable', 'Wizard\Taxes@enable')->name('wizard.taxes.enable');
|
||||
Route::get('taxes/{tax}/disable', 'Wizard\Taxes@disable')->name('wizard.taxes.disable');
|
||||
Route::get('taxes/{tax}/delete', 'Wizard\Taxes@destroy')->name('wizard.taxes.delete');
|
||||
Route::post('taxes', 'Wizard\Taxes@store')->name('wizard.taxes.store');
|
||||
Route::patch('taxes/{tax}', 'Wizard\Taxes@update')->name('wizard.taxes.upadate');
|
||||
|
||||
Route::get('finish', 'Wizard\Finish@index')->name('wizard.finish.index');
|
||||
});
|
||||
});
|
||||
|
||||
Route::group(['middleware' => ['adminmenu', 'permission:read-admin-panel']], function () {
|
||||
Route::get('/', 'Common\Dashboard@index');
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user