//
//  YourOrderVC.swift
//  OrderPicky
//
//  Created by ANGEL FS on 10/02/22.
//

import UIKit

class YourOrderVC: UIViewController {

    @IBOutlet weak var orderDetailTable: UITableView!
    @IBOutlet weak var deliverToView: UIView!
    
    override func viewDidLoad() {
        super.viewDidLoad()

        self.viewLoadingProperties()
        
    }
    
    @IBAction func backBtnTapped(_ sender: Any) {
        self.navigationController?.popViewController(animated: true)
    }
    
    @IBAction func payBtnTapped(_ sender: Any) {
        let nextVC = self.storyboard?.instantiateViewController(withIdentifier: "storeList")as! StoreListVC
        self.navigationController?.pushViewController(nextVC, animated: true)
    }
    
}

extension YourOrderVC
{
    func viewLoadingProperties()
    {
        self.orderDetailTable.register(UINib(nibName: "OrderDetailTVC", bundle: nil), forCellReuseIdentifier: "orderDetail")
        self.deliverToView.dropShadow()
    }
}

extension YourOrderVC : UITableViewDelegate , UITableViewDataSource
{
    func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
        return 5
    }
    
    func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
        let cell = tableView.dequeueReusableCell(withIdentifier: "orderDetail")as! OrderDetailTVC
        if indexPath.row == 4
        {
            cell.addItemView.isHidden = false
        }
        else
        {
            cell.addItemView.isHidden = true
        }
        return cell
    }
    
    func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
        return 75
    }
    
}
