//
//  MyOrderDetailsCell.swift
//  WOKA
//
//  Created by MacBook Pro on 08/08/24.
//

import UIKit

class MyOrderDetailsCell: UITableViewCell {

    @IBOutlet weak var detailDate: UILabel!
    @IBOutlet weak var detailTime: UILabel!
    @IBOutlet weak var remarks: UILabel!
    @IBOutlet weak var location: UILabel!
    
    override func awakeFromNib() {
        super.awakeFromNib()
        // Initialization code
    }

    override func setSelected(_ selected: Bool, animated: Bool) {
        super.setSelected(selected, animated: animated)

    }
    
    func setData(data : OrderDetailsDM.ScanDetail){
        self.remarks.text = "Order " + (data.remarks ?? "NA")
        self.location.text = "Arrived at " + (data.location ?? "NA")
        
        if let updateDate = data.updatedDate , let formattedDate = DateFormatterLib.dateMods(dateStr: updateDate, dateCurrentFormat: .yyyy_MM_dd_HH_mm_ss, dateReturnFormat: .d__MM, stringOrDate: .string).0{
            self.detailDate.text = formattedDate
        }
        
        if let updateTime = data.updatedDate , let formattedDate = DateFormatterLib.dateMods(dateStr: updateTime, dateCurrentFormat: .yyyy_MM_dd_HH_mm_ss, dateReturnFormat: .h_mm_a, stringOrDate: .string).0{
            self.detailTime.text = formattedDate
        }
    }
    
}
