<?php
use \common\libs\MyLib;
?>
<?php $this->beginBlock('header_css'); ?>
<link href="/assets/css/plugins/iCheck/custom.css" rel="stylesheet">
<?php $this->endBlock(); ?>

<div class="wrapper wrapper-content animated fadeInRight">
    <form role="form" class="form-horizontal data-from" id="theFrm">
        <input type="hidden" name="id" value="<?=intval($pay_info->id)?>">
        <div class="ibox float-e-margins">
            <div class="ibox-title">
                <h5>基本信息</h5>
            </div>
            <div class="ibox-content">
                <div class="row">
                    <div class="col-sm-12">
                        <div class="form-group">
                            <label class="col-sm-1 control-label">职务</label>
                            <div class="col-sm-3">
                                <label class="form-control-static"><?=$group_info?$group_info->getPath():''?></label>
                            </div>
                            <label class="col-sm-1 control-label">姓名</label>
                            <div class="col-sm-3">
                                <label class="form-control-static"><?=$user_info->getShowName()?></label>
                            </div>
                            <label class="col-sm-1 control-label">入职时间</label>
                            <div class="col-sm-3">
                                <label class="form-control-static"><?=$user_info->enter_date?></label>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-1 control-label">工作制</label>
                            <div class="col-sm-3">
                                <label class="form-control-static"><?=$user_info->worktype?$user_info->worktype->name:''?></label>
                            </div>
                            <label class="col-sm-1 control-label">试用工资</label>
                            <div class="col-sm-3">
                                <div class="input-group">
                                    <input type="text" name="try_pay" value="<?=$pay_info->try_pay == '0.00' ? $user_info->try_pay : $pay_info->try_pay?>" class="form-control">
                                    <div class="input-group-addon">元</div>
                                </div>
                            </div>
                            <label class="col-sm-1 control-label">转正时间</label>
                            <div class="col-sm-3">
                                <label class="form-control-static"><?=$user_info->job_date?></label>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-1 control-label">转正工资</label>
                            <div class="col-sm-3">
                                <div class="input-group">
                                    <input type="text" name="formal_pay" value="<?=$pay_info->formal_pay == '0.00' ? ($group_info?($group_info->base_pay + $group_info->job_pay + $group_info->station_pay + $user_info->ext_pay):$user_info->ext_pay) : $pay_info->formal_pay?>" class="form-control"/>
                                    <div class="input-group-addon">元</div>
                                </div>
                            </div>
                            <label class="col-sm-1 control-label">加班天数</label>
                            <div class="col-sm-3">
                                <div class="input-group">
                                    <input  name="extjob_days" type="text" value="<?=$pay_info->extjob_days?>" class="form-control"/>
                                    <div class="input-group-addon">天</div>
                                </div>
                            </div>
                            <label class="col-sm-1 control-label">试用出勤</label>
                            <div class="col-sm-3">
                                <div class="input-group">
                                    <input  name="try_attendance_days" type="text" value="<?=$pay_info->try_attendance_days?>" class="form-control"/>
                                    <div class="input-group-addon">天</div>
                                </div>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-1 control-label">转正出勤</label>
                            <div class="col-sm-3">
                                <div class="input-group">
                                    <input  name="attendance_days" type="text" value="<?=$pay_info->attendance_days?>" class="form-control"/>
                                    <div class="input-group-addon">天</div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <div class="ibox float-e-margins">
            <div class="ibox-title">
                <h5>补助工资</h5>
            </div>
            <div class="ibox-content">
                <div class="row">
                    <div class="col-sm-12">
                        <div class="form-group">
                            <label class="col-sm-1 control-label">试用加班</label>
                            <div class="col-sm-3">
                                <div class="input-group">
                                    <input  name="try_extjob_pay" type="text" value="<?=$pay_info->try_extjob_pay?>" class="form-control"/>
                                    <div class="input-group-addon">元</div>
                                </div>
                            </div>
                            <label class="col-sm-1 control-label">转正加班</label>
                            <div class="col-sm-3">
                                <div class="input-group">
                                    <input  name="extjob_pay" type="text" value="<?=$pay_info->extjob_pay?>" class="form-control"/>
                                    <div class="input-group-addon">元</div>
                                </div>
                            </div>
                            <label class="col-sm-1 control-label">社保</label>
                            <div class="col-sm-3">
                                <div class="input-group">
                                    <input  name="give_social_pay" type="text" value="<?=$pay_info->give_social_pay?>" class="form-control"/>
                                    <div class="input-group-addon">元</div>
                                </div>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-1 control-label">话费</label>
                            <div class="col-sm-3">
                                <div class="input-group">
                                    <input  name="calls" type="text" value="<?=$pay_info->calls?>" class="form-control"/>
                                    <div class="input-group-addon">元</div>
                                </div>
                            </div>
                            <label class="col-sm-1 control-label">公交</label>
                            <div class="col-sm-3">
                                <div class="input-group">
                                    <input  name="bus" type="text" value="<?=$pay_info->bus?>" class="form-control"/>
                                    <div class="input-group-addon">元</div>
                                </div>
                            </div>
                            <label class="col-sm-1 control-label">奖金</label>
                            <div class="col-sm-3">
                                <div class="input-group">
                                    <input  name="bonus" type="text" value="<?=$pay_info->bonus?>" class="form-control"/>
                                    <div class="input-group-addon">元</div>
                                </div>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-1 control-label">全勤</label>
                            <div class="col-sm-3">
                                <div class="input-group">
                                    <input  name="get_full_attendance_pay" type="text" value="<?=$pay_info->get_full_attendance_pay ? $pay_info->get_full_attendance_pay : '0.00'?>" class="form-control"/>
                                    <div class="input-group-addon">元</div>
                                </div>
                            </div>
                            <label class="col-sm-1 control-label">通时</label>
                            <div class="col-sm-3">
                                <div class="input-group">
                                    <input  name="get_pass_time_pay" type="text" value="<?=$pay_info->get_pass_time_pay ? $pay_info->get_pass_time_pay : '0.00'?>" class="form-control"/>
                                    <div class="input-group-addon">元</div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <div class="ibox float-e-margins">
            <div class="ibox-title">
                <h5>应扣工资</h5>
            </div>
            <div class="ibox-content">
                <div class="row">
                    <div class="col-sm-12">
                        <div class="form-group">
                            <label class="col-sm-1 control-label">迟到</label>
                            <div class="col-sm-3">
                                <div class="input-group">
                                    <input  name="late_pay" type="text" value="<?=$pay_info->late_pay?>" class="form-control"/>
                                    <div class="input-group-addon">元</div>
                                </div>
                            </div>
                            <label class="col-sm-1 control-label">事假</label>
                            <div class="col-sm-3">
                                <div class="input-group">
                                    <input  name="leave_pay" type="text" value="<?=$pay_info->leave_pay?>" class="form-control"/>
                                    <div class="input-group-addon">元</div>
                                </div>
                            </div>
                            <label class="col-sm-1 control-label">病假</label>
                            <div class="col-sm-3">
                                <div class="input-group">
                                    <input  name="sick_pay" type="text" value="<?=$pay_info->sick_pay?>" class="form-control"/>
                                    <div class="input-group-addon">元</div>
                                </div>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-1 control-label">社保</label>
                            <div class="col-sm-3">
                                <div class="input-group">
                                    <input  name="social_pay" type="text" value="<?=$pay_info->social_pay?>" class="form-control"/>
                                    <div class="input-group-addon">元</div>
                                </div>
                            </div>
                            <label class="col-sm-1 control-label">罚款</label>
                            <div class="col-sm-3">
                                <div class="input-group">
                                    <input  name="fine_pay" type="text" value="<?=$pay_info->fine_pay?>" class="form-control"/>
                                    <div class="input-group-addon">元</div>
                                </div>
                            </div>
                            <label class="col-sm-1 control-label">电费</label>
                            <div class="col-sm-3">
                                <div class="input-group">
                                    <input  name="electricity_pay" type="text" value="<?=$pay_info->electricity_pay?>" class="form-control"/>
                                    <div class="input-group-addon">元</div>
                                </div>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-1 control-label">离职押金</label>
                            <div class="col-sm-3">
                                <div class="input-group">
                                    <input  name="deposit" type="text" value="<?=$pay_info->deposit?>" class="form-control"/>
                                    <div class="input-group-addon">元</div>
                                </div>
                            </div>
                            <label class="col-sm-1 control-label">公积金</label>
                            <div class="col-sm-3">
                                <div class="input-group">
                                    <input  name="public_pay" type="text" value="<?=$pay_info->public_pay?>" class="form-control"/>
                                    <div class="input-group-addon">元</div>
                                </div>
                            </div>
                            <label class="col-sm-1 control-label">个税</label>
                            <div class="col-sm-3">
                                <div class="input-group">
                                    <input type="text" name="tax" value="<?=$pay_info->tax?>" class="form-control"/>
                                    <div class="input-group-addon">元</div>
                                </div>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-1 control-label">全勤</label>
                            <div class="col-sm-3">
                                <div class="input-group">
                                    <input  name="full_attendance_pay" type="text" value="<?=$pay_info->full_attendance_pay?>" class="form-control"/>
                                    <div class="input-group-addon">元</div>
                                </div>
                            </div>
                            <label class="col-sm-1 control-label">通时</label>
                            <div class="col-sm-3">
                                <div class="input-group">
                                    <input  name="pass_time_pay" type="text" value="<?=$pay_info->pass_time_pay?>" class="form-control"/>
                                    <div class="input-group-addon">元</div>
                                </div>
                            </div>
                        </div>
                        <?php if($pay_info->status_id < 4 || $pay_info->status_id == 7) { ?>
                        <div>
                            <div class="row">
                                <div class="col-sm-5 col-sm-offset-5">
                                    <button class="btn btn-primary btn-save" type="button">
                                        <strong>保 存</strong>
                                    </button>
                                </div>
                            </div>
                        </div>
                        <?php } ?>
                    </div>
                </div>
            </div>
        </div>
    </form>
</div>

<?php $this->beginBlock('footer_js'); ?>
<script type="text/javascript" language="javascript">
    $(function () {
        $('.date').datepicker({
            todayBtn: "linked",
            keyboardNavigation: false,
            forceParse: false,
            calendarWeeks: true,
            autoclose: true
        });
        //提交按钮
        $(".btn-save").click(function(){
            parent.layer.confirm('是否确认提交？', {
                btn: ['确认','取消'], //按钮
                shade: false //不显示遮罩
            }, function(){
                var params = $("#theFrm").serialize();
                $.post('/personnel/pay-save',params,function(obj){
                    if(obj.success) {
                        parent.layer.msg('保存成功');
                        parent.refreshList();
                        layer_close();
                    } else {
                        parent.layer.msg(data.msg);
                    }
                },'json');
            }, function(){
                //
            });
        });
    })
</script>
<?php $this->endBlock('footer_js'); ?>
