@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 . 'update' }}">
                            {{ csrf_field() }}

                            <input type="hidden" name="id" value="{{ $item->id }}">
                            <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[name]" class="form-control" placeholder="请输入讲师姓名" value="{{ $item->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="{{ $item->phone }}" required>
                                    @if($errors->has('phone'))
                                        <span class="help-block">{{ $errors->first('phone') }}</span>
                                    @endif
                                </div>
                            </div>

                            <div class="form-group row {{ $errors->has('is_update_password') ? 'has-error' : '' }}">
                                <label class="col-sm-2 col-sm-offset-1 control-label">更新密码</label>
                                <div class="col-sm-8">
                                    <label class="radio-inline">
                                        <input type="radio" name="is_update_password" value="1">是
                                    </label>
                                    <label class="radio-inline">
                                        <input type="radio" name="is_update_password" value="2" checked>否
                                    </label>
                                </div>
                            </div>

                            <div class="form-group row {{ $errors->has('password') ? 'has-error' : '' }}">
                                <label class="col-sm-2 col-sm-offset-1 control-label">登录密码</label>
                                <div class="col-sm-8">
                                    <input type="text" name="password" class="form-control" placeholder="请输入登录密码">
                                    @if($errors->has('password'))
                                        <span class="help-block">{{ $errors->first('password') }}</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">
                                    <select class="form-control" multiple="multiple" name="courses[]" id="sg-multi-select">
                                        @foreach($courses as $course)
                                            <option value="{{ $course->id }}">{{ $course->name }}</option>
                                        @endforeach
                                    </select>
                                </div>
                            </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 () {
    $('#sg-multi-select').multiSelect().multiSelect('select', "{{ $ids_string }}".split(','));
})
</script>
@endsection