Kundenentscheid 26.08. (D-5): Eingang und Ausgang haben eigene, pflegbare Gründe-Listen statt einer festen Liste im Controller. - Neues Modell/Tabelle stock_movement_reasons (label, direction in/out, pos, active, SoftDeletes) inkl. Seed der bisherigen Gründe sinnvoll auf Ein-/Ausgang aufgeteilt. - CRUD wie DisposalReason (SettingCrudController + FormRequest + Formular mit Richtungs-Auswahl); zwei Listen (Eingangs-/Ausgangs-Gründe) auf der Seite Einstellungen → Allgemeines, „Neu anlegen" mit vorbelegter Richtung. - Produktbestand-Maske: das Grund-Dropdown wird jetzt je nach Eingang/Ausgang per JS aus den passenden, gepflegten Gründen befüllt (manualReasons entfernt). - DeletionGuard: StockMovementReason immer löschbar. Migration create_stock_movement_reasons auf Dev-/Live-DB. 4 Tests, Suite 326 grün. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
51 lines
1.2 KiB
PHP
51 lines
1.2 KiB
PHP
<?php
|
|
|
|
namespace App\Http\Controllers\Admin\Inventory;
|
|
|
|
use App\Http\Requests\Inventory\StoreStockMovementReasonRequest;
|
|
use App\Models\StockMovementReason;
|
|
|
|
class StockMovementReasonController extends SettingCrudController
|
|
{
|
|
protected function modelClass(): string
|
|
{
|
|
return StockMovementReason::class;
|
|
}
|
|
|
|
protected function viewPrefix(): string
|
|
{
|
|
return 'admin.inventory.stock-movement-reasons';
|
|
}
|
|
|
|
protected function redirectRoute(): string
|
|
{
|
|
return 'admin.inventory.general';
|
|
}
|
|
|
|
protected function storeRequestClass(): string
|
|
{
|
|
return StoreStockMovementReasonRequest::class;
|
|
}
|
|
|
|
/**
|
|
* Neu-Formular mit vorbelegter Richtung (aus ?direction=in|out).
|
|
*
|
|
* @return array<string, mixed>
|
|
*/
|
|
protected function newModelAttributes(): array
|
|
{
|
|
$direction = in_array(request()->query('direction'), ['in', 'out'], true)
|
|
? request()->query('direction')
|
|
: 'in';
|
|
|
|
return ['active' => true, 'pos' => 0, 'direction' => $direction];
|
|
}
|
|
|
|
/**
|
|
* @return array<int, string>
|
|
*/
|
|
protected function indexOrder(): array
|
|
{
|
|
return ['direction', 'pos', 'label'];
|
|
}
|
|
}
|