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.

53 lines
1.6 KiB

  1. //
  2. // CouponBoxTableViewCell.swift
  3. // GME Remit
  4. //
  5. // Created by Jeongbae Kong on 03/12/2019.
  6. // Copyright © 2019 Gobal Money Express Co. Ltd. All rights reserved.
  7. //
  8. import UIKit
  9. class CouponBoxTableViewCell: UITableViewCell {
  10. @IBOutlet weak var couponNameLabel: UILabel!
  11. @IBOutlet weak var couponExpiryStartDateLabel: UILabel!
  12. @IBOutlet weak var couponExpiryEndDateLabel: UILabel!
  13. @IBOutlet weak var discountValueLabel: UILabel!
  14. @IBOutlet weak var cellContentView: UIView!
  15. override func awakeFromNib() {
  16. super.awakeFromNib()
  17. // Initialization code
  18. }
  19. override func setSelected(_ selected: Bool, animated: Bool) {
  20. super.setSelected(selected, animated: animated)
  21. }
  22. func couponBoxModel(with model: CouponBoxModel?) {
  23. guard let model = model else { return }
  24. cellContentView.layer.borderWidth = 1
  25. cellContentView.layer.borderColor = UIColor.gray.cgColor
  26. cellContentView.layer.cornerRadius = 5
  27. couponNameLabel.font = UIFont.sanfrancisco(.medium, size: 17)
  28. couponNameLabel.text = model.couponName
  29. couponExpiryStartDateLabel.font = UIFont.sanfrancisco(.medium, size: 17)
  30. couponExpiryStartDateLabel.text = model.buyDate
  31. couponExpiryEndDateLabel.font = UIFont.sanfrancisco(.medium, size: 17)
  32. couponExpiryEndDateLabel.text = model.expireDate
  33. discountValueLabel.font = UIFont.sanfrancisco(.medium, size: 17)
  34. if model.discountType == "1" {
  35. discountValueLabel.text = "\(model.discountValue ?? "")%"
  36. } else {
  37. discountValueLabel.text = "\(model.discountValue ?? "")KRW"
  38. }
  39. }
  40. }