- Implemented StokOpnameEdit component for editing stock opname entries. - Created StokOpnameIndex component for listing and managing stock opnames. - Added StokOpnameCardRow and StokOpnameItemSubRow components for displaying stock opname details. - Introduced routes for stok opname CRUD operations and actions (submit, verify, reject, cancel). - Integrated UI components for better user interaction and data presentation.
41 lines
1.2 KiB
PHP
41 lines
1.2 KiB
PHP
<?php
|
|
|
|
namespace App\Http\Requests\Admin\Manage;
|
|
|
|
use App\Enums\ProductStockQuality;
|
|
use Illuminate\Foundation\Http\FormRequest;
|
|
use Illuminate\Validation\Rule;
|
|
|
|
class StokOpnameRequest extends FormRequest
|
|
{
|
|
public function authorize(): bool
|
|
{
|
|
return $this->user()->can('stok_opnames.create')
|
|
|| $this->user()->can('stok_opnames.update');
|
|
}
|
|
|
|
public function rules(): array
|
|
{
|
|
return [
|
|
'opname_date' => ['required', 'date'],
|
|
'items' => ['required', 'array', 'min:1'],
|
|
'items.*.product_variant_id' => ['required', 'integer', Rule::exists('product_variants', 'id')],
|
|
'items.*.stock_quality' => ['required', Rule::in(ProductStockQuality::values())],
|
|
'items.*.physical_stock' => ['required', 'integer', 'min:0'],
|
|
'notes' => ['nullable', 'string', 'max:100'],
|
|
];
|
|
}
|
|
|
|
public function attributes(): array
|
|
{
|
|
return [
|
|
'opname_date' => 'Tanggal Opname',
|
|
'items' => 'Item produk',
|
|
'items.*.product_variant_id' => 'Varian produk',
|
|
'items.*.stock_quality' => 'Jenis stok',
|
|
'items.*.physical_stock' => 'Stok fisik',
|
|
'notes' => 'Keterangan',
|
|
];
|
|
}
|
|
}
|