@extends('adminlte::page')
@section('content')
    <?php Fun::lang()?>
    <div class="top-header">
        <ol class="breadcrumb">
            <li><a href="#">{{__('administrator.Dashboard')}}</a></li>
            <li><a href="{{route('hr-employee.index')}}">{{__('administrator.employee')}}</a></li>
            <li>{{__('administrator.create')}}</li>
        </ol>
    </div>
    <div class="page">
        <div class="top-content">
            <div class="row">
                <div class="col-sm-12 col-xs-12">
                    <div class="title-add">
                        <div class="pull-left">
                            <h3>{{__('administrator.employee')}}</h3>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        {!! Form::open(array('route' => 'hr-employee.store','method'=>'POST','enctype'=>'multipart/form-data')) !!}
        <div class="row">
            <div class="col-sm-12">
                <div class="master-form">
                    <div class="title-note">
                        <h3><span class="fa fa-exclamation-triangle"></span> {{__('administrator.employee')}}
                            <i>({{__('administrator.fields_in_red_are_required')}})</i></h3>
                    </div>
                    <div class="form-group col-sm-3 col-xs-3">
                        <div class="">
                            <strong class="required" for="name">{{__('administrator.code')}}</strong>
                            {!! Form::text('user_code', null, array('placeholder' => __('administrator.code'),'class' => 'form-control','autocomplete' => 'off','required')) !!}
                        </div>
                    </div>
                    <div class="form-group col-sm-3 col-xs-3">
                        <div class="">
                            <strong class="required" for="name">First Name</strong>
                            {!! Form::text('user_firstname', null, array('placeholder' => 'First Name','class' => 'form-control', 'autocomplete' => 'off','required')) !!}
                        </div>
                    </div>
                    <div class="form-group col-sm-3 col-xs-3">
                        <div class="">
                            <strong class="required" for="name">Last Name</strong>
                            {!! Form::text('user_lastname', null, array('placeholder' => 'Last Name','class' => 'form-control','autocomplete' => 'off','required')) !!}
                        </div>
                    </div>
                    <div class="form-group col-sm-3 col-xs-3">
                        <div class="">
                            <strong class="" for="name">{{__('administrator.nationality')}}</strong>
                            {!! Form::text('nationality', null, array('placeholder' => __('administrator.nationality'),'class' => 'form-control', 'autocomplete' => 'off')) !!}
                        </div>
                    </div>
                    <div class="form-group col-sm-3 col-xs-3">
                        <div class="">
                            <strong class="" for="name">{{__('administrator.dob')}}</strong>
                            {!! Form::text('user_dob', null, array('placeholder' => __('administrator.dob'),'class' => 'form-control date_picker','autocomplete' => 'off')) !!}
                        </div>
                    </div>
                    <div class="form-group col-sm-3 col-xs-3">
                        <div class="">
                            <strong class="" for="name">{{__('administrator.sex')}}</strong>
                            {!! Form::select('user_gender',[''=>__('administrator.please_select'),'male'=>__('administrator.male'),'female'=>__('administrator.female')] ,null, array('class' => 'form-control select2')) !!}
                        </div>
                    </div>
                    <div class="form-group col-sm-3 col-xs-3">
                        <div class="">
                            <strong class="" for="name">{{__('administrator.marital_status')}}</strong>
                            {!! Form::select('marital_status',[''=>__('administrator.please_select'),'single'=>__('administrator.single'),'married'=>__('administrator.married'),'widowed'=>__('administrator.widowed'),'divorced'=>__('administrator.divorced')] ,null, array('class' => 'form-control select2')) !!}
                        </div>
                    </div>
                    <div class="form-group col-sm-3 col-xs-3">
                        <div class="">
                            <strong class="" for="name">{{__('administrator.id_card')}}</strong>
                            {!! Form::text('user_cardid', null, array('placeholder' => __('administrator.id_card'),'class' => 'form-control', 'autocomplete' => 'off')) !!}
                        </div>
                    </div>
                    <div class="form-group col-sm-3 col-xs-3">
                        <div class="">
                            <strong class="" for="name">{{__('administrator.employment_status')}}</strong>
                            {!! Form::select('employment_id',$emp_status ,null, array('placeholder' => __('administrator.please_select'),'class' => 'form-control select2')) !!}
                        </div>
                    </div>
                    <div class="form-group col-sm-3 col-xs-3">
                        <div class="">
                            <strong class="" for="name">{{__('administrator.job')}}</strong>
                            {!! Form::select('job_id',$job ,null, array('placeholder' => __('administrator.please_select'),'class' => 'form-control select2')) !!}
                        </div>
                    </div>
                    <div class="form-group col-sm-3 col-xs-3">
                        <div class="">
                            <strong class="" for="name">{{__('administrator.contact')}}</strong>
                            {!! Form::text('contact', null, array('placeholder' => __('administrator.contact'),'class' => 'form-control', 'autocomplete' => 'off')) !!}
                        </div>
                    </div>
                    <div class="form-group col-sm-3 col-xs-3">
                        <div class="">
                            <strong class="required" for="name">{{__('administrator.email')}}</strong>
                            {!! Form::email('email', null, array('placeholder' => __('administrator.email'),'class' => 'form-control', 'autocomplete' => 'off','required')) !!}
                        </div>
                    </div>
                    <div class="form-group col-sm-3 col-xs-3">
                        <div class="">
                            <strong class="required" for="name">{{__('administrator.joined_date')}}</strong>
                            {!! Form::text('joined_date', null, array('placeholder' => __('administrator.joined_date'),'class' => 'form-control date_picker', 'autocomplete' => 'off','required')) !!}
                        </div>
                    </div>
                    <div class="form-group col-sm-3 col-xs-3">
                        <div class="">
                            <strong class="required" for="name">{{__('administrator.basic_salary')}}</strong>
                            {!! Form::text('basic_salary', null, array('placeholder' => __('administrator.basic_salary'),'class' => 'form-control number-only', 'autocomplete' => 'off','required')) !!}
                        </div>
                    </div>
                    <div class="form-group col-sm-3 col-xs-3">
                        <div class="">
                            <strong class="" for="name">{{__('administrator.spouse')}}</strong>
                            {!! Form::text('spouse', null, array('placeholder' => __('administrator.spouse'),'class' => 'form-control number-only', 'autocomplete' => 'off')) !!}
                        </div>
                    </div>
                    <div class="form-group col-sm-3 col-xs-3">
                        <div class="">
                            <strong class="" for="name">{{__('administrator.child')}}</strong>
                            {!! Form::text('child', null, array('placeholder' => __('administrator.child'),'class' => 'form-control number-only', 'autocomplete' => 'off')) !!}
                        </div>
                    </div>
                    <div class="form-group col-sm-3 col-xs-3">
                        <div class="">
                            <strong class="" for="name">{{__('administrator.increment')}}</strong>
                            {!! Form::text('increment', null, array('placeholder' => __('administrator.increment'),'class' => 'form-control number-only', 'autocomplete' => 'off')) !!}
                        </div>
                    </div>
                    <div class="form-group col-sm-3 col-xs-3">
                        <div class="">
                            <strong class="" for="name">{{__('administrator.meal_transport')}}</strong>
                            {!! Form::text('meal_transport', null, array('placeholder' => __('administrator.meal_transport'),'class' => 'form-control number-only', 'autocomplete' => 'off')) !!}
                        </div>
                    </div>
                    <div class="form-group col-sm-3 col-xs-3">
                        <div class="">
                            <strong class="" for="name">{{__('administrator.position_allowance')}}</strong>
                            {!! Form::text('position_allowance', null, array('placeholder' => __('administrator.position_allowance'),'class' => 'form-control number-only', 'autocomplete' => 'off')) !!}
                        </div>
                    </div>
                    <div class="form-group col-sm-3 col-xs-3">
                        <div class="">
                            <strong class="" for="name">{{__('administrator.other_allowance')}}</strong>
                            {!! Form::text('other_allowance', null, array('placeholder' => __('administrator.other_allowance'),'class' => 'form-control number-only', 'autocomplete' => 'off')) !!}
                        </div>
                    </div>
                    <div class="form-group col-sm-3 col-xs-3">
                        <div class="">
                            <strong class="" for="name">{{__('administrator.additional')}}</strong>
                            {!! Form::text('additional', null, array('placeholder' => __('administrator.additional'),'class' => 'form-control number-only', 'autocomplete' => 'off')) !!}
                        </div>
                    </div>
                    <div class="form-group col-sm-12 col-xs-12">
                        <div class="">
                            <strong class="" for="name">{{__('administrator.pob')}}</strong>
                            {!! Form::textarea('place_of_birth', null, array('placeholder' => __('administrator.pob'),'class' => 'form-control no-resize','rows'=>'3')) !!}
                        </div>
                    </div>
                    <div class="form-group col-sm-12 col-xs-12">
                        <div class="">
                            <strong class="" for="name">{{__('administrator.address')}}</strong>
                            {!! Form::textarea('address', null, array('placeholder' => __('administrator.address'),'class' => 'form-control no-resize','rows'=>'3')) !!}
                        </div>
                    </div>
                    
                    <div class="form-group col-sm-12 col-xs-12">
                        <div class="">
                            <strong class="" for="name">{{__('administrator.note')}}</strong>
                            {!! Form::textarea('note', null, array('placeholder' => __('administrator.note'),'class' => 'form-control no-resize','rows'=>'3')) !!}
                        </div>
                    </div>
                    <div class="form-group col-sm-12 col-xs-12">
                        <div class="col-sm-3 col-xs-12 ">
                            <strong class="" for="name">{{__('administrator.photo')}}</strong>
                            <div class="col-sm-12">
                                <input type="file" name="avatar"
                                       onchange="document.getElementById('blah').src = window.URL.createObjectURL(this.files[0])">
                            </div>
                            <div class="col-sm-12">&nbsp;</div>
                            <div class="col-sm-12">
                                <div class="add_img text-left">
                                    <img src="" style="" id="blah" width="30%">
                                </div>
                            </div>
                            <input type="hidden" name="hidden_image_name" value="">
                        </div>
                    </div>
                    <div class="form-group col-sm-12 col-xs-12">
                        <div class="">
                            <strong class="" for="name">{{__('administrator.educate')}}</strong>
                            @include('hr.employee.script-education')
                        </div>
                    </div>
                    <div class="form-group col-sm-12 col-xs-12">
                        <div class="">
                            <strong class="" for="name">{{__('administrator.work_experience')}}</strong>
                            @include('hr.employee.emp-work-experience-script')
                        </div>
                    </div>
                    <div class="form-group col-sm-12 col-xs-12">
                        <div class="">
                            <strong class="" for="name">{{__('administrator.language')}}</strong>
                            @include('hr.employee.emp-language-script')
                        </div>
                    </div>
                    <div class="form-group col-sm-12 col-xs-12">
                        <div class="">
                            <strong class="" for="name">{{__('administrator.family')}}</strong>
                            @include('hr.employee.emp-family-script')
                        </div>
                    </div>
                    <div class="form-group col-sm-12 col-xs-12">
                        <div class="">
                            <strong class="" for="name">{{__('administrator.family(only)')}}</strong>
                            @include('hr.employee.emp-family-full-script')
                        </div>
                    </div>
                    <div class="form-group col-sm-12 col-xs-12">
                        <div class="">
                            <strong class="" for="name">{{__('administrator.emergency_contact')}}</strong>
                            @include('hr.employee.script-emergency')
                        </div>
                    </div>
                    <div class="form-group col-sm-12 col-xs-12">
                        <div class="">
                            <strong class="" for="name">{{__('administrator.document')}}</strong>
                            <div id="add_attachment">
                                <div class="form-group col-sm-5 col-xs-12">
                                    <input type="text" name="file_title[]" class="form-control file_name_show"
                                           placeholder="File Name">
                                </div>
                                <div class="form-group col-sm-7 col-xs-12">
                                    <input type="file" name="att_file[]" class="">
                                </div>
                                <div class="form-group col-sm-12 col-xs-12">
                                <textarea name="file_note[]" id="" placeholder="Description" rows="2"
                                          class="form-control input-lg no-resize"></textarea>
                                </div>
                                <div class="form-group col-sm-11 col-xs-11"></div>
                            </div>
                            <div class="col-sm-offset-11 form-group col-sm-1 col-xs-12">
                                <a class="pull-right btn  btn-hover btn-primary" id="btn_attachment">
                                    <i class="fa fa-plus"></i>
                                </a>
                            </div>
                        </div>
                    </div>
                    <div class="col-sm-12 col-xs-12">
                        <div class="form-group footer-save">
                            <button type="submit" class="button_sm button_primary pull-right"><span
                                        class="fa fa-save"></span> {{__('administrator.save')}}</button>
                            <button type="button" onClick="javascript:history.go(-1)"
                                    class="button_sm button_warning pull-right">
                                <span class=" fa fa-arrow-circle-left"></span> {{__('administrator.back')}}</button>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        {!! Form::close() !!}
    </div>
