@extends('layouts.main') @section('title', 'My Product Inquiries') @section('content')
Riwayat penawaran dan pertanyaan produk
| No | Nama | Status | Aksi | |||||
|---|---|---|---|---|---|---|---|---|
| {{ $loop->iteration + $inquiries->firstItem() - 1 }} | {{ $inquiry->name }} | @if($inquiry->is_read) Dibaca @else Belum Dibaca @endif | Detail | |||||
Produk
{{ $inquiry->product->product_title ?? 'N/A' }}
Pesan
@php $raw = $inquiry->message ?? ''; $lines = preg_split("/(\r\n|\n|\r)/", $raw); $type = null; $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; } } $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{{ Str::limit($plain ?: $inquiry->message, 80) }}
Status
@if($inquiry->is_read) Dibaca @else Belum Dibaca @endifTanggal
{{ $inquiry->created_at->format('d M Y') }}