diff --git a/addons/default/visiosoft/profile-module/migrations/2020_11_06_150519_visiosoft.module.profile__create_profession_and_educational_fields.php b/addons/default/visiosoft/profile-module/migrations/2020_11_06_150519_visiosoft.module.profile__create_profession_and_educational_fields.php new file mode 100644 index 000000000..8aacbfd2d --- /dev/null +++ b/addons/default/visiosoft/profile-module/migrations/2020_11_06_150519_visiosoft.module.profile__create_profession_and_educational_fields.php @@ -0,0 +1,69 @@ +streams()->findBySlugAndNamespace('users', 'users')) { + $fields = [ + [ + 'name' => trans('visiosoft.module.profile::field.education.name'), + 'slug' => 'education', + ], + [ + 'name' => trans('visiosoft.module.profile::field.state_of_education.name'), + 'slug' => 'state_of_education', + ], + [ + 'name' => trans('visiosoft.module.profile::field.profession.name'), + 'slug' => 'profession', + ], + ]; + + foreach ($fields as $field) { + $exists = $this->fields() + ->newQuery() + ->where('slug', $field['slug']) + ->where('namespace', 'users') + ->first(); + + if (!$exists) { + $userField = $this->fields()->create([ + 'name' => $field['name'], + 'namespace' => 'users', + 'slug' => $field['slug'], + 'type' => 'anomaly.field_type.tags', + 'locked' => 0, + ]); + + $this->assignments()->create([ + 'stream_id' => $stream->id, + 'field_id' => $userField->id + ]); + } + } + } + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + /* + * I never go back on my word! + * That's my nindo: my ninja way! + * NARUTO + */ + } +} diff --git a/addons/default/visiosoft/profile-module/resources/assets/css/profile.scss b/addons/default/visiosoft/profile-module/resources/assets/css/profile.scss index 53e3144ce..3dafb014d 100644 --- a/addons/default/visiosoft/profile-module/resources/assets/css/profile.scss +++ b/addons/default/visiosoft/profile-module/resources/assets/css/profile.scss @@ -141,5 +141,9 @@ .birthday-field .input-group-addon { display: none; } + + .education-field > .tagify, .state_of_education-field > .tagify, .profession-field > .tagify { + height: initial; + } } } \ No newline at end of file diff --git a/addons/default/visiosoft/profile-module/resources/config/settings/sections.php b/addons/default/visiosoft/profile-module/resources/config/settings/sections.php index c13213f29..00bad9616 100644 --- a/addons/default/visiosoft/profile-module/resources/config/settings/sections.php +++ b/addons/default/visiosoft/profile-module/resources/config/settings/sections.php @@ -7,7 +7,11 @@ return [ 'general_setting' => [ 'title' => 'visiosoft.module.profile::section.general_setting', 'fields' => [ - 'show_my_ads', 'upload_avatar', 'show_tax_office', 'show_checkbox_terms_on_register' + 'show_my_ads', + 'upload_avatar', + 'show_tax_office', + 'show_checkbox_terms_on_register', + 'show_education_profession' ], ], 'recaptcha' => [ diff --git a/addons/default/visiosoft/profile-module/resources/config/settings/settings.php b/addons/default/visiosoft/profile-module/resources/config/settings/settings.php index f3f04357f..2dcdef450 100644 --- a/addons/default/visiosoft/profile-module/resources/config/settings/settings.php +++ b/addons/default/visiosoft/profile-module/resources/config/settings/settings.php @@ -41,4 +41,11 @@ return [ 'mode' => 'checkbox' ] ], + 'show_education_profession' => [ + 'type' => 'anomaly.field_type.boolean', + 'config' => [ + 'default_value' => true, + 'mode' => 'checkbox' + ] + ], ]; \ 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 e11c7c876..13b390085 100644 --- a/addons/default/visiosoft/profile-module/resources/lang/en/field.php +++ b/addons/default/visiosoft/profile-module/resources/lang/en/field.php @@ -58,6 +58,15 @@ return [ 'birthday' => [ 'name' => 'Birthday' ], + 'education' => [ + 'name' => 'Education' + ], + 'state_of_education' => [ + 'name' => 'State of Education' + ], + 'profession' => [ + 'name' => 'Profession' + ], 'identification_number' => [ 'name' => 'Identification Number' ], diff --git a/addons/default/visiosoft/profile-module/resources/lang/en/setting.php b/addons/default/visiosoft/profile-module/resources/lang/en/setting.php index 31a80386a..15cb14e7d 100644 --- a/addons/default/visiosoft/profile-module/resources/lang/en/setting.php +++ b/addons/default/visiosoft/profile-module/resources/lang/en/setting.php @@ -14,6 +14,10 @@ return [ 'name' => 'Show Checkbox Terms on Register', 'instructions' => 'Show the "Accept term", "protection law", "privacy term", "sms & emails" on the register form' ], + 'show_education_profession' => [ + 'name' => 'Show Education and Profession Fields', + 'instructions' => 'Show the "Education", "State of Education" and "Profession" on the profile edit page' + ], 'google_captcha_site_key' => [ 'name' => 'Google Captcha Site Key', ], 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 edde92e0b..9b782ebc8 100644 --- a/addons/default/visiosoft/profile-module/resources/views/profile/detail.twig +++ b/addons/default/visiosoft/profile-module/resources/views/profile/detail.twig @@ -149,6 +149,33 @@ {{ profileForm.fields.birthday.input|raw }} + + {% if setting_value('visiosoft.module.profile::show_education_profession') %} +