@extends('layouts.app') @section('content') @php $priceTypeOptions = $priceTypes ?? ['umum' => 'Umum', 'studio' => 'Instansi']; $normalizeInitialPriceValue = function ($value) { if ($value === null || $value === '') { return 0; } if (is_numeric($value)) { return (float) $value; } $value = trim((string) $value); $value = str_replace([' ', '.'], '', $value); $value = str_replace(',', '.', $value); return is_numeric($value) ? (float) $value : 0; }; $initialComponents = collect(old('components', [])) ->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 = collect(old('prices', [])) ->groupBy(function ($item) { return ($item['sisi'] ?? 1) . '-' . ($item['min_qty'] ?? 1) . '-' . (($item['max_qty'] ?? null) ?: 'null'); }) ->map(function ($group) use ($priceTypeOptions, $normalizeInitialPriceValue) { $first = $group->first(); $prices = []; foreach ($priceTypeOptions as $typeCode => $typeName) { $row = collect($group)->firstWhere('member_type', $typeCode); $prices[$typeCode] = $normalizeInitialPriceValue($row['price'] ?? 0); } return [ 'sisi' => (int) ($first['sisi'] ?? 1), 'min_qty' => (int) ($first['min_qty'] ?? 1), 'max_qty' => $first['max_qty'] ?? null, 'prices' => $prices, ]; }) ->values() ->all(); @endphp

{{ $title }}

@csrf
@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

@error('stock')

{{ $message }}

@enderror

Akan memberi peringatan jika stok di bawah nilai ini

@error('min_stock')

{{ $message }}

@enderror
Stok bahan custom tidak dihitung dari kolom stok bahan ini. Sistem akan mengecek dan mengurangi stok dari bahan komponennya.

Komponen Bahan

Bisa 1, 2, 3, atau lebih bahan

@error('components')

{{ $message }}

@enderror
Bahan Qty Pakai
Belum ada komponen bahan

Aturan Harga

Atur harga berbeda berdasarkan jumlah qty dan sisi cetak

Aturan Harga Bertingkat

@foreach($priceTypeOptions as $typeCode => $typeName) @endforeach
Sisi Qty Min Qty MaxHarga {{ $typeName }}
Belum ada aturan harga. Klik tombol tambah di atas.
Batal
@endsection @push('scripts') @endpush