gruene-seele/resources/views/admin/inventory/locations/index.blade.php
Kevin Adametz e08c8dec40 Warenwirtschaft: AP-50 — Lagerort löschbar (Buchungen übernehmen) + Köln als Default
Kundenentscheid 26.08.: „Waldbröl" gibt es nicht mehr, alles wird Köln; die
Standort-Funktion bleibt für künftige Standorte.

- LocationController::destroy überschrieben: ein belegter Lagerort lässt sich
  löschen, indem seine Buchungen (Wareneingänge, Produktionen, Ausschuss)
  transaktional auf einen Ziel-Lagerort übernommen werden. Ohne Ziel-Lagerort
  bleibt die Sperre bestehen; unbelegte Orte werden direkt gelöscht.
- Lagerort-Liste: Ziel-Auswahl („→ Köln" vorbelegt) im Lösch-Formular.
- Wareneingang: Köln als Standard-Lagerort vorbelegt (wie in der Produktion).

Außerdem AP-49-Folgeanpassung: Test-Helper hängt die Kategorie „Kosmetikrohstoffe"
an, damit Lieferanten im gefilterten INCI-Formular erscheinen; Lagerort-Sperr-Test
prüft die neue Meldung. Suite 322 grün.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-08-28 09:17:28 +00:00

79 lines
3.8 KiB
PHP

@extends('layouts.layout-2')
@section('content')
@include('admin.inventory.partials.wawi-ui')
<div class="wawi-page">
<div class="wawi-page-head">
<div>
<h1 class="wawi-page-head__title">{{ __('Lagerorte') }}</h1>
</div>
<div class="wawi-page-head__actions">
<a href="{{ route('admin.inventory.locations.create') }}" class="btn btn-sm btn-primary">
<span class="fas fa-plus mr-1"></span>{{ __('Neu anlegen') }}
</a>
</div>
</div>
<div class="wawi-card">
<div class="card-datatable table-responsive p-2">
<table class="datatables-style table wawi-table">
<thead>
<tr>
<th style="max-width: 60px;">&nbsp;</th>
<th>{{ __('Name') }}</th>
<th>{{ __('Status') }}</th>
<th></th>
</tr>
</thead>
<tbody>
@foreach($values as $value)
<tr>
<td>
<a href="{{ route('admin.inventory.locations.edit', $value) }}" class="btn icon-btn btn-sm btn-primary">
<span class="far fa-edit"></span>
</a>
</td>
<td>{{ $value->name }}</td>
<td data-sort="{{ $value->active ? 1 : 0 }}">
@if($value->active)
<span class="wawi-pill wawi-pill--ok">{{ __('Aktiv') }}</span>
@else
<span class="wawi-pill wawi-pill--danger">{{ __('Inaktiv') }}</span>
@endif
</td>
<td>
@php $others = $values->where('id', '!=', $value->id); @endphp
{{-- AP-50: belegte Lagerorte löschbar, indem die Buchungen auf einen Ziel-Lagerort übernommen werden --}}
<form action="{{ route('admin.inventory.locations.destroy', $value) }}" method="post" class="d-inline form-inline"
onsubmit="return confirm('{{ __('Lagerort wirklich löschen? Vorhandene Buchungen werden auf den gewählten Ziel-Lagerort übernommen.') }}');">
@csrf
@method('DELETE')
@if($others->isNotEmpty())
<select name="reassign_to" class="form-control form-control-sm d-inline-block mr-1" style="width:auto;"
title="{{ __('Buchungen übernehmen auf') }}">
@foreach($others as $other)
<option value="{{ $other->id }}" @selected(stripos($other->name, 'öln') !== false)>&rarr; {{ $other->name }}</option>
@endforeach
</select>
@endif
<button type="submit" class="btn btn-link text-danger p-0" title="{{ __('Delete') }}"><i class="far fa-trash-alt"></i></button>
</form>
</td>
</tr>
@endforeach
</tbody>
</table>
</div>
</div>
</div>
<script>
$(document).ready(function () {
$('.datatables-style').dataTable({
"bLengthChange": false,
"iDisplayLength": 100,
"order": [[1, "asc"]],
"language": {"url": "/js/German.json"}
});
});
</script>
@endsection