Merge branch 'master' into muammer

This commit is contained in:
spektra2147 2021-03-04 18:01:07 +03:00 committed by GitHub
commit eeda3c585b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 70 additions and 19 deletions

View File

@ -14,8 +14,9 @@ return [
'google_statistic_code',
'ogImage',
'free_currencyconverterapi_key',
'hide_price_categories',
'tcmb_exchange_url',
'enabled_currencies',
'tcmb_exchange_url'
],
],
'ads' => [

View File

@ -94,6 +94,14 @@ return [
"default_value" => "1eea72940f3868c77420"
]
],
'hide_price_categories' => [
'type' => 'anomaly.field_type.checkboxes',
'config' => [
'options' => function (\Visiosoft\CatsModule\Category\Contract\CategoryRepositoryInterface $categoryRepository) {
return $categoryRepository->mainCats()->pluck('name', 'id')->all();
},
],
],
'default_GET' => [
'type' => 'anomaly.field_type.boolean',
'bind' => 'adv.default_GET',

View File

@ -61,6 +61,10 @@ return [
'default_country' => [
'name' => 'Default Ad Country',
],
'hide_price_categories' => [
'name' => 'Hide Price On Categories',
'instructions' => 'The price will be hidden when you create an ad or view an ad under these categories.'
],
'free_currencyconverterapi_key' => [
'name' => 'Currency Converter API Key'
],

View File

@ -90,8 +90,7 @@
</div>
</div>
<div class="row form-group select-price
{{ setting_value('visiosoft.module.advs::price_area_hidden') ? 'hidden' }}">
<div class="row form-group select-price{{ hidePrice ? ' hidden' }}">
<label class="col-sm-2 col-xs-12">
{{ form.fields.price.label|raw }}

View File

@ -590,8 +590,6 @@ class AdvsController extends PublicController
$configurations = $this->optionConfigurationRepository->getConf($adv->id);
$foreign_currencies = json_decode($adv->foreign_currencies, true);
if (isset($_COOKIE['currency']) && $adv->foreign_currencies && array_key_exists($_COOKIE['currency'], $foreign_currencies)) {
@ -599,9 +597,15 @@ class AdvsController extends PublicController
$adv->price = $foreign_currencies[$_COOKIE['currency']];
}
// Check if hide price
$hidePrice = false;
if ($hidePriceCats = setting_value('visiosoft.module.advs::hide_price_categories')) {
$hidePrice = in_array($adv['cat1'], $hidePriceCats);
}
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', 'options', 'configurations'));
'recommended_advs', 'categories', 'features', 'options', 'configurations', 'hidePrice'));
} else {
return back();
}
@ -958,9 +962,17 @@ class AdvsController extends PublicController
->edit($adv, $categories, $cats);
}
// Check if hide price
$hidePrice = false;
if (setting_value('visiosoft.module.advs::price_area_hidden')) {
$hidePrice = true;
} elseif ($hidePriceCats = setting_value('visiosoft.module.advs::hide_price_categories')) {
$hidePrice = in_array($adv['cat1'], $hidePriceCats);
}
return $this->view->make(
'visiosoft.module.advs::new-ad/new-create',
compact('id', 'cats_d', 'cats', 'Cloudinary', 'adv', 'custom_fields', 'options')
compact('id', 'cats_d', 'cats', 'Cloudinary', 'adv', 'custom_fields', 'options', 'hidePrice')
);
}

View File

@ -916,7 +916,7 @@
.iti__flag {
height: 15px;
box-shadow: 0px 0px 1px 0px #888;
background-image: url('{{ img("visiosoft.theme.base::images/flags.png").url }}');
background-image: url('{{ img("visiosoft.theme.base::images/flags.png").path }}');
background-repeat: no-repeat;
background-color: #DBDBDB;
background-position: 20px 0; }

View File

@ -0,0 +1,31 @@
<?php namespace Visiosoft\ProfileModule\Http\Middleware;
use Anomaly\FilesModule\File\Command\GetFile;
use Anomaly\Streams\Platform\View\ViewTemplate;
use Closure;
use Illuminate\Foundation\Bus\DispatchesJobs;
use Illuminate\Http\Request;
class OGImage
{
use DispatchesJobs;
private $template;
public function __construct(ViewTemplate $template)
{
$this->template = $template;
}
public function handle(Request $request, Closure $next)
{
if (($ogImage = session()->get('ogImage')) && ($file = $this->dispatch(new GetFile($ogImage)))) {
$this->template->set(
'og_image',
$file->make()->url()
);
}
return $next($request);
}
}

View File

@ -1,6 +1,4 @@
<?php
namespace Visiosoft\ProfileModule\Http\Middleware;
<?php namespace Visiosoft\ProfileModule\Http\Middleware;
use Closure;
use Illuminate\Contracts\Auth\Guard;
@ -8,7 +6,6 @@ use Illuminate\Http\Request;
class authCheck
{
private $auth;
private $request;
@ -18,15 +15,12 @@ class authCheck
$this->request = $request;
}
/**
* @param Guard $auth
* @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector
*/
public function handle(Request $request, Closure $next)
{
if ($this->auth->check()) {
return redirect($this->request->get('redirect', '/'));
}
return $next($request);
}
}
}
}

View File

@ -15,6 +15,7 @@ use Visiosoft\ProfileModule\Education\Contract\EducationRepositoryInterface;
use Visiosoft\ProfileModule\Education\EducationModel;
use Visiosoft\ProfileModule\Education\EducationRepository;
use Visiosoft\ProfileModule\Http\Middleware\authCheck;
use Visiosoft\ProfileModule\Http\Middleware\OGImage;
use Visiosoft\ProfileModule\Profile\Password\ForgotPassFormBuilder;
use Visiosoft\ProfileModule\Profile\Password\PasswordFormBuilder;
use Visiosoft\ProfileModule\Profile\Profile\ProfileFormBuilder;
@ -84,7 +85,8 @@ class ProfileModuleServiceProvider extends AddonServiceProvider
// RegisterController
'register' => [
'middleware' => [
authCheck::class
authCheck::class,
OGImage::class
],
'ttl' => 0,
'uses' => 'Anomaly\UsersModule\Http\Controller\RegisterController@register',