UI issue fix in datagrid mass action master checkbox check and uncheck

This commit is contained in:
Prashant Singh 2019-01-21 10:56:50 +05:30
parent 9eeaee1c66
commit b19f02f5c0
5 changed files with 43 additions and 27 deletions

View File

@ -147,7 +147,7 @@ return [
'editor' =>'vscode', 'editor' =>'vscode',
/** /**
* Debug blacklisting * Blacklisting attributes while debugging
*/ */
'debug_blacklist' => [ 'debug_blacklist' => [
'_ENV' => [ '_ENV' => [

View File

@ -9,6 +9,7 @@ use Webkul\Product\Http\Requests\ProductForm;
use Webkul\Product\Repositories\ProductRepository as Product; use Webkul\Product\Repositories\ProductRepository as Product;
use Webkul\Product\Repositories\ProductGridRepository as ProductGrid; use Webkul\Product\Repositories\ProductGridRepository as ProductGrid;
use Webkul\Product\Repositories\ProductFlatRepository as ProductFlat; use Webkul\Product\Repositories\ProductFlatRepository as ProductFlat;
use Webkul\Product\Repositories\ProductAttributeValueRepository as ProductAttributeValue;
use Webkul\Attribute\Repositories\AttributeFamilyRepository as AttributeFamily; use Webkul\Attribute\Repositories\AttributeFamilyRepository as AttributeFamily;
use Webkul\Category\Repositories\CategoryRepository as Category; use Webkul\Category\Repositories\CategoryRepository as Category;
use Webkul\Inventory\Repositories\InventorySourceRepository as InventorySource; use Webkul\Inventory\Repositories\InventorySourceRepository as InventorySource;
@ -69,6 +70,7 @@ class ProductController extends Controller
* @vatr array * @vatr array
*/ */
protected $productFlat; protected $productFlat;
protected $productAttributeValue;
/** /**
* Create a new controller instance. * Create a new controller instance.
@ -85,7 +87,8 @@ class ProductController extends Controller
InventorySource $inventorySource, InventorySource $inventorySource,
Product $product, Product $product,
ProductGrid $productGrid, ProductGrid $productGrid,
ProductFlat $productFlat) ProductFlat $productFlat,
ProductAttributeValue $productAttributeValue)
{ {
$this->attributeFamily = $attributeFamily; $this->attributeFamily = $attributeFamily;
@ -99,6 +102,8 @@ class ProductController extends Controller
$this->productFlat = $productFlat; $this->productFlat = $productFlat;
$this->productAttributeValue = $productAttributeValue;
$this->_config = request('_config'); $this->_config = request('_config');
} }
@ -268,31 +273,58 @@ class ProductController extends Controller
return redirect()->route('admin.catalog.products.index'); return redirect()->route('admin.catalog.products.index');
} }
/**
* Testing for the product flat sync method on product creation and updation
*/
public function testProductFlat() { public function testProductFlat() {
$allChannels = []; $allChannels = [];
$allLocales = []; $allLocales = [];
$productFlatAtttributes = []; $productFlatAtttributes = [];
//hero variable to map the product and the attribute values on the basis of channels and locales
$productMapped = [];
$product = $this->product->find(4); $product = $this->product->find(4);
foreach($product->attribute_values as $attributeValue) {
array_push($productFlatAtttributes, strtolower($attributeValue->attribute->code));
}
foreach(core()->getAllChannels() as $channel) { foreach(core()->getAllChannels() as $channel) {
array_push($allChannels, ['name' => $channel->name, 'code' => $channel->code]); array_push($allChannels, ['id' => $channel->id, 'name' => $channel->name, 'code' => $channel->code]);
} }
foreach(core()->getAllLocales() as $locale) { foreach(core()->getAllLocales() as $locale) {
array_push($allLocales, ['name' => $locale->name, 'code' => $locale->code]); array_push($allLocales, ['id' => $locale->id,'name' => $locale->name, 'code' => $locale->code]);
} }
/**
* Setting up the hero variable for the direct use on the model itself to make entries in product flat.
*/
foreach($allChannels as $allChannel) { foreach($allChannels as $allChannel) {
foreach($allLocales as $allLocale) { foreach($allLocales as $allLocale) {
$productMapped[$allChannel['code']][$allLocale['code']] = [];
} }
} }
/**
* 1. use null when the attribute value is empty string
* 2. make use of all the nullable columns present in the product flat table
*/
foreach($product->attribute_values as $attribute_value) {
// array_push($productFlatAtttributes, ['code' => $attribute_value->attribute->code, 'channel_based' => $attribute_value->attribute->value_per_channel, 'locale_based' => $attribute_value->attribute->value_per_locale]);
if($attribute_value->attribute->value_per_locale) {
if($attribute_value->attribute->value_per_locale) {
} else {
dd('this attributes value is only channel dependent');
}
} else if($attribute_value->attribute->value_per_locale) {
dd('this attributes value is only locale dependent');
} else {
//use this for non locale and non channel based values
}
}
dd($productFlatAtttributes);
die; die;
} }
} }

View File

@ -78,10 +78,4 @@ class ProductAttributeValueRepository extends Repository
return $result->count() ? false : true; return $result->count() ? false : true;
} }
// public function getAttributesByChannelAndLocale($product, $channel = 0, $locale = null) {
// $productByChannelAndLocale = [];
// }
} }

View File

@ -512,14 +512,4 @@ class ProductRepository extends Repository
return $query->distinct()->addSelect('products.*')->where('pav.text_value', 'like', '%'.$term.'%'); return $query->distinct()->addSelect('products.*')->where('pav.text_value', 'like', '%'.$term.'%');
})->paginate(4); })->paginate(4);
} }
/**
* break the search term into explode by using space and tell which exploded item is attribute
* , category, super attribute or combination of them.
*/
public function breakTheTerm($term) {
$explodedTerm = (explode(" ", $term));
dd($term);
}
} }

View File

@ -155,7 +155,7 @@
<th colspan="100%"> <th colspan="100%">
<div class="mass-action-wrapper" style="display: flex; flex-direction: row; align-items: center; justify-content: flex-start;"> <div class="mass-action-wrapper" style="display: flex; flex-direction: row; align-items: center; justify-content: flex-start;">
<span class="massaction-remove" v-on:click="removeMassActions" style="margin-right: 10px;"> <span class="massaction-remove" v-on:click="removeMassActions" style="margin-right: 10px; margin-top: 3px;">
<span class="icon checkbox-dash-icon"></span> <span class="icon checkbox-dash-icon"></span>
</span> </span>