<?php
namespace app\admin\controller;

use app\admin\logic\FineLogic;
use app\admin\logic\StaffLogic;

class Fine extends AdminBase
{
    //员工罚款类型
    public function type(){
        if ($this->request->isAjax()) {
            $get = $this->request->get();
            $this->_success('获取数据成功', FineLogic::type($get));
        }
        return $this->fetch();
    }
    
    public function type_add(){
        if ($this->request->isAjax()) {
            $post = $this->request->post();
            $this->_success('增加罚款类别成功', FineLogic::type_add($post));
        }
       return $this->fetch(); 
    }
    
    public function type_eidt(){
        if ($this->request->isAjax()) {
            $post = $this->request->post();
            $this->_success('修改成功', FineLogic::type_eidt($post));
        }
      $id = $this->request->get('id');
      $this->assign('detail', FineLogic::type_fineinfo($id));
       return $this->fetch(); 
    }
    
    public function type_del(){
        $id = $this->request->post('id');
        $date=FineLogic::type_del($id);
        $this->_success('删除成功');
    }
    
    //罚款的列表
    public function lists(){
        if($this->request->isAjax()) {
             $get = $this->request->get();
             $this->_success('获取数据成功', FineLogic::lists($get));
         }
           $this->assign('staff',StaffLogic::serverstaff());
        return $this->fetch();
    }
    
    public function add(){
        if ($this->request->isAjax()) {
            $post = $this->request->post();
            $this->_success('增加成功', FineLogic::add($post)); 
        }
        $this->assign('staff',StaffLogic::stafflist());
        $this->assign('type',FineLogic::type_lists());
        return $this->fetch(); 
    }
    
    public function edit(){
        if ($this->request->isAjax()) {
            $post = $this->request->post();
            $this->_success('修改成功', FineLogic::edit($post));  
        }
        $id=$this->request->get('id');
        $this->assign('info',FineLogic::fineinfo($id));
        $this->assign('staff',StaffLogic::stafflist());
        $this->assign('type',FineLogic::type_lists());
        return $this->fetch(); 
    }
    
    public function del(){
        $id=$this->request->post('id');
        $del=FineLogic::finedel($id);
        $this->_success('删除罚款成功');  
    }
    
    public function proposal(){
        return $this->fetch();  
    }
    
    //处罚审核的内容
    public function done(){
        $post=$this->request->post();
        $del=FineLogic::done($post);
        $this->_success('成功');  
    }
    
    
    
}