//
//  UpcomingListHeadView.swift
//  MobilePortal
//
//  Created by caiyang on 2020/4/22.
//  Copyright © 2020 yin chen. All rights reserved.
//

import UIKit

class UpcomingListHeadView: UIView {
    var upcomingType:BusinessType = .UpcomingType
    var numStr: String? {
        didSet {
            if numStr == nil || numStr?.count == 0 {
                numStr = "0"
            }
            if upcomingType == .DoneType {
                titleLabel.text = "您有" + numStr! + "条已办已处理"
            }else{
                titleLabel.text = "您有" + numStr! + "条待办未处理"
            }
            titleLabel.attributeColor = UIColor.red
            titleLabel.underLine = false
            titleLabel.throughLine = false
            titleLabel.addAttributeTapAction(with: [numStr!]) { (string, range, index) in
            }
        }
    }
    lazy var titleLabel: UILabel = {
        let titleLabel = UILabel.init()
        titleLabel.textAlignment = .left
        titleLabel.font = UIFont.test_systemFont(ofSize: 12)
        titleLabel.numberOfLines = 0
        titleLabel.textColor = UIColorFromRGB(rgbValue: 0x23262A)
        self.addSubview(titleLabel)
        return titleLabel
    }()
    lazy var banjiBtn: UIButton = {
        let banjiBtn = UIButton.init(type: .custom)
        banjiBtn.setTitleColor(UIColorFromRGB(rgbValue: 0x3366FF), for: .normal)
        banjiBtn.titleLabel?.font = UIFont.test_systemFont(ofSize: 12)
        banjiBtn.setTitle("编辑", for: .normal)
        self.addSubview(banjiBtn)
        return banjiBtn
    }()
    
    override init(frame: CGRect) {
        super.init(frame: frame)
        titleLabel.frame = CGRect(x:30, y: 0, width:200 , height:self.height )
//        banjiBtn.frame = CGRect(x:SCREEN_WHIDTH()-60, y: 0, width:30 , height:self.height )
    }
    
    required init?(coder aDecoder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
}
