@extends('layouts.app')
@section('title')查询-入库管理@endsection

@section('content')
    <span id="nav2">
        @component('store.menu')@endcomponent
        @component('store.fast.menu')@endcomponent
    </span>
    <div class="d-none" id="fast">
        <div class="container-fluid">
            <table class="table table-striped table-sm text-nowrap table-hover td-min-width-80" id="table">
                <tr v-for="(store,i) in stores" @click="selectTr===i+1?selectTr=0:selectTr=i+1" :class="selectTr===i+1?'focusing' : ''">
                    <td>
                        <input class="checkItem" type="checkbox" :value="store.id">
                    </td>
                    <td><span>@{{ i+1  }}</span></td>
                    <td class="text-muted"><span>@{{store.asn_code}}</span></td>
                    <td><span>@{{store.warehouse ? store.warehouse.name : ''}}</span></td>
                    <td class="text-muted"><span>@{{store.owner ? store.owner.name : ''}}</span></td>
                    <td class="text-muted"><span>@{{store.stored_method}}</span></td>
                    <td class="text-muted"><span>@{{store.status}}</span></td>
                    <td><span>@{{store.remark}}</span></td>
                    <td class="text-muted"><span>@{{store.created_at}}</span></td>
                </tr>
            </table>
            <div class="text-info h5 btn btn">{{$stores->count()}}/{{$stores->total()}}</div>
            {{$stores->links()}}
        </div>
    </div>
@endsection

@section('lastScript')
    <script type="text/javascript" src="{{mix('js/queryForm/header.js')}}"></script>{{--新版2--}}
    <script>
        let vue = new Vue({
            el:'#fast',
            data:{
                stores:[
                @foreach($stores as $store)
                {!! $store !!},
                @endforeach
                ],
                selectTr:''
            },
            mounted:function(){
                $('#fast').removeClass('d-none');
                let column = [
                    {name:'index',value: '序号', neglect: true},
                    {name:'asn_code',value: 'ASN编号'},
                    {name:'warehouse_name',value: '仓库'},
                    {name:'owner_name',value: '货主'},
                    {name:'stored_method',value: '入库类型'},
                    {name:'status',value: '状态'},
                    {name:'remark',value: '备注'},
                    {name:'created_at',value: '生成时间'},
                ];
                new Header({
                    el: "table",
                    name: "storeFast",
                    column: column,
                    data: this.stores,
                }).init();
            }
        });
    </script>
@endsection
