added is options

This commit is contained in:
vedatakd 2021-06-01 11:35:20 +03:00
parent 586595e43c
commit 4ede41825b
3 changed files with 47 additions and 10 deletions

View File

@ -126,10 +126,12 @@
<span class="w-100 {{ HideStandardPrice }}">
{% set standardPriceValue = form.fields.standard_price.value|split('.') %}
<input class="mt-3 border-0 text-right standard-price-field whole-price flex-fill w-100"
placeholder="0" value="{{ standardPriceValue|first }}" type="text">
placeholder="0" value="{{ standardPriceValue|first }}"
type="text">
{% if setting_value('visiosoft.field_type.decimal::showDecimal') %}
<input class="mt-3 border-0 ml-2 text-center standard-price-decimal decimal-price"
placeholder="00" type="text" value="{{ standardPriceValue[1] }}"
placeholder="00" type="text"
value="{{ standardPriceValue[1] }}"
maxlength="2">
{% endif %}
</span>
@ -194,14 +196,16 @@
</div>
{% endif %}
{% else %}
<div class="product-options">
<label for="productOptions">
{{ trans('visiosoft.module.advs::field.product_option.name') }}
</label>
<div class="mt-3 form-group mb-0">
{{ form.fields.product_options_value.configSet('cat1', adv.cat1).input|raw }}
{% if is_options %}
<div class="product-options">
<label for="productOptions">
{{ trans('visiosoft.module.advs::field.product_option.name') }}
</label>
<div class="mt-3 form-group mb-0">
{{ form.fields.product_options_value.configSet('cat1', adv.cat1).input|raw }}
</div>
</div>
</div>
{% endif %}
{% endif %}
{% endif %}
</div>

View File

@ -0,0 +1,25 @@
<?php namespace Visiosoft\AdvsModule\Adv\Command;
use Visiosoft\AdvsModule\Productoption\Contract\ProductoptionRepositoryInterface;
use Visiosoft\AdvsModule\ProductoptionsValue\Contract\ProductoptionsValueRepositoryInterface;
class IsOptionsByCategory
{
protected $cat_id;
public function __construct($cat_id)
{
$this->cat_id = $cat_id;
}
public function handle()
{
$option_repository = app(ProductoptionRepositoryInterface::class);
$value_repository = app(ProductoptionsValueRepositoryInterface::class);
$options_id = $option_repository->getWithCategoryId($this->cat_id)->pluck('id')->all();
return count($value_repository->getWithOptionsId($options_id));
}
}

View File

@ -10,6 +10,7 @@ use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\Cookie;
use Visiosoft\AdvsModule\Adv\AdvModel;
use Visiosoft\AdvsModule\Adv\Command\IsOptionsByCategory;
use Visiosoft\AdvsModule\Adv\Contract\AdvRepositoryInterface;
use Visiosoft\AdvsModule\Adv\Event\ChangedStatusAd;
use Visiosoft\AdvsModule\Adv\Event\CreatedAd;
@ -21,6 +22,8 @@ use Visiosoft\AdvsModule\Adv\Form\AdvFormBuilder;
use Visiosoft\AdvsModule\Option\Contract\OptionRepositoryInterface;
use Visiosoft\AdvsModule\OptionConfiguration\Contract\OptionConfigurationRepositoryInterface;
use Visiosoft\AdvsModule\OptionConfiguration\OptionConfigurationModel;
use Visiosoft\AdvsModule\Productoption\Contract\ProductoptionRepositoryInterface;
use Visiosoft\AdvsModule\ProductoptionsValue\Contract\ProductoptionsValueRepositoryInterface;
use Visiosoft\CatsModule\Category\Contract\CategoryRepositoryInterface;
use Visiosoft\LocationModule\City\CityModel;
use Visiosoft\LocationModule\City\CityRepository;
@ -992,9 +995,14 @@ class AdvsController extends PublicController
$hidePrice = in_array($adv['cat1'], $hidePriceCats);
}
/* Check Options
* Added to query if there are product options.
*/
$is_options = dispatch_now(new IsOptionsByCategory($adv['cat1']));
return $this->view->make(
'visiosoft.module.advs::new-ad/new-create',
compact('id', 'cats_d', 'cats', 'adv', 'custom_fields', 'options', 'hidePrice')
compact('id', 'cats_d', 'cats', 'adv', 'custom_fields', 'options', 'hidePrice','is_options')
);
}