From f3446b035c79148fb38df43256fca10b2a2f4455 Mon Sep 17 00:00:00 2001 From: Diatrex Date: Fri, 5 Jun 2020 12:16:19 +0300 Subject: [PATCH 1/7] #1631 [emlak24-theme] [singlefile-field_type] [store-module] view file error --- .../singlefile-field_type/src/Table/ValueTableBuilder.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/default/visiosoft/singlefile-field_type/src/Table/ValueTableBuilder.php b/addons/default/visiosoft/singlefile-field_type/src/Table/ValueTableBuilder.php index d9e5a4698..9805cc021 100644 --- a/addons/default/visiosoft/singlefile-field_type/src/Table/ValueTableBuilder.php +++ b/addons/default/visiosoft/singlefile-field_type/src/Table/ValueTableBuilder.php @@ -47,7 +47,7 @@ class ValueTableBuilder extends TableBuilder protected $buttons = [ 'view' => [ 'target' => '_blank', - 'href' => 'admin/files/view/{entry.id}', + 'href' => '/files/{entry.path}', ], 'remove' => [ 'data-dismiss' => 'file', From 990f210f343ea2ecf79d125ce45da236484f9a96 Mon Sep 17 00:00:00 2001 From: Diatrex Date: Fri, 5 Jun 2020 20:13:04 +0300 Subject: [PATCH 2/7] =?UTF-8?q?#1597=20=C4=B0lanlara=20=C3=BCr=C3=BCn=20sa?= =?UTF-8?q?t=C4=B1=C5=9F=20opisyonlar=C4=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...iosoft.module.advs__create_advs_fields.php | 8 ++++ ...oft.module.advs__create_options_stream.php | 45 +++++++++++++++++++ .../resources/config/permissions.php | 5 +++ .../advs-module/resources/js/new-create.js | 7 ++- .../advs-module/resources/lang/en/button.php | 1 + .../resources/lang/en/permission.php | 8 ++++ .../advs-module/resources/lang/en/section.php | 3 ++ .../advs-module/resources/lang/en/stream.php | 3 ++ .../views/ad-detail/partials/detail.twig | 2 +- .../resources/views/new-ad/new-create.twig | 17 +++++++ .../advs-module/src/Adv/AdvModel.php | 4 +- .../src/AdvsModuleServiceProvider.php | 4 +- .../src/Http/Controller/advsController.php | 44 ++++++++++++++++-- 13 files changed, 142 insertions(+), 9 deletions(-) create mode 100644 addons/default/visiosoft/advs-module/migrations/2020_06_05_120415_visiosoft.module.advs__create_options_stream.php diff --git a/addons/default/visiosoft/advs-module/migrations/2018_09_25_211014_visiosoft.module.advs__create_advs_fields.php b/addons/default/visiosoft/advs-module/migrations/2018_09_25_211014_visiosoft.module.advs__create_advs_fields.php index e6e21a7c7..3ab4d2d9b 100644 --- a/addons/default/visiosoft/advs-module/migrations/2018_09_25_211014_visiosoft.module.advs__create_advs_fields.php +++ b/addons/default/visiosoft/advs-module/migrations/2018_09_25_211014_visiosoft.module.advs__create_advs_fields.php @@ -250,5 +250,13 @@ class VisiosoftModuleAdvsCreateAdvsFields extends Migration 'default_value' => 0, ] ], + + // Options Fields + "adv" => [ + "type" => "anomaly.field_type.relationship", + "config" => [ + "related" => AdvModel::class, + ] + ] ]; } diff --git a/addons/default/visiosoft/advs-module/migrations/2020_06_05_120415_visiosoft.module.advs__create_options_stream.php b/addons/default/visiosoft/advs-module/migrations/2020_06_05_120415_visiosoft.module.advs__create_options_stream.php new file mode 100644 index 000000000..c00f35ae8 --- /dev/null +++ b/addons/default/visiosoft/advs-module/migrations/2020_06_05_120415_visiosoft.module.advs__create_options_stream.php @@ -0,0 +1,45 @@ + 'options', + 'title_column' => 'name', + 'translatable' => false, + 'versionable' => false, + 'trashable' => false, + 'searchable' => false, + 'sortable' => false, + ]; + + /** + * The stream assignments. + * + * @var array + */ + protected $assignments = [ + 'name' => [ + 'required' => true, + ], + 'adv' => [ + 'required' => true, + ], + ]; + +} diff --git a/addons/default/visiosoft/advs-module/resources/config/permissions.php b/addons/default/visiosoft/advs-module/resources/config/permissions.php index 33de065db..eae0b67cd 100644 --- a/addons/default/visiosoft/advs-module/resources/config/permissions.php +++ b/addons/default/visiosoft/advs-module/resources/config/permissions.php @@ -16,4 +16,9 @@ return [ 'write', 'delete', ], + 'options' => [ + 'read', + 'write', + 'delete', + ], ]; diff --git a/addons/default/visiosoft/advs-module/resources/js/new-create.js b/addons/default/visiosoft/advs-module/resources/js/new-create.js index c75f3693a..4464b2885 100644 --- a/addons/default/visiosoft/advs-module/resources/js/new-create.js +++ b/addons/default/visiosoft/advs-module/resources/js/new-create.js @@ -215,5 +215,10 @@ $(document).ready(function () { price = parseInt(price.replace(/\./g, '')); let decimal = parseInt($(".priceDecimalField").val()); $('.priceHidden').find('input').val(parseFloat(price + "." + decimal)); - }) + }); + + // Add dynamic option creation + $(".options-tags").select2({ + tags: true + }); }); diff --git a/addons/default/visiosoft/advs-module/resources/lang/en/button.php b/addons/default/visiosoft/advs-module/resources/lang/en/button.php index 75eac762f..c84a77408 100644 --- a/addons/default/visiosoft/advs-module/resources/lang/en/button.php +++ b/addons/default/visiosoft/advs-module/resources/lang/en/button.php @@ -31,4 +31,5 @@ return [ 'update_category' => [ 'name' => 'Update Category' ], + 'new_option' => 'New Option', ]; diff --git a/addons/default/visiosoft/advs-module/resources/lang/en/permission.php b/addons/default/visiosoft/advs-module/resources/lang/en/permission.php index 762eea4c9..a75575d96 100644 --- a/addons/default/visiosoft/advs-module/resources/lang/en/permission.php +++ b/addons/default/visiosoft/advs-module/resources/lang/en/permission.php @@ -49,4 +49,12 @@ return [ 'delete' => 'Can delete cf values?', ], ], + 'options' => [ + 'name' => 'Options', + 'option' => [ + 'read' => 'Can read options?', + 'write' => 'Can create/edit options?', + 'delete' => 'Can delete options?', + ], + ], ]; diff --git a/addons/default/visiosoft/advs-module/resources/lang/en/section.php b/addons/default/visiosoft/advs-module/resources/lang/en/section.php index 1a3eeb889..d59a01842 100644 --- a/addons/default/visiosoft/advs-module/resources/lang/en/section.php +++ b/addons/default/visiosoft/advs-module/resources/lang/en/section.php @@ -40,4 +40,7 @@ return [ 'general' => 'General', 'ads' => 'Ads', 'user' => 'User', + 'options' => [ + 'title' => 'Options', + ], ]; diff --git a/addons/default/visiosoft/advs-module/resources/lang/en/stream.php b/addons/default/visiosoft/advs-module/resources/lang/en/stream.php index cd23e3479..29e720836 100644 --- a/addons/default/visiosoft/advs-module/resources/lang/en/stream.php +++ b/addons/default/visiosoft/advs-module/resources/lang/en/stream.php @@ -19,4 +19,7 @@ return [ 'cf_values' => [ 'name' => 'Cf values', ], + 'options' => [ + 'name' => 'Options', + ], ]; diff --git a/addons/default/visiosoft/advs-module/resources/views/ad-detail/partials/detail.twig b/addons/default/visiosoft/advs-module/resources/views/ad-detail/partials/detail.twig index e5c1cbac5..5a5c3e1b7 100644 --- a/addons/default/visiosoft/advs-module/resources/views/ad-detail/partials/detail.twig +++ b/addons/default/visiosoft/advs-module/resources/views/ad-detail/partials/detail.twig @@ -34,7 +34,7 @@ - {{ addBlock('ad-detail/details',{'adv':adv})|raw }} + {{ addBlock('ad-detail/details',{'adv':adv, 'options':options})|raw }} {{ addBlock('ad-detail/widget-details',{'adv':adv})|raw }} diff --git a/addons/default/visiosoft/advs-module/resources/views/new-ad/new-create.twig b/addons/default/visiosoft/advs-module/resources/views/new-ad/new-create.twig index 435a6582b..e509c566d 100644 --- a/addons/default/visiosoft/advs-module/resources/views/new-ad/new-create.twig +++ b/addons/default/visiosoft/advs-module/resources/views/new-ad/new-create.twig @@ -20,6 +20,7 @@
{% set form = form('advs', 'advs').entry(id).actions(['update']).get() %} {{ form_open({ + 'id': 'createEditAdvForm', 'class': 'form ' ~ form.options.class , 'enctype': 'multipart/form-data', 'url': 'advs/save_adv', @@ -94,6 +95,22 @@
+
+ +
+ +
+
+
diff --git a/addons/default/visiosoft/advs-module/src/Adv/AdvModel.php b/addons/default/visiosoft/advs-module/src/Adv/AdvModel.php index f8173e67e..a8aabe2ce 100644 --- a/addons/default/visiosoft/advs-module/src/Adv/AdvModel.php +++ b/addons/default/visiosoft/advs-module/src/Adv/AdvModel.php @@ -213,10 +213,10 @@ class AdvModel extends AdvsAdvsEntryModel implements AdvInterface return $this->getAdv()->where('advs_advs.id', $id)->first(); } - public function addCart($item, $quantity = 1) + public function addCart($item, $quantity = 1, $name = null) { $cart = $this->dispatch(new GetCart()); - $cart->add($item, $quantity); + $cart->add($item, $quantity, $name); return $this->dispatch(new GetCart()); } diff --git a/addons/default/visiosoft/advs-module/src/AdvsModuleServiceProvider.php b/addons/default/visiosoft/advs-module/src/AdvsModuleServiceProvider.php index 133138baa..3c2eb285e 100644 --- a/addons/default/visiosoft/advs-module/src/AdvsModuleServiceProvider.php +++ b/addons/default/visiosoft/advs-module/src/AdvsModuleServiceProvider.php @@ -11,6 +11,8 @@ use Anomaly\Streams\Platform\Model\Advs\AdvsAdvsEntryModel; use Visiosoft\AdvsModule\Adv\AdvModel; use Visiosoft\AdvsModule\Adv\Form\AdvFormBuilder; use Visiosoft\AdvsModule\Listener\AddAdvsSettingsScript; +use Visiosoft\AdvsModule\Option\Contract\OptionRepositoryInterface; +use Visiosoft\AdvsModule\Option\OptionRepository; use Visiosoft\LocationModule\Village\Contract\VillageRepositoryInterface; use Visiosoft\LocationModule\Village\VillageRepository; use Visiosoft\LocationModule\Village\VillageModel; @@ -299,7 +301,7 @@ class AdvsModuleServiceProvider extends AddonServiceProvider VillageRepositoryInterface::class => VillageRepository::class, CategoryRepositoryInterface::class => CategoryRepository::class, CountryRepositoryInterface::class => CountryRepository::class, - AdvRepositoryInterface::class => AdvRepository::class, + OptionRepositoryInterface::class => OptionRepository::class, ]; /** 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 88e6db12c..949d147e6 100644 --- a/addons/default/visiosoft/advs-module/src/Http/Controller/advsController.php +++ b/addons/default/visiosoft/advs-module/src/Http/Controller/advsController.php @@ -14,6 +14,7 @@ use Visiosoft\AdvsModule\Adv\Event\showAdPhone; use Illuminate\Http\Request; use Illuminate\Support\Facades\Auth; use Illuminate\Support\Facades\Cookie; +use Visiosoft\AdvsModule\Option\Contract\OptionRepositoryInterface; use Visiosoft\LocationModule\City\CityRepository; use Visiosoft\ProfileModule\Adress\Contract\AdressRepositoryInterface; use function PMA\Util\get; @@ -69,6 +70,8 @@ class AdvsController extends PublicController private $settings_repository; private $event; + private $optionRepository; + public function __construct( UserRepositoryInterface $userRepository, @@ -89,6 +92,8 @@ class AdvsController extends PublicController CategoryModel $categoryModel, CategoryRepositoryInterface $category_repository, + OptionRepositoryInterface $optionRepository, + SettingRepositoryInterface $settings_repository, Dispatcher $events, @@ -122,6 +127,7 @@ class AdvsController extends PublicController $this->requestHttp = $request; parent::__construct(); + $this->optionRepository = $optionRepository; } @@ -384,6 +390,8 @@ class AdvsController extends PublicController } } + $options = $this->optionRepository->findAllBy('adv_id', $id); + if ($isCommentActive) { $CommentModel = new CommentModel(); $comments = $CommentModel->getComments($adv->id)->get(); @@ -405,7 +413,8 @@ class AdvsController extends PublicController $this->template->set('meta_image', $coverPhoto); if ($adv->created_by_id == isset(auth()->user()->id) OR $adv->status == "approved") { - return $this->view->make('visiosoft.module.advs::ad-detail/detail', compact('adv', 'complaints', 'recommended_advs', 'categories', 'features', 'comments', 'qrSRC')); + return $this->view->make('visiosoft.module.advs::ad-detail/detail', compact('adv', 'complaints', + 'recommended_advs', 'categories', 'features', 'comments', 'qrSRC', 'options')); } else { return back(); } @@ -434,6 +443,8 @@ class AdvsController extends PublicController } } + $options = $this->optionRepository->findAllBy('adv_id', $id); + if ($this->adv_model->is_enabled('customfields')) { $features = app('Visiosoft\CustomfieldsModule\Http\Controller\cfController')->view($adv); } @@ -441,7 +452,7 @@ class AdvsController extends PublicController $isActiveDopings = $this->adv_model->is_enabled('dopings'); return $this->view->make('visiosoft.module.advs::new-ad/preview/preview', - compact('adv', 'categories', 'features', 'isActiveDopings')); + compact('adv', 'categories', 'features', 'isActiveDopings', 'options')); } public function getLocations() @@ -563,6 +574,27 @@ class AdvsController extends PublicController } } + // Create options + $optionsIds = array(); + foreach ($request->options as $optionValue) { + $option = $this->optionRepository->newQuery() + ->where('name', $optionValue) + ->where('adv_id', $request->update_id) + ->first(); + if (!$option) { + $option = $this->optionRepository->create([ + 'name' => $optionValue, + 'adv_id' => $request->update_id, + ]); + } + $optionsIds[] = $option->id; + } + $this->optionRepository->newQuery() + ->whereNotIn('id', $optionsIds) + ->where('adv_id', $request->update_id) + ->delete(); + + $adv->is_get_adv = $request->is_get_adv; $adv->save(); @@ -685,6 +717,8 @@ class AdvsController extends PublicController } } + $options = $this->optionRepository->findAllBy('adv_id', $id); + //Cloudinary Module $isActiveCloudinary = new AdvModel(); $isActiveCloudinary = $isActiveCloudinary->is_enabled('cloudinary'); @@ -705,7 +739,8 @@ class AdvsController extends PublicController $custom_fields = app('Visiosoft\CustomfieldsModule\Http\Controller\cfController')->edit($adv, $categories, $cats); } - return $this->view->make('visiosoft.module.advs::new-ad/new-create', compact('id', 'cats_d', 'request', 'Cloudinary', 'cities', 'adv', 'custom_fields')); + return $this->view->make('visiosoft.module.advs::new-ad/new-create', compact('id', 'cats_d', + 'request', 'Cloudinary', 'cities', 'adv', 'custom_fields', 'options')); } public function statusAds($id, $type, SettingRepositoryInterface $settings, Dispatcher $events) @@ -963,11 +998,12 @@ class AdvsController extends PublicController { $id = $request->id; $quantity = $request->quantity; + $name = $request->name; $thisModel = new AdvModel(); $adv = $thisModel->isAdv($id); $response = array(); if ($adv) { - $cart = $thisModel->addCart($adv, $quantity); + $cart = $thisModel->addCart($adv, $quantity, $name); $response['status'] = "success"; } else { $response['status'] = "error"; From 6ed3456d7a219c6db5fd389c724b4a8098ab355b Mon Sep 17 00:00:00 2001 From: "vedat@vebze.com" Date: Mon, 8 Jun 2020 14:46:40 +0300 Subject: [PATCH 3/7] #1643 --- .../src/Http/Controller/Admin/CategoryController.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 b8f501a3c..b6731aefe 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 @@ -154,7 +154,7 @@ class CategoryController extends AdminController } - return $this->view->make('visiosoft.module.cats::cats/admin-cat', compact('formBuilder')); + return $this->view->make('visiosoft.module.cats::cats/admin-cat'); } public function endsWith($string, $test) { From ad9dff89ee917249ed3533dbecec4645ff67b83e Mon Sep 17 00:00:00 2001 From: fatihalp Date: Mon, 8 Jun 2020 16:56:57 +0300 Subject: [PATCH 4/7] Buy package link added --- addons/default/visiosoft/emlak24-theme | 1 + 1 file changed, 1 insertion(+) create mode 160000 addons/default/visiosoft/emlak24-theme diff --git a/addons/default/visiosoft/emlak24-theme b/addons/default/visiosoft/emlak24-theme new file mode 160000 index 000000000..7862cfb4e --- /dev/null +++ b/addons/default/visiosoft/emlak24-theme @@ -0,0 +1 @@ +Subproject commit 7862cfb4ea557132726da6fdae175147b8d6658b From 6df9b45921ba24f1412f9a0219277f5fff5d88e7 Mon Sep 17 00:00:00 2001 From: "vedat@vebze.com" Date: Tue, 9 Jun 2020 10:48:16 +0300 Subject: [PATCH 5/7] #1566 change currency symbol & fix trans --- .../default/visiosoft/advs-module/resources/lang/sq/field.php | 2 +- resources/streams/config/currencies.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/addons/default/visiosoft/advs-module/resources/lang/sq/field.php b/addons/default/visiosoft/advs-module/resources/lang/sq/field.php index fd7d6ff0b..86da72d9b 100644 --- a/addons/default/visiosoft/advs-module/resources/lang/sq/field.php +++ b/addons/default/visiosoft/advs-module/resources/lang/sq/field.php @@ -127,7 +127,7 @@ return [ 'sort' => 'Tipi', 'sort_by' => 'Rendit Sipas', 'pick_option' => 'Zgjidh një mundësi', - 'pick_ordering' => 'Merr Porosin', + 'pick_ordering' => 'Renditje', 'price_high' => 'Cmimi i larte deri tek i uleti', 'price_low' => 'Cmimi i ulet deri tek i larte', 'newest' => 'Më të Rejat', diff --git a/resources/streams/config/currencies.php b/resources/streams/config/currencies.php index 905163534..5f7d2d29e 100644 --- a/resources/streams/config/currencies.php +++ b/resources/streams/config/currencies.php @@ -77,7 +77,7 @@ return [ 'separator' => ',', 'point' => '.', 'decimals' => 2, - 'symbol' => 'L', + 'symbol' => 'Leke', ], 'AMD' => [ 'name' => 'Armenian Dram', From 05a44d52d168bf1e8a4514d6db262ba4c03efe24 Mon Sep 17 00:00:00 2001 From: Diatrex Date: Tue, 9 Jun 2020 12:07:35 +0300 Subject: [PATCH 6/7] #1631 [emlak24-theme] [singlefile-field_type] [store-module] view file error #586 --- .../advs-module/resources/js/new-create.js | 36 ++++++++++++++++++- .../resources/views/new-ad/new-create.twig | 2 +- .../src/Http/Controller/advsController.php | 27 +++++++------- 3 files changed, 49 insertions(+), 16 deletions(-) diff --git a/addons/default/visiosoft/advs-module/resources/js/new-create.js b/addons/default/visiosoft/advs-module/resources/js/new-create.js index 4464b2885..d19fcca5a 100644 --- a/addons/default/visiosoft/advs-module/resources/js/new-create.js +++ b/addons/default/visiosoft/advs-module/resources/js/new-create.js @@ -219,6 +219,40 @@ $(document).ready(function () { // Add dynamic option creation $(".options-tags").select2({ - tags: true + tags: true, + tokenSeparators: [','] }); + + let deletedOptions = []; + $('#selectOptions').on('select2:unselect', function (e) { + if (e.params.data.element.id) { + const id = e.params.data.element.id.substr(9); + deletedOptions.push(id); + } else { + let index = newOptions.indexOf(e.params.data.text); + if (index > -1) { + newOptions.splice(index, 1); + } + } + }); + + let newOptions = []; + $('#selectOptions').on('select2:select', function (e) { + if (e.params.data.element) { + let index = deletedOptions.indexOf(e.params.data.element.id.substr(9)); + if (index > -1) { + deletedOptions.splice(index, 1); + } + } else { + newOptions.push(e.params.data.text) + } + }); + + $('#createEditAdvForm').submit(function () { + $(this).append(``); + + $(this).append(``); + + return true; + }) }); diff --git a/addons/default/visiosoft/advs-module/resources/views/new-ad/new-create.twig b/addons/default/visiosoft/advs-module/resources/views/new-ad/new-create.twig index e509c566d..5f36bdd84 100644 --- a/addons/default/visiosoft/advs-module/resources/views/new-ad/new-create.twig +++ b/addons/default/visiosoft/advs-module/resources/views/new-ad/new-create.twig @@ -104,7 +104,7 @@ name="options[]"> {% if count(options) %} {% for option in options %} - + {% endfor %} {% endif %} 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 949d147e6..dc63876d2 100644 --- a/addons/default/visiosoft/advs-module/src/Http/Controller/advsController.php +++ b/addons/default/visiosoft/advs-module/src/Http/Controller/advsController.php @@ -575,25 +575,24 @@ class AdvsController extends PublicController } // Create options - $optionsIds = array(); - foreach ($request->options as $optionValue) { - $option = $this->optionRepository->newQuery() - ->where('name', $optionValue) + $deletedOptions = $request->deleted_options; + $newOptions = $request->new_options; + if (!empty($deletedOptions)) { + $deletedOptions = explode(',', $request->deleted_options); + $this->optionRepository->newQuery() + ->whereIn('id', $deletedOptions) ->where('adv_id', $request->update_id) - ->first(); - if (!$option) { - $option = $this->optionRepository->create([ - 'name' => $optionValue, + ->delete(); + } + if (!empty($newOptions)) { + $newOptions = explode(',', $request->new_options); + foreach ($newOptions as $option) { + $this->optionRepository->create([ + 'name' => $option, 'adv_id' => $request->update_id, ]); } - $optionsIds[] = $option->id; } - $this->optionRepository->newQuery() - ->whereNotIn('id', $optionsIds) - ->where('adv_id', $request->update_id) - ->delete(); - $adv->is_get_adv = $request->is_get_adv; $adv->save(); From 97058553e42dc06af8100da0b90949853a3b8fb3 Mon Sep 17 00:00:00 2001 From: "vedat@vebze.com" Date: Tue, 9 Jun 2020 13:12:55 +0300 Subject: [PATCH 7/7] remove directory --- addons/default/visiosoft/emlak24-theme | 1 - 1 file changed, 1 deletion(-) delete mode 160000 addons/default/visiosoft/emlak24-theme diff --git a/addons/default/visiosoft/emlak24-theme b/addons/default/visiosoft/emlak24-theme deleted file mode 160000 index 7862cfb4e..000000000 --- a/addons/default/visiosoft/emlak24-theme +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 7862cfb4ea557132726da6fdae175147b8d6658b