diff --git a/addons/default/visiosoft/advs-module/resources/css/preview.css b/addons/default/visiosoft/advs-module/resources/css/preview.css new file mode 100644 index 000000000..b9099b3b9 --- /dev/null +++ b/addons/default/visiosoft/advs-module/resources/css/preview.css @@ -0,0 +1,63 @@ +.preview-wrapper { + border: 4px solid #999; +} +.preview-wrapper:before, .preview-wrapper:after { + content: ''; + position: absolute; + left: 50%; + top: -30px; + width: 0; + height: 0; + border-style: solid; + border-width: 0 39px 30px 39px; + border-color: transparent transparent #999 transparent; + margin-left: -39px; +} +.preview-wrapper:after { + top: inherit; + bottom: -30px; + border-width: 30px 39px 0 39px; + border-color: #999 transparent transparent transparent; +} +.preview-overlay { + position: absolute; + top: 0; + bottom: 0; + left: 0; + right: 0; + opacity: .07; + background-color: #000; + z-index: 400; +} +.preview-paragraph { + font-size: 15px; + font-weight: bold; + text-align: center; +} +.preview-actions { + margin-top: 3em; + margin-bottom: 4em; +} +.preview-edit { + color: #438ed8; + background: #f7f7f7; + border: 1px solid #f7f7f7; +} +.preview-edit:hover { + background: #eaeaea; + border-color: #eaeaea; + color: #438ed8; +} +.preview-continue { + border-radius: 2px; + color: #fff; + background: #438ed8; +} +.preview-continue:hover { + background: #3c7fc1; + border-color: #3c7fc1; + color: #fff; +} +#compare-sidebar, .dropleft-edit { + display: none; +} \ No newline at end of file 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 4779817a1..a398fa976 100644 --- a/addons/default/visiosoft/advs-module/resources/lang/en/button.php +++ b/addons/default/visiosoft/advs-module/resources/lang/en/button.php @@ -13,6 +13,7 @@ return [ 'decline' => 'Decline', 'extend' => 'Extend', 'extend_all' => 'Extend All', + 'convert_currency' => 'Convert Currency', 'categories' => 'Categories', 'sub_category' => 'Sub Categories', 'add_sub_category' => 'Add Sub Category', diff --git a/addons/default/visiosoft/advs-module/resources/lang/en/field.php b/addons/default/visiosoft/advs-module/resources/lang/en/field.php index 771236d5a..28f352576 100644 --- a/addons/default/visiosoft/advs-module/resources/lang/en/field.php +++ b/addons/default/visiosoft/advs-module/resources/lang/en/field.php @@ -270,5 +270,11 @@ return [ 'pending_message_3' => 'Estimated Waiting Time', 'pending_message_4' => 'The time spent in the approval process will be added to the doping time.', 'pending_message_5' => 'No transactions can be made from the call center regarding the ad in the approval process.', - 'hours' => 'hours' + 'hours' => 'hours', + + // Preview page + 'preview_text' => [ + 'part_1' => 'If the following information about your ad is correct, click the "Continue" button and go to the next step.', + 'part_2' => 'If not, click the "Edit" button.', + ] ]; 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 d3a67fb0a..3059a052d 100644 --- a/addons/default/visiosoft/advs-module/resources/lang/en/message.php +++ b/addons/default/visiosoft/advs-module/resources/lang/en/message.php @@ -28,4 +28,5 @@ return [ 'pending_ad_status' => 'Your ad is pending approval by the Editor.', 'extended' => ':number ad(s) has been extended successfully.', 'category_not_exist' => 'This category does not exist anymore!', + 'currency_converted' => 'Currency Converted Successfully.', ]; diff --git a/addons/default/visiosoft/advs-module/resources/views/list/partials/breadcrumb.twig b/addons/default/visiosoft/advs-module/resources/views/list/partials/breadcrumb.twig index aff044bb2..abc2f4382 100644 --- a/addons/default/visiosoft/advs-module/resources/views/list/partials/breadcrumb.twig +++ b/addons/default/visiosoft/advs-module/resources/views/list/partials/breadcrumb.twig @@ -12,7 +12,7 @@ - {{ addBlock('ads-list/partials/breadcrumb',{'mainCats':mainCats})|raw }} + {{ addBlock('ads-list/partials/breadcrumb',{'mainCats': mainCats, 'category': categoryId})|raw }} \ No newline at end of file diff --git a/addons/default/visiosoft/advs-module/resources/views/new-ad/preview/partials/preview-window.twig b/addons/default/visiosoft/advs-module/resources/views/new-ad/preview/partials/preview-window.twig new file mode 100644 index 000000000..70ca67e5d --- /dev/null +++ b/addons/default/visiosoft/advs-module/resources/views/new-ad/preview/partials/preview-window.twig @@ -0,0 +1,33 @@ +{% if setting_value('visiosoft.theme.base::breadcrumbs') %} + + {% include "visiosoft.module.advs::ad-detail/partials/breadcrumb" %} + +{% endif %} +

+ {{ adv.title }} + {{ addBlock('ad-detail/title/action',{'adv_id':adv.id})|raw }} +

+ + +
+
+ {% include "visiosoft.module.advs::ad-detail/partials/slider" %} +
+ {% if setting_value('visiosoft.theme.base::ad_details') %} + {% include "visiosoft.module.advs::ad-detail/partials/detail" %} + {% endif %} +
+
+
+ + +{% if setting_value('visiosoft.theme.base::ad_details_tab') %} + + {% if blocks('ad-item-content-block-area') is null %} + {% include "visiosoft.module.advs::ad-detail/partials/content" %} + {% else %} + {{ blocks('ad-item-content-block-area') }} + {% endif %} + + {{ addBlock('ad-detail/widget', {'price': adv.price, 'id': adv.id})|raw }} +{% endif %} \ No newline at end of file diff --git a/addons/default/visiosoft/advs-module/resources/views/new-ad/preview/preview.twig b/addons/default/visiosoft/advs-module/resources/views/new-ad/preview/preview.twig new file mode 100644 index 000000000..5162090ea --- /dev/null +++ b/addons/default/visiosoft/advs-module/resources/views/new-ad/preview/preview.twig @@ -0,0 +1,41 @@ +{% extends "theme::layouts/default" %} + +{% block content %} +
+

+ {{ trans('visiosoft.module.advs::field.preview_text.part_1') }} +
+ {{ trans('visiosoft.module.advs::field.preview_text.part_2') }} +

+
+
+ {% if isActiveDopings %} + {% set continueLink = url_route('add_doping', [adv.id]) %} + {% else %} + {% set continueLink = url_route('visiosoft.module.advs::edit_adv', [adv.id]) %} + {% endif %} + + {{ trans('visiosoft.module.advs::field.edit') }} + + + {{ trans('visiosoft.module.advs::field.continue') }} + +
+
+ {% include "visiosoft.module.advs::new-ad/preview/partials/preview-window" %} +
+
+
+ + {{ trans('visiosoft.module.advs::field.edit') }} + + + {{ trans('visiosoft.module.advs::field.continue') }} + +
+ + {{ asset_add("styles.css", "visiosoft.module.advs::css/detail.css") }} + {{ asset_add("styles.css", "visiosoft.module.advs::css/preview.css") }} + +{% endblock %} \ No newline at end of file diff --git a/addons/default/visiosoft/advs-module/src/Adv/AdvModel.php b/addons/default/visiosoft/advs-module/src/Adv/AdvModel.php index ead31e33d..f8173e67e 100644 --- a/addons/default/visiosoft/advs-module/src/Adv/AdvModel.php +++ b/addons/default/visiosoft/advs-module/src/Adv/AdvModel.php @@ -116,9 +116,9 @@ class AdvModel extends AdvsAdvsEntryModel implements AdvInterface ->where('advs_advs.finish_at', '>', date('Y-m-d H:i:s')); } - public function foreignCurrency($currency, $price, $curencies, $isUpdate, $settings) + public function foreignCurrency($currency, $price, $isUpdate, $settings) { - $currencies = explode(',', $curencies); + $currencies = setting_value('visiosoft.module.advs::enabled_currencies'); $foreign_currency = array(); $client = new Client(); @@ -128,18 +128,19 @@ class AdvModel extends AdvsAdvsEntryModel implements AdvInterface $foreign_currency[$currency] = (int)$price; } else { try { - $url = $currency . "_" . $currencyIn; - $freecurrencykey = $settings->value('visiosoft.module.advs::free_currencyconverterapi_key'); - $response = $client->get('http://free.currencyconverterapi.com/api/v6/convert?q=' . $url . '&compact=y&apiKey=' . $freecurrencykey); - - } catch (RequestException $e) { - - if ($e->getResponse()->getStatusCode() == '200') { - $response = \GuzzleHttp\json_decode($e->getResponse()->getBody()->getContents()); - $rate = $response->$url->val; - $foreign_currency[$currencyIn] = $price * $rate; + $freeCurrencyKey = $settings->value('visiosoft.module.advs::free_currencyconverterapi_key'); + $response = $client->get('http://free.currencyconverterapi.com/api/v6/convert?q=' + . $url . '&compact=y&apiKey=' . $freeCurrencyKey); + if ($response->getStatusCode() == '200') { + $response = (array)\GuzzleHttp\json_decode($response->getBody()->getContents()); + if (!empty($response)) { + $rate = $response[$url]->val; + $foreign_currency[$currencyIn] = $price * $rate; + } } + } catch (RequestException $e) { + $this->messages->error($e->getMessage()); } } } @@ -150,7 +151,6 @@ class AdvModel extends AdvsAdvsEntryModel implements AdvInterface } $adv->foreign_currencies = json_encode($foreign_currency); $adv->save(); - } public function popularAdvs() diff --git a/addons/default/visiosoft/advs-module/src/Adv/Table/AdvTableBuilder.php b/addons/default/visiosoft/advs-module/src/Adv/Table/AdvTableBuilder.php index 3cd74f5a8..d9912e9fd 100644 --- a/addons/default/visiosoft/advs-module/src/Adv/Table/AdvTableBuilder.php +++ b/addons/default/visiosoft/advs-module/src/Adv/Table/AdvTableBuilder.php @@ -77,6 +77,10 @@ class AdvTableBuilder extends TableBuilder 'handler' => \Visiosoft\AdvsModule\Adv\Table\Handler\Extend::class, 'class' => 'btn btn-info' ], + 'convert_currency' => [ + 'handler' => \Visiosoft\AdvsModule\Adv\Table\Handler\ConvertCurrency::class, + 'class' => 'btn btn-warning' + ], ]; /** diff --git a/addons/default/visiosoft/advs-module/src/Adv/Table/Handler/ConvertCurrency.php b/addons/default/visiosoft/advs-module/src/Adv/Table/Handler/ConvertCurrency.php new file mode 100644 index 000000000..6c0e47ff3 --- /dev/null +++ b/addons/default/visiosoft/advs-module/src/Adv/Table/Handler/ConvertCurrency.php @@ -0,0 +1,22 @@ +getTableModel(); + + foreach ($selected as $id) { + $entry = $model->newQuery()->find($id); + $model->foreignCurrency($entry->currency, $entry->price, $id, $settingRepository); + } + if ($selected) { + $this->messages->success(trans('visiosoft.module.advs::message.currency_converted')); + } + } +} \ No newline at end of file diff --git a/addons/default/visiosoft/advs-module/src/AdvsModuleServiceProvider.php b/addons/default/visiosoft/advs-module/src/AdvsModuleServiceProvider.php index 64db3eda7..1e3203257 100644 --- a/addons/default/visiosoft/advs-module/src/AdvsModuleServiceProvider.php +++ b/addons/default/visiosoft/advs-module/src/AdvsModuleServiceProvider.php @@ -125,6 +125,10 @@ class AdvsModuleServiceProvider extends AddonServiceProvider 'as' => 'adv_detail_seo', 'uses' => 'Visiosoft\AdvsModule\Http\Controller\advsController@view' ], + 'advs/preview/{id}' => [ + 'as' => 'advs_preview', + 'uses' => 'Visiosoft\AdvsModule\Http\Controller\advsController@preview' + ], 'advs/map?country={country}&city[]={city}&district={districts}' => [ 'as' => 'visiosoft.module.advs::show_ad_map_location', 'uses' => 'Visiosoft\AdvsModule\Http\Controller\advsController@map' @@ -151,7 +155,10 @@ class AdvsModuleServiceProvider extends AddonServiceProvider ], 'advs/my_advs' => 'Visiosoft\AdvsModule\Http\Controller\advsController@myAdvs', 'advs/my_advs/{params}' => 'Visiosoft\AdvsModule\Http\Controller\advsController@myAdvs', - 'advs/edit_advs/{id}' => 'Visiosoft\AdvsModule\Http\Controller\advsController@edit', + 'advs/edit_advs/{id}' => [ + 'as' => 'visiosoft.module.advs::edit_adv', + 'uses' => 'Visiosoft\AdvsModule\Http\Controller\advsController@edit', + ], 'advs/status/{id},{type}' => [ 'as' => 'visiosoft.module.advs::status', 'uses' => 'Visiosoft\AdvsModule\Http\Controller\advsController@statusAds' 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 5bf9e5a91..cddf7de66 100644 --- a/addons/default/visiosoft/advs-module/src/Http/Controller/advsController.php +++ b/addons/default/visiosoft/advs-module/src/Http/Controller/advsController.php @@ -387,6 +387,38 @@ class AdvsController extends PublicController } + public function preview($id) + { + $categories = array(); + $categories_id = array(); + + $adv = $this->adv_repository->getListItemAdv($id); + + for ($i = 1; $i <= 10; $i++) { + $cat = "cat" . $i; + if ($adv->$cat != null) { + $item = $this->category_repository->getItem($adv->$cat); + if (!is_null($item)) { + $categories['cat' . $i] = [ + 'name' => $item->name, + 'id' => $item->id + ]; + $categories_id[] = $item->id; + } + + } + } + + if ($this->adv_model->is_enabled('customfields')) { + $features = app('Visiosoft\CustomfieldsModule\Http\Controller\cfController')->view($adv); + } + + $isActiveDopings = $this->adv_model->is_enabled('dopings'); + + return $this->view->make('visiosoft.module.advs::new-ad/preview/preview', + compact('adv', 'categories', 'features', 'isActiveDopings')); + } + public function getLocations() { $table = $this->requestHttp->table; @@ -581,20 +613,20 @@ class AdvsController extends PublicController return redirect('/advs/edit_advs/' . $request->update_id)->with('cats_d', $cats_d)->with('request', $request); } - $foreign_currencies = new AdvModel(); - $isUpdate = $request->update_id; - $foreign_currencies->foreignCurrency($request->currency, $request->price, $request->currencies, $isUpdate, $settings); - if ($adv->slug == "") { $events->dispatch(new CreateAd($request->update_id, $settings));//Create Notify } else { $events->dispatch(new EditAd($request->update_id, $settings, $adv));//Update Notify } - if ($isActiveDopings) { - return redirect(route('add_doping', [$request->update_id])); + if ($adv->slug == "") { // Only preview when new + return redirect(route('advs_preview', [$request->update_id])); } else { - return redirect('/advs/adv/' . $request->update_id); + if ($isActiveDopings) { + return redirect(route('add_doping', [$request->update_id])); + } else { + return redirect('/advs/adv/' . $request->update_id); + } } } diff --git a/addons/default/visiosoft/cats-module/resources/views/ads-list/partials/breadcrumb.twig b/addons/default/visiosoft/cats-module/resources/views/ads-list/partials/breadcrumb.twig index 99ade293e..1564e8e56 100644 --- a/addons/default/visiosoft/cats-module/resources/views/ads-list/partials/breadcrumb.twig +++ b/addons/default/visiosoft/cats-module/resources/views/ads-list/partials/breadcrumb.twig @@ -1,9 +1,4 @@ -{% set catSlug = null %} -{% set pathInfo = app.request.pathinfo|split('/') %} -{% if pathInfo[1] == 'c' %} - {% set catSlug = pathInfo[2] %} -{% endif %} -{% if catSlug %} +{% if params.category %} {% for category_breadcrumbs in params.mainCats %}