WalletActiveCouponCollectionViewCell.swift 2.54 KB
//
//  WalletActiveCouponCollectionViewCell.swift
//  SwiftWarplyFramework
//
//  Created by Manos Chorianopoulos on 8/5/24.
//

import UIKit

@objc public class WalletActiveCouponCollectionViewCell: UICollectionViewCell {
    @IBOutlet weak var badgeViewParent: UIView!
    @IBOutlet weak var badgeView: UIView!
    @IBOutlet weak var badgeImage: UIImageView!
    @IBOutlet weak var badgeLabel: UILabel!
    @IBOutlet weak var badgeCountView: UIView!
    @IBOutlet weak var badgeCountLabel: UILabel!
    
    public override func awakeFromNib() {
        super.awakeFromNib()
        
        // Badge Banner
//        badgeViewParent.backgroundColor = UIColor(red: 0.95, green: 0.95, blue: 0.95, alpha: 1.00)
        badgeViewParent.backgroundColor = .white
        badgeViewParent.layer.cornerRadius = 16.0
        badgeViewParent.layer.shadowColor = UIColor(red: 0.00, green: 0.00, blue: 0.00, alpha: 0.2).cgColor
        badgeViewParent.layer.shadowOffset = CGSize(width: 0.0, height: 1.0)
        badgeViewParent.layer.shadowOpacity = 1.0
        badgeViewParent.layer.shadowRadius = 2.0
        
//        badgeView.backgroundColor = UIColor(red: 0.46, green: 0.75, blue: 0.45, alpha: 0.05)
        badgeView.backgroundColor = .white
        badgeView.layer.cornerRadius = 16.0
        
        badgeCountView.layer.cornerRadius = 4.0
        badgeCountView.backgroundColor = UIColor(red: 0.92, green: 0.75, blue: 0.41, alpha: 1.00)
    }

    func configureCell(badgeId: String, badgeCount: Int) {
        if (badgeId == "dfy") {
            badgeImage.image = UIImage(named: "wallet_banner_dfy", in: MyEmptyClass.resourceBundle(), compatibleWith: nil)
            badgeLabel.text = "DEALS FOR YOU"
            badgeCountView.isHidden = false
            
        } else if (badgeId == "sm") {
            badgeImage.image = UIImage(named: "wallet_banner_sm", in: MyEmptyClass.resourceBundle(), compatibleWith: nil)
            badgeLabel.text = "SUPERMARKET DEALS"
            badgeCountView.isHidden = false
            
        } else if (badgeId == "gfy") {
            badgeImage.image = UIImage(named: "wallet_banner_gfy", in: MyEmptyClass.resourceBundle(), compatibleWith: nil)
            badgeLabel.text = "FREE COUPONS"
            badgeCountView.isHidden = false
            
        } else if (badgeId == "box") {
            badgeImage.image = UIImage(named: "wallet_banner_box", in: MyEmptyClass.resourceBundle(), compatibleWith: nil)
            badgeLabel.text = "BOX"
            badgeCountView.isHidden = true
        }

        badgeCountLabel.text = String(badgeCount)
    }
}