@php global $lastpost; @endphp
@foreach($posts as $post)
    @if($post['uid'] == $user['uid'])
    <div class="card mb-3">
        <div class="card-header no-bg p-min pt-4 px-4">
            <div>
                <div class="card-title mb-3">
                    <span><i class="ri-user-line no-mr"></i> {{ App\System\Model\UserGroupModel::beRenderUserName($post['name'].' '.$post['surname'],$usergroups[$post['usergroup']]['ugnamestyle']) }}</span>
                </div>
                <div class="card-title">
                    <span><button class="btn btn-transparent btn-sm" role="none">{{ $usergroups[$post['usergroup']]['ugname'] }}</button></span>
                </div>
            </div>
        </div>
        <div class="card-content no-p px-4 pb-3">
            <div class="row">
                <div class="col-12 text-normal">
                    <hr>
                    {{ $post['tpmessage'] }}
                </div>
                <div class="col-12">
                    <hr>
                    @if($post['attachments'])
                    @foreach($post['attachments'] as $attachment)
                    <div class="p-2 card btn-transparent">
                        <div class="row-flex row-align">
                            <span class="svg-icon svg-icon-2x me-1" style="color:#009ef7">
                                <svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
                                    <path opacity="0.3" d="M19 22H5C4.4 22 4 21.6 4 21V3C4 2.4 4.4 2 5 2H14L20 8V21C20 21.6 19.6 22 19 22Z" fill="currentColor"></path>
                                    <path d="M15 8H20L14 2V7C14 7.6 14.4 8 15 8Z" fill="currentColor"></path>
                                </svg>
                            </span>
                            <a href="{{ beGetRoute('file.show',['slug' => $attachment['aslug'],'aid' => $attachment['aid']]) }}" target="_blank" style="color:#009ef7!important">{{ $attachment['aname'] }}</a>
                        </div>
                        <div class="mt-2 row-flex text-sm">
                            <span class="mr-1">{{ beConvertSize($attachment['asize']) }}</span>
                            <span class="mr-1">-</span>
                            <span>{{ beSpecialTime($attachment['adateline']) }}</span>
                        </div>
                    </div>
                    @endforeach
                    @endif
                    <div class="row-flex row-end mt-3">
                        <button class="btn btn-transparent btn-sm mr-2" role="none">{{ beSpecialTime($post['tpdateline']) }} # {{ $post['tpipaddress'] }}</button>
                    </div>
                </div>
            </div>
        </div>
    </div>
    @else
    <div class="card mb-3">
        <div class="card-header no-bg p-min pt-4 px-4">
            <div>
                <div class="card-title mb-3">
                    <span><i class="ri-user-line no-mr"></i> {{ App\System\Model\UserGroupModel::beRenderUserName($post['name'].' '.$post['surname'],$usergroups[$post['usergroup']]['ugnamestyle']) }}</span>
                </div>
                <div class="card-title">
                    <span><button class="btn btn-transparent btn-sm" role="none">{{ $usergroups[$post['usergroup']]['ugname'] }}</button></span>
                </div>
            </div>
        </div>
        <div class="card-content no-p px-4 mb-3 pb-3">
            <div class="row">
                <div class="col-12">
                    <hr>
                    {{ $post['tpmessage'] }}
                </div>
                <div class="col-12">
                    <hr>
                    @if($post['attachments'])
                    @foreach($post['attachments'] as $attachment)
                    <div class="p-2 card btn-transparent">
                        <div class="row-flex row-align">
                            <span class="svg-icon svg-icon-2x me-1" style="color:#009ef7">
                                <svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
                                    <path opacity="0.3" d="M19 22H5C4.4 22 4 21.6 4 21V3C4 2.4 4.4 2 5 2H14L20 8V21C20 21.6 19.6 22 19 22Z" fill="currentColor"></path>
                                    <path d="M15 8H20L14 2V7C14 7.6 14.4 8 15 8Z" fill="currentColor"></path>
                                </svg>
                            </span>
                            <a href="{{ beGetRoute('file.show',['slug' => $attachment['aslug'],'aid' => $attachment['aid']]) }}" target="_blank" style="color:#009ef7!important">{{ $attachment['aname'] }}</a>
                        </div>
                        <div class="mt-2 row-flex text-sm">
                            <span class="mr-1">{{ beConvertSize($attachment['asize']) }}</span>
                            <span class="mr-1">-</span>
                            <span>{{ beSpecialTime($attachment['adateline']) }}</span>
                        </div>
                    </div>
                    @endforeach
                    @endif
                    <div class="row-flex row-end mt-3">
                        <button class="btn btn-transparent btn-sm mr-2" role="none">{{ beSpecialTime($post['tpdateline']) }}</button>
                    </div>
                </div>
            </div>
        </div>
    </div>
    @endif
@endforeach