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
60 lines
1.9 KiB
//
|
|
// WalletStatementTableViewCell.swift
|
|
// GMERemittance
|
|
//
|
|
// Created by gme_2 on 03/10/2018.
|
|
// Copyright © 2018 Gobal Money Express Co. Ltd. All rights reserved.
|
|
//
|
|
|
|
import UIKit
|
|
|
|
class WalletStatementTableViewCell: UITableViewCell {
|
|
|
|
enum WalletInOutType: String {
|
|
case walletIn = "WalletIn"
|
|
case walletOut = "WalletOut"
|
|
case closingAmount = "ClosingAmount"
|
|
}
|
|
|
|
@IBOutlet weak var dateLabel: UILabel!
|
|
@IBOutlet weak var particularLabel: UILabel!
|
|
@IBOutlet weak var closingAmountLabel: UILabel!
|
|
@IBOutlet weak var amtLabelStackView: UIStackView!
|
|
|
|
@IBOutlet weak var walletAmountLabel: UILabel!
|
|
|
|
var model: WalletStatement?
|
|
|
|
func getType() -> WalletInOutType {
|
|
if (model?.particular ?? "").lowercased() == "Balance Brought Forward".lowercased() {
|
|
return .closingAmount
|
|
}
|
|
return (model?.walletOut ?? "") == "₩0" ? .walletIn : .walletOut
|
|
}
|
|
|
|
func setup() {
|
|
self.dateLabel.text = model?.transactionDate
|
|
self.particularLabel.text = model?.particular
|
|
self.closingAmountLabel.text = model?.closingAmount
|
|
|
|
|
|
|
|
let type: WalletInOutType = getType()
|
|
|
|
self.walletAmountLabel.layer.cornerRadius = 4
|
|
self.walletAmountLabel.clipsToBounds = true
|
|
walletAmountLabel.textColor = .white
|
|
|
|
switch type {
|
|
case .walletIn:
|
|
self.walletAmountLabel.backgroundColor = AppConstants.themeBlueColor
|
|
self.walletAmountLabel.text = "IN: \(self.model?.walletIn ?? "")"
|
|
case .walletOut:
|
|
self.walletAmountLabel.backgroundColor = AppConstants.themeRedColor
|
|
self.walletAmountLabel.text = "OUT: \(model?.walletOut ?? "")"
|
|
case .closingAmount:
|
|
self.walletAmountLabel.text = ""
|
|
self.walletAmountLabel.backgroundColor = AppConstants.themWhiteColor
|
|
}
|
|
}
|
|
}
|