@extends('admin.layout')

@section('content')

<?php
    if(!isset($data)) $data = array();
    if(!$data && session("data")){
        $data = session("data");
    }
    if(!$data && session('_old_input')){
        $data = session("_old_input");
    }
?>
<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>用户管理</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-3 pull-right">
    					   <a href="{{ U('User/Info/index')}}" class="btn btn-sm btn-primary pull-right">返回列表</a>
    					</div>
					</div>
		            <div class="row">
                        <div class="col-lg-10">
                            <form name="form_product" id="form-validation" action="" class="form-horizontal form-validation" accept-charset="UTF-8" method="post">
                                <div class="form-group">
                                    <label class="control-label col-sm-3">手机号</label>
                                    <div class="col-sm-9">
                                        <input id="data_phone" name="data[phone]" isMobile="true" class="form-control" value="{{ $data['phone'] or ''}}" required="" aria-required="true"  placeholder="">
                                    </div>
                                </div>

                                <div class="form-group">
                                    <label class="control-label col-sm-3">昵称</label>
                                    <div class="col-sm-9">
                                       <input id="data_nickname" name="data[nickname]" class="form-control" value="{{ $data['nickname'] or ''}}" required="" aria-required="true"  placeholder="">
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label class="control-label col-sm-3">用户头像</label>
                                    <div class="col-sm-9">
                                        {!!  widget('Tools.ImgUpload')->single2('/upload/user','avatar',"avatar", isset($data['avatar'])? $data['avatar'] : "") !!}
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label class="control-label col-sm-3">生日</label>
                                    <div class="col-sm-9">
                                         <input id="data_birthday" name="data[birthday]"  class="form-control" value="{{ $data['birthday'] or ''}}" required="" aria-required="true"  placeholder="">
                                    </div>
                                </div>
                                <div class="form-group">
                                     <label class="control-label col-sm-3">梦想币余额</label>
                                     <div class="col-sm-9">
                                         <input id="data_coin" name="data[coin]" class="form-control" value="{{ $data['coin'] or ''}}" required="" aria-required="true"  placeholder="">
                                     </div>
                                </div>

                                <div class="form-group">
                                    <label class="control-label col-sm-3">性别</label>
                                   <div class="col-sm-9">
                                       @foreach(dict()->get('user_info','sex') as $key=>$val)
                                           <label class="radio-inline">
                                               <input type="radio" name="data[sex]" value="{{$key}}" @if(isset($data['sex']) && $data['sex'] == $key)checked="checked" @endif/>{{$val}}
                                           </label>
                                       @endforeach
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label class="control-label col-sm-3">情感状态</label>
                                    <div class="col-sm-9">
                                        @foreach(dict()->get('user_info','emotion') as $key=>$val)
                                            <label class="radio-inline">
                                                <input type="radio" name="data[emotion]" value="{{$key}}" @if(isset($data['emotion']) && $data['emotion'] == $key)checked="checked" @endif/>{{$val}}
                                            </label>
                                        @endforeach
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label class="control-label col-sm-3">个性签名</label>
                                    <div class="col-sm-9">
                                        <input id="data_signturen" name="data[signture]" class="form-control" value="{{ $data['signture'] or ''}}" required="" aria-required="true"  placeholder="">
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label class="control-label col-sm-3">身高(cm)</label>
                                    <div class="col-sm-9">
                                        <input id="data_height" name="data[height]" class="form-control" value="{{ $data['height'] or ''}}" required="" aria-required="true"  placeholder="">
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label class="control-label col-sm-3">职业</label>
                                    <div class="col-sm-9">
                                        <input id="data_work" name="data[work]" class="form-control" value="{{ $data['work'] or ''}}" required="" aria-required="true"  placeholder="">
                                    </div>
                                </div>
                                
                                <div class="form-group">
                                    <label class="control-label col-sm-3">居住地址省</label>
                                    <div class="col-sm-9">
                                        <div class="col-sm-2">
                                            <select class="form-control" id="cmbProvince" name="place_province_id"></select>
                                        </div>
                                        <div class="col-sm-2">
                                            <select class="form-control" id="cmbCity" name="place_city_id"></select>
                                        </div>
                                        <div class="col-sm-2">
                                            <select class="form-control" id="cmbArea" name="data[address]"></select>
                                        </div>
                                        <script type="text/javascript" src="/base/js/areadata.min.js"></script>
                                        <script type="text/javascript">
                                            areadata({_cmbProvince:'cmbProvince',//省
                                                _cmbCity:'cmbCity',//市
                                                _cmbArea:'cmbArea',//县
                                                _infoname:'place_area_id',
                                                _default:"{{ $data['address'] or '' }}"//默认县
                                            });
                                        </script>
                                    </div>
                                </div>

                                <div class="form-group">
                                    <label class="control-label col-sm-3">所在城市</label>
                                    <div class="col-sm-9">
                                        <input id="data_city" name="data[city]" stringCheck="true" class="form-control" value="{{ $data['city'] or ''}}" required="" aria-required="true"  placeholder="">
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label class="control-label col-sm-3">&nbsp;</label>
                                    <div class="col-sm-9">
                                        <input type="hidden" name="_referer" value="<?php echo urlencode(request()->server('HTTP_REFERER'));?>"/>
                                        <input type="hidden" name="_token" value="<?php echo csrf_token(); ?>"/>
                                        <input type="submit" class="btn btn-success" style="margin-right:20px;">
                                        <input type="reset" class="btn btn-default" >
                                    </div>
                                </div>
                            </form>
                        </div>
                        <!-- /.col-lg-10 -->
                    </div>
                    <!-- /.row -->
				</div>
			</div>
		</div>
	</div>
</div>
@endsection