Merge pull request #782 from openclassify/dia

This commit is contained in:
Fatih Alp 2020-11-06 19:06:24 +03:00 committed by GitHub
commit 2dced43b59
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
12 changed files with 243 additions and 50 deletions

View File

@ -210,7 +210,10 @@ class AdvsModuleServiceProvider extends AddonServiceProvider
'uses' => 'Visiosoft\AdvsModule\Http\Controller\OptionConfigurationController@confAddCart',
],
// Admin ProductoptionsController
'admin/advs/product_options' => 'Visiosoft\AdvsModule\Http\Controller\Admin\ProductoptionsController@index',
'admin/advs/product_options/create' => 'Visiosoft\AdvsModule\Http\Controller\Admin\ProductoptionsController@create',
'admin/advs/product_options/edit/{id}' => 'Visiosoft\AdvsModule\Http\Controller\Admin\ProductoptionsController@edit',
];
protected $middleware = [

View File

@ -28,21 +28,23 @@
{% include 'visiosoft.theme.base::addons/anomaly/users-module/partials/register-form' %}
<div class="col-12">
{{ form.fields.accept_terms|raw }}
</div>
{% if setting_value('visiosoft.module.profile::show_checkbox_terms_on_register') %}
<div class="col-12">
{{ form.fields.accept_terms|raw }}
</div>
<div class="col-12">
{{ form.fields.accept_protection_law|raw }}
</div>
<div class="col-12">
{{ form.fields.accept_protection_law|raw }}
</div>
<div class="col-12">
{{ form.fields.accept_privacy_terms|raw }}
</div>
<div class="col-12">
{{ form.fields.accept_privacy_terms|raw }}
</div>
<div class="col-12">
{{ form.fields.receive_sms_emails|raw }}
</div>
<div class="col-12">
{{ form.fields.receive_sms_emails|raw }}
</div>
{% endif %}
<div class="col-12 row m-0">
<div class="col-6 pr-0 pl-1">

View File

@ -0,0 +1,64 @@
<?php
use Anomaly\Streams\Platform\Database\Migration\Migration;
class VisiosoftModuleProfileCreateProfessionAndEducationalFields extends Migration
{
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.text',
'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
*/
}
}

View File

@ -141,5 +141,9 @@
.birthday-field .input-group-addon {
display: none;
}
.education-field > .tagify, .state_of_education-field > .tagify, .profession-field > .tagify {
height: initial;
}
}
}

View File

@ -7,7 +7,14 @@ return [
'general_setting' => [
'title' => 'visiosoft.module.profile::section.general_setting',
'fields' => [
'show_my_ads', 'upload_avatar', 'show_tax_office'
'show_my_ads',
'upload_avatar',
'show_tax_office',
'show_checkbox_terms_on_register',
'show_education_profession',
'education',
'state_of_education',
'profession',
],
],
'recaptcha' => [

View File

@ -34,4 +34,21 @@ return [
"max" => 1.0,
]
],
'show_checkbox_terms_on_register' => [
'type' => 'anomaly.field_type.boolean',
'config' => [
'default_value' => false,
'mode' => 'checkbox'
]
],
'show_education_profession' => [
'type' => 'anomaly.field_type.boolean',
'config' => [
'default_value' => true,
'mode' => 'checkbox'
]
],
"education" => "anomaly.field_type.tags",
"state_of_education" => "anomaly.field_type.tags",
"profession" => "anomaly.field_type.tags",
];

View File

@ -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'
],

View File

@ -10,6 +10,14 @@ return [
'show_tax_office' => [
'name' => 'Show Tax Office Field',
],
'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'
],
'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',
],
@ -20,4 +28,13 @@ return [
'name' => 'Score Threshold',
'instructions' => 'A value between 0 and 1. The higher the threshold the more strict ReCaptcha is in trying to determine if a user is a bot or not.',
],
'education' => [
'name' => 'Education'
],
'state_of_education' => [
'name' => 'State of Education'
],
'profession' => [
'name' => 'Profession'
],
];

View File

