Blame view
App/listCtruong/VCShootItemList.swift
2.88 KB
|
1341bf603
|
1 2 |
import UIKit import GeneralUtils |
|
fbd62afcf
|
3 |
import Alamofire |
|
1341bf603
|
4 5 6 7 8 |
class VCShootItemList: UIViewController, IVCLoadDataTableViewUIThread {
@IBOutlet weak var topMargin: NSLayoutConstraint!
@IBOutlet weak var tableView: UITableViewLoadDataFromUIThread!
@IBOutlet weak var imvLogo: UIImageView!
|
|
defd9642e
|
9 |
@IBOutlet weak var tvTitle: UILabel! |
|
fbd62afcf
|
10 |
weak var tableViewListCtruong: UITableViewLoadDataFromUIThread? |
|
1341bf603
|
11 12 |
var cTruong: CongTruong!
|
|
fbd62afcf
|
13 |
static func openController(_ viewController: UIViewController, cTruong: CongTruong, tableViewListCtruong: UITableViewLoadDataFromUIThread?) {
|
|
1341bf603
|
14 15 16 |
let storyboard: UIStoryboard = UIStoryboard(name: "Main", bundle: nil)
let vcOpen = storyboard.instantiateViewController(withIdentifier: "VCShootItemList") as! VCShootItemList
vcOpen.cTruong = cTruong
|
|
fbd62afcf
|
17 |
vcOpen.tableViewListCtruong = tableViewListCtruong; |
|
1341bf603
|
18 19 20 21 22 |
viewController.present(vcOpen, animated: true, completion: nil)
}
override func viewDidLoad() {
super.viewDidLoad()
|
|
defd9642e
|
23 |
tableView.emptyText = LocalizedString("empty_muc_chup")
|
|
1341bf603
|
24 25 26 27 28 29 30 |
CellMucChupWithCamera.registerClass(tableView: tableView, forCellReuseIdentifier: "CellMucChupWithCamera")
self.tableView.separatorStyle = UITableViewCellSeparatorStyle.singleLine
self.tableView.rowHeight = UITableViewAutomaticDimension
self.tableView.estimatedRowHeight = 150
let tap = UITapGestureRecognizer.init(target: self, action: #selector(VCShootItemList.logoClick))
imvLogo.addGestureRecognizer(tap)
tableView.initAndLoadData(self)
|
|
defd9642e
|
31 |
tvTitle.text = cTruong.constructionName |
|
1341bf603
|
32 33 34 |
}
@IBAction func btnEditClick(_ sender: Any) {
|
|
fbd62afcf
|
35 |
VcEdit.openController(self, cTruong: self.cTruong, tableViewListCtruong: self.tableViewListCtruong, vcShootItemList: self) |
|
1341bf603
|
36 37 38 39 40 |
}
//region ============== TableView Data =========
func loadDataOnUI(complete: @escaping ([Any]?) -> ()) {
|
|
defd9642e
|
41 42 43 44 45 46 47 48 49 50 51 |
guard let shootItems = cTruong.shootItems else {
complete(nil)
return
}
var shootItemsWillShoot = [ShootItem]()
for item in shootItems {
if let willShoot = item.willShoot, willShoot > 0 {
shootItemsWillShoot.append(item)
}
}
complete(shootItemsWillShoot)
|
|
1341bf603
|
52 53 54 55 56 57 58 59 60 61 62 63 64 |
}
func getAllCell() -> [BaseCell] {
var baseCells: [BaseCell] = [BaseCell]();
baseCells.append(BaseCell(type: 0, identifier: "CellMucChupWithCamera"))
return baseCells
}
func getTypeOfData(baseobj: Any) -> Int {
return 0
}
func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
|
|
1341bf603
|
65 |
} |
|
1341bf603
|
66 |
//endregion |
|
7b7581e89
|
67 |
|
|
1341bf603
|
68 69 70 71 72 73 74 75 76 |
override var prefersStatusBarHidden: Bool {
return true
}
override open var supportedInterfaceOrientations: UIInterfaceOrientationMask {
return UIInterfaceOrientationMask.portrait
}
func logoClick() {
dismiss(animated: true)
}
|
|
fbd62afcf
|
77 |
|
|
1341bf603
|
78 |
} |