@extends('backend.layouts.master')
@section('title','Employee Entry')
@push('css')

@push('css')
<!-- page content -->
@section('content')
    <div class="right_col" role="main">
        <div class="">
            <div class="clearfix"></div>
            @if(Session::has('success'))
                <div class="alert alert-success">
                    {{ Session::get('success') }}
                </div>
            @endif
            @if(Session::has('error'))
                <div class="alert alert-danger">
                    {{ Session::get('error') }}
                </div>
            @endif
            <div class="row">
                <div class=" col-sm-12 ">
                    <div class="x_panel">
                        <div class="x_title">
                            <h2>Employee Entry
                                <!--<a href="{{route('account.cpi')}}" class="btn btn-xs btn-primary"> Salary Payment</a>-->
                                <!--<a href="{{route('employee.list')}}" class="btn btn-xs btn-primary">Employee List</a>-->
                             </h2>
                            <ul class="nav navbar-right panel_toolbox">
                                <li><a class="collapse-link"><i class="fa fa-chevron-up"></i></a>
                                </li>
                                <li class="dropdown">
                                    <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false"><i class="fa fa-wrench"></i></a>
                                    <ul class="dropdown-menu" role="menu">
                                        <li><a href="#">Settings 1</a></li>
                                        <li><a href="#">Settings 2</a></li>
                                    </ul>
                                </li>
                                <li><a class="close-link"><i class="fa fa-close"></i></a>
                                </li>
                            </ul>
                            <div class="clearfix"></div>
                        </div>
                        <div class="">
                            <form action="{{ route('employee.store')}}" method="post" class="form-horizontal form-label-left" enctype="multipart/form-data">
        						{{ csrf_field()}}
        						<div class="form-group">
        							<label class="control-label  col-sm-3 " for="name">Full Name <span class="required">*</span>
        							</label>
        							<div class="col-sm-6 ">
        								<input type="text" id="name" class="form-control " name="name" value="{{old('name')}}" placeholder="Employee Full Name">
        								<p class="error">{{ $errors->first('name') }}</p>
        							</div>
        						</div>
        						<div class="form-group">
        							<label for="phone" class="control-label  col-sm-3 ">Phone</label>
        							<div class="col-sm-6 ">
        								<input id="phone" class="form-control " type="text" name="phone" value="{{old('phone')}}" placeholder="Present Phone Number">
        								<p class="error">{{ $errors->first('phone') }}</p>
        							</div>
        						</div>
        						<div class="form-group">
        							<label class="control-label  col-sm-3 ">Join Date<span class="required">*</span></label>
        							<div class=" col-sm-6 ">
        								<input id="datepicker" type="date" name="join_date" class="date-picker form-control " data-zdp_readonly_element="false" value="{{ date('d-m-Y')}}" placeholder="dd-mm-yyyy">
        							</div>
        						</div>
        						<div class="form-group">
        							<label class="control-label  col-sm-3 ">Salary</label>
        							<div class=" col-sm-6 ">
        								<input type="number" class="form-control " name="salary" value="{{old('salary')}}" placeholder="Total Basic Salary">
        								<p class="error">{{ $errors->first('salary') }}</p>
        							</div>
        						</div>
        						<div class="form-group">
        							<label class="control-label  col-sm-3 ">Address</label>
        							<div class=" col-sm-6 ">
        								<input type="text" class="form-control " name="address" value="{{old('address')}}" placeholder="Present Address">
        								<p class="error">{{ $errors->first('address') }}</p>
        							</div>
        						</div>
        						<div class="form-group">
        							<label class="control-label  col-sm-3 ">Employee Image</label>
        							<div class=" col-sm-3 ">
        								<input id="" onChange="readURL(this)" name="image" class="form-control " type="file">
        							</div>
        							<div class=" col-sm-3 ">
        								<img src="" class="img-responsive img-thumbnail" id="profile_img_tag" width="170px" hight="150px" />
        							</div>
        						</div>
        						<hr />
        						<div class="form-group">
        							<div class="col-sm-7  col-md-offset-5">
        								<a href="{{route('employee.list')}}" class="btn btn-xs btn-danger">Cancel</a>
        								<button class="btn btn-xs btn-warning" type="reset">Reset</button>
        								<button type="submit" class="btn btn-xs btn-success">Save</button>
        							</div>
        						</div>
        					</form>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <!-- /page content -->
@endsection

@push('js')
    <script type="text/javascript">
        $(document).ready(function() {
            
        });
        function readURL(input){
			if (input.files && input.files[0]){
				var reader = new FileReader();
				reader.onload = function (e) {
					$('#profile_img_tag').attr('src', e.target.result);
				}
				reader.readAsDataURL(input.files[0]);
			}
		}  
    </script>
@endpush