//
//  XVJobStatusToolView.m
//  fastservice
//
//  Created by xuning on 2/5/24.
//  Copyright © 2024 FastService. All rights reserved.
//

#import "XVJobStatusToolView.h"
#import "XVOrderSettingViewController.h"

@interface XVJobStatusToolView()

@property (nonatomic, strong) UIButton *settingButton;

@property (nonatomic, strong) UIButton *statusButton;


@end

@implementation XVJobStatusToolView

- (instancetype)initWithFrame:(CGRect)frame {
    if(self = [super initWithFrame:frame]) {
        [self setupUI];
    }
    return self;
}
- (void)setupUI {
    
    [self addSubview:self.settingButton];
    self.settingButton.frame = CGRectMake(22, 11, 48, 39);
    
    [self.settingButton setTitleEdgeInsets:
           UIEdgeInsetsMake(self.settingButton.frame.size.height/2,
                           (self.settingButton.frame.size.width-self.settingButton.titleLabel.intrinsicContentSize.width)/2-self.settingButton.imageView.frame.size.width,
                            0,
                           (self.settingButton.frame.size.width-self.settingButton.titleLabel.intrinsicContentSize.width)/2)];
    [self.settingButton setImageEdgeInsets:
               UIEdgeInsetsMake(
                           0,
                           (self.settingButton.frame.size.width-self.settingButton.imageView.frame.size.width)/2,
                                self.settingButton.titleLabel.intrinsicContentSize.height,
                           (self.settingButton.frame.size.width-self.settingButton.imageView.frame.size.width)/2)];
    
    [self addSubview:self.statusButton];
    
    [self.statusButton mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(self).mas_offset(90);
        make.right.mas_equalTo(self).mas_offset(-11);
        make.top.mas_equalTo(self).mas_offset(11);
        make.height.mas_equalTo(39);
    }];

    kViewBorderRadius(self.statusButton, 4, 0, COLOR_THEMEGRENN);
    
}
- (void)settingButtonClick {
    
    XVOrderSettingViewController *vc = [[XVOrderSettingViewController alloc]init];
    [self.viewController.navigationController pushViewController:vc animated:YES];
}

- (UIButton *)settingButton {
    if(_settingButton == nil) {
        _settingButton = [[UIButton alloc]initWithTitle:@"接单设置" fontSize:12 titleColor:F_415058_COLOR normalImageName:@"if-settings" selectedImgName:@"if-settings" backgroundColor:nil];
        [_settingButton addTarget:self action:@selector(settingButtonClick) forControlEvents:UIControlEventTouchUpInside];
        
    }
    return _settingButton;
}

- (UIButton *)statusButton {
    if(_statusButton == nil) {
        _statusButton = [[UIButton alloc]initWithTitle:@"上线" fontSize:14 titleColor:[UIColor whiteColor] bgColor:COLOR_THEMEGRENN];
    }
    return _statusButton;
}

@end
