Wizard files permission and route, controller, view files added
This commit is contained in:
parent
121f0b893e
commit
6039fcb5f1
@ -264,6 +264,11 @@ class Companies extends Controller
|
||||
event(new CompanySwitched($company));
|
||||
}
|
||||
|
||||
// Check wizard
|
||||
if (!setting('general.wizard', false)) {
|
||||
return redirect('wizard');
|
||||
}
|
||||
|
||||
return redirect('/');
|
||||
}
|
||||
|
||||
|
@ -2,11 +2,15 @@
|
||||
|
||||
namespace App\Http\Controllers\Wizard;
|
||||
|
||||
use Illuminate\Routing\Controller;
|
||||
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.
|
||||
*
|
||||
@ -14,15 +18,15 @@ class Companies extends Controller
|
||||
*/
|
||||
public function edit()
|
||||
{
|
||||
if (setting(setting('general.wizard', false))) {
|
||||
return redirect('/');
|
||||
if (setting('general.wizard', false)) {
|
||||
//return redirect('/');
|
||||
}
|
||||
|
||||
$company = Company::find(session('company_id'));
|
||||
|
||||
$company->setSettings();
|
||||
|
||||
return view('wizard.companies.edit', compact('company', 'currencies'));
|
||||
return view('wizard.companies.edit', compact('company'));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -33,34 +37,43 @@ class Companies extends Controller
|
||||
*
|
||||
* @return Response
|
||||
*/
|
||||
public function update(Company $company, Request $request)
|
||||
public function update(Request $request)
|
||||
{
|
||||
// Update company
|
||||
$company->update($request->input());
|
||||
// Company
|
||||
$company = Company::find(session('company_id'));
|
||||
|
||||
// Get the company settings
|
||||
setting()->forgetAll();
|
||||
setting()->setExtraColumns(['company_id' => $company->id]);
|
||||
setting()->load(true);
|
||||
$fields = $request->all();
|
||||
|
||||
// Update settings
|
||||
setting()->set('general.company_name', $request->get('company_name'));
|
||||
setting()->set('general.company_email', $request->get('company_email'));
|
||||
setting()->set('general.company_address', $request->get('company_address'));
|
||||
$skip_keys = ['company_id', '_method', '_token'];
|
||||
$file_keys = ['company_logo', 'invoice_logo'];
|
||||
|
||||
if ($request->file('company_logo')) {
|
||||
$company_logo = $this->getMedia($request->file('company_logo'), 'settings', $company->id);
|
||||
foreach ($fields as $key => $value) {
|
||||
// Don't process unwanted keys
|
||||
if (in_array($key, $skip_keys)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if ($company_logo) {
|
||||
$company->attachMedia($company_logo, 'company_logo');
|
||||
// Process file uploads
|
||||
if (in_array($key, $file_keys)) {
|
||||
// Upload attachment
|
||||
if ($request->file($key)) {
|
||||
$media = $this->getMedia($request->file($key), 'settings');
|
||||
|
||||
setting()->set('general.company_logo', $company_logo->id);
|
||||
$company->attachMedia($media, $key);
|
||||
|
||||
$value = $media->id;
|
||||
}
|
||||
|
||||
// Prevent reset
|
||||
if (empty($value)) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
setting()->set('general.default_payment_method', 'offlinepayment.cash.1');
|
||||
setting()->set('general.default_currency', $request->get('default_currency'));
|
||||
setting()->set('general.' . $key, $value);
|
||||
}
|
||||
|
||||
// Save all settings
|
||||
setting()->save();
|
||||
|
||||
// Redirect
|
||||
@ -68,6 +81,23 @@ class Companies extends Controller
|
||||
|
||||
flash($message)->success();
|
||||
|
||||
return redirect('common/companies');
|
||||
return redirect('wizard/currencies');
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the specified resource in storage.
|
||||
*
|
||||
* @param Request $request
|
||||
*
|
||||
* @return Response
|
||||
*/
|
||||
public function skip()
|
||||
{
|
||||
setting()->set('general.wizard', true);
|
||||
|
||||
// Save all settings
|
||||
setting()->save();
|
||||
|
||||
return redirect('/');
|
||||
}
|
||||
}
|
||||
|
@ -2,7 +2,6 @@
|
||||
|
||||
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;
|
||||
@ -17,27 +16,15 @@ class Currencies extends Controller
|
||||
*
|
||||
* @return Response
|
||||
*/
|
||||
public function edit(Currency $currency)
|
||||
public function edit()
|
||||
{
|
||||
// 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;
|
||||
if (setting('general.wizard', false)) {
|
||||
//return redirect('/');
|
||||
}
|
||||
|
||||
$codes[$key] = $key;
|
||||
}
|
||||
$currencies = Currency::all();
|
||||
|
||||
// Set default currency
|
||||
$currency->default_currency = ($currency->code == setting('general.default_currency')) ? 1 : 0;
|
||||
|
||||
return view('settings.currencies.edit', compact('currency', 'codes'));
|
||||
return view('wizard.currencies.edit', compact('currencies'));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -12,62 +12,16 @@ class Finish extends Controller
|
||||
*
|
||||
* @return Response
|
||||
*/
|
||||
public function edit()
|
||||
public function index()
|
||||
{
|
||||
if (setting(setting('general.wizard', false))) {
|
||||
return redirect('/');
|
||||
//return redirect('/');
|
||||
}
|
||||
|
||||
$company = Company::find(session('company_id'));
|
||||
|
||||
$company->setSettings();
|
||||
|
||||
return view('wizard.companies.edit', compact('company', 'currencies'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the specified resource in storage.
|
||||
*
|
||||
* @param Company $company
|
||||
* @param Request $request
|
||||
*
|
||||
* @return Response
|
||||
*/
|
||||
public function update(Company $company, Request $request)
|
||||
{
|
||||
// Update company
|
||||
$company->update($request->input());
|
||||
|
||||
// Get the company settings
|
||||
setting()->forgetAll();
|
||||
setting()->setExtraColumns(['company_id' => $company->id]);
|
||||
setting()->load(true);
|
||||
|
||||
// Update settings
|
||||
setting()->set('general.company_name', $request->get('company_name'));
|
||||
setting()->set('general.company_email', $request->get('company_email'));
|
||||
setting()->set('general.company_address', $request->get('company_address'));
|
||||
|
||||
if ($request->file('company_logo')) {
|
||||
$company_logo = $this->getMedia($request->file('company_logo'), 'settings', $company->id);
|
||||
|
||||
if ($company_logo) {
|
||||
$company->attachMedia($company_logo, 'company_logo');
|
||||
|
||||
setting()->set('general.company_logo', $company_logo->id);
|
||||
}
|
||||
}
|
||||
|
||||
setting()->set('general.default_payment_method', 'offlinepayment.cash.1');
|
||||
setting()->set('general.default_currency', $request->get('default_currency'));
|
||||
|
||||
setting()->save();
|
||||
|
||||
// Redirect
|
||||
$message = trans('messages.success.updated', ['type' => trans_choice('general.companies', 1)]);
|
||||
|
||||
flash($message)->success();
|
||||
|
||||
return redirect('common/companies');
|
||||
return view('wizard.finish.index', compact('company', 'currencies'));
|
||||
}
|
||||
}
|
||||
|
@ -8,24 +8,6 @@ use App\Models\Setting\Tax;
|
||||
|
||||
class Taxes extends Controller
|
||||
{
|
||||
/**
|
||||
* Store a newly created resource in storage.
|
||||
*
|
||||
* @param Request $request
|
||||
*
|
||||
* @return Response
|
||||
*/
|
||||
public function store(Request $request)
|
||||
{
|
||||
Tax::create($request->all());
|
||||
|
||||
$message = trans('messages.success.added', ['type' => trans_choice('general.tax_rates', 1)]);
|
||||
|
||||
flash($message)->success();
|
||||
|
||||
return redirect('settings/taxes');
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for editing the specified resource.
|
||||
*
|
||||
@ -33,9 +15,11 @@ class Taxes extends Controller
|
||||
*
|
||||
* @return Response
|
||||
*/
|
||||
public function edit(Tax $tax)
|
||||
public function edit()
|
||||
{
|
||||
return view('settings.taxes.edit', compact('tax'));
|
||||
$tax = [];
|
||||
|
||||
return view('wizard.taxes.edit', compact('tax'));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -70,56 +54,4 @@ class Taxes extends Controller
|
||||
return redirect('settings/taxes/' . $tax->id . '/edit');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 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)]);
|
||||
|
||||
flash($message)->success();
|
||||
|
||||
return redirect()->route('taxes.index');
|
||||
}
|
||||
|
||||
/**
|
||||
* 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)]);
|
||||
|
||||
flash($message)->success();
|
||||
} else {
|
||||
$message = trans('messages.warning.disabled', ['name' => $tax->name, 'text' => implode(', ', $relationships)]);
|
||||
|
||||
flash($message)->warning();
|
||||
|
||||
return redirect()->route('taxes.index');
|
||||
}
|
||||
|
||||
return redirect()->route('taxes.index');
|
||||
}
|
||||
}
|
||||
|
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' => '0']);
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
@ -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,6 +51,7 @@ class Settings extends Seeder
|
||||
'general.session_lifetime' => '30',
|
||||
'general.file_size' => '2',
|
||||
'general.file_types' => 'pdf,jpeg,jpg,png',
|
||||
'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}]',
|
||||
]);
|
||||
}
|
||||
|
2
public/css/app.css
vendored
2
public/css/app.css
vendored
@ -826,7 +826,7 @@ input[type="number"] {
|
||||
width: 50px;
|
||||
height: 50px;
|
||||
text-align: center;
|
||||
padding: 0px 0;
|
||||
padding: 1px 0;
|
||||
font-size: 30px;
|
||||
line-height: 1.428571;
|
||||
border-radius: 30px;
|
||||
|
@ -102,6 +102,9 @@ return [
|
||||
'partially' => 'Partially',
|
||||
'partially_paid' => 'Partially Paid',
|
||||
'export' => 'Export',
|
||||
'finish' => 'Finish',
|
||||
'wizard' => 'Wizard',
|
||||
'skip' => 'Skip',
|
||||
'enable' => 'Enable',
|
||||
'disable' => 'Disable',
|
||||
'select_all' => 'Select All',
|
||||
|
@ -28,11 +28,14 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="box box-success">
|
||||
{!! Form::model($company, ['method' => 'PATCH', 'files' => true, 'url' => ['wizard/companies', $company->id], 'role' => 'form', 'class' => 'form-loading-button']) !!}
|
||||
{!! 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' !!}">
|
||||
@ -64,7 +67,7 @@
|
||||
<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')]) !!}
|
||||
{!! Form::button('<span class="fa fa-share"></span> ' . trans('general.skip'), ['type' => 'button', 'class' => 'btn btn-default', 'data-loading-text' => trans('general.loading')]) !!}
|
||||
<a href="{{ url('wizard/skip') }}" class="btn btn-default"><span class="fa fa-share"></span> {{ trans('general.skip') }}</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@ -87,48 +90,6 @@
|
||||
var text_yes = '{{ trans('general.yes') }}';
|
||||
var text_no = '{{ trans('general.no') }}';
|
||||
|
||||
$(document).ready(function () {
|
||||
var navListItems = $('div.setup-panel div a'),
|
||||
allWells = $('.setup-content'),
|
||||
allNextBtn = $('.nextBtn');
|
||||
|
||||
allWells.hide();
|
||||
|
||||
navListItems.click(function (e) {
|
||||
e.preventDefault();
|
||||
var $target = $($(this).attr('href')),
|
||||
$item = $(this);
|
||||
|
||||
if (!$item.hasClass('disabled')) {
|
||||
navListItems.removeClass('btn-success').addClass('btn-default');
|
||||
$item.addClass('btn-success');
|
||||
allWells.hide();
|
||||
$target.show();
|
||||
$target.find('input:eq(0)').focus();
|
||||
}
|
||||
});
|
||||
|
||||
allNextBtn.click(function () {
|
||||
var curStep = $(this).closest(".setup-content"),
|
||||
curStepBtn = curStep.attr("id"),
|
||||
nextStepWizard = $('div.setup-panel div a[href="#' + curStepBtn + '"]').parent().next().children("a"),
|
||||
curInputs = curStep.find("input[type='text'],input[type='url']"),
|
||||
isValid = true;
|
||||
|
||||
$(".form-group").removeClass("has-error");
|
||||
for (var i = 0; i < curInputs.length; i++) {
|
||||
if (!curInputs[i].validity.valid) {
|
||||
isValid = false;
|
||||
$(curInputs[i]).closest(".form-group").addClass("has-error");
|
||||
}
|
||||
}
|
||||
|
||||
if (isValid) nextStepWizard.removeAttr('disabled').trigger('click');
|
||||
});
|
||||
|
||||
$('div.setup-panel div a.btn-success').trigger('click');
|
||||
});
|
||||
|
||||
$(document).ready(function() {
|
||||
$('#company_logo').fancyfile({
|
||||
text : '{{ trans('general.form.select.file') }}',
|
||||
@ -142,7 +103,7 @@
|
||||
|
||||
@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 += ' <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>';
|
||||
@ -157,7 +118,7 @@
|
||||
company_logo_html += ' {!! Form::close() !!}';
|
||||
company_logo_html += '</span>';
|
||||
|
||||
$('#company .fancy-file .fake-file').append(company_logo_html);
|
||||
$('.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') !!}");
|
||||
|
@ -4,60 +4,56 @@
|
||||
|
||||
@section('content')
|
||||
<!-- Default box -->
|
||||
<div class="box box-success">
|
||||
{!! Form::model($company, ['method' => 'PATCH', 'files' => true, 'url' => ['wizard/companies', $company->id], 'role' => 'form', 'class' => 'form-loading-button']) !!}
|
||||
<div class="box-header">
|
||||
<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>
|
||||
<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-default btn-circle" disabled="disabled">2</a>
|
||||
<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">
|
||||
<a href="#step-3" type="button" class="btn btn-default btn-circle" disabled="disabled">3</a>
|
||||
<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">
|
||||
<a href="#step-4" type="button" class="btn btn-default btn-circle" disabled="disabled">4</a>
|
||||
<p><small>{{ trans_choice('general.companies', 1) }}</small></p>
|
||||
<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">
|
||||
{!! Form::model([], ['method' => 'PATCH', 'files' => true, 'url' => ['wizard/currencies'], 'role' => 'form', 'class' => 'form-loading-button']) !!}
|
||||
|
||||
<div class="box-header with-border">
|
||||
<h3 class="box-title">{{ trans_choice('general.currencies', 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>
|
||||
</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">
|
||||
{{ Form::saveButtons('wizard/companies') }}
|
||||
|
||||
{!! Form::button('<span class="fa fa-share"></span> ' . trans('general.skip'), ['type' => 'button', 'class' => 'btn btn-default pull-right', 'data-loading-text' => trans('general.loading')]) !!}
|
||||
<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/skip') }}" class="btn btn-default"><span class="fa fa-share"></span> {{ trans('general.skip') }}</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- /.box-footer -->
|
||||
|
||||
@ -65,96 +61,13 @@
|
||||
</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 () {
|
||||
|
||||
var navListItems = $('div.setup-panel div a'),
|
||||
allWells = $('.setup-content'),
|
||||
allNextBtn = $('.nextBtn');
|
||||
|
||||
allWells.hide();
|
||||
|
||||
navListItems.click(function (e) {
|
||||
e.preventDefault();
|
||||
var $target = $($(this).attr('href')),
|
||||
$item = $(this);
|
||||
|
||||
if (!$item.hasClass('disabled')) {
|
||||
navListItems.removeClass('btn-success').addClass('btn-default');
|
||||
$item.addClass('btn-success');
|
||||
allWells.hide();
|
||||
$target.show();
|
||||
$target.find('input:eq(0)').focus();
|
||||
}
|
||||
});
|
||||
|
||||
allNextBtn.click(function () {
|
||||
var curStep = $(this).closest(".setup-content"),
|
||||
curStepBtn = curStep.attr("id"),
|
||||
nextStepWizard = $('div.setup-panel div a[href="#' + curStepBtn + '"]').parent().next().children("a"),
|
||||
curInputs = curStep.find("input[type='text'],input[type='url']"),
|
||||
isValid = true;
|
||||
|
||||
$(".form-group").removeClass("has-error");
|
||||
for (var i = 0; i < curInputs.length; i++) {
|
||||
if (!curInputs[i].validity.valid) {
|
||||
isValid = false;
|
||||
$(curInputs[i]).closest(".form-group").addClass("has-error");
|
||||
}
|
||||
}
|
||||
|
||||
if (isValid) nextStepWizard.removeAttr('disabled').trigger('click');
|
||||
});
|
||||
|
||||
$('div.setup-panel div a.btn-success').trigger('click');
|
||||
});
|
||||
|
||||
$(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>';
|
||||
|
||||
$('#company .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
|
||||
|
73
resources/views/wizard/finish/index.blade.php
Normal file
73
resources/views/wizard/finish/index.blade.php
Normal file
@ -0,0 +1,73 @@
|
||||
@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="box box-success">
|
||||
{!! Form::model([], ['method' => 'PATCH', 'files' => true, 'url' => ['wizard/taxes'], 'role' => 'form', 'class' => 'form-loading-button']) !!}
|
||||
|
||||
<div class="box-header with-border">
|
||||
<h3 class="box-title">{{ trans('general.finish') }}</h3>
|
||||
</div>
|
||||
<!-- /.box-header -->
|
||||
|
||||
<div class="box-body">
|
||||
|
||||
{{ 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')) }}
|
||||
</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/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('scripts')
|
||||
<script type="text/javascript">
|
||||
var text_yes = '{{ trans('general.yes') }}';
|
||||
var text_no = '{{ trans('general.no') }}';
|
||||
|
||||
$(document).ready(function() {
|
||||
|
||||
});
|
||||
</script>
|
||||
@endpush
|
@ -4,60 +4,56 @@
|
||||
|
||||
@section('content')
|
||||
<!-- Default box -->
|
||||
<div class="box box-success">
|
||||
{!! Form::model($company, ['method' => 'PATCH', 'files' => true, 'url' => ['wizard/companies', $company->id], 'role' => 'form', 'class' => 'form-loading-button']) !!}
|
||||
<div class="box-header">
|
||||
<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>
|
||||
<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-default btn-circle" disabled="disabled">2</a>
|
||||
<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-default btn-circle" disabled="disabled">3</a>
|
||||
<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">
|
||||
<a href="#step-4" type="button" class="btn btn-default btn-circle" disabled="disabled">4</a>
|
||||
<p><small>{{ trans_choice('general.companies', 1) }}</small></p>
|
||||
<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">
|
||||
{!! Form::model([], ['method' => 'PATCH', 'files' => true, 'url' => ['wizard/taxes'], 'role' => 'form', 'class' => 'form-loading-button']) !!}
|
||||
|
||||
<div class="box-header with-border">
|
||||
<h3 class="box-title">{{ trans_choice('general.taxes', 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>
|
||||
</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">
|
||||
{{ Form::saveButtons('wizard/companies') }}
|
||||
|
||||
{!! Form::button('<span class="fa fa-share"></span> ' . trans('general.skip'), ['type' => 'button', 'class' => 'btn btn-default pull-right', 'data-loading-text' => trans('general.loading')]) !!}
|
||||
<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/skip') }}" class="btn btn-default"><span class="fa fa-share"></span> {{ trans('general.skip') }}</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- /.box-footer -->
|
||||
|
||||
@ -65,96 +61,13 @@
|
||||
</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 () {
|
||||
|
||||
var navListItems = $('div.setup-panel div a'),
|
||||
allWells = $('.setup-content'),
|
||||
allNextBtn = $('.nextBtn');
|
||||
|
||||
allWells.hide();
|
||||
|
||||
navListItems.click(function (e) {
|
||||
e.preventDefault();
|
||||
var $target = $($(this).attr('href')),
|
||||
$item = $(this);
|
||||
|
||||
if (!$item.hasClass('disabled')) {
|
||||
navListItems.removeClass('btn-success').addClass('btn-default');
|
||||
$item.addClass('btn-success');
|
||||
allWells.hide();
|
||||
$target.show();
|
||||
$target.find('input:eq(0)').focus();
|
||||
}
|
||||
});
|
||||
|
||||
allNextBtn.click(function () {
|
||||
var curStep = $(this).closest(".setup-content"),
|
||||
curStepBtn = curStep.attr("id"),
|
||||
nextStepWizard = $('div.setup-panel div a[href="#' + curStepBtn + '"]').parent().next().children("a"),
|
||||
curInputs = curStep.find("input[type='text'],input[type='url']"),
|
||||
isValid = true;
|
||||
|
||||
$(".form-group").removeClass("has-error");
|
||||
for (var i = 0; i < curInputs.length; i++) {
|
||||
if (!curInputs[i].validity.valid) {
|
||||
isValid = false;
|
||||
$(curInputs[i]).closest(".form-group").addClass("has-error");
|
||||
}
|
||||
}
|
||||
|
||||
if (isValid) nextStepWizard.removeAttr('disabled').trigger('click');
|
||||
});
|
||||
|
||||
$('div.setup-panel div a.btn-success').trigger('click');
|
||||
});
|
||||
|
||||
$(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>';
|
||||
|
||||
$('#company .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
|
||||
|
@ -10,17 +10,17 @@ Route::group(['middleware' => 'language'], function () {
|
||||
Route::group(['middleware' => 'permission:read-admin-panel'], function () {
|
||||
Route::group(['prefix' => 'wizard'], function () {
|
||||
Route::get('/', 'Wizard\Companies@edit');
|
||||
Route::get('skip', 'Wizard\Companies@skip');
|
||||
Route::get('companies', 'Wizard\Companies@edit');
|
||||
Route::post('companies', 'Wizard\Companies@update');
|
||||
Route::patch('companies', 'Wizard\Companies@update');
|
||||
|
||||
Route::get('currencies', 'Wizard\Currencies@create');
|
||||
Route::post('language', 'Wizard\Currencies@store');
|
||||
Route::get('currencies', 'Wizard\Currencies@edit');
|
||||
Route::post('currencies', 'Wizard\Currencies@update');
|
||||
|
||||
Route::get('taxes', 'Wizard\Taxes@create');
|
||||
Route::post('taxes', 'Wizard\Taxes@store');
|
||||
Route::get('taxes', 'Wizard\Taxes@edit');
|
||||
Route::post('taxes', 'Wizard\Taxes@update');
|
||||
|
||||
Route::get('finish', 'Wizard\Finish@create');
|
||||
Route::post('finish', 'Wizard\Finish@store');
|
||||
Route::get('finish', 'Wizard\Finish@index');
|
||||
});
|
||||
});
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user