From 2d0d36af7e2e867be376ef13f1e8cb13dfd06594 Mon Sep 17 00:00:00 2001 From: decoder Date: Thu, 25 Apr 2024 23:29:44 +0500 Subject: [PATCH] fix lang bug --- app/Http/Controllers/HomeController.php | 2 +- resources/views/home.blade.php | 18 ++++++++++++++---- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/app/Http/Controllers/HomeController.php b/app/Http/Controllers/HomeController.php index 35d2d89..71c6667 100644 --- a/app/Http/Controllers/HomeController.php +++ b/app/Http/Controllers/HomeController.php @@ -278,7 +278,7 @@ class HomeController extends Controller $forms = UserForm::join('forms', 'user_forms.form_id', '=', 'forms.id') ->leftJoin('users', 'forms.created_by', '=', 'users.id') ->where('user_forms.assigned_to', \Auth::id()) - ->select('user_forms.permissions as permissions', 'forms.name as name', 'forms.description as description', 'forms.id as form_id', 'forms.created_at as created_at', 'forms.slug as slug', 'users.name as created_by'); + ->select('user_forms.permissions as permissions', 'forms.name as name', 'forms.name_ru as name_ru', 'forms.name_est as name_est', 'forms.description as description', 'forms.description_ru as description_ru', 'forms.description_est as description_est', 'forms.id as form_id', 'forms.created_at as created_at', 'forms.slug as slug', 'users.name as created_by'); return DataTables::of($forms) ->addColumn( diff --git a/resources/views/home.blade.php b/resources/views/home.blade.php index ec10def..727fd73 100644 --- a/resources/views/home.blade.php +++ b/resources/views/home.blade.php @@ -407,12 +407,22 @@ } ], columns: [{ - data: 'name', - name: 'forms.name' + data: descColName, + name: 'forms.' + descColName, + createdCell: function(td, cellData, rowData, row, col) { + if (td.innerHTML.length === 0) { + td.innerHTML = rowData.description + } + }, }, { - data: 'description', - name: 'forms.description' + data: titleColName, + name: 'forms.' + titleColName, + createdCell: function(td, cellData, rowData, row, col) { + if (td.innerHTML.length === 0) { + td.innerHTML = rowData.name + } + }, }, @if (auth()->user()->hasRole(\App\Enums\User\RoleEnum::SUPERVISOR->value)) {