@extends('layouts.app') @section('content')

{{ __('รายการผลิตภัณฑ์') }}

@if(Auth::user()->Agency_ID && strtolower(Auth::user()->Level) !== 'consult')

{{ __('บริษัท: ') . Auth::user()->agency->Agency_Name }}

@elseif(strtolower(Auth::user()->Level) === 'consult')
@endif
{{ __('ย้อนกลับ') }} @if(Auth::user()->Agency_ID || strtolower(Auth::user()->Level) === 'consult') @endif @if(strtolower(Auth::user()->Level) === 'consult') @else @endif {{ __('เพิ่มผลิตภัณฑ์') }}
@if(session('success')) @elseif(session('error') && !session('success')) @php session()->forget('error'); @endphp @endif @if($products->isEmpty())

{{ __('ไม่มีผลิตภัณฑ์') }}

@if(Auth::user()->Agency_ID) {{ __('บริษัทของคุณยังไม่มีผลิตภัณฑ์') }} @else {{ __('คุณยังไม่มีผลิตภัณฑ์') }} @endif

{{ __('เพิ่มผลิตภัณฑ์แรก') }}
@else
@foreach($products as $index => $product) @endforeach
ลำดับ ชื่อผลิตภัณฑ์ โมเดล/รุ่น วิธีรับข้อมูล ประเภทผลิตภัณฑ์ สถานะการประเมิน วันที่สร้าง การดำเนินการ
{{ $index + 1 }} {{ $product->name }} @if($product->description)
{{ Str::limit($product->description, 50) }} @endif
{{ $product->model ?? 'ไม่ระบุ' }} @switch($product->log_receive_method) @case('syslog_udp') syslog UDP @break @case('syslog_tcp') syslog TCP @break @case('syslog_both') syslog UDP & TCP @break @default {{ $product->log_receive_method }} @endswitch @if($product->product_type == 'hw_sw_log_server') Hardware + Software @else Software Only @endif @php $latestAssessment = $product->assessments()->latest()->first(); @endphp @if($latestAssessment) @if($latestAssessment->status == 'draft') ฉบับร่าง @elseif($latestAssessment->status == 'submitted') ส่งแล้ว @else {{ $latestAssessment->status }} @endif @else ยังไม่ประเมิน @endif {{ $product->DtmIns->format('d/m/Y') }}
@if($latestAssessment && $latestAssessment->status == 'draft') @if(strtolower(Auth::user()->Level) === 'consult' && isset($selectedAgencyId)) @else @endif ทำต่อ @endif รายงาน @php $user = Auth::user(); $hasDeleteAccess = false; // เจ้าของผลิตภัณฑ์ if($user->Customer_ID === $product->user_id) { $hasDeleteAccess = true; } // Admin หรือ SuperAdmin elseif(strtolower($user->Level) === 'admin' || strtolower($user->Level) === 'superadmin') { $hasDeleteAccess = true; } // คนในบริษัทเดียวกัน elseif($user->Agency_ID && $product->user && $product->user->Agency_ID && $user->Agency_ID === $product->user->Agency_ID) { $hasDeleteAccess = true; } @endphp @if($hasDeleteAccess)
@csrf @method('DELETE')
@endif
@endif
@if(strtolower(Auth::user()->Level) === 'consult') @endif @endsection