Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Warehouse refactorred #1276

Merged
merged 1 commit into from
Jul 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/Webkul/Admin/publishable/assets/css/admin.css

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion packages/Webkul/Admin/publishable/assets/mix-manifest.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"/js/admin.js": "/js/admin.js?id=ded43dfc84d1a6b469709c56aeee570a",
"/css/admin.css": "/css/admin.css?id=a6b855125755ab112c96e86c75888210",
"/css/admin.css": "/css/admin.css?id=64b4db95cdc3c7ea70cb6bd4754a7215",
"/images/activities-active-icon.svg": "/images/activities-active-icon.svg?id=f7887e3fdcddf68567ceca8facc1e40e",
"/images/activities-icon.svg": "/images/activities-icon.svg?id=0755224d86e0281d031f938b2aa1d610",
"/images/attribute-icon.svg": "/images/attribute-icon.svg?id=8f9f3e0e90496263403fc26efef8614d",
Expand Down
5 changes: 0 additions & 5 deletions packages/Webkul/Admin/src/Config/attribute_entity_types.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,4 @@
'name' => 'admin::app.settings.warehouses.title',
'repository' => 'Webkul\Warehouse\Repositories\WarehouseRepository',
],

'locations' => [
'name' => 'admin::app.settings.locations.title',
'repository' => 'Webkul\Warehouse\Repositories\LocationRepository',
],
];
7 changes: 0 additions & 7 deletions packages/Webkul/Admin/src/Config/menu.php
Original file line number Diff line number Diff line change
Expand Up @@ -219,13 +219,6 @@
'route' => 'admin.settings.warehouses.index',
'sort' => 1,
'icon-class' => 'pipeline-icon',
], [
'key' => 'settings.warehouse.locations',
'name' => 'admin::app.layouts.locations',
'info' => 'admin::app.layouts.locations-info',
'route' => 'admin.settings.locations.index',
'sort' => 2,
'icon-class' => 'source-icon',
], [
'key' => 'settings.automation',
'name' => 'admin::app.layouts.automation',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public function __construct()
'key' => 'all',
],
],
collect(config('attribute_entity_types'))->except('locations')->map(function ($entityType, $key) {
collect(config('attribute_entity_types'))->map(function ($entityType, $key) {
return [
'name' => trans($entityType['name']),
'isActive' => false,
Expand Down
158 changes: 0 additions & 158 deletions packages/Webkul/Admin/src/DataGrids/Setting/LocationDataGrid.php

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
namespace Webkul\Admin\Http\Controllers\Setting;

use Illuminate\Support\Facades\Event;
use Prettus\Repository\Criteria\RequestCriteria;
use Webkul\Attribute\Http\Requests\AttributeForm;
use Webkul\Admin\DataGrids\Setting\LocationDataGrid;
use Webkul\Admin\Http\Controllers\Controller;
Expand All @@ -17,31 +18,20 @@ class LocationController extends Controller
*/
public function __construct(protected LocationRepository $locationRepository)
{
request()->request->add(['entity_type' => 'locations']);
}

/**
* Display a listing of the resource.
* Search location results
*
* @return \Illuminate\View\View
* @return \Illuminate\Http\Response
*/
public function index()
public function search()
{
if (request()->ajax()) {
return app(LocationDataGrid::class)->toJson();
}

return view('admin::settings.locations.index');
}
$results = $this->locationRepository
->pushCriteria(app(RequestCriteria::class))
->all();

/**
* Show the form for creating a new resource.
*
* @return \Illuminate\View\View
*/
public function create()
{
return view('admin::settings.locations.create');
return response()->json($results);
}

/**
Expand All @@ -58,48 +48,9 @@ public function store(AttributeForm $request)

Event::dispatch('settings.location.create.after', $location);

if (request()->ajax()) {
return response()->json([
'message' => trans('admin::app.locations.create-success'),
]);
}

session()->flash('success', trans('admin::app.locations.create-success'));

return redirect()->route('admin.settings.locations.index');
}

/**
* Show the form for editing the specified resource.
*
* @param int $id
* @return \Illuminate\View\View
*/
public function edit($id)
{
$location = $this->locationRepository->findOrFail($id);

return view('admin::settings.locations.edit', compact('location'));
}

/**
* Update the specified resource in storage.
*
* @param \Webkul\Attribute\Http\Requests\AttributeForm $request
* @param int $id
* @return \Illuminate\Http\Response
*/
public function update(AttributeForm $request, $id)
{
Event::dispatch('settings.location.update.before', $id);

$location = $this->locationRepository->update(request()->all(), $id);

Event::dispatch('settings.location.update.after', $location);

session()->flash('success', trans('admin::app.locations.update-success'));

return redirect()->route('admin.settings.locations.index');
return response()->json([
'message' => trans('admin::app.locations.create-success'),
]);
}

/**
Expand Down Expand Up @@ -128,18 +79,4 @@ public function destroy($id)
], 400);
}
}

/**
* Search location results
*
* @return \Illuminate\Http\Response
*/
public function search()
{
$results = $this->locationRepository->findWhere([
['name', 'like', '%' . urldecode(request()->input('query')) . '%']
]);

return response()->json($results);
}
}
Loading
Loading