From 4e56768c20d7b22f68017719805207c5e29976b5 Mon Sep 17 00:00:00 2001 From: Muammer Top Date: Mon, 14 Dec 2020 18:49:07 +0300 Subject: [PATCH 1/6] profile education form edit (half) --- ...odule.profile__create_education_stream.php | 46 +++++++++++++ ....profile__create_education_part_stream.php | 59 +++++++++++++++++ ...e__create_education_part_option_stream.php | 60 +++++++++++++++++ .../resources/config/permissions.php | 20 ++++++ .../resources/lang/en/button.php | 4 ++ .../resources/lang/en/permission.php | 32 +++++++++ .../resources/lang/en/section.php | 12 ++++ .../resources/lang/en/stream.php | 12 ++++ .../resources/views/profile/detail.twig | 66 +++++++++++-------- .../Education/Contract/EducationInterface.php | 8 +++ .../Contract/EducationRepositoryInterface.php | 8 +++ .../src/Education/EducationCollection.php | 8 +++ .../src/Education/EducationCriteria.php | 8 +++ .../src/Education/EducationModel.php | 9 +++ .../src/Education/EducationObserver.php | 8 +++ .../src/Education/EducationPresenter.php | 8 +++ .../src/Education/EducationRepository.php | 25 +++++++ .../src/Education/EducationRouter.php | 8 +++ .../src/Education/EducationSeeder.php | 15 +++++ .../Education/Form/EducationFormBuilder.php | 66 +++++++++++++++++++ .../Education/Table/EducationTableBuilder.php | 61 +++++++++++++++++ .../Contract/EducationPartInterface.php | 8 +++ .../EducationPartRepositoryInterface.php | 8 +++ .../EducationPart/EducationPartCollection.php | 8 +++ .../EducationPart/EducationPartCriteria.php | 8 +++ .../src/EducationPart/EducationPartModel.php | 9 +++ .../EducationPart/EducationPartObserver.php | 8 +++ .../EducationPart/EducationPartPresenter.php | 8 +++ .../EducationPart/EducationPartRepository.php | 25 +++++++ .../src/EducationPart/EducationPartRouter.php | 8 +++ .../src/EducationPart/EducationPartSeeder.php | 15 +++++ .../Form/EducationPartFormBuilder.php | 66 +++++++++++++++++++ .../Table/EducationPartTableBuilder.php | 61 +++++++++++++++++ .../Contract/EducationPartOptionInterface.php | 8 +++ ...EducationPartOptionRepositoryInterface.php | 8 +++ .../EducationPartOptionCollection.php | 8 +++ .../EducationPartOptionCriteria.php | 8 +++ .../EducationPartOptionModel.php | 9 +++ .../EducationPartOptionObserver.php | 8 +++ .../EducationPartOptionPresenter.php | 8 +++ .../EducationPartOptionRepository.php | 25 +++++++ .../EducationPartOptionRouter.php | 8 +++ .../EducationPartOptionSeeder.php | 15 +++++ .../Form/EducationPartOptionFormBuilder.php | 66 +++++++++++++++++++ .../Table/EducationPartOptionTableBuilder.php | 61 +++++++++++++++++ .../Http/Controller/MyProfileController.php | 16 +++++ .../src/OptionHandler/EducationOptions.php | 21 ++++++ .../Profile/Profile/ProfileFormBuilder.php | 9 ++- .../profile-module/src/ProfileModule.php | 15 +++++ .../src/ProfileModuleServiceProvider.php | 8 +++ .../src/Seed/UsersFieldsSeeder.php | 15 ----- 51 files changed, 1045 insertions(+), 46 deletions(-) create mode 100644 addons/default/visiosoft/profile-module/migrations/2020_12_14_160016_visiosoft.module.profile__create_education_stream.php create mode 100644 addons/default/visiosoft/profile-module/migrations/2020_12_14_160654_visiosoft.module.profile__create_education_part_stream.php create mode 100644 addons/default/visiosoft/profile-module/migrations/2020_12_14_161536_visiosoft.module.profile__create_education_part_option_stream.php create mode 100644 addons/default/visiosoft/profile-module/src/Education/Contract/EducationInterface.php create mode 100644 addons/default/visiosoft/profile-module/src/Education/Contract/EducationRepositoryInterface.php create mode 100644 addons/default/visiosoft/profile-module/src/Education/EducationCollection.php create mode 100644 addons/default/visiosoft/profile-module/src/Education/EducationCriteria.php create mode 100644 addons/default/visiosoft/profile-module/src/Education/EducationModel.php create mode 100644 addons/default/visiosoft/profile-module/src/Education/EducationObserver.php create mode 100644 addons/default/visiosoft/profile-module/src/Education/EducationPresenter.php create mode 100644 addons/default/visiosoft/profile-module/src/Education/EducationRepository.php create mode 100644 addons/default/visiosoft/profile-module/src/Education/EducationRouter.php create mode 100644 addons/default/visiosoft/profile-module/src/Education/EducationSeeder.php create mode 100644 addons/default/visiosoft/profile-module/src/Education/Form/EducationFormBuilder.php create mode 100644 addons/default/visiosoft/profile-module/src/Education/Table/EducationTableBuilder.php create mode 100644 addons/default/visiosoft/profile-module/src/EducationPart/Contract/EducationPartInterface.php create mode 100644 addons/default/visiosoft/profile-module/src/EducationPart/Contract/EducationPartRepositoryInterface.php create mode 100644 addons/default/visiosoft/profile-module/src/EducationPart/EducationPartCollection.php create mode 100644 addons/default/visiosoft/profile-module/src/EducationPart/EducationPartCriteria.php create mode 100644 addons/default/visiosoft/profile-module/src/EducationPart/EducationPartModel.php create mode 100644 addons/default/visiosoft/profile-module/src/EducationPart/EducationPartObserver.php create mode 100644 addons/default/visiosoft/profile-module/src/EducationPart/EducationPartPresenter.php create mode 100644 addons/default/visiosoft/profile-module/src/EducationPart/EducationPartRepository.php create mode 100644 addons/default/visiosoft/profile-module/src/EducationPart/EducationPartRouter.php create mode 100644 addons/default/visiosoft/profile-module/src/EducationPart/EducationPartSeeder.php create mode 100644 addons/default/visiosoft/profile-module/src/EducationPart/Form/EducationPartFormBuilder.php create mode 100644 addons/default/visiosoft/profile-module/src/EducationPart/Table/EducationPartTableBuilder.php create mode 100644 addons/default/visiosoft/profile-module/src/EducationPartOption/Contract/EducationPartOptionInterface.php create mode 100644 addons/default/visiosoft/profile-module/src/EducationPartOption/Contract/EducationPartOptionRepositoryInterface.php create mode 100644 addons/default/visiosoft/profile-module/src/EducationPartOption/EducationPartOptionCollection.php create mode 100644 addons/default/visiosoft/profile-module/src/EducationPartOption/EducationPartOptionCriteria.php create mode 100644 addons/default/visiosoft/profile-module/src/EducationPartOption/EducationPartOptionModel.php create mode 100644 addons/default/visiosoft/profile-module/src/EducationPartOption/EducationPartOptionObserver.php create mode 100644 addons/default/visiosoft/profile-module/src/EducationPartOption/EducationPartOptionPresenter.php create mode 100644 addons/default/visiosoft/profile-module/src/EducationPartOption/EducationPartOptionRepository.php create mode 100644 addons/default/visiosoft/profile-module/src/EducationPartOption/EducationPartOptionRouter.php create mode 100644 addons/default/visiosoft/profile-module/src/EducationPartOption/EducationPartOptionSeeder.php create mode 100644 addons/default/visiosoft/profile-module/src/EducationPartOption/Form/EducationPartOptionFormBuilder.php create mode 100644 addons/default/visiosoft/profile-module/src/EducationPartOption/Table/EducationPartOptionTableBuilder.php create mode 100644 addons/default/visiosoft/profile-module/src/OptionHandler/EducationOptions.php diff --git a/addons/default/visiosoft/profile-module/migrations/2020_12_14_160016_visiosoft.module.profile__create_education_stream.php b/addons/default/visiosoft/profile-module/migrations/2020_12_14_160016_visiosoft.module.profile__create_education_stream.php new file mode 100644 index 000000000..8320e2da6 --- /dev/null +++ b/addons/default/visiosoft/profile-module/migrations/2020_12_14_160016_visiosoft.module.profile__create_education_stream.php @@ -0,0 +1,46 @@ + 'education', + 'title_column' => 'name', + 'translatable' => true, + 'versionable' => false, + 'trashable' => false, + 'searchable' => false, + 'sortable' => false, + ]; + + /** + * The stream assignments. + * + * @var array + */ + protected $assignments = [ + 'name' => [ + 'translatable' => true, + 'required' => true, + ], + 'slug' => [ + 'unique' => true, + 'required' => true, + ], + ]; +} diff --git a/addons/default/visiosoft/profile-module/migrations/2020_12_14_160654_visiosoft.module.profile__create_education_part_stream.php b/addons/default/visiosoft/profile-module/migrations/2020_12_14_160654_visiosoft.module.profile__create_education_part_stream.php new file mode 100644 index 000000000..3ad4d9d96 --- /dev/null +++ b/addons/default/visiosoft/profile-module/migrations/2020_12_14_160654_visiosoft.module.profile__create_education_part_stream.php @@ -0,0 +1,59 @@ + 'education_part', + 'title_column' => 'name', + 'translatable' => true, + 'versionable' => false, + 'trashable' => false, + 'searchable' => false, + 'sortable' => false, + ]; + + /** + * The stream assignments. + * + * @var array + */ + protected $assignments = [ + 'education' => [ + 'required' => true, + ], + 'name' => [ + 'translatable' => true, + 'required' => true, + ], + 'slug' => [ + 'unique' => true, + 'required' => true, + ], + ]; + + protected $fields = [ + 'education' => [ + 'type' => 'anomaly.field_type.relationship', + 'config' => [ + 'related' => EducationModel::class, + ] + ] + ]; +} diff --git a/addons/default/visiosoft/profile-module/migrations/2020_12_14_161536_visiosoft.module.profile__create_education_part_option_stream.php b/addons/default/visiosoft/profile-module/migrations/2020_12_14_161536_visiosoft.module.profile__create_education_part_option_stream.php new file mode 100644 index 000000000..a6d14710e --- /dev/null +++ b/addons/default/visiosoft/profile-module/migrations/2020_12_14_161536_visiosoft.module.profile__create_education_part_option_stream.php @@ -0,0 +1,60 @@ + 'education_part_option', + 'title_column' => 'name', + 'translatable' => true, + 'versionable' => false, + 'trashable' => false, + 'searchable' => false, + 'sortable' => false, + ]; + + /** + * The stream assignments. + * + * @var array + */ + protected $assignments = [ + 'education_part' => [ + 'required' => true, + ], + 'name' => [ + 'translatable' => true, + 'required' => true, + ], + 'slug' => [ + 'unique' => true, + 'required' => true, + ], + ]; + + protected $fields = [ + 'education_part' => [ + 'type' => 'anomaly.field_type.relationship', + 'config' => [ + 'related' => EducationPartModel::class, + ] + ] + ]; + +} diff --git a/addons/default/visiosoft/profile-module/resources/config/permissions.php b/addons/default/visiosoft/profile-module/resources/config/permissions.php index af2857e38..e4abd05b1 100644 --- a/addons/default/visiosoft/profile-module/resources/config/permissions.php +++ b/addons/default/visiosoft/profile-module/resources/config/permissions.php @@ -6,4 +6,24 @@ return [ 'write', 'delete', ], + 'education' => [ + 'read', + 'write', + 'delete', + ], + 'education' => [ + 'read', + 'write', + 'delete', + ], + 'education_part' => [ + 'read', + 'write', + 'delete', + ], + 'education_part_option' => [ + 'read', + 'write', + 'delete', + ], ]; diff --git a/addons/default/visiosoft/profile-module/resources/lang/en/button.php b/addons/default/visiosoft/profile-module/resources/lang/en/button.php index 11c564faa..a8af9e732 100644 --- a/addons/default/visiosoft/profile-module/resources/lang/en/button.php +++ b/addons/default/visiosoft/profile-module/resources/lang/en/button.php @@ -15,4 +15,8 @@ return [ 'personal' => 'Personal', 'corporate' => 'Corporate', 'export' => 'Export', + 'new_education' => 'New Education', + 'new_education' => 'New Education', + 'new_education_part' => 'New Education part', + 'new_education_part_option' => 'New Education part option', ]; diff --git a/addons/default/visiosoft/profile-module/resources/lang/en/permission.php b/addons/default/visiosoft/profile-module/resources/lang/en/permission.php index b9351ead9..c7ddc6128 100644 --- a/addons/default/visiosoft/profile-module/resources/lang/en/permission.php +++ b/addons/default/visiosoft/profile-module/resources/lang/en/permission.php @@ -17,4 +17,36 @@ return [ 'delete' => 'Can delete adress?', ], ], + 'education' => [ + 'name' => 'Education', + 'option' => [ + 'read' => 'Can read education?', + 'write' => 'Can create/edit education?', + 'delete' => 'Can delete education?', + ], + ], + 'education' => [ + 'name' => 'Education', + 'option' => [ + 'read' => 'Can read education?', + 'write' => 'Can create/edit education?', + 'delete' => 'Can delete education?', + ], + ], + 'education_part' => [ + 'name' => 'Education part', + 'option' => [ + 'read' => 'Can read education part?', + 'write' => 'Can create/edit education part?', + 'delete' => 'Can delete education part?', + ], + ], + 'education_part_option' => [ + 'name' => 'Education part option', + 'option' => [ + 'read' => 'Can read education part option?', + 'write' => 'Can create/edit education part option?', + 'delete' => 'Can delete education part option?', + ], + ], ]; diff --git a/addons/default/visiosoft/profile-module/resources/lang/en/section.php b/addons/default/visiosoft/profile-module/resources/lang/en/section.php index 33c358b85..b6df27826 100644 --- a/addons/default/visiosoft/profile-module/resources/lang/en/section.php +++ b/addons/default/visiosoft/profile-module/resources/lang/en/section.php @@ -9,4 +9,16 @@ return [ ], 'general_setting' => 'General Settings', 'recaptcha' => 'reCAPTCHA', + 'education' => [ + 'title' => 'Education', + ], + 'education' => [ + 'title' => 'Education', + ], + 'education_part' => [ + 'title' => 'Education part', + ], + 'education_part_option' => [ + 'title' => 'Education part option', + ], ]; diff --git a/addons/default/visiosoft/profile-module/resources/lang/en/stream.php b/addons/default/visiosoft/profile-module/resources/lang/en/stream.php index 80f666dd3..30aa34db7 100644 --- a/addons/default/visiosoft/profile-module/resources/lang/en/stream.php +++ b/addons/default/visiosoft/profile-module/resources/lang/en/stream.php @@ -7,4 +7,16 @@ return [ 'adress' => [ 'name' => 'Address', ], + 'education' => [ + 'name' => 'Education', + ], + 'education' => [ + 'name' => 'Education', + ], + 'education_part' => [ + 'name' => 'Education part', + ], + 'education_part_option' => [ + 'name' => 'Education part option', + ], ]; diff --git a/addons/default/visiosoft/profile-module/resources/views/profile/detail.twig b/addons/default/visiosoft/profile-module/resources/views/profile/detail.twig index 8b733d248..d0f656ba1 100644 --- a/addons/default/visiosoft/profile-module/resources/views/profile/detail.twig +++ b/addons/default/visiosoft/profile-module/resources/views/profile/detail.twig @@ -171,40 +171,15 @@ - {{ profileForm.fields.education.value.input|raw }} - + {{ profileForm.fields.education.input|raw }}
-
+
- + {{ profileForm.fields.education_part.input|raw }}
@@ -283,5 +258,38 @@ {% endblock %} {% endembed %} + {{ asset_add("scripts.js", "visiosoft.module.profile::assets/js/profile.js") }} {% endblock %} \ No newline at end of file diff --git a/addons/default/visiosoft/profile-module/src/Education/Contract/EducationInterface.php b/addons/default/visiosoft/profile-module/src/Education/Contract/EducationInterface.php new file mode 100644 index 000000000..25cde7990 --- /dev/null +++ b/addons/default/visiosoft/profile-module/src/Education/Contract/EducationInterface.php @@ -0,0 +1,8 @@ +model = $model; + } +} diff --git a/addons/default/visiosoft/profile-module/src/Education/EducationRouter.php b/addons/default/visiosoft/profile-module/src/Education/EducationRouter.php new file mode 100644 index 000000000..ffc70a9fc --- /dev/null +++ b/addons/default/visiosoft/profile-module/src/Education/EducationRouter.php @@ -0,0 +1,8 @@ +model = $model; + } +} diff --git a/addons/default/visiosoft/profile-module/src/EducationPart/EducationPartRouter.php b/addons/default/visiosoft/profile-module/src/EducationPart/EducationPartRouter.php new file mode 100644 index 000000000..331061459 --- /dev/null +++ b/addons/default/visiosoft/profile-module/src/EducationPart/EducationPartRouter.php @@ -0,0 +1,8 @@ +model = $model; + } +} diff --git a/addons/default/visiosoft/profile-module/src/EducationPartOption/EducationPartOptionRouter.php b/addons/default/visiosoft/profile-module/src/EducationPartOption/EducationPartOptionRouter.php new file mode 100644 index 000000000..414126e89 --- /dev/null +++ b/addons/default/visiosoft/profile-module/src/EducationPartOption/EducationPartOptionRouter.php @@ -0,0 +1,8 @@ +json(['status' => 'success', 'data' => $profile]); } + public function getEducation(Request $request) + { + $user = $this->userRepository->find(auth()->user()->getAuthIdentifier()); + $education = EducationModel::all(); + $educationPart = EducationPartModel::all(); + return response()->json(['user' => $user, 'education' => $education, 'education-part' => $educationPart], 200); + } + + public function setEducation(Request $request) + { + $user = $this->userRepository->find(auth()->user()->getAuthIdentifier())->update(['education' => $request->education]); + $education_part = EducationPartModel::query()->where('education_id', $request->education)->get(); + return response()->json(['messages' => $user, 'data' => $education_part], 200); + } } diff --git a/addons/default/visiosoft/profile-module/src/OptionHandler/EducationOptions.php b/addons/default/visiosoft/profile-module/src/OptionHandler/EducationOptions.php new file mode 100644 index 000000000..7c8554979 --- /dev/null +++ b/addons/default/visiosoft/profile-module/src/OptionHandler/EducationOptions.php @@ -0,0 +1,21 @@ +educationRepository = $repository; + } + + public function handle(SelectFieldType $fieldType) + { + $educations = $this->educationRepository->all(); + $options = $educations->pluck('name', 'id')->all(); + $fieldType->setOptions($options); + } +} \ No newline at end of file diff --git a/addons/default/visiosoft/profile-module/src/Profile/Profile/ProfileFormBuilder.php b/addons/default/visiosoft/profile-module/src/Profile/Profile/ProfileFormBuilder.php index d93408d68..4f98e00aa 100644 --- a/addons/default/visiosoft/profile-module/src/Profile/Profile/ProfileFormBuilder.php +++ b/addons/default/visiosoft/profile-module/src/Profile/Profile/ProfileFormBuilder.php @@ -13,8 +13,13 @@ class ProfileFormBuilder extends FormBuilder 'office_phone', 'land_phone', 'identification_number', - 'education', - 'state_of_education', + 'education' => [ + 'type' => 'anomaly.field_type.select', + 'config' => [ + 'handler' => 'Visiosoft\ProfileModule\OptionHandler\EducationOptions@handle', + ] + ], + 'education_part' => 'anomaly.field_type.select', 'profession', 'birthday', 'register_type', diff --git a/addons/default/visiosoft/profile-module/src/ProfileModule.php b/addons/default/visiosoft/profile-module/src/ProfileModule.php index 69b94033e..81f00785b 100644 --- a/addons/default/visiosoft/profile-module/src/ProfileModule.php +++ b/addons/default/visiosoft/profile-module/src/ProfileModule.php @@ -30,6 +30,21 @@ class ProfileModule extends Module 'new_adress', ], ], + 'education' => [ + 'buttons' => [ + 'new_education', + ] + ], + 'education_part' => [ + 'buttons' => [ + 'new_education', + ] + ], + 'education_part_option' => [ + 'buttons' => [ + 'new_education', + ] + ] ]; } diff --git a/addons/default/visiosoft/profile-module/src/ProfileModuleServiceProvider.php b/addons/default/visiosoft/profile-module/src/ProfileModuleServiceProvider.php index bbedeac27..6d1817c5b 100644 --- a/addons/default/visiosoft/profile-module/src/ProfileModuleServiceProvider.php +++ b/addons/default/visiosoft/profile-module/src/ProfileModuleServiceProvider.php @@ -2,6 +2,7 @@ use Anomaly\Streams\Platform\Addon\AddonCollection; use Anomaly\Streams\Platform\Addon\AddonServiceProvider; +use Anomaly\Streams\Platform\Model\Profile\ProfileEducationEntryModel; use Maatwebsite\Excel\ExcelServiceProvider; use Maatwebsite\Excel\Facades\Excel; use Visiosoft\ProfileModule\Adress\Contract\AdressRepositoryInterface; @@ -10,6 +11,9 @@ use Anomaly\Streams\Platform\Model\Profile\ProfileAdressEntryModel; use Visiosoft\ProfileModule\Adress\AdressModel; use Visiosoft\ProfileModule\Adress\Form\AdressFormBuilder; use Visiosoft\ProfileModule\Adress\FormCompany\AddressCompanyFormBuilder; +use Visiosoft\ProfileModule\Education\Contract\EducationRepositoryInterface; +use Visiosoft\ProfileModule\Education\EducationModel; +use Visiosoft\ProfileModule\Education\EducationRepository; use Visiosoft\ProfileModule\Http\Middleware\authCheck; use Visiosoft\ProfileModule\Profile\Password\ForgotPassFormBuilder; use Visiosoft\ProfileModule\Profile\Password\PasswordFormBuilder; @@ -139,6 +143,8 @@ class ProfileModuleServiceProvider extends AddonServiceProvider // CacheController 'ajax/get-user-info' => 'Visiosoft\ProfileModule\Http\Controller\CacheController@getUserInfo', + 'ajax/setEducation' => 'Visiosoft\ProfileModule\Http\Controller\MyProfileController@setEducation', + 'ajax/getEducation' => 'Visiosoft\ProfileModule\Http\Controller\MyProfileController@getEducation', ]; /** @@ -201,6 +207,7 @@ class ProfileModuleServiceProvider extends AddonServiceProvider 'address' => AdressFormBuilder::class, 'addressCompany' => AddressCompanyFormBuilder::class, ProfileAdressEntryModel::class => AdressModel::class, + ProfileEducationEntryModel::class => EducationModel::class, ]; /** @@ -210,6 +217,7 @@ class ProfileModuleServiceProvider extends AddonServiceProvider */ protected $singletons = [ AdressRepositoryInterface::class => AdressRepository::class, + EducationRepositoryInterface::class => EducationRepository::class, 'register2' => Register2FormBuilder::class, 'sites' => SitesFormBuilder::class, 'forgot_pass' => ForgotPassFormBuilder::class, diff --git a/addons/default/visiosoft/profile-module/src/Seed/UsersFieldsSeeder.php b/addons/default/visiosoft/profile-module/src/Seed/UsersFieldsSeeder.php index cf4271066..1d0301bbc 100644 --- a/addons/default/visiosoft/profile-module/src/Seed/UsersFieldsSeeder.php +++ b/addons/default/visiosoft/profile-module/src/Seed/UsersFieldsSeeder.php @@ -123,21 +123,6 @@ class UsersFieldsSeeder extends Seeder "mode" => "date", "picker" => true, ] - ], - [ - 'name' => trans('visiosoft.module.profile::field.education.name'), - 'slug' => 'education', - 'type' => 'anomaly.field_type.text', - ], - [ - 'name' => trans('visiosoft.module.profile::field.state_of_education.name'), - 'slug' => 'state_of_education', - 'type' => 'anomaly.field_type.text', - ], - [ - 'name' => trans('visiosoft.module.profile::field.profession.name'), - 'slug' => 'profession', - 'type' => 'anomaly.field_type.text', ], [ 'name' => trans('visiosoft.module.profile::field.facebook_address.name'), From 734c55b54e8658c73799656f39491600732c285d Mon Sep 17 00:00:00 2001 From: Muammer Top Date: Tue, 15 Dec 2020 15:07:34 +0300 Subject: [PATCH 2/6] profile education form edit --- ...e__create_education_part_option_stream.php | 60 ----------------- .../resources/assets/js/education.js | 45 +++++++++++++ .../resources/lang/en/field.php | 7 ++ .../resources/views/profile/detail.twig | 40 ++--------- .../Contract/EducationPartOptionInterface.php | 8 --- ...EducationPartOptionRepositoryInterface.php | 8 --- .../EducationPartOptionCollection.php | 8 --- .../EducationPartOptionCriteria.php | 8 --- .../EducationPartOptionModel.php | 9 --- .../EducationPartOptionObserver.php | 8 --- .../EducationPartOptionPresenter.php | 8 --- .../EducationPartOptionRepository.php | 25 ------- .../EducationPartOptionRouter.php | 8 --- .../EducationPartOptionSeeder.php | 15 ----- .../Form/EducationPartOptionFormBuilder.php | 66 ------------------- .../Table/EducationPartOptionTableBuilder.php | 61 ----------------- .../Http/Controller/MyProfileController.php | 15 +++-- .../profile-module/src/ProfileModule.php | 5 -- .../src/Seed/UsersFieldsSeeder.php | 25 +++++++ 19 files changed, 94 insertions(+), 335 deletions(-) delete mode 100644 addons/default/visiosoft/profile-module/migrations/2020_12_14_161536_visiosoft.module.profile__create_education_part_option_stream.php create mode 100644 addons/default/visiosoft/profile-module/resources/assets/js/education.js delete mode 100644 addons/default/visiosoft/profile-module/src/EducationPartOption/Contract/EducationPartOptionInterface.php delete mode 100644 addons/default/visiosoft/profile-module/src/EducationPartOption/Contract/EducationPartOptionRepositoryInterface.php delete mode 100644 addons/default/visiosoft/profile-module/src/EducationPartOption/EducationPartOptionCollection.php delete mode 100644 addons/default/visiosoft/profile-module/src/EducationPartOption/EducationPartOptionCriteria.php delete mode 100644 addons/default/visiosoft/profile-module/src/EducationPartOption/EducationPartOptionModel.php delete mode 100644 addons/default/visiosoft/profile-module/src/EducationPartOption/EducationPartOptionObserver.php delete mode 100644 addons/default/visiosoft/profile-module/src/EducationPartOption/EducationPartOptionPresenter.php delete mode 100644 addons/default/visiosoft/profile-module/src/EducationPartOption/EducationPartOptionRepository.php delete mode 100644 addons/default/visiosoft/profile-module/src/EducationPartOption/EducationPartOptionRouter.php delete mode 100644 addons/default/visiosoft/profile-module/src/EducationPartOption/EducationPartOptionSeeder.php delete mode 100644 addons/default/visiosoft/profile-module/src/EducationPartOption/Form/EducationPartOptionFormBuilder.php delete mode 100644 addons/default/visiosoft/profile-module/src/EducationPartOption/Table/EducationPartOptionTableBuilder.php diff --git a/addons/default/visiosoft/profile-module/migrations/2020_12_14_161536_visiosoft.module.profile__create_education_part_option_stream.php b/addons/default/visiosoft/profile-module/migrations/2020_12_14_161536_visiosoft.module.profile__create_education_part_option_stream.php deleted file mode 100644 index a6d14710e..000000000 --- a/addons/default/visiosoft/profile-module/migrations/2020_12_14_161536_visiosoft.module.profile__create_education_part_option_stream.php +++ /dev/null @@ -1,60 +0,0 @@ - 'education_part_option', - 'title_column' => 'name', - 'translatable' => true, - 'versionable' => false, - 'trashable' => false, - 'searchable' => false, - 'sortable' => false, - ]; - - /** - * The stream assignments. - * - * @var array - */ - protected $assignments = [ - 'education_part' => [ - 'required' => true, - ], - 'name' => [ - 'translatable' => true, - 'required' => true, - ], - 'slug' => [ - 'unique' => true, - 'required' => true, - ], - ]; - - protected $fields = [ - 'education_part' => [ - 'type' => 'anomaly.field_type.relationship', - 'config' => [ - 'related' => EducationPartModel::class, - ] - ] - ]; - -} diff --git a/addons/default/visiosoft/profile-module/resources/assets/js/education.js b/addons/default/visiosoft/profile-module/resources/assets/js/education.js new file mode 100644 index 000000000..78dc044bb --- /dev/null +++ b/addons/default/visiosoft/profile-module/resources/assets/js/education.js @@ -0,0 +1,45 @@ +$(() => { + $.ajax({ + url: '/ajax/getEducation', + success: ((res)=>{ + $.each(res['education-part'], function (key, value) { + var selected = "" + if (res.user.education_part == value.id){ selected = 'selected'; } + $('#education_part').append('') + }) + }) + }) + + $('#education').on('change', () => { + $.ajax({ + url: '/ajax/setEducation', + data: { + info: 'education', + education: $('#education').val() + },beforeSend: function (){ + $('#education_part').html(''); + },success: function (response) { + $('#education_part').html('') + $.each(response.data, function (key, value) { + $('#education_part').append( + '' + ) + }) + } + }); + }) + + $('#education_part').on('change', () => { + $.ajax({ + url: '/ajax/setEducation', + data: { + info: 'education_part', + education: $('#education_part').val() + }, beforeSend: function (){ + $('#education_part_option').html(''); + }, success: function (response) { + + } + }) + }) +}) \ No newline at end of file diff --git a/addons/default/visiosoft/profile-module/resources/lang/en/field.php b/addons/default/visiosoft/profile-module/resources/lang/en/field.php index 5ac8fe1d6..90e22a8eb 100644 --- a/addons/default/visiosoft/profile-module/resources/lang/en/field.php +++ b/addons/default/visiosoft/profile-module/resources/lang/en/field.php @@ -121,6 +121,9 @@ return [ 'user' => [ 'name' => 'User' ], + 'name' => [ + 'name' => 'Name' + ], /*Menu Button*/ 'profile' => [ @@ -476,4 +479,8 @@ return [ 'personal' => [ 'name' => 'Personal' ], + + 'education_part' => [ + 'name' => 'State of Education' + ], ]; diff --git a/addons/default/visiosoft/profile-module/resources/views/profile/detail.twig b/addons/default/visiosoft/profile-module/resources/views/profile/detail.twig index d0f656ba1..60017932a 100644 --- a/addons/default/visiosoft/profile-module/resources/views/profile/detail.twig +++ b/addons/default/visiosoft/profile-module/resources/views/profile/detail.twig @@ -175,7 +175,7 @@
-
+
@@ -221,6 +221,7 @@
{{ profileForm.close()|raw }}
+
+ {% endblock %} {% endembed %} - + {{ asset_script("visiosoft.module.profile::assets/js/education.js") }} {{ asset_add("scripts.js", "visiosoft.module.profile::assets/js/profile.js") }} {% endblock %} \ No newline at end of file diff --git a/addons/default/visiosoft/profile-module/src/EducationPartOption/Contract/EducationPartOptionInterface.php b/addons/default/visiosoft/profile-module/src/EducationPartOption/Contract/EducationPartOptionInterface.php deleted file mode 100644 index 278c5a01d..000000000 --- a/addons/default/visiosoft/profile-module/src/EducationPartOption/Contract/EducationPartOptionInterface.php +++ /dev/null @@ -1,8 +0,0 @@ -model = $model; - } -} diff --git a/addons/default/visiosoft/profile-module/src/EducationPartOption/EducationPartOptionRouter.php b/addons/default/visiosoft/profile-module/src/EducationPartOption/EducationPartOptionRouter.php deleted file mode 100644 index 414126e89..000000000 --- a/addons/default/visiosoft/profile-module/src/EducationPartOption/EducationPartOptionRouter.php +++ /dev/null @@ -1,8 +0,0 @@ -userRepository->find(auth()->user()->getAuthIdentifier()); $education = EducationModel::all(); - $educationPart = EducationPartModel::all(); + $educationPart = EducationPartModel::query()->where('education_id', $user->education)->get(); return response()->json(['user' => $user, 'education' => $education, 'education-part' => $educationPart], 200); } public function setEducation(Request $request) { - $user = $this->userRepository->find(auth()->user()->getAuthIdentifier())->update(['education' => $request->education]); - $education_part = EducationPartModel::query()->where('education_id', $request->education)->get(); - return response()->json(['messages' => $user, 'data' => $education_part], 200); + $user_id = auth()->user()->getAuthIdentifier(); + if ($request->info == 'education') { + $user = $this->userRepository->find($user_id)->update(['education' => $request->education]); + $education = EducationPartModel::query()->where('education_id', $request->education)->get(); + } elseif ($request->info == 'education_part') { + $user = $this->userRepository->find($user_id)->update(['education_part' => $request->education]); + $education = EducationPartOptionModel::query()->where('education_part_id', $request->education)->get(); + } + return response()->json(['messages' => $user, 'data' => $education], 200); } } diff --git a/addons/default/visiosoft/profile-module/src/ProfileModule.php b/addons/default/visiosoft/profile-module/src/ProfileModule.php index 81f00785b..a6ad6ee88 100644 --- a/addons/default/visiosoft/profile-module/src/ProfileModule.php +++ b/addons/default/visiosoft/profile-module/src/ProfileModule.php @@ -40,11 +40,6 @@ class ProfileModule extends Module 'new_education', ] ], - 'education_part_option' => [ - 'buttons' => [ - 'new_education', - ] - ] ]; } diff --git a/addons/default/visiosoft/profile-module/src/Seed/UsersFieldsSeeder.php b/addons/default/visiosoft/profile-module/src/Seed/UsersFieldsSeeder.php index 1d0301bbc..4b7f734ed 100644 --- a/addons/default/visiosoft/profile-module/src/Seed/UsersFieldsSeeder.php +++ b/addons/default/visiosoft/profile-module/src/Seed/UsersFieldsSeeder.php @@ -124,6 +124,31 @@ class UsersFieldsSeeder extends Seeder "picker" => true, ] ], + [ + 'name' => trans('visiosoft.module.profile::field.education.name'), + 'slug' => 'education', + 'type' => 'anomaly.field_type.text', + ], + [ + 'name' => trans('visiosoft.module.profile::field.state_of_education.name'), + 'slug' => 'state_of_education', + 'type' => 'anomaly.field_type.text', + ], + [ + 'name' => trans('visiosoft.module.profile::field.profession.name'), + 'slug' => 'profession', + 'type' => 'anomaly.field_type.select', + ], + [ + 'name' => trans('visiosoft.module.profile::field.education_part.name'), + 'slug' => 'education_part', + 'type' => 'anomaly.field_type.select', + ], + [ + 'name' => trans('visiosoft.module.profile::field.education_part_option.name'), + 'slug' => 'education_part_option', + 'type' => 'anomaly.field_type.select', + ], [ 'name' => trans('visiosoft.module.profile::field.facebook_address.name'), 'slug' => 'facebook_address', From 4365c9e8c01b83b20df572e3e47a8b3d1e3209d9 Mon Sep 17 00:00:00 2001 From: Muammer Top Date: Tue, 15 Dec 2020 18:15:17 +0300 Subject: [PATCH 3/6] comment fixed --- .../resources/assets/js/education.js | 8 +-- .../resources/config/permissions.php | 10 ---- .../resources/lang/en/button.php | 2 - .../resources/lang/en/permission.php | 16 ------ .../resources/lang/en/section.php | 6 --- .../resources/lang/en/stream.php | 6 --- .../resources/views/profile/detail.twig | 4 +- .../Education/Form/EducationFormBuilder.php | 51 ------------------- .../Education/Table/EducationTableBuilder.php | 37 -------------- .../Form/EducationPartFormBuilder.php | 51 ------------------- .../Table/EducationPartTableBuilder.php | 37 -------------- .../Http/Controller/MyProfileController.php | 4 +- .../profile-module/src/ProfileModule.php | 2 +- .../src/ProfileModuleServiceProvider.php | 4 +- .../src/Seed/UsersFieldsSeeder.php | 5 -- 15 files changed, 9 insertions(+), 234 deletions(-) diff --git a/addons/default/visiosoft/profile-module/resources/assets/js/education.js b/addons/default/visiosoft/profile-module/resources/assets/js/education.js index 78dc044bb..22c8f6e13 100644 --- a/addons/default/visiosoft/profile-module/resources/assets/js/education.js +++ b/addons/default/visiosoft/profile-module/resources/assets/js/education.js @@ -12,7 +12,7 @@ $(() => { $('#education').on('change', () => { $.ajax({ - url: '/ajax/setEducation', + url: '/api/setEducation', data: { info: 'education', education: $('#education').val() @@ -31,14 +31,10 @@ $(() => { $('#education_part').on('change', () => { $.ajax({ - url: '/ajax/setEducation', + url: '/api/setEducation', data: { info: 'education_part', education: $('#education_part').val() - }, beforeSend: function (){ - $('#education_part_option').html(''); - }, success: function (response) { - } }) }) diff --git a/addons/default/visiosoft/profile-module/resources/config/permissions.php b/addons/default/visiosoft/profile-module/resources/config/permissions.php index e4abd05b1..934599af3 100644 --- a/addons/default/visiosoft/profile-module/resources/config/permissions.php +++ b/addons/default/visiosoft/profile-module/resources/config/permissions.php @@ -11,19 +11,9 @@ return [ 'write', 'delete', ], - 'education' => [ - 'read', - 'write', - 'delete', - ], 'education_part' => [ 'read', 'write', 'delete', ], - 'education_part_option' => [ - 'read', - 'write', - 'delete', - ], ]; diff --git a/addons/default/visiosoft/profile-module/resources/lang/en/button.php b/addons/default/visiosoft/profile-module/resources/lang/en/button.php index a8af9e732..1d8634703 100644 --- a/addons/default/visiosoft/profile-module/resources/lang/en/button.php +++ b/addons/default/visiosoft/profile-module/resources/lang/en/button.php @@ -16,7 +16,5 @@ return [ 'corporate' => 'Corporate', 'export' => 'Export', 'new_education' => 'New Education', - 'new_education' => 'New Education', 'new_education_part' => 'New Education part', - 'new_education_part_option' => 'New Education part option', ]; diff --git a/addons/default/visiosoft/profile-module/resources/lang/en/permission.php b/addons/default/visiosoft/profile-module/resources/lang/en/permission.php index c7ddc6128..f4631292c 100644 --- a/addons/default/visiosoft/profile-module/resources/lang/en/permission.php +++ b/addons/default/visiosoft/profile-module/resources/lang/en/permission.php @@ -25,14 +25,6 @@ return [ 'delete' => 'Can delete education?', ], ], - 'education' => [ - 'name' => 'Education', - 'option' => [ - 'read' => 'Can read education?', - 'write' => 'Can create/edit education?', - 'delete' => 'Can delete education?', - ], - ], 'education_part' => [ 'name' => 'Education part', 'option' => [ @@ -41,12 +33,4 @@ return [ 'delete' => 'Can delete education part?', ], ], - 'education_part_option' => [ - 'name' => 'Education part option', - 'option' => [ - 'read' => 'Can read education part option?', - 'write' => 'Can create/edit education part option?', - 'delete' => 'Can delete education part option?', - ], - ], ]; diff --git a/addons/default/visiosoft/profile-module/resources/lang/en/section.php b/addons/default/visiosoft/profile-module/resources/lang/en/section.php index b6df27826..6a5bce6b9 100644 --- a/addons/default/visiosoft/profile-module/resources/lang/en/section.php +++ b/addons/default/visiosoft/profile-module/resources/lang/en/section.php @@ -12,13 +12,7 @@ return [ 'education' => [ 'title' => 'Education', ], - 'education' => [ - 'title' => 'Education', - ], 'education_part' => [ 'title' => 'Education part', ], - 'education_part_option' => [ - 'title' => 'Education part option', - ], ]; diff --git a/addons/default/visiosoft/profile-module/resources/lang/en/stream.php b/addons/default/visiosoft/profile-module/resources/lang/en/stream.php index 30aa34db7..7f43711b2 100644 --- a/addons/default/visiosoft/profile-module/resources/lang/en/stream.php +++ b/addons/default/visiosoft/profile-module/resources/lang/en/stream.php @@ -10,13 +10,7 @@ return [ 'education' => [ 'name' => 'Education', ], - 'education' => [ - 'name' => 'Education', - ], 'education_part' => [ 'name' => 'Education part', ], - 'education_part_option' => [ - 'name' => 'Education part option', - ], ]; diff --git a/addons/default/visiosoft/profile-module/resources/views/profile/detail.twig b/addons/default/visiosoft/profile-module/resources/views/profile/detail.twig index 60017932a..0d76779e4 100644 --- a/addons/default/visiosoft/profile-module/resources/views/profile/detail.twig +++ b/addons/default/visiosoft/profile-module/resources/views/profile/detail.twig @@ -171,7 +171,7 @@ - {{ profileForm.fields.education.input|raw }} + {{ profileForm.fields.education.setPlaceholder(trans('visiosoft.module.profile::field.choose_an_option')).input|raw }}
@@ -179,7 +179,7 @@ - {{ profileForm.fields.education_part.input|raw }} + {{ profileForm.fields.education_part.setPlaceholder(trans('visiosoft.module.profile::field.choose_an_option')).input|raw }}
diff --git a/addons/default/visiosoft/profile-module/src/Education/Form/EducationFormBuilder.php b/addons/default/visiosoft/profile-module/src/Education/Form/EducationFormBuilder.php index 6500c3c22..e590597f0 100644 --- a/addons/default/visiosoft/profile-module/src/Education/Form/EducationFormBuilder.php +++ b/addons/default/visiosoft/profile-module/src/Education/Form/EducationFormBuilder.php @@ -4,35 +4,6 @@ use Anomaly\Streams\Platform\Ui\Form\FormBuilder; class EducationFormBuilder extends FormBuilder { - - /** - * The form fields. - * - * @var array|string - */ - protected $fields = []; - - /** - * Additional validation rules. - * - * @var array|string - */ - protected $rules = []; - - /** - * Fields to skip. - * - * @var array|string - */ - protected $skips = []; - - /** - * The form actions. - * - * @var array|string - */ - protected $actions = []; - /** * The form buttons. * @@ -41,26 +12,4 @@ class EducationFormBuilder extends FormBuilder protected $buttons = [ 'cancel', ]; - - /** - * The form options. - * - * @var array - */ - protected $options = []; - - /** - * The form sections. - * - * @var array - */ - protected $sections = []; - - /** - * The form assets. - * - * @var array - */ - protected $assets = []; - } diff --git a/addons/default/visiosoft/profile-module/src/Education/Table/EducationTableBuilder.php b/addons/default/visiosoft/profile-module/src/Education/Table/EducationTableBuilder.php index 6e8c5d55e..eece942ed 100644 --- a/addons/default/visiosoft/profile-module/src/Education/Table/EducationTableBuilder.php +++ b/addons/default/visiosoft/profile-module/src/Education/Table/EducationTableBuilder.php @@ -4,28 +4,6 @@ use Anomaly\Streams\Platform\Ui\Table\TableBuilder; class EducationTableBuilder extends TableBuilder { - - /** - * The table views. - * - * @var array|string - */ - protected $views = []; - - /** - * The table filters. - * - * @var array|string - */ - protected $filters = []; - - /** - * The table columns. - * - * @var array|string - */ - protected $columns = []; - /** * The table buttons. * @@ -43,19 +21,4 @@ class EducationTableBuilder extends TableBuilder protected $actions = [ 'delete' ]; - - /** - * The table options. - * - * @var array - */ - protected $options = []; - - /** - * The table assets. - * - * @var array - */ - protected $assets = []; - } diff --git a/addons/default/visiosoft/profile-module/src/EducationPart/Form/EducationPartFormBuilder.php b/addons/default/visiosoft/profile-module/src/EducationPart/Form/EducationPartFormBuilder.php index 8473648dd..845cc15c3 100644 --- a/addons/default/visiosoft/profile-module/src/EducationPart/Form/EducationPartFormBuilder.php +++ b/addons/default/visiosoft/profile-module/src/EducationPart/Form/EducationPartFormBuilder.php @@ -4,35 +4,6 @@ use Anomaly\Streams\Platform\Ui\Form\FormBuilder; class EducationPartFormBuilder extends FormBuilder { - - /** - * The form fields. - * - * @var array|string - */ - protected $fields = []; - - /** - * Additional validation rules. - * - * @var array|string - */ - protected $rules = []; - - /** - * Fields to skip. - * - * @var array|string - */ - protected $skips = []; - - /** - * The form actions. - * - * @var array|string - */ - protected $actions = []; - /** * The form buttons. * @@ -41,26 +12,4 @@ class EducationPartFormBuilder extends FormBuilder protected $buttons = [ 'cancel', ]; - - /** - * The form options. - * - * @var array - */ - protected $options = []; - - /** - * The form sections. - * - * @var array - */ - protected $sections = []; - - /** - * The form assets. - * - * @var array - */ - protected $assets = []; - } diff --git a/addons/default/visiosoft/profile-module/src/EducationPart/Table/EducationPartTableBuilder.php b/addons/default/visiosoft/profile-module/src/EducationPart/Table/EducationPartTableBuilder.php index bfed87fed..dd8d7783a 100644 --- a/addons/default/visiosoft/profile-module/src/EducationPart/Table/EducationPartTableBuilder.php +++ b/addons/default/visiosoft/profile-module/src/EducationPart/Table/EducationPartTableBuilder.php @@ -4,28 +4,6 @@ use Anomaly\Streams\Platform\Ui\Table\TableBuilder; class EducationPartTableBuilder extends TableBuilder { - - /** - * The table views. - * - * @var array|string - */ - protected $views = []; - - /** - * The table filters. - * - * @var array|string - */ - protected $filters = []; - - /** - * The table columns. - * - * @var array|string - */ - protected $columns = []; - /** * The table buttons. * @@ -43,19 +21,4 @@ class EducationPartTableBuilder extends TableBuilder protected $actions = [ 'delete' ]; - - /** - * The table options. - * - * @var array - */ - protected $options = []; - - /** - * The table assets. - * - * @var array - */ - protected $assets = []; - } diff --git a/addons/default/visiosoft/profile-module/src/Http/Controller/MyProfileController.php b/addons/default/visiosoft/profile-module/src/Http/Controller/MyProfileController.php index c64324b82..ed7317f64 100644 --- a/addons/default/visiosoft/profile-module/src/Http/Controller/MyProfileController.php +++ b/addons/default/visiosoft/profile-module/src/Http/Controller/MyProfileController.php @@ -251,7 +251,7 @@ class MyProfileController extends PublicController public function getEducation(Request $request) { - $user = $this->userRepository->find(auth()->user()->getAuthIdentifier()); + $user = $this->userRepository->find(auth()->id()); $education = EducationModel::all(); $educationPart = EducationPartModel::query()->where('education_id', $user->education)->get(); return response()->json(['user' => $user, 'education' => $education, 'education-part' => $educationPart], 200); @@ -259,7 +259,7 @@ class MyProfileController extends PublicController public function setEducation(Request $request) { - $user_id = auth()->user()->getAuthIdentifier(); + $user_id = auth()->id(); if ($request->info == 'education') { $user = $this->userRepository->find($user_id)->update(['education' => $request->education]); $education = EducationPartModel::query()->where('education_id', $request->education)->get(); diff --git a/addons/default/visiosoft/profile-module/src/ProfileModule.php b/addons/default/visiosoft/profile-module/src/ProfileModule.php index a6ad6ee88..20ec78a93 100644 --- a/addons/default/visiosoft/profile-module/src/ProfileModule.php +++ b/addons/default/visiosoft/profile-module/src/ProfileModule.php @@ -37,7 +37,7 @@ class ProfileModule extends Module ], 'education_part' => [ 'buttons' => [ - 'new_education', + 'new_education_part', ] ], ]; diff --git a/addons/default/visiosoft/profile-module/src/ProfileModuleServiceProvider.php b/addons/default/visiosoft/profile-module/src/ProfileModuleServiceProvider.php index 6d1817c5b..7880c51d5 100644 --- a/addons/default/visiosoft/profile-module/src/ProfileModuleServiceProvider.php +++ b/addons/default/visiosoft/profile-module/src/ProfileModuleServiceProvider.php @@ -105,6 +105,8 @@ class ProfileModuleServiceProvider extends AddonServiceProvider ], 'profile/notification' => 'Visiosoft\ProfileModule\Http\Controller\MyProfileController@notification', 'ajax/update-user-info' => 'Visiosoft\ProfileModule\Http\Controller\MyProfileController@updateAjaxProfile', + 'api/setEducation' => 'Visiosoft\ProfileModule\Http\Controller\MyProfileController@setEducation', + 'api/getEducation' => 'Visiosoft\ProfileModule\Http\Controller\MyProfileController@getEducation', // UserAuthenticator 'login-in' => 'Visiosoft\ProfileModule\Http\Controller\UserAuthenticator@attempt', @@ -143,8 +145,6 @@ class ProfileModuleServiceProvider extends AddonServiceProvider // CacheController 'ajax/get-user-info' => 'Visiosoft\ProfileModule\Http\Controller\CacheController@getUserInfo', - 'ajax/setEducation' => 'Visiosoft\ProfileModule\Http\Controller\MyProfileController@setEducation', - 'ajax/getEducation' => 'Visiosoft\ProfileModule\Http\Controller\MyProfileController@getEducation', ]; /** diff --git a/addons/default/visiosoft/profile-module/src/Seed/UsersFieldsSeeder.php b/addons/default/visiosoft/profile-module/src/Seed/UsersFieldsSeeder.php index 4b7f734ed..497108c1e 100644 --- a/addons/default/visiosoft/profile-module/src/Seed/UsersFieldsSeeder.php +++ b/addons/default/visiosoft/profile-module/src/Seed/UsersFieldsSeeder.php @@ -144,11 +144,6 @@ class UsersFieldsSeeder extends Seeder 'slug' => 'education_part', 'type' => 'anomaly.field_type.select', ], - [ - 'name' => trans('visiosoft.module.profile::field.education_part_option.name'), - 'slug' => 'education_part_option', - 'type' => 'anomaly.field_type.select', - ], [ 'name' => trans('visiosoft.module.profile::field.facebook_address.name'), 'slug' => 'facebook_address', From d2665a951ab6a53d5a27ae1a3456d446de7e39b4 Mon Sep 17 00:00:00 2001 From: Muammer Top Date: Wed, 16 Dec 2020 10:12:39 +0300 Subject: [PATCH 4/6] default price filter currency formatter added --- .../visiosoft/advs-module/resources/js/currency_format.js | 8 ++++++++ .../resources/views/list/partials/price-filter.twig | 3 +++ 2 files changed, 11 insertions(+) create mode 100644 addons/default/visiosoft/advs-module/resources/js/currency_format.js diff --git a/addons/default/visiosoft/advs-module/resources/js/currency_format.js b/addons/default/visiosoft/advs-module/resources/js/currency_format.js new file mode 100644 index 000000000..5a28e4909 --- /dev/null +++ b/addons/default/visiosoft/advs-module/resources/js/currency_format.js @@ -0,0 +1,8 @@ +$("input[data-type='currency']").on('blur', function() { + const value = this.value.replace(/,/g, ''); + this.value = parseFloat(value).toLocaleString('en-US', { + style: 'decimal', + maximumFractionDigits: 2, + minimumFractionDigits: 2 + }); +}); \ No newline at end of file diff --git a/addons/default/visiosoft/advs-module/resources/views/list/partials/price-filter.twig b/addons/default/visiosoft/advs-module/resources/views/list/partials/price-filter.twig index 66919ed56..b62dff2d0 100644 --- a/addons/default/visiosoft/advs-module/resources/views/list/partials/price-filter.twig +++ b/addons/default/visiosoft/advs-module/resources/views/list/partials/price-filter.twig @@ -19,12 +19,14 @@
@@ -41,4 +43,5 @@ + {{ asset_script('visiosoft.module.advs::js/currency_format.js') }} {% endif %} \ No newline at end of file From 28b67a2f49dd8afc9bce60ee9707bfd4e8ab923e Mon Sep 17 00:00:00 2001 From: Muammer Top Date: Wed, 16 Dec 2020 12:06:10 +0300 Subject: [PATCH 5/6] commit for comment in pull req --- .../resources/assets/js/education.js | 16 ++----- .../Controller/Admin/EducationController.php | 43 +++++++++++++++++++ .../Admin/EducationPartController.php | 43 +++++++++++++++++++ .../Http/Controller/MyProfileController.php | 9 +--- .../Profile/Profile/ProfileFormHandler.php | 1 + .../src/ProfileModuleServiceProvider.php | 2 +- 6 files changed, 93 insertions(+), 21 deletions(-) create mode 100644 addons/default/visiosoft/profile-module/src/Http/Controller/Admin/EducationController.php create mode 100644 addons/default/visiosoft/profile-module/src/Http/Controller/Admin/EducationPartController.php diff --git a/addons/default/visiosoft/profile-module/resources/assets/js/education.js b/addons/default/visiosoft/profile-module/resources/assets/js/education.js index 22c8f6e13..f54877dbb 100644 --- a/addons/default/visiosoft/profile-module/resources/assets/js/education.js +++ b/addons/default/visiosoft/profile-module/resources/assets/js/education.js @@ -1,6 +1,6 @@ $(() => { $.ajax({ - url: '/ajax/getEducation', + url: '/api/getEducation', success: ((res)=>{ $.each(res['education-part'], function (key, value) { var selected = "" @@ -12,14 +12,14 @@ $(() => { $('#education').on('change', () => { $.ajax({ - url: '/api/setEducation', + url: '/api/changeEducation', data: { info: 'education', education: $('#education').val() },beforeSend: function (){ $('#education_part').html(''); },success: function (response) { - $('#education_part').html('') + $('#education_part').html('') $.each(response.data, function (key, value) { $('#education_part').append( '' @@ -28,14 +28,4 @@ $(() => { } }); }) - - $('#education_part').on('change', () => { - $.ajax({ - url: '/api/setEducation', - data: { - info: 'education_part', - education: $('#education_part').val() - } - }) - }) }) \ No newline at end of file diff --git a/addons/default/visiosoft/profile-module/src/Http/Controller/Admin/EducationController.php b/addons/default/visiosoft/profile-module/src/Http/Controller/Admin/EducationController.php new file mode 100644 index 000000000..b6c61e75b --- /dev/null +++ b/addons/default/visiosoft/profile-module/src/Http/Controller/Admin/EducationController.php @@ -0,0 +1,43 @@ +render(); + } + + /** + * Create a new entry. + * + * @param EducationFormBuilder $form + * @return \Symfony\Component\HttpFoundation\Response + */ + public function create(EducationFormBuilder $form) + { + return $form->render(); + } + + /** + * Edit an existing entry. + * + * @param EducationFormBuilder $form + * @param $id + * @return \Symfony\Component\HttpFoundation\Response + */ + public function edit(EducationFormBuilder $form, $id) + { + return $form->render($id); + } +} diff --git a/addons/default/visiosoft/profile-module/src/Http/Controller/Admin/EducationPartController.php b/addons/default/visiosoft/profile-module/src/Http/Controller/Admin/EducationPartController.php new file mode 100644 index 000000000..60f997a23 --- /dev/null +++ b/addons/default/visiosoft/profile-module/src/Http/Controller/Admin/EducationPartController.php @@ -0,0 +1,43 @@ +render(); + } + + /** + * Create a new entry. + * + * @param EducationPartFormBuilder $form + * @return \Symfony\Component\HttpFoundation\Response + */ + public function create(EducationPartFormBuilder $form) + { + return $form->render(); + } + + /** + * Edit an existing entry. + * + * @param EducationPartFormBuilder $form + * @param $id + * @return \Symfony\Component\HttpFoundation\Response + */ + public function edit(EducationPartFormBuilder $form, $id) + { + return $form->render($id); + } +} diff --git a/addons/default/visiosoft/profile-module/src/Http/Controller/MyProfileController.php b/addons/default/visiosoft/profile-module/src/Http/Controller/MyProfileController.php index ed7317f64..01920904c 100644 --- a/addons/default/visiosoft/profile-module/src/Http/Controller/MyProfileController.php +++ b/addons/default/visiosoft/profile-module/src/Http/Controller/MyProfileController.php @@ -257,16 +257,11 @@ class MyProfileController extends PublicController return response()->json(['user' => $user, 'education' => $education, 'education-part' => $educationPart], 200); } - public function setEducation(Request $request) + public function changeEducation(Request $request) { - $user_id = auth()->id(); if ($request->info == 'education') { - $user = $this->userRepository->find($user_id)->update(['education' => $request->education]); $education = EducationPartModel::query()->where('education_id', $request->education)->get(); - } elseif ($request->info == 'education_part') { - $user = $this->userRepository->find($user_id)->update(['education_part' => $request->education]); - $education = EducationPartOptionModel::query()->where('education_part_id', $request->education)->get(); } - return response()->json(['messages' => $user, 'data' => $education], 200); + return response()->json(['data' => $education], 200); } } diff --git a/addons/default/visiosoft/profile-module/src/Profile/Profile/ProfileFormHandler.php b/addons/default/visiosoft/profile-module/src/Profile/Profile/ProfileFormHandler.php index ed0775c78..728e290e0 100644 --- a/addons/default/visiosoft/profile-module/src/Profile/Profile/ProfileFormHandler.php +++ b/addons/default/visiosoft/profile-module/src/Profile/Profile/ProfileFormHandler.php @@ -30,6 +30,7 @@ class ProfileFormHandler if (setting_value('visiosoft.module.profile::show_education_profession')) { $parameters = array_merge($parameters, [ 'education' => $builder->getPostValue('education'), + 'education_part' => $builder->getPostValue('education_part'), 'state_of_education' => $builder->getPostValue('state_of_education'), 'profession' => $builder->getPostValue('profession'), ]); diff --git a/addons/default/visiosoft/profile-module/src/ProfileModuleServiceProvider.php b/addons/default/visiosoft/profile-module/src/ProfileModuleServiceProvider.php index 7880c51d5..15d9efa83 100644 --- a/addons/default/visiosoft/profile-module/src/ProfileModuleServiceProvider.php +++ b/addons/default/visiosoft/profile-module/src/ProfileModuleServiceProvider.php @@ -105,7 +105,7 @@ class ProfileModuleServiceProvider extends AddonServiceProvider ], 'profile/notification' => 'Visiosoft\ProfileModule\Http\Controller\MyProfileController@notification', 'ajax/update-user-info' => 'Visiosoft\ProfileModule\Http\Controller\MyProfileController@updateAjaxProfile', - 'api/setEducation' => 'Visiosoft\ProfileModule\Http\Controller\MyProfileController@setEducation', + 'api/changeEducation' => 'Visiosoft\ProfileModule\Http\Controller\MyProfileController@changeEducation', 'api/getEducation' => 'Visiosoft\ProfileModule\Http\Controller\MyProfileController@getEducation', // UserAuthenticator From 1c5266383a412769d67ddb63b13e39f7b3660059 Mon Sep 17 00:00:00 2001 From: Muammer Top Date: Wed, 16 Dec 2020 12:07:12 +0300 Subject: [PATCH 6/6] commit for comment in pull req --- .../profile-module/src/Profile/Profile/ProfileFormHandler.php | 1 - 1 file changed, 1 deletion(-) diff --git a/addons/default/visiosoft/profile-module/src/Profile/Profile/ProfileFormHandler.php b/addons/default/visiosoft/profile-module/src/Profile/Profile/ProfileFormHandler.php index 728e290e0..15e0e832c 100644 --- a/addons/default/visiosoft/profile-module/src/Profile/Profile/ProfileFormHandler.php +++ b/addons/default/visiosoft/profile-module/src/Profile/Profile/ProfileFormHandler.php @@ -31,7 +31,6 @@ class ProfileFormHandler $parameters = array_merge($parameters, [ 'education' => $builder->getPostValue('education'), 'education_part' => $builder->getPostValue('education_part'), - 'state_of_education' => $builder->getPostValue('state_of_education'), 'profession' => $builder->getPostValue('profession'), ]); }