diff --git a/addons/default/visiosoft/advs-module/src/Adv/Form/AdvFormBuilder.php b/addons/default/visiosoft/advs-module/src/Adv/Form/AdvFormBuilder.php
index 623d88a6d..652a496e1 100644
--- a/addons/default/visiosoft/advs-module/src/Adv/Form/AdvFormBuilder.php
+++ b/addons/default/visiosoft/advs-module/src/Adv/Form/AdvFormBuilder.php
@@ -1,6 +1,5 @@
adv_model->AddAdsDefaultCoverImage($ad);
}
- for ($i = 1; $i < 7; $i++) {
+ for ($i = 1; $i <= 10; $i++) {
$cat = "cat" . $i;
if ($adv->$cat != null) {
$item = $this->category_repository->getItem($adv->$cat);
@@ -417,7 +417,6 @@ class AdvsController extends PublicController
$count_user_ads = count($this->adv_model->userAdv()->get());
if (empty($cats->toArray())) {
-
$cats = trans('visiosoft.module.advs::message.create_ad_with_post_cat');
if (setting_value('visiosoft.module.advs::default_adv_limit') <= $count_user_ads) {
@@ -433,8 +432,6 @@ class AdvsController extends PublicController
return $msg;
}
}
-
-
}
return $cats;
}
@@ -504,8 +501,9 @@ class AdvsController extends PublicController
if ($package != null)
$this->messages->error(trans('visiosoft.module.advs::message.please_buy_package'));
- } else
+ } else {
$this->messages->error(trans('visiosoft.module.advs::message.max_ad_limit.title'));
+ }
return redirect('/');
}
@@ -540,7 +538,6 @@ class AdvsController extends PublicController
app('Visiosoft\CustomfieldsModule\Http\Controller\cfController')->store($adv, $request);
}
-
$form->render($request->update_id);
$post = $form->getPostData();
$post['id'] = $request->update_id;
@@ -577,7 +574,6 @@ class AdvsController extends PublicController
$events->dispatch(new EditAd($request->update_id, $settings, $adv));//Update Notify
}
-
if ($isActiveDopings) {
return redirect(route('add_doping', [$request->update_id]));
} else {
@@ -615,7 +611,7 @@ class AdvsController extends PublicController
$cat = 'cat';
$cats = array();
- for ($i = 1; $i < 7; $i++) {
+ for ($i = 1; $i <= 10; $i++) {
if ($adv[$cat . $i] != null) {
$name = $categoryRepository->getSingleCat($adv[$cat . $i]);
if (!is_null($name)) {
@@ -699,7 +695,6 @@ class AdvsController extends PublicController
$main_cats = $this->category_repository->mainCats();
return $this->view->make('visiosoft.module.advs::new-ad/post-cat', compact('main_cats'));
-
}
/**
@@ -722,7 +717,7 @@ class AdvsController extends PublicController
$params = $this->requestHttp->all();
unset($params['action']);
- for ($i = 2; $i <= 7; $i++) {
+ for ($i = 2; $i <= 10; $i++) {
if (!isset($params['cat' . $i])) {
$params['cat' . $i] = NULL;
}
diff --git a/addons/default/visiosoft/base-theme/resources/css/register.css b/addons/default/visiosoft/base-theme/resources/css/register.css
index cbfd641bd..954390e8e 100644
--- a/addons/default/visiosoft/base-theme/resources/css/register.css
+++ b/addons/default/visiosoft/base-theme/resources/css/register.css
@@ -11,4 +11,19 @@
.personal-advantages img {
max-height: 60px;
max-width: 60px;
+}
+
+.approved-phone {
+ background-color: #ebf2e5 !important;
+ border-color: #4a7c20 !important;
+}
+
+.rejected-phone {
+ background-color: #f8e6e9 !important;
+ border-color: #ba7b84 !important;
+}
+
+.phone-validation-error {
+ color: #c75050;
+ font-size: 14px;
}
\ No newline at end of file
diff --git a/addons/default/visiosoft/base-theme/resources/js/register.js b/addons/default/visiosoft/base-theme/resources/js/register.js
index b5b0d5572..5930e77f5 100644
--- a/addons/default/visiosoft/base-theme/resources/js/register.js
+++ b/addons/default/visiosoft/base-theme/resources/js/register.js
@@ -1 +1,48 @@
phoneMask("input[name='phone'],input[name='land_phone']");
+
+// Phone register validation
+//setup before functions
+let typingTimer;
+let doneTypingInterval = 650;
+let phoneInput = $(".validate-phone input[name='phone']");
+
+//on keyup, start the countdown
+phoneInput.on('keyup', function () {
+ clearTimeout(typingTimer);
+ typingTimer = setTimeout(function () {
+ doneTyping(phoneInput.val())
+ }, doneTypingInterval)
+});
+
+//on keydown, clear the countdown
+phoneInput.on('keydown', function () {
+ clearTimeout(typingTimer);
+});
+
+function doneTyping(phoneNum) {
+ if (!phoneNum.includes('_') && phoneNum !== "") {
+ let countryCode = $(".iti__selected-flag").attr('title').split("+");
+ countryCode = '+' + countryCode[countryCode.length - 1];
+
+ $.ajax({
+ type: 'GET',
+ data: {'phoneNumber': countryCode + phoneNum.substr(1)},
+ url: 'ajax/phone-validation',
+ success: function (response) {
+ if (response.userExists) {
+ phoneInput.addClass('rejected-phone');
+ phoneInput.removeClass('approved-phone');
+ $('.phone-validation-error').removeClass('d-none')
+ } else {
+ phoneInput.addClass('approved-phone');
+ phoneInput.removeClass('rejected-phone');
+ $('.phone-validation-error').addClass('d-none')
+ }
+ },
+ });
+ } else {
+ phoneInput.removeClass('approved-phone');
+ phoneInput.removeClass('rejected-phone');
+ $('.phone-validation-error').addClass('d-none')
+ }
+}
\ No newline at end of file
diff --git a/addons/default/visiosoft/base-theme/resources/lang/en/field.php b/addons/default/visiosoft/base-theme/resources/lang/en/field.php
index 4ff406659..9677f96b6 100644
--- a/addons/default/visiosoft/base-theme/resources/lang/en/field.php
+++ b/addons/default/visiosoft/base-theme/resources/lang/en/field.php
@@ -31,6 +31,9 @@ return [
'personal_registration_list_3' => 'Send messages to the ad owners on the site.',
'register_information_note' => 'The information on this page is taken for ' . env('APPLICATION_DOMAIN') . ' membership. You can find detailed information about the protection of personal data here.',
+ // Register page
+ 'phone_validation_error' => 'This email address is in use by another member.',
+
// Forgot Password
'create_new_password' => 'Create New Password',
];
\ No newline at end of file
diff --git a/addons/default/visiosoft/base-theme/resources/views/addons/anomaly/users-module/partials/register-form.twig b/addons/default/visiosoft/base-theme/resources/views/addons/anomaly/users-module/partials/register-form.twig
index 697f139be..c63a55cb9 100644
--- a/addons/default/visiosoft/base-theme/resources/views/addons/anomaly/users-module/partials/register-form.twig
+++ b/addons/default/visiosoft/base-theme/resources/views/addons/anomaly/users-module/partials/register-form.twig
@@ -47,6 +47,25 @@
'class' :'hidden',
}).input|raw }}
{% endif %}
+
+
+
+
+ {{ trans('visiosoft.theme.base::field.phone_validation_error') }}
+
+
+
-
\ No newline at end of file
diff --git a/addons/default/visiosoft/cats-module/src/Http/Controller/Admin/CategoryController.php b/addons/default/visiosoft/cats-module/src/Http/Controller/Admin/CategoryController.php
index 9001e58f3..59ed1653f 100644
--- a/addons/default/visiosoft/cats-module/src/Http/Controller/Admin/CategoryController.php
+++ b/addons/default/visiosoft/cats-module/src/Http/Controller/Admin/CategoryController.php
@@ -69,8 +69,8 @@ class CategoryController extends AdminController
$k++;
}
}
- if ($i >= 7) {
- $this->messages->error('You have reached your sub-category limit, you can only add 5 sub-categories.');
+ if ($i > 10) {
+ $this->messages->error('You have reached your sub-category limit, you can only add 9 sub-categories.');
return $this->redirect->back();
}
diff --git a/addons/default/visiosoft/profile-module/src/Http/Controller/UserAuthenticator.php b/addons/default/visiosoft/profile-module/src/Http/Controller/UserAuthenticator.php
index 3771b1730..735d53103 100644
--- a/addons/default/visiosoft/profile-module/src/Http/Controller/UserAuthenticator.php
+++ b/addons/default/visiosoft/profile-module/src/Http/Controller/UserAuthenticator.php
@@ -224,4 +224,15 @@ class UserAuthenticator
{
return response()->json(['status' => $type, 'message' => $message]);
}
+
+ public function phoneValidation(Request $request, UserRepositoryInterface $userRepository)
+ {
+ $phoneNum = str_replace(' ', '', $request->phoneNumber);
+ $userExists = $userRepository->findBy('gsm_phone', $phoneNum);
+ if ($userExists) {
+ return response()->json(['userExists' => true]);
+ } else {
+ return response()->json(['userExists' => false]);
+ }
+ }
}
diff --git a/addons/default/visiosoft/profile-module/src/ProfileModuleServiceProvider.php b/addons/default/visiosoft/profile-module/src/ProfileModuleServiceProvider.php
index c36245a0c..8d19bab62 100644
--- a/addons/default/visiosoft/profile-module/src/ProfileModuleServiceProvider.php
+++ b/addons/default/visiosoft/profile-module/src/ProfileModuleServiceProvider.php
@@ -111,6 +111,7 @@ class ProfileModuleServiceProvider extends AddonServiceProvider
\Barryvdh\Cors\HandleCors::class,
]
],
+ 'ajax/phone-validation' => 'Visiosoft\ProfileModule\Http\Controller\UserAuthenticator@phoneValidation',
/* Login */
'login-in' => 'Visiosoft\ProfileModule\Http\Controller\UserAuthenticator@attempt',