@extends('layouts.app')
@section('title')录入-工作组@endsection

@section('content')
    <div id="nav2">
        @component('maintenance.menu')@endcomponent
        @component('maintenance.userWorkgroup.menu')@endcomponent
    </div>
    <div class="container-fluid mt-3">
        <div class="card col-md-8 offset-md-2">
            <div class="card-body" id="list">
                <form method="POST" action="{{ url('maintenance/userWorkgroup') }}">
                    @csrf
                    <div class="form-group row">
                        <label for="warehouse_id" class="col-2 col-form-label text-right">仓库名称</label>
                        <div class="col-8">
                            <select id="warehouse_id" type="text" class="form-control @error('warehouse_id') is-invalid @enderror" name="warehouse_id" autocomplete="off"  >
                                <option></option>
                                <option v-for="warehouse in warehouses" :value="warehouse.id">@{{ warehouse.name }}</option>
                            </select>
                            @error('warehouse_id')
                            <span class="invalid-feedback" role="alert">
                                        <strong>{{ $message }}</strong>
                                    </span>
                            @enderror
                        </div>
                    </div>
                    <div class="form-group row">
                        <label for="name" class="col-2 col-form-label text-right">工作组名称</label>
                        <div class="col-8">
                            <input type="text" class="form-control @error('name') is-invalid @enderror"
                                   name="name" autocomplete="off" value="{{ old('name') }}" >
                            @error('name')
                            <span class="invalid-feedback" role="alert">
                                        <strong>{{ $message }}</strong>
                                    </span>
                            @enderror
                        </div>
                    </div>
                    <div class="form-group row">
                        <label for="remark" class="col-2 col-form-label text-right">进组时需要备注</label>
                        <div class="col-8">
                            <select id="remark" type="text" class="form-control @error('remark') is-invalid @enderror" name="remark" autocomplete="off"  >
                                <option value="是">是</option>
                                <option value="否" selected>否</option>
                            </select>
                            @error('remark')
                            <span class="invalid-feedback" role="alert">
                                        <strong>{{ $message }}</strong>
                                    </span>
                            @enderror
                        </div>
                    </div>
                    <div class="form-group row">
                        <div class="col-8 offset-2">
                            <input type="submit" class="btn btn-success form-control">
                        </div>
                    </div>
                </form>
            </div>
        </div>
    </div>
@endsection
@section('lastScript')
    <script>
        new Vue({
            el:'#list',
            data:{
                warehouses:[
                    @foreach($warehouses as $warehouse)
                    {id:'{{$warehouse->id}}',name:'{{$warehouse->name}}'},
                    @endforeach
                ],
            },
        });
    </script>
@endsection
