@extends('admin.layout')
<style type="text/css">

</style>
@section('header')

@endsection

@section('content')
<div id="sg-main-container-sg">
    <div class="wrapper wrapper-content animated fadeInRight">
        <div class="row">
            <div class="col-sm-12">
                <div class="ibox float-e-margins">
                    <div class="ibox-title">
                        <h5>{{ '添加' . $model_name }}</h5>
                        <div class="ibox-tools">
                            <a class="collapse-link"> <i class="fa fa-chevron-up"></i>
                            </a>
                        </div>
                    </div>
                    <div class="ibox-content">
                        <div class="row">
                            <div class="col-sm-12 pull-right">
                                <a href="{{ $pre_uri . 'index' }}" class="btn btn-sm btn-primary pull-right">返回列表</a>
                            </div>
                        </div>
                        <form class="form-horizontal" method="POST" action="{{ $pre_uri . 'store' }}">
                            {{ csrf_field() }}

                            <div class="form-group row {{ $errors->has('name') ? 'has-error' : '' }}">
                                <label class="col-sm-2 col-sm-offset-1 control-label">学员姓名</label>
                                <div class="col-sm-8">
                                    <input type="text" name="data[name]" class="form-control" placeholder="请输入学员姓名" value="{{ isset(old('data')['name']) ? old('data')['name'] : '' }}" required>
                                    @if($errors->has('name'))
                                        <span class="help-block">{{ $errors->first('name') }}</span>
                                    @endif
                                </div>
                            </div>

                            <div class="form-group row {{ $errors->has('phone') ? 'has-error' : '' }}">
                                <label class="col-sm-2 col-sm-offset-1 control-label">手机</label>
                                <div class="col-sm-8">
                                    <input type="text" name="data[phone]" class="form-control" placeholder="请输入学员手机" value="{{ isset(old('data')['phone']) ? old('data')['phone'] : '' }}" required>
                                    @if($errors->has('phone'))
                                        <span class="help-block">{{ $errors->first('phone') }}</span>
                                    @endif
                                </div>
                            </div>

                            <div class="form-group row">
                                <label class="col-sm-2 col-sm-offset-1 control-label">年龄</label>
                                <div class="col-sm-8">
                                    <input type="text" name="data[age]" class="form-control" placeholder="请输入年龄" value="{{ isset(old('data')['age']) ? old('data')['age'] : '' }}" required>
                                </div>
                                @if($errors->has('age'))
                                    <span class="help-block">{{ $errors->first('age') }}</span>
                                @endif
                            </div>

                            <div class="form-group row">
                                <label class="col-sm-2 col-sm-offset-1 control-label">婚姻状况</label>
                                <div class="col-sm-8">
                                    <select name="data[marry]" class="form-control">
                                        @foreach($model->getMarryList() as $marry)
                                            <option value="{{ $marry['key'] }}" {{ isset(old('data')['marry']) && old('data')['marry'] == $marry['key'] ? 'selected' : '' }}>{{ $marry['show_value'] }}</option>
                                        @endforeach
                                    </select>
                                </div>
                                @if($errors->has('marry'))
                                    <span class="help-block">{{ $errors->first('marry') }}</span>
                                @endif
                            </div>

                            <div class="form-group row">
                                <label class="col-sm-2 col-sm-offset-1 control-label">职业</label>
                                <div class="col-sm-8">
                                    <input type="text" name="data[job]" class="form-control" placeholder="请输入职业" value="{{ isset(old('data')['job']) ? old('data')['job'] : '' }}">
                                </div>
                                @if($errors->has('job'))
                                    <span class="help-block">{{ $errors->first('job') }}</span>
                                @endif
                            </div>

                            <div class="form-group row">
                                <label class="col-sm-2 col-sm-offset-1 control-label">工作地点</label>
                                <div class="col-sm-8">
                                    <input type="text" name="data[work_addr]" class="form-control" placeholder="请输入工作地点" value="{{ isset(old('data')['work_addr']) ? old('data')['work_addr'] : '' }}">
                                </div>
                                @if($errors->has('work_addr'))
                                    <span class="help-block">{{ $errors->first('work_addr') }}</span>
                                @endif
                            </div>

                            <div class="form-group row">
                                <label class="col-sm-2 col-sm-offset-1 control-label">住址</label>
                                <div class="col-sm-8">
                                    <input type="text" name="data[addr]" class="form-control" placeholder="请输入住址" value="{{ isset(old('data')['addr']) ? old('data')['addr'] : '' }}">
                                </div>
                                @if($errors->has('addr'))
                                    <span class="help-block">{{ $errors->first('addr') }}</span>
                                @endif
                            </div>

                            <div class="form-group row">
                                <label class="col-sm-2 col-sm-offset-1 control-label">指纹编号</label>
                                <div class="col-sm-8">
                                    <input type="text" name="data[finger_number]" class="form-control" placeholder="请输入指纹编号" value="{{ isset(old('data')['finger_number']) ? old('data')['finger_number'] : '' }}">
                                </div>
                                @if($errors->has('finger_number'))
                                    <span class="help-block">{{ $errors->first('finger_number') }}</span>
                                @endif
                            </div>

                            <div class="form-group row">
                                <label class="col-sm-2 col-sm-offset-1 control-label">备注</label>
                                <div class="col-sm-8">
                                    <textarea name="data[remark]" class="form-control">{{ isset(old('data')['remark']) ? old('data')['remark'] : '' }}</textarea>
                                </div>
                                @if($errors->has('remark'))
                                    <span class="help-block">{{ $errors->first('remark') }}</span>
                                @endif
                            </div>

                            <div class="form-group row">
                                <label class="col-sm-2 col-sm-offset-1 control-label">请假次数（短假）</label>
                                <div class="col-sm-8">
                                    <input type="text" name="data[short_leave_times]" class="form-control" placeholder="请输入请假次数（短假）" value="{{ isset(old('data')['short_leave_times']) ? old('data')['short_leave_times'] : '0' }}">
                                </div>
                                @if($errors->has('short_leave_times'))
                                    <span class="help-block">{{ $errors->first('short_leave_times') }}</span>
                                @endif
                            </div>
                            
                            <div class="form-group row">
                                <label class="col-sm-2 col-sm-offset-1 control-label">请假次数（长假）</label>
                                <div class="col-sm-8">
                                    <input type="text" name="data[long_leave_times]" class="form-control" placeholder="请输入请假次数（长假）" value="{{ isset(old('data')['long_leave_times']) ? old('data')['long_leave_times'] : '0' }}">
                                </div>
                                @if($errors->has('long_leave_times'))
                                    <span class="help-block">{{ $errors->first('long_leave_times') }}</span>
                                @endif
                            </div>

                            <div class="form-group row">
                                <div class="col-sm-8 col-sm-offset-3">
                                    <button type="submit" class="btn btn-sm btn-primary">提交</button>
                                </div>
                            </div>
                        </form>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
@endsection

@section('footer')
<script type="text/javascript">
$(function () {

})
</script>
@endsection