<commit_before>//
//  TeacherDetailsController.swift
//  mala-ios
//
//  Created by Elors on 12/30/15.
//  Copyright © 2015 Mala Online. All rights reserved.
//

import UIKit

private let TeacherDetailsCellReuseId = [
    0: "TeacherDetailsSubjectCellReuseId",
    1: "TeacherDetailsTagsCellReuseId",
    2: "TeacherDetailsHighScoreCellReuseId",
    3: "TeacherDetailsPhotosCellReuseId",
    4: "TeacherDetailsCertificateCellReuseId",
    5: "TeacherDetailsPlaceCellReuseId",
    6: "TeacherDetailsVipServiceCellReuseId",
    7: "TeacherDetailsLevelCellReuseId",
//    8: "TeacherDetailsPriceCellReuseId"
]

class TeacherDetailsController: UIViewController, UIGestureRecognizerDelegate, UITableViewDelegate, UITableViewDataSource, SignupButtonDelegate {

    // MARK: - Property
    var teacherID: Int = 0
    var model: TeacherDetailModel = MalaConfig.defaultTeacherDetail() {
        didSet {
            self.tableHeaderView.avatar = model.avatar ?? ""
            self.tableHeaderView.name = model.name  ?? "----"
            self.tableHeaderView.gender = model.gender ?? "m"
            self.tableHeaderView.minPrice = model.min_price
            self.tableHeaderView.maxPrice = model.max_price
            self.tableView.reloadData()
        }
    }
    var schoolArray: [SchoolModel] = [] {
        didSet {
            // 刷新 [教学环境] Cell
            self.tableView.reloadSections(NSIndexSet(index: 5), withRowAnimation: .None)
        }
    }
    var memberServiceArray: [MemberServiceModel] = [] {
        didSet {
            // 刷新 [会员服务] Cell
            self.tableView.reloadSections(NSIndexSet(index: 6), withRowAnimation: .None)
        }
    }
    var isOpenSchoolsCell: Bool = false
    var isNavigationBarShow: Bool = false

    
    // MARK: - Components
    /// 主体TableView
    private lazy var tableView: UITableView = {
        let tableView = UITableView(frame: CGRect(x: 0, y: 0, width: MalaScreenWidth, height: MalaScreenHeight - MalaLayout_DetailBottomViewHeight), style: .Grouped)
        tableView.contentInset = UIEdgeInsets(top: MalaLayout_DetailBottomViewHeight, left: 0, bottom: -20, right: 0)
        return tableView
    }()
    /// TableView头部视图
    private lazy var tableHeaderView: TeacherDetailsHeaderView = {
        let tableHeaderView = TeacherDetailsHeaderView(frame: CGRect(x: 0, y: 0, width: MalaScreenWidth, height: MalaLayout_DetailHeaderHeight))
        tableHeaderView.avatar = ""
        tableHeaderView.name = "----"
        tableHeaderView.gender = "m"
        return tableHeaderView
    }()
    /// 顶部背景图
    private lazy var headerBackground: UIImageView = {
        let image = UIImageView(image: UIImage(named: "headerBackground"))
        image.contentMode = .ScaleAspectFill
        return image
    }()
    /// 底部 [立即报名] 按钮
    private lazy var signupView: TeacherDetailsSignupView = {
        let signupView = TeacherDetailsSignupView(frame: CGRect(x: 0, y: 0,<commit_msg>IOS-169 fix TeacherDetailTableView ContentInset Bottom to close<commit_after>//
//  TeacherDetailsController.swift
//  mala-ios
//
//  Created by Elors on 12/30/15.
//  Copyright © 2015 Mala Online. All rights reserved.
//

import UIKit

private let TeacherDetailsCellReuseId = [
    0: "TeacherDetailsSubjectCellReuseId",
    1: "TeacherDetailsTagsCellReuseId",
    2: "TeacherDetailsHighScoreCellReuseId",
    3: "TeacherDetailsPhotosCellReuseId",
    4: "TeacherDetailsCertificateCellReuseId",
    5: "TeacherDetailsPlaceCellReuseId",
    6: "TeacherDetailsVipServiceCellReuseId",
    7: "TeacherDetailsLevelCellReuseId",
//    8: "TeacherDetailsPriceCellReuseId"
]

class TeacherDetailsController: UIViewController, UIGestureRecognizerDelegate, UITableViewDelegate, UITableViewDataSource, SignupButtonDelegate {

    // MARK: - Property
    var teacherID: Int = 0
    var model: TeacherDetailModel = MalaConfig.defaultTeacherDetail() {
        didSet {
            self.tableHeaderView.avatar = model.avatar ?? ""
            self.tableHeaderView.name = model.name  ?? "----"
            self.tableHeaderView.gender = model.gender ?? "m"
            self.tableHeaderView.minPrice = model.min_price
            self.tableHeaderView.maxPrice = model.max_price
            self.tableView.reloadData()
        }
    }
    var schoolArray: [SchoolModel] = [] {
        didSet {
            // 刷新 [教学环境] Cell
            self.tableView.reloadSections(NSIndexSet(index: 5), withRowAnimation: .None)
        }
    }
    var memberServiceArray: [MemberServiceModel] = [] {
        didSet {
            // 刷新 [会员服务] Cell
            self.tableView.reloadSections(NSIndexSet(index: 6), withRowAnimation: .None)
        }
    }
    var isOpenSchoolsCell: Bool = false
    var isNavigationBarShow: Bool = false

    
    // MARK: - Components
    /// 主体TableView
    private lazy var tableView: UITableView = {
        let tableView = UITableView(frame: CGRect(x: 0, y: 0, width: MalaScreenWidth, height: MalaScreenHeight - MalaLayout_DetailBottomViewHeight), style: .Grouped)
        tableView.contentInset = UIEdgeInsets(top: MalaLayout_DetailBottomViewHeight, left: 0, bottom: 0, right: 0)
        return tableView
    }()
    /// TableView头部视图
    private lazy var tableHeaderView: TeacherDetailsHeaderView = {
        let tableHeaderView = TeacherDetailsHeaderView(frame: CGRect(x: 0, y: 0, width: MalaScreenWidth, height: MalaLayout_DetailHeaderHeight))
        tableHeaderView.avatar = ""
        tableHeaderView.name = "----"
        tableHeaderView.gender = "m"
        return tableHeaderView
    }()
    /// 顶部背景图
    private lazy var headerBackground: UIImageView = {
        let image = UIImageView(image: UIImage(named: "headerBackground"))
        image.contentMode = .ScaleAspectFill
        return image
    }()
    /// 底部 [立即报名] 按钮
    private lazy var signupView: TeacherDetailsSignupView = {
        let signupView = TeacherDetailsSignupView(frame: CGRect(x: 0, y: 0,
{'fraction_non_alphanumeric': 0.09989840839823907, 'fraction_numerical': 0.011175076193701321, 'mean_word_length': 2.9406270847231486, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4665644', 'n_tokens_mistral': 1902, 'n_tokens_neox': 1811, 'n_words': 375}