mirror of
https://github.com/openclassify/openclassify.git
synced 2026-01-11 18:01:10 -06:00
profile education form edit
This commit is contained in:
parent
4e56768c20
commit
734c55b54e
@ -1,60 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
use Anomaly\Streams\Platform\Database\Migration\Migration;
|
|
||||||
use \Visiosoft\ProfileModule\EducationPart\EducationPartModel;
|
|
||||||
|
|
||||||
class VisiosoftModuleProfileCreateEducationPartOptionStream extends Migration
|
|
||||||
{
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This migration creates the stream.
|
|
||||||
* It should be deleted on rollback.
|
|
||||||
*
|
|
||||||
* @var bool
|
|
||||||
*/
|
|
||||||
protected $delete = true;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The stream definition.
|
|
||||||
*
|
|
||||||
* @var array
|
|
||||||
*/
|
|
||||||
protected $stream = [
|
|
||||||
'slug' => '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,
|
|
||||||
]
|
|
||||||
]
|
|
||||||
];
|
|
||||||
|
|
||||||
}
|
|
||||||
@ -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('<option '+ selected +' value="'+ value.id +'">' + value.name + '</option>')
|
||||||
|
})
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
$('#education').on('change', () => {
|
||||||
|
$.ajax({
|
||||||
|
url: '/ajax/setEducation',
|
||||||
|
data: {
|
||||||
|
info: 'education',
|
||||||
|
education: $('#education').val()
|
||||||
|
},beforeSend: function (){
|
||||||
|
$('#education_part').html('');
|
||||||
|
},success: function (response) {
|
||||||
|
$('#education_part').html('<option>'+ choose_an_option +'</option>')
|
||||||
|
$.each(response.data, function (key, value) {
|
||||||
|
$('#education_part').append(
|
||||||
|
'<option value="'+ value.id +'">'+ value.name +'</option>'
|
||||||
|
)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
});
|
||||||
|
})
|
||||||
|
|
||||||
|
$('#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) {
|
||||||
|
|
||||||
|
}
|
||||||
|
})
|
||||||
|
})
|
||||||
|
})
|
||||||
@ -121,6 +121,9 @@ return [
|
|||||||
'user' => [
|
'user' => [
|
||||||
'name' => 'User'
|
'name' => 'User'
|
||||||
],
|
],
|
||||||
|
'name' => [
|
||||||
|
'name' => 'Name'
|
||||||
|
],
|
||||||
|
|
||||||
/*Menu Button*/
|
/*Menu Button*/
|
||||||
'profile' => [
|
'profile' => [
|
||||||
@ -476,4 +479,8 @@ return [
|
|||||||
'personal' => [
|
'personal' => [
|
||||||
'name' => 'Personal'
|
'name' => 'Personal'
|
||||||
],
|
],
|
||||||
|
|
||||||
|
'education_part' => [
|
||||||
|
'name' => 'State of Education'
|
||||||
|
],
|
||||||
];
|
];
|
||||||
|
|||||||
@ -221,6 +221,7 @@
|
|||||||
</div>
|
</div>
|
||||||
{{ profileForm.close()|raw }}
|
{{ profileForm.close()|raw }}
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
<div class="tab-pane fade" id="nav-password" role="tabpanel" aria-labelledby="nav-password-tab">
|
<div class="tab-pane fade" id="nav-password" role="tabpanel" aria-labelledby="nav-password-tab">
|
||||||
{% set passwordForm = form('updatePassword').get() %}
|
{% set passwordForm = form('updatePassword').get() %}
|
||||||
|
|
||||||
@ -255,41 +256,12 @@
|
|||||||
<!-- User Profile Form Section-->
|
<!-- User Profile Form Section-->
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<script>
|
||||||
|
var choose_an_option = "{{ trans('visiosoft.module.profile::field.choose_an_option') }}"
|
||||||
|
</script>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
{% endembed %}
|
{% endembed %}
|
||||||
|
|
||||||
<script>
|
{{ asset_script("visiosoft.module.profile::assets/js/education.js") }}
|
||||||
|
|
||||||
$(() => {
|
|
||||||
$.ajax({
|
|
||||||
url: '/ajax/getEducation',
|
|
||||||
success: ((res)=>{
|
|
||||||
// console.log(res.user.education)
|
|
||||||
$.each(res['education-part'], function (key, value) {
|
|
||||||
$('#education_part').append(
|
|
||||||
'<option value="'+ value.id +'" ' + value.id === res.user[""] + '>'+ value.name +'</option>'
|
|
||||||
)
|
|
||||||
})
|
|
||||||
})
|
|
||||||
})
|
|
||||||
})
|
|
||||||
|
|
||||||
$('#education').on('change', () => {
|
|
||||||
$.ajax({
|
|
||||||
url: '/ajax/setEducation',
|
|
||||||
data: {
|
|
||||||
education: $('#education').val()
|
|
||||||
},beforeSend: function (){
|
|
||||||
$('#education_part').html('');
|
|
||||||
},success: function (response) {
|
|
||||||
$.each(response.data, function (key, value) {
|
|
||||||
$('#education_part').append(
|
|
||||||
'<option value="'+ value.id +'">'+ value.name +'</option>'
|
|
||||||
)
|
|
||||||
})
|
|
||||||
}
|
|
||||||
});
|
|
||||||
})
|
|
||||||
</script>
|
|
||||||
{{ asset_add("scripts.js", "visiosoft.module.profile::assets/js/profile.js") }}
|
{{ asset_add("scripts.js", "visiosoft.module.profile::assets/js/profile.js") }}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
@ -1,8 +0,0 @@
|
|||||||
<?php namespace Visiosoft\ProfileModule\EducationPartOption\Contract;
|
|
||||||
|
|
||||||
use Anomaly\Streams\Platform\Entry\Contract\EntryInterface;
|
|
||||||
|
|
||||||
interface EducationPartOptionInterface extends EntryInterface
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
@ -1,8 +0,0 @@
|
|||||||
<?php namespace Visiosoft\ProfileModule\EducationPartOption\Contract;
|
|
||||||
|
|
||||||
use Anomaly\Streams\Platform\Entry\Contract\EntryRepositoryInterface;
|
|
||||||
|
|
||||||
interface EducationPartOptionRepositoryInterface extends EntryRepositoryInterface
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
@ -1,8 +0,0 @@
|
|||||||
<?php namespace Visiosoft\ProfileModule\EducationPartOption;
|
|
||||||
|
|
||||||
use Anomaly\Streams\Platform\Entry\EntryCollection;
|
|
||||||
|
|
||||||
class EducationPartOptionCollection extends EntryCollection
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
@ -1,8 +0,0 @@
|
|||||||
<?php namespace Visiosoft\ProfileModule\EducationPartOption;
|
|
||||||
|
|
||||||
use Anomaly\Streams\Platform\Entry\EntryCriteria;
|
|
||||||
|
|
||||||
class EducationPartOptionCriteria extends EntryCriteria
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
@ -1,9 +0,0 @@
|
|||||||
<?php namespace Visiosoft\ProfileModule\EducationPartOption;
|
|
||||||
|
|
||||||
use Visiosoft\ProfileModule\EducationPartOption\Contract\EducationPartOptionInterface;
|
|
||||||
use Anomaly\Streams\Platform\Model\Profile\ProfileEducationPartOptionEntryModel;
|
|
||||||
|
|
||||||
class EducationPartOptionModel extends ProfileEducationPartOptionEntryModel implements EducationPartOptionInterface
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
@ -1,8 +0,0 @@
|
|||||||
<?php namespace Visiosoft\ProfileModule\EducationPartOption;
|
|
||||||
|
|
||||||
use Anomaly\Streams\Platform\Entry\EntryObserver;
|
|
||||||
|
|
||||||
class EducationPartOptionObserver extends EntryObserver
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
@ -1,8 +0,0 @@
|
|||||||
<?php namespace Visiosoft\ProfileModule\EducationPartOption;
|
|
||||||
|
|
||||||
use Anomaly\Streams\Platform\Entry\EntryPresenter;
|
|
||||||
|
|
||||||
class EducationPartOptionPresenter extends EntryPresenter
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
@ -1,25 +0,0 @@
|
|||||||
<?php namespace Visiosoft\ProfileModule\EducationPartOption;
|
|
||||||
|
|
||||||
use Visiosoft\ProfileModule\EducationPartOption\Contract\EducationPartOptionRepositoryInterface;
|
|
||||||
use Anomaly\Streams\Platform\Entry\EntryRepository;
|
|
||||||
|
|
||||||
class EducationPartOptionRepository extends EntryRepository implements EducationPartOptionRepositoryInterface
|
|
||||||
{
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The entry model.
|
|
||||||
*
|
|
||||||
* @var EducationPartOptionModel
|
|
||||||
*/
|
|
||||||
protected $model;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Create a new EducationPartOptionRepository instance.
|
|
||||||
*
|
|
||||||
* @param EducationPartOptionModel $model
|
|
||||||
*/
|
|
||||||
public function __construct(EducationPartOptionModel $model)
|
|
||||||
{
|
|
||||||
$this->model = $model;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,8 +0,0 @@
|
|||||||
<?php namespace Visiosoft\ProfileModule\EducationPartOption;
|
|
||||||
|
|
||||||
use Anomaly\Streams\Platform\Entry\EntryRouter;
|
|
||||||
|
|
||||||
class EducationPartOptionRouter extends EntryRouter
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
@ -1,15 +0,0 @@
|
|||||||
<?php namespace Visiosoft\ProfileModule\EducationPartOption;
|
|
||||||
|
|
||||||
use Anomaly\Streams\Platform\Database\Seeder\Seeder;
|
|
||||||
|
|
||||||
class EducationPartOptionSeeder extends Seeder
|
|
||||||
{
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Run the seeder.
|
|
||||||
*/
|
|
||||||
public function run()
|
|
||||||
{
|
|
||||||
//
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,66 +0,0 @@
|
|||||||
<?php namespace Visiosoft\ProfileModule\EducationPartOption\Form;
|
|
||||||
|
|
||||||
use Anomaly\Streams\Platform\Ui\Form\FormBuilder;
|
|
||||||
|
|
||||||
class EducationPartOptionFormBuilder 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.
|
|
||||||
*
|
|
||||||
* @var array|string
|
|
||||||
*/
|
|
||||||
protected $buttons = [
|
|
||||||
'cancel',
|
|
||||||
];
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The form options.
|
|
||||||
*
|
|
||||||
* @var array
|
|
||||||
*/
|
|
||||||
protected $options = [];
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The form sections.
|
|
||||||
*
|
|
||||||
* @var array
|
|
||||||
*/
|
|
||||||
protected $sections = [];
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The form assets.
|
|
||||||
*
|
|
||||||
* @var array
|
|
||||||
*/
|
|
||||||
protected $assets = [];
|
|
||||||
|
|
||||||
}
|
|
||||||
@ -1,61 +0,0 @@
|
|||||||
<?php namespace Visiosoft\ProfileModule\EducationPartOption\Table;
|
|
||||||
|
|
||||||
use Anomaly\Streams\Platform\Ui\Table\TableBuilder;
|
|
||||||
|
|
||||||
class EducationPartOptionTableBuilder 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.
|
|
||||||
*
|
|
||||||
* @var array|string
|
|
||||||
*/
|
|
||||||
protected $buttons = [
|
|
||||||
'edit'
|
|
||||||
];
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The table actions.
|
|
||||||
*
|
|
||||||
* @var array|string
|
|
||||||
*/
|
|
||||||
protected $actions = [
|
|
||||||
'delete'
|
|
||||||
];
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The table options.
|
|
||||||
*
|
|
||||||
* @var array
|
|
||||||
*/
|
|
||||||
protected $options = [];
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The table assets.
|
|
||||||
*
|
|
||||||
* @var array
|
|
||||||
*/
|
|
||||||
protected $assets = [];
|
|
||||||
|
|
||||||
}
|
|
||||||
@ -26,6 +26,7 @@ use Visiosoft\ProfileModule\Adress\Contract\AdressRepositoryInterface;
|
|||||||
use Visiosoft\ProfileModule\Adress\Form\AdressFormBuilder;
|
use Visiosoft\ProfileModule\Adress\Form\AdressFormBuilder;
|
||||||
use Visiosoft\ProfileModule\Education\EducationModel;
|
use Visiosoft\ProfileModule\Education\EducationModel;
|
||||||
use Visiosoft\ProfileModule\EducationPart\EducationPartModel;
|
use Visiosoft\ProfileModule\EducationPart\EducationPartModel;
|
||||||
|
use Visiosoft\ProfileModule\EducationPartOption\EducationPartOptionModel;
|
||||||
use Visiosoft\ProfileModule\Profile\Form\ProfileFormBuilder;
|
use Visiosoft\ProfileModule\Profile\Form\ProfileFormBuilder;
|
||||||
use Illuminate\Contracts\Events\Dispatcher;
|
use Illuminate\Contracts\Events\Dispatcher;
|
||||||
|
|
||||||
@ -252,14 +253,20 @@ class MyProfileController extends PublicController
|
|||||||
{
|
{
|
||||||
$user = $this->userRepository->find(auth()->user()->getAuthIdentifier());
|
$user = $this->userRepository->find(auth()->user()->getAuthIdentifier());
|
||||||
$education = EducationModel::all();
|
$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);
|
return response()->json(['user' => $user, 'education' => $education, 'education-part' => $educationPart], 200);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function setEducation(Request $request)
|
public function setEducation(Request $request)
|
||||||
{
|
{
|
||||||
$user = $this->userRepository->find(auth()->user()->getAuthIdentifier())->update(['education' => $request->education]);
|
$user_id = auth()->user()->getAuthIdentifier();
|
||||||
$education_part = EducationPartModel::query()->where('education_id', $request->education)->get();
|
if ($request->info == 'education') {
|
||||||
return response()->json(['messages' => $user, 'data' => $education_part], 200);
|
$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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -40,11 +40,6 @@ class ProfileModule extends Module
|
|||||||
'new_education',
|
'new_education',
|
||||||
]
|
]
|
||||||
],
|
],
|
||||||
'education_part_option' => [
|
|
||||||
'buttons' => [
|
|
||||||
'new_education',
|
|
||||||
]
|
|
||||||
]
|
|
||||||
];
|
];
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -123,6 +123,31 @@ class UsersFieldsSeeder extends Seeder
|
|||||||
"mode" => "date",
|
"mode" => "date",
|
||||||
"picker" => true,
|
"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'),
|
'name' => trans('visiosoft.module.profile::field.facebook_address.name'),
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user