Fixes
This commit is contained in:
@@ -8,7 +8,7 @@ use App\Models\Shop\TagGroup;
|
|||||||
|
|
||||||
class TagGroupsDataTable extends DataTable
|
class TagGroupsDataTable extends DataTable
|
||||||
{
|
{
|
||||||
public $model_name = 'TagGroups';
|
public $model_name = 'tag_groups';
|
||||||
|
|
||||||
public function query(TagGroup $model)
|
public function query(TagGroup $model)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -21,6 +21,11 @@ class SpecieController extends Controller
|
|||||||
return Species::getDatatable($request->all());
|
return Species::getDatatable($request->all());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getOptions()
|
||||||
|
{
|
||||||
|
return response()->json(Species::getOptions());
|
||||||
|
}
|
||||||
|
|
||||||
public function create()
|
public function create()
|
||||||
{
|
{
|
||||||
return view('Botanic.Admin.Species.create');
|
return view('Botanic.Admin.Species.create');
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ namespace App\Http\Controllers\Shop\Admin;
|
|||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
use App\Http\Controllers\Controller;
|
use App\Http\Controllers\Controller;
|
||||||
|
|
||||||
use App\Repositories\Shop\TagGroup;
|
use App\Repositories\Shop\TagGroups;
|
||||||
use App\DataTables\Shop\TagGroupsDataTable;
|
use App\DataTables\Shop\TagGroupsDataTable;
|
||||||
|
|
||||||
class TagGroupController extends Controller
|
class TagGroupController extends Controller
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ class Shop
|
|||||||
|
|
||||||
$menu->addTo('shop', 'Articles', [ 'route' => 'Shop.Admin.Articles.index', 'permission' => 'backend_access' ])
|
$menu->addTo('shop', 'Articles', [ 'route' => 'Shop.Admin.Articles.index', 'permission' => 'backend_access' ])
|
||||||
->activeIfRoute(['Shop.Admin.Articles.*'])->order(1);
|
->activeIfRoute(['Shop.Admin.Articles.*'])->order(1);
|
||||||
$menu->addTo('shop', 'Categories', [ 'route' => 'Shop.Admin.Categories.index', 'permission' => 'backend_access' ])
|
$menu->addTo('shop', 'Rayons', [ 'route' => 'Shop.Admin.Categories.index', 'permission' => 'backend_access' ])
|
||||||
->activeIfRoute(['Shop.Admin.Categories.*'])->order(2);
|
->activeIfRoute(['Shop.Admin.Categories.*'])->order(2);
|
||||||
$menu->addTo('shop', 'Familles d\'articles', [ 'route' => 'Shop.Admin.ArticleFamilies.index', 'permission' => 'backend_access' ])
|
$menu->addTo('shop', 'Familles d\'articles', [ 'route' => 'Shop.Admin.ArticleFamilies.index', 'permission' => 'backend_access' ])
|
||||||
->activeIfRoute(['Shop.Admin.ArticleFamilies.*'])->order(3);
|
->activeIfRoute(['Shop.Admin.ArticleFamilies.*'])->order(3);
|
||||||
|
|||||||
@@ -22,8 +22,8 @@ class ArticleFamily extends Model
|
|||||||
return $this->hasMany('App\Models\Shop\Price');
|
return $this->hasMany('App\Models\Shop\Price');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function unities()
|
public function packages()
|
||||||
{
|
{
|
||||||
return $this->hasMany('App\Models\Shop\Unity');
|
return $this->hasMany('App\Models\Shop\Package');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -32,9 +32,10 @@ class Varieties
|
|||||||
$data = [];
|
$data = [];
|
||||||
foreach ($varieties as $variety)
|
foreach ($varieties as $variety)
|
||||||
{
|
{
|
||||||
$data[] = ['id' => $variety->id, 'text' => (isset($variety->specie->name) ? $variety->specie->name . ' ' : '') . $variety->name];
|
$data[$variety->id] = (isset($variety->specie->name) ? $variety->specie->name . ' ' : '') . $variety->name;
|
||||||
}
|
}
|
||||||
return collect($data)->sortBy('text')->values()->all();
|
asort($data, SORT_NATURAL | SORT_FLAG_CASE);
|
||||||
|
return $data;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function getAll()
|
public static function getAll()
|
||||||
|
|||||||
@@ -8,6 +8,8 @@ use Illuminate\Support\Str;
|
|||||||
|
|
||||||
use Yajra\DataTables\DataTables;
|
use Yajra\DataTables\DataTables;
|
||||||
|
|
||||||
|
use App\Repositories\Botanic\Species;
|
||||||
|
use App\Repositories\Botanic\Varieties;
|
||||||
use App\Models\Shop\Article;
|
use App\Models\Shop\Article;
|
||||||
|
|
||||||
class Articles
|
class Articles
|
||||||
@@ -37,11 +39,12 @@ class Articles
|
|||||||
|
|
||||||
public static function getMeta(&$data = [])
|
public static function getMeta(&$data = [])
|
||||||
{
|
{
|
||||||
|
$data['products'] = ($data['product_type'] == 'App\Models\Botanic\Variety') ? Varieties::getOptionsWithSpecie() : Species::getOptions();
|
||||||
$data['categories_options'] = Categories::getOptions();
|
$data['categories_options'] = Categories::getOptions();
|
||||||
$data['price_generics'] = PriceGenericCategories::getOptionsWithChildrens();
|
$data['price_generics'] = PriceGenericCategories::getOptionsWithChildrens();
|
||||||
$data['families_options'] = ArticleFamilies::getOptions();
|
$data['families_options'] = ArticleFamilies::getOptions();
|
||||||
$data['taxes_options'] = Taxes::getOptions();
|
$data['taxes_options'] = Taxes::getOptions();
|
||||||
$data['packages'] = Packages::getSelectByFamily($data['article_family_id']);
|
$data['packages'] = ($data['article_family_id'] ?? false) ? Packages::getSelectByFamily($data['article_family_id']) : [];
|
||||||
$data['unities'] = ($data['packages']['id'] ?? false) ? Unities::getSelectByPackage($data['packages']['id']) : [];
|
$data['unities'] = ($data['packages']['id'] ?? false) ? Unities::getSelectByPackage($data['packages']['id']) : [];
|
||||||
$data['tags_list'] = TagGroups::getTreeTags();
|
$data['tags_list'] = TagGroups::getTreeTags();
|
||||||
$data['models_options'] = ['App\Models\Botanic\Specie' => 'Espèces', 'App\Models\Botanic\Variety' => 'Variétés'];
|
$data['models_options'] = ['App\Models\Botanic\Specie' => 'Espèces', 'App\Models\Botanic\Variety' => 'Variétés'];
|
||||||
|
|||||||
@@ -4,8 +4,6 @@
|
|||||||
'breadcrumb' => [__('Shop.articles.title'), __('Shop.articles.add')]
|
'breadcrumb' => [__('Shop.articles.title'), __('Shop.articles.add')]
|
||||||
])
|
])
|
||||||
|
|
||||||
@include('boilerplate::load.fileinput')
|
|
||||||
|
|
||||||
@section('content')
|
@section('content')
|
||||||
|
|
||||||
{{ Form::open(['route' => 'Shop.Admin.Articles.store', 'id' => 'article-form', 'autocomplete' => 'off', 'files' => true]) }}
|
{{ Form::open(['route' => 'Shop.Admin.Articles.store', 'id' => 'article-form', 'autocomplete' => 'off', 'files' => true]) }}
|
||||||
|
|||||||
@@ -4,8 +4,6 @@
|
|||||||
'breadcrumb' => ['Articles']
|
'breadcrumb' => ['Articles']
|
||||||
])
|
])
|
||||||
|
|
||||||
@include('boilerplate::load.fileinput')
|
|
||||||
|
|
||||||
@section('content')
|
@section('content')
|
||||||
|
|
||||||
{{ Form::open(['route' => 'Shop.Admin.Articles.store', 'id' => 'article-form', 'autocomplete' => 'off', 'files' => true]) }}
|
{{ Form::open(['route' => 'Shop.Admin.Articles.store', 'id' => 'article-form', 'autocomplete' => 'off', 'files' => true]) }}
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
@include('boilerplate::load.fileinput')
|
@include('boilerplate::load.fileinput')
|
||||||
@include('boilerplate::load.select2')
|
@include('boilerplate::load.select2')
|
||||||
|
@include('load.set_options')
|
||||||
@include('boilerplate::load.tinymce')
|
@include('boilerplate::load.tinymce')
|
||||||
|
|
||||||
<div class="row mt-3">
|
<div class="row mt-3">
|
||||||
|
|||||||
@@ -12,7 +12,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="col-6">
|
<div class="col-6">
|
||||||
{{ Form::label('model_id', 'Produit') }}<br>
|
{{ Form::label('model_id', 'Produit') }}<br>
|
||||||
@include('components.select2', ['name' => 'product_id', 'id_name' => 'product_id', 'value' => isset($product_id) ? $product_id : null, 'class' => 'select2 form-control'])
|
@include('components.select', ['name' => 'product_id', 'id_name' => 'product_id', 'list' => $products ?? [], 'value' => isset($product_id) ? $product_id : null, 'class' => 'select2 form-control'])
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -64,7 +64,16 @@
|
|||||||
});
|
});
|
||||||
|
|
||||||
$('#product_type').change( function() {
|
$('#product_type').change( function() {
|
||||||
|
var product_type = $(this).val();
|
||||||
|
switch (product_type) {
|
||||||
|
case 'App\\Models\\Botanic\\Specie':
|
||||||
|
loadSpecies();
|
||||||
|
break;
|
||||||
|
case 'App\\Models\\Botanic\\Variety':
|
||||||
|
default:
|
||||||
loadVarieties();
|
loadVarieties();
|
||||||
|
break;
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
function loadVarieties() {
|
function loadVarieties() {
|
||||||
@@ -73,12 +82,28 @@
|
|||||||
method : 'POST',
|
method : 'POST',
|
||||||
data: {model: $('#product_type').val()},
|
data: {model: $('#product_type').val()},
|
||||||
success : function(data) {
|
success : function(data) {
|
||||||
$("#product_id").select2({data: data});
|
setOptions('#product_id', data);
|
||||||
$("#product_id").trigger('change');
|
// $("#product_id").select2({data: data});
|
||||||
|
// $("#product_id").trigger('change');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
loadVarieties();
|
function loadSpecies() {
|
||||||
|
console.log('loadSpecies');
|
||||||
|
console.log($('#product_type').val());
|
||||||
|
$.ajax({
|
||||||
|
url : '{{ route('Botanic.Admin.Species.getSelect') }}',
|
||||||
|
method : 'POST',
|
||||||
|
data: {model: $('#product_type').val()},
|
||||||
|
success : function(data) {
|
||||||
|
setOptions('#product_id', data);
|
||||||
|
// $("#product_id").select2({data: data});
|
||||||
|
// $("#product_id").trigger('change');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// loadVarieties();
|
||||||
</script>
|
</script>
|
||||||
@endpush
|
@endpush
|
||||||
@@ -0,0 +1,52 @@
|
|||||||
|
@include('Shop.Admin.Articles.partials.generic_prices.block_generic_price_new')
|
||||||
|
|
||||||
|
<div id="append_generic_price" class="row">
|
||||||
|
@include('Shop.Admin.Articles.partials.generic_prices.list-generic_prices')
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<button type="button" class="btn btn-sm btn-primary add-new-generic_price">Associer un tarif générique<i class="fa fa-plus"></i></button>
|
||||||
|
|
||||||
|
|
||||||
|
@include('components.select-tree', ['name' => "article_price_generic_id", 'value' => $price['article_price_generic_id'] ?? null, 'list' => $price_generics ?? null, 'required' => false, 'class' => 'form-control-sm w-100'])
|
||||||
|
|
||||||
|
|
||||||
|
@push('js')
|
||||||
|
<script>
|
||||||
|
|
||||||
|
function append_generic_price() {
|
||||||
|
// handle_append_attribute();
|
||||||
|
$('.select2').select2();
|
||||||
|
// handle_change_attribute();
|
||||||
|
// load_attribute_values($('.attributes-value'), $('.attributes-family').val());
|
||||||
|
}
|
||||||
|
|
||||||
|
$("#append_generic_price").appender({
|
||||||
|
rowSection: '.row-new-generic_price',
|
||||||
|
type: '.row-generic_price',
|
||||||
|
addBtn: '.add-new-generic_price',
|
||||||
|
appendEffect: 'slide',
|
||||||
|
addClass: 'animated bounceInLeft',
|
||||||
|
rowNumber: '.row-generic_price-number',
|
||||||
|
deleteBtn: '.delete-new-generic_price-btn',
|
||||||
|
callback: append_generic_price,
|
||||||
|
rowNumberStart: 2,
|
||||||
|
hideSection: true
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
function handle_delete_generic_price() {
|
||||||
|
$('.delete-generic_price-btn').click(function() {
|
||||||
|
var $selector = $(this).parents('.row-generic_price');
|
||||||
|
var id = $selector.find('.generic_price_id').val();
|
||||||
|
|
||||||
|
/*
|
||||||
|
confirm_delete(id, "{## route('Shop.Admin.ArticlePrices.destroy') }}", function() {
|
||||||
|
$selector.remove();
|
||||||
|
});
|
||||||
|
*/
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
</script>
|
||||||
|
@endpush
|
||||||
@@ -8,8 +8,8 @@
|
|||||||
<script>
|
<script>
|
||||||
$(function () {
|
$(function () {
|
||||||
handle_delete_price();
|
handle_delete_price();
|
||||||
init_attribute_values();
|
init_unities();
|
||||||
handle_change_attribute();
|
handle_change_package();
|
||||||
handle_prices();
|
handle_prices();
|
||||||
handle_prices_taxed();
|
handle_prices_taxed();
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -12,8 +12,8 @@
|
|||||||
function append_price() {
|
function append_price() {
|
||||||
// handle_append_attribute();
|
// handle_append_attribute();
|
||||||
$('.select2').select2();
|
$('.select2').select2();
|
||||||
handle_change_attribute();
|
handle_change_package();
|
||||||
load_attribute_values($('.unities'), $('.price-family').val());
|
load_unities($('.unities'), $('.package').val());
|
||||||
}
|
}
|
||||||
|
|
||||||
$("#append_price").appender({
|
$("#append_price").appender({
|
||||||
@@ -29,35 +29,36 @@
|
|||||||
hideSection: true
|
hideSection: true
|
||||||
});
|
});
|
||||||
|
|
||||||
function handle_change_attribute() {
|
function handle_change_package() {
|
||||||
$('.price-family').change( function() {
|
$('.package').change( function() {
|
||||||
var family_id = $(this).val();
|
var package_id = $(this).val();
|
||||||
var $family = $(this);
|
var $package = $(this);
|
||||||
var $parent = $family.parent().parent();
|
var $parent = $package.parent().parent();
|
||||||
var $selector = $parent.find('.unities');
|
var $selector = $parent.find('.unities');
|
||||||
load_attribute_values($selector, family_id);
|
load_unities($selector, package_id);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function init_attribute_values() {
|
function init_unities() {
|
||||||
$('.price-family').each( function() {
|
$('.package').each( function() {
|
||||||
var family_id = $(this).val();
|
var package_id = $(this).val();
|
||||||
var $family = $(this);
|
var $package = $(this);
|
||||||
var $parent = $family.parent().parent();
|
var $parent = $package.parent().parent();
|
||||||
var $selector = $parent.find('.unities');
|
var $selector = $parent.find('.unities');
|
||||||
load_attribute_values($selector, family_id);
|
load_unities($selector, package_id);
|
||||||
value_id = $selector.data('id');
|
value_id = $selector.data('id');
|
||||||
$selector.val(value_id).trigger('change');
|
$selector.val(value_id).trigger('change');
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function load_attribute_values($selector, family_id) {
|
function load_unities($selector, package_id) {
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url : "{{ route('Shop.Admin.Unities.getOptionsByFamily') }}",
|
url : "{{ route('Shop.Admin.Unities.getOptionsByPackage') }}",
|
||||||
method : 'POST',
|
method : 'POST',
|
||||||
data: { family_id: family_id },
|
data: { package_id: package_id },
|
||||||
success : function(data) {
|
success : function(data) {
|
||||||
$selector.empty().select2({data: data});
|
setOptions($selector, data);
|
||||||
|
// $selector.empty().select2({data: data});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -61,7 +61,16 @@
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function handle_packages() {
|
||||||
|
$('.delete-price-btn').click(function() {
|
||||||
|
var $selector = $(this).parents('.row-price');
|
||||||
|
var id = $selector.find('.price_id').val();
|
||||||
|
|
||||||
|
confirm_delete(id, laroute.route('Shop.Admin.PriceGenericValues.destroy', {id : id}), function() {
|
||||||
|
$selector.remove();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
@endpush
|
@endpush
|
||||||
|
|||||||
@@ -5,5 +5,5 @@
|
|||||||
])
|
])
|
||||||
|
|
||||||
@section('content')
|
@section('content')
|
||||||
@include('components.datatable', ['route' => route('Shop.Admin.TagGroups.index'), 'model' => 'TagGroups'])
|
@include('components.datatable', ['route' => route('Shop.Admin.TagGroups.index'), 'model' => 'tag_groups'])
|
||||||
@endsection
|
@endsection
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ Route::prefix('Species')->name('Species.')->group(function () {
|
|||||||
Route::post('update', 'SpecieController@update')->name('update');
|
Route::post('update', 'SpecieController@update')->name('update');
|
||||||
Route::post('store', 'SpecieController@store')->name('store');
|
Route::post('store', 'SpecieController@store')->name('store');
|
||||||
Route::get('edit/{id}', 'SpecieController@edit')->name('edit');
|
Route::get('edit/{id}', 'SpecieController@edit')->name('edit');
|
||||||
|
Route::any('getSelect', 'SpecieController@getOptions')->name('getSelect');
|
||||||
|
|
||||||
Route::any('exportExcel', 'SpecieController@exportExcel')->name('exportExcel');
|
Route::any('exportExcel', 'SpecieController@exportExcel')->name('exportExcel');
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
Route::resource('PriceFamilies', 'PriceFamilyController');
|
|
||||||
|
|
||||||
@@ -1,7 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
Route::prefix('PriceFamilyValues')->name('PriceFamilyValues.')->group(function () {
|
|
||||||
Route::any('getOptionsByFamily', 'PriceFamilyValueController@getOptionsByFamily')->name('getOptionsByFamily');
|
|
||||||
});
|
|
||||||
|
|
||||||
Route::resource('PriceFamilyValues', 'PriceFamilyValueController');
|
|
||||||
@@ -13,7 +13,6 @@ Route::middleware('auth')->prefix('Admin')->namespace('Admin')->name('Admin.')->
|
|||||||
include __DIR__ . '/Invoices.php';
|
include __DIR__ . '/Invoices.php';
|
||||||
include __DIR__ . '/OrderPayments.php';
|
include __DIR__ . '/OrderPayments.php';
|
||||||
include __DIR__ . '/Orders.php';
|
include __DIR__ . '/Orders.php';
|
||||||
include __DIR__ . '/PriceFamilies.php';
|
|
||||||
include __DIR__ . '/PriceGenerics.php';
|
include __DIR__ . '/PriceGenerics.php';
|
||||||
include __DIR__ . '/Tags.php';
|
include __DIR__ . '/Tags.php';
|
||||||
include __DIR__ . '/TagGroups.php';
|
include __DIR__ . '/TagGroups.php';
|
||||||
|
|||||||
Reference in New Issue
Block a user