mirror of
https://github.com/openclassify/openclassify.git
synced 2026-02-09 23:06:08 -06:00
#2594 e-madencilik add 3 fields to profile
This commit is contained in:
parent
55277e990f
commit
14e9e47e09
@ -0,0 +1,69 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use Anomaly\Streams\Platform\Database\Migration\Migration;
|
||||||
|
|
||||||
|
class VisiosoftModuleProfileCreateProfessionAndEducationalFields extends Migration
|
||||||
|
{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Run the migrations.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function up()
|
||||||
|
{
|
||||||
|
if ($stream = $this->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
|
||||||
|
*/
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -141,5 +141,9 @@
|
|||||||
.birthday-field .input-group-addon {
|
.birthday-field .input-group-addon {
|
||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.education-field > .tagify, .state_of_education-field > .tagify, .profession-field > .tagify {
|
||||||
|
height: initial;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -7,7 +7,11 @@ return [
|
|||||||
'general_setting' => [
|
'general_setting' => [
|
||||||
'title' => 'visiosoft.module.profile::section.general_setting',
|
'title' => 'visiosoft.module.profile::section.general_setting',
|
||||||
'fields' => [
|
'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' => [
|
'recaptcha' => [
|
||||||
|
|||||||
@ -41,4 +41,11 @@ return [
|
|||||||
'mode' => 'checkbox'
|
'mode' => 'checkbox'
|
||||||
]
|
]
|
||||||
],
|
],
|
||||||
|
'show_education_profession' => [
|
||||||
|
'type' => 'anomaly.field_type.boolean',
|
||||||
|
'config' => [
|
||||||
|
'default_value' => true,
|
||||||
|
'mode' => 'checkbox'
|
||||||
|
]
|
||||||
|
],
|
||||||
];
|
];
|
||||||
@ -58,6 +58,15 @@ return [
|
|||||||
'birthday' => [
|
'birthday' => [
|
||||||
'name' => 'Birthday'
|
'name' => 'Birthday'
|
||||||
],
|
],
|
||||||
|
'education' => [
|
||||||
|
'name' => 'Education'
|
||||||
|
],
|
||||||
|
'state_of_education' => [
|
||||||
|
'name' => 'State of Education'
|
||||||
|
],
|
||||||
|
'profession' => [
|
||||||
|
'name' => 'Profession'
|
||||||
|
],
|
||||||
'identification_number' => [
|
'identification_number' => [
|
||||||
'name' => 'Identification Number'
|
'name' => 'Identification Number'
|
||||||
],
|
],
|
||||||
|
|||||||
@ -14,6 +14,10 @@ return [
|
|||||||
'name' => 'Show Checkbox Terms on Register',
|
'name' => 'Show Checkbox Terms on Register',
|
||||||
'instructions' => 'Show the "Accept term", "protection law", "privacy term", "sms & emails" on the register form'
|
'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' => [
|
'google_captcha_site_key' => [
|
||||||
'name' => 'Google Captcha Site Key',
|
'name' => 'Google Captcha Site Key',
|
||||||
],
|
],
|
||||||
|
|||||||
@ -149,6 +149,33 @@
|
|||||||
{{ profileForm.fields.birthday.input|raw }}
|
{{ profileForm.fields.birthday.input|raw }}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
{% if setting_value('visiosoft.module.profile::show_education_profession') %}
|
||||||
|
<div class="col-md-12">
|
||||||
|
<div class="form-group education-field">
|
||||||
|
<label class="control-label font-weight-bold">
|
||||||
|
{{ trans("visiosoft.module.profile::field.education.name") }}
|
||||||
|
</label>
|
||||||
|
{{ profileForm.fields.education.input|raw }}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-12">
|
||||||
|
<div class="form-group state_of_education-field">
|
||||||
|
<label class="control-label font-weight-bold">
|
||||||
|
{{ trans("visiosoft.module.profile::field.state_of_education.name") }}
|
||||||
|
</label>
|
||||||
|
{{ profileForm.fields.state_of_education.input|raw }}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-12">
|
||||||
|
<div class="form-group profession-field">
|
||||||
|
<label class="control-label font-weight-bold">
|
||||||
|
{{ trans("visiosoft.module.profile::field.profession.name") }}
|
||||||
|
</label>
|
||||||
|
{{ profileForm.fields.profession.input|raw }}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{% endif %}
|
||||||
<div class="col-md-12">
|
<div class="col-md-12">
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label class="control-label font-weight-bold">
|
<label class="control-label font-weight-bold">
|
||||||
|
|||||||
@ -13,6 +13,9 @@ class ProfileFormBuilder extends FormBuilder
|
|||||||
'office_phone',
|
'office_phone',
|
||||||
'land_phone',
|
'land_phone',
|
||||||
'identification_number',
|
'identification_number',
|
||||||
|
'education',
|
||||||
|
'state_of_education',
|
||||||
|
'profession',
|
||||||
'birthday',
|
'birthday',
|
||||||
'register_type'
|
'register_type'
|
||||||
];
|
];
|
||||||
|
|||||||
@ -25,6 +25,14 @@ class ProfileFormHandler
|
|||||||
'register_type' => $builder->getPostValue('register_type'),
|
'register_type' => $builder->getPostValue('register_type'),
|
||||||
];
|
];
|
||||||
|
|
||||||
|
if (setting_value('visiosoft.module.profile::show_education_profession')) {
|
||||||
|
$parameters = array_merge($parameters, [
|
||||||
|
'education' => $builder->getPostValue('education'),
|
||||||
|
'state_of_education' => $builder->getPostValue('state_of_education'),
|
||||||
|
'profession' => $builder->getPostValue('profession'),
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
if ($builder->getPostValue('file') != null) {
|
if ($builder->getPostValue('file') != null) {
|
||||||
$parameters['file_id'] = $builder->getPostValue('file');
|
$parameters['file_id'] = $builder->getPostValue('file');
|
||||||
} elseif (empty($builder->getPostValue('file'))) {
|
} elseif (empty($builder->getPostValue('file'))) {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user