You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
simple-yewu/frontend/views/user/edit.php

285 lines
16 KiB

5 years ago
<?php
use \common\libs\MyLib;
?>
5 years ago
<?php $this->beginBlock('header_css'); ?>
<?php $this->endBlock(); ?>
5 years ago
5 years ago
<div class="wrapper wrapper-content animated fadeInRight">
<div class="ibox float-e-margins">
<div class="ibox-content">
<form role="form" class="form-horizontal data-from" id="theFrm">
<input type="hidden" name="id" value="<?=intval($info->id)?>">
<div class="tabs-container">
<ul class="nav nav-tabs">
<li class="active"><a data-toggle="tab" href="#tab-1"> 员工信息</a></li>
<li class=""><a data-toggle="tab" href="#tab-2"> 薪酬信息</a></li>
<li class=""><a data-toggle="tab" href="#tab-3"> 权限信息</a></li>
</ul>
<div class="tab-content ">
<div id="tab-1" class="tab-pane active">
<div class="panel-body">
<div class="form-group">
<label class="col-md-1 control-label">工号</label>
<div class="col-md-3">
<input type="text" name="username" value="<?=$info->username?>" class="form-control">
</div>
<label class="col-md-1 control-label">登录密码</label>
<div class="col-md-3">
<input type="text" name="password" value="" class="form-control">
</div>
<label class="col-md-1 control-label">姓名</label>
<div class="col-md-3">
<input type="text" name="name" value="<?=$info->name?>" class="form-control">
</div>
</div>
<div class="form-group">
<label class="col-md-1 control-label">联系电话</label>
<div class="col-md-3">
<input type="text" name="phone" value="<?=$info->phone?>" class="form-control">
</div>
<label class="col-md-1 control-label">所属岗位</label>
<div class="col-md-3">
<select name="group_id" class="form-control">
<option value="0">&nbsp;</option>
<?php
foreach($group_items as $group) {
echo '<option value="'.$group->id.'"';
if($group->id == $info->group_id)
echo ' selected ';
echo '>'.$group->name.'</option>';
5 years ago
}
5 years ago
?>
</select>
</div>
<label class="col-md-1 control-label">角色</label>
<div class="col-md-3">
<select name="role_id" class="form-control">
<?php
foreach($role_items as $role) {
echo '<option value="'.$role->id.'"';
if($role->id == $info->role_id)
echo ' selected ';
echo '>'.$role->name.'</option>';
}
?>
</select>
</div>
</div>
<div class="form-group">
<label class="col-md-1 control-label">允许登录</label>
<div class="col-md-3">
<div class="checkbox checkbox-inline">
<input type="checkbox" id="is_login" name="is_login" value="1" <?=$info->is_login==1?'checked':''?>>
<label for="is_login"></label>
</div>
5 years ago
</div>
<label class="col-md-1 control-label">外网登陆</label>
<div class="col-md-3">
<div class="checkbox checkbox-inline">
<input type="checkbox" id="is_outer" name="is_outer" value="1" <?=$info->is_outer==1?'checked':''?>>
<label for="is_outer"> 允许 </label>
</div>
5 years ago
</div>
<label class="col-md-1 control-label">是否离职</label>
<div class="col-md-3">
<div class="checkbox checkbox-inline">
<input type="checkbox" id="is_leave" name="is_leave" value="1" <?=$info->is_leave==1?'checked':''?>>
<label for="is_leave"></label>
</div>
5 years ago
</div>
</div>
</div>
</div>
<div id="tab-2" class="tab-pane">
<div class="panel-body">
<div class="form-group">
<label class="col-md-1 control-label">入职日期</label>
<div class="col-md-3">
<div class="input-group date">
<span class="input-group-addon"><i class="fa fa-calendar"></i></span>
<input type="text" name="enter_date" class="form-control" value="<?=$info->enter_date?>">
</div>
</div>
<label class="col-md-1 control-label">转正时间</label>
<div class="col-md-3">
<div class="input-group date">
<span class="input-group-addon"><i class="fa fa-calendar"></i></span>
<input type="text" name="job_date" class="form-control" value="<?=$info->job_date?>">
</div>
</div>
<label class="col-md-1 control-label">调整工资</label>
<div class="col-md-3">
<input type="text" name="ext_pay" value="<?=$info->ext_pay?>" class="form-control">
</div>
</div>
<div class="form-group">
<label class="col-md-1 control-label">总工资</label>
<div class="col-md-3">
<label class="form-control-static"><span id="total_pay">0.00</span></label>
</div>
<label class="col-md-1 control-label">试用工资(%)</label>
<div class="col-md-3">
<input type="text" name="try_rate" value="<?=$info->try_rate?>" class="form-control">
</div>
<label class="col-md-1 control-label">试用工资</label>
<div class="col-md-3">
<input type="text" name="try_pay" value="<?=$info->try_pay?>" class="form-control">
</div>
</div>
<div class="form-group">
<label class="col-md-1 control-label">工作制</label>
<div class="col-md-3">
<select name="worktype_id" class="form-control">
<option value="0">请选择</option>
<?php
foreach($worktypes as $worktype) {
echo '<option value="'.$worktype->id.'"';
if($info->worktype_id == $worktype->id)
echo ' selected ';
echo '>'.$worktype->name.'</option>';
}
?>
</select>
</div>
<label class="col-md-1 control-label">是否双休</label>
<div class="col-md-3">
<div class="checkbox checkbox-inline">
<input type="checkbox" id="is_double" name="is_double" value="1" <?=$info->is_double==1?'checked':''?>>
<label for="is_double"></label>
</div>
5 years ago
</div>
</div>
</div>
</div>
<div id="tab-3" class="tab-pane">
<div class="panel-body">
<TABLE id=tb3 name="tb" class="table table-bordered">
<thead>
5 years ago
<tr>
5 years ago
<th width="100">权限</th>
<th>一级菜单(二级菜单)</th>
5 years ago
</tr>
5 years ago
</thead>
5 years ago
<tbody>
<?php
foreach($permissions as $permission) {
$parent_menus = $permission->getMenus()
->where('parent_id=0')
->all();
?>
<tr>
<td width="100" height="25" class="bg_tr">
<?php
5 years ago
echo '<label class="i-checks">';
echo '<input class="parent_checkbox" type="checkbox" name="permissions[]" value="'.$permission->id.'"';
5 years ago
if($info->getPermissions()->where('id='.$permission->id)->count() > 0)
echo ' checked ';
echo '>'.$permission->name;
echo '</label>';
?>
</td>
<td height="25" class="td_bg">
<?php
foreach ($parent_menus as $parent_menu) {
echo '<table width="100%" align="center" border="0" cellpadding="0" cellspacing="0" id="mainTable">';
echo '<tr>';
5 years ago
echo '<td width="100">';
echo '<label class="i-checks">';
echo '<input class="sub_checkbox" type="checkbox" name="menus[]" value="'.$parent_menu->id.'"';
5 years ago
if($info->getMenus()->where('id='.$parent_menu->id)->count() > 0)
echo ' checked ';
echo '>' . $parent_menu->name;
echo '</label>';
echo '</td>';
5 years ago
echo '<td>';
5 years ago
$child_menus = $permission->getMenus()
->where('parent_id=' . $parent_menu->id)
->all();
foreach ($child_menus as $child_menu) {
5 years ago
echo '<label class="i-checks">';
echo '<input class="sub_checkbox" type="checkbox" name="menus[]" value="'.$child_menu->id.'"';
5 years ago
if($info->getMenus()->where('id='.$child_menu->id)->count() > 0)
echo ' checked ';
echo '>' . $child_menu->name;
echo '</label>';
}
echo '</td>';
echo '</tr>';
echo '</table>';
}
?>
</td>
</tr>
<?php
}
?>
5 years ago
</tbody>
5 years ago
</table>
5 years ago
</div>
</div>
</div>
</div>
<div>
<div class="row" style="margin-top: 8px;">
<div class="col-md-5 col-md-offset-5">
<button class="btn btn-primary btn-save" type="button">
<strong><?=$info ? '保 存':'添 加'?></strong>
</button>
</div>
</div>
</div>
5 years ago
</form>
5 years ago
</div>
</div>
</div>
5 years ago
5 years ago
<?php $this->beginBlock('footer_js'); ?>
<script type="text/javascript" language="javascript">
$(function () {
$('.input-group.date').datepicker({
todayBtn: "linked",
keyboardNavigation: false,
forceParse: false,
calendarWeeks: true,
autoclose: true
});
5 years ago
5 years ago
//提交按钮
$(".btn-save").click(function(){
if(confirm('是否确认提交?')) {
var params = $("#theFrm").serialize();
$.post('/user/save',params,function(obj){
parent.layer.msg(obj.msg);
if(obj.success) {
parent.refreshList();
layer_close();
5 years ago
}
5 years ago
},'json');
5 years ago
}
5 years ago
});
//处理自动选择功能
$('.parent_checkbox').click(function() {
var checked = $(this).prop('checked');
var subs = $(this).parent().parent().next().find('.sub_checkbox');
for(var i = 0; i < subs.length; i++) {
if(checked) {
$(subs[i]).prop('checked', 'checked');
} else {
$(subs[i]).prop('checked', '');
}
}
});
$('.sub_checkbox').click(function() {
var checked = $(this).prop('checked');
var subs = $(this).parent().parent().parent().parent().parent().parent().prev().find('.parent_checkbox');
for(var i = 0; i < subs.length; i++) {
if(checked) {
$(subs[i]).prop('checked', 'checked');
}
}
});
5 years ago
})
5 years ago
</script>
5 years ago
<?php $this->endBlock('footer_js'); ?>