//
//  OrderReviewVC.swift
//  Garmentoo
//
//  Created by Vijith on 11/04/22.
//

import UIKit

class OrderReviewVC: UIViewController {

    @IBOutlet weak var itemsTableView: UITableView!
    @IBOutlet weak var tableheight: NSLayoutConstraint!
    override func viewDidLoad() {
        super.viewDidLoad()

        // Do any additional setup after loading the view.
    }
  
    override func viewWillLayoutSubviews() {
        self.tableheight.constant = self.itemsTableView.contentSize.height
    }
    
    @IBAction func onTapBackBtn(_ sender: Any) {
        self.navigationController?.popViewController(animated: true)
    }
    
    @IBAction func OnTapPlaceOrder(_ sender: Any) {
        let sb = UIStoryboard(name: "Main", bundle: nil)
        let nextVc = sb.instantiateViewController(withIdentifier: "OrderSuccessVC")as! OrderSuccessVC
        nextVc.hidesBottomBarWhenPushed = true
        self.navigationController?.pushViewController(nextVc, animated: true)
    }
    
}
extension OrderReviewVC:UITableViewDelegate,UITableViewDataSource{
    func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
        return 3
    }
    
    func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
        let cell = tableView.dequeueReusableCell(withIdentifier: "itemcell", for: indexPath) as! OrderReviewTableViewCell
        return cell
    }
    func tableView(_ tableView: UITableView, willDisplay cell: UITableViewCell, forRowAt indexPath: IndexPath) {
        viewWillLayoutSubviews()
    }
    
    
}
