@extends('admin.layouts.app')

@section('content')
<div class="container-fluid">
    <h2>이미지 상세 정보</h2>
    <hr/>
    @include('admin.messages')

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

        <div class="row mb-3">
            <label class="col-sm-2">PK</label>
            <div class="col-sm-10">
                {{ $image->id }}
            </div>
        </div>

        @if($image->target_type == EDITOR_IMG_TYPE_1 || $image->target_type == EDITOR_IMG_TYPE_2)
            <div class="row mb-3">
                <label class="col-sm-2">게시글</label>
                <div class="col-sm-10">
                    {{ $image->post->subject }}
                </div>
            </div>
        @endif

        @if($image->target_type == EDITOR_IMG_TYPE_2)
            <div class="row mb-3">
                <label class="col-sm-2">댓글</label>
                <div class="col-sm-10">
                    {{ $image->comment->content }}
                </div>
            </div>
        @endif

        <div class="row mb-3">
            <label class="col-sm-2">회원</label>
            <div class="col-sm-10">
                {{ $image->user->id }} / {{ $image->user->name }} / {{ $image->user->email }}
            </div>
        </div>
        <div class="row mb-3">
            <label class="col-sm-2">이미지</label>
            <div class="col-sm-10">
                @if(file_exists($image->file_path))
                    <img src="{{ $image->file_url }}" alt="{{ $image->file_name }}" title="{{ $image->file_name }}"/>
                @else
                    -
                @endif
            </div>
        </div>
        <div class="row mb-3">
            <label class="col-sm-2">원본 파일 이름</label>
            <div class="col-sm-10">
                <i class="far fa-image"></i>
                @if(file_exists($image->file_path))
                    <a href="{{ $image->fileLink }}" download>
                        {{ $image->origin_name }}
                    </a>
                @else
                    {{ $image->origin_name }}
                @endif
            </div>
        </div>
        <div class="row mb-3">
            <label class="col-sm-2">저장 파일 이름</label>
            <div class="col-sm-10">
                {{ $image->file_name }}
            </div>
        </div>
        <div class="row mb-3">
            <label class="col-sm-2">저장 경로</label>
            <div class="col-sm-10">
                {{ $image->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="{{ $image->file_url }}"/>
            </div>
        </div>
        <div class="row mb-3">
            <label class="col-sm-2">파일 크기</label>
            <div class="col-sm-10">
                {{ $image->fileSize }}
            </div>
        </div>
        <div class="row mb-3">
            <label class="col-sm-2">확장자</label>
            <div class="col-sm-10">
                {{ $image->file_type }}
            </div>
        </div>
        <div class="row mb-3">
            <label class="col-sm-2">이미지 가로 크기</label>
            <div class="col-sm-10">
                {{ $image->width }}px
            </div>
        </div>
        <div class="row mb-3">
            <label class="col-sm-2">이미지 세로 크기</label>
            <div class="col-sm-10">
                {{ $image->height }}px
            </div>
        </div>
        <div class="row mb-3">
            <label class="col-sm-2">IP</label>
            <div class="col-sm-10">
                {{ $image->ip_address }}
            </div>
        </div>
        <div class="row mb-3">
            <label class="col-sm-2">Device</label>
            <div class="col-sm-10">
                {{ $image->device }}
            </div>
        </div>
        <div class="row mb-3">
            <label class="col-sm-2">Platform</label>
            <div class="col-sm-10">
                {{ $image->platform }}
            </div>
        </div>
        <div class="row mb-3">
            <label class="col-sm-2">Browser</label>
            <div class="col-sm-10">
                {{ $image->browser }}
            </div>
        </div>
        <div class="row mb-3">
            <label class="col-sm-2">UserAgent</label>
            <div class="col-sm-10">
                {{ $image->user_agent }}
            </div>
        </div>
        <div class="row mb-3">
            <label class="col-sm-2">등록일시</label>
            <div class="col-sm-10">
                {{ $image->created_at }}
            </div>
        </div>
        <hr/>
        <div class="text-end">
            <button type="button" class="btn btn-success btn-write-cancel" value="{{ route('admin.board.image.index') }}">뒤로가기</button>
        </div>
    </form>
</div>
@endsection
