@extends('layouts.app') @section('content') @php $initialComponents = collect(old('components', $componentsJson ?? [])) ->filter(function ($item) { return !empty($item['component_material_id']) || (($item['qty'] ?? '') !== ''); }) ->map(function ($item) { return [ 'component_material_id' => (string) ($item['component_material_id'] ?? ''), 'qty' => (float) ($item['qty'] ?? 1), ]; }) ->values() ->all(); $initialPriceGroups = old('prices') ? collect(old('prices')) ->chunk(2) ->map(function ($chunk) { $umum = collect($chunk)->firstWhere('member_type', 'umum'); $instansi = collect($chunk)->firstWhere('member_type', 'studio') ?? collect($chunk)->firstWhere('member_type', 'instansi'); return [ 'sisi' => (int) ($umum['sisi'] ?? $instansi['sisi'] ?? 1), 'min_qty' => (int) ($umum['min_qty'] ?? $instansi['min_qty'] ?? 1), 'max_qty' => $umum['max_qty'] ?? $instansi['max_qty'] ?? null, 'price_umum' => (float) ($umum['price'] ?? 0), 'price_instansi' => (float) ($instansi['price'] ?? 0), ]; }) ->values() ->all() : collect($pricesJson ?? []) ->map(function ($group) { return [ 'sisi' => (int) ($group['sisi'] ?? 1), 'min_qty' => (int) ($group['min_qty'] ?? 1), 'max_qty' => $group['max_qty'] ?? null, 'price_umum' => (float) ($group['price_umum'] ?? 0), 'price_instansi' => (float) ($group['price_instansi'] ?? $group['price_studio'] ?? 0), ]; }) ->values() ->all(); @endphp

{{ $title }}

@csrf @method('PUT')
@error('name')

{{ $message }}

@enderror

Manual: harga per unit • m²: harga per meter persegi • Roll: harga per meter panjang

@error('base_price')

{{ $message }}

@enderror
@error('unit')

{{ $message }}

@enderror

Mode Perhitungan

Manual = stok biasa • m² = stok & harga dihitung per meter persegi • Roll = stok & harga dihitung per meter panjang roll

@error('measurement_mode')

{{ $message }}

@enderror
@error('roll_width_cm')

{{ $message }}

@enderror
Contoh: 100 x 50 cm = 0.5 m². Jika harga dasar 70.000, hasil harga = 35.000.
Contoh: lebar roll 100 cm, ukuran 100 x 50 cm = pemakaian 50 cm = 0.5 meter. Jika harga dasar 70.000, hasil harga = 35.000.

Bahan Custom

Aktifkan jika bahan ini mengambil stok dari satu atau lebih bahan lain

{{ number_format((float) $material->stock, 2, ',', '.') }} {{ $material->unit }}

Stok hanya bisa diubah melalui menu Stok Masuk atau Bahan Rusak

@error('min_stock')

{{ $message }}

@enderror
Bahan custom tidak memakai stok pada bahan ini. Sistem akan mengecek dan mengurangi stok dari bahan komponennya. Saat disimpan, stok dan minimal stok bahan custom akan diset ke 0.

Komponen Bahan

Bisa 1, 2, 3, atau lebih bahan

@error('components')

{{ $message }}

@enderror
Bahan Qty Pakai
Belum ada komponen bahan

Aturan Harga Bertingkat

Sisi Qty Min Qty Max Harga Umum Harga Instansi
Belum ada aturan harga. Klik tombol tambah di atas.
Batal
@endsection @push('scripts') @endpush