From b28bc5c212f16ca6d7f591910fcf043f877f264f Mon Sep 17 00:00:00 2001 From: vedatakd Date: Wed, 30 Oct 2019 10:44:07 +0300 Subject: [PATCH 1/2] #503 fixed updated ad for deleted category --- .../advs-module/resources/lang/en/message.php | 1 + .../advs-module/resources/lang/tr/message.php | 1 + .../advs-module/src/Adv/AdvRepository.php | 31 +++++++++++-------- .../src/Http/Controller/advsController.php | 22 ++++++++----- 4 files changed, 35 insertions(+), 20 deletions(-) diff --git a/addons/default/visiosoft/advs-module/resources/lang/en/message.php b/addons/default/visiosoft/advs-module/resources/lang/en/message.php index 081e8c9a2..6457e99d1 100644 --- a/addons/default/visiosoft/advs-module/resources/lang/en/message.php +++ b/addons/default/visiosoft/advs-module/resources/lang/en/message.php @@ -22,4 +22,5 @@ return [ 'cancelBtn' => "or Cancel", 'link' => "", ], + 'update_category_info' => 'Please update category.', ]; diff --git a/addons/default/visiosoft/advs-module/resources/lang/tr/message.php b/addons/default/visiosoft/advs-module/resources/lang/tr/message.php index 091b44747..4c0e3feb9 100644 --- a/addons/default/visiosoft/advs-module/resources/lang/tr/message.php +++ b/addons/default/visiosoft/advs-module/resources/lang/tr/message.php @@ -22,4 +22,5 @@ return [ 'cancelBtn' => "ve ya İptal", 'link' => "", ], + 'update_category_info' => 'Lütfen kategoriyi güncelleyiniz.', ]; \ No newline at end of file diff --git a/addons/default/visiosoft/advs-module/src/Adv/AdvRepository.php b/addons/default/visiosoft/advs-module/src/Adv/AdvRepository.php index d083eec2b..d5f4cd950 100644 --- a/addons/default/visiosoft/advs-module/src/Adv/AdvRepository.php +++ b/addons/default/visiosoft/advs-module/src/Adv/AdvRepository.php @@ -62,7 +62,7 @@ class AdvRepository extends EntryRepository implements AdvRepositoryInterface $join->on('advs_advs.id', '=', 'advs_advs_translations.entry_id'); $join->where('advs_advs_translations.locale', '=', Request()->session()->get('_locale')); }); - + if (!empty($param['keyword'])) { $delimiter = '_'; $keyword = str_slug($param['keyword'], $delimiter); @@ -167,19 +167,19 @@ class AdvRepository extends EntryRepository implements AdvRepositoryInterface if (substr($para, 4, 3) === "cf_") { $id = substr($para, 7); $minmax = substr($para, 0, 3); - if($minmax == 'min'){ + if ($minmax == 'min') { - $num = $param[$minmax.'_cf_'.$id]; + $num = $param[$minmax . '_cf_' . $id]; $int = (int)$num; - $column = "JSON_EXTRACT(cf_json, '$.cf" . $id . "') >= '" . $int ."'"; + $column = "JSON_EXTRACT(cf_json, '$.cf" . $id . "') >= '" . $int . "'"; $query = $query->whereRaw($column); } - if($minmax == 'max'){ + if ($minmax == 'max') { - $num = $param[$minmax.'_cf_'.$id]; + $num = $param[$minmax . '_cf_' . $id]; $int = (int)$num; - $column = "JSON_EXTRACT(cf_json, '$.cf" . $id . "') <= '" . $int ."'"; + $column = "JSON_EXTRACT(cf_json, '$.cf" . $id . "') <= '" . $int . "'"; $query = $query->whereRaw($column); } @@ -201,7 +201,7 @@ class AdvRepository extends EntryRepository implements AdvRepositoryInterface $join->on('advs_advs.id', '=', 'dopings_dopings.adv_name_id'); $join->where('dopings_dopings.doping_type_id', '=', 4); }); - + $query = $query->select('advs_advs.*', 'dopings_dopings.id as doping'); } if (!empty($param['sort_by'])) { @@ -250,12 +250,17 @@ class AdvRepository extends EntryRepository implements AdvRepositoryInterface $cat1 = CategoryModel::query()->where('cats_category.id', $adv->cat1)->first(); $cat2 = CategoryModel::query()->where('cats_category.id', $adv->cat2)->first(); - $adv->setAttribute('cat1_name', $cat1->name); - if ($cat2 == null) { - $adv->setAttribute('cat2_name', ""); - } else { + if (!is_null($cat1)) + $adv->setAttribute('cat1_name', $cat1->name); + else + $adv->setAttribute('cat1_name', ""); + + if (!is_null($cat2)) $adv->setAttribute('cat2_name', $cat2->name); - } + + else + $adv->setAttribute('cat2_name', ""); + return $adv; } diff --git a/addons/default/visiosoft/advs-module/src/Http/Controller/advsController.php b/addons/default/visiosoft/advs-module/src/Http/Controller/advsController.php index 5d71e5423..5d7475e8c 100644 --- a/addons/default/visiosoft/advs-module/src/Http/Controller/advsController.php +++ b/addons/default/visiosoft/advs-module/src/Http/Controller/advsController.php @@ -257,11 +257,14 @@ class AdvsController extends PublicController $cat = "cat" . $i; if ($adv->$cat != null) { $item = $this->category_repository->getItem($adv->$cat); - $categories['cat' . $i] = [ - 'name' => $item->name, - 'id' => $item->id - ]; - $categories_id[] = $item->id; + if (!is_null($item)) { + $categories['cat' . $i] = [ + 'name' => $item->name, + 'id' => $item->id + ]; + $categories_id[] = $item->id; + } + } } @@ -681,8 +684,13 @@ class AdvsController extends PublicController for ($i = 1; $i < 7; $i++) { if ($adv[$cat . $i] != null) { $name = $categoryRepository->getSingleCat($adv[$cat . $i]); - $cats_d['cat' . $i] = $name->name; - $cats['cat' . $i] = $name->id; + if (!is_null($name)) { + $cats_d['cat' . $i] = $name->name; + $cats['cat' . $i] = $name->id; + } else { + $this->messages->info(trans('visiosoft.module.advs::message.update_category_info')); + } + } } From 77c6970cd9aeda3c7c55f6af57b0ca41eaff8ac0 Mon Sep 17 00:00:00 2001 From: vedatakd Date: Wed, 30 Oct 2019 13:33:42 +0300 Subject: [PATCH 2/2] reformat base theme --- .../base-theme/resources/css/default/main.css | 5 - .../base-theme/resources/js/phoneCounter.js | 37 ---- .../base-theme/resources/js/quantity.js | 90 ---------- .../resources/views/ad-detail/detail.twig | 106 ++++-------- .../ad-detail/partials/author-button.twig | 16 ++ .../blocks/ads-item-details-block.twig | 162 ------------------ .../blocks/ads-item-picture-block.twig | 19 -- ...tem-content-block.twig => content-ad.twig} | 0 .../views/ad-detail/partials/detail.twig | 112 ++++++++++++ .../views/ad-detail/partials/slider.twig | 25 +++ .../views/ad-detail/partials/social.twig | 14 ++ .../resources/lang/en/field.php | 6 +- .../views/ad-detail/contact-with.twig | 30 ++++ .../src/Profile/Command/FindUserProfile.php | 33 ++++ .../Contract/ProfileRepositoryInterface.php | 6 +- .../src/Profile/ProfileRepository.php | 37 ++-- .../src/ProfileModulePlugin.php | 28 +++ .../src/ProfileModuleServiceProvider.php | 4 +- 18 files changed, 322 insertions(+), 408 deletions(-) delete mode 100644 addons/default/visiosoft/base-theme/resources/js/phoneCounter.js delete mode 100644 addons/default/visiosoft/base-theme/resources/js/quantity.js create mode 100644 addons/default/visiosoft/base-theme/resources/views/ad-detail/partials/author-button.twig delete mode 100644 addons/default/visiosoft/base-theme/resources/views/ad-detail/partials/blocks/ads-item-details-block.twig delete mode 100644 addons/default/visiosoft/base-theme/resources/views/ad-detail/partials/blocks/ads-item-picture-block.twig rename addons/default/visiosoft/base-theme/resources/views/ad-detail/partials/{blocks/ads-item-content-block.twig => content-ad.twig} (100%) create mode 100644 addons/default/visiosoft/base-theme/resources/views/ad-detail/partials/detail.twig create mode 100644 addons/default/visiosoft/base-theme/resources/views/ad-detail/partials/slider.twig create mode 100644 addons/default/visiosoft/base-theme/resources/views/ad-detail/partials/social.twig create mode 100644 addons/default/visiosoft/profile-module/resources/views/ad-detail/contact-with.twig create mode 100644 addons/default/visiosoft/profile-module/src/Profile/Command/FindUserProfile.php create mode 100644 addons/default/visiosoft/profile-module/src/ProfileModulePlugin.php diff --git a/addons/default/visiosoft/base-theme/resources/css/default/main.css b/addons/default/visiosoft/base-theme/resources/css/default/main.css index c9e17df59..c22e29376 100755 --- a/addons/default/visiosoft/base-theme/resources/css/default/main.css +++ b/addons/default/visiosoft/base-theme/resources/css/default/main.css @@ -478,7 +478,6 @@ textarea { .offered-field { border-top: 1px solid #d5d5d5; - border-bottom: 1px solid #d5d5d5; } .banner-section h1.title { @@ -1610,10 +1609,6 @@ a.verified i { width: 25px; } -.offered-field { - margin-top: 15px; -} - .offered-row { padding-left: 0px; } diff --git a/addons/default/visiosoft/base-theme/resources/js/phoneCounter.js b/addons/default/visiosoft/base-theme/resources/js/phoneCounter.js deleted file mode 100644 index a5967dab9..000000000 --- a/addons/default/visiosoft/base-theme/resources/js/phoneCounter.js +++ /dev/null @@ -1,37 +0,0 @@ -function sendCount() { - var id = $('.show-number').attr('data-id'); - if (id != "") { - $.ajax({ - type: 'POST', - url: '/ajax/countPhone', - data: 'id=' + id, - success: function (data) { - hideLoader() - $('.show-number').removeAttr('data-function'); - }, - beforeSend: function () { - showLoader() - } - }); - } - -} - -// ------------------------------------------------------------- -// Show Mobile Number -// ------------------------------------------------------------- - -(function () { - $('.show-number').on('click', function () { - this.addEventListener('click', sendCount()); - $('.hide-text').fadeIn(500, function () { - $(this).addClass('hide'); - }); - $('.hide-number').fadeIn(500, function () { - $(this).addClass('show'); - }); - }); -}()); - - -// script end \ No newline at end of file diff --git a/addons/default/visiosoft/base-theme/resources/js/quantity.js b/addons/default/visiosoft/base-theme/resources/js/quantity.js deleted file mode 100644 index ad46f4682..000000000 --- a/addons/default/visiosoft/base-theme/resources/js/quantity.js +++ /dev/null @@ -1,90 +0,0 @@ -function getInput(field) { - var row = field.parent().parent(); - return $(row).find('.add-cart-quantity-input'); -} - -//plus -$('.add-cart-upgrade button').on('click', function () { - var input = getInput($(this)); - updatePrice(input, 'plus') -}) - -//minus -$('.add-cart-reduce button').on('click', function () { - var input = getInput($(this)); - updatePrice(input, 'minus') -}) - -//change -$('.add-cart-quantity-input').on('change', function () { - var input = getInput($(this)); - updatePrice(input, 'change') -}) - -function updatePrice(input, type) { - var ad_id = $(input).attr('data-id'); - var current_quantity = $(input).val(); - - productDetail(ad_id, current_quantity, type, function (data) { - ChangeFieldForResponse(type, data.newPrice, data.newQuantity, data.maxQuantity) - }); - -} - -function productDetail(id, quantity, type, returnData) { - if (quantity == 0) { - quantity = 1; - } - $.ajax({ - type: 'POST', - url: '/ajax/StockControl', - data: 'id=' + id + '&quantity=' + quantity + '&type=' + type, - success: function (data) { - hideLoader() - returnData(data); - }, - beforeSend: function () { - showLoader() - } - }); -} - -function ChangeFieldForResponse(type, price, quantity, maxQuantity) { - if (parseInt(quantity) == 1) { - $('.add-cart-reduce button').attr('disabled', true); - } else { - $('.add-cart-reduce button').attr('disabled', false); - } - if (quantity == maxQuantity) { - $('.add-cart-upgrade button').attr('disabled', true); - } else { - $('.add-cart-upgrade button').attr('disabled', false); - } - $('.add-cart-quantity-input').val(parseInt(quantity)); - $('.ad-price b').html(parseInt(price)) -} - -$('.add-cart-button').on('click', function () { - var quantity = $('.add-cart-quantity-input').val(); - var id = $('.add-cart-quantity-input').attr('data-id'); - return addCart(id, quantity) -}) - -function addCart(id, quantity) { - $.ajax({ - type: 'POST', - url: '/ajax/addCart', - data: 'id=' + id + '&quantity=' + quantity, - success: function (data) { - if (data.status == "success") { - var url = window.location.origin; - window.location.reload(); - } else { - alert(data.msg); - } - }, - beforeSend: function () { - showLoader() - } - }); -} \ No newline at end of file diff --git a/addons/default/visiosoft/base-theme/resources/views/ad-detail/detail.twig b/addons/default/visiosoft/base-theme/resources/views/ad-detail/detail.twig index 95be6461a..b49657bc5 100644 --- a/addons/default/visiosoft/base-theme/resources/views/ad-detail/detail.twig +++ b/addons/default/visiosoft/base-theme/resources/views/ad-detail/detail.twig @@ -9,68 +9,54 @@ {% endblock %} + {% block content %} - {{ asset_add("scripts.js", "theme::js.default.fotorama.min.js") }} - {{ asset_add("theme.css", "theme::css.default.fotorama.min.css") }} + {% if entries('advs').isEnabled('comments') %} {{ asset_add("styles.css", "visiosoft.module.comments::css/style.css") }} {% endif %} +
+ {% include "theme::partials/messages" %} + + + - +
- -
- {% if blocks('ad-item-picture-block-area') is null %} - {% include "visiosoft.theme.base::ad-detail/partials/blocks/ads-item-picture-block" %} - {% else %} - {{ blocks('ad-item-picture-block-area') }} - {% endif %} -
+ {% include "theme::ad-detail/partials/slider" %} -
-
- {% if entries('advs').isEnabled('favs') %} - - {% endif %} - - {% if blocks('ad-item-details-block-area') is null %} - {% include "visiosoft.theme.base::ad-detail/partials/blocks/ads-item-details-block" %} - {% else %} - {{ blocks('ad-item-details-block-area') }} - {% endif %} -
+ {% include "theme::ad-detail/partials/detail" %}
+ {% if entries('advs').isEnabled('complaints') %} {% endif %} - -
- +
+ {% if blocks('ad-item-content-block-area') is null %} - {% include "visiosoft.theme.base::ad-detail/partials/blocks/ads-item-content-block" %} + {% include "visiosoft.theme.base::ad-detail/partials/content-ad" %} {% else %} {{ blocks('ad-item-content-block-area') }} {% endif %} @@ -79,7 +65,7 @@ {% include "visiosoft.module.recommendedads::recommended-ads" %} {% endif %} - +
@@ -88,53 +74,14 @@ {% include "visiosoft.module.complaints::modal" %} {% endif %} - - - + {% if entries('advs').isEnabled('messages') %} + {% include "visiosoft.module.messages::ad-detail/modal" %} + {% endif %} {% if entries('advs').isEnabled('favs') %} {{ asset_add("scripts.js", "visiosoft.module.favs::js/favs.js") }} {% endif %} - {{ asset_add("scripts.js", "visiosoft.theme.base::js/list-item.js") }} - {{ asset_add("scripts.js", "visiosoft.theme.base::js/quantity.js") }} - {{ asset_add("scripts.js", "visiosoft.theme.base::js/phoneCounter.js") }} - {{ asset_add("scripts.js", "visiosoft.theme.base::js/viewed.js") }} - {% if entries('advs').isEnabled('comments') %} {{ asset_add("scripts.js", "visiosoft.module.comments::js/ajaxcomment.js") }} {% endif %} @@ -143,6 +90,17 @@ {% include "visiosoft.module.comparisons::comparison" %} {% endif %} + {% if entries('advs').isEnabled('phoneclickcounter') %} + {{ asset_add("scripts.js", "visiosoft.module.phoneclickcounter::js/phoneCounter.js") }} + {% endif %} + + {% if entries('advs').isEnabled('carts') %} + {{ asset_add("scripts.js", "visiosoft.module.carts::js/quantity.js") }} + {% endif %} + + {{ asset_add("scripts.js", "visiosoft.theme.base::js/list-item.js") }} + {{ asset_add("scripts.js", "visiosoft.theme.base::js/viewed.js") }} + {% endblock %} {% block customjs %} diff --git a/addons/default/visiosoft/base-theme/resources/views/ad-detail/partials/author-button.twig b/addons/default/visiosoft/base-theme/resources/views/ad-detail/partials/author-button.twig new file mode 100644 index 000000000..11bcc2500 --- /dev/null +++ b/addons/default/visiosoft/base-theme/resources/views/ad-detail/partials/author-button.twig @@ -0,0 +1,16 @@ +{% if app.auth.id == adv.created_by_id %} + + {{ trans('visiosoft.module.advs::field.edit') }} + {% if adv.status != "pending_admin" and adv.status != "approved" %} + + {{ trans('visiosoft.module.advs::field.approve') }} + {% else %} + + {{ trans('visiosoft.module.advs::field.passive') }} + {% endif %} +{% endif %} \ No newline at end of file diff --git a/addons/default/visiosoft/base-theme/resources/views/ad-detail/partials/blocks/ads-item-details-block.twig b/addons/default/visiosoft/base-theme/resources/views/ad-detail/partials/blocks/ads-item-details-block.twig deleted file mode 100644 index b663050ba..000000000 --- a/addons/default/visiosoft/base-theme/resources/views/ad-detail/partials/blocks/ads-item-details-block.twig +++ /dev/null @@ -1,162 +0,0 @@ -

