@if($inquiry->status === 'converted_to_order')
Penawaran Telah Diubah Menjadi Pesanan
@elseif($inquiry->status === 'customer_accepted')
Penawaran Telah Anda Setujui
@elseif($inquiry->status === 'customer_counter')
Menunggu Konfirmasi Admin
@elseif($inquiry->status === 'sent_to_customer' && $inquiry->final_offer_price)
Penawaran Final Telah Dikirim - Silakan Review
@elseif($inquiry->admin_replied_at)
Sudah Dibalas oleh Admin
@else
Menunggu Respons Admin
@endif
Pesan Penawaran
@php
$raw = $inquiry->message ?? '';
$lines = preg_split("/(\r\n|\n|\r)/", $raw);
$type = null; $addons = []; $hasAddonsLine = false;
if (!empty($lines)) {
$first = $lines[0] ?? '';
$second = $lines[1] ?? '';
if (substr($first, 0, 14) === '[REQUEST_TYPE]') { $type = trim(substr($first, 14)); }
if (substr($second, 0, 8) === '[ADDONS]') {
$hasAddonsLine = true;
$matches = [];
if (preg_match('/^\[ADDONS\]\s*(\[[\s\S]*\])$/', $second, $matches)) {
$decoded = json_decode($matches[1], true);
if (is_array($decoded)) { $addons = $decoded; }
}
}
}
$startIdx = 0; if ($type) { $startIdx++; } if ($hasAddonsLine) { $startIdx++; }
if (!empty($lines) && isset($lines[$startIdx]) && trim($lines[$startIdx]) === '') { $startIdx++; }
$plain = implode("\n", array_slice($lines, $startIdx));
$badgeText = $type === 'custom_addon' ? 'Custom Add-on' : ($type === 'custom_new' ? 'Custom Baru' : ($type ? 'Katalog' : null));
$badgeCls = $type === 'custom_addon' ? 'bg-yellow-100 text-yellow-800' : ($type === 'custom_new' ? 'bg-red-100 text-red-800' : 'bg-blue-100 text-blue-800');
@endphp
@if($badgeText)
{{ $badgeText }}
@endif
@if(!empty($addons))
@php
$preview = collect($addons)->map(function($a){
$name = is_array($a) ? ($a['name'] ?? '') : '';
$value = is_array($a) ? ($a['value'] ?? '') : '';
return trim(($name ?: '-') . ': ' . ($value ?: '-'));
})->implode("\n");
@endphp
Spesifikasi Tambahan
{{ $preview }}
@endif
@endif
@if($inquiry->final_offer_price)