Skip to content

Commit

Permalink
Wizard Currencies and Taxes edit page start
Browse files Browse the repository at this point in the history
  • Loading branch information
cuneytsenturk committed Oct 24, 2018
1 parent 6039fcb commit 2ebe1e3
Show file tree
Hide file tree
Showing 8 changed files with 117 additions and 219 deletions.
7 changes: 1 addition & 6 deletions app/Http/Controllers/Wizard/Companies.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class Companies extends Controller
public function edit()
{
if (setting('general.wizard', false)) {
//return redirect('/');
return redirect('/');
}

$company = Company::find(session('company_id'));
Expand Down Expand Up @@ -76,11 +76,6 @@ public function update(Request $request)
// Save all settings
setting()->save();

// Redirect
$message = trans('messages.success.updated', ['type' => trans_choice('general.companies', 1)]);

flash($message)->success();

return redirect('wizard/currencies');
}

Expand Down
2 changes: 1 addition & 1 deletion app/Http/Controllers/Wizard/Currencies.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class Currencies extends Controller
public function edit()
{
if (setting('general.wizard', false)) {
//return redirect('/');
return redirect('/');
}

$currencies = Currency::all();
Expand Down
9 changes: 5 additions & 4 deletions app/Http/Controllers/Wizard/Finish.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,14 @@ class Finish extends Controller
public function index()
{
if (setting(setting('general.wizard', false))) {
//return redirect('/');
return redirect('/');
}

$company = Company::find(session('company_id'));
setting()->set('general.wizard', true);

$company->setSettings();
// Save all settings
setting()->save();

return view('wizard.finish.index', compact('company', 'currencies'));
return view('wizard.finish.index', compact(''));
}
}
8 changes: 6 additions & 2 deletions app/Http/Controllers/Wizard/Taxes.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,13 @@ class Taxes extends Controller
*/
public function edit()
{
$tax = [];
if (setting(setting('general.wizard', false))) {
return redirect('/');
}

$taxes = Tax::all();

return view('wizard.taxes.edit', compact('tax'));
return view('wizard.taxes.edit', compact('taxes'));
}

/**
Expand Down
63 changes: 53 additions & 10 deletions resources/views/wizard/currencies/edit.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,20 +30,65 @@
</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">

{{ 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 class="table table-responsive">
<table class="table table-striped table-hover" id="tbl-currencies">
<thead>
<tr>
<th class="col-md-5">@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-1 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>
<td><a href="{{ url('settings/currencies/' . $item->id . '/edit') }}">{{ $item->name }}</a></td>
<td class="hidden-xs">{{ $item->code }}</td>
<td>{{ $item->rate }}</td>
<td class="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="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="{{ url('settings/currencies/' . $item->id . '/edit') }}">{{ trans('general.edit') }}</a></li>
@if ($item->enabled)
<li><a href="{{ route('currencies.disable', $item->id) }}">{{ trans('general.disable') }}</a></li>
@else
<li><a href="{{ route('currencies.enable', $item->id) }}">{{ trans('general.enable') }}</a></li>
@endif
@permission('delete-settings-currencies')
<li class="divider"></li>
<li>{!! Form::deleteLink($item, 'settings/currencies') !!}</li>
@endpermission
</ul>
</div>
</td>
</tr>
@endforeach
<tr id="add-new">
<td colspan="5" class="text-right">
<span class="new-button"><a href="{{ url('settings/currencies/create') }}" class="btn btn-success btn-sm"><span class="fa fa-plus"></span> &nbsp;{{ trans('general.add_new') }}</a></span>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<!-- /.box-body -->

Expand All @@ -56,8 +101,6 @@
</div>
</div>
<!-- /.box-footer -->

{!! Form::close() !!}
</div>
@endsection

Expand Down
160 changes: 0 additions & 160 deletions resources/views/wizard/finish/edit.blade.php

This file was deleted.

27 changes: 0 additions & 27 deletions resources/views/wizard/finish/index.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,34 +30,7 @@
</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> &nbsp;' . 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> &nbsp;{{ trans('general.skip') }}</a>
</div>
</div>
</div>
<!-- /.box-footer -->

{!! Form::close() !!}
</div>
@endsection

Expand Down

0 comments on commit 2ebe1e3

Please sign in to comment.