HEX
Server: LiteSpeed
System: Linux srv1.dhviews.com 5.14.0-570.23.1.el9_6.x86_64 #1 SMP PREEMPT_DYNAMIC Tue Jun 24 11:27:16 EDT 2025 x86_64
User: bdedition (1723)
PHP: 7.4.33
Disabled: NONE
Upload Files
File: /home/bdedition/www/core/resources/views/admin/category/index.blade.php
@extends('admin.layouts.app')
@section('panel')
    <div class="row">
        <div class="col-lg-12">
            <div class="card">
                <div class="card-body p-0">
                    <div class="table-responsive--md  table-responsive">
                        <table class="table table--light style--two">
                            <thead>
                                <tr>
                                    <th>@lang('Name')</th>
                                    <th>@lang('Slug')</th>
                                    <th>@lang('Status')</th>
                                    <th>@lang('Action')</th>
                                </tr>
                            </thead>
                            <tbody>
                                @forelse($categories as $category)
                                    <tr>
                                        <td><span class="fw-bold">{{ __($category->name) }}</span></td>
                                        <td><span class="fw-bold">{{ __($category->slug) }}</span></td>
                                        <td>@php echo $category->statusBadge; @endphp</td>
                                        <td>
                                            <button class="btn btn-sm btn-outline--info" data-bs-toggle="dropdown"
                                                type="button" aria-expanded="false"><i
                                                    class="las la-ellipsis-v"></i>@lang('More')</button>
                                            <div class="dropdown-menu">
                                                <button class="dropdown-item threshold editBtn"
                                                    data-action="{{ route('admin.category.store', $category->id) }}"
                                                    data-category="{{ $category }}" data-title="Edit Category">
                                                    <i class="la la-pencil"></i> @lang('Edit')
                                                </button>
                                                <a href="{{ route('admin.category.seo', $category->id) }}"
                                                    class="dropdown-item threshold">
                                                    <i class="la la-cog"></i> @lang('SEO Setting')
                                                </a>
                                                @if ($category->status == Status::DISABLE)
                                                    <button class="dropdown-item threshold confirmationBtn"
                                                        data-question="@lang('Are you sure to enable this category?')"
                                                        data-action="{{ route('admin.category.status', $category->id) }}">
                                                        <i class="la la-eye"></i> @lang('Enable')
                                                    </button>
                                                @else
                                                    <button class="dropdown-item threshold confirmationBtn"
                                                        data-question="@lang('Are you sure to disable this category?')"
                                                        data-action="{{ route('admin.category.status', $category->id) }}">
                                                        <i class="la la-eye-slash"></i> @lang('Disable')
                                                    </button>
                                                @endif
                                            </div>
                                        </td>
                                    </tr>
                                @empty
                                    <tr>
                                        <td class="text-muted text-center" colspan="100%">{{ __($emptyMessage) }}</td>
                                    </tr>
                                @endforelse
                            </tbody>
                        </table>
                    </div>
                </div>
                @if ($categories->hasPages())
                    <div class="card-footer py-4">
                        {{ paginateLinks($categories) }}
                    </div>
                @endif
            </div>
        </div>
    </div>

    <div class="modal fade" id="categoryModal">
        <div class="modal-dialog">
            <div class="modal-content">
                <div class="modal-header">
                    <h4 class="modal-title"></h4>
                    <button type="button" class="close" data-bs-dismiss="modal" aria-label="Close">
                        <i class="las la-times"></i>
                    </button>
                </div>
                <form class="form-horizontal disableSubmission" method="post">
                    @csrf
                    <div class="modal-body">
                        <div class="form-group">
                            <label class="form-label">@lang('Name')</label>
                            <div class="col-sm-12">
                                <input type="text" class="form-control" name="name" value="{{ old('name') }}"
                                    required>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="form-label">@lang('Slug')</label>
                            <div class="col-sm-12">
                                <input type="text" class="form-control" name="slug" value="{{ old('slug') }}"
                                    required>
                            </div>
                        </div>
                    </div>
                    <div class="modal-footer">
                        <button type="submit" class="btn btn--primary w-100 h-45">@lang('Submit')</button>
                    </div>
                </form>
            </div>
        </div>
    </div>

    <x-confirmation-modal />
@endsection

@push('breadcrumb-plugins')
    <x-search-form placeholder="Search..." />
    <button class="btn btn-outline--primary btn-sm addBtn" data-action="{{ route('admin.category.store') }}"
        data-title="Add Category">
        <i class="fa fa-fw fa-plus"></i> @lang('Add New')
    </button>
@endpush

@push('script')
    <script>
        (function($) {
            "use strict";

            $('.addBtn').on('click', function() {
                let modal = $('#categoryModal');
                modal.find('[name=name]').val('');
                modal.find('[name=slug]').val('');
                modal.find('.modal-title').text($(this).data('title'));
                modal.find('form').attr('action', $(this).data('action'));
                modal.modal('show');
            });

            $('.editBtn').on('click', function() {
                let modal = $('#categoryModal');
                let category = $(this).data('category');
                modal.find('[name=name]').val(category.name);
                modal.find('[name=slug]').val(category.slug);
                modal.find('.modal-title').text($(this).data('title'));
                modal.find('form').attr('action', $(this).data('action'));
                modal.modal('show');
            });
        })(jQuery);
    </script>
@endpush