mirror of
https://github.com/openclassify/openclassify.git
synced 2026-01-24 22:11:01 -06:00
Merge branch 'master' of https://github.com/openclassify/openclassify
This commit is contained in:
commit
4ab6ac1ca6
@ -0,0 +1,52 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use Anomaly\Streams\Platform\Database\Migration\Migration;
|
||||||
|
use Visiosoft\AdvsModule\Adv\AdvModel;
|
||||||
|
|
||||||
|
class VisiosoftModuleAdvsCreateProductoptionsStream extends Migration
|
||||||
|
{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This migration creates the stream.
|
||||||
|
* It should be deleted on rollback.
|
||||||
|
*
|
||||||
|
* @var bool
|
||||||
|
*/
|
||||||
|
protected $delete = true;
|
||||||
|
|
||||||
|
protected $fields = [
|
||||||
|
'category' => [
|
||||||
|
'type' => 'anomaly.field_type.select',
|
||||||
|
'config' => [
|
||||||
|
'handler' => 'Visiosoft\AdvsModule\OptionHandler\CategoriesOptions@handle'
|
||||||
|
]
|
||||||
|
],
|
||||||
|
];
|
||||||
|
/**
|
||||||
|
* The stream definition.
|
||||||
|
*
|
||||||
|
* @var array
|
||||||
|
*/
|
||||||
|
protected $stream = [
|
||||||
|
'slug' => 'productoptions',
|
||||||
|
'title_column' => 'name',
|
||||||
|
'translatable' => true,
|
||||||
|
'versionable' => false,
|
||||||
|
'trashable' => true,
|
||||||
|
'searchable' => false,
|
||||||
|
'sortable' => false,
|
||||||
|
];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The stream assignments.
|
||||||
|
*
|
||||||
|
* @var array
|
||||||
|
*/
|
||||||
|
protected $assignments = [
|
||||||
|
'category',
|
||||||
|
'name' => [
|
||||||
|
'translatable' => true,
|
||||||
|
'required' => true,
|
||||||
|
],
|
||||||
|
];
|
||||||
|
}
|
||||||
@ -0,0 +1,56 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use Anomaly\Streams\Platform\Database\Migration\Migration;
|
||||||
|
use \Visiosoft\AdvsModule\Productoption\ProductoptionModel;
|
||||||
|
|
||||||
|
class VisiosoftModuleAdvsCreateProductoptionsValueStream extends Migration
|
||||||
|
{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This migration creates the stream.
|
||||||
|
* It should be deleted on rollback.
|
||||||
|
*
|
||||||
|
* @var bool
|
||||||
|
*/
|
||||||
|
protected $delete = true;
|
||||||
|
|
||||||
|
|
||||||
|
protected $fields = [
|
||||||
|
'product_option' => [
|
||||||
|
'type' => 'anomaly.field_type.relationship',
|
||||||
|
'config' => [
|
||||||
|
'related' => ProductoptionModel::class,
|
||||||
|
],
|
||||||
|
]
|
||||||
|
];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The stream definition.
|
||||||
|
*
|
||||||
|
* @var array
|
||||||
|
*/
|
||||||
|
protected $stream = [
|
||||||
|
'slug' => 'productoptions_value',
|
||||||
|
'title_column' => 'name',
|
||||||
|
'translatable' => true,
|
||||||
|
'versionable' => false,
|
||||||
|
'trashable' => true,
|
||||||
|
'searchable' => false,
|
||||||
|
'sortable' => false,
|
||||||
|
];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The stream assignments.
|
||||||
|
*
|
||||||
|
* @var array
|
||||||
|
*/
|
||||||
|
protected $assignments = [
|
||||||
|
'name' => [
|
||||||
|
'translatable' => true,
|
||||||
|
'required' => true,
|
||||||
|
],
|
||||||
|
'product_option' => [
|
||||||
|
'required' => true,
|
||||||
|
],
|
||||||
|
];
|
||||||
|
}
|
||||||
@ -0,0 +1,48 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use Anomaly\Streams\Platform\Database\Migration\Migration;
|
||||||
|
|
||||||
|
class VisiosoftModuleAdvsAddedOptionsField extends Migration
|
||||||
|
{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Don't delete stream on rollback
|
||||||
|
* because this isn't creating the
|
||||||
|
* stream only referencing it.
|
||||||
|
*/
|
||||||
|
protected $delete = false;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Any additional information will
|
||||||
|
* be updated. Slug helps find
|
||||||
|
* the stream to work with for
|
||||||
|
* assignments that follow.
|
||||||
|
*/
|
||||||
|
protected $stream = [
|
||||||
|
'slug' => 'advs',
|
||||||
|
];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The addon fields.
|
||||||
|
*
|
||||||
|
* @var array
|
||||||
|
*/
|
||||||
|
protected $fields = [
|
||||||
|
'product_options_value' => [
|
||||||
|
'type' => 'anomaly.field_type.multiple',
|
||||||
|
'config' => [
|
||||||
|
'mode' => 'lookup',
|
||||||
|
'related' => \Visiosoft\AdvsModule\ProductoptionsValue\ProductoptionsValueModel::class,
|
||||||
|
],
|
||||||
|
]
|
||||||
|
];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The field's assignment.
|
||||||
|
*
|
||||||
|
* @var array
|
||||||
|
*/
|
||||||
|
protected $assignments = [
|
||||||
|
'product_options_value',
|
||||||
|
];
|
||||||
|
}
|
||||||
@ -0,0 +1,58 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use Anomaly\Streams\Platform\Database\Migration\Migration;
|
||||||
|
|
||||||
|
class VisiosoftModuleAdvsCreateOptionConfigurationStream extends Migration
|
||||||
|
{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This migration creates the stream.
|
||||||
|
* It should be deleted on rollback.
|
||||||
|
*
|
||||||
|
* @var bool
|
||||||
|
*/
|
||||||
|
protected $delete = true;
|
||||||
|
|
||||||
|
protected $fields = [
|
||||||
|
'option_json' => 'visiosoft.field_type.json',
|
||||||
|
];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The stream definition.
|
||||||
|
*
|
||||||
|
* @var array
|
||||||
|
*/
|
||||||
|
protected $stream = [
|
||||||
|
'slug' => 'option_configuration',
|
||||||
|
'title_column' => 'option_json',
|
||||||
|
'translatable' => false,
|
||||||
|
'versionable' => false,
|
||||||
|
'trashable' => false,
|
||||||
|
'searchable' => false,
|
||||||
|
'sortable' => false,
|
||||||
|
];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The stream assignments.
|
||||||
|
*
|
||||||
|
* @var array
|
||||||
|
*/
|
||||||
|
protected $assignments = [
|
||||||
|
'parent_adv' => [
|
||||||
|
'required' => true,
|
||||||
|
],
|
||||||
|
'price' => [
|
||||||
|
'required' => true,
|
||||||
|
],
|
||||||
|
'currency' => [
|
||||||
|
'required' => true,
|
||||||
|
],
|
||||||
|
'stock' => [
|
||||||
|
'required' => true,
|
||||||
|
],
|
||||||
|
'option_json' => [
|
||||||
|
'required' => true,
|
||||||
|
],
|
||||||
|
];
|
||||||
|
|
||||||
|
}
|
||||||
@ -21,4 +21,29 @@ return [
|
|||||||
'write',
|
'write',
|
||||||
'delete',
|
'delete',
|
||||||
],
|
],
|
||||||
|
'productoptions' => [
|
||||||
|
'read',
|
||||||
|
'write',
|
||||||
|
'delete',
|
||||||
|
],
|
||||||
|
'productoptions_value' => [
|
||||||
|
'read',
|
||||||
|
'write',
|
||||||
|
'delete',
|
||||||
|
],
|
||||||
|
'options_configuration' => [
|
||||||
|
'read',
|
||||||
|
'write',
|
||||||
|
'delete',
|
||||||
|
],
|
||||||
|
'option_configuration' => [
|
||||||
|
'read',
|
||||||
|
'write',
|
||||||
|
'delete',
|
||||||
|
],
|
||||||
|
'option_configuration' => [
|
||||||
|
'read',
|
||||||
|
'write',
|
||||||
|
'delete',
|
||||||
|
],
|
||||||
];
|
];
|
||||||
|
|||||||
@ -32,5 +32,11 @@ return [
|
|||||||
'name' => 'Update Category'
|
'name' => 'Update Category'
|
||||||
],
|
],
|
||||||
'new_option' => 'New Option',
|
'new_option' => 'New Option',
|
||||||
'export' => 'Export'
|
'export' => 'Export',
|
||||||
|
'new_productoption' => 'New Productoption',
|
||||||
|
'new_productoptions_value' => 'New Productoptions value',
|
||||||
|
'new_options_configuration' => 'New Options configuration',
|
||||||
|
'new_option_configuration' => 'New Option configuration',
|
||||||
|
'new_option_configuration' => 'New Option configuration',
|
||||||
|
'create_configurations' => 'Create Configurations',
|
||||||
];
|
];
|
||||||
|
|||||||
@ -137,7 +137,9 @@ return [
|
|||||||
'oldest' => 'Oldest',
|
'oldest' => 'Oldest',
|
||||||
'address_a_z' => 'Address (A to Z)',
|
'address_a_z' => 'Address (A to Z)',
|
||||||
'address_z_a' => 'Address (Z to A)',
|
'address_z_a' => 'Address (Z to A)',
|
||||||
'categories' => 'Categories',
|
'categories' => [
|
||||||
|
'name' => 'Categories'
|
||||||
|
],
|
||||||
'all_categories' => 'All Categories',
|
'all_categories' => 'All Categories',
|
||||||
'location' => 'Location',
|
'location' => 'Location',
|
||||||
'send_message' => 'Send Message',
|
'send_message' => 'Send Message',
|
||||||
@ -313,6 +315,12 @@ return [
|
|||||||
'site' => 'Site',
|
'site' => 'Site',
|
||||||
'subscription' => 'Subscription',
|
'subscription' => 'Subscription',
|
||||||
'created' => 'Created',
|
'created' => 'Created',
|
||||||
|
'product_option' => [
|
||||||
|
'name' => 'Product Option'
|
||||||
|
],
|
||||||
|
'option_json' => [
|
||||||
|
'name' => 'Option'
|
||||||
|
],
|
||||||
'old_price' => [
|
'old_price' => [
|
||||||
'name' => 'Old Price'
|
'name' => 'Old Price'
|
||||||
],
|
],
|
||||||
|
|||||||
@ -57,4 +57,44 @@ return [
|
|||||||
'delete' => 'Can delete options?',
|
'delete' => 'Can delete options?',
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
|
'productoptions' => [
|
||||||
|
'name' => 'Productoptions',
|
||||||
|
'option' => [
|
||||||
|
'read' => 'Can read productoptions?',
|
||||||
|
'write' => 'Can create/edit productoptions?',
|
||||||
|
'delete' => 'Can delete productoptions?',
|
||||||
|
],
|
||||||
|
],
|
||||||
|
'productoptions_value' => [
|
||||||
|
'name' => 'Productoptions value',
|
||||||
|
'option' => [
|
||||||
|
'read' => 'Can read productoptions value?',
|
||||||
|
'write' => 'Can create/edit productoptions value?',
|
||||||
|
'delete' => 'Can delete productoptions value?',
|
||||||
|
],
|
||||||
|
],
|
||||||
|
'options_configuration' => [
|
||||||
|
'name' => 'Options configuration',
|
||||||
|
'option' => [
|
||||||
|
'read' => 'Can read options configuration?',
|
||||||
|
'write' => 'Can create/edit options configuration?',
|
||||||
|
'delete' => 'Can delete options configuration?',
|
||||||
|
],
|
||||||
|
],
|
||||||
|
'option_configuration' => [
|
||||||
|
'name' => 'Option configuration',
|
||||||
|
'option' => [
|
||||||
|
'read' => 'Can read option configuration?',
|
||||||
|
'write' => 'Can create/edit option configuration?',
|
||||||
|
'delete' => 'Can delete option configuration?',
|
||||||
|
],
|
||||||
|
],
|
||||||
|
'option_configuration' => [
|
||||||
|
'name' => 'Option configuration',
|
||||||
|
'option' => [
|
||||||
|
'read' => 'Can read option configuration?',
|
||||||
|
'write' => 'Can create/edit option configuration?',
|
||||||
|
'delete' => 'Can delete option configuration?',
|
||||||
|
],
|
||||||
|
],
|
||||||
];
|
];
|
||||||
|
|||||||
@ -45,4 +45,13 @@ return [
|
|||||||
'title' => 'Options',
|
'title' => 'Options',
|
||||||
],
|
],
|
||||||
'ads_image' => 'Ads Image',
|
'ads_image' => 'Ads Image',
|
||||||
|
'product_options' => [
|
||||||
|
'title' => 'Options',
|
||||||
|
],
|
||||||
|
'productoptions_value' => [
|
||||||
|
'title' => 'Options Value',
|
||||||
|
],
|
||||||
|
'option_configuration' => [
|
||||||
|
'title' => 'Configuration',
|
||||||
|
],
|
||||||
];
|
];
|
||||||
|
|||||||
@ -22,4 +22,13 @@ return [
|
|||||||
'options' => [
|
'options' => [
|
||||||
'name' => 'Options',
|
'name' => 'Options',
|
||||||
],
|
],
|
||||||
|
'product_options' => [
|
||||||
|
'name' => 'Product Options',
|
||||||
|
],
|
||||||
|
'productoptions_value' => [
|
||||||
|
'name' => 'Options value',
|
||||||
|
],
|
||||||
|
'option_configuration' => [
|
||||||
|
'name' => 'Configuration',
|
||||||
|
],
|
||||||
];
|
];
|
||||||
|
|||||||
@ -45,7 +45,7 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- Detail With Block -->
|
<!-- Detail With Block -->
|
||||||
{{ addBlock('ad-detail/details',{'adv':adv, 'options':options})|raw }}
|
{{ addBlock('ad-detail/details',{'adv':adv, 'options':options, 'configurations':configurations})|raw }}
|
||||||
{{ addBlock('ad-detail/widget-details',{'adv':adv})|raw }}
|
{{ addBlock('ad-detail/widget-details',{'adv':adv})|raw }}
|
||||||
<!-- Detail With Block -->
|
<!-- Detail With Block -->
|
||||||
|
|
||||||
|
|||||||
@ -138,6 +138,15 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="row form-group product-options">
|
||||||
|
<label for="productOptions" class="col-sm-2">
|
||||||
|
{{ trans('visiosoft.module.advs::field.product_option.name') }}
|
||||||
|
</label>
|
||||||
|
<div class="col-sm-10">
|
||||||
|
{{ form.fields.product_options_value.input|raw }}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="row form-group brand-name">
|
<div class="row form-group brand-name">
|
||||||
<div class="col-md-12">
|
<div class="col-md-12">
|
||||||
<div class="field-group advs_desc">
|
<div class="field-group advs_desc">
|
||||||
|
|||||||
@ -14,6 +14,10 @@
|
|||||||
{% else %}
|
{% else %}
|
||||||
{% set continueLink = url_route('adv_detail_seo', [adv.slug, adv.id]) %}
|
{% set continueLink = url_route('adv_detail_seo', [adv.slug, adv.id]) %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
<a href="{{ route('visiosoft.module.advs::user.configrations.create') }}?ad={{ adv.id }}"
|
||||||
|
class="btn btn-warning shadow-sm mr-4 text-white">
|
||||||
|
{{trans('visiosoft.module.advs::button.create_configurations')}}
|
||||||
|
</a>
|
||||||
<a href="{{ url_route('visiosoft.module.advs::edit_adv', [adv.id]) }}"
|
<a href="{{ url_route('visiosoft.module.advs::edit_adv', [adv.id]) }}"
|
||||||
class="btn preview-edit shadow-sm border">
|
class="btn preview-edit shadow-sm border">
|
||||||
{{ trans('visiosoft.module.advs::field.edit') }}
|
{{ trans('visiosoft.module.advs::field.edit') }}
|
||||||
@ -27,6 +31,10 @@
|
|||||||
<div class="preview-overlay position-absolute"></div>
|
<div class="preview-overlay position-absolute"></div>
|
||||||
</div>
|
</div>
|
||||||
<div class="preview-actions text-center">
|
<div class="preview-actions text-center">
|
||||||
|
<a href="{{ route('visiosoft.module.advs::user.configrations.create') }}?ad={{ adv.id }}"
|
||||||
|
class="btn btn-warning shadow-sm mr-4 text-white">
|
||||||
|
{{trans('visiosoft.module.advs::button.create_configurations')}}
|
||||||
|
</a>
|
||||||
<a href="{{ url_route('visiosoft.module.advs::edit_adv', [adv.id]) }}" class="btn preview-edit shadow-sm border">
|
<a href="{{ url_route('visiosoft.module.advs::edit_adv', [adv.id]) }}" class="btn preview-edit shadow-sm border">
|
||||||
{{ trans('visiosoft.module.advs::field.edit') }}
|
{{ trans('visiosoft.module.advs::field.edit') }}
|
||||||
</a>
|
</a>
|
||||||
|
|||||||
@ -385,4 +385,9 @@ class AdvModel extends AdvsAdvsEntryModel implements AdvInterface
|
|||||||
{
|
{
|
||||||
return $this->finish_at ? $this->finish_at < Carbon::now() : true;
|
return $this->finish_at ? $this->finish_at < Carbon::now() : true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getProductOptionsValues()
|
||||||
|
{
|
||||||
|
return $this->product_options_value;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -448,6 +448,10 @@ class AdvRepository extends EntryRepository implements AdvRepositoryInterface
|
|||||||
->paginate(setting_value('visiosoft.module.advs::popular_ads_limit', setting_value('streams::per_page')));
|
->paginate(setting_value('visiosoft.module.advs::popular_ads_limit', setting_value('streams::per_page')));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getName($id){
|
||||||
|
return $this->find($id)->name;
|
||||||
|
}
|
||||||
|
|
||||||
public function approveAds($adsIDs)
|
public function approveAds($adsIDs)
|
||||||
{
|
{
|
||||||
$defaultAdPublishTime = setting_value('visiosoft.module.advs::default_published_time');
|
$defaultAdPublishTime = setting_value('visiosoft.module.advs::default_published_time');
|
||||||
|
|||||||
@ -81,4 +81,6 @@ interface AdvInterface extends EntryInterface
|
|||||||
public function getVillage();
|
public function getVillage();
|
||||||
|
|
||||||
public function expired();
|
public function expired();
|
||||||
|
|
||||||
|
public function getProductOptionsValues();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -45,6 +45,8 @@ interface AdvRepositoryInterface extends EntryRepositoryInterface
|
|||||||
|
|
||||||
public function getPopular();
|
public function getPopular();
|
||||||
|
|
||||||
|
public function getName($id);
|
||||||
|
|
||||||
public function approveAds($adsIDs);
|
public function approveAds($adsIDs);
|
||||||
|
|
||||||
public function getUserAds($userID = null);
|
public function getUserAds($userID = null);
|
||||||
|
|||||||
@ -60,7 +60,8 @@ class AdvFormBuilder extends FormBuilder
|
|||||||
],
|
],
|
||||||
'files',
|
'files',
|
||||||
'popular_adv',
|
'popular_adv',
|
||||||
'adv_day'
|
'adv_day',
|
||||||
|
'product_options_value'
|
||||||
];
|
];
|
||||||
|
|
||||||
protected $category = null;
|
protected $category = null;
|
||||||
|
|||||||
@ -37,9 +37,22 @@ class AdvsModule extends Module
|
|||||||
],
|
],
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
|
'product_options' => [
|
||||||
|
'title' => 'visiosoft.module.advs::section.product_options.title',
|
||||||
|
'buttons' => [
|
||||||
|
'new_productoption',
|
||||||
|
],
|
||||||
|
],
|
||||||
|
'productoptions_value' => [
|
||||||
|
'title' => 'visiosoft.module.advs::section.productoptions_value.title',
|
||||||
|
'buttons' => [
|
||||||
|
'new_productoptions_value',
|
||||||
|
],
|
||||||
|
],
|
||||||
|
'option_configuration',
|
||||||
'assets_clear' => [
|
'assets_clear' => [
|
||||||
'title' => 'visiosoft.module.advs::section.assets_clear.name',
|
'title' => 'visiosoft.module.advs::section.assets_clear.name',
|
||||||
'href' => '/admin/assets/clear',
|
'href' => '/admin/assets/clear',
|
||||||
]
|
]
|
||||||
// 'custom_fields' => [
|
// 'custom_fields' => [
|
||||||
// 'buttons' => [
|
// 'buttons' => [
|
||||||
|
|||||||
@ -15,6 +15,12 @@ use Visiosoft\AdvsModule\Http\Middleware\SetLang;
|
|||||||
use Visiosoft\AdvsModule\Listener\AddAdvsSettingsScript;
|
use Visiosoft\AdvsModule\Listener\AddAdvsSettingsScript;
|
||||||
use Visiosoft\AdvsModule\Option\Contract\OptionRepositoryInterface;
|
use Visiosoft\AdvsModule\Option\Contract\OptionRepositoryInterface;
|
||||||
use Visiosoft\AdvsModule\Option\OptionRepository;
|
use Visiosoft\AdvsModule\Option\OptionRepository;
|
||||||
|
use Visiosoft\AdvsModule\OptionConfiguration\Contract\OptionConfigurationRepositoryInterface;
|
||||||
|
use Visiosoft\AdvsModule\OptionConfiguration\OptionConfigurationRepository;
|
||||||
|
use Visiosoft\AdvsModule\Productoption\Contract\ProductoptionRepositoryInterface;
|
||||||
|
use Visiosoft\AdvsModule\Productoption\ProductoptionRepository;
|
||||||
|
use Visiosoft\AdvsModule\ProductoptionsValue\Contract\ProductoptionsValueRepositoryInterface;
|
||||||
|
use Visiosoft\AdvsModule\ProductoptionsValue\ProductoptionsValueRepository;
|
||||||
use Visiosoft\LocationModule\Village\Contract\VillageRepositoryInterface;
|
use Visiosoft\LocationModule\Village\Contract\VillageRepositoryInterface;
|
||||||
use Visiosoft\LocationModule\Village\VillageRepository;
|
use Visiosoft\LocationModule\Village\VillageRepository;
|
||||||
use Visiosoft\LocationModule\Village\VillageModel;
|
use Visiosoft\LocationModule\Village\VillageModel;
|
||||||
@ -214,6 +220,28 @@ class AdvsModuleServiceProvider extends AddonServiceProvider
|
|||||||
|
|
||||||
// Others
|
// Others
|
||||||
'advs/ttr/{id}' => 'Visiosoft\PackagesModule\Http\Controller\packageFEController@advsStatusbyUser',
|
'advs/ttr/{id}' => 'Visiosoft\PackagesModule\Http\Controller\packageFEController@advsStatusbyUser',
|
||||||
|
|
||||||
|
//Configurations Admin Controller
|
||||||
|
'admin/advs/option_configuration/create' => [
|
||||||
|
'as' => 'visiosoft.module.advs::configrations.create',
|
||||||
|
'uses' => 'Visiosoft\AdvsModule\Http\Controller\Admin\OptionConfigurationController@create',
|
||||||
|
],
|
||||||
|
'admin/advs/option_configuration' => [
|
||||||
|
'as' => 'visiosoft.module.advs::configrations.index',
|
||||||
|
'uses' => 'Visiosoft\AdvsModule\Http\Controller\Admin\OptionConfigurationController@index',
|
||||||
|
],
|
||||||
|
|
||||||
|
//Configuration Controller
|
||||||
|
'advs/option_configuration/create' => [
|
||||||
|
'as' => 'visiosoft.module.advs::user.configrations.create',
|
||||||
|
'uses' => 'Visiosoft\AdvsModule\Http\Controller\OptionConfigurationController@create',
|
||||||
|
],
|
||||||
|
'conf/addCart' => [
|
||||||
|
'as' => 'configuration::add_cart',
|
||||||
|
'uses' => 'Visiosoft\AdvsModule\Http\Controller\OptionConfigurationController@confAddCart',
|
||||||
|
],
|
||||||
|
|
||||||
|
|
||||||
];
|
];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -294,6 +322,9 @@ class AdvsModuleServiceProvider extends AddonServiceProvider
|
|||||||
CategoryRepositoryInterface::class => CategoryRepository::class,
|
CategoryRepositoryInterface::class => CategoryRepository::class,
|
||||||
CountryRepositoryInterface::class => CountryRepository::class,
|
CountryRepositoryInterface::class => CountryRepository::class,
|
||||||
OptionRepositoryInterface::class => OptionRepository::class,
|
OptionRepositoryInterface::class => OptionRepository::class,
|
||||||
|
ProductoptionRepositoryInterface::class => ProductoptionRepository::class,
|
||||||
|
OptionConfigurationRepositoryInterface::class => OptionConfigurationRepository::class,
|
||||||
|
ProductoptionsValueRepositoryInterface::class => ProductoptionsValueRepository::class,
|
||||||
];
|
];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -108,6 +108,10 @@ class AdvsController extends AdminController
|
|||||||
'replicate' => [
|
'replicate' => [
|
||||||
'text' => 'Replicate',
|
'text' => 'Replicate',
|
||||||
],
|
],
|
||||||
|
'create_configration' => [
|
||||||
|
'text' => trans('visiosoft.module.advs::button.create_configurations'),
|
||||||
|
'href' => route('visiosoft.module.advs::configrations.create')."?ad={entry.id}"
|
||||||
|
],
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
]);
|
]);
|
||||||
|
|||||||
@ -0,0 +1,32 @@
|
|||||||
|
<?php namespace Visiosoft\AdvsModule\Http\Controller\Admin;
|
||||||
|
|
||||||
|
use Visiosoft\AdvsModule\OptionConfiguration\Form\OptionConfigurationFormBuilder;
|
||||||
|
use Visiosoft\AdvsModule\OptionConfiguration\Table\OptionConfigurationTableBuilder;
|
||||||
|
use Anomaly\Streams\Platform\Http\Controller\AdminController;
|
||||||
|
|
||||||
|
class OptionConfigurationController extends AdminController
|
||||||
|
{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Display an index of existing entries.
|
||||||
|
*
|
||||||
|
* @param OptionConfigurationTableBuilder $table
|
||||||
|
* @return \Symfony\Component\HttpFoundation\Response
|
||||||
|
*/
|
||||||
|
public function index(OptionConfigurationTableBuilder $table)
|
||||||
|
{
|
||||||
|
return $table->render();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a new entry.
|
||||||
|
*
|
||||||
|
* @param OptionConfigurationFormBuilder $form
|
||||||
|
* @return \Symfony\Component\HttpFoundation\Response
|
||||||
|
*/
|
||||||
|
public function create(OptionConfigurationFormBuilder $form)
|
||||||
|
{
|
||||||
|
$form->setOption('redirect', route('visiosoft.module.advs::configrations.index'));
|
||||||
|
return $form->render();
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,43 @@
|
|||||||
|
<?php namespace Visiosoft\AdvsModule\Http\Controller\Admin;
|
||||||
|
|
||||||
|
use Visiosoft\AdvsModule\Productoption\Form\ProductoptionFormBuilder;
|
||||||
|
use Visiosoft\AdvsModule\Productoption\Table\ProductoptionTableBuilder;
|
||||||
|
use Anomaly\Streams\Platform\Http\Controller\AdminController;
|
||||||
|
|
||||||
|
class ProductoptionsController extends AdminController
|
||||||
|
{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Display an index of existing entries.
|
||||||
|
*
|
||||||
|
* @param ProductoptionTableBuilder $table
|
||||||
|
* @return \Symfony\Component\HttpFoundation\Response
|
||||||
|
*/
|
||||||
|
public function index(ProductoptionTableBuilder $table)
|
||||||
|
{
|
||||||
|
return $table->render();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a new entry.
|
||||||
|
*
|
||||||
|
* @param ProductoptionFormBuilder $form
|
||||||
|
* @return \Symfony\Component\HttpFoundation\Response
|
||||||
|
*/
|
||||||
|
public function create(ProductoptionFormBuilder $form)
|
||||||
|
{
|
||||||
|
return $form->render();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Edit an existing entry.
|
||||||
|
*
|
||||||
|
* @param ProductoptionFormBuilder $form
|
||||||
|
* @param $id
|
||||||
|
* @return \Symfony\Component\HttpFoundation\Response
|
||||||
|
*/
|
||||||
|
public function edit(ProductoptionFormBuilder $form, $id)
|
||||||
|
{
|
||||||
|
return $form->render($id);
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,43 @@
|
|||||||
|
<?php namespace Visiosoft\AdvsModule\Http\Controller\Admin;
|
||||||
|
|
||||||
|
use Visiosoft\AdvsModule\ProductoptionsValue\Form\ProductoptionsValueFormBuilder;
|
||||||
|
use Visiosoft\AdvsModule\ProductoptionsValue\Table\ProductoptionsValueTableBuilder;
|
||||||
|
use Anomaly\Streams\Platform\Http\Controller\AdminController;
|
||||||
|
|
||||||
|
class ProductoptionsValueController extends AdminController
|
||||||
|
{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Display an index of existing entries.
|
||||||
|
*
|
||||||
|
* @param ProductoptionsValueTableBuilder $table
|
||||||
|
* @return \Symfony\Component\HttpFoundation\Response
|
||||||
|
*/
|
||||||
|
public function index(ProductoptionsValueTableBuilder $table)
|
||||||
|
{
|
||||||
|
return $table->render();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a new entry.
|
||||||
|
*
|
||||||
|
* @param ProductoptionsValueFormBuilder $form
|
||||||
|
* @return \Symfony\Component\HttpFoundation\Response
|
||||||
|
*/
|
||||||
|
public function create(ProductoptionsValueFormBuilder $form)
|
||||||
|
{
|
||||||
|
return $form->render();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Edit an existing entry.
|
||||||
|
*
|
||||||
|
* @param ProductoptionsValueFormBuilder $form
|
||||||
|
* @param $id
|
||||||
|
* @return \Symfony\Component\HttpFoundation\Response
|
||||||
|
*/
|
||||||
|
public function edit(ProductoptionsValueFormBuilder $form, $id)
|
||||||
|
{
|
||||||
|
return $form->render($id);
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,61 @@
|
|||||||
|
<?php namespace Visiosoft\AdvsModule\Http\Controller;
|
||||||
|
|
||||||
|
use Anomaly\Streams\Platform\Http\Controller\PublicController;
|
||||||
|
use Anomaly\Streams\Platform\Model\Configuration\ConfigurationConfigurationEntryModel;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
use Illuminate\Support\Facades\Auth;
|
||||||
|
use Visiosoft\AdvsModule\Adv\AdvModel;
|
||||||
|
use Visiosoft\AdvsModule\Adv\Contract\AdvRepositoryInterface;
|
||||||
|
use Visiosoft\AdvsModule\OptionConfiguration\Contract\OptionConfigurationRepositoryInterface;
|
||||||
|
use Visiosoft\AdvsModule\OptionConfiguration\Form\OptionConfigurationFormBuilder;
|
||||||
|
use Visiosoft\AdvsModule\OptionConfiguration\OptionConfigurationModel;
|
||||||
|
use Visiosoft\CartsModule\Cart\CartModel;
|
||||||
|
use Visiosoft\CartsModule\Cart\CartRepository;
|
||||||
|
use Visiosoft\CartsModule\Cart\Command\GetCart;
|
||||||
|
|
||||||
|
class OptionConfigurationController extends PublicController
|
||||||
|
{
|
||||||
|
private $advRepository;
|
||||||
|
private $adv_model;
|
||||||
|
private $optionConfigurationModel;
|
||||||
|
private $optionConfigurationRepository;
|
||||||
|
|
||||||
|
public function __construct(
|
||||||
|
AdvRepositoryInterface $advRepository,
|
||||||
|
AdvModel $advModel,
|
||||||
|
OptionConfigurationModel $optionConfigurationModel,
|
||||||
|
OptionConfigurationRepositoryInterface $optionConfigurationRepository
|
||||||
|
)
|
||||||
|
{
|
||||||
|
$this->advRepository = $advRepository;
|
||||||
|
$this->adv_model = $advModel;
|
||||||
|
$this->optionConfigurationModel = $optionConfigurationModel;
|
||||||
|
$this->optionConfigurationRepository = $optionConfigurationRepository;
|
||||||
|
parent::__construct();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function create(OptionConfigurationFormBuilder $form)
|
||||||
|
{
|
||||||
|
$form->setOption('redirect', route('advs_preview', [request('ad')]));
|
||||||
|
return $form->render();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function confAddCart()
|
||||||
|
{
|
||||||
|
|
||||||
|
if($conf = $this->optionConfigurationRepository->find($this->request->configuration))
|
||||||
|
{
|
||||||
|
$conf->name = $conf->getName();
|
||||||
|
|
||||||
|
$this->adv_model->authControl();
|
||||||
|
|
||||||
|
if ($conf->stock < $this->request->quantity){
|
||||||
|
return redirect()->back()->with('warning', [trans('visiosoft.module.carts::message.error1in2')]);
|
||||||
|
}else{
|
||||||
|
$cart = $this->dispatch(new GetCart());
|
||||||
|
$cart->add($conf, $this->request->quantity);
|
||||||
|
return $this->redirect->to(route('visiosoft.module.carts::cart'));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -19,6 +19,10 @@ use Visiosoft\AdvsModule\Adv\Event\showAdPhone;
|
|||||||
use Visiosoft\AdvsModule\Adv\Event\viewAd;
|
use Visiosoft\AdvsModule\Adv\Event\viewAd;
|
||||||
use Visiosoft\AdvsModule\Adv\Form\AdvFormBuilder;
|
use Visiosoft\AdvsModule\Adv\Form\AdvFormBuilder;
|
||||||
use Visiosoft\AdvsModule\Option\Contract\OptionRepositoryInterface;
|
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\AlgoliaModule\Search\SearchModel;
|
use Visiosoft\AlgoliaModule\Search\SearchModel;
|
||||||
use Visiosoft\CatsModule\Category\CategoryModel;
|
use Visiosoft\CatsModule\Category\CategoryModel;
|
||||||
use Visiosoft\CatsModule\Category\Contract\CategoryRepositoryInterface;
|
use Visiosoft\CatsModule\Category\Contract\CategoryRepositoryInterface;
|
||||||
@ -41,6 +45,10 @@ class AdvsController extends PublicController
|
|||||||
private $adv_model;
|
private $adv_model;
|
||||||
private $adv_repository;
|
private $adv_repository;
|
||||||
|
|
||||||
|
private $optionConfigurationRepository;
|
||||||
|
private $productOptionRepository;
|
||||||
|
private $productOptionsValueRepository;
|
||||||
|
|
||||||
private $country_repository;
|
private $country_repository;
|
||||||
|
|
||||||
private $city_model;
|
private $city_model;
|
||||||
@ -67,6 +75,10 @@ class AdvsController extends PublicController
|
|||||||
AdvModel $advModel,
|
AdvModel $advModel,
|
||||||
AdvRepositoryInterface $advRepository,
|
AdvRepositoryInterface $advRepository,
|
||||||
|
|
||||||
|
OptionConfigurationRepositoryInterface $optionConfigurationRepository,
|
||||||
|
ProductoptionRepositoryInterface $productOptionRepository,
|
||||||
|
ProductoptionsValueRepositoryInterface $productOptionsValueRepository,
|
||||||
|
|
||||||
CountryRepositoryInterface $country_repository,
|
CountryRepositoryInterface $country_repository,
|
||||||
|
|
||||||
CityModel $city_model,
|
CityModel $city_model,
|
||||||
@ -95,6 +107,10 @@ class AdvsController extends PublicController
|
|||||||
$this->adv_model = $advModel;
|
$this->adv_model = $advModel;
|
||||||
$this->adv_repository = $advRepository;
|
$this->adv_repository = $advRepository;
|
||||||
|
|
||||||
|
$this->optionConfigurationRepository = $optionConfigurationRepository;
|
||||||
|
$this->productOptionRepository = $productOptionRepository;
|
||||||
|
$this->productOptionsValueRepository = $productOptionsValueRepository;
|
||||||
|
|
||||||
$this->country_repository = $country_repository;
|
$this->country_repository = $country_repository;
|
||||||
|
|
||||||
$this->city_model = $city_model;
|
$this->city_model = $city_model;
|
||||||
@ -550,9 +566,11 @@ class AdvsController extends PublicController
|
|||||||
$this->template->set('showTitle', false);
|
$this->template->set('showTitle', false);
|
||||||
$this->template->set('meta_title', $metaTitle);
|
$this->template->set('meta_title', $metaTitle);
|
||||||
|
|
||||||
if ($adv->created_by_id == isset(auth()->user()->id) or $adv->status == "approved") {
|
$configurations = $this->optionConfigurationRepository->getConf($adv->id);
|
||||||
|
|
||||||
|
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',
|
return $this->view->make('visiosoft.module.advs::ad-detail/detail', compact('adv', 'complaints',
|
||||||
'recommended_advs', 'categories', 'features', 'comments', 'qrSRC', 'options'));
|
'recommended_advs', 'categories', 'features', 'comments', 'qrSRC', 'options', 'configurations'));
|
||||||
} else {
|
} else {
|
||||||
return back();
|
return back();
|
||||||
}
|
}
|
||||||
@ -593,7 +611,7 @@ class AdvsController extends PublicController
|
|||||||
$isActiveDopings = $this->adv_model->is_enabled('dopings');
|
$isActiveDopings = $this->adv_model->is_enabled('dopings');
|
||||||
|
|
||||||
return $this->view->make('visiosoft.module.advs::new-ad/preview/preview',
|
return $this->view->make('visiosoft.module.advs::new-ad/preview/preview',
|
||||||
compact('adv', 'categories', 'features', 'isActiveDopings', 'options'));
|
compact('adv', 'categories', 'features', 'isActiveDopings', 'configurations'));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getLocations()
|
public function getLocations()
|
||||||
|
|||||||
@ -0,0 +1,8 @@
|
|||||||
|
<?php namespace Visiosoft\AdvsModule\OptionConfiguration\Contract;
|
||||||
|
|
||||||
|
use Anomaly\Streams\Platform\Entry\Contract\EntryInterface;
|
||||||
|
|
||||||
|
interface OptionConfigurationInterface extends EntryInterface
|
||||||
|
{
|
||||||
|
public function getName();
|
||||||
|
}
|
||||||
@ -0,0 +1,10 @@
|
|||||||
|
<?php namespace Visiosoft\AdvsModule\OptionConfiguration\Contract;
|
||||||
|
|
||||||
|
use Anomaly\Streams\Platform\Entry\Contract\EntryRepositoryInterface;
|
||||||
|
|
||||||
|
interface OptionConfigurationRepositoryInterface extends EntryRepositoryInterface
|
||||||
|
{
|
||||||
|
public function createConfigration($ad_id,$price,$currency,$stock,$option_json);
|
||||||
|
|
||||||
|
public function getConf($ad_id);
|
||||||
|
}
|
||||||
@ -0,0 +1,7 @@
|
|||||||
|
<?php namespace Visiosoft\AdvsModule\OptionConfiguration\Form;
|
||||||
|
|
||||||
|
use Anomaly\Streams\Platform\Ui\Form\FormBuilder;
|
||||||
|
|
||||||
|
class OptionConfigurationFormBuilder extends FormBuilder
|
||||||
|
{
|
||||||
|
}
|
||||||
@ -0,0 +1,40 @@
|
|||||||
|
<?php namespace Visiosoft\AdvsModule\OptionConfiguration\Form;
|
||||||
|
|
||||||
|
use Visiosoft\AdvsModule\Adv\Contract\AdvRepositoryInterface;
|
||||||
|
use Visiosoft\AdvsModule\Productoption\Contract\ProductoptionRepositoryInterface;
|
||||||
|
|
||||||
|
class OptionConfigurationFormFields
|
||||||
|
{
|
||||||
|
public function handle(
|
||||||
|
OptionConfigurationFormBuilder $builder,
|
||||||
|
AdvRepositoryInterface $advRepository,
|
||||||
|
ProductoptionRepositoryInterface $productOptionRepository)
|
||||||
|
{
|
||||||
|
if(request()->has('ad'))
|
||||||
|
{
|
||||||
|
$ad = $advRepository->find(request('ad'));
|
||||||
|
|
||||||
|
$options = $ad->getProductOptionsValues()->groupBy('product_option_id');
|
||||||
|
|
||||||
|
$options_fields = array();
|
||||||
|
|
||||||
|
foreach ($options as $option_id => $option_values)
|
||||||
|
{
|
||||||
|
if($option = $productOptionRepository->find($option_id))
|
||||||
|
{
|
||||||
|
$options_fields['option-'.$option->getId()] = [
|
||||||
|
'type' => 'anomaly.field_type.select',
|
||||||
|
'label' => $option->getName(),
|
||||||
|
'required' => true,
|
||||||
|
'config' => [
|
||||||
|
'options' => $option_values->pluck('name','id')->all(),
|
||||||
|
]
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$fields = array_merge($options_fields, ['price', 'currency', 'stock']);
|
||||||
|
|
||||||
|
$builder->setFields($fields);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,35 @@
|
|||||||
|
<?php namespace Visiosoft\AdvsModule\OptionConfiguration\Form;
|
||||||
|
|
||||||
|
use Visiosoft\AdvsModule\OptionConfiguration\Contract\OptionConfigurationRepositoryInterface;
|
||||||
|
|
||||||
|
class OptionConfigurationFormHandler
|
||||||
|
{
|
||||||
|
public function handle(
|
||||||
|
OptionConfigurationFormBuilder $builder,
|
||||||
|
OptionConfigurationRepositoryInterface $repository
|
||||||
|
)
|
||||||
|
{
|
||||||
|
if (!$builder->canSave()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
$parameters = $builder->getPostData();
|
||||||
|
$parameters['parent_adv_id'] = request()->get('ad');
|
||||||
|
|
||||||
|
$option_json = array();
|
||||||
|
|
||||||
|
foreach ($parameters as $key => $parameter_value) {
|
||||||
|
if (substr($key, 0, 7) === "option-") {
|
||||||
|
$option_id = substr($key, 7);
|
||||||
|
$option_json[$option_id] = $parameter_value;
|
||||||
|
unset($parameters[$key]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$option_json = ['option_json' => json_encode($option_json)];
|
||||||
|
$configration = array_merge($parameters, $option_json);
|
||||||
|
|
||||||
|
|
||||||
|
$entry = $repository->create($configration);
|
||||||
|
$builder->setFormEntry($entry);
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,8 @@
|
|||||||
|
<?php namespace Visiosoft\AdvsModule\OptionConfiguration;
|
||||||
|
|
||||||
|
use Anomaly\Streams\Platform\Entry\EntryCollection;
|
||||||
|
|
||||||
|
class OptionConfigurationCollection extends EntryCollection
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,8 @@
|
|||||||
|
<?php namespace Visiosoft\AdvsModule\OptionConfiguration;
|
||||||
|
|
||||||
|
use Anomaly\Streams\Platform\Entry\EntryCriteria;
|
||||||
|
|
||||||
|
class OptionConfigurationCriteria extends EntryCriteria
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,27 @@
|
|||||||
|
<?php namespace Visiosoft\AdvsModule\OptionConfiguration;
|
||||||
|
|
||||||
|
use Visiosoft\AdvsModule\Adv\AdvModel;
|
||||||
|
use Visiosoft\AdvsModule\Adv\Contract\AdvRepositoryInterface;
|
||||||
|
use Visiosoft\AdvsModule\OptionConfiguration\Contract\OptionConfigurationInterface;
|
||||||
|
use Anomaly\Streams\Platform\Model\Advs\AdvsOptionConfigurationEntryModel;
|
||||||
|
use Visiosoft\AdvsModule\Productoption\Contract\ProductoptionRepositoryInterface;
|
||||||
|
use Visiosoft\AdvsModule\ProductoptionsValue\Contract\ProductoptionsValueRepositoryInterface;
|
||||||
|
|
||||||
|
class OptionConfigurationModel extends AdvsOptionConfigurationEntryModel implements OptionConfigurationInterface
|
||||||
|
{
|
||||||
|
public function getName()
|
||||||
|
{
|
||||||
|
if($adv = app(AdvRepositoryInterface::class)->find($this->parent_adv_id))
|
||||||
|
{
|
||||||
|
$configurations_item = json_decode($this->option_json, true);
|
||||||
|
$option_group_value = "";
|
||||||
|
|
||||||
|
foreach ($configurations_item as $option_id => $value) {
|
||||||
|
$value_entry = app(ProductoptionsValueRepositoryInterface::class)->find($value);
|
||||||
|
$option_group_value .= " " . $value_entry->getName();
|
||||||
|
}
|
||||||
|
|
||||||
|
return $adv->name . ' | ' . trim($option_group_value, ' ');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,8 @@
|
|||||||
|
<?php namespace Visiosoft\AdvsModule\OptionConfiguration;
|
||||||
|
|
||||||
|
use Anomaly\Streams\Platform\Entry\EntryObserver;
|
||||||
|
|
||||||
|
class OptionConfigurationObserver extends EntryObserver
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,8 @@
|
|||||||
|
<?php namespace Visiosoft\AdvsModule\OptionConfiguration;
|
||||||
|
|
||||||
|
use Anomaly\Streams\Platform\Entry\EntryPresenter;
|
||||||
|
|
||||||
|
class OptionConfigurationPresenter extends EntryPresenter
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,73 @@
|
|||||||
|
<?php namespace Visiosoft\AdvsModule\OptionConfiguration;
|
||||||
|
|
||||||
|
use Anomaly\Streams\Platform\Model\Configuration\ConfigurationConfigurationEntryModel;
|
||||||
|
use Visiosoft\AdvsModule\Adv\Contract\AdvRepositoryInterface;
|
||||||
|
use Visiosoft\AdvsModule\OptionConfiguration\Contract\OptionConfigurationRepositoryInterface;
|
||||||
|
use Anomaly\Streams\Platform\Entry\EntryRepository;
|
||||||
|
use Visiosoft\AdvsModule\ProductoptionsValue\Contract\ProductoptionsValueRepositoryInterface;
|
||||||
|
|
||||||
|
class OptionConfigurationRepository extends EntryRepository implements OptionConfigurationRepositoryInterface
|
||||||
|
{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The entry model.
|
||||||
|
*
|
||||||
|
* @var OptionConfigurationModel
|
||||||
|
*/
|
||||||
|
protected $model;
|
||||||
|
protected $advRepository;
|
||||||
|
protected $productOptionsValueRepository;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a new OptionConfigurationRepository instance.
|
||||||
|
*
|
||||||
|
* @param OptionConfigurationModel $model
|
||||||
|
*/
|
||||||
|
public function __construct(
|
||||||
|
OptionConfigurationModel $model,
|
||||||
|
AdvRepositoryInterface $advRepository,
|
||||||
|
ProductoptionsValueRepositoryInterface $productoptionsValueRepository
|
||||||
|
)
|
||||||
|
{
|
||||||
|
$this->model = $model;
|
||||||
|
$this->advRepository = $advRepository;
|
||||||
|
$this->productOptionsValueRepository = $productoptionsValueRepository;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function createConfigration($ad_id, $price, $currency, $stock, $option_json)
|
||||||
|
{
|
||||||
|
return $this->create([
|
||||||
|
'parent_adv_id' => $ad_id,
|
||||||
|
'price' => $price,
|
||||||
|
'currency' => $currency,
|
||||||
|
'stock' => $stock,
|
||||||
|
'option_json' => $option_json,
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getConf($ad_id)
|
||||||
|
{
|
||||||
|
$adv = $this->advRepository->find($ad_id);
|
||||||
|
$configurations = array();
|
||||||
|
|
||||||
|
$product_configurations = $this->model->where('stock', '>', '0')->where('parent_adv_id', $ad_id)->get();
|
||||||
|
|
||||||
|
foreach ($product_configurations as $product_configuration) {
|
||||||
|
$configurations_item = json_decode($product_configuration->option_json, true);
|
||||||
|
$option_group_value = "";
|
||||||
|
foreach ($configurations_item as $option_id => $value) {
|
||||||
|
$value_entry = $this->productOptionsValueRepository->find($value);
|
||||||
|
$option_group_value .= " " . $value_entry->getName();
|
||||||
|
}
|
||||||
|
$configurations[$product_configuration->getId()] = [
|
||||||
|
'name' => $option_group_value,
|
||||||
|
'price' => $product_configuration->price,
|
||||||
|
'currency' => $product_configuration->currency,
|
||||||
|
'stock' => $product_configuration->stock,
|
||||||
|
'adv' => $adv->name . ' (' . trim($option_group_value, ' ') . ')',
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
return $configurations;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,8 @@
|
|||||||
|
<?php namespace Visiosoft\AdvsModule\OptionConfiguration;
|
||||||
|
|
||||||
|
use Anomaly\Streams\Platform\Entry\EntryRouter;
|
||||||
|
|
||||||
|
class OptionConfigurationRouter extends EntryRouter
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,15 @@
|
|||||||
|
<?php namespace Visiosoft\AdvsModule\OptionConfiguration;
|
||||||
|
|
||||||
|
use Anomaly\Streams\Platform\Database\Seeder\Seeder;
|
||||||
|
|
||||||
|
class OptionConfigurationSeeder extends Seeder
|
||||||
|
{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Run the seeder.
|
||||||
|
*/
|
||||||
|
public function run()
|
||||||
|
{
|
||||||
|
//
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,10 @@
|
|||||||
|
<?php namespace Visiosoft\AdvsModule\OptionConfiguration\Table;
|
||||||
|
|
||||||
|
use Anomaly\Streams\Platform\Ui\Table\TableBuilder;
|
||||||
|
|
||||||
|
class OptionConfigurationTableBuilder extends TableBuilder
|
||||||
|
{
|
||||||
|
protected $actions = [
|
||||||
|
'delete'
|
||||||
|
];
|
||||||
|
}
|
||||||
@ -0,0 +1,49 @@
|
|||||||
|
<?php namespace Visiosoft\AdvsModule\OptionConfiguration\Table;
|
||||||
|
|
||||||
|
|
||||||
|
use Anomaly\Streams\Platform\Entry\EntryModel;
|
||||||
|
use Visiosoft\AdvsModule\Adv\Contract\AdvRepositoryInterface;
|
||||||
|
use Visiosoft\AdvsModule\OptionConfiguration\Contract\OptionConfigurationRepositoryInterface;
|
||||||
|
use Visiosoft\AdvsModule\Productoption\Contract\ProductoptionRepositoryInterface;
|
||||||
|
use Visiosoft\AdvsModule\ProductoptionsValue\Contract\ProductoptionsValueRepositoryInterface;
|
||||||
|
|
||||||
|
class OptionConfigurationTableColumns
|
||||||
|
{
|
||||||
|
public function handle(
|
||||||
|
OptionConfigurationTableBuilder $builder
|
||||||
|
)
|
||||||
|
{
|
||||||
|
$builder->setColumns([
|
||||||
|
'name' => [
|
||||||
|
'value' => function (EntryModel $entry,
|
||||||
|
AdvRepositoryInterface $advRepository) {
|
||||||
|
|
||||||
|
$adv = $advRepository->findById($entry->parent_adv_id);
|
||||||
|
return "<span><a href='" . route('adv_detail', [$entry->parent_adv_id]) . "'>$adv->name</a></span>";
|
||||||
|
}
|
||||||
|
],
|
||||||
|
'option_json' => [
|
||||||
|
'value' => function (EntryModel $entry,
|
||||||
|
ProductoptionRepositoryInterface $productOptionRepository,
|
||||||
|
ProductoptionsValueRepositoryInterface $productOptionsValueRepository) {
|
||||||
|
|
||||||
|
$values = json_decode($entry->option_json);
|
||||||
|
$text = "";
|
||||||
|
|
||||||
|
foreach ($values as $key => $value) {
|
||||||
|
$productOption = $productOptionRepository->findBy('entry_id', $key);
|
||||||
|
$productOptionsValue = $productOptionsValueRepository->findBy('entry_id', $value);
|
||||||
|
|
||||||
|
$text .=
|
||||||
|
'<span class="tag tag-sm tag-info mr-1">' .
|
||||||
|
$productOption->name . ': ' . $productOptionsValue->name .
|
||||||
|
'</span>';
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
return $text;
|
||||||
|
}
|
||||||
|
],
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,21 @@
|
|||||||
|
<?php namespace Visiosoft\AdvsModule\OptionHandler;
|
||||||
|
|
||||||
|
use Anomaly\SelectFieldType\SelectFieldType;
|
||||||
|
use Visiosoft\CatsModule\Category\Contract\CategoryRepositoryInterface;
|
||||||
|
|
||||||
|
class CategoriesOptions
|
||||||
|
{
|
||||||
|
private $categoryRepository;
|
||||||
|
|
||||||
|
public function __construct(CategoryRepositoryInterface $categoryRepository)
|
||||||
|
{
|
||||||
|
$this->categoryRepository = $categoryRepository;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function handle(SelectFieldType $fieldType)
|
||||||
|
{
|
||||||
|
$categories = $this->categoryRepository->mainCats();
|
||||||
|
$options = $categories->pluck('name', 'id')->all();
|
||||||
|
$fieldType->setOptions($options);
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,8 @@
|
|||||||
|
<?php namespace Visiosoft\AdvsModule\Productoption\Contract;
|
||||||
|
|
||||||
|
use Anomaly\Streams\Platform\Entry\Contract\EntryInterface;
|
||||||
|
|
||||||
|
interface ProductoptionInterface extends EntryInterface
|
||||||
|
{
|
||||||
|
public function getName();
|
||||||
|
}
|
||||||
@ -0,0 +1,8 @@
|
|||||||
|
<?php namespace Visiosoft\AdvsModule\Productoption\Contract;
|
||||||
|
|
||||||
|
use Anomaly\Streams\Platform\Entry\Contract\EntryRepositoryInterface;
|
||||||
|
|
||||||
|
interface ProductoptionRepositoryInterface extends EntryRepositoryInterface
|
||||||
|
{
|
||||||
|
public function getWithCategoryId($id);
|
||||||
|
}
|
||||||
@ -0,0 +1,68 @@
|
|||||||
|
<?php namespace Visiosoft\AdvsModule\Productoption\Form;
|
||||||
|
|
||||||
|
use Anomaly\Streams\Platform\Ui\Form\FormBuilder;
|
||||||
|
use Visiosoft\CatsModule\Category\CategoryModel;
|
||||||
|
use Visiosoft\CatsModule\Category\CategoryRepository;
|
||||||
|
|
||||||
|
class ProductoptionFormBuilder extends FormBuilder
|
||||||
|
{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The form fields.
|
||||||
|
*
|
||||||
|
* @var array|string
|
||||||
|
*/
|
||||||
|
protected $fields = [];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Additional validation rules.
|
||||||
|
*
|
||||||
|
* @var array|string
|
||||||
|
*/
|
||||||
|
protected $rules = [];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Fields to skip.
|
||||||
|
*
|
||||||
|
* @var array|string
|
||||||
|
*/
|
||||||
|
protected $skips = [];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The form actions.
|
||||||
|
*
|
||||||
|
* @var array|string
|
||||||
|
*/
|
||||||
|
protected $actions = [];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The form buttons.
|
||||||
|
*
|
||||||
|
* @var array|string
|
||||||
|
*/
|
||||||
|
protected $buttons = [
|
||||||
|
'cancel',
|
||||||
|
];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The form options.
|
||||||
|
*
|
||||||
|
* @var array
|
||||||
|
*/
|
||||||
|
protected $options = [];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The form sections.
|
||||||
|
*
|
||||||
|
* @var array
|
||||||
|
*/
|
||||||
|
protected $sections = [];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The form assets.
|
||||||
|
*
|
||||||
|
* @var array
|
||||||
|
*/
|
||||||
|
protected $assets = [];
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,8 @@
|
|||||||
|
<?php namespace Visiosoft\AdvsModule\Productoption;
|
||||||
|
|
||||||
|
use Anomaly\Streams\Platform\Entry\EntryCollection;
|
||||||
|
|
||||||
|
class ProductoptionCollection extends EntryCollection
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,8 @@
|
|||||||
|
<?php namespace Visiosoft\AdvsModule\Productoption;
|
||||||
|
|
||||||
|
use Anomaly\Streams\Platform\Entry\EntryCriteria;
|
||||||
|
|
||||||
|
class ProductoptionCriteria extends EntryCriteria
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,12 @@
|
|||||||
|
<?php namespace Visiosoft\AdvsModule\Productoption;
|
||||||
|
|
||||||
|
use Visiosoft\AdvsModule\Productoption\Contract\ProductoptionInterface;
|
||||||
|
use Anomaly\Streams\Platform\Model\Advs\AdvsProductoptionsEntryModel;
|
||||||
|
|
||||||
|
class ProductoptionModel extends AdvsProductoptionsEntryModel implements ProductoptionInterface
|
||||||
|
{
|
||||||
|
public function getName()
|
||||||
|
{
|
||||||
|
return $this->name;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,8 @@
|
|||||||
|
<?php namespace Visiosoft\AdvsModule\Productoption;
|
||||||
|
|
||||||
|
use Anomaly\Streams\Platform\Entry\EntryObserver;
|
||||||
|
|
||||||
|
class ProductoptionObserver extends EntryObserver
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,8 @@
|
|||||||
|
<?php namespace Visiosoft\AdvsModule\Productoption;
|
||||||
|
|
||||||
|
use Anomaly\Streams\Platform\Entry\EntryPresenter;
|
||||||
|
|
||||||
|
class ProductoptionPresenter extends EntryPresenter
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,30 @@
|
|||||||
|
<?php namespace Visiosoft\AdvsModule\Productoption;
|
||||||
|
|
||||||
|
use Visiosoft\AdvsModule\Productoption\Contract\ProductoptionRepositoryInterface;
|
||||||
|
use Anomaly\Streams\Platform\Entry\EntryRepository;
|
||||||
|
|
||||||
|
class ProductoptionRepository extends EntryRepository implements ProductoptionRepositoryInterface
|
||||||
|
{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The entry model.
|
||||||
|
*
|
||||||
|
* @var ProductoptionModel
|
||||||
|
*/
|
||||||
|
protected $model;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a new ProductoptionRepository instance.
|
||||||
|
*
|
||||||
|
* @param ProductoptionModel $model
|
||||||
|
*/
|
||||||
|
public function __construct(ProductoptionModel $model)
|
||||||
|
{
|
||||||
|
$this->model = $model;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getWithCategoryId($id)
|
||||||
|
{
|
||||||
|
return $this->findAllBy('category',$id);
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,8 @@
|
|||||||
|
<?php namespace Visiosoft\AdvsModule\Productoption;
|
||||||
|
|
||||||
|
use Anomaly\Streams\Platform\Entry\EntryRouter;
|
||||||
|
|
||||||
|
class ProductoptionRouter extends EntryRouter
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,15 @@
|
|||||||
|
<?php namespace Visiosoft\AdvsModule\Productoption;
|
||||||
|
|
||||||
|
use Anomaly\Streams\Platform\Database\Seeder\Seeder;
|
||||||
|
|
||||||
|
class ProductoptionSeeder extends Seeder
|
||||||
|
{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Run the seeder.
|
||||||
|
*/
|
||||||
|
public function run()
|
||||||
|
{
|
||||||
|
//
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,73 @@
|
|||||||
|
<?php namespace Visiosoft\AdvsModule\Productoption\Table;
|
||||||
|
|
||||||
|
use Anomaly\Streams\Platform\Ui\Table\TableBuilder;
|
||||||
|
use Visiosoft\AdvsModule\Productoption\Contract\ProductoptionRepositoryInterface;
|
||||||
|
use Visiosoft\AdvsModule\ProductoptionsValue\Contract\ProductoptionsValueRepositoryInterface;
|
||||||
|
|
||||||
|
class ProductoptionTableBuilder extends TableBuilder
|
||||||
|
{
|
||||||
|
|
||||||
|
public function setTableEntries(\Illuminate\Support\Collection $entries)
|
||||||
|
{
|
||||||
|
$option_repository = app(ProductoptionRepositoryInterface::class);
|
||||||
|
$value_repository = app(ProductoptionsValueRepositoryInterface::class);
|
||||||
|
|
||||||
|
$options_id = $option_repository->getWithCategoryId(7)->pluck('id')->all();
|
||||||
|
|
||||||
|
$values = $value_repository->getWithOptionsId($options_id);
|
||||||
|
return parent::setTableEntries($values);
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* The table views.
|
||||||
|
*
|
||||||
|
* @var array|string
|
||||||
|
*/
|
||||||
|
protected $views = [];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The table filters.
|
||||||
|
*
|
||||||
|
* @var array|string
|
||||||
|
*/
|
||||||
|
protected $filters = [];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The table columns.
|
||||||
|
*
|
||||||
|
* @var array|string
|
||||||
|
*/
|
||||||
|
protected $columns = [];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The table buttons.
|
||||||
|
*
|
||||||
|
* @var array|string
|
||||||
|
*/
|
||||||
|
protected $buttons = [
|
||||||
|
'edit'
|
||||||
|
];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The table actions.
|
||||||
|
*
|
||||||
|
* @var array|string
|
||||||
|
*/
|
||||||
|
protected $actions = [
|
||||||
|
'delete'
|
||||||
|
];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The table options.
|
||||||
|
*
|
||||||
|
* @var array
|
||||||
|
*/
|
||||||
|
protected $options = [];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The table assets.
|
||||||
|
*
|
||||||
|
* @var array
|
||||||
|
*/
|
||||||
|
protected $assets = [];
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,8 @@
|
|||||||
|
<?php namespace Visiosoft\AdvsModule\ProductoptionsValue\Contract;
|
||||||
|
|
||||||
|
use Anomaly\Streams\Platform\Entry\Contract\EntryInterface;
|
||||||
|
|
||||||
|
interface ProductoptionsValueInterface extends EntryInterface
|
||||||
|
{
|
||||||
|
public function getName();
|
||||||
|
}
|
||||||
@ -0,0 +1,8 @@
|
|||||||
|
<?php namespace Visiosoft\AdvsModule\ProductoptionsValue\Contract;
|
||||||
|
|
||||||
|
use Anomaly\Streams\Platform\Entry\Contract\EntryRepositoryInterface;
|
||||||
|
|
||||||
|
interface ProductoptionsValueRepositoryInterface extends EntryRepositoryInterface
|
||||||
|
{
|
||||||
|
public function getWithOptionsId(array $ids);
|
||||||
|
}
|
||||||
@ -0,0 +1,68 @@
|
|||||||
|
<?php namespace Visiosoft\AdvsModule\ProductoptionsValue\Form;
|
||||||
|
|
||||||
|
use Anomaly\Streams\Platform\Ui\Form\FormBuilder;
|
||||||
|
|
||||||
|
class ProductoptionsValueFormBuilder extends FormBuilder
|
||||||
|
{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The form fields.
|
||||||
|
*
|
||||||
|
* @var array|string
|
||||||
|
*/
|
||||||
|
protected $fields = [
|
||||||
|
'product_option','name'
|
||||||
|
];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Additional validation rules.
|
||||||
|
*
|
||||||
|
* @var array|string
|
||||||
|
*/
|
||||||
|
protected $rules = [];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Fields to skip.
|
||||||
|
*
|
||||||
|
* @var array|string
|
||||||
|
*/
|
||||||
|
protected $skips = [];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The form actions.
|
||||||
|
*
|
||||||
|
* @var array|string
|
||||||
|
*/
|
||||||
|
protected $actions = [];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The form buttons.
|
||||||
|
*
|
||||||
|
* @var array|string
|
||||||
|
*/
|
||||||
|
protected $buttons = [
|
||||||
|
'cancel',
|
||||||
|
];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The form options.
|
||||||
|
*
|
||||||
|
* @var array
|
||||||
|
*/
|
||||||
|
protected $options = [];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The form sections.
|
||||||
|
*
|
||||||
|
* @var array
|
||||||
|
*/
|
||||||
|
protected $sections = [];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The form assets.
|
||||||
|
*
|
||||||
|
* @var array
|
||||||
|
*/
|
||||||
|
protected $assets = [];
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,8 @@
|
|||||||
|
<?php namespace Visiosoft\AdvsModule\ProductoptionsValue;
|
||||||
|
|
||||||
|
use Anomaly\Streams\Platform\Entry\EntryCollection;
|
||||||
|
|
||||||
|
class ProductoptionsValueCollection extends EntryCollection
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,8 @@
|
|||||||
|
<?php namespace Visiosoft\AdvsModule\ProductoptionsValue;
|
||||||
|
|
||||||
|
use Anomaly\Streams\Platform\Entry\EntryCriteria;
|
||||||
|
|
||||||
|
class ProductoptionsValueCriteria extends EntryCriteria
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,12 @@
|
|||||||
|
<?php namespace Visiosoft\AdvsModule\ProductoptionsValue;
|
||||||
|
|
||||||
|
use Visiosoft\AdvsModule\ProductoptionsValue\Contract\ProductoptionsValueInterface;
|
||||||
|
use Anomaly\Streams\Platform\Model\Advs\AdvsProductoptionsValueEntryModel;
|
||||||
|
|
||||||
|
class ProductoptionsValueModel extends AdvsProductoptionsValueEntryModel implements ProductoptionsValueInterface
|
||||||
|
{
|
||||||
|
public function getName()
|
||||||
|
{
|
||||||
|
return $this->name;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,8 @@
|
|||||||
|
<?php namespace Visiosoft\AdvsModule\ProductoptionsValue;
|
||||||
|
|
||||||
|
use Anomaly\Streams\Platform\Entry\EntryObserver;
|
||||||
|
|
||||||
|
class ProductoptionsValueObserver extends EntryObserver
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,8 @@
|
|||||||
|
<?php namespace Visiosoft\AdvsModule\ProductoptionsValue;
|
||||||
|
|
||||||
|
use Anomaly\Streams\Platform\Entry\EntryPresenter;
|
||||||
|
|
||||||
|
class ProductoptionsValuePresenter extends EntryPresenter
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,30 @@
|
|||||||
|
<?php namespace Visiosoft\AdvsModule\ProductoptionsValue;
|
||||||
|
|
||||||
|
use Visiosoft\AdvsModule\ProductoptionsValue\Contract\ProductoptionsValueRepositoryInterface;
|
||||||
|
use Anomaly\Streams\Platform\Entry\EntryRepository;
|
||||||
|
|
||||||
|
class ProductoptionsValueRepository extends EntryRepository implements ProductoptionsValueRepositoryInterface
|
||||||
|
{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The entry model.
|
||||||
|
*
|
||||||
|
* @var ProductoptionsValueModel
|
||||||
|
*/
|
||||||
|
protected $model;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a new ProductoptionsValueRepository instance.
|
||||||
|
*
|
||||||
|
* @param ProductoptionsValueModel $model
|
||||||
|
*/
|
||||||
|
public function __construct(ProductoptionsValueModel $model)
|
||||||
|
{
|
||||||
|
$this->model = $model;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getWithOptionsId(array $ids)
|
||||||
|
{
|
||||||
|
return $this->newQuery()->whereIn('product_option_id', $ids)->get();
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,8 @@
|
|||||||
|
<?php namespace Visiosoft\AdvsModule\ProductoptionsValue;
|
||||||
|
|
||||||
|
use Anomaly\Streams\Platform\Entry\EntryRouter;
|
||||||
|
|
||||||
|
class ProductoptionsValueRouter extends EntryRouter
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,15 @@
|
|||||||
|
<?php namespace Visiosoft\AdvsModule\ProductoptionsValue;
|
||||||
|
|
||||||
|
use Anomaly\Streams\Platform\Database\Seeder\Seeder;
|
||||||
|
|
||||||
|
class ProductoptionsValueSeeder extends Seeder
|
||||||
|
{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Run the seeder.
|
||||||
|
*/
|
||||||
|
public function run()
|
||||||
|
{
|
||||||
|
//
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,39 @@
|
|||||||
|
<?php namespace Visiosoft\AdvsModule\ProductoptionsValue\Support\MultipleFieldType;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Builder;
|
||||||
|
use Visiosoft\AdvsModule\Productoption\Contract\ProductoptionRepositoryInterface;
|
||||||
|
use Visiosoft\AdvsModule\ProductoptionsValue\Contract\ProductoptionsValueRepositoryInterface;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class LookupTableBuilder
|
||||||
|
*
|
||||||
|
* @link http://pyrocms.com/
|
||||||
|
* @author PyroCMS, Inc. <support@pyrocms.com>
|
||||||
|
* @author Ryan Thompson <ryan@pyrocms.com>
|
||||||
|
*/
|
||||||
|
class LookupTableBuilder extends \Anomaly\MultipleFieldType\Table\LookupTableBuilder
|
||||||
|
{
|
||||||
|
public function setTableEntries(\Illuminate\Support\Collection $entries)
|
||||||
|
{
|
||||||
|
$option_repository = app(ProductoptionRepositoryInterface::class);
|
||||||
|
$value_repository = app(ProductoptionsValueRepositoryInterface::class);
|
||||||
|
|
||||||
|
$options_id = $option_repository->getWithCategoryId(7)->pluck('id')->all();
|
||||||
|
|
||||||
|
$values = $value_repository->getWithOptionsId($options_id);
|
||||||
|
return parent::setTableEntries($values);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected $filters = [
|
||||||
|
'product_option'
|
||||||
|
];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The table columns.
|
||||||
|
*
|
||||||
|
* @var array
|
||||||
|
*/
|
||||||
|
protected $columns = [
|
||||||
|
'name', 'product_option'
|
||||||
|
];
|
||||||
|
}
|
||||||
@ -0,0 +1,21 @@
|
|||||||
|
<?php namespace Visiosoft\AdvsModule\ProductoptionsValue\Support\MultipleFieldType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class SelectedTableBuilder
|
||||||
|
*
|
||||||
|
* @link http://pyrocms.com/
|
||||||
|
* @author PyroCMS, Inc. <support@pyrocms.com>
|
||||||
|
* @author Ryan Thompson <ryan@pyrocms.com>
|
||||||
|
*/
|
||||||
|
class SelectedTableBuilder extends \Anomaly\MultipleFieldType\Table\SelectedTableBuilder
|
||||||
|
{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The table columns.
|
||||||
|
*
|
||||||
|
* @var array
|
||||||
|
*/
|
||||||
|
protected $columns = [
|
||||||
|
'name', 'product_option'
|
||||||
|
];
|
||||||
|
}
|
||||||
@ -0,0 +1,21 @@
|
|||||||
|
<?php namespace Visiosoft\AdvsModule\ProductoptionsValue\Support\MultipleFieldType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class ValueTableBuilder
|
||||||
|
*
|
||||||
|
* @link http://pyrocms.com/
|
||||||
|
* @author PyroCMS, Inc. <support@pyrocms.com>
|
||||||
|
* @author Ryan Thompson <ryan@pyrocms.com>
|
||||||
|
*/
|
||||||
|
class ValueTableBuilder extends \Anomaly\MultipleFieldType\Table\ValueTableBuilder
|
||||||
|
{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The table columns.
|
||||||
|
*
|
||||||
|
* @var array
|
||||||
|
*/
|
||||||
|
protected $columns = [
|
||||||
|
'name', 'product_option'
|
||||||
|
];
|
||||||
|
}
|
||||||
@ -0,0 +1,68 @@
|
|||||||
|
<?php namespace Visiosoft\AdvsModule\ProductoptionsValue\Table;
|
||||||
|
|
||||||
|
use Anomaly\Streams\Platform\Ui\Table\TableBuilder;
|
||||||
|
|
||||||
|
class ProductoptionsValueTableBuilder extends TableBuilder
|
||||||
|
{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The table views.
|
||||||
|
*
|
||||||
|
* @var array|string
|
||||||
|
*/
|
||||||
|
protected $views = [];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The table filters.
|
||||||
|
*
|
||||||
|
* @var array|string
|
||||||
|
*/
|
||||||
|
protected $filters = [
|
||||||
|
'name', 'product_option'
|
||||||
|
];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The table columns.
|
||||||
|
*
|
||||||
|
* @var array|string
|
||||||
|
*/
|
||||||
|
protected $columns = [
|
||||||
|
'title' => [
|
||||||
|
'value' => 'entry.name'
|
||||||
|
],
|
||||||
|
'product_option',
|
||||||
|
];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The table buttons.
|
||||||
|
*
|
||||||
|
* @var array|string
|
||||||
|
*/
|
||||||
|
protected $buttons = [
|
||||||
|
'edit'
|
||||||
|
];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The table actions.
|
||||||
|
*
|
||||||
|
* @var array|string
|
||||||
|
*/
|
||||||
|
protected $actions = [
|
||||||
|
'delete'
|
||||||
|
];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The table options.
|
||||||
|
*
|
||||||
|
* @var array
|
||||||
|
*/
|
||||||
|
protected $options = [];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The table assets.
|
||||||
|
*
|
||||||
|
* @var array
|
||||||
|
*/
|
||||||
|
protected $assets = [];
|
||||||
|
|
||||||
|
}
|
||||||
@ -36,7 +36,7 @@ class ProfileFormHandler
|
|||||||
// Prevent removing already filled fields
|
// Prevent removing already filled fields
|
||||||
foreach ($parameters as $field => $value) {
|
foreach ($parameters as $field => $value) {
|
||||||
if ($user->$field && !$value) {
|
if ($user->$field && !$value) {
|
||||||
$messages->error('visiosoft.module.profile::message.can_not_changed_filled_fields');
|
$messages->error('visiosoft.module.profile::message.can_not_remove_filled_fields');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user