<!-- iframe field -->
@include('crud::fields.inc.wrapper_start')
    <label>{!! $field['label'] !!}</label>
    @include('crud::fields.inc.translatable_icon')
    
    @if(isset($field['url']) && !empty($field['url']))
        <br>
        <a href="{{ $field['url'] }}" target="_blank" class="btn btn-success">檔案另開新視窗</a>    
        <br>
        @if (strpos($field['url'], ".pdf") !== false)

        <embed style="border: solid gray 1px"
            src="{{ $field['url'] }}"
            width="{{ $field['width'] ?? '' }}"
            height="{{ $field['height'] ?? '' }}"
            frameborder="0"
            allowfullscreen
            @if(isset($field['extra_attributes']))
                @foreach($field['extra_attributes'] as $key => $value)
                    {{ $key }}="{{ $value }}"
                @endforeach
            @endif
        ></embed>

        @else
        <a href="{{ $field['url'] }}" class="lightboxBtn" data-lightbox="uploadImages">
            <img style="border: solid gray 1px"
                src="{{ $field['url'] }}"
                height="{{ $field['height'] ?? '' }}"
            />
        </a>
            @if (isset($field['image-rotation-url']))
            <br><a class="btn" onclick="var self = this; $.ajax({async: false, url:'{{ $field['image-rotation-url'] }}', method: 'POST', headers: {'Content-Type': 'application/json', 'X-CSRF-TOKEN': $('meta[name=\'csrf-token\']').attr('content')}, error: function(jqXHR, textStatus, errorThrown){alert('錯誤:' + errorThrown);}, success: function(data) { var elem = $(self).parent().find('img'); var src=$(elem).attr('src').split('?')[0] + '?' + (new Date().getTime()).toString(); $(elem).attr('src', src); $(elem).parent().attr('href', src); } });">旋轉圖片</a>
            @endif
        @endif
        @if(isset($field['hint']))
            <p class="help-block">{!! $field['hint'] !!}</p>
        @endif
    @else
        <p class="text-muted">沒有可以顯示的內容。</p>
    @endif
</div>
@include('crud::fields.inc.wrapper_start')