AnalysisHeaderMessageViewCell.swift 1.61 KB
//
//  AnalysisHeaderMessageViewCell.swift
//  SwiftWarplyFramework
//
//  Created by Manos Chorianopoulos on 18/7/22.
//

import UIKit

class AnalysisHeaderMessageViewCell: UITableViewCell {

    // attributes
    @IBOutlet weak var itemImage: UIImageView!
    @IBOutlet weak var messageLabel: UILabel!
    @IBOutlet weak var titleLabel: UILabel!
    
    public var loyaltyBadge:swiftApi.LoyaltyBadgeModel = swiftApi().getLoyaltyBadge()
    
    // lifecycle
    override func awakeFromNib() {
        super.awakeFromNib()
        
        // image
        itemImage.image = UIImage(named: "ic_gift_circle", in: Bundle(for: MyEmptyClass.self), compatibleWith: nil)
        
        // title
        titleLabel.textColor = UIColor(rgb: 0x435563)
        titleLabel.text = "Αναλυτικά:"
        
        // message
        messageLabel.textColor = UIColor(rgb: 0x435563)
        messageLabel.layer.borderWidth = 1.0
        messageLabel.layer.borderColor = UIColor(rgb: 0xB2CE69).cgColor
        
        let totalCouponDiscount = Float(round(100 * loyaltyBadge._value) / 100)
        var totalCouponDiscountString = "0"
        totalCouponDiscountString  = String(format: "%.2f", totalCouponDiscount).replacingOccurrences(of: ".", with: ",", options: .literal, range: nil)
        
        messageLabel.text = "Μέχρι τώρα έχεις κερδίσει " + totalCouponDiscountString + "€ σε προσφορές από " + String(loyaltyBadge._couponCount) + " κουπόνια!"
    }
}

extension AnalysisHeaderMessageViewCell {
    func configureCell(item: AnalysisItem) {
        
        // TODO: TO BE IMPLEMENTED
    }
}