prevent deletion of last category by type #304

This commit is contained in:
denisdulici
2018-04-24 01:03:01 +03:00
parent 15e0662b76
commit 483ffa396e
5 changed files with 39 additions and 15 deletions

View File

@ -37,6 +37,7 @@ return [
'updates' => 'Update|Updates',
'numbers' => 'Number|Numbers',
'statuses' => 'Status|Statuses',
'others' => 'Other|Others',
'dashboard' => 'Dashboard',
'banking' => 'Banking',

View File

@ -14,6 +14,7 @@ return [
'not_user_company' => 'Error: You are not allowed to manage this company!',
'customer' => 'Error: User not created! :name already uses this email address.',
'no_file' => 'Error: No file selected!',
'last_category' => 'Error: Can not delete the last :type category!',
],
'warning' => [
'deleted' => 'Warning: You are not allowed to delete <b>:name</b> because it has :text related.',

View File

@ -10,7 +10,7 @@
<div class="box-body">
{{ Form::textGroup('name', trans('general.name'), 'id-card-o') }}
{{ Form::selectGroup('type', trans_choice('general.types', 1), 'bars', ['expense' => 'Expense', 'income' => 'Income', 'item' => 'Item', 'other' => 'Other'], config('general.types')) }}
{{ Form::selectGroup('type', trans_choice('general.types', 1), 'bars', $types, config('general.types')) }}
<div class="form-group col-md-6 required {{ $errors->has('color') ? 'has-error' : ''}}">
{!! Form::label('color', trans('general.color'), ['class' => 'control-label']) !!}

View File

@ -14,11 +14,11 @@
<div class="box-body">
{{ Form::textGroup('name', trans('general.name'), 'id-card-o') }}
@if ($category->id == $transfer_id)
{{ Form::selectGroup('type', trans_choice('general.types', 1), 'bars', ['expense' => 'Expense', 'income' => 'Income', 'item' => 'Item', 'other' => 'Other'], null, ['required' => 'required', 'disabled' => 'disabled']) }}
<input type="hidden" name="type" value="other" />
@if ($type_disabled)
{{ Form::selectGroup('type', trans_choice('general.types', 1), 'bars', $types, null, ['required' => 'required', 'disabled' => 'disabled']) }}
<input type="hidden" name="type" value="{{ $category->type }}" />
@else
{{ Form::selectGroup('type', trans_choice('general.types', 1), 'bars', ['expense' => 'Expense', 'income' => 'Income', 'item' => 'Item', 'other' => 'Other']) }}
{{ Form::selectGroup('type', trans_choice('general.types', 1), 'bars', $types) }}
@endif
<div class="form-group col-md-6 required {{ $errors->has('color') ? 'has-error' : ''}}">