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

5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
  1. //
  2. // InboundAccountCell.swift
  3. // GME Remit
  4. //
  5. // Created by InKwon James Kim on 2019/11/12.
  6. // Copyright © 2019 Gobal Money Express Co. Ltd. All rights reserved.
  7. //
  8. import UIKit
  9. protocol InboundAccountCellDelegate: class {
  10. func penneyTest(of model: InboundAccount?)
  11. func delete(of model: InboundAccount?)
  12. }
  13. class InboundAccountCell: UITableViewCell {
  14. @IBOutlet private weak var accountNameLabel: UILabel!
  15. @IBOutlet private weak var accountNumberLabel: UILabel!
  16. @IBOutlet private weak var warningButton: UIButton!
  17. @IBOutlet private weak var deleteButton: UIButton!
  18. @IBOutlet private weak var bankImageView: UIImageView!
  19. private var model: InboundAccount?
  20. weak var delegate: InboundAccountCellDelegate?
  21. func setModel(with model: InboundAccount?) {
  22. self.model = model
  23. accountNameLabel.text = model?.bankName
  24. accountNumberLabel.text = model?.accountNo
  25. warningButton.isHidden = false
  26. deleteButton.isHidden = false
  27. DispatchQueue.main.async {[weak self] in
  28. if model?.isPennyTestSuccess ?? false {
  29. self?.warningButton.isHidden = true
  30. }
  31. if model?.isPrimary ?? false {
  32. self?.warningButton.isHidden = true
  33. self?.deleteButton.isHidden = true
  34. }
  35. }
  36. bankImageView.image = BankEnum(rawValue: model?.bankCode ?? "")?.ciImage ?? UIImage(named: "ic_add")
  37. }
  38. @IBAction func touchDelete(_ sender: UIButton) {
  39. delegate?.delete(of: model)
  40. }
  41. @IBAction func touchPenneyTest(_ sender: UIButton) {
  42. delegate?.penneyTest(of: model)
  43. }
  44. }