13-05-2026 Waren Wirtschaft
This commit is contained in:
parent
9ce711d6b2
commit
ca3eb663fe
40 changed files with 1000 additions and 189 deletions
|
|
@ -27,7 +27,7 @@ class PackagingItemController extends Controller
|
|||
->orderBy('name');
|
||||
|
||||
if ($isShipping) {
|
||||
$query->whereIn('category', ['shipping', 'label', 'shipping_office']);
|
||||
$query->where('category', 'shipping');
|
||||
} else {
|
||||
$query->where('category', 'packaging');
|
||||
}
|
||||
|
|
@ -41,7 +41,10 @@ class PackagingItemController extends Controller
|
|||
|
||||
public function create(Request $request)
|
||||
{
|
||||
$category = $request->get('category', 'packaging');
|
||||
$category = $request->query('category', 'packaging');
|
||||
if (! in_array($category, ['packaging', 'shipping'], true)) {
|
||||
$category = 'packaging';
|
||||
}
|
||||
|
||||
return view('admin.inventory.packaging-items.form', [
|
||||
'model' => new PackagingItem(['active' => true, 'category' => $category === 'shipping' ? 'shipping' : 'packaging', 'weight_grams' => 0]),
|
||||
|
|
@ -53,18 +56,27 @@ class PackagingItemController extends Controller
|
|||
|
||||
public function store(StorePackagingItemRequest $request)
|
||||
{
|
||||
$item = $this->packagingItemRepository->create($request->validated());
|
||||
$validated = $request->validated();
|
||||
|
||||
\Log::debug('PackagingItem STORE – raw input', [
|
||||
'category_raw' => $request->input('category'),
|
||||
'category_hex' => bin2hex((string) $request->input('category')),
|
||||
'all_input' => $request->all(),
|
||||
]);
|
||||
\Log::debug('PackagingItem STORE – validated', $validated);
|
||||
|
||||
$item = $this->packagingItemRepository->create($validated);
|
||||
|
||||
\Session::flash('alert-save', '1');
|
||||
|
||||
$category = in_array($item->category, ['shipping', 'label', 'shipping_office']) ? 'shipping' : 'packaging';
|
||||
$category = $item->category === 'shipping' ? 'shipping' : 'packaging';
|
||||
|
||||
return redirect()->route('admin.inventory.packaging-items.index', ['category' => $category]);
|
||||
}
|
||||
|
||||
public function edit(PackagingItem $packagingItem)
|
||||
{
|
||||
$category = in_array($packagingItem->category, ['shipping', 'label', 'shipping_office']) ? 'shipping' : 'packaging';
|
||||
$category = $packagingItem->category === 'shipping' ? 'shipping' : 'packaging';
|
||||
|
||||
return view('admin.inventory.packaging-items.form', [
|
||||
'model' => $packagingItem,
|
||||
|
|
@ -76,18 +88,27 @@ class PackagingItemController extends Controller
|
|||
|
||||
public function update(UpdatePackagingItemRequest $request, PackagingItem $packagingItem)
|
||||
{
|
||||
$this->packagingItemRepository->update($packagingItem, $request->validated());
|
||||
$validated = $request->validated();
|
||||
|
||||
\Log::debug('PackagingItem UPDATE – raw input', [
|
||||
'category_raw' => $request->input('category'),
|
||||
'category_hex' => bin2hex((string) $request->input('category')),
|
||||
'all_input' => $request->all(),
|
||||
]);
|
||||
\Log::debug('PackagingItem UPDATE – validated', $validated);
|
||||
|
||||
$this->packagingItemRepository->update($packagingItem, $validated);
|
||||
|
||||
\Session::flash('alert-save', '1');
|
||||
|
||||
$category = in_array($packagingItem->category, ['shipping', 'label', 'shipping_office']) ? 'shipping' : 'packaging';
|
||||
$category = $packagingItem->category === 'shipping' ? 'shipping' : 'packaging';
|
||||
|
||||
return redirect()->route('admin.inventory.packaging-items.index', ['category' => $category]);
|
||||
}
|
||||
|
||||
public function destroy(PackagingItem $packagingItem)
|
||||
{
|
||||
$category = in_array($packagingItem->category, ['shipping', 'label', 'shipping_office']) ? 'shipping' : 'packaging';
|
||||
$category = $packagingItem->category === 'shipping' ? 'shipping' : 'packaging';
|
||||
|
||||
$packagingItem->delete();
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue