mirror of
https://github.com/openclassify/openclassify.git
synced 2026-01-11 18:01:10 -06:00
district require is optional
This commit is contained in:
parent
ca771cf280
commit
98bcc6ac13
@ -15,7 +15,7 @@ function Locations(cat, level, name) {
|
||||
url: "/class/ajax",
|
||||
success: function (msg) {
|
||||
$('select[name="' + name + '"]').find('option').remove();
|
||||
$('select[name="' + name + '"]').append('<option>...</option>');
|
||||
$('select[name="' + name + '"]').append('<option value="">...</option>');
|
||||
$.each(msg, function (key, value) {
|
||||
$('select[name="' + name + '"]').append('<option value="' + value.id + '">' + value.name + '</option>');
|
||||
});
|
||||
|
||||
@ -7,6 +7,7 @@ return [
|
||||
'general_setting' => [
|
||||
'title' => 'visiosoft.module.profile::section.general_setting',
|
||||
'fields' => [
|
||||
'required_district',
|
||||
'show_my_ads',
|
||||
'upload_avatar',
|
||||
'show_tax_office',
|
||||
|
||||
@ -70,4 +70,10 @@ return [
|
||||
"education" => "anomaly.field_type.tags",
|
||||
"state_of_education" => "anomaly.field_type.tags",
|
||||
"profession" => "anomaly.field_type.tags",
|
||||
'required_district' => [
|
||||
'type' => 'anomaly.field_type.boolean',
|
||||
'config' => [
|
||||
'default_value' => false,
|
||||
]
|
||||
],
|
||||
];
|
||||
@ -47,4 +47,7 @@ return [
|
||||
'name' => 'Hide Register Type in Profile Page',
|
||||
'instructions' => 'Hides the register type field in the profile edit page.',
|
||||
],
|
||||
'required_district' => [
|
||||
'name' => 'Required District'
|
||||
],
|
||||
];
|
||||
|
||||
@ -26,7 +26,9 @@ class AdressFormFields
|
||||
'city' => [
|
||||
'required' => true,
|
||||
],
|
||||
'district',
|
||||
'district' => [
|
||||
'required' => setting_value( 'visiosoft.module.profile::required_district'),
|
||||
],
|
||||
'adress_content' => [
|
||||
'required' => true,
|
||||
],
|
||||
|
||||
@ -134,8 +134,15 @@ class MyProfileController extends PublicController
|
||||
{
|
||||
$message = [];
|
||||
|
||||
$error_district = false;
|
||||
if (setting_value('visiosoft.module.profile::required_district') and (!$this->request->district or $this->request->district == "")) {
|
||||
$error_district = true;
|
||||
}
|
||||
|
||||
$error = $form->build()->validate()->getFormErrors()->getMessages();
|
||||
if (!empty($error)) {
|
||||
|
||||
if (!empty($error) or $error_district) {
|
||||
$this->messages->flush();
|
||||
$message['status'] = "error";
|
||||
$message['msg'] = trans('visiosoft.module.profile::message.required_all');
|
||||
return $message;
|
||||
@ -248,19 +255,19 @@ class MyProfileController extends PublicController
|
||||
return response()->json(['status' => 'success', 'data' => $profile]);
|
||||
}
|
||||
|
||||
public function getEducation(Request $request)
|
||||
{
|
||||
$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);
|
||||
}
|
||||
public function getEducation(Request $request)
|
||||
{
|
||||
$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);
|
||||
}
|
||||
|
||||
public function changeEducation(Request $request)
|
||||
{
|
||||
if ($request->info == 'education') {
|
||||
$education = EducationPartModel::query()->where('education_id', $request->education)->get();
|
||||
}
|
||||
return response()->json(['data' => $education], 200);
|
||||
}
|
||||
public function changeEducation(Request $request)
|
||||
{
|
||||
if ($request->info == 'education') {
|
||||
$education = EducationPartModel::query()->where('education_id', $request->education)->get();
|
||||
}
|
||||
return response()->json(['data' => $education], 200);
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user