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

#import "XVNewOrderAlter.h"

@interface XVNewOrderAlter()
//<BMKMapViewDelegate>

@property (nonatomic, strong) UIView *bottomView;
//@property (nonatomic, strong) BMKMapView *mapView;


@end

@implementation XVNewOrderAlter

+ (void)show {
    
    
    XVNewOrderAlter *view = [[XVNewOrderAlter alloc]init];
    // 计算alter的高度
    UIView *bgView = [[UIView alloc]initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH-16, SCREEN_HEIGHT)];
    bgView.backgroundColor = [UIColor whiteColor];
    [bgView addSubview:view];
    [view mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.right.top.mas_equalTo(bgView);
    }];
    [bgView layoutIfNeeded];
    bgView.height = view.height;
    
    [LEEAlert alert].config
        .LeeCustomView(bgView)
        .LeeMaxWidth(SCREEN_WIDTH-16)
        .LeeMaxHeight(SCREEN_HEIGHT)
        .LeeHeaderInsets(UIEdgeInsetsMake(0, 0, 0, 0))
        .LeeItemInsets(UIEdgeInsetsMake(0, 0, 0, 0))
        .LeeClickBackgroundClose(NO)
        .LeeCornerRadius(20.f)
        .LeeShow();
}
- (void)dealloc {
    DebugLog(@"XVNewOrderAlter dealloc");
//    if (_mapView) {
//        _mapView.delegate = nil;
//        _mapView = nil;
//    }
}

- (instancetype)initWithFrame:(CGRect)frame {
    if(self = [super initWithFrame:frame]) {
        [self setupUI];
    }
    return self;
}
- (void)setupUI {
    self.backgroundColor = [UIColor redColor];
    
//    [self addSubview:self.mapView];
////    self.mapView.zoomLevel = 17;
//    
//    [self addSubview:self.bottomView];
//    [self.bottomView mas_makeConstraints:^(MASConstraintMaker *make) {
//        make.left.right.bottom.mas_equalTo(self);
//        make.top.mas_equalTo(self.mapView.mas_bottom);
//        make.height.mas_equalTo(318);
//    }];
    
    kViewBorderRadius(self.bottomView, 20, 0, [UIColor whiteColor]);
    
}

- (UIView *)bottomView {
    if(_bottomView == nil) {
        _bottomView = [[UIView alloc]init];
        _bottomView.backgroundColor = [UIColor whiteColor];
    }
    return _bottomView;
}
//- (BMKMapView *)mapView {
//    if(_mapView == nil) {
//        _mapView = [[BMKMapView alloc]initWithFrame:CGRectMake(0, 0, kScreenWidth-16, 166)];
//        _mapView.delegate = self;
//    }
//    return _mapView;
//}
@end
