Skip to content

Commit

Permalink
close #611 Fixed: Create tax rate not null type.
Browse files Browse the repository at this point in the history
  • Loading branch information
cuneytsenturk committed Nov 9, 2018
1 parent 636afc4 commit d30fe4d
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 4 deletions.
8 changes: 7 additions & 1 deletion app/Http/Controllers/Settings/Taxes.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,13 @@ public function index()
{
$taxes = Tax::collect();

return view('settings.taxes.index', compact('taxes', 'rates'));
$types = [
'normal' => trans('taxes.normal'),
'inclusive' => trans('taxes.inclusive'),
'compound' => trans('taxes.compound'),
];

return view('settings.taxes.index', compact('taxes', 'types'));
}

/**
Expand Down
2 changes: 2 additions & 0 deletions app/Http/Requests/Setting/Tax.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ public function rules()
return [
'name' => 'required|string',
'rate' => 'required|min:0|max:100',
'type' => 'required|string',
'enabled' => 'integer|boolean',
];
}
}
2 changes: 1 addition & 1 deletion resources/views/settings/taxes/create.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

{{ Form::textGroup('rate', trans('taxes.rate'), 'percent') }}

{{ Form::selectGroup('type', trans_choice('general.types', 1), 'bars', $types, null, []) }}
{{ Form::selectGroup('type', trans_choice('general.types', 1), 'bars', $types, 'normal') }}

{{ Form::radioGroup('enabled', trans('general.enabled')) }}
</div>
Expand Down
2 changes: 1 addition & 1 deletion resources/views/settings/taxes/edit.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

{{ Form::textGroup('rate', trans('taxes.rate'), 'percent') }}

{{ Form::selectGroup('type', trans_choice('general.types', 1), 'bars', $types, null, []) }}
{{ Form::selectGroup('type', trans_choice('general.types', 1), 'bars', $types, null) }}

{{ Form::radioGroup('enabled', trans('general.enabled')) }}
</div>
Expand Down
4 changes: 3 additions & 1 deletion resources/views/settings/taxes/index.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@
<thead>
<tr>
<th class="col-md-5">@sortablelink('name', trans('general.name'))</th>
<th class="col-md-5">@sortablelink('rate', trans('taxes.rate_percent'))</th>
<th class="col-md-3">@sortablelink('rate', trans('taxes.rate_percent'))</th>
<th class="col-md-2">@sortablelink('type', trans_choice('general.types', 1))</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>
Expand All @@ -42,6 +43,7 @@
<tr>
<td><a href="{{ url('settings/taxes/' . $item->id . '/edit') }}">{{ $item->name }}</a></td>
<td>{{ $item->rate }}</td>
<td>{{ $types[$item->type] }}</td>
<td class="hidden-xs">
@if ($item->enabled)
<span class="label label-success">{{ trans('general.enabled') }}</span>
Expand Down

0 comments on commit d30fe4d

Please sign in to comment.