@extends('admin.layouts.app')

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

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

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