<x-app-layout>
    <x-slot name="header">
        <div class="row">
            <div class="col-6">
                <h4 class="" title><i class="circular icon fa fa-list"></i> {{ __('Cruises')  }} </h4>
            </div>
            <div class="col-6">
                @can('add_cruise')
                    <a v-on:click="create()" class="btn btn-primary btn-sm float-right" href="#"><i class="fas fa-plus-circle"></i> {{ __('Create') }}</a>
                @endcan
            </div>
        </div>
    </x-slot>
    <div class="row">
        <div class="col-12">
            <div class="card">
                <div class="card-body">
                    {{$dataTable->table()}}
                </div>
            </div>
        </div>  
            @can('add_cruise')
                @include('cruises.form')
            @endcan
    </div>


    <x-slot name="after_script">
        {{$dataTable->scripts()}}
        <script>
                var app = new Vue({
                    el: '#app',
                    mixins: [ FormMixin, DestroyMixin, FetchMixin],
                    data: {
                        action: "{{ route('cruises.store') }}",
                        table: "cruises-table",
                        modal: 'Idmodal',
                        ships: [],
                        ports: []
                    },
                    methods: {
                        fetchShips(search, loading){
                            const vm = this;
                            this.fetchOptions("{{route('ships.search')}}",search, loading,function(res){
                                vm.ships = res.data;
                            });
                        },
                        fetchPorts(search, loading){
                            const vm = this;
                            this.fetchOptions("{{route('ports.search')}}",search, loading,function(res){
                                vm.ports = res.data;
                            });
                        },
                    }
                })
        </script>
        
    </x-slot>
</x-app-layout>
