From cf7c57228a32be38653dc703bc11c5f8795a67f3 Mon Sep 17 00:00:00 2001 From: decoder Date: Mon, 18 Mar 2024 19:33:31 +0500 Subject: [PATCH] change table struct --- app/Http/Controllers/FormController.php | 4 +- app/Http/Controllers/HomeController.php | 2 +- ...2941_add_translate_name_to_forms_table.php | 2 + lang/en/messages.php | 2 + resources/js/components/CreateForm.vue | 1560 ++++++------- resources/js/components/FormTab.vue | 1982 +++++++++-------- resources/views/home.blade.php | 376 ++-- 7 files changed, 2077 insertions(+), 1851 deletions(-) diff --git a/app/Http/Controllers/FormController.php b/app/Http/Controllers/FormController.php index 19bbb73..187e989 100644 --- a/app/Http/Controllers/FormController.php +++ b/app/Http/Controllers/FormController.php @@ -191,7 +191,7 @@ class FormController extends Controller public function update($id) { try { - $input = request()->only('name', 'name_ru', 'name_est', 'description', 'slug'); + $input = request()->only('name', 'name_ru', 'name_est', 'description', 'description_ru', 'description_est', 'slug'); $form_data = [ 'form' => request()->input('form'), 'emailConfig' => request()->input('email_config'), @@ -214,6 +214,8 @@ class FormController extends Controller $form->name_est = $input['name_est']; $form->slug = $input['slug']; $form->description = $input['description']; + $form->description_ru = $input['description_ru']; + $form->description_est = $input['description_est']; $form->schema = $input['schema']; $form->is_template = $is_template; $form->mailchimp_details = request()->input('mailchimp_details'); diff --git a/app/Http/Controllers/HomeController.php b/app/Http/Controllers/HomeController.php index 1c978b2..35d2d89 100644 --- a/app/Http/Controllers/HomeController.php +++ b/app/Http/Controllers/HomeController.php @@ -183,7 +183,7 @@ class HomeController extends Controller if (request()->ajax()) { $user_id = request()->user()->id; - $forms = Form::select('name', 'description', 'id', 'slug', 'is_global_template') + $forms = Form::select('name', 'name_est', 'name_ru', 'description', 'description_ru', 'description_est', 'id', 'slug', 'is_global_template') ->where(function ($query) use ($user_id) { $query->where('is_template', 1) ->where('created_by', $user_id) diff --git a/database/migrations/2024_03_06_172941_add_translate_name_to_forms_table.php b/database/migrations/2024_03_06_172941_add_translate_name_to_forms_table.php index 3c28ad6..39cfaed 100644 --- a/database/migrations/2024_03_06_172941_add_translate_name_to_forms_table.php +++ b/database/migrations/2024_03_06_172941_add_translate_name_to_forms_table.php @@ -16,6 +16,8 @@ return new class extends Migration Schema::table('forms', function (Blueprint $table) { $table->string('name_ru')->after('name')->nullable(); $table->string('name_est')->after('name_ru')->nullable(); + $table->string('description_ru')->after('description')->nullable(); + $table->string('description_est')->after('description_ru')->nullable(); }); } diff --git a/lang/en/messages.php b/lang/en/messages.php index 331a8b6..423a719 100644 --- a/lang/en/messages.php +++ b/lang/en/messages.php @@ -687,4 +687,6 @@ return [ 'options_ru' => 'Options in Ru', 'form_name_est' => 'Form Name est', 'form_name_ru' => 'Form Name ru', + 'form_description_est' => 'Form Description est', + 'form_description_ru' => 'Form Description ru', ]; diff --git a/resources/js/components/CreateForm.vue b/resources/js/components/CreateForm.vue index 603569a..d5d5885 100644 --- a/resources/js/components/CreateForm.vue +++ b/resources/js/components/CreateForm.vue @@ -1,248 +1,251 @@ diff --git a/resources/js/components/FormTab.vue b/resources/js/components/FormTab.vue index fdf19b7..1425ace 100644 --- a/resources/js/components/FormTab.vue +++ b/resources/js/components/FormTab.vue @@ -1,351 +1,460 @@ diff --git a/resources/views/home.blade.php b/resources/views/home.blade.php index 2f98656..ec10def 100644 --- a/resources/views/home.blade.php +++ b/resources/views/home.blade.php @@ -8,7 +8,7 @@ @include('layouts/partials/status') - @if(auth()->user()->hasRole(\App\Enums\User\RoleEnum::SUPERVISOR->value) || auth()->user()->can_create_form) + @if (auth()->user()->hasRole(\App\Enums\User\RoleEnum::SUPERVISOR->value) || auth()->user()->can_create_form)
@@ -16,20 +16,19 @@
@lang('messages.forms') - {{$form_count}} + {{ $form_count }}
- @if(!auth()->user()->hasRole(\App\Enums\User\RoleEnum::ADMIN->value)) + @if (!auth()->user()->hasRole(\App\Enums\User\RoleEnum::ADMIN->value))
- +
@lang('messages.templates') - {{$template_count}} + {{ $template_count }}
@@ -41,15 +40,14 @@
@lang('messages.submissions') - {{$submission_count}} + {{ $submission_count }}
-
@@ -59,84 +57,76 @@
- @if(auth()->user()->hasRole(\App\Enums\User\RoleEnum::SUPERVISOR->value) || auth()->user()->can_create_form) + @if (auth()->user()->hasRole(\App\Enums\User\RoleEnum::SUPERVISOR->value) || auth()->user()->can_create_form)
+ aria-labelledby="custome-tabs-all-forms">
- - - - - - - + + + + + + +
@lang('messages.name')@lang('messages.description')@lang('messages.created_at')@lang('messages.submissions')@lang('messages.action')
@lang('messages.description')@lang('messages.name')@lang('messages.created_at')@lang('messages.submissions')@lang('messages.action')
+ aria-labelledby="custome-tabs-all-templates">
- - - - @if(auth()->user()->can('superadmin')) - - @endif - - + + + + @if (auth()->user()->can('superadmin')) + + @endif + +
@lang('messages.name')@lang('messages.description') - @lang('messages.is_global_template') - - @lang('messages.action')
@lang('messages.description')@lang('messages.name') + @lang('messages.is_global_template') + + @lang('messages.action')
@@ -144,22 +134,21 @@
@endif
+ @if (!auth()->user()->hasRole(\App\Enums\User\RoleEnum::SUPERVISOR->value) || !auth()->user()->can_create_form) active show @endif + " + id="custome-tabs-shared-forms-assigned" role="tabpanel" + aria-labelledby="custome-tabs-shared-forms">
- - - - @if (auth()->user()->hasRole(\App\Enums\User\RoleEnum::SUPERVISOR->value)) - - @endif - - + + + + @if (auth()->user()->hasRole(\App\Enums\User\RoleEnum::SUPERVISOR->value)) + + @endif + +
@lang('messages.name')@lang('messages.description')@lang('messages.created_by')@lang('messages.action')
@lang('messages.name')@lang('messages.description')@lang('messages.created_by')@lang('messages.action')
@@ -177,16 +166,21 @@ @section('footer')