@extends('admin.layouts.app')

@section('content')
<div class="container-fluid">
    <h2>첨부파일(Download) 관리 - 상세</h2>
    <hr/>
    @include('admin.messages')

    <form name="f_admin_search" id="fAdminSearch" method="post" action="{{ route('admin.board.file.download.update', $log->id) }}">
        @csrf
        @method('PUT')
        <input type="hidden" name="post_file_down_log_id" value="{{ $log->id }}"/>

        <div class="row mb-3">
            <label class="col-sm-2">PK</label>
            <div class="col-sm-10">
                {{ $log->id }}
            </div>
        </div>
        <div class="row mb-3">
            <label class="col-sm-2">게시판</label>
            <div class="col-sm-10">
                {{ $log->board->name }}
            </div>
        </div>
        <div class="row mb-3">
            <label class="col-sm-2">게시글</label>
            <div class="col-sm-10">
                {{ $log->post->subject }}
            </div>
        </div>
        <div class="row mb-3">
            <label class="col-sm-2">회원</label>
            <div class="col-sm-10">
                {{ $log->user->id }} / {{ $log->user->name }} / {{ $log->user->email }}
            </div>
        </div>
        <div class="row mb-3">
            <label class="col-sm-2">원본 파일 이름</label>
            <div class="col-sm-10">
                @if($log->is_image)
                    <i class="far fa-image"></i>
                @else
                    <i class="fas fa-file"></i>
                @endif
                @if(file_exists($log->postFile->file_path))
                    <a href="{{ $log->fileLink }}" download="{{ $log->postFile->origin_name }}">
                        {{ $log->postFile->origin_name }}
                    </a>
                @else
                    {{ $log->postFile->origin_name }}
                @endif
            </div>
        </div>
        <div class="row mb-3">
            <label class="col-sm-2">저장 파일 이름</label>
            <div class="col-sm-10">
                {{ $log->postFile->file_name }}
            </div>
        </div>
        <div class="row mb-3">
            <label class="col-sm-2">저장 경로</label>
            <div class="col-sm-10">
                {{ $log->postFile->file_path }}
            </div>
        </div>
        <div class="row mb-3">
            <label class="col-sm-2">접근 URL</label>
            <div class="col-sm-10">
                <input type="text" class="form-control-plaintext" value="{{ $log->postFile->file_url }}"/>
            </div>
        </div>
        <div class="row mb-3">
            <label class="col-sm-2">파일 크기</label>
            <div class="col-sm-10">
                {{ $log->fileSize }}
            </div>
        </div>
        <div class="row mb-3">
            <label class="col-sm-2">확장자</label>
            <div class="col-sm-10">
                {{ $log->postFile->file_ext }}
            </div>
        </div>
        <div class="row mb-3">
            <label class="col-sm-2">이미지 여부</label>
            <div class="col-sm-10">
                {{ $log->postFile->is_image ? 'Y' : 'N' }}
            </div>
        </div>
        <div class="row mb-3">
            <label class="col-sm-2">이미지 가로 크기</label>
            <div class="col-sm-10">
                {{ $log->postFile->img_width }}px
            </div>
        </div>
        <div class="row mb-3">
            <label class="col-sm-2">이미지 세로 크기</label>
            <div class="col-sm-10">
                {{ $log->postFile->img_height }}px
            </div>
        </div>
        <div class="row mb-3">
            <label class="col-sm-2">다운로드 수</label>
            <div class="col-sm-10">
                {{ $log->download }}
            </div>
        </div>
        <div class="row mb-3">
            <label class="col-sm-2">IP</label>
            <div class="col-sm-10">
                {{ $log->ip_address }}
            </div>
        </div>
        <div class="row mb-3">
            <label class="col-sm-2">Device</label>
            <div class="col-sm-10">
                {{ $log->device }}
            </div>
        </div>
        <div class="row mb-3">
            <label class="col-sm-2">Platform</label>
            <div class="col-sm-10">
                {{ $log->platform }}
            </div>
        </div>
        <div class="row mb-3">
            <label class="col-sm-2">Browser</label>
            <div class="col-sm-10">
                {{ $log->browser }}
            </div>
        </div>
        <div class="row mb-3">
            <label class="col-sm-2">UserAgent</label>
            <div class="col-sm-10">
                {{ $log->user_agent }}
            </div>
        </div>
        <div class="row mb-3">
            <label class="col-sm-2">등록일시</label>
            <div class="col-sm-10">
                {{ $log->created_at }}
            </div>
        </div>
        <hr/>
        <div class="text-end">
            <button type="button" class="btn btn-success btn-write-cancel" value="{{ route('admin.board.file.download.index') }}">뒤로가기</button>
        </div>
    </form>
</div>
@endsection
