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.9 KiB

6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
  1. //
  2. // WalletStatementTableViewCell.swift
  3. // GMERemittance
  4. //
  5. // Created by gme_2 on 03/10/2018.
  6. // Copyright © 2018 Gobal Money Express Co. Ltd. All rights reserved.
  7. //
  8. import UIKit
  9. class WalletStatementTableViewCell: UITableViewCell {
  10. enum WalletInOutType: String {
  11. case walletIn = "WalletIn"
  12. case walletOut = "WalletOut"
  13. case closingAmount = "ClosingAmount"
  14. }
  15. @IBOutlet weak var dateLabel: UILabel!
  16. @IBOutlet weak var particularLabel: UILabel!
  17. @IBOutlet weak var closingAmountLabel: UILabel!
  18. @IBOutlet weak var amtLabelStackView: UIStackView!
  19. @IBOutlet weak var walletAmountLabel: UILabel!
  20. var model: WalletStatement?
  21. func getType() -> WalletInOutType {
  22. if (model?.particular ?? "").lowercased() == "Balance Brought Forward".lowercased() {
  23. return .closingAmount
  24. }
  25. return (model?.walletOut ?? "") == "₩0" ? .walletIn : .walletOut
  26. }
  27. func setup() {
  28. self.dateLabel.text = model?.transactionDate
  29. self.particularLabel.text = model?.particular
  30. self.closingAmountLabel.text = model?.closingAmount
  31. let type: WalletInOutType = getType()
  32. self.walletAmountLabel.layer.cornerRadius = 4
  33. self.walletAmountLabel.clipsToBounds = true
  34. walletAmountLabel.textColor = .white
  35. switch type {
  36. case .walletIn:
  37. self.walletAmountLabel.backgroundColor = AppConstants.themeBlueColor
  38. self.walletAmountLabel.text = "IN: \(self.model?.walletIn ?? "")"
  39. case .walletOut:
  40. self.walletAmountLabel.backgroundColor = AppConstants.themeRedColor
  41. self.walletAmountLabel.text = "OUT: \(model?.walletOut ?? "")"
  42. case .closingAmount:
  43. self.walletAmountLabel.text = ""
  44. self.walletAmountLabel.backgroundColor = AppConstants.themWhiteColor
  45. }
  46. }
  47. }