Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //
- // PaymentConfirmationNewView.m
- // Moselo
- //
- // Created by Axel Soedarsono on 11/15/17.
- // Copyright © 2017 Moselo. All rights reserved.
- //
- #import "PaymentConfirmationNewView.h"
- @interface PaymentConfirmationNewView ()
- @end
- @implementation PaymentConfirmationNewView
- #pragma mark - Lifecycle
- - (id)initWithFrame:(CGRect)frame {
- self = [super initWithFrame:frame];
- self.backgroundColor = [Util getColor:@"F5F5F5"];
- if(self) {
- _scrollView = [[UIScrollView alloc] initWithFrame:CGRectMake(0.0f, 0.0f, CGRectGetWidth(self.frame), CGRectGetHeight(self.frame))];
- [self.scrollView setContentSize:CGSizeMake(CGRectGetWidth(self.frame), 700.0f)];
- self.scrollView.showsHorizontalScrollIndicator = NO;
- self.scrollView.showsVerticalScrollIndicator = NO;
- self.scrollView.alwaysBounceVertical = YES;
- [self addSubview:self.scrollView];
- _paymentTotalPriceWithStatusView = [[UIView alloc] initWithFrame:CGRectMake(0.0f, 0.0f, CGRectGetWidth(self.frame), 130.0f)];
- self.paymentTotalPriceWithStatusView.backgroundColor = [Util getColor:@"FFFFFF"];
- [self.scrollView addSubview:self.paymentTotalPriceWithStatusView];
- _separator1View = [[UIView alloc] initWithFrame:CGRectMake(0.0f, CGRectGetMaxY(self.paymentTotalPriceWithStatusView.frame) - [Util lineMinimumHeight], CGRectGetWidth(self.frame), [Util lineMinimumHeight])];
- self.separator1View.backgroundColor = [Util getColor:@"DDDDDD"];
- [self.scrollView addSubview:self.separator1View];
- _totalPriceLabel = [[UILabel alloc] initWithFrame:CGRectMake((CGRectGetWidth(self.paymentTotalPriceWithStatusView.frame) - 53.0f)/2.0f, 21.0f, 53.0f, 14.0f)];
- self.totalPriceLabel.text = NSLocalizedString(@"Total (Rp)", @"");
- self.totalPriceLabel.font = [UIFont fontWithName:FONT_LATO_REGULAR size:12.0f];
- self.totalPriceLabel.textColor = [Util getColor:@"AAAAAA"];
- self.totalPriceLabel.textAlignment = NSTextAlignmentCenter;
- [self.paymentTotalPriceWithStatusView addSubview:self.totalPriceLabel];
- _totalPriceNumberLabel = [[UILabel alloc] initWithFrame:CGRectMake(16.0f, CGRectGetMaxY(self.totalPriceLabel.frame) + 10.0f, CGRectGetWidth(self.paymentTotalPriceWithStatusView.frame) - 16.0f - 16.0f, 32.0f)];
- // self.totalPriceNumberLabel.text = NSLocalizedString(@"515.000", @"");
- self.totalPriceNumberLabel.font = [UIFont fontWithName:FONT_LATO_BOLD size:30.0f];
- self.totalPriceNumberLabel.textColor = [Util getColor:@"333333"];
- self.totalPriceNumberLabel.textAlignment = NSTextAlignmentCenter;
- [self.paymentTotalPriceWithStatusView addSubview:self.totalPriceNumberLabel];
- _paymentStatusNotificationView = [[UIView alloc] initWithFrame:CGRectMake((CGRectGetWidth(self.paymentTotalPriceWithStatusView.frame) - 120.0f)/2.0f, CGRectGetMaxY(self.totalPriceNumberLabel.frame) + 14.0f, 120.0f, 20.0f)];
- self.paymentStatusNotificationView.layer.cornerRadius = CGRectGetHeight(self.paymentStatusNotificationView.frame)/2.0f;
- [self.paymentTotalPriceWithStatusView addSubview:self.paymentStatusNotificationView];
- _paymentStatusNotificationLabel = [[UILabel alloc] initWithFrame:CGRectMake(5.0f, 3.0f, 110.0f, 14.0f)];
- self.paymentStatusNotificationLabel.font = [UIFont fontWithName:FONT_LATO_BOLD size:10.0f];
- self.paymentStatusNotificationLabel.textAlignment = NSTextAlignmentCenter;
- [self.paymentStatusNotificationView addSubview:self.paymentStatusNotificationLabel];
- //AS TEMP PAYMENT PENDING
- self.paymentStatusNotificationView.backgroundColor = [UIColor whiteColor];
- self.paymentStatusNotificationView.layer.borderWidth = 1.0f;
- self.paymentStatusNotificationView.layer.borderColor = [Util getColor:@"AB81C5"].CGColor;
- self.paymentStatusNotificationLabel.textColor = [Util getColor:@"AB81C5"];
- self.paymentStatusNotificationLabel.text = NSLocalizedString(@"PAYMENT PENDING", @"");
- //END AS TEMP
- _paymentConfirmationContainerView = [[UIView alloc]initWithFrame:CGRectMake(0.0f, CGRectGetMaxY(self.separator1View.frame), CGRectGetWidth(self.scrollView.frame), CGRectGetHeight(self.frame) - CGRectGetHeight(self.paymentTotalPriceWithStatusView.frame))];
- self.paymentConfirmationContainerView.backgroundColor = [Util getColor:@"F5F5F5"];
- [self.scrollView addSubview:self.paymentConfirmationContainerView];
- _paymentConfirmationBlankLabel = [[UILabel alloc] initWithFrame:CGRectMake((CGRectGetWidth(self.paymentConfirmationContainerView.frame) - 130.0f )/2.0f, 80.0f, 130.0f, 30.0f)];
- self.paymentConfirmationBlankLabel.numberOfLines = 0;
- self.paymentConfirmationBlankLabel.text = NSLocalizedString(@"You haven’t made any\npayment confirmation", @"");
- self.paymentConfirmationBlankLabel.font = [UIFont fontWithName:FONT_LATO_REGULAR size:13.0f];
- self.paymentConfirmationBlankLabel.textColor = [Util getColor:@"AAAAAA"];
- // CGSize paymentConfirmationBlankLabelSize = [self.paymentConfirmationBlankLabel sizeThatFits:CGSizeMake(130.0f, CGFLOAT_MAX)];
- // self.paymentConfirmationBlankLabel.frame = CGRectMake((CGRectGetWidth(self.paymentConfirmationContainerView.frame) - 130.0f )/2.0f, 80.0f, 130.0f, paymentConfirmationBlankLabelSize.height);
- self.paymentConfirmationBlankLabel.textAlignment = NSTextAlignmentCenter;
- [self.paymentConfirmationContainerView addSubview:self.paymentConfirmationBlankLabel];
- //IF THERE'S AN ORDER IN ROLE USER || EXPERT
- _paymentConfirmationItemView = [[UIView alloc] initWithFrame:CGRectMake(16.0f, 16.0f, CGRectGetWidth(self.paymentConfirmationContainerView.frame) - 16.0 - 16.0f, 322.0f)];
- self.paymentConfirmationItemView.layer.cornerRadius = 4.0f;
- self.paymentConfirmationItemView.layer.masksToBounds = YES;
- self.paymentConfirmationItemView.clipsToBounds = YES;
- self.paymentConfirmationItemView.layer.borderWidth = 1.0f;
- self.paymentConfirmationItemView.layer.borderColor = [Util getColor:@"EEEEEE"].CGColor;
- self.paymentConfirmationItemView.backgroundColor = [Util getColor:@"FFFFFF"];
- [self.paymentConfirmationContainerView addSubview:self.paymentConfirmationItemView];
- _paymentConfirmationItemImageContainerView = [[UIView alloc] initWithFrame:CGRectMake(0.0f, 0.0f, CGRectGetWidth(self.paymentConfirmationItemView.frame), 128.0f)];
- //AS TEMP ImageContainer
- UIBezierPath *maskPath = [UIBezierPath bezierPathWithRoundedRect:CGRectMake(0.0f, 0.0f, CGRectGetWidth(self.paymentConfirmationItemImageContainerView.frame),CGRectGetHeight(self.paymentConfirmationItemImageContainerView.frame))
- byRoundingCorners:(UIRectCornerTopLeft|UIRectCornerTopRight)
- cornerRadii:CGSizeMake(5.0, 5.0)];
- CAShapeLayer *maskLayer = [[CAShapeLayer alloc] init];
- maskLayer.frame = CGRectMake(0.0f, 0.0f, CGRectGetWidth(self.frame), 44.0f);
- maskLayer.path = maskPath.CGPath;
- self.paymentConfirmationItemImageContainerView.layer.mask = maskLayer;
- //END AS TEMP ImageContainer
- [self.paymentConfirmationItemView addSubview:self.paymentConfirmationItemImageContainerView];
- _paymentConfirmationItemImageView = [[RNImageView alloc] initWithFrame:CGRectMake(0.0f, 0.0f, CGRectGetWidth(self.paymentConfirmationItemView.frame), 128.0f)];
- // self.paymentConfirmationItemImageView.image = [UIImage imageNamed:@"testCover"];
- self.paymentConfirmationItemImageView.contentMode = UIViewContentModeScaleAspectFill;
- self.paymentConfirmationItemImageView.layer.borderWidth = 1.0f;
- self.paymentConfirmationItemImageView.layer.borderColor = [Util getColor:@"EEEEEE"].CGColor;
- self.paymentConfirmationItemImageView.clipsToBounds = YES;
- self.paymentConfirmationItemImageView.layer.masksToBounds = YES;
- //AS TEMP UIBezierPath RNImage
- UIBezierPath *maskPathImage = [UIBezierPath bezierPathWithRoundedRect:CGRectMake(0.0f, 0.0f, CGRectGetWidth(self.paymentConfirmationItemImageView.frame),CGRectGetHeight(self.paymentConfirmationItemImageView.frame))
- byRoundingCorners:(UIRectCornerTopLeft|UIRectCornerTopRight)
- cornerRadii:CGSizeMake(5.0, 5.0)];
- CAShapeLayer *maskLayerImage = [[CAShapeLayer alloc] init];
- maskLayerImage.frame = CGRectMake(0.0f, 0.0f, CGRectGetWidth(self.frame), 44.0f);
- maskLayerImage.path = maskPathImage.CGPath;
- self.paymentConfirmationItemImageView.layer.mask = maskLayerImage;
- //END AS TEMP UIBezierPath RNImage
- [self.paymentConfirmationItemImageContainerView addSubview:self.paymentConfirmationItemImageView];
- _paymentConfirmationItemDatetimeLabel = [[UILabel alloc] initWithFrame:CGRectMake(17.0f, CGRectGetMaxY(self.paymentConfirmationItemImageView.frame) + 18.0f, 125.0f, 15.0f)];
- // self.paymentConfirmationItemDatetimeLabel.text = NSLocalizedString(@"08 Feb 2017, 21:00", @"");
- self.paymentConfirmationItemDatetimeLabel.font = [UIFont fontWithName:FONT_LATO_REGULAR size:13.0f];
- self.paymentConfirmationItemDatetimeLabel.textColor = [Util getColor:@"444444"];
- self.paymentConfirmationItemDatetimeLabel.textAlignment = NSTextAlignmentLeft;
- [self.paymentConfirmationItemView addSubview:self.paymentConfirmationItemDatetimeLabel];
- _paymentConfirmationItemPriceLabel = [[UILabel alloc] initWithFrame:CGRectMake(CGRectGetWidth(self.paymentConfirmationItemView.frame) - 16.0f - (CGRectGetWidth(self.paymentConfirmationItemView.frame) - 17.0f - 125.0f - 5.0f - 16.0f), CGRectGetMaxY(self.paymentConfirmationItemImageView.frame) + 15.0f, CGRectGetWidth(self.paymentConfirmationItemView.frame) - 17.0f - 125.0f - 5.0f - 16.0f, 20.0f)];
- // self.paymentConfirmationItemPriceLabel.text = NSLocalizedString(@"Rp 99.000.000.000", @"");
- self.paymentConfirmationItemPriceLabel.font = [UIFont fontWithName:FONT_LATO_BOLD size:18.0f];
- self.paymentConfirmationItemPriceLabel.textColor = [Util getColor:@"444444"];
- self.paymentConfirmationItemPriceLabel.textAlignment = NSTextAlignmentRight;
- [self.paymentConfirmationItemView addSubview:self.paymentConfirmationItemPriceLabel];
- _iconTransferDestinationImageView = [[UIImageView alloc] initWithFrame:CGRectMake(17.0f, CGRectGetMaxY(self.paymentConfirmationItemPriceLabel.frame) + 14.0f, 15.0f, 17.0f)];
- self.iconTransferDestinationImageView.image = [UIImage imageNamed:@"arrowRightGray"];
- self.iconTransferDestinationImageView.contentMode = UIViewContentModeScaleAspectFit;
- [self.paymentConfirmationItemView addSubview:self.iconTransferDestinationImageView];
- _bankAccountTransferDestinationLabel = [[UILabel alloc] initWithFrame:CGRectMake(CGRectGetMaxX(self.iconTransferDestinationImageView.frame) + 18.0f, CGRectGetMinY(self.iconTransferDestinationImageView.frame), CGRectGetWidth(self.paymentConfirmationItemView.frame) - 17.0f - 17.0f - 18.0f - 17.0f, 15.0f)];
- self.bankAccountTransferDestinationLabel.numberOfLines = 0;
- // self.bankAccountTransferDestinationLabel.text = NSLocalizedString(@"Bank Central Asia: 131-00-12210-888", @"");
- self.bankAccountTransferDestinationLabel.font = [UIFont fontWithName:FONT_LATO_REGULAR size:13.0f];
- self.bankAccountTransferDestinationLabel.textColor = [Util getColor:@"444444"];
- // CGSize bankAccountTransferDestinationLabelSize = [self.bankAccountTransferDestinationLabel sizeThatFits:CGSizeMake(CGRectGetWidth(self.paymentConfirmationItemView.frame) - 17.0f - 17.0f - 18.0f - 17.0f, CGFLOAT_MAX)];
- // self.bankAccountTransferDestinationLabel.frame = CGRectMake(CGRectGetMaxX(self.iconTransferDestinationImageView.frame) + 18.0f, CGRectGetMinY(self.iconTransferDestinationImageView.frame), CGRectGetWidth(self.paymentConfirmationItemView.frame) - 17.0f - 17.0f - 18.0f - 17.0f, bankAccountTransferDestinationLabelSize.height);
- self.bankAccountTransferDestinationLabel.textAlignment = NSTextAlignmentLeft;
- [self.paymentConfirmationItemView addSubview:self.bankAccountTransferDestinationLabel];
- _bankAccountUsernameTransferDestinationLabel = [[UILabel alloc] initWithFrame:CGRectMake(CGRectGetMaxX(self.iconTransferDestinationImageView.frame) + 18.0f, CGRectGetMaxY(self.bankAccountTransferDestinationLabel.frame) + 3.0f, CGRectGetWidth(self.paymentConfirmationItemView.frame) - 17.0f - 17.0f - 18.0f - 17.0f, 15.0f)];
- self.bankAccountUsernameTransferDestinationLabel.numberOfLines = 0;
- // self.bankAccountUsernameTransferDestinationLabel.text = NSLocalizedString(@"Adaniwafi Kodok1 Kodok2 Kodok3 Kodok4", @"");
- self.bankAccountUsernameTransferDestinationLabel.font = [UIFont fontWithName:FONT_LATO_REGULAR size:13.0f];
- self.bankAccountUsernameTransferDestinationLabel.textColor = [Util getColor:@"444444"];
- // CGSize bankAccountUsernameTransferDestinationLabelSize = [self.bankAccountUsernameTransferDestinationLabel sizeThatFits:CGSizeMake(CGRectGetWidth(self.paymentConfirmationItemView.frame) - 17.0f - 17.0f - 18.0f - 17.0f, CGFLOAT_MAX)];
- // self.bankAccountUsernameTransferDestinationLabel.frame = CGRectMake(CGRectGetMaxX(self.iconTransferDestinationImageView.frame) + 18.0f, CGRectGetMaxY(self.bankAccountTransferDestinationLabel.frame) + 3.0f, CGRectGetWidth(self.paymentConfirmationItemView.frame) - 17.0f - 17.0f - 18.0f - 17.0f, bankAccountUsernameTransferDestinationLabelSize.height);
- self.bankAccountUsernameTransferDestinationLabel.textAlignment = NSTextAlignmentLeft;
- [self.paymentConfirmationItemView addSubview:self.bankAccountUsernameTransferDestinationLabel];
- _iconSenderImageView = [[UIImageView alloc] initWithFrame:CGRectMake(14.0f, CGRectGetMaxY(self.bankAccountUsernameTransferDestinationLabel.frame) + 16.0f, 20.0f, 16.0f)];
- self.iconSenderImageView.image = [UIImage imageNamed:@"cardLogo"];
- self.iconSenderImageView.contentMode = UIViewContentModeScaleAspectFit;
- [self.paymentConfirmationItemView addSubview:self.iconSenderImageView];
- _bankAccountSenderLabel = [[UILabel alloc] initWithFrame:CGRectMake(CGRectGetMaxX(self.iconSenderImageView.frame) + 15.0f, CGRectGetMinY(self.iconSenderImageView.frame) - 0.5f, CGRectGetWidth(self.paymentConfirmationItemView.frame) - 14.0f - 20.0f - 15.0f - 17.0f, 15.0f)];
- self.bankAccountSenderLabel.numberOfLines = 0;
- // self.bankAccountSenderLabel.text = NSLocalizedString(@"Bank BRI: 777-1087-888", @"");
- self.bankAccountSenderLabel.font = [UIFont fontWithName:FONT_LATO_REGULAR size:13.0f];
- self.bankAccountSenderLabel.textColor = [Util getColor:@"444444"];
- // CGSize bankAccountSenderLabelSize = [self.bankAccountSenderLabel sizeThatFits:CGSizeMake(CGRectGetWidth(self.paymentConfirmationItemView.frame) - 14.0f - 20.0f - 15.0f - 17.0f, CGFLOAT_MAX)];
- // self.bankAccountSenderLabel.frame = CGRectMake(CGRectGetMaxX(self.iconSenderImageView.frame) + 15.0f, CGRectGetMinY(self.iconSenderImageView.frame) - 0.5f, CGRectGetWidth(self.paymentConfirmationItemView.frame) - 14.0f - 20.0f - 15.0f - 17.0f, bankAccountSenderLabelSize.height);
- self.bankAccountSenderLabel.textAlignment = NSTextAlignmentLeft;
- [self.paymentConfirmationItemView addSubview:self.bankAccountSenderLabel];
- _bankAccountUsernameSenderLabel = [[UILabel alloc] initWithFrame:CGRectMake(CGRectGetMaxX(self.iconSenderImageView.frame) + 15.0f, CGRectGetMaxY(self.bankAccountSenderLabel.frame) + 3.0f, CGRectGetWidth(self.paymentConfirmationItemView.frame) - 14.0f - 20.0f - 15.0f - 17.0f, 15.0f)];
- self.bankAccountUsernameSenderLabel.numberOfLines = 0;
- // self.bankAccountUsernameSenderLabel.text = NSLocalizedString(@"Rizka FM KODOK KODOK KODOK KODOK KODOK KODOK KODOK KODOK KODOK KODOK KODOK KODOK KODOK KODOK KODOK KODOK KODOK KODOK KODOK KODOK KODOK KODOK KODOK KODOK KODOK KODOK KODOK KODOK KODOK KODOK KODOK KODOK asdasd", @"");
- self.bankAccountUsernameSenderLabel.font = [UIFont fontWithName:FONT_LATO_REGULAR size:13.0f];
- self.bankAccountUsernameSenderLabel.textColor = [Util getColor:@"444444"];
- // CGSize bankAccountUsernameSenderLabelSize = [self.bankAccountUsernameSenderLabel sizeThatFits:CGSizeMake(CGRectGetWidth(self.paymentConfirmationItemView.frame) - 14.0f - 20.0f - 15.0f - 17.0f, CGFLOAT_MAX)];
- // self.bankAccountUsernameSenderLabel.frame = CGRectMake(CGRectGetMaxX(self.iconSenderImageView.frame) + 15.0f, CGRectGetMaxY(self.bankAccountSenderLabel.frame) + 3.0f, CGRectGetWidth(self.paymentConfirmationItemView.frame) - 14.0f - 20.0f - 15.0f - 17.0f, bankAccountUsernameSenderLabelSize.height);
- self.bankAccountUsernameSenderLabel.textAlignment = NSTextAlignmentLeft;
- [self.paymentConfirmationItemView addSubview:self.bankAccountUsernameSenderLabel];
- //UPDATE PaymenConfirmationItemView
- self.paymentConfirmationItemView.frame = CGRectMake(16.0f, 16.0f, CGRectGetWidth(self.paymentConfirmationContainerView.frame) - 16.0 - 16.0f, CGRectGetMaxY(self.bankAccountUsernameSenderLabel.frame) + 22.0f + 45.0f);
- //WAITING CONFIRMATION
- _statusConfirmationView = [[UIView alloc] initWithFrame:CGRectMake(0.0f, CGRectGetHeight(self.paymentConfirmationItemView.frame) - 45.0f, CGRectGetWidth(self.paymentConfirmationItemView.frame), 45.0f)];
- self.statusConfirmationView.alpha = 0.0f;
- self.statusConfirmationView.backgroundColor = [Util getColor:@"FFFFFF"];
- self.statusConfirmationLabel.clipsToBounds = YES;
- self.statusConfirmationLabel.layer.masksToBounds = YES;
- [self.paymentConfirmationItemView addSubview:self.statusConfirmationView];
- _statusConfirmationLabel = [[UILabel alloc] initWithFrame:CGRectMake((CGRectGetWidth(self.statusConfirmationView.frame) - 160.0f)/2.0f, (CGRectGetHeight(self.statusConfirmationView.frame) - 18.0f)/2.0f, 160.0f, 18.0f)];
- self.statusConfirmationLabel.text = NSLocalizedString(@"Waiting Confirmation", @"");
- self.statusConfirmationLabel.font = [UIFont fontWithName:FONT_LATO_REGULAR size:16.0f];
- self.statusConfirmationLabel.textColor = [Util getColor:@"CCCCCC"];
- self.statusConfirmationLabel.textAlignment = NSTextAlignmentCenter;
- [self.statusConfirmationView addSubview:self.statusConfirmationLabel];
- _separatorUpperView = [[UIView alloc] initWithFrame:CGRectMake(0.0f, CGRectGetMinY(self.statusConfirmationView.frame) - [Util lineMinimumHeight], CGRectGetWidth(self.paymentConfirmationItemView.frame), [Util lineMinimumHeight])];
- self.separatorUpperView.backgroundColor = [Util getColor:@"EEEEEE"];
- self.separatorUpperView.alpha = 0.0f;
- [self.paymentConfirmationItemView addSubview:self.separatorUpperView];
- //END WAITING CONFIRMATION
- //ACCEPT & DECLINE FOR EXPERT PAYMENT CONFIRMATION FROM USER
- //LEFT OPTION VIEW (DECLINE)
- _leftOptionView = [[UIView alloc] initWithFrame:CGRectMake(0.0f, CGRectGetHeight(self.paymentConfirmationItemView.frame) - 45.0f, CGRectGetWidth(self.paymentConfirmationItemView.frame)/2.0f, 45.0f)];
- self.leftOptionView.alpha = 0.0f;
- [self.paymentConfirmationItemView addSubview:self.leftOptionView];
- //RIGHT OPTION VIEW (ACCEPT)
- _rightOptionView = [[UIView alloc] initWithFrame:CGRectMake(CGRectGetMaxX(self.leftOptionView.frame), CGRectGetMinY(self.leftOptionView.frame), CGRectGetWidth(self.paymentConfirmationItemView.frame)/2.0f, CGRectGetHeight(self.leftOptionView.frame))];
- self.rightOptionView.alpha = 0.0f;
- [self.paymentConfirmationItemView addSubview:self.rightOptionView];
- //SEPARATOR MID
- _separatorMidView = [[UIView alloc] initWithFrame:CGRectMake(CGRectGetMaxX(self.leftOptionView.frame), CGRectGetMinY(self.leftOptionView.frame), [Util lineMinimumHeight], CGRectGetHeight(self.leftOptionView.frame))];
- self.separatorMidView.backgroundColor = [Util getColor:@"EEEEEE"];
- self.separatorMidView.alpha = 0.0f;
- [self.paymentConfirmationItemView addSubview:self.separatorMidView];
- _separatorUpperView = [[UIView alloc] initWithFrame:CGRectMake(0.0f, CGRectGetMinY(self.leftOptionView.frame) - [Util lineMinimumHeight], CGRectGetWidth(self.paymentConfirmationItemView.frame), [Util lineMinimumHeight])];
- self.separatorUpperView.backgroundColor = [Util getColor:@"EEEEEE"];
- self.separatorUpperView.alpha = 0.0f;
- [self.paymentConfirmationItemView addSubview:self.separatorUpperView];
- //LEFTOPTION LABEL
- _leftOptionLabel = [[UILabel alloc] initWithFrame:CGRectMake((CGRectGetWidth(self.leftOptionView.frame) - 55.0f)/2.0f, ((CGRectGetHeight(self.leftOptionView.frame) - 18.0f)/2.0f) - 1.5f, 55.0f, 18.0f)];
- self.leftOptionLabel.text = NSLocalizedString(@"Decline", @"");
- self.leftOptionLabel.font = [UIFont fontWithName:FONT_LATO_REGULAR size:16.0f];
- self.leftOptionLabel.textColor = [Util getColor:@"FF5656"];
- self.leftOptionLabel.textAlignment = NSTextAlignmentCenter;
- [self.leftOptionView addSubview:self.leftOptionLabel];
- //RIGHTOPTION LABEL
- _rightOptionLabel = [[UILabel alloc] initWithFrame:CGRectMake((CGRectGetWidth(self.rightOptionView.frame) - 53.0f)/2.0f, ((CGRectGetHeight(self.rightOptionView.frame) - 18.0f)/2.0f) - 1.5f, 53.0f, 18.0f)];
- self.rightOptionLabel.text = NSLocalizedString(@"Accept", @"");
- self.rightOptionLabel.font = [UIFont fontWithName:FONT_LATO_REGULAR size:16.0f];
- self.rightOptionLabel.textColor = [Util getColor:@"2ECCAD"];
- self.rightOptionLabel.textAlignment = NSTextAlignmentCenter;
- [self.rightOptionView addSubview:self.rightOptionLabel];
- //LEFTOPTION BUTTON
- _leftOptionButton = [[UIButton alloc] initWithFrame:CGRectMake(0.0f, CGRectGetHeight(self.paymentConfirmationItemView.frame) - 45.0f, CGRectGetWidth(self.paymentConfirmationItemView.frame)/2.0f, 45.0f)];
- self.leftOptionButton.alpha = 0.0f;
- [self.paymentConfirmationItemView addSubview:self.leftOptionButton];
- //RIGHTOPTION BUTTON
- _rightOptionButton = [[UIButton alloc] initWithFrame:CGRectMake(CGRectGetMaxX(self.leftOptionButton.frame), CGRectGetMinY(self.leftOptionButton.frame), CGRectGetWidth(self.paymentConfirmationItemView.frame)/2.0f, CGRectGetHeight(self.leftOptionButton.frame))];
- self.rightOptionButton.alpha = 0.0f;
- [self.paymentConfirmationItemView addSubview:self.rightOptionButton];
- //END ACCEPT & DECLINE FOR EXPERT PAYMENT CONFIRMATION FROM USER
- //CREATE CONFIRMATION BUTTON FOR USER
- _createConfirmationContainerView = [[UIView alloc] initWithFrame:CGRectMake(0.0f, CGRectGetHeight(self.frame) - 56.0f, CGRectGetWidth(self.frame), 56.0f)];
- //AS TEMP
- self.createConfirmationContainerView.alpha = 1.0f; //IF USER
- // self.createConfirmationContainerView.alpha = 0.0f; //IF EXPERT
- //END AS TEMP
- self.createConfirmationContainerView.backgroundColor = [Util getColor:@"FFFFFF"];
- [self addSubview:self.createConfirmationContainerView];
- _separatorUppercreateConfirmationContainerView = [[UIView alloc] initWithFrame:CGRectMake(0.0f, 0.0f, CGRectGetWidth(self.createConfirmationContainerView.frame), 1.0f)];
- self.separatorUppercreateConfirmationContainerView.backgroundColor = [Util getColor:@"DDDDDD"];
- [self.createConfirmationContainerView addSubview:self.separatorUppercreateConfirmationContainerView];
- _createConfirmationView = [[UIView alloc] initWithFrame:CGRectMake(8.0f, 8.0f, CGRectGetWidth(self.createConfirmationContainerView.frame) - 8.0f - 8.0f, CGRectGetHeight(self.createConfirmationContainerView.frame) - 8.0f - 8.0f)];
- self.createConfirmationView.layer.cornerRadius = 4.0f;
- self.createConfirmationView.layer.borderWidth = 1.0f;
- self.createConfirmationView.layer.borderColor = [Util getColor:@"17B293"].CGColor;
- self.createConfirmationView.backgroundColor = [Util getColor:@"2ECCAD"];
- [self. createConfirmationContainerView addSubview:self.createConfirmationView];
- _createConfirmationLabel = [[UILabel alloc] initWithFrame:CGRectMake((CGRectGetWidth(self.createConfirmationView.frame) - 150.0f)/2.0f, (CGRectGetHeight(self.createConfirmationView.frame) - 16.0f)/2.0f, 150.0f, 16.0f)];
- self.createConfirmationLabel.text = NSLocalizedString(@"Create Confirmation", @"");
- self.createConfirmationLabel.font = [UIFont fontWithName:FONT_NAME_BOLD size:14.0f];
- self.createConfirmationLabel.textColor = [Util getColor:@"FFFFFF"];
- self.createConfirmationLabel.textAlignment = NSTextAlignmentCenter;
- [self.createConfirmationView addSubview:self.createConfirmationLabel];
- _createConfirmationButton = [[UIButton alloc] initWithFrame:CGRectMake(8.0f, 8.0f, CGRectGetWidth(self.createConfirmationContainerView.frame) - 8.0f - 8.0f, CGRectGetHeight(self.createConfirmationContainerView.frame) - 8.0f - 8.0f)];
- [self.createConfirmationContainerView addSubview:self.createConfirmationButton];
- self.scrollView.contentSize = CGSizeMake(CGRectGetWidth(self.scrollView.frame), CGRectGetMaxY(self.paymentConfirmationContainerView.frame) + 40.0f + CGRectGetHeight(self.createConfirmationContainerView.frame));
- }
- return self;
- }
- #pragma mark - Custom Method
- - (void)setPaymentConfirmationNewViewType:(PaymentConfirmationNewViewType)paymentConfirmationNewViewType {
- _paymentConfirmationNewViewType = paymentConfirmationNewViewType;
- if(self.paymentConfirmationNewViewType == PaymentConfirmationNewViewTypeCancelled) {
- self.paymentStatusNotificationView.backgroundColor = [Util getColor:@"FF5656"];
- self.paymentStatusNotificationView.layer.borderWidth = 0.0f;
- self.paymentStatusNotificationLabel.textColor = [UIColor whiteColor];
- self.paymentStatusNotificationLabel.text = NSLocalizedString(@"CANCELLED", @"");
- }
- else if(self.paymentConfirmationNewViewType == PaymentConfirmationNewViewTypeConfirmed) {
- self.paymentStatusNotificationView.backgroundColor = [UIColor whiteColor];
- self.paymentStatusNotificationView.layer.borderWidth = 1.0f;
- self.paymentStatusNotificationView.layer.borderColor = [Util getColor:@"2ECCAD"].CGColor;
- self.paymentStatusNotificationLabel.textColor = [Util getColor:@"2ECCAD"];
- self.paymentStatusNotificationLabel.text = NSLocalizedString(@"USER CONFIRMED", @"");
- }
- else if(self.paymentConfirmationNewViewType == PaymentConfirmationTypeDeclined) {
- self.paymentStatusNotificationView.backgroundColor = [Util getColor:@"FF5656"];
- self.paymentStatusNotificationView.layer.borderWidth = 0.0f;
- self.paymentStatusNotificationLabel.textColor = [UIColor whiteColor];
- self.paymentStatusNotificationLabel.text = NSLocalizedString(@"EXPERT DECLINED", @"");
- }
- else if(self.paymentConfirmationNewViewType == PaymentConfirmationTypeAccepted) {
- self.paymentStatusNotificationView.backgroundColor = [UIColor whiteColor];
- self.paymentStatusNotificationView.layer.borderWidth = 1.0f;
- self.paymentStatusNotificationView.layer.borderColor = [Util getColor:@"AB81C5"].CGColor;
- self.paymentStatusNotificationLabel.textColor = [Util getColor:@"AB81C5"];
- self.paymentStatusNotificationLabel.text = NSLocalizedString(@"PAYMENT PENDING", @"");
- }
- else if(self.paymentConfirmationNewViewType == PaymentConfirmationNewViewTypeUserConfirmed) {
- self.paymentStatusNotificationView.backgroundColor = [Util getColor:@"2ECCAD"];
- self.paymentStatusNotificationView.layer.borderWidth = 0.0f;
- self.paymentStatusNotificationLabel.textColor = [UIColor whiteColor];
- //NSString *formattedString = [NSString stringWithFormat:@"%li PAYMENT CONFIRMED", (long)numberOfPaymentConfirmed];
- self.paymentStatusNotificationLabel.text = NSLocalizedString(@"PAYMENT CONFIRMED", @"");
- }
- else if(self.paymentConfirmationNewViewType == PaymentConfirmationNewViewTypeCompleted) {
- self.paymentStatusNotificationView.backgroundColor = [Util getColor:@"AB81C5"];
- self.paymentStatusNotificationView.layer.borderWidth = 0.0f;
- self.paymentStatusNotificationLabel.textColor = [UIColor whiteColor];
- self.paymentStatusNotificationLabel.text = NSLocalizedString(@"PAYMENT COMPLETED", @"");
- }
- else if(self.paymentConfirmationNewViewType == PaymentConfirmationNewViewTypeOverpaid) {
- self.paymentStatusNotificationView.backgroundColor = [UIColor whiteColor];
- self.paymentStatusNotificationView.layer.borderWidth = 1.0f;
- self.paymentStatusNotificationView.layer.borderColor = [Util getColor:@"FF5656"].CGColor;
- self.paymentStatusNotificationLabel.textColor = [Util getColor:@"FF5656"];
- self.paymentStatusNotificationLabel.text = NSLocalizedString(@"OVERPAID", @"");
- }
- }
- - (void)setPaymentConfirmationNewViewButtonType:(PaymentConfirmationNewViewButtonType)paymentConfirmationNewViewButtonType {
- //User = 0 || Expert = 1
- _paymentConfirmationNewViewButtonType = paymentConfirmationNewViewButtonType;
- if(self.paymentConfirmationNewViewButtonType == PaymentConfirmationNewViewButtonTypeUser) {
- //DISPLAY BUTTON CREATE CONFIRMATION
- self.createConfirmationContainerView.alpha = 1.0f;
- }
- else if (self.paymentConfirmationNewViewButtonType == PaymentConfirmationNewViewButtonTypeExpert) {
- //HIDE BUTTON CREATE CONFIRMATION
- self.createConfirmationContainerView.alpha = 0.0f;
- }
- }
- - (void)setPaymentConfirmationNewViewStatusOrActionType:(PaymentConfirmationNewViewStatusOrActionType)paymentConfirmationNewViewStatusOrActionType {
- _paymentConfirmationNewViewStatusOrActionType = paymentConfirmationNewViewStatusOrActionType;
- if(self.paymentConfirmationNewViewStatusOrActionType == PaymentConfirmationNewViewStatusOrActionTypeUser) {
- //IF USER SHOW "Waiting Confirmation"
- self.statusConfirmationView.alpha = 1.0f;
- self.separatorUpperView.alpha = 1.0f;
- //HIDE "Decline or Accept"
- self.leftOptionView.alpha = 0.0;
- self.rightOptionView.alpha = 0.0;
- self.separatorMidView.alpha = 0.0;
- self.leftOptionButton.alpha = 0.0;
- self.rightOptionButton.alpha = 0.0;
- }
- else if(self.paymentConfirmationNewViewStatusOrActionType == PaymentConfirmationNewViewStatusOrActionTypeExpert) {
- //IF EXPERT SHOW "Decline or Accept"
- self.leftOptionView.alpha = 1.0;
- self.rightOptionView.alpha = 1.0;
- self.separatorUpperView.alpha = 1.0f;
- self.separatorMidView.alpha = 1.0;
- self.leftOptionButton.alpha = 1.0;
- self.rightOptionButton.alpha = 1.0;
- //HIDE "Waiting Confirmation"
- self.statusConfirmationView.alpha = 0.0f;
- }
- }
- //DISPLAY AND HIDE PaymentConfirmationItemView
- /*
- //if there's no payment confirmation (must check USER/EXPERT)
- //Hide the button if Expert
- self.paymentConfirmationItemView.alpha = 0.0f;
- //self.createConfirmationContainerView.alpha = 1.0f;
- [self setPaymentConfirmationNewViewButtonType:PaymentConfirmationNewViewButtonTypeUser];
- [self setPaymentConfirmationNewViewButtonType:PaymentConfirmationNewViewButtonTypeExpert];
- //if theres payment confirmation (must check USER/EXPERT)
- //Hide the button if Expert
- self.paymentConfirmationItemView.alpha = 1.0f;
- //self.createConfirmationContainerView.alpha = 1.0f;
- [self setPaymentConfirmationNewViewButtonType:PaymentConfirmationNewViewButtonTypeUser];
- [self setPaymentConfirmationNewViewButtonType:PaymentConfirmationNewViewButtonTypeExpert];
- */
- - (void)setPaymentConfirmationNewViewValueType:(PaymentConfirmationNewViewValueType)paymentConfirmationNewViewValueType {
- _paymentConfirmationNewViewValueType = paymentConfirmationNewViewValueType;
- if(self.paymentConfirmationNewViewValueType == PaymentConfirmationNewViewValueTypeEmptyPaymentConfirmation) {
- //if there's no payment confirmation (must check USER/EXPERT)
- //Hide the button if Expert
- self.paymentConfirmationItemView.alpha = 0.0f;
- //self.createConfirmationContainerView.alpha = 1.0f;
- //[self setPaymentConfirmationNewViewButtonType:PaymentConfirmationNewViewButtonTypeUser];
- //[self setPaymentConfirmationNewViewButtonType:PaymentConfirmationNewViewButtonTypeExpert];
- }
- else if (self.paymentConfirmationNewViewValueType == PaymentConfirmationNewViewValueTypeHavePaymentConfirmation) {
- //if there're payment confirmation (must check USER/EXPERT)
- //Hide the button if Expert
- self.paymentConfirmationItemView.alpha = 1.0f;
- //self.createConfirmationContainerView.alpha = 1.0f;
- //[self setPaymentConfirmationNewViewButtonType:PaymentConfirmationNewViewButtonTypeUser];
- //[self setPaymentConfirmationNewViewButtonType:PaymentConfirmationNewViewButtonTypeExpert];
- }
- }
- - (void)setTotalPriceNumberWithTotalPrice:(NSString *)totalPrice {
- //set totalPriceNumberLabel;
- self.totalPriceNumberLabel.text = totalPrice;
- }
- - (void)setPaymentConfirmationItemWithImageUrl:(NSString *)imageURL
- dateTimeConfirmation:(NSString *)dateTimeConfirmation
- totalPrice:(NSString *)totalPrice
- bankAccountTransferDestination:(NSString *)bankAccountTransferDestination
- bankAccountUsernameTransferDestination:(NSString *)bankAccountUsernameTransferDestination
- bankAccountSender:(NSString *)bankAccountSender
- bankAccountUsernameSender:(NSString *)bankAccountUsernameSender {
- //set Data for PaymentConfirmationItem
- self.paymentConfirmationItemImageView.image = [UIImage imageNamed:imageURL];
- self.paymentConfirmationItemDatetimeLabel.text = dateTimeConfirmation;
- self.paymentConfirmationItemPriceLabel.text = totalPrice;
- self.bankAccountTransferDestinationLabel.text = bankAccountTransferDestination;
- self.bankAccountUsernameTransferDestinationLabel.text = bankAccountUsernameTransferDestination;
- self.bankAccountSenderLabel.text = bankAccountSender;
- self.bankAccountUsernameSenderLabel.text = bankAccountUsernameSender;
- //BANK ACC DESTINATION
- CGSize bankAccountTransferDestinationLabelSize = [self.bankAccountTransferDestinationLabel sizeThatFits:CGSizeMake(CGRectGetWidth(self.paymentConfirmationItemView.frame) - 17.0f - 17.0f - 18.0f - 17.0f, CGFLOAT_MAX)];
- self.bankAccountTransferDestinationLabel.frame = CGRectMake(CGRectGetMaxX(self.iconTransferDestinationImageView.frame) + 18.0f, CGRectGetMinY(self.iconTransferDestinationImageView.frame), CGRectGetWidth(self.paymentConfirmationItemView.frame) - 17.0f - 17.0f - 18.0f - 17.0f, bankAccountTransferDestinationLabelSize.height);
- //BANK USERNAME DESTINATION
- CGSize bankAccountUsernameTransferDestinationLabelSize = [self.bankAccountUsernameTransferDestinationLabel sizeThatFits:CGSizeMake(CGRectGetWidth(self.paymentConfirmationItemView.frame) - 17.0f - 17.0f - 18.0f - 17.0f, CGFLOAT_MAX)];
- self.bankAccountUsernameTransferDestinationLabel.frame = CGRectMake(CGRectGetMaxX(self.iconTransferDestinationImageView.frame) + 18.0f, CGRectGetMaxY(self.bankAccountTransferDestinationLabel.frame) + 3.0f, CGRectGetWidth(self.paymentConfirmationItemView.frame) - 17.0f - 17.0f - 18.0f - 17.0f, bankAccountUsernameTransferDestinationLabelSize.height);
- //BANK ACC ICON SENDER
- self.iconSenderImageView.frame = CGRectMake(CGRectGetMinX(self.iconSenderImageView.frame), CGRectGetMaxY(self.bankAccountUsernameTransferDestinationLabel.frame) + 16.0f, CGRectGetWidth(self.iconSenderImageView.frame), CGRectGetHeight(self.iconSenderImageView.frame));
- //BANK ACC SENDER
- CGSize bankAccountSenderLabelSize = [self.bankAccountSenderLabel sizeThatFits:CGSizeMake(CGRectGetWidth(self.paymentConfirmationItemView.frame) - 14.0f - 20.0f - 15.0f - 17.0f, CGFLOAT_MAX)];
- self.bankAccountSenderLabel.frame = CGRectMake(CGRectGetMaxX(self.iconSenderImageView.frame) + 15.0f, CGRectGetMinY(self.iconSenderImageView.frame) - 0.5f, CGRectGetWidth(self.paymentConfirmationItemView.frame) - 14.0f - 20.0f - 15.0f - 17.0f, bankAccountSenderLabelSize.height);
- //BANK USERNAMER SENDER
- CGSize bankAccountUsernameSenderLabelSize = [self.bankAccountUsernameSenderLabel sizeThatFits:CGSizeMake(CGRectGetWidth(self.paymentConfirmationItemView.frame) - 14.0f - 20.0f - 15.0f - 17.0f, CGFLOAT_MAX)];
- self.bankAccountUsernameSenderLabel.frame = CGRectMake(CGRectGetMaxX(self.iconSenderImageView.frame) + 15.0f, CGRectGetMaxY(self.bankAccountSenderLabel.frame) + 3.0f, CGRectGetWidth(self.paymentConfirmationItemView.frame) - 14.0f - 20.0f - 15.0f - 17.0f, bankAccountUsernameSenderLabelSize.height);
- //Update PaymenConfirmationItemContainer
- self.paymentConfirmationItemView.frame = CGRectMake(16.0f, 16.0f, CGRectGetWidth(self.paymentConfirmationContainerView.frame) - 16.0 - 16.0f, CGRectGetMaxY(self.bankAccountUsernameSenderLabel.frame) + 45.0f + 22.0f);
- //FOR USER "WAITING CONFIRMATION"
- self.statusConfirmationView.frame = CGRectMake(0.0f, CGRectGetHeight(self.paymentConfirmationItemView.frame) - 45.0f, CGRectGetWidth(self.paymentConfirmationItemView.frame), 45.0f);
- //UpperSeparatorView
- self.separatorUpperView.frame = CGRectMake(0.0f, CGRectGetMinY(self.statusConfirmationView.frame) - [Util lineMinimumHeight], CGRectGetWidth(self.paymentConfirmationItemView.frame), [Util lineMinimumHeight]);
- //FOR EXPERT options "Decline | Accept"
- //LEFT OPTION (DECLINE)
- self.leftOptionView.frame = CGRectMake(0.0f, CGRectGetHeight(self.paymentConfirmationItemView.frame) - 45.0f, CGRectGetWidth(self.paymentConfirmationItemView.frame)/2.0f, 45.0f);
- //RIGHT OPTION VIEW (ACCEPT)
- self.rightOptionView.frame = CGRectMake(CGRectGetMaxX(self.leftOptionView.frame), CGRectGetMinY(self.leftOptionView.frame), CGRectGetWidth(self.paymentConfirmationItemView.frame)/2.0f, CGRectGetHeight(self.leftOptionView.frame));
- //separator Mid
- self.separatorMidView.frame = CGRectMake(CGRectGetMaxX(self.leftOptionView.frame), CGRectGetMinY(self.leftOptionView.frame), [Util lineMinimumHeight], CGRectGetHeight(self.leftOptionView.frame));
- //SeparatorUpper
- self.separatorUpperView.frame = CGRectMake(0.0f, CGRectGetMinY(self.leftOptionView.frame) - [Util lineMinimumHeight], CGRectGetWidth(self.paymentConfirmationItemView.frame), [Util lineMinimumHeight]);
- //LeftButton
- self.leftOptionButton.frame = CGRectMake(0.0f, CGRectGetHeight(self.paymentConfirmationItemView.frame) - 45.0f, CGRectGetWidth(self.paymentConfirmationItemView.frame)/2.0f, 45.0f);
- //RightBUtton
- self.rightOptionButton.frame = CGRectMake(CGRectGetMaxX(self.leftOptionView.frame), CGRectGetMinY(self.leftOptionView.frame), CGRectGetWidth(self.paymentConfirmationItemView.frame)/2.0f, CGRectGetHeight(self.leftOptionView.frame));
- //update paymenconfirmationcontainer
- self.paymentConfirmationContainerView.frame = CGRectMake(0.0f, CGRectGetMaxY(self.separator1View.frame), CGRectGetWidth(self.scrollView.frame), CGRectGetMaxY(self.paymentConfirmationItemView.frame) + 40.0f);
- //UPDATE SCROLLVIEW CONTENTSIZE
- self.scrollView.contentSize = CGSizeMake(CGRectGetWidth(self.scrollView.frame), CGRectGetMaxY(self.paymentConfirmationContainerView.frame) + 60.0f );
- }
- @end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement