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

#import "XVNewJobViewController.h"
#import "XVOrderDetailsViewController.h"
#import "XVJobStatusToolView.h"
#import "XVNewJobViewCell.h"

@interface XVNewJobViewController ()<UITextFieldDelegate>



@property (nonatomic, strong) XVJobStatusToolView *toolView;

@property (nonatomic, strong) UITableView *tableView;

@end

@implementation XVNewJobViewController
#pragma mark - JXCategoryListContentViewDelegate

/**
 实现 <JXCategoryListContentViewDelegate> 协议方法，返回该视图控制器所拥有的「视图」
 */
- (UIView *)listView {
    return self.view;
}
- (void)viewDidLoad {
    [super viewDidLoad];


    
    [self setupUI];
}

- (void)setupUI {

    
    [self.view addSubview:self.toolView];
    [self.toolView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.bottom.mas_equalTo(self.view);
        make.centerX.mas_equalTo(self.view);
        make.width.mas_equalTo(SCREEN_WIDTH);
        make.height.mas_equalTo(61 + KiPhoneXSafeAreaDValue);
    }];
    
    [self.view addSubview:self.tableView];
    [self.tableView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(self.view);
        make.left.right.mas_equalTo(self.view);
        make.bottom.mas_equalTo(self.view.mas_safeAreaLayoutGuideBottom).mas_offset(-61);
    }];
    
}

#pragma mark - TableViewDelegate & Datasource
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
    return 10;
}

- (UITableViewCell*)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
    
    XVNewJobViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"XVNewJobViewCell"];
    
    return cell;
}

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
    
    XVOrderDetailsViewController *vc = [[XVOrderDetailsViewController alloc]init];
    [self.navigationController pushViewController:vc animated:YES];
    
}

- (void)textFieldDidChange:(UITextField *)textField {
    
}


- (XVJobStatusToolView *)toolView {
    if(_toolView == nil) {
        _toolView = [[XVJobStatusToolView alloc]init];
        _toolView.backgroundColor = [UIColor colorWithHexString:@"#EEEEEE"];
    }
    return _toolView;
}

- (UITableView *)tableView {
    if (_tableView == nil) {
        _tableView = [[UITableView alloc]initWithFrame:CGRectZero style:UITableViewStylePlain];
        _tableView.delegate = self;
        _tableView.dataSource = self;
        _tableView.emptyDataSetSource = self;
        _tableView.emptyDataSetDelegate = self;
        _tableView.tableFooterView = [UIView new];
        _tableView.backgroundColor = DEFAULT_BACKGROUND_COLOR;
        _tableView.rowHeight = UITableViewAutomaticDimension;
        
        _tableView.estimatedRowHeight = 100;
        _tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
        
        _tableView.estimatedSectionFooterHeight = 0;
        _tableView.estimatedSectionHeaderHeight = 0;
        
        [_tableView registerClass:[XVNewJobViewCell class] forCellReuseIdentifier:@"XVNewJobViewCell"];

    }
    return _tableView;
}

@end
