Untitled

mail@pastecode.io avatar
unknown
plain_text
7 months ago
13 kB
1
Indexable
Never
<div>
    <div>
        <div class="pb-4 rounded-lg flex flex-col flex-wrap">
            <div class="rounded-lg w-full flex flex-row items-center gap-4 justify-between">
                <ul class="flex items-center flex-row flex-wrap gap-2">
                    <li>
                        <div class="relative w-52" wire:key="{{ \Illuminate\Support\Str::random() }}">
                            <x:form.custom-select
                                placeholder="Researcher"
                                :options="$researchers"
                                wire:model="filters.selectedResearcher"/>
                        </div>
                    </li>
                    <li>
                        <div wire:key="{{ \Illuminate\Support\Str::random() }}" class="relative w-52">
                            <x:custom-multiselect
                                trigger="Creator"
                                selected="filters.selectedCreators"
                                items="creators"
                                :setValueOnClose="true"/>
                        </div>
                    </li>
                    @if($this->filters['selectedCreators'])
                        <li>
                            <div wire:key="{{ \Illuminate\Support\Str::random() }}" class="relative w-52">
                                <x:custom-multiselect
                                    trigger="Channels"
                                    selected="filters.selectedChannels"
                                    items="channels"
                                    :setValueOnClose="false"/>
                            </div>
                        </li>
                    @endif

                    <li>
                        <div wire:key="{{ \Illuminate\Support\Str::random() }}" class="relative w-52">
                            <x:form.custom-select
                                placeholder="Is Created Before"
                                :options="$isCreatedBefore"
                                wire:model="filters.isCreatedBefore"/>
                        </div>
                    </li>

                </ul>
                <div class="">
                    <x:buttons.primary type="button"
                                       wire:click="$emit('openGenerateCompilationModal')"
                                       class="flex items-center !bg-emerald-400 !hover:bg-emerald-700">
                        <x:icons.sparkles/>
                        <span class="ml-1">Generate</span>
                    </x:buttons.primary>
                </div>

            </div>
        </div>
    </div>

    <div x-data="{ openAdvance : false}">
        <x:table.table>
            <div class="flex items-center justify-between">
                <div class="pt-2 pb-2 px-2 flex items-center gap-2">
                    @if(auth()->user()->hasRole(\App\Enums\RoleEnum::Researcher()) && auth()->user()->hasRole(\App\Enums\RoleEnum::CreatorPosts()))
                        <button wire:click.prevent="$emit('updateCreatorTableTab', 'posts')"
                                class="inline-flex items-center rounded-md text-sm tab-inactive">
                            <x:icons.video-camera class="w-5 mr-0 md:mr-3"/>
                            Posts
                        </button>
                    @endif
                    @if(auth()->user()->hasRole(\App\Enums\RoleEnum::Researcher()) && auth()->user()->hasRole(\App\Enums\RoleEnum::Compilations()))
                        <button wire:click.prevent="$emit('updateCreatorTableTab', 'compilations')"
                                class="inline-flex items-center rounded-md text-sm tab-active">
                            <x:icons.globe class="w-5 mr-0 md:mr-3"/>
                            AI Compilations
                        </button>
                    @endif
                </div>
                <div class="relative w-64">
                    <div class="absolute inset-y-0 left-0 pl-3 flex items-center">
                        <x:icons.search class="h-5 w-5 text-gray-400"/>
                    </div>
                    <x:form.input type="search" wire:model.lazy="query" placeholder="Search" class="pl-10"/>
                </div>
            </div>
            <x:table.thead :fields="['Thumbnail','Task Name','Date Added','Used Post','Channel','Task Count', '', '']"/>

            <x:table.tbody>
                @forelse($compilations as $key => $compilation)
                    <div>
                        <x:table.tr>
                            <x-table.td class="w-40 flex items-center gap-2 pl-3" :is-first="true">
                                @foreach($compilation->creatorPosts as $index => $post)
                                    @if($index === 0)
                                        <a href="{{$post->permalink}}" target="_blank">
                                            <div class="relative inline-block">
                                                <img src="{{ $post->full_thumbnail_url}}"
                                                     alt="Post Image"
                                                     class=" object-cover hover:opacity-75 animation ease-in-out duration-200 rounded-md">
                                                @if( $post->links_exists)
                                                    <div
                                                        class="absolute top-2 left-2 bg-black bg-opacity-50 text-red-100 px-2 py-1 rounded-md">
                                                        Used
                                                    </div>
                                                @endif
                                            </div>
                                        </a>
                                        @break
                                    @endif
                                @endforeach
                            </x-table.td>

                            <x:table.td>
                                <div class="flex flex-row flex-nowrap">
                                    <p class="text-center max-w-full overflow-hidden overflow-ellipsis whitespace-nowrap">
                                    <span title="{{$post->title}}" class="dark:text-white">
                                        {{ \Illuminate\Support\Str::limit($post->title, 30) ?? '-' }}
                                    </span>
                                    </p>
                                </div>
                            </x:table.td>

                            <x:table.td>

                                <div class="flex flex-auto flex-col dark:text-white">
                                    <div class="flex text-sm">
                                    <span>
                                        {{format_date_to_readable($compilation->created_at)}}
                                    </span>
                                    </div>
                                    <div class="flex flex-row ">
                                        <div class="rounded-md flex">
                                    <span
                                        class="text-sm whitespace-nowrap text-gray-500">{{ $compilation->user->name  ?? ''}}</span>
                                        </div>
                                    </div>
                                </div>
                            </x:table.td>

                            <x:table.td>
                                <div class="flex flex-auto flex-col ml-2 dark:text-white">
                                    <div class="rounded-md flex items-center text-primary">
                                        <span class="flex flex-auto ">
                                            {{$compilation->highest_similarity}}
                                        </span>
                                    </div>
                                </div>
                            </x:table.td>

                            <x:table.td>
                                <div class="flex flex-auto flex-col">
                                    <div class="rounded-md dark:text-white">
                                        <a href="{{$compilation->creatorChannel?->full_permalink}}"
                                           target="_blank">
                                <span>
                                    {{$compilation->creatorChannel?->name}}
                                </span>
                                        </a>
                                    </div>
                                </div>
                            </x:table.td>

                            <x:table.td>
                                <div class="flex flex-auto flex-col dark:text-white">
                                    ----
                                </div>
                            </x:table.td>

                            <x:table.td>
                                <div class="flex items-center justify-end ">
                                    <a href="{{ route('publish.workflow.inventory.creators.compilation', ['compilation' => $compilation, 'view' => 'creators']) }}">
                                        <button
                                            class="active:bg-indigo-400 bg-indigo-400 border border-transparent duration-150 ease-in-out focus:border-indigo-400 focus:outline-none focus:shadow-outline-primary font-medium hover:bg-indigo-500 inline-flex justify-center leading-5 px-2 py-1 rounded-md text-sm text-white transition">
                                            View Compilation
                                        </button>
                                    </a>
                                </div>
                            </x:table.td>

                            <x:table.td>
                                <button x-show="!openAdvance" @click="openAdvance = !openAdvance"
                                        type="button"
                                        class="flex items-center gap-2 focus:outline-none outline-none font-normal">
                                    <x:icons.chevron-down
                                        :class="{'transform rotate-180': openAdvance, 'transform rotate-0': !openAdvance}"
                                        class="w-5 h-5 transition-transform duration-200 dark:text-gray-300"/>
                                </button>
                            </x:table.td>
                        </x:table.tr>

                        <x:table.tr x-show="openAdvance">
                            <td colspan="100%">
                                <div class="">
                                    <div
                                        class="bg-gray-100 dark:bg-gray-900 p-1 mt-1 flex gap-4 overflow-x-auto w-[1289px]">
                                        @foreach($compilation->creatorPosts as $post)
                                            @include('front.publish.workflow.inventory.partials.creator-post', [$post])
                                        @endforeach
                                    </div>
                                    <div class="col-span-12 flex flex-col mt-2">
                                        <div class="flex justify-center">
                                            <button @click="openAdvance = false"
                                                    type="button"
                                                    class="flex items-center gap-2 focus:outline-none outline-none font-normal">
                                                <x:icons.chevron-down
                                                    class="w-5 h-5 transition-transform duration-200 transform rotate-180 dark:text-gray-300"/>
                                            </button>
                                        </div>
                                    </div>
                                </div>
                            </td>
                        </x:table.tr>
                    </div>
                @empty
                    <x:table.empty-row/>
                @endforelse
            </x:table.tbody>

        </x:table.table>

        @if(count($compilations)==0)
            <div class="pl-4 text-md text-gray-700">
                There are no compilations available with current filters
            </div>
        @endif
        <div class="mb-2 ml-2 mr-2 mt-2">
            {{$compilations->links()}}
        </div>
    </div>
    <livewire:front.publish.workflow.inventory.creators.modals.generate-compilation-modal/>
</div>


Leave a Comment