Skip to content

Commit

Permalink
人员相关日程子表; fix: 不输入立案日期自动删除
Browse files Browse the repository at this point in the history
  • Loading branch information
uicestone committed Jul 19, 2013
1 parent 69ec32c commit 515e2f2
Show file tree
Hide file tree
Showing 5 changed files with 127 additions and 1 deletion.
24 changes: 24 additions & 0 deletions application/controllers/people.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ class People extends SS_Controller{
var $project_list_args;

var $team_list_args;

var $schedule_list_args;

function __construct() {
parent::__construct();
Expand Down Expand Up @@ -66,6 +68,14 @@ function __construct() {
'leader_name'=>array('heading'=>'负责人','cell'=>array('data'=>'<a href="#{leader_type}/{leader}">{leader_name}</a>'))
);

$this->schedule_list_args=array(
'name'=>array('heading'=>array('data'=>'标题'),'wrap'=>array('mark'=>'span','class'=>'show-schedule','id'=>'{id}')),
'start'=>array('heading'=>array('data'=>'时间'),'parser'=>array('function'=>function($start){
return $start?date('Y-m-d H:i',intval($start)):null;
},'args'=>array('start'))),
'creater_name'=>array('heading'=>array('data'=>'人员'))
);

$this->load->view_path['list_aside']='people/list_sidebar';
$this->load->view_path['edit']='people/edit';
$this->load->view_path['edit_aside']='people/edit_sidebar';
Expand Down Expand Up @@ -146,6 +156,7 @@ function edit($id){
$this->load->addViewData('relative_list', $this->relativeList());
$this->load->addViewData('profile_list',$this->profileList());
$this->load->addViewData('project_list', $this->projectList());
$this->load->addViewData('schedule_list', $this->scheduleList());

if($this->people->data['staff']){
$this->people->data['staff_name']=$this->staff->fetch($this->people->data['staff'],'name');
Expand Down Expand Up @@ -246,6 +257,19 @@ function teamList(){
return $list;
}

/**
* 返回人员相关日程列表
*/
function scheduleList(){

$this->load->model('schedule_model','schedule');

return $this->table->setFields($this->schedule_list_args)
->setAttribute('name','schedule')
->setRowAttributes(array('onclick'=>"$.viewSchedule({id:{id}})",'style'=>'cursor:pointer;'))
->generate($this->schedule->getList(array('show_creater'=>true,'limit'=>10,'people'=>$this->people->id,'orderby'=>'id desc')));
}

/**
* 提交处理
*/
Expand Down
2 changes: 1 addition & 1 deletion application/models/project_model.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ function add($data=array()){
function update($id,array $data){

foreach(array('first_contact','time_contract','end') as $date_field){
if(empty($data[$date_field])){
if(isset($data[$date_field]) && $data[$date_field]===''){
$data[$date_field]=NULL;
}
}
Expand Down
13 changes: 13 additions & 0 deletions application/views/client/edit.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,19 @@
<?=$project_list?>
</div>

<div class="item" name="schedule">
<div class="title">
<span class="right">
<?=(double)$this->schedule->getSum(array('people'=>$this->people->id,'completed'=>true))?>小时
<a href="#schedule/lists?people=<?=$this->value('people/id')?>">所有日程>></a>
</span>
<label>最新日程:
<a href="javascript:$.createSchedule({people:<?=$this->value('people/id')?>,refreshOnSave:true})">添加>></a>
</label>
</div>
<?=$schedule_list?>
</div>

<div class="item">
<div class="title"><label>备注:</label></div>
<textarea name="people[comment]"><?=$this->value('people/comment')?></textarea>
Expand Down
85 changes: 85 additions & 0 deletions application/views/contact/edit.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
<form method="post" name="<?=CONTROLLER?>" id="<?=$this->people->id?>" enctype="multipart/form-data">
<div class="item">
<div class="title"><label>基本信息:</label></div>
<input name="people[name]" value="<?=$this->value('people/name'); ?>" type="text" placeholder="中文名" />

<input name="people[phone]" value="<?=$this->value('people/phone'); ?>" type="text" placeholder="电话" />
<input name="people[email]" value="<?=$this->value('people/email'); ?>" type="text" placeholder="电子邮件" />
<?=checkbox('单位', 'people[character]', $this->value('people/character'), '单位')?>
<?if($this->value('people/character')=='单位'){?>
<input name="people[abbreviation]" value="<?=$this->value('people/abbreviation')?>" placeholder="简称" />
<?}else{?>
<select name="people[gender]"><?=options(array('',''), $this->value('people/gender'), '性别')?></select>
<input type="text" name="people[id_card]" value="<?=$this->value('people/id_card'); ?>" placeholder="身份证" style="width:195px;" />
<input type="text" name="people[birthday]" value="<?=$this->value('people/birthday'); ?>" placeholder="生日" class="date" />
<input name="people[name_en]" value="<?=$this->value('people/name_en'); ?>" type="text" placeholder="英文名" />
<input type="text" name="people[work_for]" value="<?=$this->value('people/work_for')?>" placeholder="工作单位" />
<input type="text" name="people[position]" value="<?=$this->value('people/position')?>" placeholder="职位" />
<?}?>

</div>

<?if($people['type']=='client'){?>
<div class="item">
<div class="title"><label>来源:</label></div>
<select name="profiles[来源类型]">
<?=options($this->config->user_item('客户来源类型'),$this->value('profiles/来源类型'),'来源类型')?>
</select>

<input type="text" name="profiles[来源]" value="<?=$this->value('profiles/来源')?>" <?if(!$this->value('profiles/来源')){?>class="hidden" disabled="disabled"<?}?> />
<input type="text" name="people[staff_name]" placeholder="来源律师" value="<?=$this->value('people/staff_name')?$this->value('people/staff_name'):$this->user->name?>" />
</div>
<?}?>

<div class="item" name="profile">
<div class="title"><label>资料项</label></div>
<?=$profile_list?>
<button type="button" class="toggle-add-form">+</button>
<span class="add-form hidden">
<select name="profile[name]" class="chosen allow-new" data-placeholder="资料项名称">
<?=options($profile_name_options,$this->value('profile/name'),'',false,false,false)?>
</select>
<input type="text" name="profile[content]" value="<?=$this->value('profile/content')?>" placeholder="资料项内容" />
<input type="text" name="profile[comment]" value="<?=$this->value('profile/comment')?>" placeholder="备注" />

<button type="submit" name="submit[profile]">添加</button>
</span>
</div>

<div class="item" name="relative">
<div class="title"><label>相关人</label></div>
<?=$relative_list?>
<button type="button" class="toggle-add-form">+</button>
<span class="add-form hidden">
<input type="hidden" name="relative[id]" class="tagging" data-placeholder="名称" data-ajax="/people/match/" />
<select name="relative[relation]" class="chosen allow-new" data-placeholder="关系">
<?=options($this->config->user_item(($this->value('people/character')=='单位'?'单位':'个人').'相关人关系'),$this->value('relative/relation'),'',false,false,false)?>
</select>
<button type="submit" name="submit[relative]">添加</button>
</span>
</div>

<div class="item">
<div class="title"><label>相关事务</label></div>
<?=$project_list?>
</div>

<div class="item" name="schedule">
<div class="title">
<span class="right">
<?=(double)$this->schedule->getSum(array('people'=>$this->people->id,'completed'=>true))?>小时
<a href="#schedule/lists?people=<?=$this->value('people/id')?>">所有日程>></a>
</span>
<label>最新日程:
<a href="javascript:$.createSchedule({people:<?=$this->value('people/id')?>,refreshOnSave:true})">添加>></a>
</label>
</div>
<?=$schedule_list?>
</div>

<div class="item">
<div class="title"><label>备注:</label></div>
<textarea name="people[comment]"><?=$this->value('people/comment')?></textarea>
</div>
</form>
<?=$this->javascript('people_add')?>
4 changes: 4 additions & 0 deletions application/views/project/edit.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,10 @@

<div class="item" name="schedule">
<div class="title">
<span class="right">
<?=(double)$this->schedule->getSum(array('project'=>$this->project->id,'completed'=>true))?>小时
<a href="#schedule/lists?people=<?=$this->value('project/id')?>">所有日程>></a>
</span>
<label>日程:
<a href="javascript:$.createSchedule({project:<?=$this->value('project/id')?>,refreshOnSave:true,target:this})">添加>></a>
<a href="#schedule/lists?project=<?=$this->value('project/id')?>" class="right">查看全部</a>
Expand Down

0 comments on commit 515e2f2

Please sign in to comment.