@extends('admin.layouts.app')

@section('title', __('admin/ticket-predefined-replies.title'))

@section('content')
<div class="container-fluid px-4">
    <x-admin.page-header
        :title="__('admin/ticket-predefined-replies.title')"
        icon="fas fa-reply-all"
        :buttons="[
            ['label' => __('admin/ticket-predefined-replies.actions_create'), 'route' => route('admin.ticket-predefined-replies.create'), 'icon' => 'fas fa-plus', 'color' => 'primary', 'permission' => 'create ticket-predefined-reply'],
        ]"
    />

    <x-admin.card>
        <x-admin.data-table id="ticketPredefinedReplies" :records-url="route('api.admin.ticket-predefined-replies.records')">
            <th>{{ __('admin/ticket-predefined-replies.fields_title') }}</th>
            <th>{{ __('admin/ticket-predefined-replies.fields_content') }}</th>
            <th>{{ __('admin/ticket-predefined-replies.fields_departments') }}</th>
            <th>{{ __('admin/ticket-predefined-replies.fields_roles') }}</th>
            <th>{{ __('admin/ticket-predefined-replies.fields_status') }}</th>
            <th>{{ __('admin/ticket-predefined-replies.fields_created_at') }}</th>
            <th>{{ __('admin/ticket-predefined-replies.fields_actions') }}</th>
        </x-admin.data-table>
    </x-admin.card>
</div>
@endsection

@push('scripts')
<script>
    window.permissions = {
        ticketPredefinedReplies: {
            update: {{ json_encode(Auth::user()->can('updateAny', App\Models\TicketPredefinedReply::class)) }},
            delete: {{ json_encode(Auth::user()->can('deleteAny', App\Models\TicketPredefinedReply::class)) }}
        }
    };

    window.routes = {
        ticketPredefinedReplies: {
            edit: '{{ route("admin.ticket-predefined-replies.edit", ":id") }}',
            delete: '{{ route("api.admin.ticket-predefined-replies.destroy", ":id") }}'
        }
    };

    window.translations = {
        buttons: {
            edit: '{{ __("admin/ticket-predefined-replies.buttons_edit") }}',
            delete: '{{ __("admin/ticket-predefined-replies.buttons_delete") }}'
        },
        status: {
            active: '{{ __("admin/ticket-predefined-replies.status_active") }}',
            inactive: '{{ __("admin/ticket-predefined-replies.status_inactive") }}'
        },
        messages: {
            delete_confirm: '{{ __("admin/ticket-predefined-replies.messages_delete_confirm") }}',
            delete_success: '{{ __("admin/ticket-predefined-replies.messages_deleted") }}',
            delete_error: '{{ __("admin/ticket-predefined-replies.messages_delete_error") }}'
        }
    };
</script>
@vite('resources/js/admin/ticket-predefined-replies/index.js')
@endpush