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.

47 lines
1.6 KiB

6 years ago
6 years ago
  1. //
  2. // TransactionHistoryTableViewCell.swift
  3. // GMERemittance
  4. //
  5. // Created by gme_2 on 28/09/2018.
  6. // Copyright © 2018 Gobal Money Express Co. Ltd. All rights reserved.
  7. //
  8. import UIKit
  9. class TransactionHistoryTableViewCell: UITableViewCell {
  10. enum Status: String {
  11. case paid = "paid"
  12. case unpaid = "unpaid"
  13. }
  14. @IBOutlet weak var bgView: UIView!
  15. @IBOutlet weak var dateLabel: UILabel!
  16. @IBOutlet weak var amountLabel: UILabel!
  17. @IBOutlet weak var paymentMethodLabel: UILabel!
  18. @IBOutlet weak var nameLabel: UILabel!
  19. @IBOutlet weak var transactionNumberLabel: UILabel!
  20. @IBOutlet weak var controlNumberLabel: UILabel!
  21. var model: TransactionModel?
  22. override func awakeFromNib() {
  23. super.awakeFromNib()
  24. // Initialization code
  25. }
  26. func setup() {
  27. self.dateLabel.text = model?.sendDate
  28. self.amountLabel.text = (model?.pAmt ?? "") + " " + (model?.pCurrency ?? "")
  29. self.paymentMethodLabel.text = model?.payOutMode
  30. self.nameLabel.text = model?.user
  31. let paystatus = model?.payStatus ?? ""
  32. self.transactionNumberLabel.text = paystatus.uppercased() // show pay status, paid or unpaid
  33. self.transactionNumberLabel.textColor = .white
  34. self.transactionNumberLabel.layer.cornerRadius = 5
  35. self.controlNumberLabel.text = self.model?.controlNumber
  36. let status = Status.init(rawValue: paystatus.lowercased()) ?? .unpaid
  37. self.transactionNumberLabel.backgroundColor = status == .paid ? AppConstants.themeBlueColor : AppConstants.themeRedColor
  38. }
  39. }