//
//  MyWorkFlowFooterView.m
//  smartRhino
//
//  Created by tederen on 2019/11/7.
//  Copyright © 2019 tederen. All rights reserved.
//

#import "MyWorkFlowFooterView.h"
@interface MyWorkFlowFooterView()
//@property (nonatomic, strong) TDButton cancelButton;
@end



@implementation MyWorkFlowFooterView
- (instancetype)initWithFrame:(CGRect)frame{
    self = [super initWithFrame:frame];
    if (self) {
        [self addSubview:self.agreeView];
        [self addSubview:self.noAgreeView];
        [self addSubview:self.disscusView];
        [self addSubview:self.waitView];
        [self addSubview:self.nextAggreView];
        self.backgroundColor = [UIColor whiteColor];
        CGFloat with = self.frame.size.width/5;
        CGFloat heght = self.frame.size.height;
        self.agreeView.frame = CGRectMake(0,0,with,heght);
        self.noAgreeView.frame = CGRectMake(with,0, with, heght);
        self.waitView.frame = CGRectMake(with*2,0,with,heght);
        self.disscusView.frame = CGRectMake(with*3,0, with, heght);
        self.nextAggreView.frame = CGRectMake(with*4,0, with, heght);
    }
    return self;
}
- (MyWorkFlowFooterViewCell *)agreeView{
    if (!_agreeView) {
        _agreeView = [[MyWorkFlowFooterViewCell alloc]init];
        _agreeView.button.tag = 100;
        [_agreeView.button addTarget:self action:@selector(butoonhander:) forControlEvents:UIControlEventTouchDown];
    }
    return _agreeView;
}
- (MyWorkFlowFooterViewCell *)noAgreeView{
    if (!_noAgreeView) {
        _noAgreeView = [[MyWorkFlowFooterViewCell alloc]init];
        _noAgreeView.button.tag = 101;
         [_noAgreeView.button addTarget:self action:@selector(butoonhander:) forControlEvents:UIControlEventTouchDown];
        
    }
    return _noAgreeView;
}
- (MyWorkFlowFooterViewCell *)disscusView{
    if (!_disscusView) {
        _disscusView = [[MyWorkFlowFooterViewCell alloc]init];
        _disscusView.button.tag = 102;
         [_disscusView.button addTarget:self action:@selector(butoonhander:) forControlEvents:UIControlEventTouchDown];
        
    }
    return _disscusView;
}
- (MyWorkFlowFooterViewCell *)waitView{
    if (!_waitView) {
        _waitView = [[MyWorkFlowFooterViewCell alloc]init];
        _waitView.button.tag = 103;
        [_waitView.button addTarget:self action:@selector(butoonhander:) forControlEvents:UIControlEventTouchDown];
    }
    return _waitView;
}
- (MyWorkFlowFooterViewCell *)nextAggreView{
    if (!_nextAggreView) {
        _nextAggreView = [[MyWorkFlowFooterViewCell alloc]init];
        _nextAggreView.button.tag = 104;
         [_nextAggreView.button addTarget:self action:@selector(butoonhander:) forControlEvents:UIControlEventTouchDown];
        
    }
    return _nextAggreView;
}
- (void)butoonhander:(UIButton *)sender{
    if ([self.delegate respondsToSelector:@selector(didMyWorkFlowFooterViewBack:)]) {
        [self.delegate didMyWorkFlowFooterViewBack:sender.tag];
           return;
       }
}
@end
@implementation MyWorkFlowFooterViewCell

- (instancetype)initWithFrame:(CGRect)frame{
    self = [super initWithFrame:frame];
    if (self) {
        [self addSubview:self.imageVIew];
        [self addSubview:self.nameLab];
        [self addSubview:self.button];

        [self.nameLab mas_makeConstraints:^(MASConstraintMaker *make) {
            make.centerX.mas_equalTo(self).offset(15);
            make.centerY.equalTo(self);
        }];
        [self.imageVIew mas_makeConstraints:^(MASConstraintMaker *make) {
            make.right.equalTo(self.nameLab.mas_left).offset(-5);
            make.centerY.equalTo(self);
        }];
        [self.button mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.right.top.bottom.equalTo(self);
        }];
        
        
    }
    return self;
}
- (UILabel *)nameLab{
    if (!_nameLab) {
        _nameLab = [UILabel new];
        _nameLab.textColor = k6;
        _nameLab.font = [UIFont systemFontOfSize:16];
        
    }
    return _nameLab;
}
- (UIImageView *)imageVIew{
    if (!_imageVIew) {
        _imageVIew = [UIImageView new];
    }
    return _imageVIew;
}
- (UIButton *)button{
    if (!_button) {
        _button = [UIButton new];
        
    }
    return _button;
}
@end