@ -149,6 +149,64 @@
{{ profileForm.fields.birthday.input|raw }}
</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.value.input|raw }}
<select name="education" class="custom-select form-control"
data-field="education" data-field_name="education"
data-provides="anomaly.field_type.select" id="education">
<option value="">Choose an option...</option>
{% for education in setting_value('visiosoft.module.profile::education') %}
<option value="{{ education }}"
{{ profileForm.fields.education.value == education ? 'selected' }}>
{{ education }}
</option>
{% endfor %}
</select>
</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>
<select name="state_of_education" class="custom-select form-control"
data-field="state_of_education" data-field_name="state_of_education"
data-provides="anomaly.field_type.select" id="state_of_education">
<option value="">Choose an option...</option>
{% for state_of_education in setting_value('visiosoft.module.profile::state_of_education') %}
<option value="{{ state_of_education }}"
{{ profileForm.fields.state_of_education.value == state_of_education ? 'selected' }}>
{{ state_of_education }}
</option>
{% endfor %}
</select>
</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>
<select name="profession" class="custom-select form-control"
data-field="profession" data-field_name="profession"
data-provides="anomaly.field_type.select" id="profession">
<option value="">Choose an option...</option>
{% for profession in setting_value('visiosoft.module.profile::profession') %}
<option value="{{ profession }}"
{{ profileForm.fields.profession.value == profession ? 'selected' }}>
{{ profession }}
</option>
{% endfor %}
</select>
</div>
</div>
{% endif %}
<div class="col-md-12">
<div class="form-group">
<label class="control-label font-weight-bold">

View File

@ -13,6 +13,9 @@ class ProfileFormBuilder extends FormBuilder
'office_phone',
'land_phone',
'identification_number',
'education',
'state_of_education',
'profession',
'birthday',
'register_type'
];

View File

@ -25,6 +25,14 @@ class ProfileFormHandler
'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) {
$parameters['file_id'] = $builder->getPostValue('file');
} elseif (empty($builder->getPostValue('file'))) {

View File

@ -32,6 +32,43 @@ class Register2FormFields
];
}
if (setting_value('visiosoft.module.profile::show_checkbox_terms_on_register')) {
$register = array_merge($register, [
"accept_terms" => [
"type" => "anomaly.field_type.boolean",
"config" => [
"default_value" => false,
"mode" => "checkbox",
"label" => 'visiosoft.module.profile::field.accept_terms_label',
]
],
"accept_protection_law" => [
"type" => "anomaly.field_type.boolean",
"config" => [
"default_value" => false,
"mode" => "checkbox",
"label" => 'visiosoft.module.profile::field.accept_protection_law_label',
]
],
"accept_privacy_terms" => [
"type" => "anomaly.field_type.boolean",
"config" => [
"default_value" => false,
"mode" => "checkbox",
"label" => 'visiosoft.module.profile::field.accept_privacy_terms_label',
]
],
"receive_sms_emails" => [
"type" => "anomaly.field_type.boolean",
"config" => [
"default_value" => false,
"mode" => "checkbox",
"label" => 'visiosoft.module.profile::field.receive_sms_emails_label',
]
],
]);
}
$builder->setFields(
array_merge(
$register,
@ -66,42 +103,6 @@ class Register2FormFields
'password' => [
'instructions' => false,
],
"accept_terms" => [
"type" => "anomaly.field_type.boolean",
"required" => true,
"config" => [
"default_value" => false,
"mode" => "checkbox",
"label" => 'visiosoft.module.profile::field.accept_terms_label',
]
],
"accept_protection_law" => [
"type" => "anomaly.field_type.boolean",
"required" => true,
"config" => [
"default_value" => false,
"mode" => "checkbox",
"label" => 'visiosoft.module.profile::field.accept_protection_law_label',
]
],
"accept_privacy_terms" => [
"type" => "anomaly.field_type.boolean",
"required" => true,
"config" => [
"default_value" => false,
"mode" => "checkbox",
"label" => 'visiosoft.module.profile::field.accept_privacy_terms_label',
]
],
"receive_sms_emails" => [
"type" => "anomaly.field_type.boolean",
"required" => true,
"config" => [
"default_value" => false,
"mode" => "checkbox",
"label" => 'visiosoft.module.profile::field.receive_sms_emails_label',
]
],
]
)
);