@endsection
@section('js')
    <script type="text/javascript">
        var intId = 0;
        $("#btn_attachment").click(function () {

            var lastField = $("#add_attachment div:last");
            intId++;
            var fieldWrapper = $("<div class=\"fieldwrapper\" id=\"field" + intId + "\"/>");
            fieldWrapper.data("idx", intId);
            var fName = $('' +
                '                    <div class="form-group col-sm-5 col-xs-12">' +
                '                       <input type="text" name="file_title[]" class="form-control file_name_show" placeholder="File Name">' +
                '                    </div>' +
                '                    <div class="form-group col-sm-7 col-xs-12">' +
                '                        <input type="file" name="att_file[]" required class="">' +
                '                    </div>' +
                '                    <div class="form-group col-sm-12 col-xs-12">' +
                '                        <textarea name="file_note[]" id="" placeholder="Description" rows="2" class="form-control input-lg no-resize"></textarea>' +
                '                    </div><div class="form-group col-sm-11 col-xs-11"></div>' +
                '');
            var removeButton = $("<div class=\"form-group col-sm-1 col-xs-1\"><a  class=\"remove btn btn-hover btn-danger pull-right\"><span class=\"fa fa-trash\"></span></a></div>");
            removeButton.click(function () {
                $(this).parent().remove();
            });
            fieldWrapper.append(fName);
            fieldWrapper.append(removeButton);
            $("#add_attachment").append(fieldWrapper);
        });
    </script>
@endsection


