diff --git a/app/Http/Controllers/SettingsController.php b/app/Http/Controllers/SettingsController.php index f0fa07181e9..eef3e26c769 100644 --- a/app/Http/Controllers/SettingsController.php +++ b/app/Http/Controllers/SettingsController.php @@ -20,10 +20,10 @@ use Illuminate\Http\RedirectResponse; use App\Notifications\InvitationMail; use App\Http\Requests\SettingsRequest; +use App\Services\Contact\Tag\UpdateTag; use LaravelWebauthn\Models\WebauthnKey; use App\Http\Requests\InvitationRequest; use App\Services\Contact\Tag\DestroyTag; -use Illuminate\Support\Facades\Validator; use App\Services\Account\Settings\ResetAccount; use App\Services\Account\Settings\DestroyAccount; use PragmaRX\Google2FALaravel\Facade as Google2FA; @@ -370,7 +370,7 @@ public function deleteTag($tagId) } /** - * Method editTag + * Edit a tag name. * * @param Tag $tag * @param Request $request @@ -379,22 +379,13 @@ public function deleteTag($tagId) */ public function editTag(Tag $tag, Request $request): RedirectResponse { - $validator = Validator::make($request->all(), [ - 'tag_name' => 'required|string|max:255', + app(UpdateTag::class)->execute([ + 'tag_id' => $tag->id, + 'account_id' => auth()->user()->account_id, + 'name' => $request->input('name'), ]); - if ($validator->fails()) { - return redirect()->route('settings.tags.index') - ->with('error', $validator->errors()); - } - - $newName = $request->input('tag_name'); - - $tag->name = $newName; - $tag->save(); - - - return redirect()->route('settings.tags.index') + return back() ->with('success', trans('settings.tags_list_edit_success')); } diff --git a/resources/sass/settings.scss b/resources/sass/settings.scss index 09f743ef8ee..5320cbfb8f1 100644 --- a/resources/sass/settings.scss +++ b/resources/sass/settings.scss @@ -99,6 +99,20 @@ } } + .tags-list { + h3.with-actions { + padding-bottom: 13px; + } + + .table-cell.actions { + @if $htmldir == ltr { + text-align: right; + } @else { + text-align: left; + } + } + } + .blank-screen { text-align: center; diff --git a/resources/views/settings/export.blade.php b/resources/views/settings/export.blade.php index 353bbb74223..14aa39c1e0f 100644 --- a/resources/views/settings/export.blade.php +++ b/resources/views/settings/export.blade.php @@ -87,16 +87,16 @@ @foreach ($exports as $export)
  • -
    +
    {{ trans("settings.export_type_{$export['type']}") }}
    -
    +
    {{ \App\Helpers\DateHelper::getShortDateWithTime($export['created_at']) }}
    -
    +
    {{ trans("settings.export_status_{$export['status']}") }}
    -
    +
    @if ($export['status'] === \App\Models\Account\ExportJob::EXPORT_DONE)
    @csrf diff --git a/resources/views/settings/tags.blade.php b/resources/views/settings/tags.blade.php index faec7c988fb..c73d1ebf965 100644 --- a/resources/views/settings/tags.blade.php +++ b/resources/views/settings/tags.blade.php @@ -30,7 +30,7 @@ @include('settings._sidebar') -
    +
    @if (auth()->user()->account->tags->count() == 0) @@ -62,29 +62,34 @@
      @foreach (auth()->user()->account->tags as $tag)
    • -
      - +
      + + @method('PUT') @csrf - + + {{ trans('app.save') }} + {{ trans('app.close') }} - {{ $tag->name }} - ({{ trans_choice('settings.tags_list_contact_number', $tag->contacts()->count(), ['count' => $tag->contacts()->count()]) }}) - +
      + {{ $tag->name }} + ({{ trans_choice('settings.tags_list_contact_number', $tag->contacts()->count(), ['count' => $tag->contacts()->count()]) }}) + +
      -
      - - - -
      + + + + + @method('DELETE') @csrf - +
      @@ -105,12 +110,10 @@ diff --git a/routes/web.php b/routes/web.php index d374cffb1df..cc8c4ee4984 100644 --- a/routes/web.php +++ b/routes/web.php @@ -293,8 +293,7 @@ Route::name('tags.')->group(function () { Route::get('/settings/tags', 'SettingsController@tags')->name('index'); - Route::get('/settings/tags/update/{tag}', 'SettingsController@editTag')->name('edit'); - Route::get('/settings/tags/add', 'SettingsController@addUser')->name('add'); + Route::put('/settings/tags/{tag}', 'SettingsController@editTag')->name('update'); Route::delete('/settings/tags/{tag}', 'SettingsController@deleteTag')->name('delete'); });