@php
    $pages = HelpDesk::elementPagesByArgs($args);
@endphp

<section class="default-el">
    <div class="container">
        @if (isset($args['title']) || isset($args['view_all']) || isset($args['page_id']))
        <div class="section-head">
            <div class="content">
                <p class="sub-title">{{ isset($args['subtitle']) ? $args['subtitle'] : '' }}</p>
                <h2 class="title">{{ isset($args['title']) ? $args['title'] : '' }}</h2>
                <p class="description">{{ isset($args['description']) ? $args['description'] : '' }}</p>
            </div>

            <div>
                @if (isset($args['view_all']) && $args['view_all'] == 'true')

                <a 
                    href="{{ isset($args['page_id']) ? DzHelper::laraPageLink($args['page_id']) : 'javascript:void(0);' }}"
                    class="btn btn-outline light style-1 ms-auto p-2 group button--stroke flairBtn magneticBtn" 
                    data-block="button"
                >
                    <span class="button-flair"></span>
                    <span class="button__label font-normal xl:ps-25 px-10 inline-flex items-center gap-14">{{ __('View All') }}</span>
                    <span class="inline-flex justify-center items-center size-32 rounded-full dark:bg-primary dark:text-secondary bg-secondary text-white duration-100 dark:group-hover:bg-secondary dark:group-hover:text-white group-hover:bg-white group-hover:text-secondary z-1">
                        <i class="fa-solid fa-arrow-right text-sm"></i>
                    </span>
                </a>
                @endif
            </div>
        </div>
        @endif
        <div class="page-list row">
            @forelse($pages as $page)
            <div class="lg:w-3/12 mb-30 sm:w-1/2"> 
				<div class="page-listing-box dark:!bg-card">
					<h5 class="mb-15">{{ $page->title }}</h5>
					<p class="mb-20">{{ $page->excerpt }}</p>
					<a class="btn btn-primary btn-sm" href="{{ DzHelper::laraPageLink($page->id) }}">{{ __('Go to Page') }}</a>
				</div>
			</div>
            @empty
            @endforelse
        </div>
        @if (isset($args['pagination']) && ($args['pagination'] == true))
        <div class="w-full">
            {!! $pages->links('elements.pagination') !!}
        </div>
        @endif
    </div>
</section>