{{ adv.title }}

-

- {{ adv.price.format() }} {{ adv.currency }} - {% if app.auth.id == adv.created_by_id %} - - {{ trans('visiosoft.module.advs::field.edit') }} - {% if adv.status != "pending_admin" and adv.status != "approved" %} - - {{ trans('visiosoft.module.advs::field.approve') }} - {% else %} - - {{ trans('visiosoft.module.advs::field.passive') }} - {% endif %} - {% endif %} -

-
- {% if adv.is_get_adv == "1" and adv.stock != "0" and entries('advs').isEnabled('carts') %} -
-
-
- -
-
- - {{ trans('visiosoft.module.advs::field.quantity') }} - {#Trans yapılacak#} -
-
- -
-
- -
- {% endif %} -
- {% if entries('advs').isEnabled('favs') %} - - {% endif %} - {{ trans('visiosoft.module.advs::field.offered_by') }}: - {{ adv.owner }} - - {{ trans('visiosoft.module.advs::field.ad_id') }}: - {{ adv.id }} - -
- -
- {{ adv.created_at|date('d/m/Y') }} - - {% if setting_value('visiosoft.module.location::detail_page_location') %} - {{ adv.city_name }} - , {{ adv.country_name }} - {% endif %} - {% if adv.isCorporate == 2 %} - {{ adv.owner }} - {% endif %} -
- -
- {% if entries('advs').isEnabled('comparisons') %} - {% include "visiosoft.module.comparisons::comparebtn" %} - {{ trans('visiosoft.module.comparisons::field.comparisonpagetitle') }} - {% endif %} -
- - {% if(adv.video_url != null) %} -
-

{{ trans('visiosoft.module.cloudinary::field.video') }}

- {{ trans('visiosoft.module.cloudinary::field.video') }} - - -
- {% endif %} - {% if(profile.getObject().gsm_phone is not null or profile.office_phone is not null or entries('advs').isEnabled('messages')) %} - -
-

{{ trans('visiosoft.module.advs::field.contact_with') }}

- {% if(profile.getObject().gsm_phone != null) %} - - - {{ trans('visiosoft.module.advs::field.click_phone') }} - {{ trans("visiosoft.module.advs::field.phone_gsm") }} - : {{ profile.getObject().gsm_phone }} - {% if profile.office_phone != null and profile.office_phone != "" %} -
- {{ trans("visiosoft.module.advs::field.phone_office") }}: {{ profile.office_phone }} - {% endif %} -
-
- {% endif %} - {% if entries('advs').isEnabled('messages') %} - {{ trans("visiosoft.module.advs::field.send_message") }} - - {% endif %} -
- {% endif %} - {% if adv_detail_place_code %} -
- {{ adv_detail_place_code }} -
- {% endif %} - - - -
\ No newline at end of file diff --git a/addons/default/visiosoft/base-theme/resources/views/ad-detail/partials/blocks/ads-item-picture-block.twig b/addons/default/visiosoft/base-theme/resources/views/ad-detail/partials/blocks/ads-item-picture-block.twig deleted file mode 100644 index 30404957e..000000000 --- a/addons/default/visiosoft/base-theme/resources/views/ad-detail/partials/blocks/ads-item-picture-block.twig +++ /dev/null @@ -1,19 +0,0 @@ -
- {% set advPhoto = '' %} - {% if count(adv.files) == 0 %} - {% set advPhoto = img('theme::images/no-image.png').url %} - - {% else %} - {% for image in adv.getViewPhotoUrl %} - - {% if loop.index == 1 %} - {% set advPhoto = image %} - {% endif %} - {% endfor %} - - {% endif %} -
\ No newline at end of file diff --git a/addons/default/visiosoft/base-theme/resources/views/ad-detail/partials/blocks/ads-item-content-block.twig b/addons/default/visiosoft/base-theme/resources/views/ad-detail/partials/content-ad.twig similarity index 100% rename from addons/default/visiosoft/base-theme/resources/views/ad-detail/partials/blocks/ads-item-content-block.twig rename to addons/default/visiosoft/base-theme/resources/views/ad-detail/partials/content-ad.twig diff --git a/addons/default/visiosoft/base-theme/resources/views/ad-detail/partials/detail.twig b/addons/default/visiosoft/base-theme/resources/views/ad-detail/partials/detail.twig new file mode 100644 index 000000000..7281a43a2 --- /dev/null +++ b/addons/default/visiosoft/base-theme/resources/views/ad-detail/partials/detail.twig @@ -0,0 +1,112 @@ +
+ {% if entries('advs').isEnabled('favs') %} + + + + + + {% endif %} + + {% if blocks('ad-item-details-block-area') is null %} + +

{{ adv.title }}

+ +

+ {{ adv.price.format() }} {{ adv.currency }} + + {% include "theme::ad-detail/partials/author-button" %} + +

+ +
+ + {% if adv.is_get_adv == "1" and adv.stock != "0" and entries('advs').isEnabled('carts') %} + {% include "visiosoft.module.carts::ad-detail/quantity" %} + {% endif %} + +
+ + {% if entries('advs').isEnabled('favs') %} + + + + {% endif %} + + {{ trans('visiosoft.module.advs::field.offered_by') }}: + {{ adv.owner }} + + + {{ trans('visiosoft.module.advs::field.ad_id') }}: + {{ adv.id }} + + +
+ +
+ + + {{ adv.created_at|date('d/m/Y') }} + + + {% if setting_value('visiosoft.module.location::detail_page_location') %} + + + {{ adv.city_name }}, {{ adv.country_name }} + + {% endif %} + + {% if adv.isCorporate == 2 %} + + + {{ adv.owner }} + + {% endif %} + +
+ + {% if entries('advs').isEnabled('comparisons') %} + +
+ {% include "visiosoft.module.comparisons::comparebtn" %} + + {{ trans('visiosoft.module.comparisons::field.comparisonpagetitle') }} + +
+ + {% endif %} + + {% if(adv.video_url != null) %} + + {% include "visiosoft.module.cloudinary::ad-detail/player-modal" %} + + {% endif %} + + +
+

{{ trans('visiosoft.module.advs::field.contact_with') }}

+ + {% include "visiosoft.module.profile::ad-detail/contact-with" %} + + {% if entries('advs').isEnabled('messages') %} + + {% include "visiosoft.module.messages::ad-detail/contact-with" %} + + {% endif %} + +
+ + + + + +
+ + {% else %} + {{ blocks('ad-item-details-block-area') }} + {% endif %} + +
\ No newline at end of file diff --git a/addons/default/visiosoft/base-theme/resources/views/ad-detail/partials/slider.twig b/addons/default/visiosoft/base-theme/resources/views/ad-detail/partials/slider.twig new file mode 100644 index 000000000..aa271a457 --- /dev/null +++ b/addons/default/visiosoft/base-theme/resources/views/ad-detail/partials/slider.twig @@ -0,0 +1,25 @@ +
+ {% if blocks('ad-item-picture-block-area') is null %} +
+ {% set advPhoto = '' %} + {% if count(adv.files) == 0 %} + {% set advPhoto = img('theme::images/no-image.png').url %} + + {% else %} + {% for image in adv.getViewPhotoUrl %} + + {% if loop.index == 1 %} + {% set advPhoto = image %} + {% endif %} + {% endfor %} + + {% endif %} +
+ {% else %} + {{ blocks('ad-item-picture-block-area') }} + {% endif %} +
diff --git a/addons/default/visiosoft/base-theme/resources/views/ad-detail/partials/social.twig b/addons/default/visiosoft/base-theme/resources/views/ad-detail/partials/social.twig new file mode 100644 index 000000000..1472c7882 --- /dev/null +++ b/addons/default/visiosoft/base-theme/resources/views/ad-detail/partials/social.twig @@ -0,0 +1,14 @@ +

{{ trans('visiosoft.module.advs::field.share') }}

+ \ No newline at end of file diff --git a/addons/default/visiosoft/profile-module/resources/lang/en/field.php b/addons/default/visiosoft/profile-module/resources/lang/en/field.php index e79d67866..d52b22f87 100644 --- a/addons/default/visiosoft/profile-module/resources/lang/en/field.php +++ b/addons/default/visiosoft/profile-module/resources/lang/en/field.php @@ -44,13 +44,13 @@ return [ 'name' => 'Village' ], 'gsm_phone' => [ - 'name' => 'GSM Phone Number' + 'name' => 'GSM Phone' ], 'land_phone' => [ - 'name' => 'Land Phone Number' + 'name' => 'Land Phone' ], 'office_phone' => [ - 'name' => 'Office Phone Number' + 'name' => 'Office Phone' ], 'register_type' => [ 'name' => 'Register Type' diff --git a/addons/default/visiosoft/profile-module/resources/views/ad-detail/contact-with.twig b/addons/default/visiosoft/profile-module/resources/views/ad-detail/contact-with.twig new file mode 100644 index 000000000..4f3b0a667 --- /dev/null +++ b/addons/default/visiosoft/profile-module/resources/views/ad-detail/contact-with.twig @@ -0,0 +1,30 @@ +{% set profile = findUserProfile(adv.created_by_id) %} + +{% if profile.gsm_phone is not null %} + + + {{ trans('visiosoft.module.advs::field.click_phone') }} + + {% if profile.gsm_phone is not null %} +

+ + {{ trans("visiosoft.module.profile::field.gsm_phone.name") }}: {{ profile.gsm_phone }} +

+ {% endif %} + + {% if profile.office_phone is not empty %} +

+ + {{ trans("visiosoft.module.profile::field.office_phone.name") }}: {{ profile.office_phone }} +

+ {% endif %} + + {% if profile.land_phone is not empty %} +

+ + {{ trans("visiosoft.module.profile::field.office_phone.name") }}: {{ profile.office_phone }} +

+ {% endif %} + +
+{% endif %} \ No newline at end of file diff --git a/addons/default/visiosoft/profile-module/src/Profile/Command/FindUserProfile.php b/addons/default/visiosoft/profile-module/src/Profile/Command/FindUserProfile.php new file mode 100644 index 000000000..140dc0598 --- /dev/null +++ b/addons/default/visiosoft/profile-module/src/Profile/Command/FindUserProfile.php @@ -0,0 +1,33 @@ +id = $id; + } + + /** + * @param ProfileRepositoryInterface $profileRepository + * @return |null + */ + public function handle(ProfileRepositoryInterface $profileRepository) + { + if ($this->id) { + return $profileRepository->findByUserID($this->id); + } + return null; + } +} diff --git a/addons/default/visiosoft/profile-module/src/Profile/Contract/ProfileRepositoryInterface.php b/addons/default/visiosoft/profile-module/src/Profile/Contract/ProfileRepositoryInterface.php index 9938e4690..961e9e7ac 100644 --- a/addons/default/visiosoft/profile-module/src/Profile/Contract/ProfileRepositoryInterface.php +++ b/addons/default/visiosoft/profile-module/src/Profile/Contract/ProfileRepositoryInterface.php @@ -9,8 +9,12 @@ interface ProfileRepositoryInterface extends EntryRepositoryInterface public function getProfile($id); public function validPasswordByEmail($email); + public function validPasswordByUsername($username); public function updateUserField($fields); - public function changePassword($fields,$password); + + public function changePassword($fields, $password); + + public function findByUserID($id); } diff --git a/addons/default/visiosoft/profile-module/src/Profile/ProfileRepository.php b/addons/default/visiosoft/profile-module/src/Profile/ProfileRepository.php index c8a5422bd..2da0607d2 100644 --- a/addons/default/visiosoft/profile-module/src/Profile/ProfileRepository.php +++ b/addons/default/visiosoft/profile-module/src/Profile/ProfileRepository.php @@ -103,26 +103,31 @@ class ProfileRepository extends EntryRepository implements ProfileRepositoryInte public function changePassword($fields, $userPassword) { - if ($fields['new_password'] != $fields['re_new_password']) { - $errorList[] = trans('anomaly.module.users::field.confirm_password.name'); - $fields['error'] = $errorList; - return $fields; - } + if ($fields['new_password'] != $fields['re_new_password']) { + $errorList[] = trans('anomaly.module.users::field.confirm_password.name'); + $fields['error'] = $errorList; + return $fields; + } - $validator = $userPassword->validate($fields['new_password']); - $errorList = array(); - foreach ($validator->errors()->all() as $error) { - $errorList[] = $error; - } - if (count($errorList) != 0) { - $fields['error'] = $errorList; - return $fields; - } + $validator = $userPassword->validate($fields['new_password']); + $errorList = array(); + foreach ($validator->errors()->all() as $error) { + $errorList[] = $error; + } + if (count($errorList) != 0) { + $fields['error'] = $errorList; + return $fields; + } - UsersUsersEntryModel::query()->find(Auth::id())->update(['password' => Hash::make($fields['new_password'])]); - unset($fields['new_password'], $fields['re_new_password'], $fields['confirm_password_input']); + UsersUsersEntryModel::query()->find(Auth::id())->update(['password' => Hash::make($fields['new_password'])]); + unset($fields['new_password'], $fields['re_new_password'], $fields['confirm_password_input']); return $fields; } + public function findByUserID($id) + { + return $this->model->where('user_no_id', $id)->first(); + } + } diff --git a/addons/default/visiosoft/profile-module/src/ProfileModulePlugin.php b/addons/default/visiosoft/profile-module/src/ProfileModulePlugin.php new file mode 100644 index 000000000..749ee3007 --- /dev/null +++ b/addons/default/visiosoft/profile-module/src/ProfileModulePlugin.php @@ -0,0 +1,28 @@ +dispatch(new FindUserProfile($id))) { + return null; + } + + return $ad; + } + ) + ]; + } +} diff --git a/addons/default/visiosoft/profile-module/src/ProfileModuleServiceProvider.php b/addons/default/visiosoft/profile-module/src/ProfileModuleServiceProvider.php index 0ac8c7d78..5da671856 100644 --- a/addons/default/visiosoft/profile-module/src/ProfileModuleServiceProvider.php +++ b/addons/default/visiosoft/profile-module/src/ProfileModuleServiceProvider.php @@ -22,7 +22,9 @@ class ProfileModuleServiceProvider extends AddonServiceProvider * * @type array|null */ - protected $plugins = []; + protected $plugins = [ + ProfileModulePlugin::class + ]; /** * The addon Artisan commands.