Merge pull request #6695 from papnoisanjeev/category-mass-action-update-added
Category mass update action added #6690
This commit is contained in:
commit
0b013f2926
|
|
@ -165,6 +165,11 @@ return [
|
|||
'name' => 'admin::app.acl.mass-delete',
|
||||
'route' => 'admin.catalog.categories.massdelete',
|
||||
'sort' => 4,
|
||||
], [
|
||||
'key' => 'catalog.categories.mass-update',
|
||||
'name' => 'admin::app.acl.mass-update',
|
||||
'route' => 'admin.catalog.categories.mass-update',
|
||||
'sort' => 4,
|
||||
], [
|
||||
'key' => 'catalog.attributes',
|
||||
'name' => 'admin::app.acl.attributes',
|
||||
|
|
|
|||
|
|
@ -174,5 +174,16 @@ class CategoryDataGrid extends DataGrid
|
|||
'action' => route('admin.catalog.categories.massdelete'),
|
||||
'method' => 'POST',
|
||||
]);
|
||||
|
||||
$this->addMassAction([
|
||||
'type' => 'update',
|
||||
'label' => trans('admin::app.datagrid.update-status'),
|
||||
'action' => route('admin.catalog.categories.mass-update'),
|
||||
'method' => 'POST',
|
||||
'options' => [
|
||||
trans('admin::app.datagrid.active') => 1,
|
||||
trans('admin::app.datagrid.inactive') => 0,
|
||||
],
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -731,6 +731,7 @@ return [
|
|||
'image' => 'صورة',
|
||||
'filterable-attributes' => 'سمات قابلة للفلترة',
|
||||
'attributes' => 'السمات',
|
||||
'mass-update-success' => 'تم تحديث جميع الفئات المحددة بنجاح',
|
||||
],
|
||||
],
|
||||
|
||||
|
|
|
|||
|
|
@ -737,6 +737,8 @@ return [
|
|||
'attributes' => 'Attributes',
|
||||
'image-size' => 'Image resolution should be like 300px X 168px',
|
||||
'image-size-logo' => 'Image resolution should be like 20px X 20px',
|
||||
'mass-update-success' => 'All the selected categories have been updated successfully',
|
||||
|
||||
],
|
||||
],
|
||||
|
||||
|
|
|
|||
|
|
@ -723,6 +723,7 @@ return [
|
|||
'image' => 'Bild',
|
||||
'filterable-attributes' => 'Filterbare Attribute',
|
||||
'attributes' => 'Attribute',
|
||||
'mass-update-success' => 'Alle ausgewählten Kategorien wurden erfolgreich aktualisiert',
|
||||
],
|
||||
],
|
||||
'configuration' =>
|
||||
|
|
|
|||
|
|
@ -737,6 +737,7 @@ return [
|
|||
'attributes' => 'Attributes',
|
||||
'image-size' => 'Image resolution should be like 300px X 168px',
|
||||
'image-size-logo' => 'Image resolution should be like 20px X 20px',
|
||||
'mass-update-success' => 'All the selected categories have been updated successfully',
|
||||
],
|
||||
],
|
||||
|
||||
|
|
|
|||
|
|
@ -733,6 +733,7 @@ return [
|
|||
'image' => 'Imagen',
|
||||
'filterable-attributes' => 'Atributos filtrables',
|
||||
'attributes' => 'Atributos',
|
||||
'mass-update-success' => 'Todas las categorías seleccionadas se han actualizado correctamente',
|
||||
],
|
||||
],
|
||||
|
||||
|
|
|
|||
|
|
@ -716,6 +716,7 @@ return [
|
|||
'image' => 'تصویر',
|
||||
'filterable-attributes' => 'ویژگی های فیلتر',
|
||||
'attributes' => 'ویژگی های',
|
||||
'mass-update-success' => 'همه دسته های انتخابی با موفقیت به روز شدند',
|
||||
],
|
||||
],
|
||||
|
||||
|
|
|
|||
|
|
@ -736,6 +736,7 @@ return [
|
|||
'image' => 'Image',
|
||||
'filterable-attributes' => 'Attributs filtrables',
|
||||
'attributes' => 'Les attributs',
|
||||
'mass-update-success' => 'Toutes les catégories sélectionnées ont été mises à jour avec succès',
|
||||
],
|
||||
],
|
||||
|
||||
|
|
|
|||
|
|
@ -737,6 +737,7 @@ return [
|
|||
'attributes' => 'Attributes',
|
||||
'image-size' => 'Image resolution should be like 300px X 168px',
|
||||
'image-size-logo' => 'Image resolution should be like 20px X 20px',
|
||||
'mass-update-success' => 'All the selected categories have been updated successfully',
|
||||
],
|
||||
],
|
||||
|
||||
|
|
|
|||
|
|
@ -734,6 +734,7 @@ return [
|
|||
'attributes' => 'गुण',
|
||||
'image-size' => 'इमेज रेजोल्यूशन 300px X 168px जैसा होना चाहिए',
|
||||
'image-size-logo' => 'इमेज रेजोल्यूशन 20px X 20px जैसा होना चाहिए',
|
||||
'mass-update-success' => 'सभी चयनित श्रेणियों को सफलतापूर्वक अपडेट कर दिया गया है',
|
||||
],
|
||||
],
|
||||
|
||||
|
|
|
|||
|
|
@ -721,6 +721,7 @@ return [
|
|||
'image' => 'Immagine',
|
||||
'filterable-attributes' => 'Attributi filtrabili',
|
||||
'attributes' => 'Attributi',
|
||||
'mass-update-success' => 'Tutte le categorie selezionate sono state aggiornate con successo',
|
||||
],
|
||||
],
|
||||
|
||||
|
|
|
|||
|
|
@ -737,6 +737,7 @@ return [
|
|||
'attributes' => 'Attributes',
|
||||
'image-size' => 'Image resolution should be like 300px X 168px',
|
||||
'image-size-logo' => 'Image resolution should be like 20px X 20px',
|
||||
'mass-update-success' => 'All the selected categories have been updated successfully',
|
||||
],
|
||||
],
|
||||
|
||||
|
|
|
|||
|
|
@ -715,6 +715,7 @@ return [
|
|||
'image' => 'Afbeelding',
|
||||
'filterable-attributes' => 'Filtreerbare kenmerken',
|
||||
'attributes' => 'Attributen',
|
||||
'mass-update-success' => 'Alle geselecteerde categorieën zijn met succes bijgewerkt',
|
||||
],
|
||||
],
|
||||
|
||||
|
|
|
|||
|
|
@ -716,6 +716,7 @@ return [
|
|||
'filterable-attributes' => '
|
||||
„filterable-atrybuty” => „Filtrowalne atrybuty',
|
||||
'attributes' => 'Atrybuty',
|
||||
'mass-update-success' => 'Wszystkie wybrane kategorie zostały pomyślnie zaktualizowane',
|
||||
],
|
||||
],
|
||||
|
||||
|
|
|
|||
|
|
@ -714,6 +714,7 @@ return [
|
|||
'image' => 'Imagem',
|
||||
'filterable-attributes' => 'Atributos filtráveis',
|
||||
'attributes' => 'Atributos',
|
||||
'mass-update-success' => 'Todas as categorias selecionadas foram atualizadas com sucesso',
|
||||
],
|
||||
],
|
||||
|
||||
|
|
|
|||
|
|
@ -737,6 +737,7 @@ return [
|
|||
'attributes' => 'Attributes',
|
||||
'image-size' => 'Image resolution should be like 300px X 168px',
|
||||
'image-size-logo' => 'Image resolution should be like 20px X 20px',
|
||||
'mass-update-success' => 'All the selected categories have been updated successfully',
|
||||
],
|
||||
],
|
||||
|
||||
|
|
|
|||
|
|
@ -737,6 +737,7 @@ return [
|
|||
'attributes' => 'Attributes',
|
||||
'image-size' => 'Image resolution should be like 300px X 168px',
|
||||
'image-size-logo' => 'Image resolution should be like 20px X 20px',
|
||||
'mass-update-success' => 'All the selected categories have been updated successfully',
|
||||
],
|
||||
],
|
||||
|
||||
|
|
|
|||
|
|
@ -721,6 +721,7 @@ return [
|
|||
'image' => 'Görsel',
|
||||
'filterable-attributes' => 'Filtrelenebilir Nitelikler',
|
||||
'attributes' => 'Nitelikler',
|
||||
'mass-update-success' => 'All the selected categories have been updated successfully',
|
||||
],
|
||||
],
|
||||
|
||||
|
|
|
|||
|
|
@ -716,6 +716,7 @@ return [
|
|||
'image' => '图片',
|
||||
'filterable-attributes' => '可过滤属性',
|
||||
'attributes' => '属性列表',
|
||||
'mass-update-success' => '所有選擇的類別都已成功更新',
|
||||
],
|
||||
],
|
||||
|
||||
|
|
|
|||
|
|
@ -104,6 +104,10 @@ Route::group(['middleware' => ['web', 'admin'], 'prefix' => config('app.admin_ur
|
|||
'redirect' => 'admin.catalog.categories.index',
|
||||
])->name('admin.catalog.categories.massdelete');
|
||||
|
||||
Route::post('categories/mass-update', [CategoryController::class, 'massUpdate'])->defaults('_config', [
|
||||
'redirect' => 'admin.catalog.categories.index',
|
||||
])->name('admin.catalog.categories.mass-update');
|
||||
|
||||
Route::post('/categories/product/count', [CategoryController::class, 'categoryProductCount'])->name('admin.catalog.categories.product.count');
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -205,6 +205,37 @@ class CategoryController extends Controller
|
|||
return redirect()->route($this->_config['redirect']);
|
||||
}
|
||||
|
||||
/**
|
||||
* Mass update Category.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function massUpdate()
|
||||
{
|
||||
$data = request()->all();
|
||||
|
||||
if (! isset($data['massaction-type']) || ! $data['massaction-type'] == 'update') {
|
||||
return redirect()->back();
|
||||
}
|
||||
|
||||
$categoryIds = explode(',', $data['indexes']);
|
||||
|
||||
foreach ($categoryIds as $categoryId) {
|
||||
Event::dispatch('catalog.categories.mass-update.before', $categoryId);
|
||||
|
||||
$category = $this->categoryRepository->find($categoryId);
|
||||
|
||||
$category->status = $data['update-options'];
|
||||
$category->save();
|
||||
|
||||
Event::dispatch('catalog.categories.mass-update.after', $category);
|
||||
}
|
||||
|
||||
session()->flash('success', trans('admin::app.catalog.categories.mass-update-success'));
|
||||
|
||||
return redirect()->route($this->_config['redirect']);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get category product count.
|
||||
*
|
||||
|
|
|
|||
Loading…
Reference in New Issue