You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

60 lines
1.5 KiB

//
// InboundAccountCell.swift
// GME Remit
//
// Created by InKwon James Kim on 2019/11/12.
// Copyright © 2019 Gobal Money Express Co. Ltd. All rights reserved.
//
import UIKit
protocol InboundAccountCellDelegate: class {
func penneyTest(of model: InboundAccount?)
func delete(of model: InboundAccount?)
}
class InboundAccountCell: UITableViewCell {
@IBOutlet private weak var accountNameLabel: UILabel!
@IBOutlet private weak var accountNumberLabel: UILabel!
@IBOutlet private weak var warningButton: UIButton!
@IBOutlet private weak var deleteButton: UIButton!
@IBOutlet private weak var bankImageView: UIImageView!
private var model: InboundAccount?
weak var delegate: InboundAccountCellDelegate?
func setModel(with model: InboundAccount?) {
self.model = model
accountNameLabel.text = model?.bankName
accountNumberLabel.text = model?.accountNo
warningButton.isHidden = false
deleteButton.isHidden = false
DispatchQueue.main.async {[weak self] in
if model?.isPennyTestSuccess ?? false {
self?.warningButton.isHidden = true
}
if model?.isPrimary ?? false {
self?.warningButton.isHidden = true
self?.deleteButton.isHidden = true
}
}
bankImageView.image = BankEnum(rawValue: model?.bankCode ?? "")?.ciImage ?? UIImage(named: "ic_add")
}
@IBAction func touchDelete(_ sender: UIButton) {
delegate?.delete(of: model)
}
@IBAction func touchPenneyTest(_ sender: UIButton) {
delegate?.penneyTest(of: model)
}
}