@extends('admin.layout.master')

@section('title', 'Sayfalar')

@section('breadcrumb')

    <div class="container-fluid px-4">
        <nav aria-label="breadcrumb">
            <ol class="breadcrumb my-0">
                <li class="breadcrumb-item"><a href="{{ route('admin.dashboard.index') }}">Anasayfa</a></li>
                <li class="breadcrumb-item active"><span>Formlar</span></li>
            </ol>
        </nav>
    </div>
@stop

@section('content')

    <div class="container-lg px-4">

        @can('page.create')
            <div class="row mb-4">
                <div class="d-flex justify-content-end">
                    <a href="{{ route('admin.forms.create') }}" class="btn btn-sm btn-primary">
                    <span class="cil-plus"></span>
                        Yeni Form
                    </a>
                </div>
            </div>
        @endcan

        <div class="row">
            <div class="col-12">
                <div class="card mb-4">
                    <livewire:admin.forms.index />
                </div>
            </div>
        </div>
    </div>

@section('css')
    <link href="{{ URL::to('admin/vendors/@coreui/icons/css/free.min.css') }}" rel="stylesheet">
@stop

@section('js')

    <script>
        const toastConfig = {
            toast: true,
            position: 'top-end',
            showConfirmButton: false,
            timer: 2000,
            timerProgressBar: true,
        };

        document.addEventListener('livewire:init', () => {
            Livewire.on('showAlert', (event) => {
                Swal.fire({
                    ...toastConfig,
                    text: event[0].text,
                    icon: event[0].icon,
                });
            });
        });
    </script>
@stop

@stop
